summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-11-28 13:47:03 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-11-28 13:47:03 +0000
commitcab9e4984ef886485a179deef66ebafa436ba779 (patch)
tree60f086ce3a68ddfccf31a427bafd4cf73a6d7b87 /sys
parentf195a557c10e9e9b7e41b0cc154da9c1c72e0c09 (diff)
COMPAT_09 uname is only used by freebsd compat, so move it to the right place
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/freebsd/freebsd_misc.c45
-rw-r--r--sys/compat/freebsd/syscalls.master4
-rw-r--r--sys/kern/syscalls.master4
3 files changed, 48 insertions, 5 deletions
diff --git a/sys/compat/freebsd/freebsd_misc.c b/sys/compat/freebsd/freebsd_misc.c
index b7eb9532b57..1ee602a4fa0 100644
--- a/sys/compat/freebsd/freebsd_misc.c
+++ b/sys/compat/freebsd/freebsd_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: freebsd_misc.c,v 1.10 2007/04/05 15:33:42 tedu Exp $ */
+/* $OpenBSD: freebsd_misc.c,v 1.11 2007/11/28 13:47:02 deraadt Exp $ */
/* $NetBSD: freebsd_misc.c,v 1.2 1996/05/03 17:03:10 christos Exp $ */
/*
@@ -40,6 +40,7 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/mount.h>
+#include <sys/kernel.h>
#include <sys/file.h>
#include <sys/dirent.h>
#include <sys/filedesc.h>
@@ -179,3 +180,45 @@ freebsd_sys_mmap(struct proc *p, void *v, register_t *retval)
SCARG(uap, flags) &= ~FBSD_MAP_NOCORE;
return (sys_mmap(p, uap, retval));
}
+
+struct outsname {
+ char sysname[32];
+ char nodename[32];
+ char release[32];
+ char version[32];
+ char machine[32];
+};
+
+/* ARGSUSED */
+int
+compat_freebsd_sys_uname(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct compat_freebsd_sys_uname_args /* {
+ syscallarg(struct outsname *) name;
+ } */ *uap = v;
+ struct outsname outsname;
+ const char *cp;
+ char *dp, *ep;
+
+ strlcpy(outsname.sysname, ostype, sizeof(outsname.sysname));
+ strlcpy(outsname.nodename, hostname, sizeof(outsname.nodename));
+ strlcpy(outsname.release, osrelease, sizeof(outsname.release));
+ dp = outsname.version;
+ ep = &outsname.version[sizeof(outsname.version) - 1];
+ for (cp = version; *cp && *cp != '('; cp++)
+ ;
+ for (cp++; *cp && *cp != ')' && dp < ep; cp++)
+ *dp++ = *cp;
+ for (; *cp && *cp != '#'; cp++)
+ ;
+ for (; *cp && *cp != ':' && dp < ep; cp++)
+ *dp++ = *cp;
+ *dp = '\0';
+ strlcpy(outsname.machine, MACHINE, sizeof(outsname.machine));
+
+ return (copyout((caddr_t)&outsname, (caddr_t)SCARG(uap, name),
+ sizeof(struct outsname)));
+}
diff --git a/sys/compat/freebsd/syscalls.master b/sys/compat/freebsd/syscalls.master
index 388718b91fd..d7ef67eb5e9 100644
--- a/sys/compat/freebsd/syscalls.master
+++ b/sys/compat/freebsd/syscalls.master
@@ -1,4 +1,4 @@
- $OpenBSD: syscalls.master,v 1.31 2007/04/05 15:33:42 tedu Exp $
+ $OpenBSD: syscalls.master,v 1.32 2007/11/28 13:47:02 deraadt Exp $
; $NetBSD: syscalls.master,v 1.3 1995/10/10 18:28:40 mycroft Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -308,7 +308,7 @@
int len); }
163 NOARGS { int compat_09_sys_setdomainname(char *domainname, \
int len); }
-164 NOARGS { int compat_09_sys_uname(struct outsname *name); }
+164 STD { int compat_freebsd_sys_uname(struct outsname *name); }
165 NOARGS { int sys_sysarch(int op, char *parms); }
166 STD { int freebsd_sys_rtprio(int function, pid_t pid, \
struct freebsd_rtprio *rtp); }
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 0efaa4faa4e..137936b56e9 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -1,4 +1,4 @@
-; $OpenBSD: syscalls.master,v 1.87 2007/11/27 18:04:47 art Exp $
+; $OpenBSD: syscalls.master,v 1.88 2007/11/28 13:47:02 deraadt Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -307,7 +307,7 @@
ogetdomainname
163 COMPAT_09 { int sys_setdomainname(char *domainname, int len); } \
osetdomainname
-164 COMPAT_09 { int sys_uname(struct outsname *name); } ouname
+164 UNIMPL ouname
165 STD { int sys_sysarch(int op, void *parms); }
166 UNIMPL
167 UNIMPL