diff options
Diffstat (limited to 'sys/compat/freebsd')
-rw-r--r-- | sys/compat/freebsd/freebsd_misc.c | 45 | ||||
-rw-r--r-- | sys/compat/freebsd/syscalls.master | 4 |
2 files changed, 46 insertions, 3 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); } |