[Midnightbsd-cvs] src: compat/ia32: Sync with FreeBSD 7
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Mon Sep 15 21:34:22 EDT 2008
Log Message:
-----------
Sync with FreeBSD 7
Modified Files:
--------------
src/sys/compat/freebsd32:
Makefile (r1.1.1.1 -> r1.2)
freebsd32.h (r1.1.1.1 -> r1.2)
freebsd32_misc.c (r1.2 -> r1.3)
freebsd32_proto.h (r1.1.1.2 -> r1.2)
freebsd32_syscall.h (r1.1.1.2 -> r1.2)
freebsd32_syscalls.c (r1.1.1.2 -> r1.2)
freebsd32_sysent.c (r1.1.1.2 -> r1.2)
syscalls.conf (r1.1.1.1 -> r1.2)
syscalls.master (r1.1.1.2 -> r1.2)
src/sys/compat/ia32:
ia32_genassym.c (r1.1.1.1 -> r1.2)
ia32_signal.h (r1.1.1.1 -> r1.2)
ia32_sysvec.c (r1.1.1.1 -> r1.2)
src/sys/compat/linprocfs:
linprocfs.c (r1.1.1.1 -> r1.2)
src/sys/compat/linux:
linux_file.c (r1.1.1.1 -> r1.2)
linux_getcwd.c (r1.2 -> r1.3)
linux_ioctl.c (r1.1.1.2 -> r1.2)
linux_ioctl.h (r1.1.1.1 -> r1.2)
linux_ipc.c (r1.1.1.1 -> r1.2)
linux_ipc.h (r1.1.1.1 -> r1.2)
linux_mib.c (r1.1.1.2 -> r1.2)
linux_mib.h (r1.1.1.2 -> r1.2)
linux_misc.c (r1.1.1.1 -> r1.2)
linux_signal.c (r1.1.1.1 -> r1.2)
linux_signal.h (r1.1.1.1 -> r1.2)
linux_socket.c (r1.1.1.2 -> r1.2)
linux_stats.c (r1.2 -> r1.3)
linux_sysctl.c (r1.1.1.1 -> r1.2)
linux_uid16.c (r1.1.1.1 -> r1.2)
linux_util.c (r1.1.1.1 -> r1.2)
linux_util.h (r1.1.1.2 -> r1.2)
src/sys/compat/ndis:
kern_ndis.c (r1.1.1.1 -> r1.2)
kern_windrv.c (r1.1.1.1 -> r1.2)
ndis_var.h (r1.1.1.1 -> r1.2)
ntoskrnl_var.h (r1.1.1.1 -> r1.2)
pe_var.h (r1.1.1.1 -> r1.2)
subr_hal.c (r1.1.1.1 -> r1.2)
subr_ndis.c (r1.1.1.1 -> r1.2)
subr_ntoskrnl.c (r1.1.1.1 -> r1.2)
subr_pe.c (r1.1.1.1 -> r1.2)
winx32_wrap.S (r1.1.1.1 -> r1.2)
src/sys/compat/svr4:
Makefile (r1.1.1.1 -> r1.2)
imgact_svr4.c (r1.1.1.1 -> r1.2)
svr4.h (r1.1.1.1 -> r1.2)
svr4_fcntl.c (r1.1.1.1 -> r1.2)
svr4_filio.c (r1.1.1.1 -> r1.2)
svr4_ioctl.c (r1.1.1.1 -> r1.2)
svr4_ipc.c (r1.1.1.1 -> r1.2)
svr4_misc.c (r1.1.1.1 -> r1.2)
svr4_proto.h (r1.1.1.1 -> r1.2)
svr4_siginfo.h (r1.1.1.1 -> r1.2)
svr4_signal.c (r1.1.1.1 -> r1.2)
svr4_signal.h (r1.1.1.1 -> r1.2)
svr4_socket.c (r1.1.1.1 -> r1.2)
svr4_socket.h (r1.1.1.1 -> r1.2)
svr4_sockio.c (r1.1.1.1 -> r1.2)
svr4_stat.c (r1.1.1.1 -> r1.2)
svr4_stream.c (r1.1.1.1 -> r1.2)
svr4_stropts.h (r1.1.1.1 -> r1.2)
svr4_syscall.h (r1.1.1.1 -> r1.2)
svr4_syscallnames.c (r1.1.1.1 -> r1.2)
svr4_sysent.c (r1.1.1.1 -> r1.2)
svr4_sysvec.c (r1.1.1.1 -> r1.2)
svr4_termios.c (r1.1.1.1 -> r1.2)
svr4_ttold.c (r1.1.1.1 -> r1.2)
svr4_util.h (r1.1.1.1 -> r1.2)
syscalls.conf (r1.1.1.1 -> r1.2)
syscalls.master (r1.1.1.1 -> r1.2)
Added Files:
-----------
src/sys/compat/freebsd32:
freebsd32_ipc.h (r1.1)
freebsd32_signal.h (r1.1)
src/sys/compat/linux:
linux_emul.c (r1.1)
linux_emul.h (r1.1)
linux_futex.c (r1.1)
linux_futex.h (r1.1)
linux_misc.h (r1.1)
linux_time.c (r1.1)
Removed Files:
-------------
src/sys/compat/pecoff:
imgact_pecoff.c
imgact_pecoff.h
-------------- next part --------------
Index: syscalls.master
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/syscalls.master,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/freebsd32/syscalls.master -L sys/compat/freebsd32/syscalls.master -u -r1.1.1.2 -r1.2
--- sys/compat/freebsd32/syscalls.master
+++ sys/compat/freebsd32/syscalls.master
@@ -1,20 +1,19 @@
- $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.50.2.4 2006/01/27 17:17:05 ambrisko Exp $
+ $FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.91.2.2 2007/12/19 20:43:41 jhb Exp $
; from: @(#)syscalls.master 8.2 (Berkeley) 1/13/94
; from: src/sys/kern/syscalls.master 1.107
;
; System call name/number master file.
; Processed to created init_sysent.c, syscalls.c and syscall.h.
-; Columns: number [M]type nargs name alt{name,tag,rtyp}/comments
+; Columns: number audit type nargs name alt{name,tag,rtyp}/comments
; number system call number, must be in order
; audit the audit event associated with the system call
; A value of AUE_NULL means no auditing, but it also means that
; there is no audit event for the call at this time. For the
; case where the event exists, but we don't want auditing, the
; event should be #defined to AUE_NULL in audit_kevents.h.
-; type one of [M]STD, [M]OBSOL, [M]UNIMPL, [M]COMPAT, [M]CPT_NOA,
-; [M]LIBCOMPAT, [M]NODEF, [M]NOARGS, [M]NOPROTO, [M]NOIMPL,
-; [M]NOSTD
+; type one of STD, OBSOL, UNIMPL, COMPAT, CPT_NOA, LIBCOMPAT,
+; NODEF, NOARGS, NOPROTO, NOIMPL, NOSTD, COMPAT4
; name psuedo-prototype of syscall routine
; If one of the following alts is different, then all appear:
; altname name of system call if different
@@ -23,17 +22,15 @@
; for UNIMPL/OBSOL, name continues with comments
; types:
-; [M] e.g. like MSTD -- means the system call is MP-safe. If no
-; M prefix is used, the syscall wrapper will obtain the Giant
-; lock for the syscall.
; STD always included
; COMPAT included on COMPAT #ifdef
+; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat)
; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h
; OBSOL obsolete, not included in system, only specifies name
; UNIMPL not implemented, placeholder only
; NOSTD implemented but as a lkm that can be statically
-; compiled in sysent entry will be filled with lkmsys
-; so the SYSCALL_MODULE macro works
+; compiled in; sysent entry will be filled with lkmsys
+; so the SYSCALL_MODULE macro works
; #ifdef's, etc. may be included, and are copied to the output files.
@@ -41,6 +38,7 @@
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/mount.h>
+#include <sys/socket.h>
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
@@ -50,226 +48,224 @@
; redistributions should be placed in the reserved range at the end
; of the current calls.
-0 AUE_NULL MNOPROTO { int nosys(void); } syscall nosys_args int
-1 AUE_NULL MNOPROTO { void sys_exit(int rval); } exit \
+0 AUE_NULL NOPROTO { int nosys(void); } syscall nosys_args int
+1 AUE_EXIT NOPROTO { void sys_exit(int rval); } exit \
sys_exit_args void
-2 AUE_NULL MNOPROTO { int fork(void); }
-3 AUE_NULL MNOPROTO { ssize_t read(int fd, void *buf, \
+2 AUE_FORK NOPROTO { int fork(void); }
+3 AUE_READ NOPROTO { ssize_t read(int fd, void *buf, \
size_t nbyte); }
-4 AUE_NULL MNOPROTO { ssize_t write(int fd, const void *buf, \
+4 AUE_WRITE NOPROTO { ssize_t write(int fd, const void *buf, \
size_t nbyte); }
-5 AUE_NULL MNOPROTO { int open(char *path, int flags, \
+5 AUE_OPEN_RWTC NOPROTO { int open(char *path, int flags, \
int mode); }
-6 AUE_NULL MNOPROTO { int close(int fd); }
-7 AUE_NULL MSTD { int freebsd32_wait4(int pid, int *status, \
+6 AUE_CLOSE NOPROTO { int close(int fd); }
+7 AUE_WAIT4 STD { int freebsd32_wait4(int pid, int *status, \
int options, struct rusage32 *rusage); }
-8 AUE_NULL OBSOL old creat
-9 AUE_NULL MNOPROTO { int link(char *path, char *link); }
-10 AUE_NULL MNOPROTO { int unlink(char *path); }
+8 AUE_CREAT OBSOL old creat
+9 AUE_LINK NOPROTO { int link(char *path, char *link); }
+10 AUE_UNLINK NOPROTO { int unlink(char *path); }
11 AUE_NULL OBSOL execv
-12 AUE_NULL MNOPROTO { int chdir(char *path); }
-13 AUE_NULL MNOPROTO { int fchdir(int fd); }
-14 AUE_NULL MNOPROTO { int mknod(char *path, int mode, int dev); }
-15 AUE_NULL MNOPROTO { int chmod(char *path, int mode); }
-16 AUE_NULL MNOPROTO { int chown(char *path, int uid, int gid); }
-17 AUE_NULL MNOPROTO { int obreak(char *nsize); } break \
+12 AUE_CHDIR NOPROTO { int chdir(char *path); }
+13 AUE_FCHDIR NOPROTO { int fchdir(int fd); }
+14 AUE_MKNOD NOPROTO { int mknod(char *path, int mode, int dev); }
+15 AUE_CHMOD NOPROTO { int chmod(char *path, int mode); }
+16 AUE_CHOWN NOPROTO { int chown(char *path, int uid, int gid); }
+17 AUE_NULL NOPROTO { int obreak(char *nsize); } break \
obreak_args int
-18 AUE_NULL MCOMPAT4 { int freebsd32_getfsstat( \
+18 AUE_GETFSSTAT COMPAT4 { int freebsd32_getfsstat( \
struct statfs32 *buf, long bufsize, \
int flags); }
-19 AUE_NULL OBSOL olseek
-20 AUE_NULL MNOPROTO { pid_t getpid(void); }
-21 AUE_NULL NOPROTO { int mount(char *type, char *path, \
+19 AUE_LSEEK OBSOL olseek
+20 AUE_GETPID NOPROTO { pid_t getpid(void); }
+21 AUE_MOUNT NOPROTO { int mount(char *type, char *path, \
int flags, caddr_t data); }
-22 AUE_NULL NOPROTO { int unmount(char *path, int flags); }
-23 AUE_NULL MNOPROTO { int setuid(uid_t uid); }
-24 AUE_NULL MNOPROTO { uid_t getuid(void); }
-25 AUE_NULL MNOPROTO { uid_t geteuid(void); }
-26 AUE_NULL MNOPROTO { int ptrace(int req, pid_t pid, \
+22 AUE_UMOUNT NOPROTO { int unmount(char *path, int flags); }
+23 AUE_SETUID NOPROTO { int setuid(uid_t uid); }
+24 AUE_GETUID NOPROTO { uid_t getuid(void); }
+25 AUE_GETEUID NOPROTO { uid_t geteuid(void); }
+26 AUE_PTRACE NOPROTO { int ptrace(int req, pid_t pid, \
caddr_t addr, int data); }
-; XXX implement
-27 AUE_NULL MSTD { int freebsd32_recvmsg(int s, struct msghdr32 *msg, \
+27 AUE_RECVMSG STD { int freebsd32_recvmsg(int s, struct msghdr32 *msg, \
int flags); }
-28 AUE_NULL MSTD { int freebsd32_sendmsg(int s, struct msghdr32 *msg, \
+28 AUE_SENDMSG STD { int freebsd32_sendmsg(int s, struct msghdr32 *msg, \
int flags); }
-29 AUE_NULL MSTD { int freebsd32_recvfrom(int s, u_int32_t buf, \
+29 AUE_RECVFROM STD { int freebsd32_recvfrom(int s, u_int32_t buf, \
u_int32_t len, int flags, u_int32_t from, \
u_int32_t fromlenaddr); }
-30 AUE_NULL MNOPROTO { int accept(int s, caddr_t name, \
+30 AUE_ACCEPT NOPROTO { int accept(int s, caddr_t name, \
int *anamelen); }
-31 AUE_NULL MNOPROTO { int getpeername(int fdes, caddr_t asa, \
+31 AUE_GETPEERNAME NOPROTO { int getpeername(int fdes, caddr_t asa, \
int *alen); }
-32 AUE_NULL MNOPROTO { int getsockname(int fdes, caddr_t asa, \
+32 AUE_GETSOCKNAME NOPROTO { int getsockname(int fdes, caddr_t asa, \
int *alen); }
-33 AUE_NULL MNOPROTO { int access(char *path, int flags); }
-34 AUE_NULL MNOPROTO { int chflags(char *path, int flags); }
-35 AUE_NULL MNOPROTO { int fchflags(int fd, int flags); }
-36 AUE_NULL MNOPROTO { int sync(void); }
-37 AUE_NULL MNOPROTO { int kill(int pid, int signum); }
-38 AUE_NULL UNIMPL ostat
-39 AUE_NULL MNOPROTO { pid_t getppid(void); }
-40 AUE_NULL UNIMPL olstat
-41 AUE_NULL MNOPROTO { int dup(u_int fd); }
-42 AUE_NULL MNOPROTO { int pipe(void); }
-43 AUE_NULL MNOPROTO { gid_t getegid(void); }
-44 AUE_NULL MNOPROTO { int profil(caddr_t samples, size_t size, \
+33 AUE_ACCESS NOPROTO { int access(char *path, int flags); }
+34 AUE_CHFLAGS NOPROTO { int chflags(char *path, int flags); }
+35 AUE_FCHFLAGS NOPROTO { int fchflags(int fd, int flags); }
+36 AUE_SYNC NOPROTO { int sync(void); }
+37 AUE_KILL NOPROTO { int kill(int pid, int signum); }
+38 AUE_STAT UNIMPL ostat
+39 AUE_GETPPID NOPROTO { pid_t getppid(void); }
+40 AUE_LSTAT UNIMPL olstat
+41 AUE_DUP NOPROTO { int dup(u_int fd); }
+42 AUE_PIPE NOPROTO { int pipe(void); }
+43 AUE_GETEGID NOPROTO { gid_t getegid(void); }
+44 AUE_PROFILE NOPROTO { int profil(caddr_t samples, size_t size, \
size_t offset, u_int scale); }
-45 AUE_NULL MNOPROTO { int ktrace(const char *fname, int ops, \
+45 AUE_KTRACE NOPROTO { int ktrace(const char *fname, int ops, \
int facs, int pid); }
-46 AUE_NULL MCOMPAT { int freebsd32_sigaction( int signum, \
+46 AUE_SIGACTION COMPAT { int freebsd32_sigaction( int signum, \
struct osigaction32 *nsa, \
struct osigaction32 *osa); }
-47 AUE_NULL MNOPROTO { gid_t getgid(void); }
-48 AUE_NULL MCOMPAT { int freebsd32_sigprocmask(int how, \
+47 AUE_GETGID NOPROTO { gid_t getgid(void); }
+48 AUE_SIGPROCMASK COMPAT { int freebsd32_sigprocmask(int how, \
osigset_t mask); }
-49 AUE_NULL MNOPROTO { int getlogin(char *namebuf, \
+49 AUE_GETLOGIN NOPROTO { int getlogin(char *namebuf, \
u_int namelen); }
-50 AUE_NULL MNOPROTO { int setlogin(char *namebuf); }
-51 AUE_NULL MNOPROTO { int acct(char *path); }
-52 AUE_NULL MCOMPAT { int freebsd32_sigpending(void); }
-53 AUE_NULL MSTD { int freebsd32_sigaltstack( \
+50 AUE_SETLOGIN NOPROTO { int setlogin(char *namebuf); }
+51 AUE_ACCT NOPROTO { int acct(char *path); }
+52 AUE_SIGPENDING COMPAT { int freebsd32_sigpending(void); }
+53 AUE_SIGALTSTACK STD { int freebsd32_sigaltstack( \
struct sigaltstack32 *ss, \
struct sigaltstack32 *oss); }
-54 AUE_NULL MNOPROTO { int ioctl(int fd, u_long com, \
+54 AUE_IOCTL NOPROTO { int ioctl(int fd, u_long com, \
caddr_t data); }
-55 AUE_NULL MNOPROTO { int reboot(int opt); }
-56 AUE_NULL MNOPROTO { int revoke(char *path); }
-57 AUE_NULL MNOPROTO { int symlink(char *path, char *link); }
-58 AUE_NULL MNOPROTO { int readlink(char *path, char *buf, \
+55 AUE_REBOOT NOPROTO { int reboot(int opt); }
+56 AUE_REVOKE NOPROTO { int revoke(char *path); }
+57 AUE_SYMLINK NOPROTO { int symlink(char *path, char *link); }
+58 AUE_READLINK NOPROTO { int readlink(char *path, char *buf, \
int count); }
-59 AUE_NULL MSTD { int freebsd32_execve(char *fname, \
+59 AUE_EXECVE STD { int freebsd32_execve(char *fname, \
u_int32_t *argv, u_int32_t *envv); }
-60 AUE_NULL MNOPROTO { int umask(int newmask); } umask \
+60 AUE_UMASK NOPROTO { int umask(int newmask); } umask \
umask_args int
-61 AUE_NULL MNOPROTO { int chroot(char *path); }
-62 AUE_NULL OBSOL ofstat
+61 AUE_CHROOT NOPROTO { int chroot(char *path); }
+62 AUE_FSTAT OBSOL ofstat
63 AUE_NULL OBSOL ogetkerninfo
64 AUE_NULL OBSOL ogetpagesize
-; XXX implement (not OBSOL at all)
-65 AUE_NULL MNOPROTO { int msync(void *addr, size_t len, \
+65 AUE_MSYNC NOPROTO { int msync(void *addr, size_t len, \
int flags); }
-66 AUE_NULL MNOPROTO { int vfork(void); }
+66 AUE_VFORK NOPROTO { int vfork(void); }
67 AUE_NULL OBSOL vread
68 AUE_NULL OBSOL vwrite
-69 AUE_NULL MNOPROTO { int sbrk(int incr); }
-70 AUE_NULL MNOPROTO { int sstk(int incr); }
-71 AUE_NULL OBSOL ommap
-72 AUE_NULL MNOPROTO { int ovadvise(int anom); } vadvise \
+69 AUE_SBRK NOPROTO { int sbrk(int incr); }
+70 AUE_SSTK NOPROTO { int sstk(int incr); }
+71 AUE_MMAP OBSOL ommap
+72 AUE_O_VADVISE NOPROTO { int ovadvise(int anom); } vadvise \
ovadvise_args int
-73 AUE_NULL MNOPROTO { int munmap(void *addr, size_t len); }
-74 AUE_NULL MNOPROTO { int mprotect(const void *addr, \
+73 AUE_MUNMAP NOPROTO { int munmap(void *addr, size_t len); }
+74 AUE_MPROTECT NOPROTO { int mprotect(const void *addr, \
size_t len, int prot); }
-75 AUE_NULL MNOPROTO { int madvise(void *addr, size_t len, \
+75 AUE_MADVISE NOPROTO { int madvise(void *addr, size_t len, \
int behav); }
76 AUE_NULL OBSOL vhangup
77 AUE_NULL OBSOL vlimit
-78 AUE_NULL MNOPROTO { int mincore(const void *addr, size_t len, \
+78 AUE_MINCORE NOPROTO { int mincore(const void *addr, size_t len, \
char *vec); }
-79 AUE_NULL MNOPROTO { int getgroups(u_int gidsetsize, \
+79 AUE_GETGROUPS NOPROTO { int getgroups(u_int gidsetsize, \
gid_t *gidset); }
-80 AUE_NULL MNOPROTO { int setgroups(u_int gidsetsize, \
+80 AUE_SETGROUPS NOPROTO { int setgroups(u_int gidsetsize, \
gid_t *gidset); }
-81 AUE_NULL MNOPROTO { int getpgrp(void); }
-82 AUE_NULL MNOPROTO { int setpgid(int pid, int pgid); }
-83 AUE_NULL MSTD { int freebsd32_setitimer(u_int which, \
+81 AUE_GETPGRP NOPROTO { int getpgrp(void); }
+82 AUE_SETPGRP NOPROTO { int setpgid(int pid, int pgid); }
+83 AUE_SETITIMER STD { int freebsd32_setitimer(u_int which, \
struct itimerval32 *itv, \
struct itimerval32 *oitv); }
84 AUE_NULL OBSOL owait
; XXX implement
-85 AUE_NULL OBSOL oswapon
-86 AUE_NULL MSTD { int freebsd32_getitimer(u_int which, \
+85 AUE_SWAPON OBSOL oswapon
+86 AUE_GETITIMER STD { int freebsd32_getitimer(u_int which, \
struct itimerval32 *itv); }
-87 AUE_NULL OBSOL ogethostname
-88 AUE_NULL OBSOL osethostname
-89 AUE_NULL MNOPROTO { int getdtablesize(void); }
-90 AUE_NULL MNOPROTO { int dup2(u_int from, u_int to); }
+87 AUE_O_GETHOSTNAME OBSOL ogethostname
+88 AUE_O_SETHOSTNAME OBSOL osethostname
+89 AUE_GETDTABLESIZE NOPROTO { int getdtablesize(void); }
+90 AUE_DUP2 NOPROTO { int dup2(u_int from, u_int to); }
91 AUE_NULL UNIMPL getdopt
-92 AUE_NULL MNOPROTO { int fcntl(int fd, int cmd, long arg); }
-93 AUE_NULL MSTD { int freebsd32_select(int nd, fd_set *in, \
+92 AUE_FCNTL NOPROTO { int fcntl(int fd, int cmd, long arg); }
+93 AUE_SELECT STD { int freebsd32_select(int nd, fd_set *in, \
fd_set *ou, fd_set *ex, \
struct timeval32 *tv); }
; XXX need to override for big-endian - little-endian should work fine.
94 AUE_NULL UNIMPL setdopt
-95 AUE_NULL MNOPROTO { int fsync(int fd); }
-96 AUE_NULL MNOPROTO { int setpriority(int which, int who, \
+95 AUE_FSYNC NOPROTO { int fsync(int fd); }
+96 AUE_SETPRIORITY NOPROTO { int setpriority(int which, int who, \
int prio); }
-97 AUE_NULL MNOPROTO { int socket(int domain, int type, \
+97 AUE_SOCKET NOPROTO { int socket(int domain, int type, \
int protocol); }
-98 AUE_NULL MNOPROTO { int connect(int s, caddr_t name, \
+98 AUE_CONNECT NOPROTO { int connect(int s, caddr_t name, \
int namelen); }
99 AUE_NULL OBSOL oaccept
-100 AUE_NULL MNOPROTO { int getpriority(int which, int who); }
+100 AUE_GETPRIORITY NOPROTO { int getpriority(int which, int who); }
101 AUE_NULL OBSOL osend
102 AUE_NULL OBSOL orecv
103 AUE_NULL OBSOL osigreturn
-104 AUE_NULL MNOPROTO { int bind(int s, caddr_t name, \
+104 AUE_BIND NOPROTO { int bind(int s, caddr_t name, \
int namelen); }
-105 AUE_NULL MNOPROTO { int setsockopt(int s, int level, \
+105 AUE_SETSOCKOPT NOPROTO { int setsockopt(int s, int level, \
int name, caddr_t val, int valsize); }
-106 AUE_NULL MNOPROTO { int listen(int s, int backlog); }
+106 AUE_LISTEN NOPROTO { int listen(int s, int backlog); }
107 AUE_NULL OBSOL vtimes
-108 AUE_NULL MCOMPAT { int freebsd32_sigvec(int signum, \
+108 AUE_O_SIGVEC COMPAT { int freebsd32_sigvec(int signum, \
struct sigvec32 *nsv, \
struct sigvec32 *osv); }
-109 AUE_NULL MCOMPAT { int freebsd32_sigblock(int mask); }
-110 AUE_NULL MCOMPAT { int freebsd32_sigsetmask( int mask); }
-111 AUE_NULL MCOMPAT { int freebsd32_sigsuspend( int mask); }
-112 AUE_NULL MCOMPAT { int freebsd32_sigstack( \
+109 AUE_O_SIGBLOCK COMPAT { int freebsd32_sigblock(int mask); }
+110 AUE_O_SIGSETMASK COMPAT { int freebsd32_sigsetmask( int mask); }
+111 AUE_SIGSUSPEND COMPAT { int freebsd32_sigsuspend( int mask); }
+112 AUE_O_SIGSTACK COMPAT { int freebsd32_sigstack( \
struct sigstack32 *nss, \
struct sigstack32 *oss); }
113 AUE_NULL OBSOL orecvmsg
114 AUE_NULL OBSOL osendmsg
115 AUE_NULL OBSOL vtrace
-116 AUE_NULL MSTD { int freebsd32_gettimeofday( \
+116 AUE_GETTIMEOFDAY STD { int freebsd32_gettimeofday( \
struct timeval32 *tp, \
struct timezone *tzp); }
-117 AUE_NULL MSTD { int freebsd32_getrusage(int who, \
+117 AUE_GETRUSAGE STD { int freebsd32_getrusage(int who, \
struct rusage32 *rusage); }
-118 AUE_NULL MNOPROTO { int getsockopt(int s, int level, \
+118 AUE_GETSOCKOPT NOPROTO { int getsockopt(int s, int level, \
int name, caddr_t val, int *avalsize); }
119 AUE_NULL UNIMPL resuba (BSD/OS 2.x)
-120 AUE_NULL MSTD { int freebsd32_readv(int fd, \
+120 AUE_READV STD { int freebsd32_readv(int fd, \
struct iovec32 *iovp, u_int iovcnt); }
-121 AUE_NULL MSTD { int freebsd32_writev(int fd, \
+121 AUE_WRITEV STD { int freebsd32_writev(int fd, \
struct iovec32 *iovp, u_int iovcnt); }
-122 AUE_NULL MSTD { int freebsd32_settimeofday( \
+122 AUE_SETTIMEOFDAY STD { int freebsd32_settimeofday( \
struct timeval32 *tv, \
struct timezone *tzp); }
-123 AUE_NULL MNOPROTO { int fchown(int fd, int uid, int gid); }
-124 AUE_NULL MNOPROTO { int fchmod(int fd, int mode); }
-125 AUE_NULL OBSOL orecvfrom
-126 AUE_NULL MNOPROTO { int setreuid(int ruid, int euid); }
-127 AUE_NULL MNOPROTO { int setregid(int rgid, int egid); }
-128 AUE_NULL MNOPROTO { int rename(char *from, char *to); }
-129 AUE_NULL OBSOL otruncate
-130 AUE_NULL OBSOL ftruncate
-131 AUE_NULL MNOPROTO { int flock(int fd, int how); }
-132 AUE_NULL MNOPROTO { int mkfifo(char *path, int mode); }
-133 AUE_NULL MNOPROTO { int sendto(int s, caddr_t buf, \
+123 AUE_FCHOWN NOPROTO { int fchown(int fd, int uid, int gid); }
+124 AUE_FCHMOD NOPROTO { int fchmod(int fd, int mode); }
+125 AUE_RECVFROM OBSOL orecvfrom
+126 AUE_SETREUID NOPROTO { int setreuid(int ruid, int euid); }
+127 AUE_SETREGID NOPROTO { int setregid(int rgid, int egid); }
+128 AUE_RENAME NOPROTO { int rename(char *from, char *to); }
+129 AUE_TRUNCATE OBSOL otruncate
+130 AUE_FTRUNCATE OBSOL ftruncate
+131 AUE_FLOCK NOPROTO { int flock(int fd, int how); }
+132 AUE_MKFIFO NOPROTO { int mkfifo(char *path, int mode); }
+133 AUE_SENDTO NOPROTO { int sendto(int s, caddr_t buf, \
size_t len, int flags, caddr_t to, \
int tolen); }
-134 AUE_NULL MNOPROTO { int shutdown(int s, int how); }
-135 AUE_NULL MNOPROTO { int socketpair(int domain, int type, \
+134 AUE_SHUTDOWN NOPROTO { int shutdown(int s, int how); }
+135 AUE_SOCKETPAIR NOPROTO { int socketpair(int domain, int type, \
int protocol, int *rsv); }
-136 AUE_NULL MNOPROTO { int mkdir(char *path, int mode); }
-137 AUE_NULL MNOPROTO { int rmdir(char *path); }
-138 AUE_NULL MSTD { int freebsd32_utimes(char *path, \
+136 AUE_MKDIR NOPROTO { int mkdir(char *path, int mode); }
+137 AUE_RMDIR NOPROTO { int rmdir(char *path); }
+138 AUE_UTIMES STD { int freebsd32_utimes(char *path, \
struct timeval32 *tptr); }
139 AUE_NULL OBSOL 4.2 sigreturn
-140 AUE_NULL MSTD { int freebsd32_adjtime( \
+140 AUE_ADJTIME STD { int freebsd32_adjtime( \
struct timeval32 *delta, \
struct timeval32 *olddelta); }
-141 AUE_NULL OBSOL ogetpeername
-142 AUE_NULL OBSOL ogethostid
-143 AUE_NULL OBSOL sethostid
-144 AUE_NULL OBSOL getrlimit
-145 AUE_NULL OBSOL setrlimit
-146 AUE_NULL OBSOL killpg
-147 AUE_NULL MNOPROTO { int setsid(void); }
-148 AUE_NULL MNOPROTO { int quotactl(char *path, int cmd, int uid, \
+141 AUE_GETPEERNAME OBSOL ogetpeername
+142 AUE_SYSCTL OBSOL ogethostid
+143 AUE_SYSCTL OBSOL sethostid
+144 AUE_GETRLIMIT OBSOL getrlimit
+145 AUE_SETRLIMIT OBSOL setrlimit
+146 AUE_KILLPG OBSOL killpg
+147 AUE_SETSID NOPROTO { int setsid(void); }
+148 AUE_QUOTACTL NOPROTO { int quotactl(char *path, int cmd, int uid, \
caddr_t arg); }
-149 AUE_NULL OBSOL oquota
-150 AUE_NULL OBSOL ogetsockname
+149 AUE_O_QUOTA OBSOL oquota
+150 AUE_GETSOCKNAME OBSOL ogetsockname
; Syscalls 151-180 inclusive are reserved for vendor-specific
; system calls. (This includes various calls added for compatibity
@@ -281,104 +277,104 @@
154 AUE_NULL UNIMPL nosys
; 155 is initialized by the NFS code, if present.
; XXX this is a problem!!!
-155 AUE_NULL UNIMPL nfssvc
-156 AUE_NULL OBSOL ogetdirentries
-157 AUE_NULL MCOMPAT4 { int freebsd32_statfs(char *path, \
+155 AUE_NFS_SVC UNIMPL nfssvc
+156 AUE_GETDIRENTRIES OBSOL ogetdirentries
+157 AUE_STATFS COMPAT4 { int freebsd32_statfs(char *path, \
struct statfs32 *buf); }
-158 AUE_NULL MCOMPAT4 { int freebsd32_fstatfs(int fd, \
+158 AUE_FSTATFS COMPAT4 { int freebsd32_fstatfs(int fd, \
struct statfs32 *buf); }
159 AUE_NULL UNIMPL nosys
-160 AUE_NULL UNIMPL nosys
-161 AUE_NULL MNOPROTO { int getfh(char *fname, \
+160 AUE_LGETFH UNIMPL lgetfh
+161 AUE_NFS_GETFH NOPROTO { int getfh(char *fname, \
struct fhandle *fhp); }
-162 AUE_NULL MNOPROTO { int getdomainname(char *domainname, \
+162 AUE_SYSCTL NOPROTO { int getdomainname(char *domainname, \
int len); }
-163 AUE_NULL MNOPROTO { int setdomainname(char *domainname, \
+163 AUE_SYSCTL NOPROTO { int setdomainname(char *domainname, \
int len); }
-164 AUE_NULL MNOPROTO { int uname(struct utsname *name); }
-165 AUE_NULL MNOPROTO { int sysarch(int op, char *parms); }
-166 AUE_NULL MNOPROTO { int rtprio(int function, pid_t pid, \
+164 AUE_NULL NOPROTO { int uname(struct utsname *name); }
+165 AUE_SYSARCH NOPROTO { int sysarch(int op, char *parms); }
+166 AUE_RTPRIO NOPROTO { int rtprio(int function, pid_t pid, \
struct rtprio *rtp); }
167 AUE_NULL UNIMPL nosys
168 AUE_NULL UNIMPL nosys
-169 AUE_NULL MSTD { int freebsd32_semsys(int which, int a2, \
+169 AUE_SEMSYS STD { int freebsd32_semsys(int which, int a2, \
int a3, int a4, int a5); }
-170 AUE_NULL MSTD { int freebsd32_msgsys(int which, int a2, \
+170 AUE_MSGSYS STD { int freebsd32_msgsys(int which, int a2, \
int a3, int a4, int a5, int a6); }
-171 AUE_NULL MSTD { int freebsd32_shmsys(int which, int a2, \
- int a3, int a4); }
+171 AUE_SHMSYS STD { int freebsd32_shmsys(uint32_t which, uint32_t a2, \
+ uint32_t a3, uint32_t a4); }
172 AUE_NULL UNIMPL nosys
-173 AUE_NULL MSTD { ssize_t freebsd32_pread(int fd, void *buf, \
+173 AUE_PREAD COMPAT6 { ssize_t freebsd32_pread(int fd, void *buf, \
size_t nbyte, int pad, \
u_int32_t offsetlo, u_int32_t offsethi); }
; XXX note - bigendian is different
-174 AUE_NULL MSTD { ssize_t freebsd32_pwrite(int fd, \
+174 AUE_PWRITE COMPAT6 { ssize_t freebsd32_pwrite(int fd, \
const void *buf, size_t nbyte, int pad, \
u_int32_t offsetlo, u_int32_t offsethi); }
; XXX note - bigendian is different
175 AUE_NULL UNIMPL nosys
-176 AUE_NULL MNOPROTO { int ntp_adjtime(struct timex *tp); }
+176 AUE_NTP_ADJTIME NOPROTO { int ntp_adjtime(struct timex *tp); }
177 AUE_NULL UNIMPL sfork (BSD/OS 2.x)
178 AUE_NULL UNIMPL getdescriptor (BSD/OS 2.x)
179 AUE_NULL UNIMPL setdescriptor (BSD/OS 2.x)
180 AUE_NULL UNIMPL nosys
; Syscalls 181-199 are used by/reserved for BSD
-181 AUE_NULL MNOPROTO { int setgid(gid_t gid); }
-182 AUE_NULL MNOPROTO { int setegid(gid_t egid); }
-183 AUE_NULL MNOPROTO { int seteuid(uid_t euid); }
+181 AUE_SETGID NOPROTO { int setgid(gid_t gid); }
+182 AUE_SETEGID NOPROTO { int setegid(gid_t egid); }
+183 AUE_SETEUID NOPROTO { int seteuid(uid_t euid); }
184 AUE_NULL UNIMPL lfs_bmapv
185 AUE_NULL UNIMPL lfs_markv
186 AUE_NULL UNIMPL lfs_segclean
187 AUE_NULL UNIMPL lfs_segwait
-188 AUE_NULL MSTD { int freebsd32_stat(char *path, \
+188 AUE_STAT STD { int freebsd32_stat(char *path, \
struct stat32 *ub); }
-189 AUE_NULL MSTD { int freebsd32_fstat(int fd, \
+189 AUE_FSTAT STD { int freebsd32_fstat(int fd, \
struct stat32 *ub); }
-190 AUE_NULL MSTD { int freebsd32_lstat(char *path, \
+190 AUE_LSTAT STD { int freebsd32_lstat(char *path, \
struct stat32 *ub); }
-191 AUE_NULL MNOPROTO { int pathconf(char *path, int name); }
-192 AUE_NULL MNOPROTO { int fpathconf(int fd, int name); }
+191 AUE_PATHCONF NOPROTO { int pathconf(char *path, int name); }
+192 AUE_FPATHCONF NOPROTO { int fpathconf(int fd, int name); }
193 AUE_NULL UNIMPL nosys
-194 AUE_NULL MNOPROTO { int getrlimit(u_int which, \
+194 AUE_GETRLIMIT NOPROTO { int getrlimit(u_int which, \
struct rlimit *rlp); } getrlimit \
__getrlimit_args int
-195 AUE_NULL MNOPROTO { int setrlimit(u_int which, \
+195 AUE_SETRLIMIT NOPROTO { int setrlimit(u_int which, \
struct rlimit *rlp); } setrlimit \
__setrlimit_args int
-196 AUE_NULL MNOPROTO { int getdirentries(int fd, char *buf, \
+196 AUE_GETDIRENTRIES NOPROTO { int getdirentries(int fd, char *buf, \
u_int count, long *basep); }
-197 AUE_NULL MSTD { caddr_t freebsd32_mmap(caddr_t addr, \
+197 AUE_MMAP COMPAT6 { caddr_t freebsd32_mmap(caddr_t addr, \
size_t len, int prot, int flags, int fd, \
int pad, u_int32_t poslo, \
u_int32_t poshi); }
-198 AUE_NULL MNOPROTO { int nosys(void); } __syscall \
+198 AUE_NULL NOPROTO { int nosys(void); } __syscall \
__syscall_args int
; XXX note - bigendian is different
-199 AUE_NULL MSTD { off_t freebsd32_lseek(int fd, int pad, \
+199 AUE_LSEEK COMPAT6 { off_t freebsd32_lseek(int fd, int pad, \
u_int32_t offsetlo, u_int32_t offsethi, \
int whence); }
; XXX note - bigendian is different
-200 AUE_NULL MSTD { int freebsd32_truncate(char *path, \
+200 AUE_TRUNCATE COMPAT6 { int freebsd32_truncate(char *path, \
int pad, u_int32_t lengthlo, \
u_int32_t lengthhi); }
; XXX note - bigendian is different
-201 AUE_NULL MSTD { int freebsd32_ftruncate(int fd, int pad, \
+201 AUE_FTRUNCATE COMPAT6 { int freebsd32_ftruncate(int fd, int pad, \
u_int32_t lengthlo, u_int32_t lengthhi); }
-202 AUE_NULL MSTD { int freebsd32_sysctl(int *name, \
+202 AUE_SYSCTL STD { int freebsd32_sysctl(int *name, \
u_int namelen, void *old, \
u_int32_t *oldlenp, void *new, \
u_int32_t newlen); }
-203 AUE_NULL MNOPROTO { int mlock(const void *addr, \
+203 AUE_MLOCK NOPROTO { int mlock(const void *addr, \
size_t len); }
-204 AUE_NULL MNOPROTO { int munlock(const void *addr, \
+204 AUE_MUNLOCK NOPROTO { int munlock(const void *addr, \
size_t len); }
-205 AUE_NULL MNOPROTO { int undelete(char *path); }
-206 AUE_NULL MSTD { int freebsd32_futimes(int fd, \
+205 AUE_UNDELETE NOPROTO { int undelete(char *path); }
+206 AUE_FUTIMES STD { int freebsd32_futimes(int fd, \
struct timeval32 *tptr); }
-207 AUE_NULL MNOPROTO { int getpgid(pid_t pid); }
+207 AUE_GETPGID NOPROTO { int getpgid(pid_t pid); }
208 AUE_NULL UNIMPL newreboot (NetBSD)
-209 AUE_NULL MNOPROTO { int poll(struct pollfd *fds, u_int nfds, \
+209 AUE_POLL NOPROTO { int poll(struct pollfd *fds, u_int nfds, \
int timeout); }
;
@@ -399,40 +395,40 @@
; The following were introduced with NetBSD/4.4Lite-2
; They are initialized by thier respective modules/sysinits
; XXX PROBLEM!!
-220 AUE_NULL MNOPROTO { int __semctl(int semid, int semnum, \
- int cmd, union semun *arg); }
-221 AUE_NULL MNOPROTO { int semget(key_t key, int nsems, \
+220 AUE_SEMCTL STD { int freebsd32_semctl(int semid, int semnum, \
+ int cmd, union semun32 *arg); }
+221 AUE_SEMGET NOPROTO { int semget(key_t key, int nsems, \
int semflg); }
-222 AUE_NULL MNOPROTO { int semop(int semid, struct sembuf *sops, \
+222 AUE_SEMOP NOPROTO { int semop(int semid, struct sembuf *sops, \
u_int nsops); }
223 AUE_NULL UNIMPL semconfig
-224 AUE_NULL MNOPROTO { int msgctl(int msqid, int cmd, \
- struct msqid_ds *buf); }
-225 AUE_NULL MNOPROTO { int msgget(key_t key, int msgflg); }
-226 AUE_NULL MNOPROTO { int msgsnd(int msqid, void *msgp, \
+224 AUE_MSGCTL STD { int freebsd32_msgctl(int msqid, int cmd, \
+ struct msqid_ds32 *buf); }
+225 AUE_MSGGET NOPROTO { int msgget(key_t key, int msgflg); }
+226 AUE_MSGSND STD { int freebsd32_msgsnd(int msqid, void *msgp, \
size_t msgsz, int msgflg); }
-227 AUE_NULL MNOPROTO { int msgrcv(int msqid, void *msgp, \
+227 AUE_MSGRCV STD { int freebsd32_msgrcv(int msqid, void *msgp, \
size_t msgsz, long msgtyp, int msgflg); }
-228 AUE_NULL MNOPROTO { int shmat(int shmid, void *shmaddr, \
+228 AUE_SHMAT NOPROTO { int shmat(int shmid, void *shmaddr, \
int shmflg); }
-229 AUE_NULL MNOPROTO { int shmctl(int shmid, int cmd, \
+229 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \
struct shmid_ds *buf); }
-230 AUE_NULL MNOPROTO { int shmdt(void *shmaddr); }
-231 AUE_NULL MNOPROTO { int shmget(key_t key, int size, \
+230 AUE_SHMDT NOPROTO { int shmdt(void *shmaddr); }
+231 AUE_SHMGET NOPROTO { int shmget(key_t key, int size, \
int shmflg); }
;
-232 AUE_NULL MSTD { int freebsd32_clock_gettime(clockid_t clock_id, \
+232 AUE_NULL STD { int freebsd32_clock_gettime(clockid_t clock_id, \
struct timespec32 *tp); }
-233 AUE_NULL MSTD { int freebsd32_clock_settime(clockid_t clock_id, \
+233 AUE_CLOCK_SETTIME STD { int freebsd32_clock_settime(clockid_t clock_id, \
const struct timespec32 *tp); }
-234 AUE_NULL MSTD { int freebsd32_clock_getres(clockid_t clock_id, \
+234 AUE_NULL STD { int freebsd32_clock_getres(clockid_t clock_id, \
struct timespec32 *tp); }
235 AUE_NULL UNIMPL timer_create
236 AUE_NULL UNIMPL timer_delete
237 AUE_NULL UNIMPL timer_settime
238 AUE_NULL UNIMPL timer_gettime
239 AUE_NULL UNIMPL timer_getoverrun
-240 AUE_NULL MSTD { int freebsd32_nanosleep( \
+240 AUE_NULL STD { int freebsd32_nanosleep( \
const struct timespec32 *rqtp, \
struct timespec32 *rmtp); }
241 AUE_NULL UNIMPL nosys
@@ -445,13 +441,13 @@
248 AUE_NULL UNIMPL ntp_gettime
249 AUE_NULL UNIMPL nosys
; syscall numbers initially used in OpenBSD
-250 AUE_NULL MNOPROTO { int minherit(void *addr, size_t len, \
+250 AUE_MINHERIT NOPROTO { int minherit(void *addr, size_t len, \
int inherit); }
-251 AUE_NULL MNOPROTO { int rfork(int flags); }
-252 AUE_NULL MNOPROTO { int openbsd_poll(struct pollfd *fds, \
+251 AUE_RFORK NOPROTO { int rfork(int flags); }
+252 AUE_POLL NOPROTO { int openbsd_poll(struct pollfd *fds, \
u_int nfds, int timeout); }
-253 AUE_NULL MNOPROTO { int issetugid(void); }
-254 AUE_NULL MNOPROTO { int lchown(char *path, int uid, int gid); }
+253 AUE_ISSETUGID NOPROTO { int issetugid(void); }
+254 AUE_LCHOWN NOPROTO { int lchown(char *path, int uid, int gid); }
255 AUE_NULL UNIMPL nosys
256 AUE_NULL UNIMPL nosys
257 AUE_NULL UNIMPL nosys
@@ -469,20 +465,20 @@
269 AUE_NULL UNIMPL nosys
270 AUE_NULL UNIMPL nosys
271 AUE_NULL UNIMPL nosys
-272 AUE_NULL MNOPROTO { int getdents(int fd, char *buf, \
+272 AUE_O_GETDENTS NOPROTO { int getdents(int fd, char *buf, \
size_t count); }
273 AUE_NULL UNIMPL nosys
-274 AUE_NULL MNOPROTO { int lchmod(char *path, mode_t mode); }
-275 AUE_NULL MNOPROTO { int lchown(char *path, uid_t uid, \
+274 AUE_LCHMOD NOPROTO { int lchmod(char *path, mode_t mode); }
+275 AUE_LCHOWN NOPROTO { int lchown(char *path, uid_t uid, \
gid_t gid); } netbsd_lchown \
lchown_args int
-276 AUE_NULL MSTD { int freebsd32_lutimes(char *path, \
+276 AUE_LUTIMES STD { int freebsd32_lutimes(char *path, \
struct timeval32 *tptr); }
-277 AUE_NULL MNOPROTO { int msync(void *addr, size_t len, \
+277 AUE_MSYNC NOPROTO { int msync(void *addr, size_t len, \
int flags); } netbsd_msync msync_args int
-278 AUE_NULL MNOPROTO { int nstat(char *path, struct nstat *ub); }
-279 AUE_NULL MNOPROTO { int nfstat(int fd, struct nstat *sb); }
-280 AUE_NULL MNOPROTO { int nlstat(char *path, struct nstat *ub); }
+278 AUE_STAT NOPROTO { int nstat(char *path, struct nstat *ub); }
+279 AUE_FSTAT NOPROTO { int nfstat(int fd, struct nstat *sb); }
+280 AUE_LSTAT NOPROTO { int nlstat(char *path, struct nstat *ub); }
281 AUE_NULL UNIMPL nosys
282 AUE_NULL UNIMPL nosys
283 AUE_NULL UNIMPL nosys
@@ -492,11 +488,11 @@
287 AUE_NULL UNIMPL nosys
288 AUE_NULL UNIMPL nosys
; 289 and 290 from NetBSD (OpenBSD: 267 and 268)
-289 AUE_NULL MSTD { ssize_t freebsd32_preadv(int fd, \
+289 AUE_PREADV STD { ssize_t freebsd32_preadv(int fd, \
struct iovec32 *iovp, \
u_int iovcnt, off_t offset); }
; XXX note - bigendian is different
-290 AUE_NULL MSTD { ssize_t freebsd32_pwritev(int fd, \
+290 AUE_PWRITEV STD { ssize_t freebsd32_pwritev(int fd, \
struct iovec32 *iovp, \
u_int iovcnt, off_t offset); }
; XXX note - bigendian is different
@@ -507,30 +503,30 @@
295 AUE_NULL UNIMPL nosys
296 AUE_NULL UNIMPL nosys
; XXX 297 is 300 in NetBSD
-297 AUE_NULL MCOMPAT4 { int freebsd32_fhstatfs( \
+297 AUE_FHSTATFS COMPAT4 { int freebsd32_fhstatfs( \
const struct fhandle *u_fhp, \
struct statfs32 *buf); }
-298 AUE_NULL MNOPROTO { int fhopen(const struct fhandle *u_fhp, \
+298 AUE_FHOPEN NOPROTO { int fhopen(const struct fhandle *u_fhp, \
int flags); }
-299 AUE_NULL MNOPROTO { int fhstat(const struct fhandle *u_fhp, \
+299 AUE_FHSTAT NOPROTO { int fhstat(const struct fhandle *u_fhp, \
struct stat *sb); }
; syscall numbers for FreeBSD
-300 AUE_NULL MNOPROTO { int modnext(int modid); }
-301 AUE_NULL MSTD { int freebsd32_modstat(int modid, \
+300 AUE_NULL NOPROTO { int modnext(int modid); }
+301 AUE_NULL STD { int freebsd32_modstat(int modid, \
struct module_stat32* stat); }
-302 AUE_NULL MNOPROTO { int modfnext(int modid); }
-303 AUE_NULL MNOPROTO { int modfind(const char *name); }
-304 AUE_NULL MNOPROTO { int kldload(const char *file); }
-305 AUE_NULL MNOPROTO { int kldunload(int fileid); }
-306 AUE_NULL MNOPROTO { int kldfind(const char *file); }
-307 AUE_NULL MNOPROTO { int kldnext(int fileid); }
-308 AUE_NULL MNOPROTO { int kldstat(int fileid, \
+302 AUE_NULL NOPROTO { int modfnext(int modid); }
+303 AUE_NULL NOPROTO { int modfind(const char *name); }
+304 AUE_MODLOAD NOPROTO { int kldload(const char *file); }
+305 AUE_MODUNLOAD NOPROTO { int kldunload(int fileid); }
+306 AUE_NULL NOPROTO { int kldfind(const char *file); }
+307 AUE_NULL NOPROTO { int kldnext(int fileid); }
+308 AUE_NULL NOPROTO { int kldstat(int fileid, \
struct kld_file_stat* stat); }
-309 AUE_NULL MNOPROTO { int kldfirstmod(int fileid); }
-310 AUE_NULL MNOPROTO { int getsid(pid_t pid); }
-311 AUE_NULL MNOPROTO { int setresuid(uid_t ruid, uid_t euid, \
+309 AUE_NULL NOPROTO { int kldfirstmod(int fileid); }
+310 AUE_GETSID NOPROTO { int getsid(pid_t pid); }
+311 AUE_SETRESUID NOPROTO { int setresuid(uid_t ruid, uid_t euid, \
uid_t suid); }
-312 AUE_NULL MNOPROTO { int setresgid(gid_t rgid, gid_t egid, \
+312 AUE_SETRESGID NOPROTO { int setresgid(gid_t rgid, gid_t egid, \
gid_t sgid); }
313 AUE_NULL OBSOL signanosleep
314 AUE_NULL UNIMPL aio_return
@@ -540,86 +536,89 @@
318 AUE_NULL UNIMPL aio_read
319 AUE_NULL UNIMPL aio_write
320 AUE_NULL UNIMPL lio_listio
-321 AUE_NULL MNOPROTO { int yield(void); }
+321 AUE_NULL NOPROTO { int yield(void); }
322 AUE_NULL OBSOL thr_sleep
323 AUE_NULL OBSOL thr_wakeup
-324 AUE_NULL MNOPROTO { int mlockall(int how); }
-325 AUE_NULL MNOPROTO { int munlockall(void); }
-326 AUE_NULL MNOPROTO { int __getcwd(u_char *buf, u_int buflen); }
+324 AUE_MLOCKALL NOPROTO { int mlockall(int how); }
+325 AUE_MUNLOCKALL NOPROTO { int munlockall(void); }
+326 AUE_GETCWD NOPROTO { int __getcwd(u_char *buf, u_int buflen); }
-327 AUE_NULL MNOPROTO { int sched_setparam (pid_t pid, \
+327 AUE_NULL NOPROTO { int sched_setparam (pid_t pid, \
const struct sched_param *param); }
-328 AUE_NULL MNOPROTO { int sched_getparam (pid_t pid, \
+328 AUE_NULL NOPROTO { int sched_getparam (pid_t pid, \
struct sched_param *param); }
-329 AUE_NULL MNOPROTO { int sched_setscheduler (pid_t pid, \
+329 AUE_NULL NOPROTO { int sched_setscheduler (pid_t pid, \
int policy, \
const struct sched_param *param); }
-330 AUE_NULL MNOPROTO { int sched_getscheduler (pid_t pid); }
+330 AUE_NULL NOPROTO { int sched_getscheduler (pid_t pid); }
-331 AUE_NULL MNOPROTO { int sched_yield (void); }
-332 AUE_NULL MNOPROTO { int sched_get_priority_max (int policy); }
-333 AUE_NULL MNOPROTO { int sched_get_priority_min (int policy); }
-334 AUE_NULL MNOPROTO { int sched_rr_get_interval (pid_t pid, \
+331 AUE_NULL NOPROTO { int sched_yield (void); }
+332 AUE_NULL NOPROTO { int sched_get_priority_max (int policy); }
+333 AUE_NULL NOPROTO { int sched_get_priority_min (int policy); }
+334 AUE_NULL NOPROTO { int sched_rr_get_interval (pid_t pid, \
struct timespec *interval); }
-335 AUE_NULL MNOPROTO { int utrace(const void *addr, size_t len); }
+335 AUE_NULL NOPROTO { int utrace(const void *addr, size_t len); }
; XXX note - bigendian is different
-336 AUE_NULL MCOMPAT4 { int freebsd32_sendfile(int fd, int s, \
+336 AUE_SENDFILE COMPAT4 { int freebsd32_sendfile(int fd, int s, \
u_int32_t offsetlo, u_int32_t offsethi, \
- size_t nbytes, struct sf_hdtr *hdtr, \
+ size_t nbytes, struct sf_hdtr32 *hdtr, \
off_t *sbytes, int flags); }
-337 AUE_NULL MNOPROTO { int kldsym(int fileid, int cmd, \
+337 AUE_NULL NOPROTO { int kldsym(int fileid, int cmd, \
void *data); }
-338 AUE_NULL MNOPROTO { int jail(struct jail *jail); }
+338 AUE_JAIL NOPROTO { int jail(struct jail *jail); }
339 AUE_NULL UNIMPL pioctl
-340 AUE_NULL MNOPROTO { int sigprocmask(int how, \
+340 AUE_SIGPROCMASK NOPROTO { int sigprocmask(int how, \
const sigset_t *set, sigset_t *oset); }
-341 AUE_NULL MNOPROTO { int sigsuspend(const sigset_t *sigmask); }
-342 AUE_NULL MCOMPAT4 { int freebsd32_sigaction(int sig, \
+341 AUE_SIGSUSPEND NOPROTO { int sigsuspend(const sigset_t *sigmask); }
+342 AUE_SIGACTION COMPAT4 { int freebsd32_sigaction(int sig, \
struct sigaction32 *act, \
struct sigaction32 *oact); }
-343 AUE_NULL MNOPROTO { int sigpending(sigset_t *set); }
-344 AUE_NULL MCOMPAT4 { int freebsd32_sigreturn( \
+343 AUE_SIGPENDING NOPROTO { int sigpending(sigset_t *set); }
+344 AUE_SIGRETURN COMPAT4 { int freebsd32_sigreturn( \
const struct freebsd4_freebsd32_ucontext *sigcntxp); }
-; XXX implement
-345 AUE_NULL UNIMPL sigtimedwait
-; XXX implement
-346 AUE_NULL UNIMPL sigwaitinfo
-347 AUE_NULL MNOPROTO { int __acl_get_file(const char *path, \
+345 AUE_SIGWAIT STD { int freebsd32_sigtimedwait(const sigset_t *set, \
+ siginfo_t *info, \
+ const struct timespec *timeout); }
+346 AUE_NULL STD { int freebsd32_sigwaitinfo(const sigset_t *set, \
+ siginfo_t *info); }
+347 AUE_NULL NOPROTO { int __acl_get_file(const char *path, \
acl_type_t type, struct acl *aclp); }
-348 AUE_NULL MNOPROTO { int __acl_set_file(const char *path, \
+348 AUE_NULL NOPROTO { int __acl_set_file(const char *path, \
acl_type_t type, struct acl *aclp); }
-349 AUE_NULL MNOPROTO { int __acl_get_fd(int filedes, \
+349 AUE_NULL NOPROTO { int __acl_get_fd(int filedes, \
acl_type_t type, struct acl *aclp); }
-350 AUE_NULL MNOPROTO { int __acl_set_fd(int filedes, \
+350 AUE_NULL NOPROTO { int __acl_set_fd(int filedes, \
acl_type_t type, struct acl *aclp); }
-351 AUE_NULL MNOPROTO { int __acl_delete_file(const char *path, \
+351 AUE_NULL NOPROTO { int __acl_delete_file(const char *path, \
acl_type_t type); }
-352 AUE_NULL MNOPROTO { int __acl_delete_fd(int filedes, \
+352 AUE_NULL NOPROTO { int __acl_delete_fd(int filedes, \
acl_type_t type); }
-353 AUE_NULL MNOPROTO { int __acl_aclcheck_file(const char *path, \
+353 AUE_NULL NOPROTO { int __acl_aclcheck_file(const char *path, \
acl_type_t type, struct acl *aclp); }
-354 AUE_NULL MNOPROTO { int __acl_aclcheck_fd(int filedes, \
+354 AUE_NULL NOPROTO { int __acl_aclcheck_fd(int filedes, \
acl_type_t type, struct acl *aclp); }
-355 AUE_NULL NOPROTO { int extattrctl(const char *path, int cmd, \
+355 AUE_EXTATTRCTL NOPROTO { int extattrctl(const char *path, int cmd, \
const char *filename, int attrnamespace, \
const char *attrname); }
-356 AUE_NULL NOPROTO { int extattr_set_file(const char *path, \
- int attrnamespace, const char *attrname, \
- void *data, size_t nbytes); }
-357 AUE_NULL NOPROTO { ssize_t extattr_get_file(const char *path, \
- int attrnamespace, const char *attrname, \
- void *data, size_t nbytes); }
-358 AUE_NULL NOPROTO { int extattr_delete_file(const char *path, \
- int attrnamespace, \
+356 AUE_EXTATTR_SET_FILE NOPROTO { int extattr_set_file( \
+ const char *path, int attrnamespace, \
+ const char *attrname, void *data, \
+ size_t nbytes); }
+357 AUE_EXTATTR_GET_FILE NOPROTO { ssize_t extattr_get_file( \
+ const char *path, int attrnamespace, \
+ const char *attrname, void *data, \
+ size_t nbytes); }
+358 AUE_EXTATTR_DELETE_FILE NOPROTO { int extattr_delete_file( \
+ const char *path, int attrnamespace, \
const char *attrname); }
359 AUE_NULL UNIMPL aio_waitcomplete
-360 AUE_NULL MNOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \
+360 AUE_GETRESUID NOPROTO { int getresuid(uid_t *ruid, uid_t *euid, \
uid_t *suid); }
-361 AUE_NULL MNOPROTO { int getresgid(gid_t *rgid, gid_t *egid, \
+361 AUE_GETRESGID NOPROTO { int getresgid(gid_t *rgid, gid_t *egid, \
gid_t *sgid); }
-362 AUE_NULL MNOPROTO { int kqueue(void); }
-363 AUE_NULL MSTD { int freebsd32_kevent(int fd, \
+362 AUE_KQUEUE NOPROTO { int kqueue(void); }
+363 AUE_NULL STD { int freebsd32_kevent(int fd, \
const struct kevent32 *changelist, \
int nchanges, \
struct kevent32 *eventlist, int nevents, \
@@ -631,50 +630,50 @@
368 AUE_NULL UNIMPL __cap_set_fd
369 AUE_NULL UNIMPL __cap_set_file
370 AUE_NULL UNIMPL lkmressys
-371 AUE_NULL NOPROTO { int extattr_set_fd(int fd, \
+371 AUE_EXTATTR_SET_FD NOPROTO { int extattr_set_fd(int fd, \
int attrnamespace, const char *attrname, \
void *data, size_t nbytes); }
-372 AUE_NULL NOPROTO { ssize_t extattr_get_fd(int fd, \
+372 AUE_EXTATTR_GET_FD NOPROTO { ssize_t extattr_get_fd(int fd, \
int attrnamespace, const char *attrname, \
void *data, size_t nbytes); }
-373 AUE_NULL NOPROTO { int extattr_delete_fd(int fd, \
+373 AUE_EXTATTR_DELETE_FD NOPROTO { int extattr_delete_fd(int fd, \
int attrnamespace, \
const char *attrname); }
-374 AUE_NULL MNOPROTO { int __setugid(int flag); }
+374 AUE_NULL NOPROTO { int __setugid(int flag); }
375 AUE_NULL UNIMPL nfsclnt
-376 AUE_NULL MNOPROTO { int eaccess(char *path, int flags); }
+376 AUE_EACCESS NOPROTO { int eaccess(char *path, int flags); }
377 AUE_NULL UNIMPL afs_syscall
-378 AUE_NULL NOPROTO { int nmount(struct iovec *iovp, \
+378 AUE_NMOUNT NOPROTO { int nmount(struct iovec *iovp, \
unsigned int iovcnt, int flags); }
-379 AUE_NULL MNOPROTO { int kse_exit(void); }
-380 AUE_NULL MNOPROTO { int kse_wakeup(struct kse_mailbox *mbx); }
-381 AUE_NULL MNOPROTO { int kse_create(struct kse_mailbox *mbx, \
+379 AUE_NULL NOPROTO { int kse_exit(void); }
+380 AUE_NULL NOPROTO { int kse_wakeup(struct kse_mailbox *mbx); }
+381 AUE_NULL NOPROTO { int kse_create(struct kse_mailbox *mbx, \
int newgroup); }
-382 AUE_NULL MNOPROTO { int kse_thr_interrupt( \
+382 AUE_NULL NOPROTO { int kse_thr_interrupt( \
struct kse_thr_mailbox *tmbx); }
-383 AUE_NULL MNOPROTO { int kse_release(void); }
+383 AUE_NULL NOPROTO { int kse_release(void); }
384 AUE_NULL UNIMPL __mac_get_proc
385 AUE_NULL UNIMPL __mac_set_proc
386 AUE_NULL UNIMPL __mac_get_fd
387 AUE_NULL UNIMPL __mac_get_file
388 AUE_NULL UNIMPL __mac_set_fd
389 AUE_NULL UNIMPL __mac_set_file
-390 AUE_NULL MNOPROTO { int kenv(int what, const char *name, \
+390 AUE_NULL NOPROTO { int kenv(int what, const char *name, \
char *value, int len); }
-391 AUE_NULL MNOPROTO { int lchflags(const char *path, int flags); }
-392 AUE_NULL MNOPROTO { int uuidgen(struct uuid *store, \
+391 AUE_LCHFLAGS NOPROTO { int lchflags(const char *path, int flags); }
+392 AUE_NULL NOPROTO { int uuidgen(struct uuid *store, \
int count); }
-393 AUE_NULL MSTD { int freebsd32_sendfile(int fd, int s, \
+393 AUE_SENDFILE STD { int freebsd32_sendfile(int fd, int s, \
u_int32_t offsetlo, u_int32_t offsethi, \
- size_t nbytes, struct sf_hdtr *hdtr, \
+ size_t nbytes, struct sf_hdtr32 *hdtr, \
off_t *sbytes, int flags); }
394 AUE_NULL UNIMPL mac_syscall
-395 AUE_NULL MNOPROTO { int getfsstat(struct statfs *buf, \
+395 AUE_GETFSSTAT NOPROTO { int getfsstat(struct statfs *buf, \
long bufsize, int flags); }
-396 AUE_NULL MNOPROTO { int statfs(char *path, \
+396 AUE_STATFS NOPROTO { int statfs(char *path, \
struct statfs *buf); }
-397 AUE_NULL MNOPROTO { int fstatfs(int fd, struct statfs *buf); }
-398 AUE_NULL MNOPROTO { int fhstatfs(const struct fhandle *u_fhp, \
+397 AUE_FSTATFS NOPROTO { int fstatfs(int fd, struct statfs *buf); }
+398 AUE_FHSTATFS NOPROTO { int fhstatfs(const struct fhandle *u_fhp, \
struct statfs *buf); }
399 AUE_NULL UNIMPL nosys
; XXX implement these?
@@ -690,55 +689,110 @@
409 AUE_NULL UNIMPL __mac_get_pid
410 AUE_NULL UNIMPL __mac_get_link
411 AUE_NULL UNIMPL __mac_set_link
-412 AUE_NULL UNIMPL extattr_set_link
-413 AUE_NULL UNIMPL extattr_get_link
-414 AUE_NULL UNIMPL extattr_delete_link
+412 AUE_EXTATTR_SET_LINK UNIMPL extattr_set_link
+413 AUE_EXTATTR_GET_LINK UNIMPL extattr_get_link
+414 AUE_EXTATTR_DELETE_LINK UNIMPL extattr_delete_link
415 AUE_NULL UNIMPL __mac_execve
-416 AUE_NULL MSTD { int freebsd32_sigaction(int sig, \
+416 AUE_SIGACTION STD { int freebsd32_sigaction(int sig, \
struct sigaction32 *act, \
struct sigaction32 *oact); }
-417 AUE_NULL MSTD { int freebsd32_sigreturn( \
+417 AUE_SIGRETURN STD { int freebsd32_sigreturn( \
const struct freebsd32_ucontext *sigcntxp); }
418 AUE_NULL UNIMPL __xstat
419 AUE_NULL UNIMPL __xfstat
420 AUE_NULL UNIMPL __xlstat
-; XXX implement
-421 AUE_NULL UNIMPL getcontext
-; XXX implement
-422 AUE_NULL UNIMPL setcontext
-; XXX implement
-423 AUE_NULL UNIMPL swapcontext
-424 AUE_NULL UNIMPL swapoff
+421 AUE_NULL STD { int freebsd32_getcontext( \
+ struct freebsd32_ucontext *ucp); }
+422 AUE_NULL STD { int freebsd32_setcontext( \
+ const struct freebsd32_ucontext *ucp); }
+423 AUE_NULL STD { int freebsd32_swapcontext( \
+ struct freebsd32_ucontext *oucp, \
+ const struct freebsd32_ucontext *ucp); }
+424 AUE_SWAPOFF UNIMPL swapoff
425 AUE_NULL UNIMPL __acl_get_link
426 AUE_NULL UNIMPL __acl_set_link
427 AUE_NULL UNIMPL __acl_delete_link
428 AUE_NULL UNIMPL __acl_aclcheck_link
-; XXX implement
-429 AUE_NULL UNIMPL sigwait
-430 AUE_NULL MNOPROTO { int thr_create(ucontext_t *ctx, long *id, \
- int flag s); }
-431 AUE_NULL MNOPROTO { void thr_exit(long *state); }
-432 AUE_NULL MNOPROTO { int thr_self(long *id); }
-433 AUE_NULL MNOPROTO { int thr_kill(long id, int sig); }
-434 AUE_NULL MNOPROTO { int _umtx_lock(struct umtx *umtx); }
-435 AUE_NULL MNOPROTO { int _umtx_unlock(struct umtx *umtx); }
-436 AUE_NULL MNOPROTO { int jail_attach(int jid); }
-437 AUE_NULL UNIMPL extattr_list_fd
-438 AUE_NULL UNIMPL extattr_list_file
-439 AUE_NULL UNIMPL extattr_list_link
+429 AUE_SIGWAIT NOPROTO { int sigwait(const sigset_t *set, \
+ int *sig); }
+430 AUE_NULL UNIMPL thr_create;
+431 AUE_NULL NOPROTO { void thr_exit(long *state); }
+432 AUE_NULL NOPROTO { int thr_self(long *id); }
+433 AUE_NULL NOPROTO { int thr_kill(long id, int sig); }
+434 AUE_NULL STD { int freebsd32_umtx_lock(struct umtx *umtx); }
+435 AUE_NULL STD { int freebsd32_umtx_unlock(struct umtx *umtx); }
+436 AUE_NULL NOPROTO { int jail_attach(int jid); }
+437 AUE_EXTATTR_LIST_FD UNIMPL extattr_list_fd
+438 AUE_EXTATTR_LIST_FILE UNIMPL extattr_list_file
+439 AUE_EXTATTR_LIST_LINK UNIMPL extattr_list_link
440 AUE_NULL UNIMPL kse_switchin
441 AUE_NULL UNIMPL ksem_timedwait
-442 AUE_NULL MNOPROTO { int thr_suspend( \
- const struct timespec *timeout); }
-443 AUE_NULL MNOPROTO { int thr_wake(long id); }
-444 AUE_NULL MNOPROTO { int kldunloadf(int fileid, int flags); }
-445 AUE_NULL UNIMPL audit
-446 AUE_NULL UNIMPL auditon
-447 AUE_NULL UNIMPL getauid
-448 AUE_NULL UNIMPL setauid
-449 AUE_NULL UNIMPL getaudit
-450 AUE_NULL UNIMPL setaudit
-451 AUE_NULL UNIMPL getaudit_addr
-452 AUE_NULL UNIMPL setaudit_addr
-453 AUE_NULL UNIMPL auditctl
-454 AUE_NULL UNIMPL _umtx_op
+442 AUE_NULL STD { int freebsd32_thr_suspend( \
+ const struct timespec32 *timeout); }
+443 AUE_NULL NOPROTO { int thr_wake(long id); }
+444 AUE_MODUNLOAD NOPROTO { int kldunloadf(int fileid, int flags); }
+445 AUE_AUDIT NOPROTO { int audit(const void *record, \
+ u_int length); }
+446 AUE_AUDITON NOPROTO { int auditon(int cmd, void *data, \
+ u_int length); }
+447 AUE_GETAUID NOPROTO { int getauid(uid_t *auid); }
+448 AUE_SETAUID NOPROTO { int setauid(uid_t *auid); }
+449 AUE_GETAUDIT NOPROTO { int getaudit(struct auditinfo *auditinfo); }
+450 AUE_SETAUDIT NOPROTO { int setaudit(struct auditinfo *auditinfo); }
+451 AUE_GETAUDIT_ADDR NOPROTO { int getaudit_addr( \
+ struct auditinfo_addr *auditinfo_addr, \
+ u_int length); }
+452 AUE_SETAUDIT_ADDR NOPROTO { int setaudit_addr( \
+ struct auditinfo_addr *auditinfo_addr, \
+ u_int length); }
+453 AUE_AUDITCTL NOPROTO { int auditctl(char *path); }
+454 AUE_NULL STD { int freebsd32_umtx_op(void *obj, int op,\
+ u_long val, void *uaddr, \
+ void *uaddr2); }
+455 AUE_NULL STD { int freebsd32_thr_new( \
+ struct thr_param32 *param, \
+ int param_size); }
+456 AUE_NULL NOPROTO { int sigqueue(pid_t pid, int signum, \
+ void *value); }
+457 AUE_NULL UNIMPL kmq_open
+458 AUE_NULL UNIMPL kmq_setattr
+459 AUE_NULL UNIMPL kmq_timedreceive
+460 AUE_NULL UNIMPL kmq_timedsend
+461 AUE_NULL UNIMPL kmq_notify
+462 AUE_NULL UNIMPL kmq_unlink
+463 AUE_NULL NOPROTO { int abort2(const char *why, int nargs, void **args); }
+464 AUE_NULL NOPROTO { int thr_set_name(long id, const char *name); }
+465 AUE_NULL UNIMPL aio_fsync
+466 AUE_RTPRIO NOPROTO { int rtprio_thread(int function, \
+ lwpid_t lwpid, struct rtprio *rtp); }
+467 AUE_NULL UNIMPL nosys
+468 AUE_NULL UNIMPL nosys
+469 AUE_NULL UNIMPL __getpath_fromfd
+470 AUE_NULL UNIMPL __getpath_fromaddr
+471 AUE_NULL NOPROTO { int sctp_peeloff(int sd, uint32_t name); }
+472 AUE_NULL NOPROTO { int sctp_generic_sendmsg(int sd, caddr_t msg, int mlen, \
+ caddr_t to, __socklen_t tolen, \
+ struct sctp_sndrcvinfo *sinfo, int flags); }
+473 AUE_NULL NOPROTO { int sctp_generic_sendmsg_iov(int sd, struct iovec *iov, int iovlen, \
+ caddr_t to, __socklen_t tolen, \
+ struct sctp_sndrcvinfo *sinfo, int flags); }
+474 AUE_NULL NOPROTO { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \
+ struct sockaddr * from, __socklen_t *fromlenaddr, \
+ struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
+475 AUE_PREAD STD { ssize_t freebsd32_pread(int fd, \
+ void *buf,size_t nbyte, \
+ u_int32_t offsetlo, u_int32_t offsethi); }
+476 AUE_PWRITE STD { ssize_t freebsd32_pwrite(int fd, \
+ const void *buf, size_t nbyte, \
+ u_int32_t offsetlo, u_int32_t offsethi); }
+477 AUE_MMAP STD { caddr_t freebsd32_mmap(caddr_t addr, \
+ size_t len, int prot, int flags, int fd, \
+ u_int32_t poslo, u_int32_t poshi); }
+478 AUE_LSEEK STD { off_t freebsd32_lseek(int fd, \
+ u_int32_t offsetlo, u_int32_t offsethi, \
+ int whence); }
+479 AUE_TRUNCATE STD { int freebsd32_truncate(char *path, \
+ u_int32_t lengthlo, u_int32_t lengthhi); }
+480 AUE_FTRUNCATE STD { int freebsd32_ftruncate(int fd, \
+ u_int32_t lengthlo, u_int32_t lengthhi); }
+481 AUE_KILL NOPROTO { int thr_kill2(pid_t pid, long id, int sig); }
Index: syscalls.conf
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/syscalls.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/freebsd32/syscalls.conf -L sys/compat/freebsd32/syscalls.conf -u -r1.1.1.1 -r1.2
--- sys/compat/freebsd32/syscalls.conf
+++ sys/compat/freebsd32/syscalls.conf
@@ -1,4 +1,5 @@
-# $FreeBSD: src/sys/compat/freebsd32/syscalls.conf,v 1.4 2003/12/24 00:32:07 peter Exp $
+# $MidnightBSD$
+# $FreeBSD: src/sys/compat/freebsd32/syscalls.conf,v 1.5 2006/08/15 17:25:54 jhb Exp $
sysnames="freebsd32_syscalls.c"
sysproto="freebsd32_proto.h"
sysproto_h=_FREEBSD32_SYSPROTO_H_
@@ -8,4 +9,4 @@
syscallprefix="FREEBSD32_SYS_"
switchname="freebsd32_sysent"
namesname="freebsd32_syscallnames"
-sysvec="\n"
+systrace="/dev/null"
Index: freebsd32.h
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/freebsd32/freebsd32.h -L sys/compat/freebsd32/freebsd32.h -u -r1.1.1.1 -r1.2
--- sys/compat/freebsd32/freebsd32.h
+++ sys/compat/freebsd32/freebsd32.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32.h,v 1.4 2004/04/14 23:17:37 peter Exp $
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32.h,v 1.6.2.1 2007/12/19 20:37:53 jhb Exp $
*/
#ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
@@ -45,7 +45,7 @@
#define TV_CP(src,dst,fld) do { \
CP((src).fld,(dst).fld,tv_sec); \
CP((src).fld,(dst).fld,tv_usec); \
-} while (0);
+} while (0)
struct timespec32 {
u_int32_t tv_sec;
@@ -75,6 +75,11 @@
int32_t ru_nivcsw;
};
+struct itimerval32 {
+ struct timeval32 it_interval;
+ struct timeval32 it_value;
+};
+
#define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
/* 4.x version */
@@ -103,4 +108,69 @@
int32_t f_spare[2];
};
+struct kevent32 {
+ u_int32_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ u_short flags;
+ u_int fflags;
+ int32_t data;
+ u_int32_t udata; /* opaque user data identifier */
+};
+
+struct iovec32 {
+ u_int32_t iov_base;
+ int iov_len;
+};
+
+struct msghdr32 {
+ u_int32_t msg_name;
+ socklen_t msg_namelen;
+ u_int32_t msg_iov;
+ int msg_iovlen;
+ u_int32_t msg_control;
+ socklen_t msg_controllen;
+ int msg_flags;
+};
+
+struct stat32 {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ struct timespec32 st_atimespec;
+ struct timespec32 st_mtimespec;
+ struct timespec32 st_ctimespec;
+ off_t st_size;
+ int64_t st_blocks;
+ u_int32_t st_blksize;
+ u_int32_t st_flags;
+ u_int32_t st_gen;
+ struct timespec32 st_birthtimespec;
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
+ unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
+};
+
+struct sigaction32 {
+ u_int32_t sa_u;
+ int sa_flags;
+ sigset_t sa_mask;
+};
+
+struct thr_param32 {
+ uint32_t start_func;
+ uint32_t arg;
+ uint32_t stack_base;
+ uint32_t stack_size;
+ uint32_t tls_base;
+ uint32_t tls_size;
+ uint32_t child_tid;
+ uint32_t parent_tid;
+ int32_t flags;
+ uint32_t rtp;
+ uint32_t spare[3];
+};
+
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
--- /dev/null
+++ sys/compat/freebsd32/freebsd32_signal.h
@@ -0,0 +1,75 @@
+/*-
+ * Copyright (c) 2006 David Xu <davidxu at freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_signal.h,v 1.1 2006/10/05 01:58:08 davidxu Exp $
+ */
+
+#ifndef _COMPAT_FREEBSD32_SIGNAL_H_
+#define _COMPAT_FREEBSD32_SIGNAL_H_
+
+struct sigaltstack32 {
+ u_int32_t ss_sp; /* signal stack base */
+ u_int32_t ss_size; /* signal stack length */
+ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
+};
+
+union sigval32 {
+ int sigval_int;
+ u_int32_t sigval_ptr;
+};
+
+struct siginfo32 {
+ int si_signo; /* signal number */
+ int si_errno; /* errno association */
+ int si_code; /* signal code */
+ int32_t si_pid; /* sending process */
+ u_int32_t si_uid; /* sender's ruid */
+ int si_status; /* exit value */
+ u_int32_t si_addr; /* faulting instruction */
+ union sigval32 si_value; /* signal value */
+ union {
+ struct {
+ int _trapno;/* machine specific trap code */
+ } _fault;
+ struct {
+ int _timerid;
+ int _overrun;
+ } _timer;
+ struct {
+ int _mqd;
+ } _mesgq;
+ struct {
+ int _band; /* band event for SIGPOLL */
+ } _poll; /* was this ever used ? */
+ struct {
+ int __spare1__;
+ int __spare2__[7];
+ } __spare__;
+ } _reason;
+};
+
+void siginfo_to_siginfo32(siginfo_t *src, struct siginfo32 *dst);
+
+#endif /* !_COMPAT_FREEBSD32_SIGNAL_H_ */
Index: freebsd32_syscall.h
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32_syscall.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/freebsd32/freebsd32_syscall.h -L sys/compat/freebsd32/freebsd32_syscall.h -u -r1.1.1.2 -r1.2
--- sys/compat/freebsd32/freebsd32_syscall.h
+++ sys/compat/freebsd32/freebsd32_syscall.h
@@ -2,8 +2,8 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.38.2.4 2006/01/27 17:17:23 ambrisko Exp $
- * created from FreeBSD
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.76.2.1 2007/12/19 20:48:53 jhb Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.91.2.2 2007/12/19 20:43:41 jhb Exp
*/
#define FREEBSD32_SYS_syscall 0
@@ -24,7 +24,7 @@
#define FREEBSD32_SYS_chmod 15
#define FREEBSD32_SYS_chown 16
#define FREEBSD32_SYS_break 17
- /* 18 is old freebsd32_getfsstat */
+#define FREEBSD32_SYS_freebsd4_freebsd32_getfsstat 18
/* 19 is obsolete olseek */
#define FREEBSD32_SYS_getpid 20
#define FREEBSD32_SYS_mount 21
@@ -153,8 +153,8 @@
/* 149 is obsolete oquota */
/* 150 is obsolete ogetsockname */
/* 156 is obsolete ogetdirentries */
- /* 157 is old freebsd32_statfs */
- /* 158 is old freebsd32_fstatfs */
+#define FREEBSD32_SYS_freebsd4_freebsd32_statfs 157
+#define FREEBSD32_SYS_freebsd4_freebsd32_fstatfs 158
#define FREEBSD32_SYS_getfh 161
#define FREEBSD32_SYS_getdomainname 162
#define FREEBSD32_SYS_setdomainname 163
@@ -164,8 +164,8 @@
#define FREEBSD32_SYS_freebsd32_semsys 169
#define FREEBSD32_SYS_freebsd32_msgsys 170
#define FREEBSD32_SYS_freebsd32_shmsys 171
-#define FREEBSD32_SYS_freebsd32_pread 173
-#define FREEBSD32_SYS_freebsd32_pwrite 174
+#define FREEBSD32_SYS_freebsd6_freebsd32_pread 173
+#define FREEBSD32_SYS_freebsd6_freebsd32_pwrite 174
#define FREEBSD32_SYS_ntp_adjtime 176
#define FREEBSD32_SYS_setgid 181
#define FREEBSD32_SYS_setegid 182
@@ -178,11 +178,11 @@
#define FREEBSD32_SYS_getrlimit 194
#define FREEBSD32_SYS_setrlimit 195
#define FREEBSD32_SYS_getdirentries 196
-#define FREEBSD32_SYS_freebsd32_mmap 197
+#define FREEBSD32_SYS_freebsd6_freebsd32_mmap 197
#define FREEBSD32_SYS___syscall 198
-#define FREEBSD32_SYS_freebsd32_lseek 199
-#define FREEBSD32_SYS_freebsd32_truncate 200
-#define FREEBSD32_SYS_freebsd32_ftruncate 201
+#define FREEBSD32_SYS_freebsd6_freebsd32_lseek 199
+#define FREEBSD32_SYS_freebsd6_freebsd32_truncate 200
+#define FREEBSD32_SYS_freebsd6_freebsd32_ftruncate 201
#define FREEBSD32_SYS_freebsd32_sysctl 202
#define FREEBSD32_SYS_mlock 203
#define FREEBSD32_SYS_munlock 204
@@ -190,15 +190,15 @@
#define FREEBSD32_SYS_freebsd32_futimes 206
#define FREEBSD32_SYS_getpgid 207
#define FREEBSD32_SYS_poll 209
-#define FREEBSD32_SYS___semctl 220
+#define FREEBSD32_SYS_freebsd32_semctl 220
#define FREEBSD32_SYS_semget 221
#define FREEBSD32_SYS_semop 222
-#define FREEBSD32_SYS_msgctl 224
+#define FREEBSD32_SYS_freebsd32_msgctl 224
#define FREEBSD32_SYS_msgget 225
-#define FREEBSD32_SYS_msgsnd 226
-#define FREEBSD32_SYS_msgrcv 227
+#define FREEBSD32_SYS_freebsd32_msgsnd 226
+#define FREEBSD32_SYS_freebsd32_msgrcv 227
#define FREEBSD32_SYS_shmat 228
-#define FREEBSD32_SYS_shmctl 229
+#define FREEBSD32_SYS_freebsd32_shmctl 229
#define FREEBSD32_SYS_shmdt 230
#define FREEBSD32_SYS_shmget 231
#define FREEBSD32_SYS_freebsd32_clock_gettime 232
@@ -220,7 +220,7 @@
#define FREEBSD32_SYS_nlstat 280
#define FREEBSD32_SYS_freebsd32_preadv 289
#define FREEBSD32_SYS_freebsd32_pwritev 290
- /* 297 is old freebsd32_fhstatfs */
+#define FREEBSD32_SYS_freebsd4_freebsd32_fhstatfs 297
#define FREEBSD32_SYS_fhopen 298
#define FREEBSD32_SYS_fhstat 299
#define FREEBSD32_SYS_modnext 300
@@ -252,14 +252,16 @@
#define FREEBSD32_SYS_sched_get_priority_min 333
#define FREEBSD32_SYS_sched_rr_get_interval 334
#define FREEBSD32_SYS_utrace 335
- /* 336 is old freebsd32_sendfile */
+#define FREEBSD32_SYS_freebsd4_freebsd32_sendfile 336
#define FREEBSD32_SYS_kldsym 337
#define FREEBSD32_SYS_jail 338
#define FREEBSD32_SYS_sigprocmask 340
#define FREEBSD32_SYS_sigsuspend 341
- /* 342 is old freebsd32_sigaction */
+#define FREEBSD32_SYS_freebsd4_freebsd32_sigaction 342
#define FREEBSD32_SYS_sigpending 343
- /* 344 is old freebsd32_sigreturn */
+#define FREEBSD32_SYS_freebsd4_freebsd32_sigreturn 344
+#define FREEBSD32_SYS_freebsd32_sigtimedwait 345
+#define FREEBSD32_SYS_freebsd32_sigwaitinfo 346
#define FREEBSD32_SYS___acl_get_file 347
#define FREEBSD32_SYS___acl_set_file 348
#define FREEBSD32_SYS___acl_get_fd 349
@@ -297,14 +299,43 @@
#define FREEBSD32_SYS_fhstatfs 398
#define FREEBSD32_SYS_freebsd32_sigaction 416
#define FREEBSD32_SYS_freebsd32_sigreturn 417
-#define FREEBSD32_SYS_thr_create 430
+#define FREEBSD32_SYS_freebsd32_getcontext 421
+#define FREEBSD32_SYS_freebsd32_setcontext 422
+#define FREEBSD32_SYS_freebsd32_swapcontext 423
+#define FREEBSD32_SYS_sigwait 429
#define FREEBSD32_SYS_thr_exit 431
#define FREEBSD32_SYS_thr_self 432
#define FREEBSD32_SYS_thr_kill 433
-#define FREEBSD32_SYS__umtx_lock 434
-#define FREEBSD32_SYS__umtx_unlock 435
+#define FREEBSD32_SYS_freebsd32_umtx_lock 434
+#define FREEBSD32_SYS_freebsd32_umtx_unlock 435
#define FREEBSD32_SYS_jail_attach 436
-#define FREEBSD32_SYS_thr_suspend 442
+#define FREEBSD32_SYS_freebsd32_thr_suspend 442
#define FREEBSD32_SYS_thr_wake 443
#define FREEBSD32_SYS_kldunloadf 444
-#define FREEBSD32_SYS_MAXSYSCALL 455
+#define FREEBSD32_SYS_audit 445
+#define FREEBSD32_SYS_auditon 446
+#define FREEBSD32_SYS_getauid 447
+#define FREEBSD32_SYS_setauid 448
+#define FREEBSD32_SYS_getaudit 449
+#define FREEBSD32_SYS_setaudit 450
+#define FREEBSD32_SYS_getaudit_addr 451
+#define FREEBSD32_SYS_setaudit_addr 452
+#define FREEBSD32_SYS_auditctl 453
+#define FREEBSD32_SYS_freebsd32_umtx_op 454
+#define FREEBSD32_SYS_freebsd32_thr_new 455
+#define FREEBSD32_SYS_sigqueue 456
+#define FREEBSD32_SYS_abort2 463
+#define FREEBSD32_SYS_thr_set_name 464
+#define FREEBSD32_SYS_rtprio_thread 466
+#define FREEBSD32_SYS_sctp_peeloff 471
+#define FREEBSD32_SYS_sctp_generic_sendmsg 472
+#define FREEBSD32_SYS_sctp_generic_sendmsg_iov 473
+#define FREEBSD32_SYS_sctp_generic_recvmsg 474
+#define FREEBSD32_SYS_freebsd32_pread 475
+#define FREEBSD32_SYS_freebsd32_pwrite 476
+#define FREEBSD32_SYS_freebsd32_mmap 477
+#define FREEBSD32_SYS_freebsd32_lseek 478
+#define FREEBSD32_SYS_freebsd32_truncate 479
+#define FREEBSD32_SYS_freebsd32_ftruncate 480
+#define FREEBSD32_SYS_thr_kill2 481
+#define FREEBSD32_SYS_MAXSYSCALL 482
--- /dev/null
+++ sys/compat/freebsd32/freebsd32_ipc.h
@@ -0,0 +1,106 @@
+/*-
+ * Copyright (c) 2002 Doug Rabson
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_ipc.h,v 1.2.2.2 2007/12/19 20:43:41 jhb Exp $
+ */
+
+#ifndef _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
+#define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_
+
+struct ipc_perm32 {
+ uint16_t cuid;
+ uint16_t cgid;
+ uint16_t uid;
+ uint16_t gid;
+ uint16_t mode;
+ uint16_t seq;
+ uint32_t key;
+};
+
+struct semid_ds32 {
+ struct ipc_perm32 sem_perm;
+ uint32_t sem_base;
+ unsigned short sem_nsems;
+ int32_t sem_otime;
+ int32_t sem_pad1;
+ int32_t sem_ctime;
+ int32_t sem_pad2;
+ int32_t sem_pad3[4];
+};
+
+union semun32 {
+ int val;
+ uint32_t buf;
+ uint32_t array;
+};
+
+struct msqid_ds32 {
+ struct ipc_perm32 msg_perm;
+ uint32_t msg_first;
+ uint32_t msg_last;
+ uint32_t msg_cbytes;
+ uint32_t msg_qnum;
+ uint32_t msg_qbytes;
+ pid_t msg_lspid;
+ pid_t msg_lrpid;
+ int32_t msg_stime;
+ int32_t msg_pad1;
+ int32_t msg_rtime;
+ int32_t msg_pad2;
+ int32_t msg_ctime;
+ int32_t msg_pad3;
+ int32_t msg_pad4[4];
+};
+
+struct shmid_ds32 {
+ struct ipc_perm32 shm_perm;
+ int32_t shm_segsz;
+ int32_t shm_lpid;
+ int32_t shm_cpid;
+ int16_t shm_nattch;
+ int32_t shm_atime;
+ int32_t shm_dtime;
+ int32_t shm_ctime;
+ uint32_t shm_internal;
+};
+
+struct shm_info32 {
+ int32_t used_ids;
+ uint32_t shm_tot;
+ uint32_t shm_rss;
+ uint32_t shm_swp;
+ uint32_t swap_attempts;
+ uint32_t swap_successes;
+};
+
+struct shminfo32 {
+ uint32_t shmmax;
+ uint32_t shmmin;
+ uint32_t shmmni;
+ uint32_t shmseg;
+ uint32_t shmall;
+};
+
+#endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */
Index: freebsd32_syscalls.c
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32_syscalls.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/freebsd32/freebsd32_syscalls.c -L sys/compat/freebsd32/freebsd32_syscalls.c -u -r1.1.1.2 -r1.2
--- sys/compat/freebsd32/freebsd32_syscalls.c
+++ sys/compat/freebsd32/freebsd32_syscalls.c
@@ -2,8 +2,8 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.29.2.4 2006/01/27 17:17:23 ambrisko Exp $
- * created from FreeBSD
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.67.2.1 2007/12/19 20:48:53 jhb Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.91.2.2 2007/12/19 20:43:41 jhb Exp
*/
const char *freebsd32_syscallnames[] = {
@@ -25,7 +25,7 @@
"chmod", /* 15 = chmod */
"chown", /* 16 = chown */
"break", /* 17 = break */
- "old.freebsd32_getfsstat", /* 18 = old freebsd32_getfsstat */
+ "compat4.freebsd32_getfsstat", /* 18 = old freebsd32_getfsstat */
"obs_olseek", /* 19 = obsolete olseek */
"getpid", /* 20 = getpid */
"mount", /* 21 = mount */
@@ -53,13 +53,13 @@
"getegid", /* 43 = getegid */
"profil", /* 44 = profil */
"ktrace", /* 45 = ktrace */
- "old.freebsd32_sigaction", /* 46 = old freebsd32_sigaction */
+ "compat.freebsd32_sigaction", /* 46 = old freebsd32_sigaction */
"getgid", /* 47 = getgid */
- "old.freebsd32_sigprocmask", /* 48 = old freebsd32_sigprocmask */
+ "compat.freebsd32_sigprocmask", /* 48 = old freebsd32_sigprocmask */
"getlogin", /* 49 = getlogin */
"setlogin", /* 50 = setlogin */
"acct", /* 51 = acct */
- "old.freebsd32_sigpending", /* 52 = old freebsd32_sigpending */
+ "compat.freebsd32_sigpending", /* 52 = old freebsd32_sigpending */
"freebsd32_sigaltstack", /* 53 = freebsd32_sigaltstack */
"ioctl", /* 54 = ioctl */
"reboot", /* 55 = reboot */
@@ -115,11 +115,11 @@
"setsockopt", /* 105 = setsockopt */
"listen", /* 106 = listen */
"obs_vtimes", /* 107 = obsolete vtimes */
- "old.freebsd32_sigvec", /* 108 = old freebsd32_sigvec */
- "old.freebsd32_sigblock", /* 109 = old freebsd32_sigblock */
- "old.freebsd32_sigsetmask", /* 110 = old freebsd32_sigsetmask */
- "old.freebsd32_sigsuspend", /* 111 = old freebsd32_sigsuspend */
- "old.freebsd32_sigstack", /* 112 = old freebsd32_sigstack */
+ "compat.freebsd32_sigvec", /* 108 = old freebsd32_sigvec */
+ "compat.freebsd32_sigblock", /* 109 = old freebsd32_sigblock */
+ "compat.freebsd32_sigsetmask", /* 110 = old freebsd32_sigsetmask */
+ "compat.freebsd32_sigsuspend", /* 111 = old freebsd32_sigsuspend */
+ "compat.freebsd32_sigstack", /* 112 = old freebsd32_sigstack */
"obs_orecvmsg", /* 113 = obsolete orecvmsg */
"obs_osendmsg", /* 114 = obsolete osendmsg */
"obs_vtrace", /* 115 = obsolete vtrace */
@@ -164,10 +164,10 @@
"#154", /* 154 = nosys */
"#155", /* 155 = nfssvc */
"obs_ogetdirentries", /* 156 = obsolete ogetdirentries */
- "old.freebsd32_statfs", /* 157 = old freebsd32_statfs */
- "old.freebsd32_fstatfs", /* 158 = old freebsd32_fstatfs */
+ "compat4.freebsd32_statfs", /* 157 = old freebsd32_statfs */
+ "compat4.freebsd32_fstatfs", /* 158 = old freebsd32_fstatfs */
"#159", /* 159 = nosys */
- "#160", /* 160 = nosys */
+ "#160", /* 160 = lgetfh */
"getfh", /* 161 = getfh */
"getdomainname", /* 162 = getdomainname */
"setdomainname", /* 163 = setdomainname */
@@ -180,8 +180,8 @@
"freebsd32_msgsys", /* 170 = freebsd32_msgsys */
"freebsd32_shmsys", /* 171 = freebsd32_shmsys */
"#172", /* 172 = nosys */
- "freebsd32_pread", /* 173 = freebsd32_pread */
- "freebsd32_pwrite", /* 174 = freebsd32_pwrite */
+ "compat6.freebsd32_pread", /* 173 = old freebsd32_pread */
+ "compat6.freebsd32_pwrite", /* 174 = old freebsd32_pwrite */
"#175", /* 175 = nosys */
"ntp_adjtime", /* 176 = ntp_adjtime */
"#177", /* 177 = sfork */
@@ -204,11 +204,11 @@
"getrlimit", /* 194 = getrlimit */
"setrlimit", /* 195 = setrlimit */
"getdirentries", /* 196 = getdirentries */
- "freebsd32_mmap", /* 197 = freebsd32_mmap */
+ "compat6.freebsd32_mmap", /* 197 = old freebsd32_mmap */
"__syscall", /* 198 = __syscall */
- "freebsd32_lseek", /* 199 = freebsd32_lseek */
- "freebsd32_truncate", /* 200 = freebsd32_truncate */
- "freebsd32_ftruncate", /* 201 = freebsd32_ftruncate */
+ "compat6.freebsd32_lseek", /* 199 = old freebsd32_lseek */
+ "compat6.freebsd32_truncate", /* 200 = old freebsd32_truncate */
+ "compat6.freebsd32_ftruncate", /* 201 = old freebsd32_ftruncate */
"freebsd32_sysctl", /* 202 = freebsd32_sysctl */
"mlock", /* 203 = mlock */
"munlock", /* 204 = munlock */
@@ -227,16 +227,16 @@
"#217", /* 217 = */
"#218", /* 218 = */
"#219", /* 219 = */
- "__semctl", /* 220 = __semctl */
+ "freebsd32_semctl", /* 220 = freebsd32_semctl */
"semget", /* 221 = semget */
"semop", /* 222 = semop */
"#223", /* 223 = semconfig */
- "msgctl", /* 224 = msgctl */
+ "freebsd32_msgctl", /* 224 = freebsd32_msgctl */
"msgget", /* 225 = msgget */
- "msgsnd", /* 226 = msgsnd */
- "msgrcv", /* 227 = msgrcv */
+ "freebsd32_msgsnd", /* 226 = freebsd32_msgsnd */
+ "freebsd32_msgrcv", /* 227 = freebsd32_msgrcv */
"shmat", /* 228 = shmat */
- "shmctl", /* 229 = shmctl */
+ "freebsd32_shmctl", /* 229 = freebsd32_shmctl */
"shmdt", /* 230 = shmdt */
"shmget", /* 231 = shmget */
"freebsd32_clock_gettime", /* 232 = freebsd32_clock_gettime */
@@ -304,7 +304,7 @@
"#294", /* 294 = nosys */
"#295", /* 295 = nosys */
"#296", /* 296 = nosys */
- "old.freebsd32_fhstatfs", /* 297 = old freebsd32_fhstatfs */
+ "compat4.freebsd32_fhstatfs", /* 297 = old freebsd32_fhstatfs */
"fhopen", /* 298 = fhopen */
"fhstat", /* 299 = fhstat */
"modnext", /* 300 = modnext */
@@ -343,17 +343,17 @@
"sched_get_priority_min", /* 333 = sched_get_priority_min */
"sched_rr_get_interval", /* 334 = sched_rr_get_interval */
"utrace", /* 335 = utrace */
- "old.freebsd32_sendfile", /* 336 = old freebsd32_sendfile */
+ "compat4.freebsd32_sendfile", /* 336 = old freebsd32_sendfile */
"kldsym", /* 337 = kldsym */
"jail", /* 338 = jail */
"#339", /* 339 = pioctl */
"sigprocmask", /* 340 = sigprocmask */
"sigsuspend", /* 341 = sigsuspend */
- "old.freebsd32_sigaction", /* 342 = old freebsd32_sigaction */
+ "compat4.freebsd32_sigaction", /* 342 = old freebsd32_sigaction */
"sigpending", /* 343 = sigpending */
- "old.freebsd32_sigreturn", /* 344 = old freebsd32_sigreturn */
- "#345", /* 345 = sigtimedwait */
- "#346", /* 346 = sigwaitinfo */
+ "compat4.freebsd32_sigreturn", /* 344 = old freebsd32_sigreturn */
+ "freebsd32_sigtimedwait", /* 345 = freebsd32_sigtimedwait */
+ "freebsd32_sigwaitinfo", /* 346 = freebsd32_sigwaitinfo */
"__acl_get_file", /* 347 = __acl_get_file */
"__acl_set_file", /* 348 = __acl_set_file */
"__acl_get_fd", /* 349 = __acl_get_fd */
@@ -428,38 +428,65 @@
"#418", /* 418 = __xstat */
"#419", /* 419 = __xfstat */
"#420", /* 420 = __xlstat */
- "#421", /* 421 = getcontext */
- "#422", /* 422 = setcontext */
- "#423", /* 423 = swapcontext */
+ "freebsd32_getcontext", /* 421 = freebsd32_getcontext */
+ "freebsd32_setcontext", /* 422 = freebsd32_setcontext */
+ "freebsd32_swapcontext", /* 423 = freebsd32_swapcontext */
"#424", /* 424 = swapoff */
"#425", /* 425 = __acl_get_link */
"#426", /* 426 = __acl_set_link */
"#427", /* 427 = __acl_delete_link */
"#428", /* 428 = __acl_aclcheck_link */
- "#429", /* 429 = sigwait */
- "thr_create", /* 430 = thr_create */
+ "sigwait", /* 429 = sigwait */
+ "#430", /* 430 = thr_create; */
"thr_exit", /* 431 = thr_exit */
"thr_self", /* 432 = thr_self */
"thr_kill", /* 433 = thr_kill */
- "_umtx_lock", /* 434 = _umtx_lock */
- "_umtx_unlock", /* 435 = _umtx_unlock */
+ "freebsd32_umtx_lock", /* 434 = freebsd32_umtx_lock */
+ "freebsd32_umtx_unlock", /* 435 = freebsd32_umtx_unlock */
"jail_attach", /* 436 = jail_attach */
"#437", /* 437 = extattr_list_fd */
"#438", /* 438 = extattr_list_file */
"#439", /* 439 = extattr_list_link */
"#440", /* 440 = kse_switchin */
"#441", /* 441 = ksem_timedwait */
- "thr_suspend", /* 442 = thr_suspend */
+ "freebsd32_thr_suspend", /* 442 = freebsd32_thr_suspend */
"thr_wake", /* 443 = thr_wake */
"kldunloadf", /* 444 = kldunloadf */
- "#445", /* 445 = audit */
- "#446", /* 446 = auditon */
- "#447", /* 447 = getauid */
- "#448", /* 448 = setauid */
- "#449", /* 449 = getaudit */
- "#450", /* 450 = setaudit */
- "#451", /* 451 = getaudit_addr */
- "#452", /* 452 = setaudit_addr */
- "#453", /* 453 = auditctl */
- "#454", /* 454 = _umtx_op */
+ "audit", /* 445 = audit */
+ "auditon", /* 446 = auditon */
+ "getauid", /* 447 = getauid */
+ "setauid", /* 448 = setauid */
+ "getaudit", /* 449 = getaudit */
+ "setaudit", /* 450 = setaudit */
+ "getaudit_addr", /* 451 = getaudit_addr */
+ "setaudit_addr", /* 452 = setaudit_addr */
+ "auditctl", /* 453 = auditctl */
+ "freebsd32_umtx_op", /* 454 = freebsd32_umtx_op */
+ "freebsd32_thr_new", /* 455 = freebsd32_thr_new */
+ "sigqueue", /* 456 = sigqueue */
+ "#457", /* 457 = kmq_open */
+ "#458", /* 458 = kmq_setattr */
+ "#459", /* 459 = kmq_timedreceive */
+ "#460", /* 460 = kmq_timedsend */
+ "#461", /* 461 = kmq_notify */
+ "#462", /* 462 = kmq_unlink */
+ "abort2", /* 463 = abort2 */
+ "thr_set_name", /* 464 = thr_set_name */
+ "#465", /* 465 = aio_fsync */
+ "rtprio_thread", /* 466 = rtprio_thread */
+ "#467", /* 467 = nosys */
+ "#468", /* 468 = nosys */
+ "#469", /* 469 = __getpath_fromfd */
+ "#470", /* 470 = __getpath_fromaddr */
+ "sctp_peeloff", /* 471 = sctp_peeloff */
+ "sctp_generic_sendmsg", /* 472 = sctp_generic_sendmsg */
+ "sctp_generic_sendmsg_iov", /* 473 = sctp_generic_sendmsg_iov */
+ "sctp_generic_recvmsg", /* 474 = sctp_generic_recvmsg */
+ "freebsd32_pread", /* 475 = freebsd32_pread */
+ "freebsd32_pwrite", /* 476 = freebsd32_pwrite */
+ "freebsd32_mmap", /* 477 = freebsd32_mmap */
+ "freebsd32_lseek", /* 478 = freebsd32_lseek */
+ "freebsd32_truncate", /* 479 = freebsd32_truncate */
+ "freebsd32_ftruncate", /* 480 = freebsd32_ftruncate */
+ "thr_kill2", /* 481 = thr_kill2 */
};
Index: freebsd32_misc.c
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32_misc.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/compat/freebsd32/freebsd32_misc.c -L sys/compat/freebsd32/freebsd32_misc.c -u -r1.2 -r1.3
--- sys/compat/freebsd32/freebsd32_misc.c
+++ sys/compat/freebsd32/freebsd32_misc.c
@@ -25,19 +25,21 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.38.2.7 2006/03/06 10:56:43 ps Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.67.2.3 2007/12/20 19:43:55 jhb Exp $");
#include "opt_compat.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
+#include <sys/clock.h>
#include <sys/exec.h>
#include <sys/fcntl.h>
#include <sys/filedesc.h>
#include <sys/namei.h>
#include <sys/imgact.h>
#include <sys/kernel.h>
+#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/file.h> /* Must come after sys/malloc.h */
@@ -46,8 +48,6 @@
#include <sys/module.h>
#include <sys/mount.h>
#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/param.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/resource.h>
@@ -65,10 +65,15 @@
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/sysproto.h>
-#include <sys/systm.h>
+#include <sys/thr.h>
#include <sys/unistd.h>
+#include <sys/ucontext.h>
#include <sys/vnode.h>
#include <sys/wait.h>
+#include <sys/ipc.h>
+#include <sys/msg.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@@ -82,12 +87,24 @@
#include <compat/freebsd32/freebsd32_util.h>
#include <compat/freebsd32/freebsd32.h>
+#include <compat/freebsd32/freebsd32_ipc.h>
+#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/freebsd32/freebsd32_proto.h>
CTASSERT(sizeof(struct timeval32) == 8);
CTASSERT(sizeof(struct timespec32) == 8);
+CTASSERT(sizeof(struct itimerval32) == 16);
CTASSERT(sizeof(struct statfs32) == 256);
CTASSERT(sizeof(struct rusage32) == 72);
+CTASSERT(sizeof(struct sigaltstack32) == 12);
+CTASSERT(sizeof(struct kevent32) == 20);
+CTASSERT(sizeof(struct iovec32) == 8);
+CTASSERT(sizeof(struct msghdr32) == 28);
+CTASSERT(sizeof(struct stat32) == 96);
+CTASSERT(sizeof(struct sigaction32) == 24);
+
+static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
+static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
int
freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
@@ -131,28 +148,28 @@
static void
copy_statfs(struct statfs *in, struct statfs32 *out)
{
-
+
+ statfs_scale_blocks(in, INT32_MAX);
bzero(out, sizeof(*out));
CP(*in, *out, f_bsize);
- CP(*in, *out, f_iosize);
+ out->f_iosize = MIN(in->f_iosize, INT32_MAX);
CP(*in, *out, f_blocks);
CP(*in, *out, f_bfree);
CP(*in, *out, f_bavail);
- CP(*in, *out, f_files);
- CP(*in, *out, f_ffree);
+ out->f_files = MIN(in->f_files, INT32_MAX);
+ out->f_ffree = MIN(in->f_ffree, INT32_MAX);
CP(*in, *out, f_fsid);
CP(*in, *out, f_owner);
CP(*in, *out, f_type);
CP(*in, *out, f_flags);
- CP(*in, *out, f_flags);
- CP(*in, *out, f_syncwrites);
- CP(*in, *out, f_asyncwrites);
+ out->f_syncwrites = MIN(in->f_syncwrites, INT32_MAX);
+ out->f_asyncwrites = MIN(in->f_asyncwrites, INT32_MAX);
strlcpy(out->f_fstypename,
in->f_fstypename, MFSNAMELEN);
strlcpy(out->f_mntonname,
in->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN));
- CP(*in, *out, f_syncreads);
- CP(*in, *out, f_asyncreads);
+ out->f_syncreads = MIN(in->f_syncreads, INT32_MAX);
+ out->f_asyncreads = MIN(in->f_asyncreads, INT32_MAX);
strlcpy(out->f_mntfromname,
in->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN));
}
@@ -186,14 +203,6 @@
}
#endif
-struct sigaltstack32 {
- u_int32_t ss_sp;
- u_int32_t ss_size;
- int ss_flags;
-};
-
-CTASSERT(sizeof(struct sigaltstack32) == 12);
-
int
freebsd32_sigaltstack(struct thread *td,
struct freebsd32_sigaltstack_args *uap)
@@ -260,7 +269,7 @@
copystr(fname, args->fname, PATH_MAX, &length) :
copyinstr(fname, args->fname, PATH_MAX, &length);
if (error != 0)
- return (error);
+ goto err_exit;
/*
* extract arguments first
@@ -269,16 +278,15 @@
for (;;) {
error = copyin(p32++, &arg, sizeof(arg));
if (error)
- return (error);
+ goto err_exit;
if (arg == 0)
break;
argp = PTRIN(arg);
error = copyinstr(argp, args->endp, args->stringspace, &length);
if (error) {
if (error == ENAMETOOLONG)
- return (E2BIG);
- else
- return (error);
+ error = E2BIG;
+ goto err_exit;
}
args->stringspace -= length;
args->endp += length;
@@ -295,7 +303,7 @@
for (;;) {
error = copyin(p32++, &arg, sizeof(arg));
if (error)
- return (error);
+ goto err_exit;
if (arg == 0)
break;
envp = PTRIN(arg);
@@ -303,9 +311,8 @@
&length);
if (error) {
if (error == ENAMETOOLONG)
- return (E2BIG);
- else
- return (error);
+ error = E2BIG;
+ goto err_exit;
}
args->stringspace -= length;
args->endp += length;
@@ -314,6 +321,12 @@
}
return (0);
+
+err_exit:
+ kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
+ PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
+ args->buf = NULL;
+ return (error);
}
int
@@ -326,7 +339,6 @@
uap->argv, uap->envv);
if (error == 0)
error = kern_execve(td, &eargs, NULL);
- exec_free_args(&eargs);
return (error);
}
@@ -403,7 +415,6 @@
start = addr;
end = addr + len;
- mtx_lock(&Giant);
if (start != trunc_page(start)) {
error = freebsd32_mmap_partial(td, start,
round_page(start), prot,
@@ -434,14 +445,11 @@
prot |= VM_PROT_WRITE;
map = &td->td_proc->p_vmspace->vm_map;
rv = vm_map_remove(map, start, end);
- if (rv != KERN_SUCCESS) {
- mtx_unlock(&Giant);
+ if (rv != KERN_SUCCESS)
return (EINVAL);
- }
rv = vm_map_find(map, 0, 0,
&start, end - start, FALSE,
prot, VM_PROT_ALL, 0);
- mtx_unlock(&Giant);
if (rv != KERN_SUCCESS)
return (EINVAL);
r.fd = fd;
@@ -455,7 +463,6 @@
td->td_retval[0] = addr;
return (0);
}
- mtx_unlock(&Giant);
if (end == start) {
/*
* After dealing with the ragged ends, there
@@ -479,12 +486,23 @@
return (mmap(td, &ap));
}
-struct itimerval32 {
- struct timeval32 it_interval;
- struct timeval32 it_value;
-};
+#ifdef COMPAT_FREEBSD6
+int
+freebsd6_freebsd32_mmap(struct thread *td, struct freebsd6_freebsd32_mmap_args *uap)
+{
+ struct freebsd32_mmap_args ap;
-CTASSERT(sizeof(struct itimerval32) == 16);
+ ap.addr = uap->addr;
+ ap.len = uap->len;
+ ap.prot = uap->prot;
+ ap.flags = uap->flags;
+ ap.fd = uap->fd;
+ ap.poslo = uap->poslo;
+ ap.poshi = uap->poshi;
+
+ return (freebsd32_mmap(td, &ap));
+}
+#endif
int
freebsd32_setitimer(struct thread *td, struct freebsd32_setitimer_args *uap)
@@ -548,19 +566,6 @@
return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp));
}
-struct kevent32 {
- u_int32_t ident; /* identifier for this event */
- short filter; /* filter for event */
- u_short flags;
- u_int fflags;
- int32_t data;
- u_int32_t udata; /* opaque user data identifier */
-};
-
-CTASSERT(sizeof(struct kevent32) == 20);
-static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
-static int freebsd32_kevent_copyin(void *arg, struct kevent *kevp, int count);
-
/*
* Copy 'count' items into the destination list pointed to by uap->eventlist.
*/
@@ -698,13 +703,6 @@
return (error);
}
-struct iovec32 {
- u_int32_t iov_base;
- int iov_len;
-};
-
-CTASSERT(sizeof(struct iovec32) == 8);
-
static int
freebsd32_copyinuio(struct iovec32 *iovp, u_int iovcnt, struct uio **uiop)
{
@@ -830,37 +828,6 @@
}
static int
-freebsd32_copyoutiov(struct iovec *iov, u_int iovcnt, struct iovec32 *iovp,
- int error)
-{
- struct iovec32 iov32;
- int i;
-
- if (iovcnt > UIO_MAXIOV)
- return (error);
- for (i = 0; i < iovcnt; i++) {
- iov32.iov_base = PTROUT(iov[i].iov_base);
- iov32.iov_len = iov[i].iov_len;
- error = copyout(&iov32, &iovp[i], sizeof(iov32));
- if (error)
- return (error);
- }
- return (0);
-}
-
-
-struct msghdr32 {
- u_int32_t msg_name;
- socklen_t msg_namelen;
- u_int32_t msg_iov;
- int msg_iovlen;
- u_int32_t msg_control;
- socklen_t msg_controllen;
- int msg_flags;
-};
-CTASSERT(sizeof(struct msghdr32) == 28);
-
-static int
freebsd32_copyinmsghdr(struct msghdr32 *msg32, struct msghdr *msg)
{
struct msghdr32 m32;
@@ -1015,8 +982,8 @@
error = freebsd32_copyinmsghdr(uap->msg, &msg);
if (error)
return (error);
- error = freebsd32_copyiniov((struct iovec32 *)(uintptr_t)m32.msg_iov,
- m32.msg_iovlen, &iov, EMSGSIZE);
+ error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov,
+ EMSGSIZE);
if (error)
return (error);
msg.msg_flags = uap->flags;
@@ -1024,7 +991,7 @@
msg.msg_iov = iov;
controlp = (msg.msg_control != NULL) ? &control : NULL;
- error = kern_recvit(td, uap->s, &msg, NULL, UIO_USERSPACE, controlp);
+ error = kern_recvit(td, uap->s, &msg, UIO_USERSPACE, controlp);
if (error == 0) {
msg.msg_iov = uiov;
@@ -1033,10 +1000,6 @@
if (error == 0)
error = freebsd32_copyoutmsghdr(&msg, uap->msg);
-
- if (error == 0)
- error = freebsd32_copyoutiov(iov, m32.msg_iovlen,
- (struct iovec32 *)(uintptr_t)m32.msg_iov, EMSGSIZE);
}
free(iov, M_IOV);
@@ -1104,8 +1067,8 @@
error = freebsd32_copyinmsghdr(uap->msg, &msg);
if (error)
return (error);
- error = freebsd32_copyiniov((struct iovec32 *)(uintptr_t)m32.msg_iov,
- m32.msg_iovlen, &iov, EMSGSIZE);
+ error = freebsd32_copyiniov(PTRIN(m32.msg_iov), m32.msg_iovlen, &iov,
+ EMSGSIZE);
if (error)
return (error);
msg.msg_iov = iov;
@@ -1153,23 +1116,25 @@
int error;
if (uap->fromlenaddr) {
- error = copyin((void *)(uintptr_t)uap->fromlenaddr,
- &msg.msg_namelen, sizeof(msg.msg_namelen));
+ error = copyin(PTRIN(uap->fromlenaddr), &msg.msg_namelen,
+ sizeof(msg.msg_namelen));
if (error)
return (error);
} else {
msg.msg_namelen = 0;
}
- msg.msg_name = (void *)(uintptr_t)uap->from;
+ msg.msg_name = PTRIN(uap->from);
msg.msg_iov = &aiov;
msg.msg_iovlen = 1;
- aiov.iov_base = (void *)(uintptr_t)uap->buf;
+ aiov.iov_base = PTRIN(uap->buf);
aiov.iov_len = uap->len;
- msg.msg_control = 0;
+ msg.msg_control = NULL;
msg.msg_flags = uap->flags;
- error = kern_recvit(td, uap->s, &msg,
- (void *)(uintptr_t)uap->fromlenaddr, UIO_USERSPACE, NULL);
+ error = kern_recvit(td, uap->s, &msg, UIO_USERSPACE, NULL);
+ if (error == 0 && uap->fromlenaddr)
+ error = copyout(&msg.msg_namelen, PTRIN(uap->fromlenaddr),
+ sizeof (msg.msg_namelen));
return (error);
}
@@ -1341,31 +1306,358 @@
}
#endif
+static void
+freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip)
+{
+
+ CP(*ip32, *ip, cuid);
+ CP(*ip32, *ip, cgid);
+ CP(*ip32, *ip, uid);
+ CP(*ip32, *ip, gid);
+ CP(*ip32, *ip, mode);
+ CP(*ip32, *ip, seq);
+ CP(*ip32, *ip, key);
+}
+
+static void
+freebsd32_ipcperm_out(struct ipc_perm *ip, struct ipc_perm32 *ip32)
+{
+
+ CP(*ip, *ip32, cuid);
+ CP(*ip, *ip32, cgid);
+ CP(*ip, *ip32, uid);
+ CP(*ip, *ip32, gid);
+ CP(*ip, *ip32, mode);
+ CP(*ip, *ip32, seq);
+ CP(*ip, *ip32, key);
+}
+
int
freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap)
{
- /*
- * Vector through to semsys if it is loaded.
- */
- return sysent[SYS_semsys].sy_call(td, uap);
+
+ switch (uap->which) {
+ case 0:
+ return (freebsd32_semctl(td,
+ (struct freebsd32_semctl_args *)&uap->a2));
+ default:
+ return (semsys(td, (struct semsys_args *)uap));
+ }
+}
+
+int
+freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap)
+{
+ struct semid_ds32 dsbuf32;
+ struct semid_ds dsbuf;
+ union semun semun;
+ union semun32 arg;
+ register_t rval;
+ int error;
+
+ switch (uap->cmd) {
+ case SEM_STAT:
+ case IPC_SET:
+ case IPC_STAT:
+ case GETALL:
+ case SETVAL:
+ case SETALL:
+ error = copyin(uap->arg, &arg, sizeof(arg));
+ if (error)
+ return (error);
+ break;
+ }
+
+ switch (uap->cmd) {
+ case SEM_STAT:
+ case IPC_STAT:
+ semun.buf = &dsbuf;
+ break;
+ case IPC_SET:
+ error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32));
+ if (error)
+ return (error);
+ freebsd32_ipcperm_in(&dsbuf32.sem_perm, &dsbuf.sem_perm);
+ PTRIN_CP(dsbuf32, dsbuf, sem_base);
+ CP(dsbuf32, dsbuf, sem_nsems);
+ CP(dsbuf32, dsbuf, sem_otime);
+ CP(dsbuf32, dsbuf, sem_pad1);
+ CP(dsbuf32, dsbuf, sem_ctime);
+ CP(dsbuf32, dsbuf, sem_pad2);
+ CP(dsbuf32, dsbuf, sem_pad3[0]);
+ CP(dsbuf32, dsbuf, sem_pad3[1]);
+ CP(dsbuf32, dsbuf, sem_pad3[2]);
+ CP(dsbuf32, dsbuf, sem_pad3[3]);
+ semun.buf = &dsbuf;
+ break;
+ case GETALL:
+ case SETALL:
+ semun.array = PTRIN(arg.array);
+ break;
+ case SETVAL:
+ semun.val = arg.val;
+ break;
+ }
+
+ error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun,
+ &rval);
+ if (error)
+ return (error);
+
+ switch (uap->cmd) {
+ case SEM_STAT:
+ case IPC_STAT:
+ freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm);
+ PTROUT_CP(dsbuf, dsbuf32, sem_base);
+ CP(dsbuf, dsbuf32, sem_nsems);
+ CP(dsbuf, dsbuf32, sem_otime);
+ CP(dsbuf, dsbuf32, sem_pad1);
+ CP(dsbuf, dsbuf32, sem_ctime);
+ CP(dsbuf, dsbuf32, sem_pad2);
+ CP(dsbuf, dsbuf32, sem_pad3[0]);
+ CP(dsbuf, dsbuf32, sem_pad3[1]);
+ CP(dsbuf, dsbuf32, sem_pad3[2]);
+ CP(dsbuf, dsbuf32, sem_pad3[3]);
+ error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32));
+ break;
+ }
+
+ if (error == 0)
+ td->td_retval[0] = rval;
+ return (error);
}
int
freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap)
{
- /*
- * Vector through to msgsys if it is loaded.
- */
- return sysent[SYS_msgsys].sy_call(td, uap);
+
+ switch (uap->which) {
+ case 0:
+ return (freebsd32_msgctl(td,
+ (struct freebsd32_msgctl_args *)&uap->a2));
+ case 2:
+ return (freebsd32_msgsnd(td,
+ (struct freebsd32_msgsnd_args *)&uap->a2));
+ case 3:
+ return (freebsd32_msgrcv(td,
+ (struct freebsd32_msgrcv_args *)&uap->a2));
+ default:
+ return (msgsys(td, (struct msgsys_args *)uap));
+ }
+}
+
+int
+freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap)
+{
+ struct msqid_ds msqbuf;
+ struct msqid_ds32 msqbuf32;
+ int error;
+
+ if (uap->cmd == IPC_SET) {
+ error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32));
+ if (error)
+ return (error);
+ freebsd32_ipcperm_in(&msqbuf32.msg_perm, &msqbuf.msg_perm);
+ PTRIN_CP(msqbuf32, msqbuf, msg_first);
+ PTRIN_CP(msqbuf32, msqbuf, msg_last);
+ CP(msqbuf32, msqbuf, msg_cbytes);
+ CP(msqbuf32, msqbuf, msg_qnum);
+ CP(msqbuf32, msqbuf, msg_qbytes);
+ CP(msqbuf32, msqbuf, msg_lspid);
+ CP(msqbuf32, msqbuf, msg_lrpid);
+ CP(msqbuf32, msqbuf, msg_stime);
+ CP(msqbuf32, msqbuf, msg_pad1);
+ CP(msqbuf32, msqbuf, msg_rtime);
+ CP(msqbuf32, msqbuf, msg_pad2);
+ CP(msqbuf32, msqbuf, msg_ctime);
+ CP(msqbuf32, msqbuf, msg_pad3);
+ CP(msqbuf32, msqbuf, msg_pad4[0]);
+ CP(msqbuf32, msqbuf, msg_pad4[1]);
+ CP(msqbuf32, msqbuf, msg_pad4[2]);
+ CP(msqbuf32, msqbuf, msg_pad4[3]);
+ }
+ error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf);
+ if (error)
+ return (error);
+ if (uap->cmd == IPC_STAT) {
+ freebsd32_ipcperm_out(&msqbuf.msg_perm, &msqbuf32.msg_perm);
+ PTROUT_CP(msqbuf, msqbuf32, msg_first);
+ PTROUT_CP(msqbuf, msqbuf32, msg_last);
+ CP(msqbuf, msqbuf32, msg_cbytes);
+ CP(msqbuf, msqbuf32, msg_qnum);
+ CP(msqbuf, msqbuf32, msg_qbytes);
+ CP(msqbuf, msqbuf32, msg_lspid);
+ CP(msqbuf, msqbuf32, msg_lrpid);
+ CP(msqbuf, msqbuf32, msg_stime);
+ CP(msqbuf, msqbuf32, msg_pad1);
+ CP(msqbuf, msqbuf32, msg_rtime);
+ CP(msqbuf, msqbuf32, msg_pad2);
+ CP(msqbuf, msqbuf32, msg_ctime);
+ CP(msqbuf, msqbuf32, msg_pad3);
+ CP(msqbuf, msqbuf32, msg_pad4[0]);
+ CP(msqbuf, msqbuf32, msg_pad4[1]);
+ CP(msqbuf, msqbuf32, msg_pad4[2]);
+ CP(msqbuf, msqbuf32, msg_pad4[3]);
+ error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32));
+ }
+ return (error);
+}
+
+int
+freebsd32_msgsnd(struct thread *td, struct freebsd32_msgsnd_args *uap)
+{
+ const void *msgp;
+ long mtype;
+ int32_t mtype32;
+ int error;
+
+ msgp = PTRIN(uap->msgp);
+ if ((error = copyin(msgp, &mtype32, sizeof(mtype32))) != 0)
+ return (error);
+ mtype = mtype32;
+ return (kern_msgsnd(td, uap->msqid,
+ (const char *)msgp + sizeof(mtype32),
+ uap->msgsz, uap->msgflg, mtype));
+}
+
+int
+freebsd32_msgrcv(struct thread *td, struct freebsd32_msgrcv_args *uap)
+{
+ void *msgp;
+ long mtype;
+ int32_t mtype32;
+ int error;
+
+ msgp = PTRIN(uap->msgp);
+ if ((error = kern_msgrcv(td, uap->msqid,
+ (char *)msgp + sizeof(mtype32), uap->msgsz,
+ uap->msgtyp, uap->msgflg, &mtype)) != 0)
+ return (error);
+ mtype32 = (int32_t)mtype;
+ return (copyout(&mtype32, msgp, sizeof(mtype32)));
}
int
freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap)
{
- /*
- * Vector through to shmsys if it is loaded.
- */
- return sysent[SYS_shmsys].sy_call(td, uap);
+
+ switch (uap->which) {
+ case 0: { /* shmat */
+ struct shmat_args ap;
+
+ ap.shmid = uap->a2;
+ ap.shmaddr = PTRIN(uap->a3);
+ ap.shmflg = uap->a4;
+ return (sysent[SYS_shmat].sy_call(td, &ap));
+ }
+ case 2: { /* shmdt */
+ struct shmdt_args ap;
+
+ ap.shmaddr = PTRIN(uap->a2);
+ return (sysent[SYS_shmdt].sy_call(td, &ap));
+ }
+ case 3: { /* shmget */
+ struct shmget_args ap;
+
+ ap.key = uap->a2;
+ ap.size = uap->a3;
+ ap.shmflg = uap->a4;
+ return (sysent[SYS_shmget].sy_call(td, &ap));
+ }
+ case 4: { /* shmctl */
+ struct freebsd32_shmctl_args ap;
+
+ ap.shmid = uap->a2;
+ ap.cmd = uap->a3;
+ ap.buf = PTRIN(uap->a4);
+ return (freebsd32_shmctl(td, &ap));
+ }
+ case 1: /* oshmctl */
+ default:
+ return (EINVAL);
+ }
+}
+
+int
+freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap)
+{
+ int error = 0;
+ union {
+ struct shmid_ds shmid_ds;
+ struct shm_info shm_info;
+ struct shminfo shminfo;
+ } u;
+ union {
+ struct shmid_ds32 shmid_ds32;
+ struct shm_info32 shm_info32;
+ struct shminfo32 shminfo32;
+ } u32;
+ size_t sz;
+
+ if (uap->cmd == IPC_SET) {
+ if ((error = copyin(uap->buf, &u32.shmid_ds32,
+ sizeof(u32.shmid_ds32))))
+ goto done;
+ freebsd32_ipcperm_in(&u32.shmid_ds32.shm_perm,
+ &u.shmid_ds.shm_perm);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_segsz);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_lpid);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_cpid);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_nattch);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_atime);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_dtime);
+ CP(u32.shmid_ds32, u.shmid_ds, shm_ctime);
+ PTRIN_CP(u32.shmid_ds32, u.shmid_ds, shm_internal);
+ }
+
+ error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz);
+ if (error)
+ goto done;
+
+ /* Cases in which we need to copyout */
+ switch (uap->cmd) {
+ case IPC_INFO:
+ CP(u.shminfo, u32.shminfo32, shmmax);
+ CP(u.shminfo, u32.shminfo32, shmmin);
+ CP(u.shminfo, u32.shminfo32, shmmni);
+ CP(u.shminfo, u32.shminfo32, shmseg);
+ CP(u.shminfo, u32.shminfo32, shmall);
+ error = copyout(&u32.shminfo32, uap->buf,
+ sizeof(u32.shminfo32));
+ break;
+ case SHM_INFO:
+ CP(u.shm_info, u32.shm_info32, used_ids);
+ CP(u.shm_info, u32.shm_info32, shm_rss);
+ CP(u.shm_info, u32.shm_info32, shm_tot);
+ CP(u.shm_info, u32.shm_info32, shm_swp);
+ CP(u.shm_info, u32.shm_info32, swap_attempts);
+ CP(u.shm_info, u32.shm_info32, swap_successes);
+ error = copyout(&u32.shm_info32, uap->buf,
+ sizeof(u32.shm_info32));
+ break;
+ case SHM_STAT:
+ case IPC_STAT:
+ freebsd32_ipcperm_out(&u.shmid_ds.shm_perm,
+ &u32.shmid_ds32.shm_perm);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_segsz);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_lpid);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_cpid);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_nattch);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_atime);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_dtime);
+ CP(u.shmid_ds, u32.shmid_ds32, shm_ctime);
+ PTROUT_CP(u.shmid_ds, u32.shmid_ds32, shm_internal);
+ error = copyout(&u32.shmid_ds32, uap->buf,
+ sizeof(u32.shmid_ds32));
+ break;
+ }
+
+done:
+ if (error) {
+ /* Invalidate the return value */
+ td->td_retval[0] = -1;
+ }
+ return (error);
}
int
@@ -1430,62 +1722,149 @@
return (ftruncate(td, &ap));
}
-#ifdef COMPAT_FREEBSD4
+#ifdef COMPAT_FREEBSD6
+/* versions with the 'int pad' argument */
int
-freebsd4_freebsd32_sendfile(struct thread *td,
- struct freebsd4_freebsd32_sendfile_args *uap)
+freebsd6_freebsd32_pread(struct thread *td, struct freebsd6_freebsd32_pread_args *uap)
{
- struct freebsd4_sendfile_args ap;
+ struct pread_args ap;
ap.fd = uap->fd;
- ap.s = uap->s;
+ ap.buf = uap->buf;
+ ap.nbyte = uap->nbyte;
ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
- ap.nbytes = uap->nbytes; /* XXX check */
- ap.hdtr = uap->hdtr; /* XXX check */
- ap.sbytes = uap->sbytes; /* XXX FIXME!! */
- ap.flags = uap->flags;
- return (freebsd4_sendfile(td, &ap));
+ return (pread(td, &ap));
}
-#endif
int
-freebsd32_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap)
+freebsd6_freebsd32_pwrite(struct thread *td, struct freebsd6_freebsd32_pwrite_args *uap)
+{
+ struct pwrite_args ap;
+
+ ap.fd = uap->fd;
+ ap.buf = uap->buf;
+ ap.nbyte = uap->nbyte;
+ ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ return (pwrite(td, &ap));
+}
+
+int
+freebsd6_freebsd32_lseek(struct thread *td, struct freebsd6_freebsd32_lseek_args *uap)
+{
+ int error;
+ struct lseek_args ap;
+ off_t pos;
+
+ ap.fd = uap->fd;
+ ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
+ ap.whence = uap->whence;
+ error = lseek(td, &ap);
+ /* Expand the quad return into two parts for eax and edx */
+ pos = *(off_t *)(td->td_retval);
+ td->td_retval[0] = pos & 0xffffffff; /* %eax */
+ td->td_retval[1] = pos >> 32; /* %edx */
+ return error;
+}
+
+int
+freebsd6_freebsd32_truncate(struct thread *td, struct freebsd6_freebsd32_truncate_args *uap)
+{
+ struct truncate_args ap;
+
+ ap.path = uap->path;
+ ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ return (truncate(td, &ap));
+}
+
+int
+freebsd6_freebsd32_ftruncate(struct thread *td, struct freebsd6_freebsd32_ftruncate_args *uap)
+{
+ struct ftruncate_args ap;
+
+ ap.fd = uap->fd;
+ ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32));
+ return (ftruncate(td, &ap));
+}
+#endif /* COMPAT_FREEBSD6 */
+
+struct sf_hdtr32 {
+ uint32_t headers;
+ int hdr_cnt;
+ uint32_t trailers;
+ int trl_cnt;
+};
+
+static int
+freebsd32_do_sendfile(struct thread *td,
+ struct freebsd32_sendfile_args *uap, int compat)
{
struct sendfile_args ap;
+ struct sf_hdtr32 hdtr32;
+ struct sf_hdtr hdtr;
+ struct uio *hdr_uio, *trl_uio;
+ struct iovec32 *iov32;
+ int error;
+
+ hdr_uio = trl_uio = NULL;
ap.fd = uap->fd;
ap.s = uap->s;
ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
- ap.nbytes = uap->nbytes; /* XXX check */
- ap.hdtr = uap->hdtr; /* XXX check */
- ap.sbytes = uap->sbytes; /* XXX FIXME!! */
+ ap.nbytes = uap->nbytes;
+ ap.hdtr = (struct sf_hdtr *)uap->hdtr; /* XXX not used */
+ ap.sbytes = uap->sbytes;
ap.flags = uap->flags;
- return (sendfile(td, &ap));
+
+ if (uap->hdtr != NULL) {
+ error = copyin(uap->hdtr, &hdtr32, sizeof(hdtr32));
+ if (error)
+ goto out;
+ PTRIN_CP(hdtr32, hdtr, headers);
+ CP(hdtr32, hdtr, hdr_cnt);
+ PTRIN_CP(hdtr32, hdtr, trailers);
+ CP(hdtr32, hdtr, trl_cnt);
+
+ if (hdtr.headers != NULL) {
+ iov32 = PTRIN(hdtr32.headers);
+ error = freebsd32_copyinuio(iov32,
+ hdtr32.hdr_cnt, &hdr_uio);
+ if (error)
+ goto out;
+ }
+ if (hdtr.trailers != NULL) {
+ iov32 = PTRIN(hdtr32.trailers);
+ error = freebsd32_copyinuio(iov32,
+ hdtr32.trl_cnt, &trl_uio);
+ if (error)
+ goto out;
+ }
+ }
+
+ error = kern_sendfile(td, &ap, hdr_uio, trl_uio, compat);
+out:
+ if (hdr_uio)
+ free(hdr_uio, M_IOV);
+ if (trl_uio)
+ free(trl_uio, M_IOV);
+ return (error);
}
-struct stat32 {
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
- struct timespec32 st_atimespec;
- struct timespec32 st_mtimespec;
- struct timespec32 st_ctimespec;
- off_t st_size;
- int64_t st_blocks;
- u_int32_t st_blksize;
- u_int32_t st_flags;
- u_int32_t st_gen;
- struct timespec32 st_birthtimespec;
- unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
- unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
-};
+#ifdef COMPAT_FREEBSD4
+int
+freebsd4_freebsd32_sendfile(struct thread *td,
+ struct freebsd4_freebsd32_sendfile_args *uap)
+{
+ return (freebsd32_do_sendfile(td,
+ (struct freebsd32_sendfile_args *)uap, 1));
+}
+#endif
+int
+freebsd32_sendfile(struct thread *td, struct freebsd32_sendfile_args *uap)
+{
-CTASSERT(sizeof(struct stat32) == 96);
+ return (freebsd32_do_sendfile(td, uap, 0));
+}
static void
copy_stat( struct stat *in, struct stat32 *out)
@@ -1583,14 +1962,6 @@
return (error);
}
-struct sigaction32 {
- u_int32_t sa_u;
- int sa_flags;
- sigset_t sa_mask;
-};
-
-CTASSERT(sizeof(struct sigaction32) == 24);
-
int
freebsd32_sigaction(struct thread *td, struct freebsd32_sigaction_args *uap)
{
@@ -1821,7 +2192,7 @@
{
struct sigstack32 s32;
struct sigstack nss, oss;
- int error = 0;
+ int error = 0, unss;
if (uap->nss != NULL) {
error = copyin(uap->nss, &s32, sizeof(s32));
@@ -1829,13 +2200,16 @@
return (error);
nss.ss_sp = PTRIN(s32.ss_sp);
CP(s32, nss, ss_onstack);
+ unss = 1;
+ } else {
+ unss = 0;
}
oss.ss_sp = td->td_sigstk.ss_sp;
oss.ss_onstack = sigonstack(cpu_getstack(td));
- if (uap->nss != NULL) {
+ if (unss) {
td->td_sigstk.ss_sp = nss.ss_sp;
td->td_sigstk.ss_size = 0;
- td->td_sigstk.ss_flags |= nss.ss_onstack & SS_ONSTACK;
+ td->td_sigstk.ss_flags |= (nss.ss_onstack & SS_ONSTACK);
td->td_pflags |= TDP_ALTSTACK;
}
if (uap->oss != NULL) {
@@ -1931,6 +2305,143 @@
return (error);
}
+int
+freebsd32_thr_new(struct thread *td,
+ struct freebsd32_thr_new_args *uap)
+{
+ struct thr_param32 param32;
+ struct thr_param param;
+ int error;
+
+ if (uap->param_size < 0 ||
+ uap->param_size > sizeof(struct thr_param32))
+ return (EINVAL);
+ bzero(¶m, sizeof(struct thr_param));
+ bzero(¶m32, sizeof(struct thr_param32));
+ error = copyin(uap->param, ¶m32, uap->param_size);
+ if (error != 0)
+ return (error);
+ param.start_func = PTRIN(param32.start_func);
+ param.arg = PTRIN(param32.arg);
+ param.stack_base = PTRIN(param32.stack_base);
+ param.stack_size = param32.stack_size;
+ param.tls_base = PTRIN(param32.tls_base);
+ param.tls_size = param32.tls_size;
+ param.child_tid = PTRIN(param32.child_tid);
+ param.parent_tid = PTRIN(param32.parent_tid);
+ param.flags = param32.flags;
+ param.rtp = PTRIN(param32.rtp);
+ param.spare[0] = PTRIN(param32.spare[0]);
+ param.spare[1] = PTRIN(param32.spare[1]);
+ param.spare[2] = PTRIN(param32.spare[2]);
+
+ return (kern_thr_new(td, ¶m));
+}
+
+int
+freebsd32_thr_suspend(struct thread *td, struct freebsd32_thr_suspend_args *uap)
+{
+ struct timespec32 ts32;
+ struct timespec ts, *tsp;
+ int error;
+
+ error = 0;
+ tsp = NULL;
+ if (uap->timeout != NULL) {
+ error = copyin((const void *)uap->timeout, (void *)&ts32,
+ sizeof(struct timespec32));
+ if (error != 0)
+ return (error);
+ ts.tv_sec = ts32.tv_sec;
+ ts.tv_nsec = ts32.tv_nsec;
+ tsp = &ts;
+ }
+ return (kern_thr_suspend(td, tsp));
+}
+
+void
+siginfo_to_siginfo32(siginfo_t *src, struct siginfo32 *dst)
+{
+ bzero(dst, sizeof(*dst));
+ dst->si_signo = src->si_signo;
+ dst->si_errno = src->si_errno;
+ dst->si_code = src->si_code;
+ dst->si_pid = src->si_pid;
+ dst->si_uid = src->si_uid;
+ dst->si_status = src->si_status;
+ dst->si_addr = dst->si_addr;
+ dst->si_value.sigval_int = src->si_value.sival_int;
+ dst->si_timerid = src->si_timerid;
+ dst->si_overrun = src->si_overrun;
+}
+
+int
+freebsd32_sigtimedwait(struct thread *td, struct freebsd32_sigtimedwait_args *uap)
+{
+ struct timespec32 ts32;
+ struct timespec ts;
+ struct timespec *timeout;
+ sigset_t set;
+ ksiginfo_t ksi;
+ struct siginfo32 si32;
+ int error;
+
+ if (uap->timeout) {
+ error = copyin(uap->timeout, &ts32, sizeof(ts32));
+ if (error)
+ return (error);
+ ts.tv_sec = ts32.tv_sec;
+ ts.tv_nsec = ts32.tv_nsec;
+ timeout = &ts;
+ } else
+ timeout = NULL;
+
+ error = copyin(uap->set, &set, sizeof(set));
+ if (error)
+ return (error);
+
+ error = kern_sigtimedwait(td, set, &ksi, timeout);
+ if (error)
+ return (error);
+
+ if (uap->info) {
+ siginfo_to_siginfo32(&ksi.ksi_info, &si32);
+ error = copyout(&si32, uap->info, sizeof(struct siginfo32));
+ }
+
+ if (error == 0)
+ td->td_retval[0] = ksi.ksi_signo;
+ return (error);
+}
+
+/*
+ * MPSAFE
+ */
+int
+freebsd32_sigwaitinfo(struct thread *td, struct freebsd32_sigwaitinfo_args *uap)
+{
+ ksiginfo_t ksi;
+ struct siginfo32 si32;
+ sigset_t set;
+ int error;
+
+ error = copyin(uap->set, &set, sizeof(set));
+ if (error)
+ return (error);
+
+ error = kern_sigtimedwait(td, set, &ksi, NULL);
+ if (error)
+ return (error);
+
+ if (uap->info) {
+ siginfo_to_siginfo32(&ksi.ksi_info, &si32);
+ error = copyout(&si32, uap->info, sizeof(struct siginfo32));
+ }
+ if (error == 0)
+ td->td_retval[0] = ksi.ksi_signo;
+ return (error);
+}
+
#if 0
int
Index: freebsd32_proto.h
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32_proto.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/freebsd32/freebsd32_proto.h -L sys/compat/freebsd32/freebsd32_proto.h -u -r1.1.1.2 -r1.2
--- sys/compat/freebsd32/freebsd32_proto.h
+++ sys/compat/freebsd32/freebsd32_proto.h
@@ -2,8 +2,8 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.38.2.4 2006/01/27 17:17:23 ambrisko Exp $
- * created from FreeBSD
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.78.2.1 2007/12/19 20:48:53 jhb Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.91.2.2 2007/12/19 20:43:41 jhb Exp
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -11,12 +11,11 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
-#include <posix4/_semaphore.h>
-
+#include <sys/_semaphore.h>
#include <sys/ucontext.h>
+#include <bsm/audit_kevents.h>
+
struct proc;
struct thread;
@@ -130,26 +129,10 @@
char a6_l_[PADL_(int)]; int a6; char a6_r_[PADR_(int)];
};
struct freebsd32_shmsys_args {
- char which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];
- char a2_l_[PADL_(int)]; int a2; char a2_r_[PADR_(int)];
- char a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)];
- char a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)];
-};
-struct freebsd32_pread_args {
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
- char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
-};
-struct freebsd32_pwrite_args {
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
- char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char which_l_[PADL_(uint32_t)]; uint32_t which; char which_r_[PADR_(uint32_t)];
+ char a2_l_[PADL_(uint32_t)]; uint32_t a2; char a2_r_[PADR_(uint32_t)];
+ char a3_l_[PADL_(uint32_t)]; uint32_t a3; char a3_r_[PADR_(uint32_t)];
+ char a4_l_[PADL_(uint32_t)]; uint32_t a4; char a4_r_[PADR_(uint32_t)];
};
struct freebsd32_stat_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
@@ -163,35 +146,6 @@
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char ub_l_[PADL_(struct stat32 *)]; struct stat32 * ub; char ub_r_[PADR_(struct stat32 *)];
};
-struct freebsd32_mmap_args {
- char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
- char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
- char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
- char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
-};
-struct freebsd32_lseek_args {
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
- char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
- char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
-};
-struct freebsd32_truncate_args {
- char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
-};
-struct freebsd32_ftruncate_args {
- char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
- char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
- char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
- char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
-};
struct freebsd32_sysctl_args {
char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)];
char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)];
@@ -204,6 +158,35 @@
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char tptr_l_[PADL_(struct timeval32 *)]; struct timeval32 * tptr; char tptr_r_[PADR_(struct timeval32 *)];
};
+struct freebsd32_semctl_args {
+ char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];
+ char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)];
+ char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
+ char arg_l_[PADL_(union semun32 *)]; union semun32 * arg; char arg_r_[PADR_(union semun32 *)];
+};
+struct freebsd32_msgctl_args {
+ char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];
+ char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
+ char buf_l_[PADL_(struct msqid_ds32 *)]; struct msqid_ds32 * buf; char buf_r_[PADR_(struct msqid_ds32 *)];
+};
+struct freebsd32_msgsnd_args {
+ char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];
+ char msgp_l_[PADL_(void *)]; void * msgp; char msgp_r_[PADR_(void *)];
+ char msgsz_l_[PADL_(size_t)]; size_t msgsz; char msgsz_r_[PADR_(size_t)];
+ char msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)];
+};
+struct freebsd32_msgrcv_args {
+ char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];
+ char msgp_l_[PADL_(void *)]; void * msgp; char msgp_r_[PADR_(void *)];
+ char msgsz_l_[PADL_(size_t)]; size_t msgsz; char msgsz_r_[PADR_(size_t)];
+ char msgtyp_l_[PADL_(long)]; long msgtyp; char msgtyp_r_[PADR_(long)];
+ char msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)];
+};
+struct freebsd32_shmctl_args {
+ char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)];
+ char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
+ char buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)];
+};
struct freebsd32_clock_gettime_args {
char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
char tp_l_[PADL_(struct timespec32 *)]; struct timespec32 * tp; char tp_r_[PADR_(struct timespec32 *)];
@@ -240,6 +223,15 @@
char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];
char stat_l_[PADL_(struct module_stat32 *)]; struct module_stat32 * stat; char stat_r_[PADR_(struct module_stat32 *)];
};
+struct freebsd32_sigtimedwait_args {
+ char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+ char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];
+};
+struct freebsd32_sigwaitinfo_args {
+ char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];
+ char info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];
+};
struct freebsd32_kevent_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char changelist_l_[PADL_(const struct kevent32 *)]; const struct kevent32 * changelist; char changelist_r_[PADR_(const struct kevent32 *)];
@@ -254,7 +246,7 @@
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
- char hdtr_l_[PADL_(struct sf_hdtr *)]; struct sf_hdtr * hdtr; char hdtr_r_[PADR_(struct sf_hdtr *)];
+ char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
};
@@ -266,6 +258,75 @@
struct freebsd32_sigreturn_args {
char sigcntxp_l_[PADL_(const struct freebsd32_ucontext *)]; const struct freebsd32_ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct freebsd32_ucontext *)];
};
+struct freebsd32_getcontext_args {
+ char ucp_l_[PADL_(struct freebsd32_ucontext *)]; struct freebsd32_ucontext * ucp; char ucp_r_[PADR_(struct freebsd32_ucontext *)];
+};
+struct freebsd32_setcontext_args {
+ char ucp_l_[PADL_(const struct freebsd32_ucontext *)]; const struct freebsd32_ucontext * ucp; char ucp_r_[PADR_(const struct freebsd32_ucontext *)];
+};
+struct freebsd32_swapcontext_args {
+ char oucp_l_[PADL_(struct freebsd32_ucontext *)]; struct freebsd32_ucontext * oucp; char oucp_r_[PADR_(struct freebsd32_ucontext *)];
+ char ucp_l_[PADL_(const struct freebsd32_ucontext *)]; const struct freebsd32_ucontext * ucp; char ucp_r_[PADR_(const struct freebsd32_ucontext *)];
+};
+struct freebsd32_umtx_lock_args {
+ char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)];
+};
+struct freebsd32_umtx_unlock_args {
+ char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)];
+};
+struct freebsd32_thr_suspend_args {
+ char timeout_l_[PADL_(const struct timespec32 *)]; const struct timespec32 * timeout; char timeout_r_[PADR_(const struct timespec32 *)];
+};
+struct freebsd32_umtx_op_args {
+ char obj_l_[PADL_(void *)]; void * obj; char obj_r_[PADR_(void *)];
+ char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
+ char val_l_[PADL_(u_long)]; u_long val; char val_r_[PADR_(u_long)];
+ char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)];
+ char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
+};
+struct freebsd32_thr_new_args {
+ char param_l_[PADL_(struct thr_param32 *)]; struct thr_param32 * param; char param_r_[PADR_(struct thr_param32 *)];
+ char param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)];
+};
+struct freebsd32_pread_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_pwrite_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_mmap_args {
+ char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
+ char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_lseek_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+};
+struct freebsd32_truncate_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+};
+struct freebsd32_ftruncate_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+};
int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *);
int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *);
@@ -285,17 +346,16 @@
int freebsd32_semsys(struct thread *, struct freebsd32_semsys_args *);
int freebsd32_msgsys(struct thread *, struct freebsd32_msgsys_args *);
int freebsd32_shmsys(struct thread *, struct freebsd32_shmsys_args *);
-int freebsd32_pread(struct thread *, struct freebsd32_pread_args *);
-int freebsd32_pwrite(struct thread *, struct freebsd32_pwrite_args *);
int freebsd32_stat(struct thread *, struct freebsd32_stat_args *);
int freebsd32_fstat(struct thread *, struct freebsd32_fstat_args *);
int freebsd32_lstat(struct thread *, struct freebsd32_lstat_args *);
-int freebsd32_mmap(struct thread *, struct freebsd32_mmap_args *);
-int freebsd32_lseek(struct thread *, struct freebsd32_lseek_args *);
-int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
-int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
int freebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *);
int freebsd32_futimes(struct thread *, struct freebsd32_futimes_args *);
+int freebsd32_semctl(struct thread *, struct freebsd32_semctl_args *);
+int freebsd32_msgctl(struct thread *, struct freebsd32_msgctl_args *);
+int freebsd32_msgsnd(struct thread *, struct freebsd32_msgsnd_args *);
+int freebsd32_msgrcv(struct thread *, struct freebsd32_msgrcv_args *);
+int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *);
int freebsd32_clock_gettime(struct thread *, struct freebsd32_clock_gettime_args *);
int freebsd32_clock_settime(struct thread *, struct freebsd32_clock_settime_args *);
int freebsd32_clock_getres(struct thread *, struct freebsd32_clock_getres_args *);
@@ -304,10 +364,26 @@
int freebsd32_preadv(struct thread *, struct freebsd32_preadv_args *);
int freebsd32_pwritev(struct thread *, struct freebsd32_pwritev_args *);
int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *);
+int freebsd32_sigtimedwait(struct thread *, struct freebsd32_sigtimedwait_args *);
+int freebsd32_sigwaitinfo(struct thread *, struct freebsd32_sigwaitinfo_args *);
int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *);
int freebsd32_sendfile(struct thread *, struct freebsd32_sendfile_args *);
int freebsd32_sigaction(struct thread *, struct freebsd32_sigaction_args *);
int freebsd32_sigreturn(struct thread *, struct freebsd32_sigreturn_args *);
+int freebsd32_getcontext(struct thread *, struct freebsd32_getcontext_args *);
+int freebsd32_setcontext(struct thread *, struct freebsd32_setcontext_args *);
+int freebsd32_swapcontext(struct thread *, struct freebsd32_swapcontext_args *);
+int freebsd32_umtx_lock(struct thread *, struct freebsd32_umtx_lock_args *);
+int freebsd32_umtx_unlock(struct thread *, struct freebsd32_umtx_unlock_args *);
+int freebsd32_thr_suspend(struct thread *, struct freebsd32_thr_suspend_args *);
+int freebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *);
+int freebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *);
+int freebsd32_pread(struct thread *, struct freebsd32_pread_args *);
+int freebsd32_pwrite(struct thread *, struct freebsd32_pwrite_args *);
+int freebsd32_mmap(struct thread *, struct freebsd32_mmap_args *);
+int freebsd32_lseek(struct thread *, struct freebsd32_lseek_args *);
+int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
+int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
#ifdef COMPAT_43
@@ -375,7 +451,7 @@
char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];
- char hdtr_l_[PADL_(struct sf_hdtr *)]; struct sf_hdtr * hdtr; char hdtr_r_[PADR_(struct sf_hdtr *)];
+ char hdtr_l_[PADL_(struct sf_hdtr32 *)]; struct sf_hdtr32 * hdtr; char hdtr_r_[PADR_(struct sf_hdtr32 *)];
char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
};
@@ -397,6 +473,121 @@
#endif /* COMPAT_FREEBSD4 */
+
+#ifdef COMPAT_FREEBSD6
+
+struct freebsd6_freebsd32_pread_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+};
+struct freebsd6_freebsd32_pwrite_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
+ char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+};
+struct freebsd6_freebsd32_mmap_args {
+ char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
+ char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+ char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+ char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)];
+ char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)];
+};
+struct freebsd6_freebsd32_lseek_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)];
+ char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)];
+ char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+};
+struct freebsd6_freebsd32_truncate_args {
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+};
+struct freebsd6_freebsd32_ftruncate_args {
+ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+ char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
+ char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)];
+ char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)];
+};
+int freebsd6_freebsd32_pread(struct thread *, struct freebsd6_freebsd32_pread_args *);
+int freebsd6_freebsd32_pwrite(struct thread *, struct freebsd6_freebsd32_pwrite_args *);
+int freebsd6_freebsd32_mmap(struct thread *, struct freebsd6_freebsd32_mmap_args *);
+int freebsd6_freebsd32_lseek(struct thread *, struct freebsd6_freebsd32_lseek_args *);
+int freebsd6_freebsd32_truncate(struct thread *, struct freebsd6_freebsd32_truncate_args *);
+int freebsd6_freebsd32_ftruncate(struct thread *, struct freebsd6_freebsd32_ftruncate_args *);
+
+#endif /* COMPAT_FREEBSD6 */
+
+#define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4
+#define FREEBSD32_SYS_AUE_freebsd32_recvmsg AUE_RECVMSG
+#define FREEBSD32_SYS_AUE_freebsd32_sendmsg AUE_SENDMSG
+#define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM
+#define FREEBSD32_SYS_AUE_freebsd32_sigaltstack AUE_SIGALTSTACK
+#define FREEBSD32_SYS_AUE_freebsd32_execve AUE_EXECVE
+#define FREEBSD32_SYS_AUE_freebsd32_setitimer AUE_SETITIMER
+#define FREEBSD32_SYS_AUE_freebsd32_getitimer AUE_GETITIMER
+#define FREEBSD32_SYS_AUE_freebsd32_select AUE_SELECT
+#define FREEBSD32_SYS_AUE_freebsd32_gettimeofday AUE_GETTIMEOFDAY
+#define FREEBSD32_SYS_AUE_freebsd32_getrusage AUE_GETRUSAGE
+#define FREEBSD32_SYS_AUE_freebsd32_readv AUE_READV
+#define FREEBSD32_SYS_AUE_freebsd32_writev AUE_WRITEV
+#define FREEBSD32_SYS_AUE_freebsd32_settimeofday AUE_SETTIMEOFDAY
+#define FREEBSD32_SYS_AUE_freebsd32_utimes AUE_UTIMES
+#define FREEBSD32_SYS_AUE_freebsd32_adjtime AUE_ADJTIME
+#define FREEBSD32_SYS_AUE_freebsd32_semsys AUE_SEMSYS
+#define FREEBSD32_SYS_AUE_freebsd32_msgsys AUE_MSGSYS
+#define FREEBSD32_SYS_AUE_freebsd32_shmsys AUE_SHMSYS
+#define FREEBSD32_SYS_AUE_freebsd32_stat AUE_STAT
+#define FREEBSD32_SYS_AUE_freebsd32_fstat AUE_FSTAT
+#define FREEBSD32_SYS_AUE_freebsd32_lstat AUE_LSTAT
+#define FREEBSD32_SYS_AUE_freebsd32_sysctl AUE_SYSCTL
+#define FREEBSD32_SYS_AUE_freebsd32_futimes AUE_FUTIMES
+#define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL
+#define FREEBSD32_SYS_AUE_freebsd32_msgctl AUE_MSGCTL
+#define FREEBSD32_SYS_AUE_freebsd32_msgsnd AUE_MSGSND
+#define FREEBSD32_SYS_AUE_freebsd32_msgrcv AUE_MSGRCV
+#define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL
+#define FREEBSD32_SYS_AUE_freebsd32_clock_gettime AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_clock_settime AUE_CLOCK_SETTIME
+#define FREEBSD32_SYS_AUE_freebsd32_clock_getres AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_nanosleep AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES
+#define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV
+#define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV
+#define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT
+#define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_kevent AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_sendfile AUE_SENDFILE
+#define FREEBSD32_SYS_AUE_freebsd32_sigaction AUE_SIGACTION
+#define FREEBSD32_SYS_AUE_freebsd32_sigreturn AUE_SIGRETURN
+#define FREEBSD32_SYS_AUE_freebsd32_getcontext AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_setcontext AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_swapcontext AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_umtx_lock AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_umtx_unlock AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_umtx_op AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_thr_new AUE_NULL
+#define FREEBSD32_SYS_AUE_freebsd32_pread AUE_PREAD
+#define FREEBSD32_SYS_AUE_freebsd32_pwrite AUE_PWRITE
+#define FREEBSD32_SYS_AUE_freebsd32_mmap AUE_MMAP
+#define FREEBSD32_SYS_AUE_freebsd32_lseek AUE_LSEEK
+#define FREEBSD32_SYS_AUE_freebsd32_truncate AUE_TRUNCATE
+#define FREEBSD32_SYS_AUE_freebsd32_ftruncate AUE_FTRUNCATE
+
#undef PAD_
#undef PADL_
#undef PADR_
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/freebsd32/Makefile -L sys/compat/freebsd32/Makefile -u -r1.1.1.1 -r1.2
--- sys/compat/freebsd32/Makefile
+++ sys/compat/freebsd32/Makefile
@@ -1,6 +1,6 @@
# Makefile for syscall tables
#
-# $FreeBSD: src/sys/compat/freebsd32/Makefile,v 1.3 2003/08/22 22:51:48 peter Exp $
+# $FreeBSD: src/sys/compat/freebsd32/Makefile,v 1.4 2005/10/23 23:58:23 obrien Exp $
all:
@echo "make sysent only"
@@ -14,3 +14,6 @@
-mv -f freebsd32_syscall.h freebsd32_syscall.h.bak
-mv -f freebsd32_proto.h freebsd32_proto.h.bak
sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+
+clean:
+ rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h
Index: freebsd32_sysent.c
===================================================================
RCS file: /home/cvs/src/sys/compat/freebsd32/freebsd32_sysent.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/freebsd32/freebsd32_sysent.c -L sys/compat/freebsd32/freebsd32_sysent.c -u -r1.1.1.2 -r1.2
--- sys/compat/freebsd32/freebsd32_sysent.c
+++ sys/compat/freebsd32/freebsd32_sysent.c
@@ -2,8 +2,8 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.39.2.4 2006/01/27 17:17:23 ambrisko Exp $
- * created from FreeBSD
+ * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.77.2.1 2007/12/19 20:48:53 jhb Exp $
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.91.2.2 2007/12/19 20:43:41 jhb Exp
*/
#include "opt_compat.h"
@@ -13,6 +13,7 @@
#include <sys/sysent.h>
#include <sys/sysproto.h>
#include <sys/mount.h>
+#include <sys/socket.h>
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
@@ -30,461 +31,494 @@
#define compat4(n, name) 0, (sy_call_t *)nosys
#endif
+#ifdef COMPAT_FREEBSD6
+#define compat6(n, name) n, (sy_call_t *)__CONCAT(freebsd6_,name)
+#else
+#define compat6(n, name) 0, (sy_call_t *)nosys
+#endif
+
/* The casts are bogus but will do for now. */
struct sysent freebsd32_sysent[] = {
- { SYF_MPSAFE | 0, (sy_call_t *)nosys, AUE_NULL }, /* 0 = syscall */
- { SYF_MPSAFE | AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_NULL }, /* 1 = exit */
- { SYF_MPSAFE | 0, (sy_call_t *)fork, AUE_NULL }, /* 2 = fork */
- { SYF_MPSAFE | AS(read_args), (sy_call_t *)read, AUE_NULL }, /* 3 = read */
- { SYF_MPSAFE | AS(write_args), (sy_call_t *)write, AUE_NULL }, /* 4 = write */
- { SYF_MPSAFE | AS(open_args), (sy_call_t *)open, AUE_NULL }, /* 5 = open */
- { SYF_MPSAFE | AS(close_args), (sy_call_t *)close, AUE_NULL }, /* 6 = close */
- { SYF_MPSAFE | AS(freebsd32_wait4_args), (sy_call_t *)freebsd32_wait4, AUE_NULL }, /* 7 = freebsd32_wait4 */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 8 = obsolete old creat */
- { SYF_MPSAFE | AS(link_args), (sy_call_t *)link, AUE_NULL }, /* 9 = link */
- { SYF_MPSAFE | AS(unlink_args), (sy_call_t *)unlink, AUE_NULL }, /* 10 = unlink */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 11 = obsolete execv */
- { SYF_MPSAFE | AS(chdir_args), (sy_call_t *)chdir, AUE_NULL }, /* 12 = chdir */
- { SYF_MPSAFE | AS(fchdir_args), (sy_call_t *)fchdir, AUE_NULL }, /* 13 = fchdir */
- { SYF_MPSAFE | AS(mknod_args), (sy_call_t *)mknod, AUE_NULL }, /* 14 = mknod */
- { SYF_MPSAFE | AS(chmod_args), (sy_call_t *)chmod, AUE_NULL }, /* 15 = chmod */
- { SYF_MPSAFE | AS(chown_args), (sy_call_t *)chown, AUE_NULL }, /* 16 = chown */
- { SYF_MPSAFE | AS(obreak_args), (sy_call_t *)obreak, AUE_NULL }, /* 17 = break */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_NULL }, /* 18 = old freebsd32_getfsstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 19 = obsolete olseek */
- { SYF_MPSAFE | 0, (sy_call_t *)getpid, AUE_NULL }, /* 20 = getpid */
- { AS(mount_args), (sy_call_t *)mount, AUE_NULL }, /* 21 = mount */
- { AS(unmount_args), (sy_call_t *)unmount, AUE_NULL }, /* 22 = unmount */
- { SYF_MPSAFE | AS(setuid_args), (sy_call_t *)setuid, AUE_NULL }, /* 23 = setuid */
- { SYF_MPSAFE | 0, (sy_call_t *)getuid, AUE_NULL }, /* 24 = getuid */
- { SYF_MPSAFE | 0, (sy_call_t *)geteuid, AUE_NULL }, /* 25 = geteuid */
- { SYF_MPSAFE | AS(ptrace_args), (sy_call_t *)ptrace, AUE_NULL }, /* 26 = ptrace */
- { SYF_MPSAFE | AS(freebsd32_recvmsg_args), (sy_call_t *)freebsd32_recvmsg, AUE_NULL }, /* 27 = freebsd32_recvmsg */
- { SYF_MPSAFE | AS(freebsd32_sendmsg_args), (sy_call_t *)freebsd32_sendmsg, AUE_NULL }, /* 28 = freebsd32_sendmsg */
- { SYF_MPSAFE | AS(freebsd32_recvfrom_args), (sy_call_t *)freebsd32_recvfrom, AUE_NULL }, /* 29 = freebsd32_recvfrom */
- { SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept, AUE_NULL }, /* 30 = accept */
- { SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL }, /* 31 = getpeername */
- { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL }, /* 32 = getsockname */
- { SYF_MPSAFE | AS(access_args), (sy_call_t *)access, AUE_NULL }, /* 33 = access */
- { SYF_MPSAFE | AS(chflags_args), (sy_call_t *)chflags, AUE_NULL }, /* 34 = chflags */
- { SYF_MPSAFE | AS(fchflags_args), (sy_call_t *)fchflags, AUE_NULL }, /* 35 = fchflags */
- { SYF_MPSAFE | 0, (sy_call_t *)sync, AUE_NULL }, /* 36 = sync */
- { SYF_MPSAFE | AS(kill_args), (sy_call_t *)kill, AUE_NULL }, /* 37 = kill */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 38 = ostat */
- { SYF_MPSAFE | 0, (sy_call_t *)getppid, AUE_NULL }, /* 39 = getppid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 40 = olstat */
- { SYF_MPSAFE | AS(dup_args), (sy_call_t *)dup, AUE_NULL }, /* 41 = dup */
- { SYF_MPSAFE | 0, (sy_call_t *)pipe, AUE_NULL }, /* 42 = pipe */
- { SYF_MPSAFE | 0, (sy_call_t *)getegid, AUE_NULL }, /* 43 = getegid */
- { SYF_MPSAFE | AS(profil_args), (sy_call_t *)profil, AUE_NULL }, /* 44 = profil */
- { SYF_MPSAFE | AS(ktrace_args), (sy_call_t *)ktrace, AUE_NULL }, /* 45 = ktrace */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigaction_args),freebsd32_sigaction), AUE_NULL }, /* 46 = old freebsd32_sigaction */
- { SYF_MPSAFE | 0, (sy_call_t *)getgid, AUE_NULL }, /* 47 = getgid */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigprocmask_args),freebsd32_sigprocmask), AUE_NULL }, /* 48 = old freebsd32_sigprocmask */
- { SYF_MPSAFE | AS(getlogin_args), (sy_call_t *)getlogin, AUE_NULL }, /* 49 = getlogin */
- { SYF_MPSAFE | AS(setlogin_args), (sy_call_t *)setlogin, AUE_NULL }, /* 50 = setlogin */
- { SYF_MPSAFE | AS(acct_args), (sy_call_t *)acct, AUE_NULL }, /* 51 = acct */
- { compat(SYF_MPSAFE | 0,freebsd32_sigpending), AUE_NULL }, /* 52 = old freebsd32_sigpending */
- { SYF_MPSAFE | AS(freebsd32_sigaltstack_args), (sy_call_t *)freebsd32_sigaltstack, AUE_NULL }, /* 53 = freebsd32_sigaltstack */
- { SYF_MPSAFE | AS(ioctl_args), (sy_call_t *)ioctl, AUE_NULL }, /* 54 = ioctl */
- { SYF_MPSAFE | AS(reboot_args), (sy_call_t *)reboot, AUE_NULL }, /* 55 = reboot */
- { SYF_MPSAFE | AS(revoke_args), (sy_call_t *)revoke, AUE_NULL }, /* 56 = revoke */
- { SYF_MPSAFE | AS(symlink_args), (sy_call_t *)symlink, AUE_NULL }, /* 57 = symlink */
- { SYF_MPSAFE | AS(readlink_args), (sy_call_t *)readlink, AUE_NULL }, /* 58 = readlink */
- { SYF_MPSAFE | AS(freebsd32_execve_args), (sy_call_t *)freebsd32_execve, AUE_NULL }, /* 59 = freebsd32_execve */
- { SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask, AUE_NULL }, /* 60 = umask */
- { SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot, AUE_NULL }, /* 61 = chroot */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 62 = obsolete ofstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 63 = obsolete ogetkerninfo */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 64 = obsolete ogetpagesize */
- { SYF_MPSAFE | AS(msync_args), (sy_call_t *)msync, AUE_NULL }, /* 65 = msync */
- { SYF_MPSAFE | 0, (sy_call_t *)vfork, AUE_NULL }, /* 66 = vfork */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 67 = obsolete vread */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 68 = obsolete vwrite */
- { SYF_MPSAFE | AS(sbrk_args), (sy_call_t *)sbrk, AUE_NULL }, /* 69 = sbrk */
- { SYF_MPSAFE | AS(sstk_args), (sy_call_t *)sstk, AUE_NULL }, /* 70 = sstk */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 71 = obsolete ommap */
- { SYF_MPSAFE | AS(ovadvise_args), (sy_call_t *)ovadvise, AUE_NULL }, /* 72 = vadvise */
- { SYF_MPSAFE | AS(munmap_args), (sy_call_t *)munmap, AUE_NULL }, /* 73 = munmap */
- { SYF_MPSAFE | AS(mprotect_args), (sy_call_t *)mprotect, AUE_NULL }, /* 74 = mprotect */
- { SYF_MPSAFE | AS(madvise_args), (sy_call_t *)madvise, AUE_NULL }, /* 75 = madvise */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 76 = obsolete vhangup */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 77 = obsolete vlimit */
- { SYF_MPSAFE | AS(mincore_args), (sy_call_t *)mincore, AUE_NULL }, /* 78 = mincore */
- { SYF_MPSAFE | AS(getgroups_args), (sy_call_t *)getgroups, AUE_NULL }, /* 79 = getgroups */
- { SYF_MPSAFE | AS(setgroups_args), (sy_call_t *)setgroups, AUE_NULL }, /* 80 = setgroups */
- { SYF_MPSAFE | 0, (sy_call_t *)getpgrp, AUE_NULL }, /* 81 = getpgrp */
- { SYF_MPSAFE | AS(setpgid_args), (sy_call_t *)setpgid, AUE_NULL }, /* 82 = setpgid */
- { SYF_MPSAFE | AS(freebsd32_setitimer_args), (sy_call_t *)freebsd32_setitimer, AUE_NULL }, /* 83 = freebsd32_setitimer */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 84 = obsolete owait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 85 = obsolete oswapon */
- { SYF_MPSAFE | AS(freebsd32_getitimer_args), (sy_call_t *)freebsd32_getitimer, AUE_NULL }, /* 86 = freebsd32_getitimer */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 87 = obsolete ogethostname */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 88 = obsolete osethostname */
- { SYF_MPSAFE | 0, (sy_call_t *)getdtablesize, AUE_NULL }, /* 89 = getdtablesize */
- { SYF_MPSAFE | AS(dup2_args), (sy_call_t *)dup2, AUE_NULL }, /* 90 = dup2 */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 91 = getdopt */
- { SYF_MPSAFE | AS(fcntl_args), (sy_call_t *)fcntl, AUE_NULL }, /* 92 = fcntl */
- { SYF_MPSAFE | AS(freebsd32_select_args), (sy_call_t *)freebsd32_select, AUE_NULL }, /* 93 = freebsd32_select */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 94 = setdopt */
- { SYF_MPSAFE | AS(fsync_args), (sy_call_t *)fsync, AUE_NULL }, /* 95 = fsync */
- { SYF_MPSAFE | AS(setpriority_args), (sy_call_t *)setpriority, AUE_NULL }, /* 96 = setpriority */
- { SYF_MPSAFE | AS(socket_args), (sy_call_t *)socket, AUE_NULL }, /* 97 = socket */
- { SYF_MPSAFE | AS(connect_args), (sy_call_t *)connect, AUE_NULL }, /* 98 = connect */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 99 = obsolete oaccept */
- { SYF_MPSAFE | AS(getpriority_args), (sy_call_t *)getpriority, AUE_NULL }, /* 100 = getpriority */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 101 = obsolete osend */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 102 = obsolete orecv */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 103 = obsolete osigreturn */
- { SYF_MPSAFE | AS(bind_args), (sy_call_t *)bind, AUE_NULL }, /* 104 = bind */
- { SYF_MPSAFE | AS(setsockopt_args), (sy_call_t *)setsockopt, AUE_NULL }, /* 105 = setsockopt */
- { SYF_MPSAFE | AS(listen_args), (sy_call_t *)listen, AUE_NULL }, /* 106 = listen */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 107 = obsolete vtimes */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigvec_args),freebsd32_sigvec), AUE_NULL }, /* 108 = old freebsd32_sigvec */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigblock_args),freebsd32_sigblock), AUE_NULL }, /* 109 = old freebsd32_sigblock */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigsetmask_args),freebsd32_sigsetmask), AUE_NULL }, /* 110 = old freebsd32_sigsetmask */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigsuspend_args),freebsd32_sigsuspend), AUE_NULL }, /* 111 = old freebsd32_sigsuspend */
- { compat(SYF_MPSAFE | AS(ofreebsd32_sigstack_args),freebsd32_sigstack), AUE_NULL }, /* 112 = old freebsd32_sigstack */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 113 = obsolete orecvmsg */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 114 = obsolete osendmsg */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 115 = obsolete vtrace */
- { SYF_MPSAFE | AS(freebsd32_gettimeofday_args), (sy_call_t *)freebsd32_gettimeofday, AUE_NULL }, /* 116 = freebsd32_gettimeofday */
- { SYF_MPSAFE | AS(freebsd32_getrusage_args), (sy_call_t *)freebsd32_getrusage, AUE_NULL }, /* 117 = freebsd32_getrusage */
- { SYF_MPSAFE | AS(getsockopt_args), (sy_call_t *)getsockopt, AUE_NULL }, /* 118 = getsockopt */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 119 = resuba */
- { SYF_MPSAFE | AS(freebsd32_readv_args), (sy_call_t *)freebsd32_readv, AUE_NULL }, /* 120 = freebsd32_readv */
- { SYF_MPSAFE | AS(freebsd32_writev_args), (sy_call_t *)freebsd32_writev, AUE_NULL }, /* 121 = freebsd32_writev */
- { SYF_MPSAFE | AS(freebsd32_settimeofday_args), (sy_call_t *)freebsd32_settimeofday, AUE_NULL }, /* 122 = freebsd32_settimeofday */
- { SYF_MPSAFE | AS(fchown_args), (sy_call_t *)fchown, AUE_NULL }, /* 123 = fchown */
- { SYF_MPSAFE | AS(fchmod_args), (sy_call_t *)fchmod, AUE_NULL }, /* 124 = fchmod */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 125 = obsolete orecvfrom */
- { SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid, AUE_NULL }, /* 126 = setreuid */
- { SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid, AUE_NULL }, /* 127 = setregid */
- { SYF_MPSAFE | AS(rename_args), (sy_call_t *)rename, AUE_NULL }, /* 128 = rename */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 129 = obsolete otruncate */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 130 = obsolete ftruncate */
- { SYF_MPSAFE | AS(flock_args), (sy_call_t *)flock, AUE_NULL }, /* 131 = flock */
- { SYF_MPSAFE | AS(mkfifo_args), (sy_call_t *)mkfifo, AUE_NULL }, /* 132 = mkfifo */
- { SYF_MPSAFE | AS(sendto_args), (sy_call_t *)sendto, AUE_NULL }, /* 133 = sendto */
- { SYF_MPSAFE | AS(shutdown_args), (sy_call_t *)shutdown, AUE_NULL }, /* 134 = shutdown */
- { SYF_MPSAFE | AS(socketpair_args), (sy_call_t *)socketpair, AUE_NULL }, /* 135 = socketpair */
- { SYF_MPSAFE | AS(mkdir_args), (sy_call_t *)mkdir, AUE_NULL }, /* 136 = mkdir */
- { SYF_MPSAFE | AS(rmdir_args), (sy_call_t *)rmdir, AUE_NULL }, /* 137 = rmdir */
- { SYF_MPSAFE | AS(freebsd32_utimes_args), (sy_call_t *)freebsd32_utimes, AUE_NULL }, /* 138 = freebsd32_utimes */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 139 = obsolete 4.2 sigreturn */
- { SYF_MPSAFE | AS(freebsd32_adjtime_args), (sy_call_t *)freebsd32_adjtime, AUE_NULL }, /* 140 = freebsd32_adjtime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 141 = obsolete ogetpeername */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 142 = obsolete ogethostid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 143 = obsolete sethostid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 144 = obsolete getrlimit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 145 = obsolete setrlimit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 146 = obsolete killpg */
- { SYF_MPSAFE | 0, (sy_call_t *)setsid, AUE_NULL }, /* 147 = setsid */
- { SYF_MPSAFE | AS(quotactl_args), (sy_call_t *)quotactl, AUE_NULL }, /* 148 = quotactl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 149 = obsolete oquota */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 150 = obsolete ogetsockname */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 151 = sem_lock */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 152 = sem_wakeup */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 153 = asyncdaemon */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 154 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 155 = nfssvc */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 156 = obsolete ogetdirentries */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_statfs_args),freebsd32_statfs), AUE_NULL }, /* 157 = old freebsd32_statfs */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_fstatfs_args),freebsd32_fstatfs), AUE_NULL }, /* 158 = old freebsd32_fstatfs */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 159 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 160 = nosys */
- { SYF_MPSAFE | AS(getfh_args), (sy_call_t *)getfh, AUE_NULL }, /* 161 = getfh */
- { SYF_MPSAFE | AS(getdomainname_args), (sy_call_t *)getdomainname, AUE_NULL }, /* 162 = getdomainname */
- { SYF_MPSAFE | AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_NULL }, /* 163 = setdomainname */
- { SYF_MPSAFE | AS(uname_args), (sy_call_t *)uname, AUE_NULL }, /* 164 = uname */
- { SYF_MPSAFE | AS(sysarch_args), (sy_call_t *)sysarch, AUE_NULL }, /* 165 = sysarch */
- { SYF_MPSAFE | AS(rtprio_args), (sy_call_t *)rtprio, AUE_NULL }, /* 166 = rtprio */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 167 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 168 = nosys */
- { SYF_MPSAFE | AS(freebsd32_semsys_args), (sy_call_t *)freebsd32_semsys, AUE_NULL }, /* 169 = freebsd32_semsys */
- { SYF_MPSAFE | AS(freebsd32_msgsys_args), (sy_call_t *)freebsd32_msgsys, AUE_NULL }, /* 170 = freebsd32_msgsys */
- { SYF_MPSAFE | AS(freebsd32_shmsys_args), (sy_call_t *)freebsd32_shmsys, AUE_NULL }, /* 171 = freebsd32_shmsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 172 = nosys */
- { SYF_MPSAFE | AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_NULL }, /* 173 = freebsd32_pread */
- { SYF_MPSAFE | AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_NULL }, /* 174 = freebsd32_pwrite */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 175 = nosys */
- { SYF_MPSAFE | AS(ntp_adjtime_args), (sy_call_t *)ntp_adjtime, AUE_NULL }, /* 176 = ntp_adjtime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 177 = sfork */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 178 = getdescriptor */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 179 = setdescriptor */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 180 = nosys */
- { SYF_MPSAFE | AS(setgid_args), (sy_call_t *)setgid, AUE_NULL }, /* 181 = setgid */
- { SYF_MPSAFE | AS(setegid_args), (sy_call_t *)setegid, AUE_NULL }, /* 182 = setegid */
- { SYF_MPSAFE | AS(seteuid_args), (sy_call_t *)seteuid, AUE_NULL }, /* 183 = seteuid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 184 = lfs_bmapv */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 185 = lfs_markv */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 186 = lfs_segclean */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 187 = lfs_segwait */
- { SYF_MPSAFE | AS(freebsd32_stat_args), (sy_call_t *)freebsd32_stat, AUE_NULL }, /* 188 = freebsd32_stat */
- { SYF_MPSAFE | AS(freebsd32_fstat_args), (sy_call_t *)freebsd32_fstat, AUE_NULL }, /* 189 = freebsd32_fstat */
- { SYF_MPSAFE | AS(freebsd32_lstat_args), (sy_call_t *)freebsd32_lstat, AUE_NULL }, /* 190 = freebsd32_lstat */
- { SYF_MPSAFE | AS(pathconf_args), (sy_call_t *)pathconf, AUE_NULL }, /* 191 = pathconf */
- { SYF_MPSAFE | AS(fpathconf_args), (sy_call_t *)fpathconf, AUE_NULL }, /* 192 = fpathconf */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 193 = nosys */
- { SYF_MPSAFE | AS(__getrlimit_args), (sy_call_t *)getrlimit, AUE_NULL }, /* 194 = getrlimit */
- { SYF_MPSAFE | AS(__setrlimit_args), (sy_call_t *)setrlimit, AUE_NULL }, /* 195 = setrlimit */
- { SYF_MPSAFE | AS(getdirentries_args), (sy_call_t *)getdirentries, AUE_NULL }, /* 196 = getdirentries */
- { SYF_MPSAFE | AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_NULL }, /* 197 = freebsd32_mmap */
- { SYF_MPSAFE | 0, (sy_call_t *)nosys, AUE_NULL }, /* 198 = __syscall */
- { SYF_MPSAFE | AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_NULL }, /* 199 = freebsd32_lseek */
- { SYF_MPSAFE | AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_NULL }, /* 200 = freebsd32_truncate */
- { SYF_MPSAFE | AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_NULL }, /* 201 = freebsd32_ftruncate */
- { SYF_MPSAFE | AS(freebsd32_sysctl_args), (sy_call_t *)freebsd32_sysctl, AUE_NULL }, /* 202 = freebsd32_sysctl */
- { SYF_MPSAFE | AS(mlock_args), (sy_call_t *)mlock, AUE_NULL }, /* 203 = mlock */
- { SYF_MPSAFE | AS(munlock_args), (sy_call_t *)munlock, AUE_NULL }, /* 204 = munlock */
- { SYF_MPSAFE | AS(undelete_args), (sy_call_t *)undelete, AUE_NULL }, /* 205 = undelete */
- { SYF_MPSAFE | AS(freebsd32_futimes_args), (sy_call_t *)freebsd32_futimes, AUE_NULL }, /* 206 = freebsd32_futimes */
- { SYF_MPSAFE | AS(getpgid_args), (sy_call_t *)getpgid, AUE_NULL }, /* 207 = getpgid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 208 = newreboot */
- { SYF_MPSAFE | AS(poll_args), (sy_call_t *)poll, AUE_NULL }, /* 209 = poll */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 210 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 211 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 212 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 213 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 214 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 215 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 216 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 217 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 218 = */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 219 = */
- { SYF_MPSAFE | AS(__semctl_args), (sy_call_t *)__semctl, AUE_NULL }, /* 220 = __semctl */
- { SYF_MPSAFE | AS(semget_args), (sy_call_t *)semget, AUE_NULL }, /* 221 = semget */
- { SYF_MPSAFE | AS(semop_args), (sy_call_t *)semop, AUE_NULL }, /* 222 = semop */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 223 = semconfig */
- { SYF_MPSAFE | AS(msgctl_args), (sy_call_t *)msgctl, AUE_NULL }, /* 224 = msgctl */
- { SYF_MPSAFE | AS(msgget_args), (sy_call_t *)msgget, AUE_NULL }, /* 225 = msgget */
- { SYF_MPSAFE | AS(msgsnd_args), (sy_call_t *)msgsnd, AUE_NULL }, /* 226 = msgsnd */
- { SYF_MPSAFE | AS(msgrcv_args), (sy_call_t *)msgrcv, AUE_NULL }, /* 227 = msgrcv */
- { SYF_MPSAFE | AS(shmat_args), (sy_call_t *)shmat, AUE_NULL }, /* 228 = shmat */
- { SYF_MPSAFE | AS(shmctl_args), (sy_call_t *)shmctl, AUE_NULL }, /* 229 = shmctl */
- { SYF_MPSAFE | AS(shmdt_args), (sy_call_t *)shmdt, AUE_NULL }, /* 230 = shmdt */
- { SYF_MPSAFE | AS(shmget_args), (sy_call_t *)shmget, AUE_NULL }, /* 231 = shmget */
- { SYF_MPSAFE | AS(freebsd32_clock_gettime_args), (sy_call_t *)freebsd32_clock_gettime, AUE_NULL }, /* 232 = freebsd32_clock_gettime */
- { SYF_MPSAFE | AS(freebsd32_clock_settime_args), (sy_call_t *)freebsd32_clock_settime, AUE_NULL }, /* 233 = freebsd32_clock_settime */
- { SYF_MPSAFE | AS(freebsd32_clock_getres_args), (sy_call_t *)freebsd32_clock_getres, AUE_NULL }, /* 234 = freebsd32_clock_getres */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 235 = timer_create */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 236 = timer_delete */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 237 = timer_settime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 238 = timer_gettime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 239 = timer_getoverrun */
- { SYF_MPSAFE | AS(freebsd32_nanosleep_args), (sy_call_t *)freebsd32_nanosleep, AUE_NULL }, /* 240 = freebsd32_nanosleep */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 241 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 242 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 243 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 244 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 245 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 246 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 247 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 248 = ntp_gettime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 249 = nosys */
- { SYF_MPSAFE | AS(minherit_args), (sy_call_t *)minherit, AUE_NULL }, /* 250 = minherit */
- { SYF_MPSAFE | AS(rfork_args), (sy_call_t *)rfork, AUE_NULL }, /* 251 = rfork */
- { SYF_MPSAFE | AS(openbsd_poll_args), (sy_call_t *)openbsd_poll, AUE_NULL }, /* 252 = openbsd_poll */
- { SYF_MPSAFE | 0, (sy_call_t *)issetugid, AUE_NULL }, /* 253 = issetugid */
- { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 254 = lchown */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 255 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 256 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 257 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 258 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 259 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 260 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 261 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 262 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 263 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 264 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 265 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 266 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 267 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 268 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 269 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 270 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 271 = nosys */
- { SYF_MPSAFE | AS(getdents_args), (sy_call_t *)getdents, AUE_NULL }, /* 272 = getdents */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 273 = nosys */
- { SYF_MPSAFE | AS(lchmod_args), (sy_call_t *)lchmod, AUE_NULL }, /* 274 = lchmod */
- { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 275 = netbsd_lchown */
- { SYF_MPSAFE | AS(freebsd32_lutimes_args), (sy_call_t *)freebsd32_lutimes, AUE_NULL }, /* 276 = freebsd32_lutimes */
- { SYF_MPSAFE | AS(msync_args), (sy_call_t *)msync, AUE_NULL }, /* 277 = netbsd_msync */
- { SYF_MPSAFE | AS(nstat_args), (sy_call_t *)nstat, AUE_NULL }, /* 278 = nstat */
- { SYF_MPSAFE | AS(nfstat_args), (sy_call_t *)nfstat, AUE_NULL }, /* 279 = nfstat */
- { SYF_MPSAFE | AS(nlstat_args), (sy_call_t *)nlstat, AUE_NULL }, /* 280 = nlstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 281 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 282 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 283 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 284 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 285 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 286 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 287 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 288 = nosys */
- { SYF_MPSAFE | AS(freebsd32_preadv_args), (sy_call_t *)freebsd32_preadv, AUE_NULL }, /* 289 = freebsd32_preadv */
- { SYF_MPSAFE | AS(freebsd32_pwritev_args), (sy_call_t *)freebsd32_pwritev, AUE_NULL }, /* 290 = freebsd32_pwritev */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 291 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 292 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 293 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 294 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 295 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 296 = nosys */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_fhstatfs_args),freebsd32_fhstatfs), AUE_NULL }, /* 297 = old freebsd32_fhstatfs */
- { SYF_MPSAFE | AS(fhopen_args), (sy_call_t *)fhopen, AUE_NULL }, /* 298 = fhopen */
- { SYF_MPSAFE | AS(fhstat_args), (sy_call_t *)fhstat, AUE_NULL }, /* 299 = fhstat */
- { SYF_MPSAFE | AS(modnext_args), (sy_call_t *)modnext, AUE_NULL }, /* 300 = modnext */
- { SYF_MPSAFE | AS(freebsd32_modstat_args), (sy_call_t *)freebsd32_modstat, AUE_NULL }, /* 301 = freebsd32_modstat */
- { SYF_MPSAFE | AS(modfnext_args), (sy_call_t *)modfnext, AUE_NULL }, /* 302 = modfnext */
- { SYF_MPSAFE | AS(modfind_args), (sy_call_t *)modfind, AUE_NULL }, /* 303 = modfind */
- { SYF_MPSAFE | AS(kldload_args), (sy_call_t *)kldload, AUE_NULL }, /* 304 = kldload */
- { SYF_MPSAFE | AS(kldunload_args), (sy_call_t *)kldunload, AUE_NULL }, /* 305 = kldunload */
- { SYF_MPSAFE | AS(kldfind_args), (sy_call_t *)kldfind, AUE_NULL }, /* 306 = kldfind */
- { SYF_MPSAFE | AS(kldnext_args), (sy_call_t *)kldnext, AUE_NULL }, /* 307 = kldnext */
- { SYF_MPSAFE | AS(kldstat_args), (sy_call_t *)kldstat, AUE_NULL }, /* 308 = kldstat */
- { SYF_MPSAFE | AS(kldfirstmod_args), (sy_call_t *)kldfirstmod, AUE_NULL }, /* 309 = kldfirstmod */
- { SYF_MPSAFE | AS(getsid_args), (sy_call_t *)getsid, AUE_NULL }, /* 310 = getsid */
- { SYF_MPSAFE | AS(setresuid_args), (sy_call_t *)setresuid, AUE_NULL }, /* 311 = setresuid */
- { SYF_MPSAFE | AS(setresgid_args), (sy_call_t *)setresgid, AUE_NULL }, /* 312 = setresgid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 313 = obsolete signanosleep */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 314 = aio_return */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 315 = aio_suspend */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 316 = aio_cancel */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 317 = aio_error */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 318 = aio_read */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 319 = aio_write */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 320 = lio_listio */
- { SYF_MPSAFE | 0, (sy_call_t *)yield, AUE_NULL }, /* 321 = yield */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 322 = obsolete thr_sleep */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 323 = obsolete thr_wakeup */
- { SYF_MPSAFE | AS(mlockall_args), (sy_call_t *)mlockall, AUE_NULL }, /* 324 = mlockall */
- { SYF_MPSAFE | 0, (sy_call_t *)munlockall, AUE_NULL }, /* 325 = munlockall */
- { SYF_MPSAFE | AS(__getcwd_args), (sy_call_t *)__getcwd, AUE_NULL }, /* 326 = __getcwd */
- { SYF_MPSAFE | AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_NULL }, /* 327 = sched_setparam */
- { SYF_MPSAFE | AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_NULL }, /* 328 = sched_getparam */
- { SYF_MPSAFE | AS(sched_setscheduler_args), (sy_call_t *)sched_setscheduler, AUE_NULL }, /* 329 = sched_setscheduler */
- { SYF_MPSAFE | AS(sched_getscheduler_args), (sy_call_t *)sched_getscheduler, AUE_NULL }, /* 330 = sched_getscheduler */
- { SYF_MPSAFE | 0, (sy_call_t *)sched_yield, AUE_NULL }, /* 331 = sched_yield */
- { SYF_MPSAFE | AS(sched_get_priority_max_args), (sy_call_t *)sched_get_priority_max, AUE_NULL }, /* 332 = sched_get_priority_max */
- { SYF_MPSAFE | AS(sched_get_priority_min_args), (sy_call_t *)sched_get_priority_min, AUE_NULL }, /* 333 = sched_get_priority_min */
- { SYF_MPSAFE | AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_NULL }, /* 334 = sched_rr_get_interval */
- { SYF_MPSAFE | AS(utrace_args), (sy_call_t *)utrace, AUE_NULL }, /* 335 = utrace */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_NULL }, /* 336 = old freebsd32_sendfile */
- { SYF_MPSAFE | AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL }, /* 337 = kldsym */
- { SYF_MPSAFE | AS(jail_args), (sy_call_t *)jail, AUE_NULL }, /* 338 = jail */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 339 = pioctl */
- { SYF_MPSAFE | AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_NULL }, /* 340 = sigprocmask */
- { SYF_MPSAFE | AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_NULL }, /* 341 = sigsuspend */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_sigaction_args),freebsd32_sigaction), AUE_NULL }, /* 342 = old freebsd32_sigaction */
- { SYF_MPSAFE | AS(sigpending_args), (sy_call_t *)sigpending, AUE_NULL }, /* 343 = sigpending */
- { compat4(SYF_MPSAFE | AS(freebsd4_freebsd32_sigreturn_args),freebsd32_sigreturn), AUE_NULL }, /* 344 = old freebsd32_sigreturn */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 345 = sigtimedwait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 346 = sigwaitinfo */
- { SYF_MPSAFE | AS(__acl_get_file_args), (sy_call_t *)__acl_get_file, AUE_NULL }, /* 347 = __acl_get_file */
- { SYF_MPSAFE | AS(__acl_set_file_args), (sy_call_t *)__acl_set_file, AUE_NULL }, /* 348 = __acl_set_file */
- { SYF_MPSAFE | AS(__acl_get_fd_args), (sy_call_t *)__acl_get_fd, AUE_NULL }, /* 349 = __acl_get_fd */
- { SYF_MPSAFE | AS(__acl_set_fd_args), (sy_call_t *)__acl_set_fd, AUE_NULL }, /* 350 = __acl_set_fd */
- { SYF_MPSAFE | AS(__acl_delete_file_args), (sy_call_t *)__acl_delete_file, AUE_NULL }, /* 351 = __acl_delete_file */
- { SYF_MPSAFE | AS(__acl_delete_fd_args), (sy_call_t *)__acl_delete_fd, AUE_NULL }, /* 352 = __acl_delete_fd */
- { SYF_MPSAFE | AS(__acl_aclcheck_file_args), (sy_call_t *)__acl_aclcheck_file, AUE_NULL }, /* 353 = __acl_aclcheck_file */
- { SYF_MPSAFE | AS(__acl_aclcheck_fd_args), (sy_call_t *)__acl_aclcheck_fd, AUE_NULL }, /* 354 = __acl_aclcheck_fd */
- { AS(extattrctl_args), (sy_call_t *)extattrctl, AUE_NULL }, /* 355 = extattrctl */
- { AS(extattr_set_file_args), (sy_call_t *)extattr_set_file, AUE_NULL }, /* 356 = extattr_set_file */
- { AS(extattr_get_file_args), (sy_call_t *)extattr_get_file, AUE_NULL }, /* 357 = extattr_get_file */
- { AS(extattr_delete_file_args), (sy_call_t *)extattr_delete_file, AUE_NULL }, /* 358 = extattr_delete_file */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 359 = aio_waitcomplete */
- { SYF_MPSAFE | AS(getresuid_args), (sy_call_t *)getresuid, AUE_NULL }, /* 360 = getresuid */
- { SYF_MPSAFE | AS(getresgid_args), (sy_call_t *)getresgid, AUE_NULL }, /* 361 = getresgid */
- { SYF_MPSAFE | 0, (sy_call_t *)kqueue, AUE_NULL }, /* 362 = kqueue */
- { SYF_MPSAFE | AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_NULL }, /* 363 = freebsd32_kevent */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 364 = __cap_get_proc */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 365 = __cap_set_proc */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 366 = __cap_get_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 367 = __cap_get_file */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 368 = __cap_set_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 369 = __cap_set_file */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 370 = lkmressys */
- { AS(extattr_set_fd_args), (sy_call_t *)extattr_set_fd, AUE_NULL }, /* 371 = extattr_set_fd */
- { AS(extattr_get_fd_args), (sy_call_t *)extattr_get_fd, AUE_NULL }, /* 372 = extattr_get_fd */
- { AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd, AUE_NULL }, /* 373 = extattr_delete_fd */
- { SYF_MPSAFE | AS(__setugid_args), (sy_call_t *)__setugid, AUE_NULL }, /* 374 = __setugid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 375 = nfsclnt */
- { SYF_MPSAFE | AS(eaccess_args), (sy_call_t *)eaccess, AUE_NULL }, /* 376 = eaccess */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 377 = afs_syscall */
- { AS(nmount_args), (sy_call_t *)nmount, AUE_NULL }, /* 378 = nmount */
- { SYF_MPSAFE | 0, (sy_call_t *)kse_exit, AUE_NULL }, /* 379 = kse_exit */
- { SYF_MPSAFE | AS(kse_wakeup_args), (sy_call_t *)kse_wakeup, AUE_NULL }, /* 380 = kse_wakeup */
- { SYF_MPSAFE | AS(kse_create_args), (sy_call_t *)kse_create, AUE_NULL }, /* 381 = kse_create */
- { SYF_MPSAFE | AS(kse_thr_interrupt_args), (sy_call_t *)kse_thr_interrupt, AUE_NULL }, /* 382 = kse_thr_interrupt */
- { SYF_MPSAFE | 0, (sy_call_t *)kse_release, AUE_NULL }, /* 383 = kse_release */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 384 = __mac_get_proc */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 385 = __mac_set_proc */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 386 = __mac_get_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 387 = __mac_get_file */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 388 = __mac_set_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 389 = __mac_set_file */
- { SYF_MPSAFE | AS(kenv_args), (sy_call_t *)kenv, AUE_NULL }, /* 390 = kenv */
- { SYF_MPSAFE | AS(lchflags_args), (sy_call_t *)lchflags, AUE_NULL }, /* 391 = lchflags */
- { SYF_MPSAFE | AS(uuidgen_args), (sy_call_t *)uuidgen, AUE_NULL }, /* 392 = uuidgen */
- { SYF_MPSAFE | AS(freebsd32_sendfile_args), (sy_call_t *)freebsd32_sendfile, AUE_NULL }, /* 393 = freebsd32_sendfile */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 394 = mac_syscall */
- { SYF_MPSAFE | AS(getfsstat_args), (sy_call_t *)getfsstat, AUE_NULL }, /* 395 = getfsstat */
- { SYF_MPSAFE | AS(statfs_args), (sy_call_t *)statfs, AUE_NULL }, /* 396 = statfs */
- { SYF_MPSAFE | AS(fstatfs_args), (sy_call_t *)fstatfs, AUE_NULL }, /* 397 = fstatfs */
- { SYF_MPSAFE | AS(fhstatfs_args), (sy_call_t *)fhstatfs, AUE_NULL }, /* 398 = fhstatfs */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 399 = nosys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 400 = ksem_close */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 401 = ksem_post */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 402 = ksem_wait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 403 = ksem_trywait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 404 = ksem_init */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 405 = ksem_open */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 406 = ksem_unlink */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 407 = ksem_getvalue */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 408 = ksem_destroy */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 409 = __mac_get_pid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 410 = __mac_get_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 411 = __mac_set_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 412 = extattr_set_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 413 = extattr_get_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 414 = extattr_delete_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 415 = __mac_execve */
- { SYF_MPSAFE | AS(freebsd32_sigaction_args), (sy_call_t *)freebsd32_sigaction, AUE_NULL }, /* 416 = freebsd32_sigaction */
- { SYF_MPSAFE | AS(freebsd32_sigreturn_args), (sy_call_t *)freebsd32_sigreturn, AUE_NULL }, /* 417 = freebsd32_sigreturn */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 418 = __xstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 419 = __xfstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 420 = __xlstat */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 421 = getcontext */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 422 = setcontext */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 423 = swapcontext */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 424 = swapoff */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 425 = __acl_get_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 426 = __acl_set_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 427 = __acl_delete_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 428 = __acl_aclcheck_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 429 = sigwait */
- { SYF_MPSAFE | AS(thr_create_args), (sy_call_t *)thr_create, AUE_NULL }, /* 430 = thr_create */
- { SYF_MPSAFE | AS(thr_exit_args), (sy_call_t *)thr_exit, AUE_NULL }, /* 431 = thr_exit */
- { SYF_MPSAFE | AS(thr_self_args), (sy_call_t *)thr_self, AUE_NULL }, /* 432 = thr_self */
- { SYF_MPSAFE | AS(thr_kill_args), (sy_call_t *)thr_kill, AUE_NULL }, /* 433 = thr_kill */
- { SYF_MPSAFE | AS(_umtx_lock_args), (sy_call_t *)_umtx_lock, AUE_NULL }, /* 434 = _umtx_lock */
- { SYF_MPSAFE | AS(_umtx_unlock_args), (sy_call_t *)_umtx_unlock, AUE_NULL }, /* 435 = _umtx_unlock */
- { SYF_MPSAFE | AS(jail_attach_args), (sy_call_t *)jail_attach, AUE_NULL }, /* 436 = jail_attach */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 437 = extattr_list_fd */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 438 = extattr_list_file */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 439 = extattr_list_link */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 440 = kse_switchin */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 441 = ksem_timedwait */
- { SYF_MPSAFE | AS(thr_suspend_args), (sy_call_t *)thr_suspend, AUE_NULL }, /* 442 = thr_suspend */
- { SYF_MPSAFE | AS(thr_wake_args), (sy_call_t *)thr_wake, AUE_NULL }, /* 443 = thr_wake */
- { SYF_MPSAFE | AS(kldunloadf_args), (sy_call_t *)kldunloadf, AUE_NULL }, /* 444 = kldunloadf */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 445 = audit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 446 = auditon */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 447 = getauid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 448 = setauid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 449 = getaudit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 450 = setaudit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 451 = getaudit_addr */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 452 = setaudit_addr */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 453 = auditctl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 454 = _umtx_op */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 0 = syscall */
+ { AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT, NULL, 0, 0 }, /* 1 = exit */
+ { 0, (sy_call_t *)fork, AUE_FORK, NULL, 0, 0 }, /* 2 = fork */
+ { AS(read_args), (sy_call_t *)read, AUE_READ, NULL, 0, 0 }, /* 3 = read */
+ { AS(write_args), (sy_call_t *)write, AUE_WRITE, NULL, 0, 0 }, /* 4 = write */
+ { AS(open_args), (sy_call_t *)open, AUE_OPEN_RWTC, NULL, 0, 0 }, /* 5 = open */
+ { AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0 }, /* 6 = close */
+ { AS(freebsd32_wait4_args), (sy_call_t *)freebsd32_wait4, AUE_WAIT4, NULL, 0, 0 }, /* 7 = freebsd32_wait4 */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 8 = obsolete old creat */
+ { AS(link_args), (sy_call_t *)link, AUE_LINK, NULL, 0, 0 }, /* 9 = link */
+ { AS(unlink_args), (sy_call_t *)unlink, AUE_UNLINK, NULL, 0, 0 }, /* 10 = unlink */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 11 = obsolete execv */
+ { AS(chdir_args), (sy_call_t *)chdir, AUE_CHDIR, NULL, 0, 0 }, /* 12 = chdir */
+ { AS(fchdir_args), (sy_call_t *)fchdir, AUE_FCHDIR, NULL, 0, 0 }, /* 13 = fchdir */
+ { AS(mknod_args), (sy_call_t *)mknod, AUE_MKNOD, NULL, 0, 0 }, /* 14 = mknod */
+ { AS(chmod_args), (sy_call_t *)chmod, AUE_CHMOD, NULL, 0, 0 }, /* 15 = chmod */
+ { AS(chown_args), (sy_call_t *)chown, AUE_CHOWN, NULL, 0, 0 }, /* 16 = chown */
+ { AS(obreak_args), (sy_call_t *)obreak, AUE_NULL, NULL, 0, 0 }, /* 17 = break */
+ { compat4(AS(freebsd4_freebsd32_getfsstat_args),freebsd32_getfsstat), AUE_GETFSSTAT, NULL, 0, 0 }, /* 18 = old freebsd32_getfsstat */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 19 = obsolete olseek */
+ { 0, (sy_call_t *)getpid, AUE_GETPID, NULL, 0, 0 }, /* 20 = getpid */
+ { AS(mount_args), (sy_call_t *)mount, AUE_MOUNT, NULL, 0, 0 }, /* 21 = mount */
+ { AS(unmount_args), (sy_call_t *)unmount, AUE_UMOUNT, NULL, 0, 0 }, /* 22 = unmount */
+ { AS(setuid_args), (sy_call_t *)setuid, AUE_SETUID, NULL, 0, 0 }, /* 23 = setuid */
+ { 0, (sy_call_t *)getuid, AUE_GETUID, NULL, 0, 0 }, /* 24 = getuid */
+ { 0, (sy_call_t *)geteuid, AUE_GETEUID, NULL, 0, 0 }, /* 25 = geteuid */
+ { AS(ptrace_args), (sy_call_t *)ptrace, AUE_PTRACE, NULL, 0, 0 }, /* 26 = ptrace */
+ { AS(freebsd32_recvmsg_args), (sy_call_t *)freebsd32_recvmsg, AUE_RECVMSG, NULL, 0, 0 }, /* 27 = freebsd32_recvmsg */
+ { AS(freebsd32_sendmsg_args), (sy_call_t *)freebsd32_sendmsg, AUE_SENDMSG, NULL, 0, 0 }, /* 28 = freebsd32_sendmsg */
+ { AS(freebsd32_recvfrom_args), (sy_call_t *)freebsd32_recvfrom, AUE_RECVFROM, NULL, 0, 0 }, /* 29 = freebsd32_recvfrom */
+ { AS(accept_args), (sy_call_t *)accept, AUE_ACCEPT, NULL, 0, 0 }, /* 30 = accept */
+ { AS(getpeername_args), (sy_call_t *)getpeername, AUE_GETPEERNAME, NULL, 0, 0 }, /* 31 = getpeername */
+ { AS(getsockname_args), (sy_call_t *)getsockname, AUE_GETSOCKNAME, NULL, 0, 0 }, /* 32 = getsockname */
+ { AS(access_args), (sy_call_t *)access, AUE_ACCESS, NULL, 0, 0 }, /* 33 = access */
+ { AS(chflags_args), (sy_call_t *)chflags, AUE_CHFLAGS, NULL, 0, 0 }, /* 34 = chflags */
+ { AS(fchflags_args), (sy_call_t *)fchflags, AUE_FCHFLAGS, NULL, 0, 0 }, /* 35 = fchflags */
+ { 0, (sy_call_t *)sync, AUE_SYNC, NULL, 0, 0 }, /* 36 = sync */
+ { AS(kill_args), (sy_call_t *)kill, AUE_KILL, NULL, 0, 0 }, /* 37 = kill */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 38 = ostat */
+ { 0, (sy_call_t *)getppid, AUE_GETPPID, NULL, 0, 0 }, /* 39 = getppid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 40 = olstat */
+ { AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 }, /* 41 = dup */
+ { 0, (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 }, /* 42 = pipe */
+ { 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 }, /* 43 = getegid */
+ { AS(profil_args), (sy_call_t *)profil, AUE_PROFILE, NULL, 0, 0 }, /* 44 = profil */
+ { AS(ktrace_args), (sy_call_t *)ktrace, AUE_KTRACE, NULL, 0, 0 }, /* 45 = ktrace */
+ { compat(AS(ofreebsd32_sigaction_args),freebsd32_sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 46 = old freebsd32_sigaction */
+ { 0, (sy_call_t *)getgid, AUE_GETGID, NULL, 0, 0 }, /* 47 = getgid */
+ { compat(AS(ofreebsd32_sigprocmask_args),freebsd32_sigprocmask), AUE_SIGPROCMASK, NULL, 0, 0 }, /* 48 = old freebsd32_sigprocmask */
+ { AS(getlogin_args), (sy_call_t *)getlogin, AUE_GETLOGIN, NULL, 0, 0 }, /* 49 = getlogin */
+ { AS(setlogin_args), (sy_call_t *)setlogin, AUE_SETLOGIN, NULL, 0, 0 }, /* 50 = setlogin */
+ { AS(acct_args), (sy_call_t *)acct, AUE_ACCT, NULL, 0, 0 }, /* 51 = acct */
+ { compat(0,freebsd32_sigpending), AUE_SIGPENDING, NULL, 0, 0 }, /* 52 = old freebsd32_sigpending */
+ { AS(freebsd32_sigaltstack_args), (sy_call_t *)freebsd32_sigaltstack, AUE_SIGALTSTACK, NULL, 0, 0 }, /* 53 = freebsd32_sigaltstack */
+ { AS(ioctl_args), (sy_call_t *)ioctl, AUE_IOCTL, NULL, 0, 0 }, /* 54 = ioctl */
+ { AS(reboot_args), (sy_call_t *)reboot, AUE_REBOOT, NULL, 0, 0 }, /* 55 = reboot */
+ { AS(revoke_args), (sy_call_t *)revoke, AUE_REVOKE, NULL, 0, 0 }, /* 56 = revoke */
+ { AS(symlink_args), (sy_call_t *)symlink, AUE_SYMLINK, NULL, 0, 0 }, /* 57 = symlink */
+ { AS(readlink_args), (sy_call_t *)readlink, AUE_READLINK, NULL, 0, 0 }, /* 58 = readlink */
+ { AS(freebsd32_execve_args), (sy_call_t *)freebsd32_execve, AUE_EXECVE, NULL, 0, 0 }, /* 59 = freebsd32_execve */
+ { AS(umask_args), (sy_call_t *)umask, AUE_UMASK, NULL, 0, 0 }, /* 60 = umask */
+ { AS(chroot_args), (sy_call_t *)chroot, AUE_CHROOT, NULL, 0, 0 }, /* 61 = chroot */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 62 = obsolete ofstat */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 63 = obsolete ogetkerninfo */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 64 = obsolete ogetpagesize */
+ { AS(msync_args), (sy_call_t *)msync, AUE_MSYNC, NULL, 0, 0 }, /* 65 = msync */
+ { 0, (sy_call_t *)vfork, AUE_VFORK, NULL, 0, 0 }, /* 66 = vfork */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 67 = obsolete vread */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 68 = obsolete vwrite */
+ { AS(sbrk_args), (sy_call_t *)sbrk, AUE_SBRK, NULL, 0, 0 }, /* 69 = sbrk */
+ { AS(sstk_args), (sy_call_t *)sstk, AUE_SSTK, NULL, 0, 0 }, /* 70 = sstk */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 71 = obsolete ommap */
+ { AS(ovadvise_args), (sy_call_t *)ovadvise, AUE_O_VADVISE, NULL, 0, 0 }, /* 72 = vadvise */
+ { AS(munmap_args), (sy_call_t *)munmap, AUE_MUNMAP, NULL, 0, 0 }, /* 73 = munmap */
+ { AS(mprotect_args), (sy_call_t *)mprotect, AUE_MPROTECT, NULL, 0, 0 }, /* 74 = mprotect */
+ { AS(madvise_args), (sy_call_t *)madvise, AUE_MADVISE, NULL, 0, 0 }, /* 75 = madvise */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 76 = obsolete vhangup */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 77 = obsolete vlimit */
+ { AS(mincore_args), (sy_call_t *)mincore, AUE_MINCORE, NULL, 0, 0 }, /* 78 = mincore */
+ { AS(getgroups_args), (sy_call_t *)getgroups, AUE_GETGROUPS, NULL, 0, 0 }, /* 79 = getgroups */
+ { AS(setgroups_args), (sy_call_t *)setgroups, AUE_SETGROUPS, NULL, 0, 0 }, /* 80 = setgroups */
+ { 0, (sy_call_t *)getpgrp, AUE_GETPGRP, NULL, 0, 0 }, /* 81 = getpgrp */
+ { AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP, NULL, 0, 0 }, /* 82 = setpgid */
+ { AS(freebsd32_setitimer_args), (sy_call_t *)freebsd32_setitimer, AUE_SETITIMER, NULL, 0, 0 }, /* 83 = freebsd32_setitimer */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 84 = obsolete owait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 85 = obsolete oswapon */
+ { AS(freebsd32_getitimer_args), (sy_call_t *)freebsd32_getitimer, AUE_GETITIMER, NULL, 0, 0 }, /* 86 = freebsd32_getitimer */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 87 = obsolete ogethostname */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 88 = obsolete osethostname */
+ { 0, (sy_call_t *)getdtablesize, AUE_GETDTABLESIZE, NULL, 0, 0 }, /* 89 = getdtablesize */
+ { AS(dup2_args), (sy_call_t *)dup2, AUE_DUP2, NULL, 0, 0 }, /* 90 = dup2 */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 91 = getdopt */
+ { AS(fcntl_args), (sy_call_t *)fcntl, AUE_FCNTL, NULL, 0, 0 }, /* 92 = fcntl */
+ { AS(freebsd32_select_args), (sy_call_t *)freebsd32_select, AUE_SELECT, NULL, 0, 0 }, /* 93 = freebsd32_select */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 94 = setdopt */
+ { AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC, NULL, 0, 0 }, /* 95 = fsync */
+ { AS(setpriority_args), (sy_call_t *)setpriority, AUE_SETPRIORITY, NULL, 0, 0 }, /* 96 = setpriority */
+ { AS(socket_args), (sy_call_t *)socket, AUE_SOCKET, NULL, 0, 0 }, /* 97 = socket */
+ { AS(connect_args), (sy_call_t *)connect, AUE_CONNECT, NULL, 0, 0 }, /* 98 = connect */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 99 = obsolete oaccept */
+ { AS(getpriority_args), (sy_call_t *)getpriority, AUE_GETPRIORITY, NULL, 0, 0 }, /* 100 = getpriority */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 101 = obsolete osend */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 102 = obsolete orecv */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 103 = obsolete osigreturn */
+ { AS(bind_args), (sy_call_t *)bind, AUE_BIND, NULL, 0, 0 }, /* 104 = bind */
+ { AS(setsockopt_args), (sy_call_t *)setsockopt, AUE_SETSOCKOPT, NULL, 0, 0 }, /* 105 = setsockopt */
+ { AS(listen_args), (sy_call_t *)listen, AUE_LISTEN, NULL, 0, 0 }, /* 106 = listen */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 107 = obsolete vtimes */
+ { compat(AS(ofreebsd32_sigvec_args),freebsd32_sigvec), AUE_O_SIGVEC, NULL, 0, 0 }, /* 108 = old freebsd32_sigvec */
+ { compat(AS(ofreebsd32_sigblock_args),freebsd32_sigblock), AUE_O_SIGBLOCK, NULL, 0, 0 }, /* 109 = old freebsd32_sigblock */
+ { compat(AS(ofreebsd32_sigsetmask_args),freebsd32_sigsetmask), AUE_O_SIGSETMASK, NULL, 0, 0 }, /* 110 = old freebsd32_sigsetmask */
+ { compat(AS(ofreebsd32_sigsuspend_args),freebsd32_sigsuspend), AUE_SIGSUSPEND, NULL, 0, 0 }, /* 111 = old freebsd32_sigsuspend */
+ { compat(AS(ofreebsd32_sigstack_args),freebsd32_sigstack), AUE_O_SIGSTACK, NULL, 0, 0 }, /* 112 = old freebsd32_sigstack */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 113 = obsolete orecvmsg */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 114 = obsolete osendmsg */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 115 = obsolete vtrace */
+ { AS(freebsd32_gettimeofday_args), (sy_call_t *)freebsd32_gettimeofday, AUE_GETTIMEOFDAY, NULL, 0, 0 }, /* 116 = freebsd32_gettimeofday */
+ { AS(freebsd32_getrusage_args), (sy_call_t *)freebsd32_getrusage, AUE_GETRUSAGE, NULL, 0, 0 }, /* 117 = freebsd32_getrusage */
+ { AS(getsockopt_args), (sy_call_t *)getsockopt, AUE_GETSOCKOPT, NULL, 0, 0 }, /* 118 = getsockopt */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 119 = resuba */
+ { AS(freebsd32_readv_args), (sy_call_t *)freebsd32_readv, AUE_READV, NULL, 0, 0 }, /* 120 = freebsd32_readv */
+ { AS(freebsd32_writev_args), (sy_call_t *)freebsd32_writev, AUE_WRITEV, NULL, 0, 0 }, /* 121 = freebsd32_writev */
+ { AS(freebsd32_settimeofday_args), (sy_call_t *)freebsd32_settimeofday, AUE_SETTIMEOFDAY, NULL, 0, 0 }, /* 122 = freebsd32_settimeofday */
+ { AS(fchown_args), (sy_call_t *)fchown, AUE_FCHOWN, NULL, 0, 0 }, /* 123 = fchown */
+ { AS(fchmod_args), (sy_call_t *)fchmod, AUE_FCHMOD, NULL, 0, 0 }, /* 124 = fchmod */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 125 = obsolete orecvfrom */
+ { AS(setreuid_args), (sy_call_t *)setreuid, AUE_SETREUID, NULL, 0, 0 }, /* 126 = setreuid */
+ { AS(setregid_args), (sy_call_t *)setregid, AUE_SETREGID, NULL, 0, 0 }, /* 127 = setregid */
+ { AS(rename_args), (sy_call_t *)rename, AUE_RENAME, NULL, 0, 0 }, /* 128 = rename */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 129 = obsolete otruncate */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 130 = obsolete ftruncate */
+ { AS(flock_args), (sy_call_t *)flock, AUE_FLOCK, NULL, 0, 0 }, /* 131 = flock */
+ { AS(mkfifo_args), (sy_call_t *)mkfifo, AUE_MKFIFO, NULL, 0, 0 }, /* 132 = mkfifo */
+ { AS(sendto_args), (sy_call_t *)sendto, AUE_SENDTO, NULL, 0, 0 }, /* 133 = sendto */
+ { AS(shutdown_args), (sy_call_t *)shutdown, AUE_SHUTDOWN, NULL, 0, 0 }, /* 134 = shutdown */
+ { AS(socketpair_args), (sy_call_t *)socketpair, AUE_SOCKETPAIR, NULL, 0, 0 }, /* 135 = socketpair */
+ { AS(mkdir_args), (sy_call_t *)mkdir, AUE_MKDIR, NULL, 0, 0 }, /* 136 = mkdir */
+ { AS(rmdir_args), (sy_call_t *)rmdir, AUE_RMDIR, NULL, 0, 0 }, /* 137 = rmdir */
+ { AS(freebsd32_utimes_args), (sy_call_t *)freebsd32_utimes, AUE_UTIMES, NULL, 0, 0 }, /* 138 = freebsd32_utimes */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 139 = obsolete 4.2 sigreturn */
+ { AS(freebsd32_adjtime_args), (sy_call_t *)freebsd32_adjtime, AUE_ADJTIME, NULL, 0, 0 }, /* 140 = freebsd32_adjtime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 141 = obsolete ogetpeername */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 142 = obsolete ogethostid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 143 = obsolete sethostid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 144 = obsolete getrlimit */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 145 = obsolete setrlimit */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 146 = obsolete killpg */
+ { 0, (sy_call_t *)setsid, AUE_SETSID, NULL, 0, 0 }, /* 147 = setsid */
+ { AS(quotactl_args), (sy_call_t *)quotactl, AUE_QUOTACTL, NULL, 0, 0 }, /* 148 = quotactl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 149 = obsolete oquota */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 150 = obsolete ogetsockname */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 151 = sem_lock */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 152 = sem_wakeup */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 153 = asyncdaemon */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 154 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 155 = nfssvc */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 156 = obsolete ogetdirentries */
+ { compat4(AS(freebsd4_freebsd32_statfs_args),freebsd32_statfs), AUE_STATFS, NULL, 0, 0 }, /* 157 = old freebsd32_statfs */
+ { compat4(AS(freebsd4_freebsd32_fstatfs_args),freebsd32_fstatfs), AUE_FSTATFS, NULL, 0, 0 }, /* 158 = old freebsd32_fstatfs */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 159 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 160 = lgetfh */
+ { AS(getfh_args), (sy_call_t *)getfh, AUE_NFS_GETFH, NULL, 0, 0 }, /* 161 = getfh */
+ { AS(getdomainname_args), (sy_call_t *)getdomainname, AUE_SYSCTL, NULL, 0, 0 }, /* 162 = getdomainname */
+ { AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_SYSCTL, NULL, 0, 0 }, /* 163 = setdomainname */
+ { AS(uname_args), (sy_call_t *)uname, AUE_NULL, NULL, 0, 0 }, /* 164 = uname */
+ { AS(sysarch_args), (sy_call_t *)sysarch, AUE_SYSARCH, NULL, 0, 0 }, /* 165 = sysarch */
+ { AS(rtprio_args), (sy_call_t *)rtprio, AUE_RTPRIO, NULL, 0, 0 }, /* 166 = rtprio */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 167 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 168 = nosys */
+ { AS(freebsd32_semsys_args), (sy_call_t *)freebsd32_semsys, AUE_SEMSYS, NULL, 0, 0 }, /* 169 = freebsd32_semsys */
+ { AS(freebsd32_msgsys_args), (sy_call_t *)freebsd32_msgsys, AUE_MSGSYS, NULL, 0, 0 }, /* 170 = freebsd32_msgsys */
+ { AS(freebsd32_shmsys_args), (sy_call_t *)freebsd32_shmsys, AUE_SHMSYS, NULL, 0, 0 }, /* 171 = freebsd32_shmsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 172 = nosys */
+ { compat6(AS(freebsd6_freebsd32_pread_args),freebsd32_pread), AUE_PREAD, NULL, 0, 0 }, /* 173 = old freebsd32_pread */
+ { compat6(AS(freebsd6_freebsd32_pwrite_args),freebsd32_pwrite), AUE_PWRITE, NULL, 0, 0 }, /* 174 = old freebsd32_pwrite */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 175 = nosys */
+ { AS(ntp_adjtime_args), (sy_call_t *)ntp_adjtime, AUE_NTP_ADJTIME, NULL, 0, 0 }, /* 176 = ntp_adjtime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 177 = sfork */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 178 = getdescriptor */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 179 = setdescriptor */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 180 = nosys */
+ { AS(setgid_args), (sy_call_t *)setgid, AUE_SETGID, NULL, 0, 0 }, /* 181 = setgid */
+ { AS(setegid_args), (sy_call_t *)setegid, AUE_SETEGID, NULL, 0, 0 }, /* 182 = setegid */
+ { AS(seteuid_args), (sy_call_t *)seteuid, AUE_SETEUID, NULL, 0, 0 }, /* 183 = seteuid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 184 = lfs_bmapv */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 185 = lfs_markv */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 186 = lfs_segclean */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 187 = lfs_segwait */
+ { AS(freebsd32_stat_args), (sy_call_t *)freebsd32_stat, AUE_STAT, NULL, 0, 0 }, /* 188 = freebsd32_stat */
+ { AS(freebsd32_fstat_args), (sy_call_t *)freebsd32_fstat, AUE_FSTAT, NULL, 0, 0 }, /* 189 = freebsd32_fstat */
+ { AS(freebsd32_lstat_args), (sy_call_t *)freebsd32_lstat, AUE_LSTAT, NULL, 0, 0 }, /* 190 = freebsd32_lstat */
+ { AS(pathconf_args), (sy_call_t *)pathconf, AUE_PATHCONF, NULL, 0, 0 }, /* 191 = pathconf */
+ { AS(fpathconf_args), (sy_call_t *)fpathconf, AUE_FPATHCONF, NULL, 0, 0 }, /* 192 = fpathconf */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 193 = nosys */
+ { AS(__getrlimit_args), (sy_call_t *)getrlimit, AUE_GETRLIMIT, NULL, 0, 0 }, /* 194 = getrlimit */
+ { AS(__setrlimit_args), (sy_call_t *)setrlimit, AUE_SETRLIMIT, NULL, 0, 0 }, /* 195 = setrlimit */
+ { AS(getdirentries_args), (sy_call_t *)getdirentries, AUE_GETDIRENTRIES, NULL, 0, 0 }, /* 196 = getdirentries */
+ { compat6(AS(freebsd6_freebsd32_mmap_args),freebsd32_mmap), AUE_MMAP, NULL, 0, 0 }, /* 197 = old freebsd32_mmap */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 198 = __syscall */
+ { compat6(AS(freebsd6_freebsd32_lseek_args),freebsd32_lseek), AUE_LSEEK, NULL, 0, 0 }, /* 199 = old freebsd32_lseek */
+ { compat6(AS(freebsd6_freebsd32_truncate_args),freebsd32_truncate), AUE_TRUNCATE, NULL, 0, 0 }, /* 200 = old freebsd32_truncate */
+ { compat6(AS(freebsd6_freebsd32_ftruncate_args),freebsd32_ftruncate), AUE_FTRUNCATE, NULL, 0, 0 }, /* 201 = old freebsd32_ftruncate */
+ { AS(freebsd32_sysctl_args), (sy_call_t *)freebsd32_sysctl, AUE_SYSCTL, NULL, 0, 0 }, /* 202 = freebsd32_sysctl */
+ { AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK, NULL, 0, 0 }, /* 203 = mlock */
+ { AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK, NULL, 0, 0 }, /* 204 = munlock */
+ { AS(undelete_args), (sy_call_t *)undelete, AUE_UNDELETE, NULL, 0, 0 }, /* 205 = undelete */
+ { AS(freebsd32_futimes_args), (sy_call_t *)freebsd32_futimes, AUE_FUTIMES, NULL, 0, 0 }, /* 206 = freebsd32_futimes */
+ { AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID, NULL, 0, 0 }, /* 207 = getpgid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 208 = newreboot */
+ { AS(poll_args), (sy_call_t *)poll, AUE_POLL, NULL, 0, 0 }, /* 209 = poll */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 210 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 211 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 212 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 213 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 214 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 215 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 216 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 217 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 218 = */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 219 = */
+ { AS(freebsd32_semctl_args), (sy_call_t *)freebsd32_semctl, AUE_SEMCTL, NULL, 0, 0 }, /* 220 = freebsd32_semctl */
+ { AS(semget_args), (sy_call_t *)semget, AUE_SEMGET, NULL, 0, 0 }, /* 221 = semget */
+ { AS(semop_args), (sy_call_t *)semop, AUE_SEMOP, NULL, 0, 0 }, /* 222 = semop */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 223 = semconfig */
+ { AS(freebsd32_msgctl_args), (sy_call_t *)freebsd32_msgctl, AUE_MSGCTL, NULL, 0, 0 }, /* 224 = freebsd32_msgctl */
+ { AS(msgget_args), (sy_call_t *)msgget, AUE_MSGGET, NULL, 0, 0 }, /* 225 = msgget */
+ { AS(freebsd32_msgsnd_args), (sy_call_t *)freebsd32_msgsnd, AUE_MSGSND, NULL, 0, 0 }, /* 226 = freebsd32_msgsnd */
+ { AS(freebsd32_msgrcv_args), (sy_call_t *)freebsd32_msgrcv, AUE_MSGRCV, NULL, 0, 0 }, /* 227 = freebsd32_msgrcv */
+ { AS(shmat_args), (sy_call_t *)shmat, AUE_SHMAT, NULL, 0, 0 }, /* 228 = shmat */
+ { AS(freebsd32_shmctl_args), (sy_call_t *)freebsd32_shmctl, AUE_SHMCTL, NULL, 0, 0 }, /* 229 = freebsd32_shmctl */
+ { AS(shmdt_args), (sy_call_t *)shmdt, AUE_SHMDT, NULL, 0, 0 }, /* 230 = shmdt */
+ { AS(shmget_args), (sy_call_t *)shmget, AUE_SHMGET, NULL, 0, 0 }, /* 231 = shmget */
+ { AS(freebsd32_clock_gettime_args), (sy_call_t *)freebsd32_clock_gettime, AUE_NULL, NULL, 0, 0 }, /* 232 = freebsd32_clock_gettime */
+ { AS(freebsd32_clock_settime_args), (sy_call_t *)freebsd32_clock_settime, AUE_CLOCK_SETTIME, NULL, 0, 0 }, /* 233 = freebsd32_clock_settime */
+ { AS(freebsd32_clock_getres_args), (sy_call_t *)freebsd32_clock_getres, AUE_NULL, NULL, 0, 0 }, /* 234 = freebsd32_clock_getres */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 235 = timer_create */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 236 = timer_delete */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 237 = timer_settime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 238 = timer_gettime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 239 = timer_getoverrun */
+ { AS(freebsd32_nanosleep_args), (sy_call_t *)freebsd32_nanosleep, AUE_NULL, NULL, 0, 0 }, /* 240 = freebsd32_nanosleep */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 241 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 242 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 243 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 244 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 245 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 246 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 247 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 248 = ntp_gettime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 249 = nosys */
+ { AS(minherit_args), (sy_call_t *)minherit, AUE_MINHERIT, NULL, 0, 0 }, /* 250 = minherit */
+ { AS(rfork_args), (sy_call_t *)rfork, AUE_RFORK, NULL, 0, 0 }, /* 251 = rfork */
+ { AS(openbsd_poll_args), (sy_call_t *)openbsd_poll, AUE_POLL, NULL, 0, 0 }, /* 252 = openbsd_poll */
+ { 0, (sy_call_t *)issetugid, AUE_ISSETUGID, NULL, 0, 0 }, /* 253 = issetugid */
+ { AS(lchown_args), (sy_call_t *)lchown, AUE_LCHOWN, NULL, 0, 0 }, /* 254 = lchown */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 255 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 256 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 257 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 258 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 259 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 260 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 261 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 262 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 263 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 264 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 265 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 266 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 267 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 268 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 269 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 270 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 271 = nosys */
+ { AS(getdents_args), (sy_call_t *)getdents, AUE_O_GETDENTS, NULL, 0, 0 }, /* 272 = getdents */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 273 = nosys */
+ { AS(lchmod_args), (sy_call_t *)lchmod, AUE_LCHMOD, NULL, 0, 0 }, /* 274 = lchmod */
+ { AS(lchown_args), (sy_call_t *)lchown, AUE_LCHOWN, NULL, 0, 0 }, /* 275 = netbsd_lchown */
+ { AS(freebsd32_lutimes_args), (sy_call_t *)freebsd32_lutimes, AUE_LUTIMES, NULL, 0, 0 }, /* 276 = freebsd32_lutimes */
+ { AS(msync_args), (sy_call_t *)msync, AUE_MSYNC, NULL, 0, 0 }, /* 277 = netbsd_msync */
+ { AS(nstat_args), (sy_call_t *)nstat, AUE_STAT, NULL, 0, 0 }, /* 278 = nstat */
+ { AS(nfstat_args), (sy_call_t *)nfstat, AUE_FSTAT, NULL, 0, 0 }, /* 279 = nfstat */
+ { AS(nlstat_args), (sy_call_t *)nlstat, AUE_LSTAT, NULL, 0, 0 }, /* 280 = nlstat */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 281 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 282 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 283 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 284 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 285 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 286 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 287 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 288 = nosys */
+ { AS(freebsd32_preadv_args), (sy_call_t *)freebsd32_preadv, AUE_PREADV, NULL, 0, 0 }, /* 289 = freebsd32_preadv */
+ { AS(freebsd32_pwritev_args), (sy_call_t *)freebsd32_pwritev, AUE_PWRITEV, NULL, 0, 0 }, /* 290 = freebsd32_pwritev */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 291 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 292 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 293 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 294 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 295 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 296 = nosys */
+ { compat4(AS(freebsd4_freebsd32_fhstatfs_args),freebsd32_fhstatfs), AUE_FHSTATFS, NULL, 0, 0 }, /* 297 = old freebsd32_fhstatfs */
+ { AS(fhopen_args), (sy_call_t *)fhopen, AUE_FHOPEN, NULL, 0, 0 }, /* 298 = fhopen */
+ { AS(fhstat_args), (sy_call_t *)fhstat, AUE_FHSTAT, NULL, 0, 0 }, /* 299 = fhstat */
+ { AS(modnext_args), (sy_call_t *)modnext, AUE_NULL, NULL, 0, 0 }, /* 300 = modnext */
+ { AS(freebsd32_modstat_args), (sy_call_t *)freebsd32_modstat, AUE_NULL, NULL, 0, 0 }, /* 301 = freebsd32_modstat */
+ { AS(modfnext_args), (sy_call_t *)modfnext, AUE_NULL, NULL, 0, 0 }, /* 302 = modfnext */
+ { AS(modfind_args), (sy_call_t *)modfind, AUE_NULL, NULL, 0, 0 }, /* 303 = modfind */
+ { AS(kldload_args), (sy_call_t *)kldload, AUE_MODLOAD, NULL, 0, 0 }, /* 304 = kldload */
+ { AS(kldunload_args), (sy_call_t *)kldunload, AUE_MODUNLOAD, NULL, 0, 0 }, /* 305 = kldunload */
+ { AS(kldfind_args), (sy_call_t *)kldfind, AUE_NULL, NULL, 0, 0 }, /* 306 = kldfind */
+ { AS(kldnext_args), (sy_call_t *)kldnext, AUE_NULL, NULL, 0, 0 }, /* 307 = kldnext */
+ { AS(kldstat_args), (sy_call_t *)kldstat, AUE_NULL, NULL, 0, 0 }, /* 308 = kldstat */
+ { AS(kldfirstmod_args), (sy_call_t *)kldfirstmod, AUE_NULL, NULL, 0, 0 }, /* 309 = kldfirstmod */
+ { AS(getsid_args), (sy_call_t *)getsid, AUE_GETSID, NULL, 0, 0 }, /* 310 = getsid */
+ { AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID, NULL, 0, 0 }, /* 311 = setresuid */
+ { AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID, NULL, 0, 0 }, /* 312 = setresgid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 313 = obsolete signanosleep */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 314 = aio_return */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 315 = aio_suspend */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 316 = aio_cancel */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 317 = aio_error */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 318 = aio_read */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 319 = aio_write */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 320 = lio_listio */
+ { 0, (sy_call_t *)yield, AUE_NULL, NULL, 0, 0 }, /* 321 = yield */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 322 = obsolete thr_sleep */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 323 = obsolete thr_wakeup */
+ { AS(mlockall_args), (sy_call_t *)mlockall, AUE_MLOCKALL, NULL, 0, 0 }, /* 324 = mlockall */
+ { 0, (sy_call_t *)munlockall, AUE_MUNLOCKALL, NULL, 0, 0 }, /* 325 = munlockall */
+ { AS(__getcwd_args), (sy_call_t *)__getcwd, AUE_GETCWD, NULL, 0, 0 }, /* 326 = __getcwd */
+ { AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_NULL, NULL, 0, 0 }, /* 327 = sched_setparam */
+ { AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_NULL, NULL, 0, 0 }, /* 328 = sched_getparam */
+ { AS(sched_setscheduler_args), (sy_call_t *)sched_setscheduler, AUE_NULL, NULL, 0, 0 }, /* 329 = sched_setscheduler */
+ { AS(sched_getscheduler_args), (sy_call_t *)sched_getscheduler, AUE_NULL, NULL, 0, 0 }, /* 330 = sched_getscheduler */
+ { 0, (sy_call_t *)sched_yield, AUE_NULL, NULL, 0, 0 }, /* 331 = sched_yield */
+ { AS(sched_get_priority_max_args), (sy_call_t *)sched_get_priority_max, AUE_NULL, NULL, 0, 0 }, /* 332 = sched_get_priority_max */
+ { AS(sched_get_priority_min_args), (sy_call_t *)sched_get_priority_min, AUE_NULL, NULL, 0, 0 }, /* 333 = sched_get_priority_min */
+ { AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_NULL, NULL, 0, 0 }, /* 334 = sched_rr_get_interval */
+ { AS(utrace_args), (sy_call_t *)utrace, AUE_NULL, NULL, 0, 0 }, /* 335 = utrace */
+ { compat4(AS(freebsd4_freebsd32_sendfile_args),freebsd32_sendfile), AUE_SENDFILE, NULL, 0, 0 }, /* 336 = old freebsd32_sendfile */
+ { AS(kldsym_args), (sy_call_t *)kldsym, AUE_NULL, NULL, 0, 0 }, /* 337 = kldsym */
+ { AS(jail_args), (sy_call_t *)jail, AUE_JAIL, NULL, 0, 0 }, /* 338 = jail */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 339 = pioctl */
+ { AS(sigprocmask_args), (sy_call_t *)sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 }, /* 340 = sigprocmask */
+ { AS(sigsuspend_args), (sy_call_t *)sigsuspend, AUE_SIGSUSPEND, NULL, 0, 0 }, /* 341 = sigsuspend */
+ { compat4(AS(freebsd4_freebsd32_sigaction_args),freebsd32_sigaction), AUE_SIGACTION, NULL, 0, 0 }, /* 342 = old freebsd32_sigaction */
+ { AS(sigpending_args), (sy_call_t *)sigpending, AUE_SIGPENDING, NULL, 0, 0 }, /* 343 = sigpending */
+ { compat4(AS(freebsd4_freebsd32_sigreturn_args),freebsd32_sigreturn), AUE_SIGRETURN, NULL, 0, 0 }, /* 344 = old freebsd32_sigreturn */
+ { AS(freebsd32_sigtimedwait_args), (sy_call_t *)freebsd32_sigtimedwait, AUE_SIGWAIT, NULL, 0, 0 }, /* 345 = freebsd32_sigtimedwait */
+ { AS(freebsd32_sigwaitinfo_args), (sy_call_t *)freebsd32_sigwaitinfo, AUE_NULL, NULL, 0, 0 }, /* 346 = freebsd32_sigwaitinfo */
+ { AS(__acl_get_file_args), (sy_call_t *)__acl_get_file, AUE_NULL, NULL, 0, 0 }, /* 347 = __acl_get_file */
+ { AS(__acl_set_file_args), (sy_call_t *)__acl_set_file, AUE_NULL, NULL, 0, 0 }, /* 348 = __acl_set_file */
+ { AS(__acl_get_fd_args), (sy_call_t *)__acl_get_fd, AUE_NULL, NULL, 0, 0 }, /* 349 = __acl_get_fd */
+ { AS(__acl_set_fd_args), (sy_call_t *)__acl_set_fd, AUE_NULL, NULL, 0, 0 }, /* 350 = __acl_set_fd */
+ { AS(__acl_delete_file_args), (sy_call_t *)__acl_delete_file, AUE_NULL, NULL, 0, 0 }, /* 351 = __acl_delete_file */
+ { AS(__acl_delete_fd_args), (sy_call_t *)__acl_delete_fd, AUE_NULL, NULL, 0, 0 }, /* 352 = __acl_delete_fd */
+ { AS(__acl_aclcheck_file_args), (sy_call_t *)__acl_aclcheck_file, AUE_NULL, NULL, 0, 0 }, /* 353 = __acl_aclcheck_file */
+ { AS(__acl_aclcheck_fd_args), (sy_call_t *)__acl_aclcheck_fd, AUE_NULL, NULL, 0, 0 }, /* 354 = __acl_aclcheck_fd */
+ { AS(extattrctl_args), (sy_call_t *)extattrctl, AUE_EXTATTRCTL, NULL, 0, 0 }, /* 355 = extattrctl */
+ { AS(extattr_set_file_args), (sy_call_t *)extattr_set_file, AUE_EXTATTR_SET_FILE, NULL, 0, 0 }, /* 356 = extattr_set_file */
+ { AS(extattr_get_file_args), (sy_call_t *)extattr_get_file, AUE_EXTATTR_GET_FILE, NULL, 0, 0 }, /* 357 = extattr_get_file */
+ { AS(extattr_delete_file_args), (sy_call_t *)extattr_delete_file, AUE_EXTATTR_DELETE_FILE, NULL, 0, 0 }, /* 358 = extattr_delete_file */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 359 = aio_waitcomplete */
+ { AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID, NULL, 0, 0 }, /* 360 = getresuid */
+ { AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID, NULL, 0, 0 }, /* 361 = getresgid */
+ { 0, (sy_call_t *)kqueue, AUE_KQUEUE, NULL, 0, 0 }, /* 362 = kqueue */
+ { AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_NULL, NULL, 0, 0 }, /* 363 = freebsd32_kevent */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 364 = __cap_get_proc */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 365 = __cap_set_proc */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 366 = __cap_get_fd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 367 = __cap_get_file */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 368 = __cap_set_fd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 369 = __cap_set_file */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 370 = lkmressys */
+ { AS(extattr_set_fd_args), (sy_call_t *)extattr_set_fd, AUE_EXTATTR_SET_FD, NULL, 0, 0 }, /* 371 = extattr_set_fd */
+ { AS(extattr_get_fd_args), (sy_call_t *)extattr_get_fd, AUE_EXTATTR_GET_FD, NULL, 0, 0 }, /* 372 = extattr_get_fd */
+ { AS(extattr_delete_fd_args), (sy_call_t *)extattr_delete_fd, AUE_EXTATTR_DELETE_FD, NULL, 0, 0 }, /* 373 = extattr_delete_fd */
+ { AS(__setugid_args), (sy_call_t *)__setugid, AUE_NULL, NULL, 0, 0 }, /* 374 = __setugid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 375 = nfsclnt */
+ { AS(eaccess_args), (sy_call_t *)eaccess, AUE_EACCESS, NULL, 0, 0 }, /* 376 = eaccess */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 377 = afs_syscall */
+ { AS(nmount_args), (sy_call_t *)nmount, AUE_NMOUNT, NULL, 0, 0 }, /* 378 = nmount */
+ { 0, (sy_call_t *)kse_exit, AUE_NULL, NULL, 0, 0 }, /* 379 = kse_exit */
+ { AS(kse_wakeup_args), (sy_call_t *)kse_wakeup, AUE_NULL, NULL, 0, 0 }, /* 380 = kse_wakeup */
+ { AS(kse_create_args), (sy_call_t *)kse_create, AUE_NULL, NULL, 0, 0 }, /* 381 = kse_create */
+ { AS(kse_thr_interrupt_args), (sy_call_t *)kse_thr_interrupt, AUE_NULL, NULL, 0, 0 }, /* 382 = kse_thr_interrupt */
+ { 0, (sy_call_t *)kse_release, AUE_NULL, NULL, 0, 0 }, /* 383 = kse_release */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 384 = __mac_get_proc */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 385 = __mac_set_proc */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 386 = __mac_get_fd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 387 = __mac_get_file */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 388 = __mac_set_fd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 389 = __mac_set_file */
+ { AS(kenv_args), (sy_call_t *)kenv, AUE_NULL, NULL, 0, 0 }, /* 390 = kenv */
+ { AS(lchflags_args), (sy_call_t *)lchflags, AUE_LCHFLAGS, NULL, 0, 0 }, /* 391 = lchflags */
+ { AS(uuidgen_args), (sy_call_t *)uuidgen, AUE_NULL, NULL, 0, 0 }, /* 392 = uuidgen */
+ { AS(freebsd32_sendfile_args), (sy_call_t *)freebsd32_sendfile, AUE_SENDFILE, NULL, 0, 0 }, /* 393 = freebsd32_sendfile */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 394 = mac_syscall */
+ { AS(getfsstat_args), (sy_call_t *)getfsstat, AUE_GETFSSTAT, NULL, 0, 0 }, /* 395 = getfsstat */
+ { AS(statfs_args), (sy_call_t *)statfs, AUE_STATFS, NULL, 0, 0 }, /* 396 = statfs */
+ { AS(fstatfs_args), (sy_call_t *)fstatfs, AUE_FSTATFS, NULL, 0, 0 }, /* 397 = fstatfs */
+ { AS(fhstatfs_args), (sy_call_t *)fhstatfs, AUE_FHSTATFS, NULL, 0, 0 }, /* 398 = fhstatfs */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 399 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 400 = ksem_close */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 401 = ksem_post */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 402 = ksem_wait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 403 = ksem_trywait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 404 = ksem_init */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 405 = ksem_open */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 406 = ksem_unlink */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 407 = ksem_getvalue */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 408 = ksem_destroy */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 409 = __mac_get_pid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 410 = __mac_get_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 411 = __mac_set_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 412 = extattr_set_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 413 = extattr_get_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 414 = extattr_delete_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 415 = __mac_execve */
+ { AS(freebsd32_sigaction_args), (sy_call_t *)freebsd32_sigaction, AUE_SIGACTION, NULL, 0, 0 }, /* 416 = freebsd32_sigaction */
+ { AS(freebsd32_sigreturn_args), (sy_call_t *)freebsd32_sigreturn, AUE_SIGRETURN, NULL, 0, 0 }, /* 417 = freebsd32_sigreturn */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 418 = __xstat */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 419 = __xfstat */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 420 = __xlstat */
+ { AS(freebsd32_getcontext_args), (sy_call_t *)freebsd32_getcontext, AUE_NULL, NULL, 0, 0 }, /* 421 = freebsd32_getcontext */
+ { AS(freebsd32_setcontext_args), (sy_call_t *)freebsd32_setcontext, AUE_NULL, NULL, 0, 0 }, /* 422 = freebsd32_setcontext */
+ { AS(freebsd32_swapcontext_args), (sy_call_t *)freebsd32_swapcontext, AUE_NULL, NULL, 0, 0 }, /* 423 = freebsd32_swapcontext */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 424 = swapoff */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 425 = __acl_get_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 426 = __acl_set_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 427 = __acl_delete_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 428 = __acl_aclcheck_link */
+ { AS(sigwait_args), (sy_call_t *)sigwait, AUE_SIGWAIT, NULL, 0, 0 }, /* 429 = sigwait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 430 = thr_create; */
+ { AS(thr_exit_args), (sy_call_t *)thr_exit, AUE_NULL, NULL, 0, 0 }, /* 431 = thr_exit */
+ { AS(thr_self_args), (sy_call_t *)thr_self, AUE_NULL, NULL, 0, 0 }, /* 432 = thr_self */
+ { AS(thr_kill_args), (sy_call_t *)thr_kill, AUE_NULL, NULL, 0, 0 }, /* 433 = thr_kill */
+ { AS(freebsd32_umtx_lock_args), (sy_call_t *)freebsd32_umtx_lock, AUE_NULL, NULL, 0, 0 }, /* 434 = freebsd32_umtx_lock */
+ { AS(freebsd32_umtx_unlock_args), (sy_call_t *)freebsd32_umtx_unlock, AUE_NULL, NULL, 0, 0 }, /* 435 = freebsd32_umtx_unlock */
+ { AS(jail_attach_args), (sy_call_t *)jail_attach, AUE_NULL, NULL, 0, 0 }, /* 436 = jail_attach */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 437 = extattr_list_fd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 438 = extattr_list_file */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 439 = extattr_list_link */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 440 = kse_switchin */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 441 = ksem_timedwait */
+ { AS(freebsd32_thr_suspend_args), (sy_call_t *)freebsd32_thr_suspend, AUE_NULL, NULL, 0, 0 }, /* 442 = freebsd32_thr_suspend */
+ { AS(thr_wake_args), (sy_call_t *)thr_wake, AUE_NULL, NULL, 0, 0 }, /* 443 = thr_wake */
+ { AS(kldunloadf_args), (sy_call_t *)kldunloadf, AUE_MODUNLOAD, NULL, 0, 0 }, /* 444 = kldunloadf */
+ { AS(audit_args), (sy_call_t *)audit, AUE_AUDIT, NULL, 0, 0 }, /* 445 = audit */
+ { AS(auditon_args), (sy_call_t *)auditon, AUE_AUDITON, NULL, 0, 0 }, /* 446 = auditon */
+ { AS(getauid_args), (sy_call_t *)getauid, AUE_GETAUID, NULL, 0, 0 }, /* 447 = getauid */
+ { AS(setauid_args), (sy_call_t *)setauid, AUE_SETAUID, NULL, 0, 0 }, /* 448 = setauid */
+ { AS(getaudit_args), (sy_call_t *)getaudit, AUE_GETAUDIT, NULL, 0, 0 }, /* 449 = getaudit */
+ { AS(setaudit_args), (sy_call_t *)setaudit, AUE_SETAUDIT, NULL, 0, 0 }, /* 450 = setaudit */
+ { AS(getaudit_addr_args), (sy_call_t *)getaudit_addr, AUE_GETAUDIT_ADDR, NULL, 0, 0 }, /* 451 = getaudit_addr */
+ { AS(setaudit_addr_args), (sy_call_t *)setaudit_addr, AUE_SETAUDIT_ADDR, NULL, 0, 0 }, /* 452 = setaudit_addr */
+ { AS(auditctl_args), (sy_call_t *)auditctl, AUE_AUDITCTL, NULL, 0, 0 }, /* 453 = auditctl */
+ { AS(freebsd32_umtx_op_args), (sy_call_t *)freebsd32_umtx_op, AUE_NULL, NULL, 0, 0 }, /* 454 = freebsd32_umtx_op */
+ { AS(freebsd32_thr_new_args), (sy_call_t *)freebsd32_thr_new, AUE_NULL, NULL, 0, 0 }, /* 455 = freebsd32_thr_new */
+ { AS(sigqueue_args), (sy_call_t *)sigqueue, AUE_NULL, NULL, 0, 0 }, /* 456 = sigqueue */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 457 = kmq_open */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 458 = kmq_setattr */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 459 = kmq_timedreceive */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 460 = kmq_timedsend */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 461 = kmq_notify */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 462 = kmq_unlink */
+ { AS(abort2_args), (sy_call_t *)abort2, AUE_NULL, NULL, 0, 0 }, /* 463 = abort2 */
+ { AS(thr_set_name_args), (sy_call_t *)thr_set_name, AUE_NULL, NULL, 0, 0 }, /* 464 = thr_set_name */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 465 = aio_fsync */
+ { AS(rtprio_thread_args), (sy_call_t *)rtprio_thread, AUE_RTPRIO, NULL, 0, 0 }, /* 466 = rtprio_thread */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 467 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 468 = nosys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 469 = __getpath_fromfd */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 470 = __getpath_fromaddr */
+ { AS(sctp_peeloff_args), (sy_call_t *)sctp_peeloff, AUE_NULL, NULL, 0, 0 }, /* 471 = sctp_peeloff */
+ { AS(sctp_generic_sendmsg_args), (sy_call_t *)sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0 }, /* 472 = sctp_generic_sendmsg */
+ { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0 }, /* 473 = sctp_generic_sendmsg_iov */
+ { AS(sctp_generic_recvmsg_args), (sy_call_t *)sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0 }, /* 474 = sctp_generic_recvmsg */
+ { AS(freebsd32_pread_args), (sy_call_t *)freebsd32_pread, AUE_PREAD, NULL, 0, 0 }, /* 475 = freebsd32_pread */
+ { AS(freebsd32_pwrite_args), (sy_call_t *)freebsd32_pwrite, AUE_PWRITE, NULL, 0, 0 }, /* 476 = freebsd32_pwrite */
+ { AS(freebsd32_mmap_args), (sy_call_t *)freebsd32_mmap, AUE_MMAP, NULL, 0, 0 }, /* 477 = freebsd32_mmap */
+ { AS(freebsd32_lseek_args), (sy_call_t *)freebsd32_lseek, AUE_LSEEK, NULL, 0, 0 }, /* 478 = freebsd32_lseek */
+ { AS(freebsd32_truncate_args), (sy_call_t *)freebsd32_truncate, AUE_TRUNCATE, NULL, 0, 0 }, /* 479 = freebsd32_truncate */
+ { AS(freebsd32_ftruncate_args), (sy_call_t *)freebsd32_ftruncate, AUE_FTRUNCATE, NULL, 0, 0 }, /* 480 = freebsd32_ftruncate */
+ { AS(thr_kill2_args), (sy_call_t *)thr_kill2, AUE_KILL, NULL, 0, 0 }, /* 481 = thr_kill2 */
};
Index: ia32_sysvec.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ia32/ia32_sysvec.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ia32/ia32_sysvec.c -L sys/compat/ia32/ia32_sysvec.c -u -r1.1.1.1 -r1.2
--- sys/compat/ia32/ia32_sysvec.c
+++ sys/compat/ia32/ia32_sysvec.c
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.20 2005/01/29 23:11:58 sobomax Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_sysvec.c,v 1.27 2007/09/24 20:49:39 jhb Exp $");
#include "opt_compat.h"
@@ -64,6 +64,7 @@
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
+#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/freebsd32/freebsd32_util.h>
#include <compat/freebsd32/freebsd32_proto.h>
#include <compat/freebsd32/freebsd32_syscall.h>
@@ -85,7 +86,7 @@
CTASSERT(sizeof(struct ia32_mcontext) == 640);
CTASSERT(sizeof(struct ia32_ucontext) == 704);
CTASSERT(sizeof(struct ia32_sigframe) == 800);
-CTASSERT(sizeof(struct ia32_siginfo) == 64);
+CTASSERT(sizeof(struct siginfo32) == 64);
#ifdef COMPAT_FREEBSD4
CTASSERT(sizeof(struct ia32_mcontext4) == 260);
CTASSERT(sizeof(struct ia32_ucontext4) == 324);
@@ -93,12 +94,22 @@
#endif
static register_t *ia32_copyout_strings(struct image_params *imgp);
-static void ia32_fixlimits(struct image_params *imgp);
+static void ia32_fixlimit(struct rlimit *rl, int which);
extern struct sysent freebsd32_sysent[];
SYSCTL_NODE(_compat, OID_AUTO, ia32, CTLFLAG_RW, 0, "ia32 mode");
+static u_long ia32_maxdsiz = IA32_MAXDSIZ;
+SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxdsiz, CTLFLAG_RW, &ia32_maxdsiz, 0, "");
+TUNABLE_ULONG("compat.ia32.maxdsiz", &ia32_maxdsiz);
+static u_long ia32_maxssiz = IA32_MAXSSIZ;
+SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxssiz, CTLFLAG_RW, &ia32_maxssiz, 0, "");
+TUNABLE_ULONG("compat.ia32.maxssiz", &ia32_maxssiz);
+static u_long ia32_maxvmem = IA32_MAXVMEM;
+SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxvmem, CTLFLAG_RW, &ia32_maxvmem, 0, "");
+TUNABLE_ULONG("compat.ia32.maxvmem", &ia32_maxvmem);
+
struct sysentvec ia32_freebsd_sysvec = {
FREEBSD32_SYS_MAXSYSCALL,
freebsd32_sysent,
@@ -125,7 +136,8 @@
VM_PROT_ALL,
ia32_copyout_strings,
ia32_setregs,
- ia32_fixlimits
+ ia32_fixlimit,
+ &ia32_maxssiz
};
@@ -137,6 +149,7 @@
"/libexec/ld-elf.so.1",
&ia32_freebsd_sysvec,
"/libexec/ld-elf32.so.1",
+ BI_CAN_EXEC_DYN,
};
SYSINIT(ia32, SI_SUB_EXEC, SI_ORDER_ANY,
@@ -151,6 +164,7 @@
"/usr/libexec/ld-elf.so.1",
&ia32_freebsd_sysvec,
"/libexec/ld-elf32.so.1",
+ BI_CAN_EXEC_DYN,
};
SYSINIT(oia32, SI_SUB_EXEC, SI_ORDER_ANY,
@@ -270,44 +284,34 @@
return ((register_t *)stack_base);
}
-static u_long ia32_maxdsiz = IA32_MAXDSIZ;
-SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxdsiz, CTLFLAG_RW, &ia32_maxdsiz, 0, "");
-static u_long ia32_maxssiz = IA32_MAXSSIZ;
-SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxssiz, CTLFLAG_RW, &ia32_maxssiz, 0, "");
-static u_long ia32_maxvmem = IA32_MAXVMEM;
-SYSCTL_ULONG(_compat_ia32, OID_AUTO, maxvmem, CTLFLAG_RW, &ia32_maxvmem, 0, "");
-
static void
-ia32_fixlimits(struct image_params *imgp)
+ia32_fixlimit(struct rlimit *rl, int which)
{
- struct proc *p = imgp->proc;
- struct plimit *oldlim, *newlim;
- if (ia32_maxdsiz == 0 && ia32_maxssiz == 0 && ia32_maxvmem == 0)
- return;
- newlim = lim_alloc();
- PROC_LOCK(p);
- oldlim = p->p_limit;
- lim_copy(newlim, oldlim);
- if (ia32_maxdsiz != 0) {
- if (newlim->pl_rlimit[RLIMIT_DATA].rlim_cur > ia32_maxdsiz)
- newlim->pl_rlimit[RLIMIT_DATA].rlim_cur = ia32_maxdsiz;
- if (newlim->pl_rlimit[RLIMIT_DATA].rlim_max > ia32_maxdsiz)
- newlim->pl_rlimit[RLIMIT_DATA].rlim_max = ia32_maxdsiz;
- }
- if (ia32_maxssiz != 0) {
- if (newlim->pl_rlimit[RLIMIT_STACK].rlim_cur > ia32_maxssiz)
- newlim->pl_rlimit[RLIMIT_STACK].rlim_cur = ia32_maxssiz;
- if (newlim->pl_rlimit[RLIMIT_STACK].rlim_max > ia32_maxssiz)
- newlim->pl_rlimit[RLIMIT_STACK].rlim_max = ia32_maxssiz;
- }
- if (ia32_maxvmem != 0) {
- if (newlim->pl_rlimit[RLIMIT_VMEM].rlim_cur > ia32_maxvmem)
- newlim->pl_rlimit[RLIMIT_VMEM].rlim_cur = ia32_maxvmem;
- if (newlim->pl_rlimit[RLIMIT_VMEM].rlim_max > ia32_maxvmem)
- newlim->pl_rlimit[RLIMIT_VMEM].rlim_max = ia32_maxvmem;
+ switch (which) {
+ case RLIMIT_DATA:
+ if (ia32_maxdsiz != 0) {
+ if (rl->rlim_cur > ia32_maxdsiz)
+ rl->rlim_cur = ia32_maxdsiz;
+ if (rl->rlim_max > ia32_maxdsiz)
+ rl->rlim_max = ia32_maxdsiz;
+ }
+ break;
+ case RLIMIT_STACK:
+ if (ia32_maxssiz != 0) {
+ if (rl->rlim_cur > ia32_maxssiz)
+ rl->rlim_cur = ia32_maxssiz;
+ if (rl->rlim_max > ia32_maxssiz)
+ rl->rlim_max = ia32_maxssiz;
+ }
+ break;
+ case RLIMIT_VMEM:
+ if (ia32_maxvmem != 0) {
+ if (rl->rlim_cur > ia32_maxvmem)
+ rl->rlim_cur = ia32_maxvmem;
+ if (rl->rlim_max > ia32_maxvmem)
+ rl->rlim_max = ia32_maxvmem;
+ }
+ break;
}
- p->p_limit = newlim;
- PROC_UNLOCK(p);
- lim_free(oldlim);
}
Index: ia32_signal.h
===================================================================
RCS file: /home/cvs/src/sys/compat/ia32/ia32_signal.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ia32/ia32_signal.h -L sys/compat/ia32/ia32_signal.h -u -r1.1.1.1 -r1.2
--- sys/compat/ia32/ia32_signal.h
+++ sys/compat/ia32/ia32_signal.h
@@ -26,15 +26,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/ia32/ia32_signal.h,v 1.7 2005/04/05 22:41:49 peter Exp $
+ * $FreeBSD: src/sys/compat/ia32/ia32_signal.h,v 1.10 2006/10/05 01:56:11 davidxu Exp $
*/
-struct ia32_sigaltstack {
- u_int32_t ss_sp; /* signal stack base */
- u_int32_t ss_size; /* signal stack length */
- int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
-};
-
struct ia32_mcontext {
u_int32_t mc_onstack; /* XXX - sigcontext compat. */
u_int32_t mc_gs; /* machine state (struct trapframe) */
@@ -72,7 +66,7 @@
sigset_t uc_sigmask;
struct ia32_mcontext uc_mcontext;
u_int32_t uc_link;
- struct ia32_sigaltstack uc_stack;
+ struct sigaltstack32 uc_stack;
u_int32_t uc_flags;
u_int32_t __spare__[4];
};
@@ -108,7 +102,7 @@
sigset_t uc_sigmask;
struct ia32_mcontext4 uc_mcontext;
u_int32_t uc_link;
- struct ia32_sigaltstack uc_stack;
+ struct sigaltstack32 uc_stack;
u_int32_t __spare__[8];
};
#endif
@@ -142,22 +136,6 @@
/*
* Signal frames, arguments passed to application signal handlers.
*/
-union ia32_sigval {
- int sigval_int;
- u_int32_t sigval_ptr;
-};
-struct ia32_siginfo {
- int si_signo; /* signal number */
- int si_errno; /* errno association */
- int si_code; /* signal code */
- int32_t si_pid; /* sending process */
- u_int32_t si_uid; /* sender's ruid */
- int si_status; /* exit value */
- u_int32_t si_addr; /* faulting instruction */
- union ia32_sigval si_value; /* signal value */
- int32_t si_band; /* band event for SIGPOLL */
- int __spare__[7]; /* gimme some slack */
-};
#ifdef COMPAT_FREEBSD4
struct ia32_sigframe4 {
@@ -167,7 +145,7 @@
u_int32_t sf_addr; /* undocumented 4th arg */
u_int32_t sf_ah; /* action/handler pointer */
struct ia32_ucontext4 sf_uc; /* = *sf_ucontext */
- struct ia32_siginfo sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
+ struct siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
};
#endif
@@ -179,7 +157,7 @@
u_int32_t sf_ah; /* action/handler pointer */
/* Beware, hole due to ucontext being 16 byte aligned! */
struct ia32_ucontext sf_uc; /* = *sf_ucontext */
- struct ia32_siginfo sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
+ struct siginfo32 sf_si; /* = *sf_siginfo (SA_SIGINFO case) */
};
#ifdef COMPAT_FREEBSD3
@@ -187,7 +165,7 @@
struct ia32_sigcontext3 si_sc;
int si_signo;
int si_code;
- union ia32_sigval si_value;
+ union sigval32 si_value;
};
struct ia32_sigframe3 {
int sf_signum;
@@ -199,10 +177,11 @@
};
#endif
+struct ksiginfo;
extern char ia32_sigcode[];
extern char freebsd4_ia32_sigcode[];
extern int sz_ia32_sigcode;
extern int sz_freebsd4_ia32_sigcode;
-extern void ia32_sendsig(sig_t, int, sigset_t *, u_long);
+extern void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *);
extern void ia32_setregs(struct thread *td, u_long entry, u_long stack,
u_long ps_strings);
Index: ia32_genassym.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ia32/ia32_genassym.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ia32/ia32_genassym.c -L sys/compat/ia32/ia32_genassym.c -u -r1.1.1.1 -r1.2
--- sys/compat/ia32/ia32_genassym.c
+++ sys/compat/ia32/ia32_genassym.c
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_genassym.c,v 1.4 2004/02/21 23:35:56 peter Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ia32/ia32_genassym.c,v 1.5 2006/10/05 01:56:11 davidxu Exp $");
#include "opt_compat.h"
@@ -8,6 +8,7 @@
#include <sys/systm.h>
#include <sys/signal.h>
+#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/ia32/ia32_signal.h>
ASSYM(IA32_SIGF_HANDLER, offsetof(struct ia32_sigframe, sf_ah));
Index: linprocfs.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linprocfs/linprocfs.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linprocfs/linprocfs.c -L sys/compat/linprocfs/linprocfs.c -u -r1.1.1.1 -r1.2
--- sys/compat/linprocfs/linprocfs.c
+++ sys/compat/linprocfs/linprocfs.c
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.89.2.1 2005/12/14 19:06:48 mlaier Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.115 2007/06/05 00:00:50 jeff Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -54,15 +54,18 @@
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
+#include <sys/msg.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sbuf.h>
+#include <sys/sem.h>
#include <sys/smp.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#include <sys/time.h>
#include <sys/tty.h>
#include <sys/user.h>
#include <sys/vmmeter.h>
@@ -79,13 +82,6 @@
#include <machine/clock.h>
-#ifdef __alpha__
-#include <machine/alpha_cpu.h>
-#include <machine/cpuconf.h>
-#include <machine/rpb.h>
-extern int ncpus;
-#endif /* __alpha__ */
-
#if defined(__i386__) || defined(__amd64__)
#include <machine/cputypes.h>
#include <machine/md_var.h>
@@ -113,6 +109,22 @@
#define P2B(x) ((x) << PAGE_SHIFT) /* pages to bytes */
#define P2K(x) ((x) << (PAGE_SHIFT - 10)) /* pages to kbytes */
+/**
+ * @brief Mapping of ki_stat in struct kinfo_proc to the linux state
+ *
+ * The linux procfs state field displays one of the characters RSDZTW to
+ * denote running, sleeping in an interruptible wait, waiting in an
+ * uninteruptible disk sleep, a zombie process, process is being traced
+ * or stopped, or process is paging respectively.
+ *
+ * Our struct kinfo_proc contains the variable ki_stat which contains a
+ * value out of SIDL, SRUN, SSLEEP, SSTOP, SZOMB, SWAIT and SLOCK.
+ *
+ * This character array is used with ki_stati-1 as an index and tries to
+ * map our states to suitable linux states.
+ */
+static char linux_state[] = "RRSTZDD";
+
/*
* Filler function for proc/meminfo
*/
@@ -185,77 +197,6 @@
return (0);
}
-#ifdef __alpha__
-extern struct rpb *hwrpb;
-/*
- * Filler function for proc/cpuinfo (Alpha version)
- */
-static int
-linprocfs_docpuinfo(PFS_FILL_ARGS)
-{
- u_int64_t type, major;
- struct pcs *pcsp;
- const char *model, *sysname;
-
- static const char *cpuname[] = {
- "EV3", "EV4", "Simulate", "LCA4", "EV5", "EV45", "EV56",
- "EV6", "PCA56", "PCA57", "EV67", "EV68CB", "EV68AL"
- };
-
- pcsp = LOCATE_PCS(hwrpb, hwrpb->rpb_primary_cpu_id);
- type = pcsp->pcs_proc_type;
- major = (type & PCS_PROC_MAJOR) >> PCS_PROC_MAJORSHIFT;
- if (major < sizeof(cpuname)/sizeof(char *)) {
- model = cpuname[major - 1];
- } else {
- model = "unknown";
- }
-
- sysname = alpha_dsr_sysname();
-
- sbuf_printf(sb,
- "cpu\t\t\t: Alpha\n"
- "cpu model\t\t: %s\n"
- "cpu variation\t\t: %ld\n"
- "cpu revision\t\t: %d\n"
- "cpu serial number\t: %s\n"
- "system type\t\t: %s\n"
- "system variation\t: %s\n"
- "system revision\t\t: %d\n"
- "system serial number\t: %s\n"
- "cycle frequency [Hz]\t: %lu\n"
- "timer frequency [Hz]\t: %u\n"
- "page size [bytes]\t: %ld\n"
- "phys. address bits\t: %ld\n"
- "max. addr. space #\t: %ld\n"
- "BogoMIPS\t\t: %u.%02u\n"
- "kernel unaligned acc\t: %d (pc=%x,va=%x)\n"
- "user unaligned acc\t: %d (pc=%x,va=%x)\n"
- "platform string\t\t: %s\n"
- "cpus detected\t\t: %d\n"
- ,
- model,
- pcsp->pcs_proc_var,
- *(int *)hwrpb->rpb_revision,
- " ",
- " ",
- "0",
- 0,
- " ",
- hwrpb->rpb_cc_freq,
- hz,
- hwrpb->rpb_page_size,
- hwrpb->rpb_phys_addr_size,
- hwrpb->rpb_max_asn,
- 0, 0,
- 0, 0, 0,
- 0, 0, 0,
- sysname,
- ncpus);
- return (0);
-}
-#endif /* __alpha__ */
-
#if defined(__i386__) || defined(__amd64__)
/*
* Filler function for proc/cpuinfo (i386 & amd64 version)
@@ -263,6 +204,9 @@
static int
linprocfs_docpuinfo(PFS_FILL_ARGS)
{
+ int hw_model[2];
+ char model[128];
+ size_t size;
int class, fqmhz, fqkhz;
int i;
@@ -300,22 +244,29 @@
default:
class = 0;
break;
-#else
+#else /* __amd64__ */
default:
- class = 6;
+ class = 15;
break;
#endif
}
+ hw_model[0] = CTL_HW;
+ hw_model[1] = HW_MODEL;
+ model[0] = '\0';
+ size = sizeof(model);
+ if (kernel_sysctl(td, hw_model, 2, &model, &size, 0, 0, 0, 0) != 0)
+ strcpy(model, "unknown");
for (i = 0; i < mp_ncpus; ++i) {
sbuf_printf(sb,
"processor\t: %d\n"
"vendor_id\t: %.20s\n"
"cpu family\t: %d\n"
"model\t\t: %d\n"
+ "model name\t: %s\n"
"stepping\t: %d\n",
- i, cpu_vendor, class, cpu, cpu_id & 0xf);
- /* XXX per-cpu vendor / class / id? */
+ i, cpu_vendor, class, cpu, model, cpu_id & 0xf);
+ /* XXX per-cpu vendor / class / model / id? */
}
sbuf_cat(sb,
@@ -361,9 +312,11 @@
int error;
/* resolve symlinks etc. in the emulation tree prefix */
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, linux_emul_path, td);
flep = NULL;
- if (namei(&nd) != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0)
+ error = namei(&nd);
+ VFS_UNLOCK_GIANT(NDHASGIANT(&nd));
+ if (error != 0 || vn_fullpath(td, nd.ni_vp, &dlep, &flep) != 0)
lep = linux_emul_path;
else
lep = dlep;
@@ -388,14 +341,18 @@
else if (strcmp(fstype, "procfs") == 0)
continue;
- sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype,
- mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw");
+ if (strcmp(fstype, "linsysfs") == 0) {
+ sbuf_printf(sb, "/sys %s sysfs %s", mntto,
+ mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw");
+ } else {
+ sbuf_printf(sb, "%s %s %s %s", mntfrom, mntto, fstype,
+ mp->mnt_stat.f_flags & MNT_RDONLY ? "ro" : "rw");
+ }
#define ADD_OPTION(opt, name) \
if (mp->mnt_stat.f_flags & (opt)) sbuf_printf(sb, "," name);
ADD_OPTION(MNT_SYNCHRONOUS, "sync");
ADD_OPTION(MNT_NOEXEC, "noexec");
ADD_OPTION(MNT_NOSUID, "nosuid");
- ADD_OPTION(MNT_NODEV, "nodev");
ADD_OPTION(MNT_UNION, "union");
ADD_OPTION(MNT_ASYNC, "async");
ADD_OPTION(MNT_SUIDDIR, "suiddir");
@@ -463,6 +420,57 @@
}
/*
+ * Get OS build date
+ */
+static void
+linprocfs_osbuild(struct thread *td, struct sbuf *sb)
+{
+#if 0
+ char osbuild[256];
+ char *cp1, *cp2;
+
+ strncpy(osbuild, version, 256);
+ osbuild[255] = '\0';
+ cp1 = strstr(osbuild, "\n");
+ cp2 = strstr(osbuild, ":");
+ if (cp1 && cp2) {
+ *cp1 = *cp2 = '\0';
+ cp1 = strstr(osbuild, "#");
+ } else
+ cp1 = NULL;
+ if (cp1)
+ sbuf_printf(sb, "%s%s", cp1, cp2 + 1);
+ else
+#endif
+ sbuf_cat(sb, "#4 Sun Dec 18 04:30:00 CET 1977");
+}
+
+/*
+ * Get OS builder
+ */
+static void
+linprocfs_osbuilder(struct thread *td, struct sbuf *sb)
+{
+#if 0
+ char builder[256];
+ char *cp;
+
+ cp = strstr(version, "\n ");
+ if (cp) {
+ strncpy(builder, cp + 5, 256);
+ builder[255] = '\0';
+ cp = strstr(builder, ":");
+ if (cp)
+ *cp = '\0';
+ }
+ if (cp)
+ sbuf_cat(sb, builder);
+ else
+#endif
+ sbuf_cat(sb, "des at freebsd.org");
+}
+
+/*
* Filler function for proc/version
*/
static int
@@ -473,10 +481,12 @@
linux_get_osname(td, osname);
linux_get_osrelease(td, osrelease);
+ sbuf_printf(sb, "%s version %s (", osname, osrelease);
+ linprocfs_osbuilder(td, sb);
+ sbuf_cat(sb, ") (gcc version " __VERSION__ ") ");
+ linprocfs_osbuild(td, sb);
+ sbuf_cat(sb, "\n");
- sbuf_printf(sb,
- "%s version %s (des at freebsd.org) (gcc version " __VERSION__ ")"
- " #4 Sun Dec 18 04:30:00 CET 1977\n", osname, osrelease);
return (0);
}
@@ -486,6 +496,7 @@
static int
linprocfs_doloadavg(PFS_FILL_ARGS)
{
+
sbuf_printf(sb,
"%d.%02d %d.%02d %d.%02d %d/%d %d\n",
(int)(averunnable.ldavg[0] / averunnable.fscale),
@@ -498,7 +509,6 @@
nprocs, /* number of tasks */
lastpid /* the last pid */
);
-
return (0);
}
@@ -509,50 +519,67 @@
linprocfs_doprocstat(PFS_FILL_ARGS)
{
struct kinfo_proc kp;
+ char state;
+ static int ratelimit = 0;
PROC_LOCK(p);
fill_kinfo_proc(p, &kp);
sbuf_printf(sb, "%d", p->p_pid);
#define PS_ADD(name, fmt, arg) sbuf_printf(sb, " " fmt, arg)
PS_ADD("comm", "(%s)", p->p_comm);
- PS_ADD("statr", "%c", '0'); /* XXX */
+ if (kp.ki_stat > sizeof(linux_state)) {
+ state = 'R';
+
+ if (ratelimit == 0) {
+ printf("linprocfs: don't know how to handle unknown FreeBSD state %d/%zd, mapping to R\n",
+ kp.ki_stat, sizeof(linux_state));
+ ++ratelimit;
+ }
+ } else
+ state = linux_state[kp.ki_stat - 1];
+ PS_ADD("state", "%c", state);
PS_ADD("ppid", "%d", p->p_pptr ? p->p_pptr->p_pid : 0);
PS_ADD("pgrp", "%d", p->p_pgid);
PS_ADD("session", "%d", p->p_session->s_sid);
PROC_UNLOCK(p);
PS_ADD("tty", "%d", 0); /* XXX */
- PS_ADD("tpgid", "%d", 0); /* XXX */
+ PS_ADD("tpgid", "%d", kp.ki_tpgid);
PS_ADD("flags", "%u", 0); /* XXX */
- PS_ADD("minflt", "%u", 0); /* XXX */
- PS_ADD("cminflt", "%u", 0); /* XXX */
- PS_ADD("majflt", "%u", 0); /* XXX */
- PS_ADD("cminflt", "%u", 0); /* XXX */
- PS_ADD("utime", "%d", 0); /* XXX */
- PS_ADD("stime", "%d", 0); /* XXX */
- PS_ADD("cutime", "%d", 0); /* XXX */
- PS_ADD("cstime", "%d", 0); /* XXX */
- PS_ADD("counter", "%d", 0); /* XXX */
- PS_ADD("priority", "%d", 0); /* XXX */
- PS_ADD("timeout", "%u", 0); /* XXX */
- PS_ADD("itrealvalue", "%u", 0); /* XXX */
- PS_ADD("starttime", "%d", 0); /* XXX */
- PS_ADD("vsize", "%ju", (uintmax_t)kp.ki_size);
- PS_ADD("rss", "%ju", P2K((uintmax_t)kp.ki_rssize));
- PS_ADD("rlim", "%u", 0); /* XXX */
+ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt);
+ PS_ADD("cminflt", "%lu", kp.ki_rusage_ch.ru_minflt);
+ PS_ADD("majflt", "%lu", kp.ki_rusage.ru_majflt);
+ PS_ADD("cmajflt", "%lu", kp.ki_rusage_ch.ru_majflt);
+ PS_ADD("utime", "%ld", T2J(tvtohz(&kp.ki_rusage.ru_utime)));
+ PS_ADD("stime", "%ld", T2J(tvtohz(&kp.ki_rusage.ru_stime)));
+ PS_ADD("cutime", "%ld", T2J(tvtohz(&kp.ki_rusage_ch.ru_utime)));
+ PS_ADD("cstime", "%ld", T2J(tvtohz(&kp.ki_rusage_ch.ru_stime)));
+ PS_ADD("priority", "%d", kp.ki_pri.pri_user);
+ PS_ADD("nice", "%d", kp.ki_nice); /* 19 (nicest) to -19 */
+ PS_ADD("0", "%d", 0); /* removed field */
+ PS_ADD("itrealvalue", "%d", 0); /* XXX */
+ /* XXX: starttime is not right, it is the _same_ for _every_ process.
+ It should be the number of jiffies between system boot and process
+ start. */
+ PS_ADD("starttime", "%lu", T2J(tvtohz(&kp.ki_start)));
+ PS_ADD("vsize", "%ju", P2K((uintmax_t)kp.ki_size));
+ PS_ADD("rss", "%ju", (uintmax_t)kp.ki_rssize);
+ PS_ADD("rlim", "%lu", kp.ki_rusage.ru_maxrss);
PS_ADD("startcode", "%u", (unsigned)0);
PS_ADD("endcode", "%u", 0); /* XXX */
PS_ADD("startstack", "%u", 0); /* XXX */
- PS_ADD("esp", "%u", 0); /* XXX */
- PS_ADD("eip", "%u", 0); /* XXX */
- PS_ADD("signal", "%d", 0); /* XXX */
- PS_ADD("blocked", "%d", 0); /* XXX */
- PS_ADD("sigignore", "%d", 0); /* XXX */
- PS_ADD("sigcatch", "%d", 0); /* XXX */
+ PS_ADD("kstkesp", "%u", 0); /* XXX */
+ PS_ADD("kstkeip", "%u", 0); /* XXX */
+ PS_ADD("signal", "%u", 0); /* XXX */
+ PS_ADD("blocked", "%u", 0); /* XXX */
+ PS_ADD("sigignore", "%u", 0); /* XXX */
+ PS_ADD("sigcatch", "%u", 0); /* XXX */
PS_ADD("wchan", "%u", 0); /* XXX */
- PS_ADD("nswap", "%lu", (long unsigned)0); /* XXX */
- PS_ADD("cnswap", "%lu", (long unsigned)0); /* XXX */
+ PS_ADD("nswap", "%lu", kp.ki_rusage.ru_nswap);
+ PS_ADD("cnswap", "%lu", kp.ki_rusage_ch.ru_nswap);
PS_ADD("exitsignal", "%d", 0); /* XXX */
- PS_ADD("processor", "%d", 0); /* XXX */
+ PS_ADD("processor", "%u", kp.ki_lastcpu);
+ PS_ADD("rt_priority", "%u", 0); /* XXX */ /* >= 2.5.19 */
+ PS_ADD("policy", "%u", kp.ki_pri.pri_class); /* >= 2.5.19 */
#undef PS_ADD
sbuf_putc(sb, '\n');
@@ -609,7 +636,7 @@
if (P_SHOULDSTOP(p)) {
state = "T (stopped)";
} else {
- mtx_lock_spin(&sched_lock);
+ PROC_SLOCK(p);
switch(p->p_state) {
case PRS_NEW:
state = "I (idle)";
@@ -639,7 +666,7 @@
state = "? (unknown)";
break;
}
- mtx_unlock_spin(&sched_lock);
+ PROC_SUNLOCK(p);
}
fill_kinfo_proc(p, &kp);
@@ -820,8 +847,8 @@
static int
linprocfs_doprocenviron(PFS_FILL_ARGS)
{
- sbuf_printf(sb, "doprocenviron\n%c", '\0');
+ sbuf_printf(sb, "doprocenviron\n%c", '\0');
return (0);
}
@@ -833,64 +860,82 @@
{
char mebuffer[512];
vm_map_t map = &p->p_vmspace->vm_map;
- vm_map_entry_t entry;
+ vm_map_entry_t entry, tmp_entry;
vm_object_t obj, tobj, lobj;
+ vm_offset_t saved_end;
vm_ooffset_t off = 0;
char *name = "", *freename = NULL;
size_t len;
ino_t ino;
+ unsigned int last_timestamp;
int ref_count, shadow_count, flags;
int error;
struct vnode *vp;
struct vattr vat;
-
+ int locked;
+
PROC_LOCK(p);
error = p_candebug(td, p);
PROC_UNLOCK(p);
if (error)
return (error);
-
+
if (uio->uio_rw != UIO_READ)
return (EOPNOTSUPP);
-
+
if (uio->uio_offset != 0)
return (0);
-
+
error = 0;
- if (map != &curthread->td_proc->p_vmspace->vm_map)
- vm_map_lock_read(map);
- for (entry = map->header.next;
+ vm_map_lock_read(map);
+ for (entry = map->header.next;
((uio->uio_resid > 0) && (entry != &map->header));
entry = entry->next) {
name = "";
freename = NULL;
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
+ saved_end = entry->end;
obj = entry->object.vm_object;
- for (lobj = tobj = obj; tobj; tobj = tobj->backing_object)
+ for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
+ VM_OBJECT_LOCK(tobj);
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
lobj = tobj;
+ }
ino = 0;
if (lobj) {
- vp = lobj->handle;
- VM_OBJECT_LOCK(lobj);
off = IDX_TO_OFF(lobj->size);
- if (lobj->type == OBJT_VNODE && lobj->handle) {
- vn_fullpath(td, vp, &name, &freename);
- VOP_GETATTR(vp, &vat, td->td_ucred, td);
- ino = vat.va_fileid;
+ if (lobj->type == OBJT_VNODE) {
+ vp = lobj->handle;
+ if (vp)
+ vref(vp);
}
+ else
+ vp = NULL;
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
flags = obj->flags;
ref_count = obj->ref_count;
shadow_count = obj->shadow_count;
- VM_OBJECT_UNLOCK(lobj);
+ VM_OBJECT_UNLOCK(obj);
+ if (vp) {
+ vn_fullpath(td, vp, &name, &freename);
+ locked = VFS_LOCK_GIANT(vp->v_mount);
+ vn_lock(vp, LK_SHARED | LK_RETRY, td);
+ VOP_GETATTR(vp, &vat, td->td_ucred, td);
+ ino = vat.va_fileid;
+ vput(vp);
+ VFS_UNLOCK_GIANT(locked);
+ }
} else {
flags = 0;
ref_count = 0;
shadow_count = 0;
}
-
+
/*
- * format:
+ * format:
* start, end, access, offset, major, minor, inode, name.
*/
snprintf(mebuffer, sizeof mebuffer,
@@ -915,16 +960,27 @@
* XXX We should probably return
* EFBIG here, as in procfs.
*/
+ last_timestamp = map->timestamp;
+ vm_map_unlock_read(map);
error = uiomove(mebuffer, len, uio);
+ vm_map_lock_read(map);
if (error)
break;
+ if (last_timestamp + 1 != map->timestamp) {
+ /*
+ * Look again for the entry because the map was
+ * modified while it was unlocked. Specifically,
+ * the entry may have been clipped, merged, or deleted.
+ */
+ vm_map_lookup_entry(map, saved_end - 1, &tmp_entry);
+ entry = tmp_entry;
+ }
}
- if (map != &curthread->td_proc->p_vmspace->vm_map)
- vm_map_unlock_read(map);
-
+ vm_map_unlock_read(map);
+
return (error);
-}
-
+}
+
/*
* Filler function for proc/net/dev
*/
@@ -953,7 +1009,100 @@
return (0);
}
-#if 0
+/*
+ * Filler function for proc/sys/kernel/osrelease
+ */
+static int
+linprocfs_doosrelease(PFS_FILL_ARGS)
+{
+ char osrelease[LINUX_MAX_UTSNAME];
+
+ linux_get_osrelease(td, osrelease);
+ sbuf_printf(sb, "%s\n", osrelease);
+
+ return (0);
+}
+
+/*
+ * Filler function for proc/sys/kernel/ostype
+ */
+static int
+linprocfs_doostype(PFS_FILL_ARGS)
+{
+ char osname[LINUX_MAX_UTSNAME];
+
+ linux_get_osname(td, osname);
+ sbuf_printf(sb, "%s\n", osname);
+
+ return (0);
+}
+
+/*
+ * Filler function for proc/sys/kernel/version
+ */
+static int
+linprocfs_doosbuild(PFS_FILL_ARGS)
+{
+
+ linprocfs_osbuild(td, sb);
+ sbuf_cat(sb, "\n");
+ return (0);
+}
+
+/*
+ * Filler function for proc/sys/kernel/msgmni
+ */
+static int
+linprocfs_domsgmni(PFS_FILL_ARGS)
+{
+
+ sbuf_printf(sb, "%d\n", msginfo.msgmni);
+ return (0);
+}
+
+/*
+ * Filler function for proc/sys/kernel/pid_max
+ */
+static int
+linprocfs_dopid_max(PFS_FILL_ARGS)
+{
+
+ sbuf_printf(sb, "%i\n", PID_MAX);
+ return (0);
+}
+
+/*
+ * Filler function for proc/sys/kernel/sem
+ */
+static int
+linprocfs_dosem(PFS_FILL_ARGS)
+{
+
+ sbuf_printf(sb, "%d %d %d %d\n", seminfo.semmsl, seminfo.semmns,
+ seminfo.semopm, seminfo.semmni);
+ return (0);
+}
+
+/*
+ * Filler function for proc/scsi/device_info
+ */
+static int
+linprocfs_doscsidevinfo(PFS_FILL_ARGS)
+{
+
+ return (0);
+}
+
+/*
+ * Filler function for proc/scsi/scsi
+ */
+static int
+linprocfs_doscsiscsi(PFS_FILL_ARGS)
+{
+
+ return (0);
+}
+
extern struct cdevsw *cdevsw[];
/*
@@ -962,19 +1111,17 @@
static int
linprocfs_dodevices(PFS_FILL_ARGS)
{
- int i;
-
+ char *char_devices;
sbuf_printf(sb, "Character devices:\n");
- for (i = 0; i < NUMCDEVSW; i++)
- if (cdevsw[i] != NULL)
- sbuf_printf(sb, "%3d %s\n", i, cdevsw[i]->d_name);
+ char_devices = linux_get_char_devices();
+ sbuf_printf(sb, "%s", char_devices);
+ linux_free_get_char_devices(char_devices);
sbuf_printf(sb, "\nBlock devices:\n");
return (0);
}
-#endif
/*
* Filler function for proc/cmdline
@@ -982,6 +1129,7 @@
static int
linprocfs_docmdline(PFS_FILL_ARGS)
{
+
sbuf_printf(sb, "BOOT_IMAGE=%s", kernelname);
sbuf_printf(sb, " ro root=302\n");
return (0);
@@ -1017,59 +1165,83 @@
/* /proc/... */
pfs_create_file(root, "cmdline", &linprocfs_docmdline,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "cpuinfo", &linprocfs_docpuinfo,
- NULL, NULL, PFS_RD);
-#if 0
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "devices", &linprocfs_dodevices,
- NULL, NULL, PFS_RD);
-#endif
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "loadavg", &linprocfs_doloadavg,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "meminfo", &linprocfs_domeminfo,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
#if 0
pfs_create_file(root, "modules", &linprocfs_domodules,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
#endif
+ pfs_create_file(root, "mounts", &linprocfs_domtab,
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "mtab", &linprocfs_domtab,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_link(root, "self", &procfs_docurproc,
- NULL, NULL, 0);
+ NULL, NULL, NULL, 0);
pfs_create_file(root, "stat", &linprocfs_dostat,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "uptime", &linprocfs_douptime,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(root, "version", &linprocfs_doversion,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
/* /proc/net/... */
- dir = pfs_create_dir(root, "net", NULL, NULL, 0);
+ dir = pfs_create_dir(root, "net", NULL, NULL, NULL, 0);
pfs_create_file(dir, "dev", &linprocfs_donetdev,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
/* /proc/<pid>/... */
- dir = pfs_create_dir(root, "pid", NULL, NULL, PFS_PROCDEP);
+ dir = pfs_create_dir(root, "pid", NULL, NULL, NULL, PFS_PROCDEP);
pfs_create_file(dir, "cmdline", &linprocfs_doproccmdline,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_link(dir, "cwd", &linprocfs_doproccwd,
- NULL, NULL, 0);
+ NULL, NULL, NULL, 0);
pfs_create_file(dir, "environ", &linprocfs_doprocenviron,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_link(dir, "exe", &procfs_doprocfile,
- NULL, &procfs_notsystem, 0);
+ NULL, &procfs_notsystem, NULL, 0);
pfs_create_file(dir, "maps", &linprocfs_doprocmaps,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "mem", &procfs_doprocmem,
- &procfs_attr, &procfs_candebug, PFS_RDWR|PFS_RAW);
+ &procfs_attr, &procfs_candebug, NULL, PFS_RDWR|PFS_RAW);
pfs_create_link(dir, "root", &linprocfs_doprocroot,
- NULL, NULL, 0);
+ NULL, NULL, NULL, 0);
pfs_create_file(dir, "stat", &linprocfs_doprocstat,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "statm", &linprocfs_doprocstatm,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
pfs_create_file(dir, "status", &linprocfs_doprocstatus,
- NULL, NULL, PFS_RD);
+ NULL, NULL, NULL, PFS_RD);
+
+ /* /proc/scsi/... */
+ dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);
+ pfs_create_file(dir, "device_info", &linprocfs_doscsidevinfo,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "scsi", &linprocfs_doscsiscsi,
+ NULL, NULL, NULL, PFS_RD);
+
+ /* /proc/sys/... */
+ dir = pfs_create_dir(root, "sys", NULL, NULL, NULL, 0);
+ /* /proc/sys/kernel/... */
+ dir = pfs_create_dir(dir, "kernel", NULL, NULL, NULL, 0);
+ pfs_create_file(dir, "osrelease", &linprocfs_doosrelease,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "ostype", &linprocfs_doostype,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "version", &linprocfs_doosbuild,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "msgmni", &linprocfs_domsgmni,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "pid_max", &linprocfs_dopid_max,
+ NULL, NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "sem", &linprocfs_dosem,
+ NULL, NULL, NULL, PFS_RD);
return (0);
}
@@ -1088,3 +1260,5 @@
PSEUDOFS(linprocfs, 1);
MODULE_DEPEND(linprocfs, linux, 1, 1, 1);
MODULE_DEPEND(linprocfs, procfs, 1, 1, 1);
+MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1);
+MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1);
Index: linux_util.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_util.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_util.c -L sys/compat/linux/linux_util.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_util.c
+++ sys/compat/linux/linux_util.c
@@ -30,11 +30,15 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_util.c,v 1.29 2005/03/01 17:57:45 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_util.c,v 1.32 2007/02/24 16:49:24 netchild Exp $");
+
+#include "opt_compat.h"
#include <sys/param.h>
+#include <sys/bus.h>
#include <sys/lock.h>
#include <sys/malloc.h>
+#include <sys/linker_set.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
@@ -45,16 +49,20 @@
#include <machine/stdarg.h>
#include <compat/linux/linux_util.h>
+#ifdef COMPAT_LINUX32
+#include <machine/../linux32/linux.h>
+#else
+#include <machine/../linux/linux.h>
+#endif
const char linux_emul_path[] = "/compat/linux";
/*
- * Search an alternate path before passing pathname arguments on
- * to system calls. Useful for keeping a separate 'emulation tree'.
+ * Search an alternate path before passing pathname arguments on to
+ * system calls. Useful for keeping a separate 'emulation tree'.
*
- * If cflag is set, we check if an attempt can be made to create
- * the named file, i.e. we check if the directory it should
- * be in exists.
+ * If cflag is set, we check if an attempt can be made to create the
+ * named file, i.e. we check if the directory it should be in exists.
*/
int
linux_emul_convpath(td, path, pathseg, pbuf, cflag)
@@ -82,3 +90,136 @@
va_end(ap);
printf("\n");
}
+
+struct device_element
+{
+ TAILQ_ENTRY(device_element) list;
+ struct linux_device_handler entry;
+};
+
+static TAILQ_HEAD(, device_element) devices =
+ TAILQ_HEAD_INITIALIZER(devices);
+
+static struct linux_device_handler null_handler =
+ { "mem", "mem", "null", "null", 1, 3, 1};
+
+DATA_SET(linux_device_handler_set, null_handler);
+
+char *
+linux_driver_get_name_dev(device_t dev)
+{
+ struct device_element *de;
+ const char *device_name = device_get_name(dev);
+
+ if (device_name == NULL)
+ return NULL;
+ TAILQ_FOREACH(de, &devices, list) {
+ if (strcmp(device_name, de->entry.bsd_driver_name) == 0)
+ return (de->entry.linux_driver_name);
+ }
+
+ return NULL;
+}
+
+int
+linux_driver_get_major_minor(char *node, int *major, int *minor)
+{
+ struct device_element *de;
+
+ if (node == NULL || major == NULL || minor == NULL)
+ return 1;
+ TAILQ_FOREACH(de, &devices, list) {
+ if (strcmp(node, de->entry.bsd_device_name) == 0) {
+ *major = de->entry.linux_major;
+ *minor = de->entry.linux_minor;
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+char *
+linux_get_char_devices()
+{
+ struct device_element *de;
+ char *temp, *string, *last;
+ char formated[256];
+ int current_size = 0, string_size = 1024;
+
+ MALLOC(string, char *, string_size, M_LINUX, M_WAITOK);
+ string[0] = '\000';
+ last = "";
+ TAILQ_FOREACH(de, &devices, list) {
+ if (!de->entry.linux_char_device)
+ continue;
+ temp = string;
+ if (strcmp(last, de->entry.bsd_driver_name) != 0) {
+ last = de->entry.bsd_driver_name;
+
+ snprintf(formated, sizeof(formated), "%3d %s\n",
+ de->entry.linux_major,
+ de->entry.linux_device_name);
+ if (strlen(formated) + current_size
+ >= string_size) {
+ string_size *= 2;
+ MALLOC(string, char *, string_size,
+ M_LINUX, M_WAITOK);
+ bcopy(temp, string, current_size);
+ FREE(temp, M_LINUX);
+ }
+ strcat(string, formated);
+ current_size = strlen(string);
+ }
+ }
+
+ return string;
+}
+
+void
+linux_free_get_char_devices(char *string)
+{
+ FREE(string, M_LINUX);
+}
+
+static int linux_major_starting = 200;
+
+int
+linux_device_register_handler(struct linux_device_handler *d)
+{
+ struct device_element *de;
+
+ if (d == NULL)
+ return (EINVAL);
+
+ MALLOC(de, struct device_element *, sizeof(*de),
+ M_LINUX, M_WAITOK);
+ if (d->linux_major < 0) {
+ d->linux_major = linux_major_starting++;
+ }
+ bcopy(d, &de->entry, sizeof(*d));
+
+ /* Add the element to the list, sorted on span. */
+ TAILQ_INSERT_TAIL(&devices, de, list);
+
+ return (0);
+}
+
+int
+linux_device_unregister_handler(struct linux_device_handler *d)
+{
+ struct device_element *de;
+
+ if (d == NULL)
+ return (EINVAL);
+
+ TAILQ_FOREACH(de, &devices, list) {
+ if (bcmp(d, &de->entry, sizeof(*d)) == 0) {
+ TAILQ_REMOVE(&devices, de, list);
+ FREE(de, M_LINUX);
+ return (0);
+ }
+ }
+
+ return (EINVAL);
+}
Index: linux_mib.h
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_mib.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/linux/linux_mib.h -L sys/compat/linux/linux_mib.h -u -r1.1.1.2 -r1.2
--- sys/compat/linux/linux_mib.h
+++ sys/compat/linux/linux_mib.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_mib.h,v 1.8.12.1 2005/12/22 21:25:19 jhb Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_mib.h,v 1.10 2006/12/31 12:39:10 netchild Exp $
*/
#ifndef _LINUX_MIB_H_
@@ -40,4 +40,6 @@
int linux_get_oss_version(struct thread *td);
int linux_set_oss_version(struct thread *td, int oss_version);
+int linux_use26(struct thread *td);
+
#endif /* _LINUX_MIB_H_ */
Index: linux_signal.h
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_signal.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_signal.h -L sys/compat/linux/linux_signal.h -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_signal.h
+++ sys/compat/linux/linux_signal.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_signal.h,v 1.6 2002/03/20 05:42:02 alfred Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_signal.h,v 1.7 2006/10/15 12:51:43 netchild Exp $
*/
#ifndef _LINUX_SIGNAL_H_
@@ -35,4 +35,6 @@
void bsd_to_linux_sigset(sigset_t *, l_sigset_t *);
int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *);
+#define LINUX_SIG_VALID(sig) ((sig) <= LINUX_NSIG && (sig) > 0)
+
#endif /* _LINUX_SIGNAL_H_ */
Index: linux_socket.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_socket.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/linux/linux_socket.c -L sys/compat/linux/linux_socket.c -u -r1.1.1.2 -r1.2
--- sys/compat/linux/linux_socket.c
+++ sys/compat/linux/linux_socket.c
@@ -27,16 +27,12 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.59.2.1 2006/01/10 10:12:55 glebius Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.74 2007/08/06 14:25:59 rwatson Exp $");
/* XXX we use functions that might not exist. */
#include "opt_compat.h"
#include "opt_inet6.h"
-#ifndef COMPAT_43
-#error "Unable to compile Linux-emulator due to missing COMPAT_43 option!"
-#endif
-
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/systm.h>
@@ -53,6 +49,7 @@
#include <sys/syscallsubr.h>
#include <sys/uio.h>
#include <sys/syslog.h>
+#include <sys/un.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -62,8 +59,6 @@
#include <netinet6/ip6_var.h>
#endif
-#include "opt_compat.h"
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -199,7 +194,6 @@
return (-1);
}
-#ifndef __alpha__
static int
bsd_to_linux_domain(int domain)
{
@@ -299,6 +293,20 @@
return (SO_OOBINLINE);
case LINUX_SO_LINGER:
return (SO_LINGER);
+ case LINUX_SO_PEERCRED:
+ return (LOCAL_PEERCRED);
+ case LINUX_SO_RCVLOWAT:
+ return (SO_RCVLOWAT);
+ case LINUX_SO_SNDLOWAT:
+ return (SO_SNDLOWAT);
+ case LINUX_SO_RCVTIMEO:
+ return (SO_RCVTIMEO);
+ case LINUX_SO_SNDTIMEO:
+ return (SO_SNDTIMEO);
+ case LINUX_SO_TIMESTAMP:
+ return (SO_TIMESTAMP);
+ case LINUX_SO_ACCEPTCONN:
+ return (SO_ACCEPTCONN);
}
return (-1);
}
@@ -343,6 +351,48 @@
return ret_flags;
}
+/*
+* If bsd_to_linux_sockaddr() or linux_to_bsd_sockaddr() faults, then the
+* native syscall will fault. Thus, we don't really need to check the
+* return values for these functions.
+*/
+
+static int
+bsd_to_linux_sockaddr(struct sockaddr *arg)
+{
+ struct sockaddr sa;
+ size_t sa_len = sizeof(struct sockaddr);
+ int error;
+
+ if ((error = copyin(arg, &sa, sa_len)))
+ return (error);
+
+ *(u_short *)&sa = sa.sa_family;
+
+ error = copyout(&sa, arg, sa_len);
+
+ return (error);
+}
+
+static int
+linux_to_bsd_sockaddr(struct sockaddr *arg, int len)
+{
+ struct sockaddr sa;
+ size_t sa_len = sizeof(struct sockaddr);
+ int error;
+
+ if ((error = copyin(arg, &sa, sa_len)))
+ return (error);
+
+ sa.sa_family = *(sa_family_t *)&sa;
+ sa.sa_len = len;
+
+ error = copyout(&sa, arg, sa_len);
+
+ return (error);
+}
+
+
static int
linux_sa_put(struct osockaddr *osa)
{
@@ -574,7 +624,11 @@
if (error)
return (error);
- return (kern_bind(td, linux_args.s, sa));
+ error = kern_bind(td, linux_args.s, sa);
+ free(sa, M_SONAME);
+ if (error == EADDRNOTAVAIL && linux_args.namelen != sizeof(struct sockaddr_in))
+ return (EINVAL);
+ return (error);
}
struct linux_connect_args {
@@ -583,7 +637,6 @@
int namelen;
};
int linux_connect(struct thread *, struct linux_connect_args *);
-#endif /* !__alpha__*/
int
linux_connect(struct thread *td, struct linux_connect_args *args)
@@ -594,12 +647,8 @@
u_int fflag;
int error;
-#ifdef __alpha__
- bcopy(args, &linux_args, sizeof(linux_args));
-#else
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
return (error);
-#endif /* __alpha__ */
error = linux_getsockaddr(&sa,
(struct osockaddr *)PTRIN(linux_args.name),
@@ -608,6 +657,7 @@
return (error);
error = kern_connect(td, linux_args.s, sa);
+ free(sa, M_SONAME);
if (error != EISCONN)
return (error);
@@ -615,8 +665,11 @@
* Linux doesn't return EISCONN the first time it occurs,
* when on a non-blocking socket. Instead it returns the
* error getsockopt(SOL_SOCKET, SO_ERROR) would return on BSD.
+ *
+ * XXXRW: Instead of using fgetsock(), check that it is a
+ * socket and use the file descriptor reference instead of
+ * creating a new one.
*/
- NET_LOCK_GIANT();
error = fgetsock(td, linux_args.s, &so, &fflag);
if (error == 0) {
error = EISCONN;
@@ -629,12 +682,9 @@
}
fputsock(so);
}
- NET_UNLOCK_GIANT();
return (error);
}
-#ifndef __alpha__
-
struct linux_listen_args {
int s;
int backlog;
@@ -673,9 +723,6 @@
struct sockaddr * __restrict name;
socklen_t * __restrict anamelen;
} */ bsd_args;
- struct close_args /* {
- int fd;
- } */ c_args;
int error, fd;
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
@@ -685,14 +732,17 @@
/* XXX: */
bsd_args.name = (struct sockaddr * __restrict)PTRIN(linux_args.addr);
bsd_args.anamelen = PTRIN(linux_args.namelen);/* XXX */
- error = oaccept(td, &bsd_args);
- if (error)
+ error = accept(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.name);
+ if (error) {
+ if (error == EFAULT && linux_args.namelen != sizeof(struct sockaddr_in))
+ return (EINVAL);
return (error);
+ }
if (linux_args.addr) {
error = linux_sa_put(PTRIN(linux_args.addr));
if (error) {
- c_args.fd = td->td_retval[0];
- (void)close(td, &c_args);
+ (void)kern_close(td, td->td_retval[0]);
return (error);
}
}
@@ -732,7 +782,8 @@
/* XXX: */
bsd_args.asa = (struct sockaddr * __restrict)PTRIN(linux_args.addr);
bsd_args.alen = PTRIN(linux_args.namelen); /* XXX */
- error = ogetsockname(td, &bsd_args);
+ error = getsockname(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
error = linux_sa_put(PTRIN(linux_args.addr));
@@ -751,7 +802,7 @@
linux_getpeername(struct thread *td, struct linux_getpeername_args *args)
{
struct linux_getpeername_args linux_args;
- struct ogetpeername_args /* {
+ struct getpeername_args /* {
int fdes;
caddr_t asa;
int *alen;
@@ -762,9 +813,10 @@
return (error);
bsd_args.fdes = linux_args.s;
- bsd_args.asa = (caddr_t)PTRIN(linux_args.addr);
+ bsd_args.asa = (struct sockaddr *)PTRIN(linux_args.addr);
bsd_args.alen = (int *)PTRIN(linux_args.namelen);
- error = ogetpeername(td, &bsd_args);
+ error = getpeername(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.asa);
if (error)
return (error);
error = linux_sa_put(PTRIN(linux_args.addr));
@@ -920,11 +972,15 @@
struct sockaddr * __restrict from;
socklen_t * __restrict fromlenaddr;
} */ bsd_args;
+ size_t len;
int error;
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
return (error);
+ if ((error = copyin(PTRIN(linux_args.fromlen), &len, sizeof(size_t))))
+ return (error);
+
bsd_args.s = linux_args.s;
bsd_args.buf = PTRIN(linux_args.buf);
bsd_args.len = linux_args.len;
@@ -932,7 +988,11 @@
/* XXX: */
bsd_args.from = (struct sockaddr * __restrict)PTRIN(linux_args.from);
bsd_args.fromlenaddr = PTRIN(linux_args.fromlen);/* XXX */
- error = orecvfrom(td, &bsd_args);
+
+ linux_to_bsd_sockaddr((struct sockaddr *)bsd_args.from, len);
+ error = recvfrom(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.from);
+
if (error)
return (error);
if (linux_args.from) {
@@ -966,6 +1026,16 @@
error = copyin(PTRIN(linux_args.msg), &msg, sizeof(msg));
if (error)
return (error);
+
+ /*
+ * Some Linux applications (ping) define a non-NULL control data
+ * pointer, but a msg_controllen of 0, which is not allowed in the
+ * FreeBSD system call interface. NULL the msg_control pointer in
+ * order to handle this case. This should be checked, but allows the
+ * Linux ping to work.
+ */
+ if (msg.msg_control != NULL && msg.msg_controllen == 0)
+ msg.msg_control = NULL;
error = copyiniov(msg.msg_iov, msg.msg_iovlen, &iov, EMSGSIZE);
if (error)
return (error);
@@ -1001,10 +1071,19 @@
if ((error = copyin(args, &linux_args, sizeof(linux_args))))
return (error);
+ if ((error = copyin(PTRIN(args->msg), &msg, sizeof (msg))))
+ return (error);
+
bsd_args.s = linux_args.s;
bsd_args.msg = PTRIN(linux_args.msg);
bsd_args.flags = linux_to_bsd_msg_flags(linux_args.flags);
- error = recvmsg(td, &bsd_args);
+ if (msg.msg_name) {
+ linux_to_bsd_sockaddr((struct sockaddr *)msg.msg_name,
+ msg.msg_namelen);
+ error = recvmsg(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)msg.msg_name);
+ } else
+ error = recvmsg(td, &bsd_args);
if (error)
return (error);
@@ -1087,12 +1166,21 @@
break;
}
if (name == -1)
- return (EINVAL);
+ return (ENOPROTOOPT);
bsd_args.name = name;
bsd_args.val = PTRIN(linux_args.optval);
bsd_args.valsize = linux_args.optlen;
- return (setsockopt(td, &bsd_args));
+
+ if (name == IPV6_NEXTHOP) {
+ linux_to_bsd_sockaddr((struct sockaddr *)bsd_args.val,
+ bsd_args.valsize);
+ error = setsockopt(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.val);
+ } else
+ error = setsockopt(td, &bsd_args);
+
+ return (error);
}
struct linux_getsockopt_args {
@@ -1142,7 +1230,14 @@
bsd_args.name = name;
bsd_args.val = PTRIN(linux_args.optval);
bsd_args.avalsize = PTRIN(linux_args.optlen);
- return (getsockopt(td, &bsd_args));
+
+ if (name == IPV6_NEXTHOP) {
+ error = getsockopt(td, &bsd_args);
+ bsd_to_linux_sockaddr((struct sockaddr *)bsd_args.val);
+ } else
+ error = getsockopt(td, &bsd_args);
+
+ return (error);
}
int
@@ -1190,4 +1285,3 @@
uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what);
return (ENOSYS);
}
-#endif /*!__alpha__*/
Index: linux_sysctl.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_sysctl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_sysctl.c -L sys/compat/linux/linux_sysctl.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_sysctl.c
+++ sys/compat/linux/linux_sysctl.c
@@ -27,7 +27,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_sysctl.c,v 1.14 2005/01/14 04:44:56 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_sysctl.c,v 1.17 2006/03/19 11:10:33 ru Exp $");
+
+#include "opt_compat.h"
#include <sys/param.h>
#include <sys/lock.h>
@@ -38,8 +40,6 @@
#include <sys/systm.h>
#include <sys/sbuf.h>
-#include "opt_compat.h"
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
Index: linux_file.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_file.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_file.c -L sys/compat/linux/linux_file.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_file.c
+++ sys/compat/linux/linux_file.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.91 2005/04/13 04:31:43 mdodd Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_file.c,v 1.105.4.1 2008/01/04 04:56:07 kib Exp $");
#include "opt_compat.h"
#include "opt_mac.h"
@@ -40,22 +40,25 @@
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/lock.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
+#include <sys/namei.h>
#include <sys/proc.h>
+#include <sys/stat.h>
+#include <sys/sx.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/tty.h>
+#include <sys/unistd.h>
#include <sys/vnode.h>
+#include <security/mac/mac_framework.h>
+
#include <ufs/ufs/extattr.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/ufsmount.h>
-#include "opt_compat.h"
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -65,7 +68,6 @@
#endif
#include <compat/linux/linux_util.h>
-#ifndef __alpha__
int
linux_creat(struct thread *td, struct linux_creat_args *args)
{
@@ -83,74 +85,228 @@
LFREEPATH(path);
return (error);
}
-#endif /*!__alpha__*/
-int
-linux_open(struct thread *td, struct linux_open_args *args)
+
+static int
+linux_common_open(struct thread *td, char *path, int l_flags, int mode, int openat)
{
struct proc *p = td->td_proc;
- char *path;
+ struct file *fp;
+ int fd;
int bsd_flags, error;
- if (args->flags & LINUX_O_CREAT)
- LCONVPATHCREAT(td, args->path, &path);
- else
- LCONVPATHEXIST(td, args->path, &path);
-
-#ifdef DEBUG
- if (ldebug(open))
- printf(ARGS(open, "%s, 0x%x, 0x%x"),
- path, args->flags, args->mode);
-#endif
bsd_flags = 0;
- if (args->flags & LINUX_O_RDONLY)
- bsd_flags |= O_RDONLY;
- if (args->flags & LINUX_O_WRONLY)
+ switch (l_flags & LINUX_O_ACCMODE) {
+ case LINUX_O_WRONLY:
bsd_flags |= O_WRONLY;
- if (args->flags & LINUX_O_RDWR)
+ break;
+ case LINUX_O_RDWR:
bsd_flags |= O_RDWR;
- if (args->flags & LINUX_O_NDELAY)
+ break;
+ default:
+ bsd_flags |= O_RDONLY;
+ }
+ if (l_flags & LINUX_O_NDELAY)
bsd_flags |= O_NONBLOCK;
- if (args->flags & LINUX_O_APPEND)
+ if (l_flags & LINUX_O_APPEND)
bsd_flags |= O_APPEND;
- if (args->flags & LINUX_O_SYNC)
+ if (l_flags & LINUX_O_SYNC)
bsd_flags |= O_FSYNC;
- if (args->flags & LINUX_O_NONBLOCK)
+ if (l_flags & LINUX_O_NONBLOCK)
bsd_flags |= O_NONBLOCK;
- if (args->flags & LINUX_FASYNC)
+ if (l_flags & LINUX_FASYNC)
bsd_flags |= O_ASYNC;
- if (args->flags & LINUX_O_CREAT)
+ if (l_flags & LINUX_O_CREAT)
bsd_flags |= O_CREAT;
- if (args->flags & LINUX_O_TRUNC)
+ if (l_flags & LINUX_O_TRUNC)
bsd_flags |= O_TRUNC;
- if (args->flags & LINUX_O_EXCL)
+ if (l_flags & LINUX_O_EXCL)
bsd_flags |= O_EXCL;
- if (args->flags & LINUX_O_NOCTTY)
+ if (l_flags & LINUX_O_NOCTTY)
bsd_flags |= O_NOCTTY;
+ if (l_flags & LINUX_O_DIRECT)
+ bsd_flags |= O_DIRECT;
+ if (l_flags & LINUX_O_NOFOLLOW)
+ bsd_flags |= O_NOFOLLOW;
+ /* XXX LINUX_O_NOATIME: unable to be easily implemented. */
+
+ error = kern_open(td, path, UIO_SYSSPACE, bsd_flags, mode);
+ if (!error) {
+ fd = td->td_retval[0];
+ /*
+ * XXX In between kern_open() and fget(), another process
+ * having the same filedesc could use that fd without
+ * checking below.
+ */
+ error = fget(td, fd, &fp);
+ if (!error) {
+ sx_slock(&proctree_lock);
+ PROC_LOCK(p);
+ if (!(bsd_flags & O_NOCTTY) &&
+ SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
+ PROC_UNLOCK(p);
+ sx_unlock(&proctree_lock);
+ if (fp->f_type == DTYPE_VNODE)
+ (void) fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0,
+ td->td_ucred, td);
+ } else {
+ PROC_UNLOCK(p);
+ sx_sunlock(&proctree_lock);
+ }
+ if (l_flags & LINUX_O_DIRECTORY) {
+ if (fp->f_type != DTYPE_VNODE ||
+ fp->f_vnode->v_type != VDIR) {
+ error = ENOTDIR;
+ }
+ }
+ fdrop(fp, td);
+ /*
+ * XXX as above, fdrop()/kern_close() pair is racy.
+ */
+ if (error)
+ kern_close(td, fd);
+ }
+ }
- error = kern_open(td, path, UIO_SYSSPACE, bsd_flags, args->mode);
- PROC_LOCK(p);
- if (!error && !(bsd_flags & O_NOCTTY) &&
- SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
- struct file *fp;
+#ifdef DEBUG
+ if (ldebug(open))
+ printf(LMSG("open returns error %d"), error);
+#endif
+ if (!openat)
+ LFREEPATH(path);
+ return error;
+}
- PROC_UNLOCK(p);
- error = fget(td, td->td_retval[0], &fp);
+/*
+ * common code for linux *at set of syscalls
+ *
+ * works like this:
+ * if filename is absolute
+ * ignore dirfd
+ * else
+ * if dirfd == AT_FDCWD
+ * return CWD/filename
+ * else
+ * return DIRFD/filename
+ */
+static int
+linux_at(struct thread *td, int dirfd, char *filename, char **newpath, char **freebuf)
+{
+ struct file *fp;
+ int error = 0, vfslocked;
+ struct vnode *dvp;
+ struct filedesc *fdp = td->td_proc->p_fd;
+ char *fullpath = "unknown";
+ char *freepath = NULL;
+
+ /* don't do anything if the pathname is absolute */
+ if (*filename == '/') {
+ *newpath= filename;
+ return (0);
+ }
+
+ /* check for AT_FDWCD */
+ if (dirfd == LINUX_AT_FDCWD) {
+ FILEDESC_SLOCK(fdp);
+ dvp = fdp->fd_cdir;
+ vref(dvp);
+ FILEDESC_SUNLOCK(fdp);
+ } else {
+ error = fget(td, dirfd, &fp);
+ if (error)
+ return (error);
+ dvp = fp->f_vnode;
+ /* only a dir can be dfd */
+ if (dvp->v_type != VDIR) {
+ fdrop(fp, td);
+ return (ENOTDIR);
+ }
+ vref(dvp);
+ fdrop(fp, td);
+ }
+
+ /*
+ * XXXRW: This is bogus, as vn_fullpath() returns only an advisory
+ * file path, and may fail in several common situations, including
+ * for file systmes that don't use the name cache, and if the entry
+ * for the file falls out of the name cache. We should implement
+ * openat() in the FreeBSD native system call layer properly (using a
+ * requested starting directory), and have Linux and other ABIs wrap
+ * the native implementation.
+ */
+ error = vn_fullpath(td, dvp, &fullpath, &freepath);
if (!error) {
- if (fp->f_type == DTYPE_VNODE)
- fo_ioctl(fp, TIOCSCTTY, (caddr_t) 0, td->td_ucred,
- td);
- fdrop(fp, td);
+ *newpath = malloc(strlen(fullpath) + strlen(filename) + 2, M_TEMP, M_WAITOK | M_ZERO);
+ *freebuf = freepath;
+ sprintf(*newpath, "%s/%s", fullpath, filename);
+ } else {
+ *newpath = NULL;
+ }
+ vfslocked = VFS_LOCK_GIANT(dvp->v_mount);
+ vrele(dvp);
+ VFS_UNLOCK_GIANT(vfslocked);
+ return (error);
+}
+
+int
+linux_openat(struct thread *td, struct linux_openat_args *args)
+{
+ char *newpath, *oldpath, *freebuf, *path;
+ int error;
+
+ oldpath = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
+ error = copyinstr(args->filename, oldpath, MAXPATHLEN, NULL);
+ if (error) {
+ free(oldpath, M_TEMP);
+ return (error);
}
- } else {
- PROC_UNLOCK(p);
+#ifdef DEBUG
+ if (ldebug(openat))
+ printf(ARGS(openat, "%i, %s, 0x%x, 0x%x"), args->dfd,
+ oldpath, args->flags, args->mode);
+#endif
+ newpath = freebuf = NULL;
+ error = linux_at(td, args->dfd, oldpath, &newpath, &freebuf);
+ if (error == 0) {
+#ifdef DEBUG
+ if (ldebug(openat))
+ printf(LMSG("newpath: %s"), newpath);
+#endif
+ if (args->flags & LINUX_O_CREAT)
+ LCONVPATH_SEG(td, newpath, &path, 1, UIO_SYSSPACE);
+ else
+ LCONVPATH_SEG(td, newpath, &path, 0, UIO_SYSSPACE);
+ }
+ if (freebuf)
+ free(freebuf, M_TEMP);
+ if (*oldpath != '/')
+ free(newpath, M_TEMP);
+ if (error == 0) {
+ error = linux_common_open(td, path, args->flags,
+ args->mode, 1);
+ LFREEPATH(path);
+ }
+ free(oldpath, M_TEMP);
+ return (error);
+}
+
+int
+linux_open(struct thread *td, struct linux_open_args *args)
+{
+ char *path;
+
+ if (args->flags & LINUX_O_CREAT)
+ LCONVPATHCREAT(td, args->path, &path);
+ else
+ LCONVPATHEXIST(td, args->path, &path);
+
#ifdef DEBUG
if (ldebug(open))
- printf(LMSG("open returns error %d"), error);
+ printf(ARGS(open, "%s, 0x%x, 0x%x"),
+ path, args->flags, args->mode);
#endif
- }
- LFREEPATH(path);
- return error;
+
+ return linux_common_open(td, path, args->flags, args->mode, 0);
}
int
@@ -177,7 +333,6 @@
return error;
}
-#ifndef __alpha__
int
linux_llseek(struct thread *td, struct linux_llseek_args *args)
{
@@ -205,9 +360,7 @@
td->td_retval[0] = 0;
return 0;
}
-#endif /*!__alpha__*/
-#ifndef __alpha__
int
linux_readdir(struct thread *td, struct linux_readdir_args *args)
{
@@ -218,7 +371,6 @@
lda.count = 1;
return linux_getdents(td, &lda);
}
-#endif /*!__alpha__*/
/*
* Note that linux_getdents(2) and linux_getdents64(2) have the same
@@ -267,7 +419,17 @@
struct l_dirent64 linux_dirent64;
int buflen, error, eofflag, nbytes, justone;
u_long *cookies = NULL, *cookiep;
- int ncookies;
+ int ncookies, vfslocked;
+
+ nbytes = args->count;
+ if (nbytes == 1) {
+ /* readdir(2) case. Always struct dirent. */
+ if (is64bit)
+ return (EINVAL);
+ nbytes = sizeof(linux_dirent);
+ justone = 1;
+ } else
+ justone = 0;
if ((error = getvnode(td->td_proc->p_fd, args->fd, &fp)) != 0)
return (error);
@@ -278,23 +440,13 @@
}
vp = fp->f_vnode;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
if (vp->v_type != VDIR) {
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
return (EINVAL);
}
- nbytes = args->count;
- if (nbytes == 1) {
- /* readdir(2) case. Always struct dirent. */
- if (is64bit) {
- fdrop(fp, td);
- return (EINVAL);
- }
- nbytes = sizeof(linux_dirent);
- justone = 1;
- } else
- justone = 0;
-
off = fp->f_offset;
buflen = max(LINUX_DIRBLKSIZ, nbytes);
@@ -447,6 +599,7 @@
free(cookies, M_TEMP);
VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
free(buf, M_TEMP);
return (error);
@@ -486,6 +639,10 @@
char *path;
int error;
+ /* linux convention */
+ if (args->flags & ~(F_OK | X_OK | W_OK | R_OK))
+ return (EINVAL);
+
LCONVPATHEXIST(td, args->path, &path);
#ifdef DEBUG
@@ -494,6 +651,7 @@
#endif
error = kern_access(td, path, UIO_SYSSPACE, args->flags);
LFREEPATH(path);
+
return (error);
}
@@ -502,6 +660,7 @@
{
char *path;
int error;
+ struct stat st;
LCONVPATHEXIST(td, args->path, &path);
@@ -511,6 +670,11 @@
#endif
error = kern_unlink(td, path, UIO_SYSSPACE);
+ if (error == EPERM)
+ /* Introduce POSIX noncompliant behaviour of Linux */
+ if (kern_stat(td, path, UIO_SYSSPACE, &st) == 0)
+ if (S_ISDIR(st.st_mode))
+ error = EISDIR;
LFREEPATH(path);
return (error);
}
@@ -669,6 +833,20 @@
}
int
+linux_ftruncate(struct thread *td, struct linux_ftruncate_args *args)
+{
+ struct ftruncate_args /* {
+ int fd;
+ int pad;
+ off_t length;
+ } */ nuap;
+
+ nuap.fd = args->fd;
+ nuap.length = args->length;
+ return (ftruncate(td, &nuap));
+}
+
+int
linux_link(struct thread *td, struct linux_link_args *args)
{
char *path, *to;
@@ -692,7 +870,6 @@
return (error);
}
-#ifndef __alpha__
int
linux_fdatasync(td, uap)
struct thread *td;
@@ -703,7 +880,6 @@
bsd.fd = uap->fd;
return fsync(td, &bsd);
}
-#endif /*!__alpha__*/
int
linux_pread(td, uap)
@@ -711,12 +887,28 @@
struct linux_pread_args *uap;
{
struct pread_args bsd;
+ struct vnode *vp;
+ int error;
bsd.fd = uap->fd;
bsd.buf = uap->buf;
bsd.nbyte = uap->nbyte;
bsd.offset = uap->offset;
- return pread(td, &bsd);
+
+ error = pread(td, &bsd);
+
+ if (error == 0) {
+ /* This seems to violate POSIX but linux does it */
+ if ((error = fgetvp(td, uap->fd, &vp)) != 0)
+ return (error);
+ if (vp->v_type == VDIR) {
+ vrele(vp);
+ return (EISDIR);
+ }
+ vrele(vp);
+ }
+
+ return (error);
}
int
@@ -938,10 +1130,6 @@
}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
-#if defined(__alpha__)
-#define linux_fcntl64_args linux_fcntl_args
-#endif
-
static int
fcntl_common(struct thread *td, struct linux_fcntl64_args *args)
{
Index: linux_ioctl.h
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_ioctl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_ioctl.h -L sys/compat/linux/linux_ioctl.h -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_ioctl.h
+++ sys/compat/linux/linux_ioctl.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_ioctl.h,v 1.22 2005/01/05 22:34:35 imp Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_ioctl.h,v 1.26.2.1 2007/11/15 10:38:06 kib Exp $
*/
#ifndef _LINUX_IOCTL_H_
@@ -103,6 +103,8 @@
#define LINUX_CDROM_DEBUG 0x5330
#define LINUX_CDROM_GET_CAPABILITY 0x5331
#define LINUX_CDROMAUDIOBUFSIZ 0x5382
+#define LINUX_SCSI_GET_IDLUN 0x5382
+#define LINUX_SCSI_GET_BUS_NUMBER 0x5386
#define LINUX_DVD_READ_STRUCT 0x5390
#define LINUX_DVD_WRITE_STRUCT 0x5391
#define LINUX_DVD_AUTH 0x5392
@@ -130,6 +132,38 @@
#define LINUX_DVD_HOST_SEND_RPC_STATE 11
/*
+ * SG
+ */
+#define LINUX_SG_SET_TIMEOUT 0x2201
+#define LINUX_SG_GET_TIMEOUT 0x2202
+#define LINUX_SG_EMULATED_HOST 0x2203
+#define LINUX_SG_SET_TRANSFORM 0x2204
+#define LINUX_SG_GET_TRANSFORM 0x2205
+#define LINUX_SG_GET_COMMAND_Q 0x2270
+#define LINUX_SG_SET_COMMAND_Q 0x2271
+#define LINUX_SG_SET_RESERVED_SIZE 0x2275
+#define LINUX_SG_GET_RESERVED_SIZE 0x2272
+#define LINUX_SG_GET_SCSI_ID 0x2276
+#define LINUX_SG_SET_FORCE_LOW_DMA 0x2279
+#define LINUX_SG_GET_LOW_DMA 0x227a
+#define LINUX_SG_SET_FORCE_PACK_ID 0x227b
+#define LINUX_SG_GET_PACK_ID 0x227c
+#define LINUX_SG_GET_NUM_WAITING 0x227d
+#define LINUX_SG_SET_DEBUG 0x227e
+#define LINUX_SG_GET_SG_TABLESIZE 0x227f
+#define LINUX_SG_GET_VERSION_NUM 0x2282
+#define LINUX_SG_NEXT_CMD_LEN 0x2283
+#define LINUX_SG_SCSI_RESET 0x2284
+#define LINUX_SG_IO 0x2285
+#define LINUX_SG_GET_REQUEST_TABLE 0x2286
+#define LINUX_SG_SET_KEEP_ORPHAN 0x2287
+#define LINUX_SG_GET_KEEP_ORPHAN 0x2288
+#define LINUX_SG_GET_ACCESS_COUNT 0x2289
+
+#define LINUX_IOCTL_SG_MIN 0x2200
+#define LINUX_IOCTL_SG_MAX 0x22ff
+
+/*
* VFAT
*/
#define LINUX_VFAT_READDIR_BOTH 0x7201
@@ -196,9 +230,12 @@
#define LINUX_SIOCGIFHWADDR 0x8927
#define LINUX_SIOCADDMULTI 0x8931
#define LINUX_SIOCDELMULTI 0x8932
+#define LINUX_SIOCGIFINDEX 0x8933
+#define LINUX_SIOGIFINDEX LINUX_SIOCGIFINDEX
+#define LINUX_SIOCGIFCOUNT 0x8938
#define LINUX_IOCTL_SOCKET_MIN LINUX_FIOSETOWN
-#define LINUX_IOCTL_SOCKET_MAX LINUX_SIOCDELMULTI
+#define LINUX_IOCTL_SOCKET_MAX LINUX_SIOCGIFCOUNT
/*
* Device private ioctl calls
@@ -278,19 +315,6 @@
/*
* termio
*/
-#ifdef __alpha__
-#define LINUX_TCGETS 0x7413
-#define LINUX_TCSETS 0x7414
-#define LINUX_TCSETSW 0x7415
-#define LINUX_TCSETSF 0x7416
-#define LINUX_TCGETA 0x7417
-#define LINUX_TCSETA 0x7418
-#define LINUX_TCSETAW 0x7419
-#define LINUX_TCSETAF 0x741c
-#define LINUX_TCSBRK 0x741d
-#define LINUX_TCXONC 0x741e
-#define LINUX_TCFLSH 0x741f
-#else
#define LINUX_TCGETS 0x5401
#define LINUX_TCSETS 0x5402
#define LINUX_TCSETSW 0x5403
@@ -302,30 +326,19 @@
#define LINUX_TCSBRK 0x5409
#define LINUX_TCXONC 0x540A
#define LINUX_TCFLSH 0x540B
-#endif
#define LINUX_TIOCEXCL 0x540C
#define LINUX_TIOCNXCL 0x540D
#define LINUX_TIOCSCTTY 0x540E
-#ifdef __alpha__
-#define LINUX_TIOCSPGRP 0x7476
-#define LINUX_TIOCGPGRP 0x7477
-#else
#define LINUX_TIOCGPGRP 0x540F
#define LINUX_TIOCSPGRP 0x5410
-#endif
#define LINUX_TIOCOUTQ 0x5411
#define LINUX_TIOCSTI 0x5412
-#ifdef __alpha__
-#define LINUX_TIOCSWINSZ 0x7467
-#define LINUX_TIOCGWINSZ 0x7468
-#else
#define LINUX_TIOCGWINSZ 0x5413
#define LINUX_TIOCSWINSZ 0x5414
-#endif
#define LINUX_TIOCMGET 0x5415
#define LINUX_TIOCMBIS 0x5416
@@ -334,11 +347,7 @@
#define LINUX_TIOCGSOFTCAR 0x5419
#define LINUX_TIOCSSOFTCAR 0x541A
-#ifdef __alpha__
-#define LINUX_FIONREAD 0x667f
-#else
#define LINUX_FIONREAD 0x541B
-#endif
#define LINUX_TIOCINQ FIONREAD
#define LINUX_TIOCLINUX 0x541C
@@ -347,11 +356,7 @@
#define LINUX_TIOCSSERIAL 0x541F
#define LINUX_TIOCPKT 0x5420
-#ifdef __alpha__
-#define LINUX_FIONBIO 0x667e
-#else
#define LINUX_FIONBIO 0x5421
-#endif
#define LINUX_TIOCNOTTY 0x5422
#define LINUX_TIOCSETD 0x5423
@@ -362,15 +367,11 @@
#define LINUX_TIOCSBRK 0x5427
#define LINUX_TIOCCBRK 0x5428
-#ifdef __alpha__
-#define LINUX_FIOCLEX 0x6601
-#define LINUX_FIONCLEX 0x6602
-#define LINUX_FIOASYNC 0x667d
-#else
+#define LINUX_TIOCGPTN 0x5430
+
#define LINUX_FIONCLEX 0x5450
#define LINUX_FIOCLEX 0x5451
#define LINUX_FIOASYNC 0x5452
-#endif
#define LINUX_TIOCSERCONFIG 0x5453
#define LINUX_TIOCSERGWILD 0x5454
@@ -378,13 +379,8 @@
#define LINUX_TIOCGLCKTRMIOS 0x5456
#define LINUX_TIOCSLCKTRMIOS 0x5457
-#ifdef __alpha__
-#define LINUX_IOCTL_TERMIO_MIN LINUX_TIOCEXCL
-#define LINUX_IOCTL_TERMIO_MAX LINUX_TIOCGPGRP
-#else
#define LINUX_IOCTL_TERMIO_MIN LINUX_TCGETS
#define LINUX_IOCTL_TERMIO_MAX LINUX_TIOCSLCKTRMIOS
-#endif
/* arguments for tcflow() and LINUX_TCXONC */
#define LINUX_TCOOFF 0
@@ -404,18 +400,6 @@
#define LINUX_N_PPP 3
/* Linux termio c_cc values */
-#ifdef __alpha__
-#define LINUX__VINTR 0
-#define LINUX__VQUIT 1
-#define LINUX__VERASE 2
-#define LINUX__VKILL 3
-#define LINUX__VEOF 4
-#define LINUX__VMIN 4
-#define LINUX__VEOL 5
-#define LINUX__VTIME 5
-#define LINUX__VEOL2 6
-#define LINUX__VSWTC 7
-#else
#define LINUX_VINTR 0
#define LINUX_VQUIT 1
#define LINUX_VERASE 2
@@ -424,29 +408,9 @@
#define LINUX_VTIME 5
#define LINUX_VMIN 6
#define LINUX_VSWTC 7
-#endif
#define LINUX_NCC 8
/* Linux termios c_cc values */
-#ifdef __alpha__
-#define LINUX_VEOF 0
-#define LINUX_VEOL 1
-#define LINUX_VEOL2 2
-#define LINUX_VERASE 3
-#define LINUX_VWERASE 4
-#define LINUX_VKILL 5
-#define LINUX_VREPRINT 6
-#define LINUX_VSWTC 7
-#define LINUX_VINTR 8
-#define LINUX_VQUIT 9
-#define LINUX_VSUSP 10
-#define LINUX_VSTART 12
-#define LINUX_VSTOP 13
-#define LINUX_VLNEXT 14
-#define LINUX_VDISCARD 15
-#define LINUX_VMIN 16
-#define LINUX_VTIME 17
-#else
/* In addition to the termio values */
#define LINUX_VSTART 8
#define LINUX_VSTOP 9
@@ -457,7 +421,6 @@
#define LINUX_VWERASE 14
#define LINUX_VLNEXT 15
#define LINUX_VEOL2 16
-#endif
#define LINUX_NCCS 19
#define LINUX_POSIX_VDISABLE '\0'
@@ -473,30 +436,18 @@
#define LINUX_IGNCR 0x0000080
#define LINUX_ICRNL 0x0000100
-#ifdef __alpha__
-#define LINUX_IXON 0x0000200
-#define LINUX_IXOFF 0x0000400
-#define LINUX_IXANY 0x0000800
-#define LINUX_IUCLC 0x0001000
-#else
#define LINUX_IUCLC 0x0000200
#define LINUX_IXON 0x0000400
#define LINUX_IXANY 0x0000800
#define LINUX_IXOFF 0x0001000
-#endif
#define LINUX_IMAXBEL 0x0002000
/* Linux c_oflag masks */
#define LINUX_OPOST 0x0000001
-#ifdef __alpha__
-#define LINUX_ONLCR 0x0000002
-#define LINUX_OLCUC 0x0000004
-#else
#define LINUX_OLCUC 0x0000002
#define LINUX_ONLCR 0x0000004
-#endif
#define LINUX_OCRNL 0x0000008
#define LINUX_ONOCR 0x0000010
@@ -504,33 +455,6 @@
#define LINUX_OFILL 0x0000040
#define LINUX_OFDEL 0x0000080
-#ifdef __alpha__
-#define LINUX_NLDLY 0x0000300
-#define LINUX_NL0 0x0000000
-#define LINUX_NL1 0x0000100
-#define LINUX_NL2 0x0000200
-#define LINUX_NL3 0x0000300
-#define LINUX_TABDLY 0x000C000
-#define LINUX_TAB0 0x0000000
-#define LINUX_TAB1 0x0004000
-#define LINUX_TAB2 0x0008000
-#define LINUX_TAB3 0x000C000
-#define LINUX_CRDLY 0x0030000
-#define LINUX_CR0 0x0000000
-#define LINUX_CR1 0x0010000
-#define LINUX_CR2 0x0020000
-#define LINUX_CR3 0x0030000
-#define LINUX_FFDLY 0x0040000
-#define LINUX_FF0 0x0000000
-#define LINUX_FF1 0x0040000
-#define LINUX_BSDLY 0x0080000
-#define LINUX_BS0 0x0000000
-#define LINUX_BS1 0x0080000
-#define LINUX_VTDLY 0x0100000
-#define LINUX_VT0 0x0000000
-#define LINUX_VT1 0x0100000
-#define LINUX_XTABS 0x0200000
-#else
#define LINUX_NLDLY 0x0000100
#define LINUX_NL0 0x0000000
#define LINUX_NL1 0x0000100
@@ -554,13 +478,8 @@
#define LINUX_FFDLY 0x0008000
#define LINUX_FF0 0x0000000
#define LINUX_FF1 0x0008000
-#endif
-#ifdef __alpha__
-#define LINUX_CBAUD 0x0000001f
-#else
#define LINUX_CBAUD 0x0000100f
-#endif
#define LINUX_B0 0x00000000
#define LINUX_B50 0x00000001
@@ -581,29 +500,10 @@
#define LINUX_EXTA LINUX_B19200
#define LINUX_EXTB LINUX_B38400
-#ifdef __alpha__
-#define LINUX_CBAUDEX 0x00000000
-#define LINUX_B57600 0x00000010
-#define LINUX_B115200 0x00000011
-#else
#define LINUX_CBAUDEX 0x00001000
#define LINUX_B57600 0x00001001
#define LINUX_B115200 0x00001002
-#endif
-#ifdef __alpha__
-#define LINUX_CSIZE 0x00000300
-#define LINUX_CS5 0x00000000
-#define LINUX_CS6 0x00000100
-#define LINUX_CS7 0x00000200
-#define LINUX_CS8 0x00000300
-#define LINUX_CSTOPB 0x00000400
-#define LINUX_CREAD 0x00000800
-#define LINUX_PARENB 0x00001000
-#define LINUX_PARODD 0x00002000
-#define LINUX_HUPCL 0x00004000
-#define LINUX_CLOCAL 0x00008000
-#else
#define LINUX_CSIZE 0x00000030
#define LINUX_CS5 0x00000000
#define LINUX_CS6 0x00000010
@@ -615,28 +515,10 @@
#define LINUX_PARODD 0x00000200
#define LINUX_HUPCL 0x00000400
#define LINUX_CLOCAL 0x00000800
-#endif
#define LINUX_CRTSCTS 0x80000000
/* Linux c_lflag masks */
-#ifdef __alpha__
-#define LINUX_ECHOKE 0x00000001
-#define LINUX_ECHOE 0x00000002
-#define LINUX_ECHOK 0x00000004
-#define LINUX_ECHO 0x00000008
-#define LINUX_ECHONL 0x00000010
-#define LINUX_ECHOPRT 0x00000020
-#define LINUX_ECHOCTL 0x00000040
-#define LINUX_ISIG 0x00000080
-#define LINUX_ICANON 0x00000100
-#define LINUX_IEXTEN 0x00000400
-#define LINUX_XCASE 0x00004000
-#define LINUX_TOSTOP 0x00400000
-#define LINUX_FLUSHO 0x00800000
-#define LINUX_PENDIN 0x20000000
-#define LINUX_NOFLSH 0x80000000
-#else
#define LINUX_ISIG 0x00000001
#define LINUX_ICANON 0x00000002
#define LINUX_XCASE 0x00000004
@@ -652,7 +534,6 @@
#define LINUX_FLUSHO 0x00001000
#define LINUX_PENDIN 0x00002000
#define LINUX_IEXTEN 0x00008000
-#endif
/* serial_struct values for TIOC[GS]SERIAL ioctls */
#define LINUX_ASYNC_CLOSING_WAIT_INF 0
Index: linux_util.h
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_util.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/linux/linux_util.h -L sys/compat/linux/linux_util.h -u -r1.1.1.2 -r1.2
--- sys/compat/linux/linux_util.h
+++ sys/compat/linux/linux_util.h
@@ -28,7 +28,7 @@
*
* from: svr4_util.h,v 1.5 1994/11/18 02:54:31 christos Exp
* from: linux_util.h,v 1.2 1995/03/05 23:23:50 fvdl Exp
- * $FreeBSD: src/sys/compat/linux/linux_util.h,v 1.25.2.1 2005/12/19 17:06:51 glebius Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_util.h,v 1.29 2007/03/29 02:11:45 julian Exp $
*/
/*
@@ -49,46 +49,23 @@
#include <sys/cdefs.h>
#include <sys/uio.h>
-static __inline caddr_t stackgap_init(void);
-static __inline void *stackgap_alloc(caddr_t *, size_t);
-
-#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
-#define psstrings (curthread->td_proc->p_sysent->sv_psstrings)
-
-static __inline caddr_t
-stackgap_init()
-{
- return (caddr_t)(psstrings - szsigcode - SPARE_USRSPACE);
-}
-
-static __inline void *
-stackgap_alloc(sgp, sz)
- caddr_t *sgp;
- size_t sz;
-{
- void *p = (void *) *sgp;
-
- sz = ALIGN(sz);
- if (*sgp + sz > (caddr_t)(psstrings - szsigcode))
- return NULL;
- *sgp += sz;
- return p;
-}
-
extern const char linux_emul_path[];
int linux_emul_convpath(struct thread *, char *, enum uio_seg, char **, int);
-#define LCONVPATH(td, upath, pathp, i) \
+#define LCONVPATH_SEG(td, upath, pathp, i, seg) \
do { \
int _error; \
\
- _error = linux_emul_convpath(td, upath, UIO_USERSPACE, \
+ _error = linux_emul_convpath(td, upath, seg, \
pathp, i); \
if (*(pathp) == NULL) \
return (_error); \
} while (0)
+#define LCONVPATH(td, upath, pathp, i) \
+ LCONVPATH_SEG(td, upath, pathp, i, UIO_USERSPACE)
+
#define LCONVPATHEXIST(td, upath, pathp) LCONVPATH(td, upath, pathp, 0)
#define LCONVPATHCREAT(td, upath, pathp) LCONVPATH(td, upath, pathp, 1)
#define LFREEPATH(path) free(path, M_TEMP)
@@ -110,4 +87,21 @@
void linux_msg(const struct thread *td, const char *fmt, ...)
__printflike(2, 3);
+struct linux_device_handler {
+ char *bsd_driver_name;
+ char *linux_driver_name;
+ char *bsd_device_name;
+ char *linux_device_name;
+ int linux_major;
+ int linux_minor;
+ int linux_char_device;
+};
+
+int linux_device_register_handler(struct linux_device_handler *h);
+int linux_device_unregister_handler(struct linux_device_handler *h);
+char *linux_driver_get_name_dev(device_t dev);
+int linux_driver_get_major_minor(char *node, int *major, int *minor);
+char *linux_get_char_devices(void);
+void linux_free_get_char_devices(char *string);
+
#endif /* !_LINUX_UTIL_H_ */
Index: linux_stats.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_stats.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/compat/linux/linux_stats.c -L sys/compat/linux/linux_stats.c -u -r1.2 -r1.3
--- sys/compat/linux/linux_stats.c
+++ sys/compat/linux/linux_stats.c
@@ -27,8 +27,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.72.2.1 2006/03/13 03:04:07 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_stats.c,v 1.88.4.1 2008/01/09 16:03:02 kib Exp $");
+#include "opt_compat.h"
#include "opt_mac.h"
#include <sys/param.h>
@@ -37,7 +38,6 @@
#include <sys/filedesc.h>
#include <sys/proc.h>
#include <sys/jail.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/namei.h>
@@ -45,8 +45,8 @@
#include <sys/syscallsubr.h>
#include <sys/systm.h>
#include <sys/vnode.h>
-
-#include "opt_compat.h"
+#include <sys/conf.h>
+#include <sys/fcntl.h>
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
@@ -58,6 +58,8 @@
#include <compat/linux/linux_util.h>
+#include <security/mac/mac_framework.h>
+
/*
* XXX: This was removed from newstat_copyout(), and almost identical
* XXX: code was in stat64_copyout(). findcdev() needs to be replaced
@@ -94,6 +96,42 @@
}
#endif
+static void
+translate_fd_major_minor(struct thread *td, int fd, struct stat *buf)
+{
+ struct file *fp;
+ int major, minor;
+
+ if ((!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode)) ||
+ fget(td, fd, &fp) != 0)
+ return;
+ if (fp->f_vnode != NULL &&
+ fp->f_vnode->v_un.vu_cdev != NULL &&
+ linux_driver_get_major_minor(fp->f_vnode->v_un.vu_cdev->si_name,
+ &major, &minor) == 0)
+ buf->st_rdev = (major << 8 | minor);
+ fdrop(fp, td);
+}
+
+static void
+translate_path_major_minor(struct thread *td, char *path, struct stat *buf)
+{
+ struct proc *p = td->td_proc;
+ struct filedesc *fdp = p->p_fd;
+ int fd;
+ int temp;
+
+ if (!S_ISCHR(buf->st_mode) && !S_ISBLK(buf->st_mode))
+ return;
+ temp = td->td_retval[0];
+ if (kern_open(td, path, UIO_SYSSPACE, O_RDONLY, 0) != 0)
+ return;
+ fd = td->td_retval[0];
+ td->td_retval[0] = temp;
+ translate_fd_major_minor(td, fd, buf);
+ fdclose(fdp, fdp->fd_ofiles[fd], fd, td);
+}
+
static int
newstat_copyout(struct stat *buf, void *ubuf)
{
@@ -132,6 +170,19 @@
#endif
error = kern_stat(td, path, UIO_SYSSPACE, &buf);
+ if (!error) {
+ if (strlen(path) > strlen("/dev/pts/") &&
+ !strncmp(path, "/dev/pts/", strlen("/dev/pts/")) &&
+ path[9] >= '0' && path[9] <= '9') {
+ /*
+ * Linux checks major and minors of the slave device
+ * to make sure it's a pty device, so let's make him
+ * believe it is.
+ */
+ buf.st_rdev = (136 << 8);
+ } else
+ translate_path_major_minor(td, path, &buf);
+ }
LFREEPATH(path);
if (error)
return (error);
@@ -153,6 +204,8 @@
#endif
error = kern_lstat(td, path, UIO_SYSSPACE, &sb);
+ if (!error)
+ translate_path_major_minor(td, path, &sb);
LFREEPATH(path);
if (error)
return (error);
@@ -171,12 +224,87 @@
#endif
error = kern_fstat(td, args->fd, &buf);
+ translate_fd_major_minor(td, args->fd, &buf);
if (!error)
error = newstat_copyout(&buf, args->buf);
return (error);
}
+static int
+stat_copyout(struct stat *buf, void *ubuf)
+{
+ struct l_stat lbuf;
+
+ bzero(&lbuf, sizeof(lbuf));
+ lbuf.st_dev = buf->st_dev;
+ lbuf.st_ino = buf->st_ino;
+ lbuf.st_mode = buf->st_mode;
+ lbuf.st_nlink = buf->st_nlink;
+ lbuf.st_uid = buf->st_uid;
+ lbuf.st_gid = buf->st_gid;
+ lbuf.st_rdev = buf->st_rdev;
+ if (buf->st_size < (quad_t)1 << 32)
+ lbuf.st_size = buf->st_size;
+ else
+ lbuf.st_size = -2;
+ lbuf.st_atime = buf->st_atime;
+ lbuf.st_mtime = buf->st_mtime;
+ lbuf.st_ctime = buf->st_ctime;
+ lbuf.st_blksize = buf->st_blksize;
+ lbuf.st_blocks = buf->st_blocks;
+ lbuf.st_flags = buf->st_flags;
+ lbuf.st_gen = buf->st_gen;
+
+ return (copyout(&lbuf, ubuf, sizeof(lbuf)));
+}
+
+int
+linux_stat(struct thread *td, struct linux_stat_args *args)
+{
+ struct stat buf;
+ char *path;
+ int error;
+
+ LCONVPATHEXIST(td, args->path, &path);
+
+#ifdef DEBUG
+ if (ldebug(stat))
+ printf(ARGS(stat, "%s, *"), path);
+#endif
+ error = kern_stat(td, path, UIO_SYSSPACE, &buf);
+ if (error) {
+ LFREEPATH(path);
+ return (error);
+ }
+ translate_path_major_minor(td, path, &buf);
+ LFREEPATH(path);
+ return(stat_copyout(&buf, args->up));
+}
+
+int
+linux_lstat(struct thread *td, struct linux_lstat_args *args)
+{
+ struct stat buf;
+ char *path;
+ int error;
+
+ LCONVPATHEXIST(td, args->path, &path);
+
+#ifdef DEBUG
+ if (ldebug(lstat))
+ printf(ARGS(lstat, "%s, *"), path);
+#endif
+ error = kern_lstat(td, path, UIO_SYSSPACE, &buf);
+ if (error) {
+ LFREEPATH(path);
+ return (error);
+ }
+ translate_path_major_minor(td, path, &buf);
+ LFREEPATH(path);
+ return(stat_copyout(&buf, args->up));
+}
+
/* XXX - All fields of type l_int are defined as l_long on i386 */
struct l_statfs {
l_int f_type;
@@ -201,6 +329,7 @@
#define LINUX_NTFS_SUPER_MAGIC 0x5346544EL
#define LINUX_PROC_SUPER_MAGIC 0x9fa0L
#define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */
+#define LINUX_DEVFS_SUPER_MAGIC 0x1373L
static long
bsd_to_linux_ftype(const char *fstypename)
@@ -217,6 +346,7 @@
{"nwfs", LINUX_NCP_SUPER_MAGIC},
{"hpfs", LINUX_HPFS_SUPER_MAGIC},
{"coda", LINUX_CODA_SUPER_MAGIC},
+ {"devfs", LINUX_DEVFS_SUPER_MAGIC},
{NULL, 0L}};
for (i = 0; b2l_tbl[i].bsd_name != NULL; i++)
@@ -264,6 +394,47 @@
return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
}
+static void
+bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs)
+{
+
+ linux_statfs->f_type = bsd_to_linux_ftype(bsd_statfs->f_fstypename);
+ linux_statfs->f_bsize = bsd_statfs->f_bsize;
+ linux_statfs->f_blocks = bsd_statfs->f_blocks;
+ linux_statfs->f_bfree = bsd_statfs->f_bfree;
+ linux_statfs->f_bavail = bsd_statfs->f_bavail;
+ linux_statfs->f_ffree = bsd_statfs->f_ffree;
+ linux_statfs->f_files = bsd_statfs->f_files;
+ linux_statfs->f_fsid.val[0] = bsd_statfs->f_fsid.val[0];
+ linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
+ linux_statfs->f_namelen = MAXNAMLEN;
+}
+
+int
+linux_statfs64(struct thread *td, struct linux_statfs64_args *args)
+{
+ struct l_statfs64 linux_statfs;
+ struct statfs bsd_statfs;
+ char *path;
+ int error;
+
+ if (args->bufsize != sizeof(struct l_statfs64))
+ return EINVAL;
+
+ LCONVPATHEXIST(td, args->path, &path);
+
+#ifdef DEBUG
+ if (ldebug(statfs64))
+ printf(ARGS(statfs64, "%s, *"), path);
+#endif
+ error = kern_statfs(td, path, UIO_SYSSPACE, &bsd_statfs);
+ LFREEPATH(path);
+ if (error)
+ return (error);
+ bsd_to_linux_statfs64(&bsd_statfs, &linux_statfs);
+ return copyout(&linux_statfs, args->buf, sizeof(linux_statfs));
+}
+
int
linux_fstatfs(struct thread *td, struct linux_fstatfs_args *args)
{
@@ -349,6 +520,19 @@
#endif
error = kern_stat(td, filename, UIO_SYSSPACE, &buf);
+ if (!error) {
+ if (strlen(filename) > strlen("/dev/pts/") &&
+ !strncmp(filename, "/dev/pts/", strlen("/dev/pts/")) &&
+ filename[9] >= '0' && filename[9] <= '9') {
+ /*
+ * Linux checks major and minors of the slave device
+ * to make sure it's a pty deivce, so let's make him
+ * believe it is.
+ */
+ buf.st_rdev = (136 << 8);
+ } else
+ translate_path_major_minor(td, filename, &buf);
+ }
LFREEPATH(filename);
if (error)
return (error);
@@ -370,6 +554,8 @@
#endif
error = kern_lstat(td, filename, UIO_SYSSPACE, &sb);
+ if (!error)
+ translate_path_major_minor(td, filename, &sb);
LFREEPATH(filename);
if (error)
return (error);
@@ -388,6 +574,7 @@
#endif
error = kern_fstat(td, args->fd, &buf);
+ translate_fd_major_minor(td, args->fd, &buf);
if (!error)
error = stat64_copyout(&buf, args->statbuf);
--- /dev/null
+++ sys/compat/linux/linux_misc.h
@@ -0,0 +1,45 @@
+/*-
+ * Copyright (c) 2006 Roman Divacky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/compat/linux/linux_misc.h,v 1.2 2006/12/31 11:56:16 netchild Exp $
+ */
+
+#ifndef _LINUX_MISC_H_
+#define _LINUX_MISC_H_
+
+/* defines for prctl */
+#define LINUX_PR_SET_PDEATHSIG 1 /* Second arg is a signal. */
+#define LINUX_PR_GET_PDEATHSIG 2 /*
+ * Second arg is a ptr to return the
+ * signal.
+ */
+#define LINUX_PR_SET_NAME 15 /* Set process name. */
+#define LINUX_PR_GET_NAME 16 /* Get process name. */
+
+#define LINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */
+
+#endif /* _LINUX_MISC_H_ */
Index: linux_mib.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_mib.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/linux/linux_mib.c -L sys/compat/linux/linux_mib.c -u -r1.1.1.2 -r1.2
--- sys/compat/linux/linux_mib.c
+++ sys/compat/linux/linux_mib.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.23.2.1 2005/12/22 21:25:19 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_mib.c,v 1.29 2007/01/14 16:07:01 netchild Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -52,6 +52,7 @@
char pr_osname[LINUX_MAX_UTSNAME];
char pr_osrelease[LINUX_MAX_UTSNAME];
int pr_oss_version;
+ int pr_use_linux26; /* flag to determine whether to use 2.6 emulation */
};
SYSCTL_NODE(_compat, OID_AUTO, linux, CTLFLAG_RW, 0,
@@ -82,6 +83,7 @@
"Linux kernel OS name");
static char linux_osrelease[LINUX_MAX_UTSNAME] = "2.4.2";
+static int linux_use_linux26 = 0;
static int
linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS)
@@ -227,19 +229,42 @@
}
int
+linux_use26(struct thread *td)
+{
+ struct prison *pr;
+ struct linux_prison *lpr;
+ int use26 = linux_use_linux26;
+
+ pr = td->td_ucred->cr_prison;
+ if (pr != NULL) {
+ if (pr->pr_linux != NULL) {
+ lpr = (struct linux_prison *)pr->pr_linux;
+ use26 = lpr->pr_use_linux26;
+ }
+ }
+
+ return (use26);
+}
+
+int
linux_set_osrelease(struct thread *td, char *osrelease)
{
struct prison *pr;
struct linux_prison *lpr;
+ int use26;
+
+ use26 = (strlen(osrelease) >= 3 && osrelease[2] == '6');
pr = linux_get_prison(td);
if (pr != NULL) {
lpr = (struct linux_prison *)pr->pr_linux;
strcpy(lpr->pr_osrelease, osrelease);
+ lpr->pr_use_linux26 = use26;
mtx_unlock(&pr->pr_mtx);
} else {
mtx_lock(&osname_lock);
strcpy(linux_osrelease, osrelease);
+ linux_use_linux26 = use26;
mtx_unlock(&osname_lock);
}
--- /dev/null
+++ sys/compat/linux/linux_emul.h
@@ -0,0 +1,80 @@
+/*-
+ * Copyright (c) 2006 Roman Divacky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/compat/linux/linux_emul.h,v 1.7 2007/04/02 18:38:13 jkim Exp $
+ */
+
+#ifndef _LINUX_EMUL_H_
+#define _LINUX_EMUL_H_
+
+struct linux_emuldata_shared {
+ int refs;
+ pid_t group_pid;
+
+ LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */
+};
+
+/*
+ * modeled after similar structure in NetBSD
+ * this will be extended as we need more functionality
+ */
+struct linux_emuldata {
+ pid_t pid;
+
+ int *child_set_tid; /* in clone(): Child's TID to set on clone */
+ int *child_clear_tid;/* in clone(): Child's TID to clear on exit */
+
+ struct linux_emuldata_shared *shared;
+
+ int pdeath_signal; /* parent death signal */
+
+ LIST_ENTRY(linux_emuldata) threads; /* list of linux threads */
+};
+
+struct linux_emuldata *em_find(struct proc *, int locked);
+
+#define EMUL_LOCK(l) mtx_lock(l)
+#define EMUL_UNLOCK(l) mtx_unlock(l)
+
+#define EMUL_SHARED_RLOCK(l) sx_slock(l)
+#define EMUL_SHARED_RUNLOCK(l) sx_sunlock(l)
+#define EMUL_SHARED_WLOCK(l) sx_xlock(l)
+#define EMUL_SHARED_WUNLOCK(l) sx_xunlock(l)
+
+/* for em_find use */
+#define EMUL_DOLOCK 1
+#define EMUL_DONTLOCK 0
+
+int linux_proc_init(struct thread *, pid_t, int);
+void linux_proc_exit(void *, struct proc *);
+void linux_schedtail(void *, struct proc *);
+void linux_proc_exec(void *, struct proc *, struct image_params *);
+
+extern struct sx emul_shared_lock;
+extern struct mtx emul_lock;
+
+#endif /* !_LINUX_EMUL_H_ */
Index: linux_ipc.h
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_ipc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_ipc.h -L sys/compat/linux/linux_ipc.h -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_ipc.h
+++ sys/compat/linux/linux_ipc.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.10 2004/08/16 07:28:16 tjr Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_ipc.h,v 1.11 2006/12/21 13:11:06 netchild Exp $
*/
#ifndef _LINUX_IPC_H_
@@ -135,6 +135,8 @@
int linux_shmdt(struct thread *, struct linux_shmdt_args *);
int linux_shmget(struct thread *, struct linux_shmget_args *);
+#define LINUX_MSG_INFO 12
+
#endif /* __i386__ || __amd64__ */
#endif /* _LINUX_IPC_H_ */
--- /dev/null
+++ sys/compat/linux/linux_emul.c
@@ -0,0 +1,332 @@
+/*-
+ * Copyright (c) 2006 Roman Divacky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer
+ * in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_emul.c,v 1.20 2007/04/02 18:38:13 jkim Exp $");
+
+#include "opt_compat.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/imgact.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/malloc.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
+#include <sys/proc.h>
+#include <sys/syscallsubr.h>
+#include <sys/sysproto.h>
+#include <sys/unistd.h>
+
+#include <compat/linux/linux_emul.h>
+#include <compat/linux/linux_futex.h>
+
+#ifdef COMPAT_LINUX32
+#include <machine/../linux32/linux.h>
+#include <machine/../linux32/linux32_proto.h>
+#else
+#include <machine/../linux/linux.h>
+#include <machine/../linux/linux_proto.h>
+#endif
+
+struct sx emul_shared_lock;
+struct mtx emul_lock;
+
+/* this returns locked reference to the emuldata entry (if found) */
+struct linux_emuldata *
+em_find(struct proc *p, int locked)
+{
+ struct linux_emuldata *em;
+
+ if (locked == EMUL_DOLOCK)
+ EMUL_LOCK(&emul_lock);
+
+ em = p->p_emuldata;
+
+ if (em == NULL && locked == EMUL_DOLOCK)
+ EMUL_UNLOCK(&emul_lock);
+
+ return (em);
+}
+
+int
+linux_proc_init(struct thread *td, pid_t child, int flags)
+{
+ struct linux_emuldata *em, *p_em;
+ struct proc *p;
+
+ if (child != 0) {
+ /* non-exec call */
+ em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
+ em->pid = child;
+ em->pdeath_signal = 0;
+ if (flags & LINUX_CLONE_THREAD) {
+ /* handled later in the code */
+ } else {
+ struct linux_emuldata_shared *s;
+
+ s = malloc(sizeof *s, M_LINUX, M_WAITOK | M_ZERO);
+ s->refs = 1;
+ s->group_pid = child;
+
+ LIST_INIT(&s->threads);
+ em->shared = s;
+ }
+ } else {
+ /* lookup the old one */
+ em = em_find(td->td_proc, EMUL_DOLOCK);
+ KASSERT(em != NULL, ("proc_init: emuldata not found in exec case.\n"));
+ }
+
+ em->child_clear_tid = NULL;
+ em->child_set_tid = NULL;
+
+ /*
+ * allocate the shared struct only in clone()/fork cases in the case
+ * of clone() td = calling proc and child = pid of the newly created
+ * proc
+ */
+ if (child != 0) {
+ if (flags & LINUX_CLONE_THREAD) {
+ /* lookup the parent */
+ /*
+ * we dont have to lock the p_em because
+ * its waiting for us in linux_clone so
+ * there is no chance of it changing the
+ * p_em->shared address
+ */
+ p_em = em_find(td->td_proc, EMUL_DONTLOCK);
+ KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_THREAD\n"));
+ em->shared = p_em->shared;
+ EMUL_SHARED_WLOCK(&emul_shared_lock);
+ em->shared->refs++;
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+ } else {
+ /*
+ * handled earlier to avoid malloc(M_WAITOK) with
+ * rwlock held
+ */
+ }
+ }
+ if (child != 0) {
+ EMUL_SHARED_WLOCK(&emul_shared_lock);
+ LIST_INSERT_HEAD(&em->shared->threads, em, threads);
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+
+ p = pfind(child);
+ KASSERT(p != NULL, ("process not found in proc_init\n"));
+ p->p_emuldata = em;
+ PROC_UNLOCK(p);
+ } else
+ EMUL_UNLOCK(&emul_lock);
+
+ return (0);
+}
+
+void
+linux_proc_exit(void *arg __unused, struct proc *p)
+{
+ struct linux_emuldata *em;
+ int error;
+ struct thread *td = FIRST_THREAD_IN_PROC(p);
+ int *child_clear_tid;
+ struct proc *q, *nq;
+
+ if (__predict_true(p->p_sysent != &elf_linux_sysvec))
+ return;
+
+ /* find the emuldata */
+ em = em_find(p, EMUL_DOLOCK);
+
+ KASSERT(em != NULL, ("proc_exit: emuldata not found.\n"));
+
+ /* reparent all procs that are not a thread leader to initproc */
+ if (em->shared->group_pid != p->p_pid) {
+ child_clear_tid = em->child_clear_tid;
+ EMUL_UNLOCK(&emul_lock);
+ sx_xlock(&proctree_lock);
+ wakeup(initproc);
+ PROC_LOCK(p);
+ proc_reparent(p, initproc);
+ p->p_sigparent = SIGCHLD;
+ PROC_UNLOCK(p);
+ sx_xunlock(&proctree_lock);
+ } else {
+ child_clear_tid = em->child_clear_tid;
+ EMUL_UNLOCK(&emul_lock);
+ }
+
+ EMUL_SHARED_WLOCK(&emul_shared_lock);
+ LIST_REMOVE(em, threads);
+
+ em->shared->refs--;
+ if (em->shared->refs == 0) {
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+ free(em->shared, M_LINUX);
+ } else
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+
+ if (child_clear_tid != NULL) {
+ struct linux_sys_futex_args cup;
+ int null = 0;
+
+ error = copyout(&null, child_clear_tid, sizeof(null));
+ if (error) {
+ free(em, M_LINUX);
+ return;
+ }
+
+ /* futexes stuff */
+ cup.uaddr = child_clear_tid;
+ cup.op = LINUX_FUTEX_WAKE;
+ cup.val = 0x7fffffff; /* Awake everyone */
+ cup.timeout = NULL;
+ cup.uaddr2 = NULL;
+ cup.val3 = 0;
+ error = linux_sys_futex(FIRST_THREAD_IN_PROC(p), &cup);
+ /*
+ * this cannot happen at the moment and if this happens it
+ * probably means there is a user space bug
+ */
+ if (error)
+ printf(LMSG("futex stuff in proc_exit failed.\n"));
+ }
+
+ /* clean the stuff up */
+ free(em, M_LINUX);
+
+ /* this is a little weird but rewritten from exit1() */
+ sx_xlock(&proctree_lock);
+ q = LIST_FIRST(&p->p_children);
+ for (; q != NULL; q = nq) {
+ nq = LIST_NEXT(q, p_sibling);
+ if (q->p_flag & P_WEXIT)
+ continue;
+ if (__predict_false(q->p_sysent != &elf_linux_sysvec))
+ continue;
+ em = em_find(q, EMUL_DOLOCK);
+ KASSERT(em != NULL, ("linux_reparent: emuldata not found: %i\n", q->p_pid));
+ if (em->pdeath_signal != 0) {
+ PROC_LOCK(q);
+ psignal(q, em->pdeath_signal);
+ PROC_UNLOCK(q);
+ }
+ EMUL_UNLOCK(&emul_lock);
+ }
+ sx_xunlock(&proctree_lock);
+}
+
+/*
+ * This is used in a case of transition from FreeBSD binary execing to linux binary
+ * in this case we create linux emuldata proc entry with the pid of the currently running
+ * process.
+ */
+void
+linux_proc_exec(void *arg __unused, struct proc *p, struct image_params *imgp)
+{
+ if (__predict_false(imgp->sysent == &elf_linux_sysvec
+ && p->p_sysent != &elf_linux_sysvec))
+ linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0);
+ if (__predict_false(imgp->sysent != &elf_linux_sysvec
+ && p->p_sysent == &elf_linux_sysvec)) {
+ struct linux_emuldata *em;
+
+ /*
+ * XXX:There's a race because here we assign p->p_emuldata NULL
+ * but the process is still counted as linux one for a short
+ * time so some other process might reference it and try to
+ * access its p->p_emuldata and panicing on a NULL reference.
+ */
+ em = em_find(p, EMUL_DONTLOCK);
+
+ KASSERT(em != NULL, ("proc_exec: emuldata not found.\n"));
+
+ EMUL_SHARED_WLOCK(&emul_shared_lock);
+ LIST_REMOVE(em, threads);
+
+ PROC_LOCK(p);
+ p->p_emuldata = NULL;
+ PROC_UNLOCK(p);
+
+ em->shared->refs--;
+ if (em->shared->refs == 0) {
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+ free(em->shared, M_LINUX);
+ } else
+ EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+
+ free(em, M_LINUX);
+ }
+}
+
+void
+linux_schedtail(void *arg __unused, struct proc *p)
+{
+ struct linux_emuldata *em;
+ int error = 0;
+ int *child_set_tid;
+
+ if (__predict_true(p->p_sysent != &elf_linux_sysvec))
+ return;
+
+ /* find the emuldata */
+ em = em_find(p, EMUL_DOLOCK);
+
+ KASSERT(em != NULL, ("linux_schedtail: emuldata not found.\n"));
+ child_set_tid = em->child_set_tid;
+ EMUL_UNLOCK(&emul_lock);
+
+ if (child_set_tid != NULL)
+ error = copyout(&p->p_pid, (int *)child_set_tid,
+ sizeof(p->p_pid));
+
+ return;
+}
+
+int
+linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args)
+{
+ struct linux_emuldata *em;
+
+#ifdef DEBUG
+ if (ldebug(set_tid_address))
+ printf(ARGS(set_tid_address, "%p"), args->tidptr);
+#endif
+
+ /* find the emuldata */
+ em = em_find(td->td_proc, EMUL_DOLOCK);
+
+ KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n"));
+
+ em->child_clear_tid = args->tidptr;
+ td->td_retval[0] = td->td_proc->p_pid;
+
+ EMUL_UNLOCK(&emul_lock);
+ return 0;
+}
--- /dev/null
+++ sys/compat/linux/linux_futex.c
@@ -0,0 +1,513 @@
+/* $NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $ */
+
+/*-
+ * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Emmanuel Dreyfus
+ * 4. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.10 2007/05/23 08:33:05 kib Exp $");
+#if 0
+__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $");
+#endif
+
+#include "opt_compat.h"
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/queue.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
+#include <sys/malloc.h>
+
+#ifdef COMPAT_LINUX32
+#include <machine/../linux32/linux.h>
+#include <machine/../linux32/linux32_proto.h>
+#else
+#include <machine/../linux/linux.h>
+#include <machine/../linux/linux_proto.h>
+#endif
+#include <compat/linux/linux_futex.h>
+
+struct futex;
+
+struct waiting_proc {
+ struct thread *wp_t;
+ struct futex *wp_new_futex;
+ TAILQ_ENTRY(waiting_proc) wp_list;
+};
+struct futex {
+ void *f_uaddr;
+ int f_refcount;
+ LIST_ENTRY(futex) f_list;
+ TAILQ_HEAD(lf_waiting_proc, waiting_proc) f_waiting_proc;
+};
+
+LIST_HEAD(futex_list, futex) futex_list;
+struct sx futex_sx; /* this protects the LIST of futexes */
+
+#define FUTEX_LOCK sx_xlock(&futex_sx)
+#define FUTEX_UNLOCK sx_xunlock(&futex_sx)
+
+#define FUTEX_LOCKED 1
+#define FUTEX_UNLOCKED 0
+
+#define FUTEX_SYSTEM_LOCK mtx_lock(&Giant)
+#define FUTEX_SYSTEM_UNLOCK mtx_unlock(&Giant)
+
+static struct futex *futex_get(void *, int);
+static void futex_put(struct futex *);
+static int futex_sleep(struct futex *, struct thread *, unsigned long);
+static int futex_wake(struct futex *, int, struct futex *, int);
+static int futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr);
+
+/* support.s */
+int futex_xchgl(int oparg, caddr_t uaddr, int *oldval);
+int futex_addl(int oparg, caddr_t uaddr, int *oldval);
+int futex_orl(int oparg, caddr_t uaddr, int *oldval);
+int futex_andl(int oparg, caddr_t uaddr, int *oldval);
+int futex_xorl(int oparg, caddr_t uaddr, int *oldval);
+
+int
+linux_sys_futex(struct thread *td, struct linux_sys_futex_args *args)
+{
+ int val;
+ int ret;
+ struct l_timespec timeout = {0, 0};
+ int error = 0;
+ struct futex *f;
+ struct futex *newf;
+ int timeout_hz;
+ struct timeval tv = {0, 0};
+ struct futex *f2;
+ int op_ret;
+
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf(ARGS(futex, "%p, %i, %i, *, %p, %i"), args->uaddr, args->op,
+ args->val, args->uaddr2, args->val3);
+#endif
+
+ switch (args->op) {
+ case LINUX_FUTEX_WAIT:
+ FUTEX_SYSTEM_LOCK;
+
+ if ((error = copyin(args->uaddr,
+ &val, sizeof(val))) != 0) {
+ FUTEX_SYSTEM_UNLOCK;
+ return error;
+ }
+
+ if (val != args->val) {
+ FUTEX_SYSTEM_UNLOCK;
+ return EWOULDBLOCK;
+ }
+
+ if (args->timeout != NULL) {
+ if ((error = copyin(args->timeout,
+ &timeout, sizeof(timeout))) != 0) {
+ FUTEX_SYSTEM_UNLOCK;
+ return error;
+ }
+ }
+
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAIT %d: val = %d, uaddr = %p, "
+ "*uaddr = %d, timeout = %d.%09lu\n",
+ td->td_proc->p_pid, args->val,
+ args->uaddr, val, timeout.tv_sec,
+ (unsigned long)timeout.tv_nsec);
+#endif
+ tv.tv_usec = timeout.tv_sec * 1000000 + timeout.tv_nsec / 1000;
+ timeout_hz = tvtohz(&tv);
+
+ if (timeout.tv_sec == 0 && timeout.tv_nsec == 0)
+ timeout_hz = 0;
+ /*
+ * If the user process requests a non null timeout,
+ * make sure we do not turn it into an infinite
+ * timeout because timeout_hz gets null.
+ *
+ * We use a minimal timeout of 1/hz. Maybe it would
+ * make sense to just return ETIMEDOUT without sleeping.
+ */
+ if (((timeout.tv_sec != 0) || (timeout.tv_nsec != 0)) &&
+ (timeout_hz == 0))
+ timeout_hz = 1;
+
+
+ f = futex_get(args->uaddr, FUTEX_UNLOCKED);
+ ret = futex_sleep(f, td, timeout_hz);
+ futex_put(f);
+
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAIT %d: uaddr = %p, "
+ "ret = %d\n", td->td_proc->p_pid, args->uaddr, ret);
+#endif
+
+ FUTEX_SYSTEM_UNLOCK;
+ switch (ret) {
+ case EWOULDBLOCK: /* timeout */
+ return ETIMEDOUT;
+ break;
+ case EINTR: /* signal */
+ return EINTR;
+ break;
+ case 0: /* FUTEX_WAKE received */
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAIT %d: uaddr = %p, "
+ "got FUTEX_WAKE\n",
+ td->td_proc->p_pid, args->uaddr);
+#endif
+ return 0;
+ break;
+ default:
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAIT: unexpected ret = %d\n",
+ ret);
+#endif
+ break;
+ }
+
+ /* NOTREACHED */
+ break;
+
+ case LINUX_FUTEX_WAKE:
+ FUTEX_SYSTEM_LOCK;
+
+ /*
+ * XXX: Linux is able to cope with different addresses
+ * corresponding to the same mapped memory in the sleeping
+ * and waker process(es).
+ */
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAKE %d: uaddr = %p, val = %d\n",
+ td->td_proc->p_pid, args->uaddr, args->val);
+#endif
+ f = futex_get(args->uaddr, FUTEX_UNLOCKED);
+ td->td_retval[0] = futex_wake(f, args->val, NULL, 0);
+ futex_put(f);
+
+ FUTEX_SYSTEM_UNLOCK;
+ break;
+
+ case LINUX_FUTEX_CMP_REQUEUE:
+ FUTEX_SYSTEM_LOCK;
+
+ if ((error = copyin(args->uaddr,
+ &val, sizeof(val))) != 0) {
+ FUTEX_SYSTEM_UNLOCK;
+ return error;
+ }
+
+ if (val != args->val3) {
+ FUTEX_SYSTEM_UNLOCK;
+ return EAGAIN;
+ }
+
+ f = futex_get(args->uaddr, FUTEX_UNLOCKED);
+ newf = futex_get(args->uaddr2, FUTEX_UNLOCKED);
+ td->td_retval[0] = futex_wake(f, args->val, newf,
+ (int)(unsigned long)args->timeout);
+ futex_put(f);
+ futex_put(newf);
+
+ FUTEX_SYSTEM_UNLOCK;
+ break;
+
+ case LINUX_FUTEX_REQUEUE:
+ FUTEX_SYSTEM_LOCK;
+
+ f = futex_get(args->uaddr, FUTEX_UNLOCKED);
+ newf = futex_get(args->uaddr2, FUTEX_UNLOCKED);
+ td->td_retval[0] = futex_wake(f, args->val, newf,
+ (int)(unsigned long)args->timeout);
+ futex_put(f);
+ futex_put(newf);
+
+ FUTEX_SYSTEM_UNLOCK;
+ break;
+
+ case LINUX_FUTEX_FD:
+ /* XXX: Linux plans to remove this operation */
+ printf("linux_sys_futex: unimplemented op %d\n",
+ args->op);
+ break;
+
+ case LINUX_FUTEX_WAKE_OP:
+ FUTEX_SYSTEM_LOCK;
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX_WAKE_OP: %d: uaddr = %p, op = %d, "
+ "val = %x, uaddr2 = %p, val3 = %x\n",
+ td->td_proc->p_pid, args->uaddr, args->op,
+ args->val, args->uaddr2, args->val3);
+#endif
+ f = futex_get(args->uaddr, FUTEX_UNLOCKED);
+ f2 = futex_get(args->uaddr2, FUTEX_UNLOCKED);
+
+ /*
+ * This function returns positive number as results and
+ * negative as errors
+ */
+ op_ret = futex_atomic_op(td, args->val3, args->uaddr2);
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("futex_atomic_op ret %d\n", op_ret);
+#endif
+ if (op_ret < 0) {
+ /* XXX: We don't handle the EFAULT yet. */
+ if (op_ret != -EFAULT) {
+ futex_put(f);
+ futex_put(f2);
+ FUTEX_SYSTEM_UNLOCK;
+ return (-op_ret);
+ }
+
+ futex_put(f);
+ futex_put(f2);
+
+ FUTEX_SYSTEM_UNLOCK;
+ return (EFAULT);
+ }
+
+ ret = futex_wake(f, args->val, NULL, 0);
+ futex_put(f);
+ if (op_ret > 0) {
+ op_ret = 0;
+ /*
+ * Linux abuses the address of the timespec parameter
+ * as the number of retries.
+ */
+ op_ret += futex_wake(f2,
+ (int)(unsigned long)args->timeout, NULL, 0);
+ ret += op_ret;
+ }
+ futex_put(f2);
+ td->td_retval[0] = ret;
+
+ FUTEX_SYSTEM_UNLOCK;
+ break;
+
+ default:
+ printf("linux_sys_futex: unknown op %d\n",
+ args->op);
+ break;
+ }
+ return (0);
+}
+
+static struct futex *
+futex_get(void *uaddr, int locked)
+{
+ struct futex *f;
+
+ if (locked == FUTEX_UNLOCKED)
+ FUTEX_LOCK;
+ LIST_FOREACH(f, &futex_list, f_list) {
+ if (f->f_uaddr == uaddr) {
+ f->f_refcount++;
+ if (locked == FUTEX_UNLOCKED)
+ FUTEX_UNLOCK;
+ return f;
+ }
+ }
+
+ f = malloc(sizeof(*f), M_LINUX, M_WAITOK);
+ f->f_uaddr = uaddr;
+ f->f_refcount = 1;
+ TAILQ_INIT(&f->f_waiting_proc);
+ LIST_INSERT_HEAD(&futex_list, f, f_list);
+ if (locked == FUTEX_UNLOCKED)
+ FUTEX_UNLOCK;
+
+ return f;
+}
+
+static void
+futex_put(f)
+ struct futex *f;
+{
+ FUTEX_LOCK;
+ f->f_refcount--;
+ if (f->f_refcount == 0) {
+ LIST_REMOVE(f, f_list);
+ free(f, M_LINUX);
+ }
+ FUTEX_UNLOCK;
+
+ return;
+}
+
+static int
+futex_sleep(struct futex *f, struct thread *td, unsigned long timeout)
+{
+ struct waiting_proc *wp;
+ int ret;
+
+ wp = malloc(sizeof(*wp), M_LINUX, M_WAITOK);
+ wp->wp_t = td;
+ wp->wp_new_futex = NULL;
+ FUTEX_LOCK;
+ TAILQ_INSERT_TAIL(&f->f_waiting_proc, wp, wp_list);
+ FUTEX_UNLOCK;
+
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX --> %d tlseep timeout = %ld\n",
+ td->td_proc->p_pid, timeout);
+#endif
+ ret = tsleep(wp, PCATCH | PZERO, "linuxfutex", timeout);
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("FUTEX -> %d tsleep returns %d\n",
+ td->td_proc->p_pid, ret);
+#endif
+
+ FUTEX_LOCK;
+ TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+ FUTEX_UNLOCK;
+
+ /* if we got woken up in futex_wake */
+ if ((ret == 0) && (wp->wp_new_futex != NULL)) {
+ /* suspend us on the new futex */
+ ret = futex_sleep(wp->wp_new_futex, td, timeout);
+ /* and release the old one */
+ futex_put(wp->wp_new_futex);
+ }
+
+ free(wp, M_LINUX);
+
+ return ret;
+}
+
+static int
+futex_wake(struct futex *f, int n, struct futex *newf, int n2)
+{
+ struct waiting_proc *wp;
+ int count;
+
+ /*
+ * Linux is very strange it wakes up N threads for
+ * all operations BUT requeue ones where its N+1
+ * mimic this.
+ */
+ count = newf ? 0 : 1;
+
+ FUTEX_LOCK;
+ TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) {
+ if (count <= n) {
+ wakeup_one(wp);
+ count++;
+ } else {
+ if (newf != NULL) {
+ /* futex_put called after tsleep */
+ wp->wp_new_futex = futex_get(newf->f_uaddr,
+ FUTEX_LOCKED);
+ wakeup_one(wp);
+ if (count - n >= n2)
+ break;
+ }
+ }
+ }
+ FUTEX_UNLOCK;
+
+ return count;
+}
+
+static int
+futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr)
+{
+ int op = (encoded_op >> 28) & 7;
+ int cmp = (encoded_op >> 24) & 15;
+ int oparg = (encoded_op << 8) >> 20;
+ int cmparg = (encoded_op << 20) >> 20;
+ int oldval = 0, ret;
+
+ if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
+ oparg = 1 << oparg;
+
+#ifdef DEBUG
+ if (ldebug(sys_futex))
+ printf("futex_atomic_op: op = %d, cmp = %d, oparg = %x, "
+ "cmparg = %x, uaddr = %p\n",
+ op, cmp, oparg, cmparg, uaddr);
+#endif
+ /* XXX: linux verifies access here and returns EFAULT */
+
+ switch (op) {
+ case FUTEX_OP_SET:
+ ret = futex_xchgl(oparg, uaddr, &oldval);
+ break;
+ case FUTEX_OP_ADD:
+ ret = futex_addl(oparg, uaddr, &oldval);
+ break;
+ case FUTEX_OP_OR:
+ ret = futex_orl(oparg, uaddr, &oldval);
+ break;
+ case FUTEX_OP_ANDN:
+ ret = futex_andl(~oparg, uaddr, &oldval);
+ break;
+ case FUTEX_OP_XOR:
+ ret = futex_xorl(oparg, uaddr, &oldval);
+ break;
+ default:
+ ret = -ENOSYS;
+ break;
+ }
+
+ if (ret)
+ return (ret);
+
+ switch (cmp) {
+ case FUTEX_OP_CMP_EQ:
+ return (oldval == cmparg);
+ case FUTEX_OP_CMP_NE:
+ return (oldval != cmparg);
+ case FUTEX_OP_CMP_LT:
+ return (oldval < cmparg);
+ case FUTEX_OP_CMP_GE:
+ return (oldval >= cmparg);
+ case FUTEX_OP_CMP_LE:
+ return (oldval <= cmparg);
+ case FUTEX_OP_CMP_GT:
+ return (oldval > cmparg);
+ default:
+ return (-ENOSYS);
+ }
+}
Index: linux_ipc.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_ipc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_ipc.c -L sys/compat/linux/linux_ipc.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_ipc.c
+++ sys/compat/linux/linux_ipc.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.43 2005/02/11 13:46:55 sobomax Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.54 2007/01/14 16:34:43 netchild Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -83,6 +83,17 @@
l_ulong swap_successes;
};
+struct l_msginfo {
+ l_int msgpool;
+ l_int msgmap;
+ l_int msgmax;
+ l_int msgmnb;
+ l_int msgmni;
+ l_int msgssz;
+ l_int msgtql;
+ l_ushort msgseg;
+};
+
static void
bsd_to_linux_shminfo( struct shminfo *bpp, struct l_shminfo *lpp)
{
@@ -465,7 +476,7 @@
} */ bsd_args;
bsd_args.semid = args->semid;
- bsd_args.sops = (struct sembuf *)PTRIN(args->tsops);
+ bsd_args.sops = PTRIN(args->tsops);
bsd_args.nsops = args->nsops;
return semop(td, &bsd_args);
}
@@ -491,71 +502,59 @@
linux_semctl(struct thread *td, struct linux_semctl_args *args)
{
struct l_semid_ds linux_semid;
- struct __semctl_args /* {
- int semid;
- int semnum;
- int cmd;
- union semun *arg;
- } */ bsd_args;
struct l_seminfo linux_seminfo;
- int error;
- union semun *unptr;
- caddr_t sg;
-
- sg = stackgap_init();
-
- /* Make sure the arg parameter can be copied in. */
- unptr = stackgap_alloc(&sg, sizeof(union semun));
- bcopy(&args->arg, unptr, sizeof(union semun));
-
- bsd_args.semid = args->semid;
- bsd_args.semnum = args->semnum;
- bsd_args.arg = unptr;
+ struct semid_ds semid;
+ union semun semun;
+ register_t rval;
+ int cmd, error;
switch (args->cmd & ~LINUX_IPC_64) {
case LINUX_IPC_RMID:
- bsd_args.cmd = IPC_RMID;
+ cmd = IPC_RMID;
break;
case LINUX_GETNCNT:
- bsd_args.cmd = GETNCNT;
+ cmd = GETNCNT;
break;
case LINUX_GETPID:
- bsd_args.cmd = GETPID;
+ cmd = GETPID;
break;
case LINUX_GETVAL:
- bsd_args.cmd = GETVAL;
+ cmd = GETVAL;
break;
case LINUX_GETZCNT:
- bsd_args.cmd = GETZCNT;
+ cmd = GETZCNT;
break;
case LINUX_SETVAL:
- bsd_args.cmd = SETVAL;
+ cmd = SETVAL;
+ semun.val = args->arg.val;
break;
case LINUX_IPC_SET:
- bsd_args.cmd = IPC_SET;
+ cmd = IPC_SET;
error = linux_semid_pullup(args->cmd & LINUX_IPC_64,
- &linux_semid, (caddr_t)PTRIN(args->arg.buf));
+ &linux_semid, PTRIN(args->arg.buf));
if (error)
return (error);
- unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
- linux_to_bsd_semid_ds(&linux_semid, unptr->buf);
- return __semctl(td, &bsd_args);
+ linux_to_bsd_semid_ds(&linux_semid, &semid);
+ semun.buf = &semid;
+ return (kern_semctl(td, args->semid, args->semnum, cmd, &semun,
+ td->td_retval));
case LINUX_IPC_STAT:
case LINUX_SEM_STAT:
- if((args->cmd & ~LINUX_IPC_64) == LINUX_IPC_STAT)
- bsd_args.cmd = IPC_STAT;
+ if ((args->cmd & ~LINUX_IPC_64) == LINUX_IPC_STAT)
+ cmd = IPC_STAT;
else
- bsd_args.cmd = SEM_STAT;
- unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds));
- error = __semctl(td, &bsd_args);
+ cmd = SEM_STAT;
+ semun.buf = &semid;
+ error = kern_semctl(td, args->semid, args->semnum, cmd, &semun,
+ &rval);
if (error)
- return error;
- td->td_retval[0] = (bsd_args.cmd == SEM_STAT) ?
- IXSEQ_TO_IPCID(bsd_args.semid, unptr->buf->sem_perm) :
- 0;
- bsd_to_linux_semid_ds(unptr->buf, &linux_semid);
- return (linux_semid_pushdown(args->cmd & LINUX_IPC_64,
- &linux_semid, (caddr_t)PTRIN(args->arg.buf)));
+ return (error);
+ bsd_to_linux_semid_ds(&semid, &linux_semid);
+ error = linux_semid_pushdown(args->cmd & LINUX_IPC_64,
+ &linux_semid, PTRIN(args->arg.buf));
+ if (error == 0)
+ td->td_retval[0] = (cmd == SEM_STAT) ? rval : 0;
+ return (error);
case LINUX_IPC_INFO:
case LINUX_SEM_INFO:
bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) );
@@ -572,51 +571,58 @@
td->td_retval[0] = seminfo.semmni;
return 0; /* No need for __semctl call */
case LINUX_GETALL:
- /* FALLTHROUGH */
+ cmd = GETALL;
+ semun.val = args->arg.val;
+ break;
case LINUX_SETALL:
- /* FALLTHROUGH */
+ cmd = SETALL;
+ semun.val = args->arg.val;
+ break;
default:
linux_msg(td, "ipc type %d is not implemented",
args->cmd & ~LINUX_IPC_64);
return EINVAL;
}
- return __semctl(td, &bsd_args);
+ return (kern_semctl(td, args->semid, args->semnum, cmd, &semun,
+ td->td_retval));
}
int
linux_msgsnd(struct thread *td, struct linux_msgsnd_args *args)
{
- struct msgsnd_args /* {
- int msqid;
- void *msgp;
- size_t msgsz;
- int msgflg;
- } */ bsd_args;
+ const void *msgp;
+ long mtype;
+ l_long lmtype;
+ int error;
- bsd_args.msqid = args->msqid;
- bsd_args.msgp = PTRIN(args->msgp);
- bsd_args.msgsz = args->msgsz;
- bsd_args.msgflg = args->msgflg;
- return msgsnd(td, &bsd_args);
+ if ((l_long)args->msgsz < 0 || args->msgsz > (l_long)msginfo.msgmax)
+ return (EINVAL);
+ msgp = PTRIN(args->msgp);
+ if ((error = copyin(msgp, &lmtype, sizeof(lmtype))) != 0)
+ return (error);
+ mtype = (long)lmtype;
+ return (kern_msgsnd(td, args->msqid,
+ (const char *)msgp + sizeof(lmtype),
+ args->msgsz, args->msgflg, mtype));
}
int
linux_msgrcv(struct thread *td, struct linux_msgrcv_args *args)
{
- struct msgrcv_args /* {
- int msqid;
- void *msgp;
- size_t msgsz;
- long msgtyp;
- int msgflg;
- } */ bsd_args;
+ void *msgp;
+ long mtype;
+ l_long lmtype;
+ int error;
- bsd_args.msqid = args->msqid;
- bsd_args.msgp = PTRIN(args->msgp);
- bsd_args.msgsz = args->msgsz;
- bsd_args.msgtyp = args->msgtyp;
- bsd_args.msgflg = args->msgflg;
- return msgrcv(td, &bsd_args);
+ if ((l_long)args->msgsz < 0 || args->msgsz > (l_long)msginfo.msgmax)
+ return (EINVAL);
+ msgp = PTRIN(args->msgp);
+ if ((error = kern_msgrcv(td, args->msqid,
+ (char *)msgp + sizeof(lmtype), args->msgsz,
+ args->msgtyp, args->msgflg, &mtype)) != 0)
+ return (error);
+ lmtype = (l_long)mtype;
+ return (copyout(&lmtype, msgp, sizeof(lmtype)));
}
int
@@ -639,13 +645,41 @@
struct l_msqid_ds linux_msqid;
struct msqid_ds bsd_msqid;
- error = linux_msqid_pullup(args->cmd & LINUX_IPC_64,
- &linux_msqid, (caddr_t)PTRIN(args->buf));
- if (error != 0)
- return (error);
bsd_cmd = args->cmd & ~LINUX_IPC_64;
- if (bsd_cmd == LINUX_IPC_SET)
+ switch (bsd_cmd) {
+ case LINUX_IPC_INFO:
+ case LINUX_MSG_INFO: {
+ struct l_msginfo linux_msginfo;
+
+ /*
+ * XXX MSG_INFO uses the same data structure but returns different
+ * dynamic counters in msgpool, msgmap, and msgtql fields.
+ */
+ linux_msginfo.msgpool = (long)msginfo.msgmni *
+ (long)msginfo.msgmnb / 1024L; /* XXX MSG_INFO. */
+ linux_msginfo.msgmap = msginfo.msgmnb; /* XXX MSG_INFO. */
+ linux_msginfo.msgmax = msginfo.msgmax;
+ linux_msginfo.msgmnb = msginfo.msgmnb;
+ linux_msginfo.msgmni = msginfo.msgmni;
+ linux_msginfo.msgssz = msginfo.msgssz;
+ linux_msginfo.msgtql = msginfo.msgtql; /* XXX MSG_INFO. */
+ linux_msginfo.msgseg = msginfo.msgseg;
+ error = copyout(&linux_msginfo, PTRIN(args->buf),
+ sizeof(linux_msginfo));
+ if (error == 0)
+ td->td_retval[0] = msginfo.msgmni; /* XXX */
+
+ return (error);
+ }
+
+ case LINUX_IPC_SET:
+ error = linux_msqid_pullup(args->cmd & LINUX_IPC_64,
+ &linux_msqid, PTRIN(args->buf));
+ if (error)
+ return (error);
linux_to_bsd_msqid_ds(&linux_msqid, &bsd_msqid);
+ break;
+ }
error = kern_msgctl(td, args->msqid, bsd_cmd, &bsd_msqid);
if (error != 0)
@@ -655,7 +689,7 @@
if (bsd_cmd == LINUX_IPC_STAT) {
bsd_to_linux_msqid_ds(&bsd_msqid, &linux_msqid);
return (linux_msqid_pushdown(args->cmd & LINUX_IPC_64,
- &linux_msqid, (caddr_t)PTRIN(args->buf)));
+ &linux_msqid, PTRIN(args->buf)));
}
return (0);
@@ -721,7 +755,6 @@
struct l_shminfo linux_shminfo;
struct l_shm_info linux_shm_info;
struct shmid_ds bsd_shmid;
- size_t bufsz;
int error;
switch (args->cmd & ~LINUX_IPC_64) {
@@ -731,14 +764,14 @@
/* Perform shmctl wanting removed segments lookup */
error = kern_shmctl(td, args->shmid, IPC_INFO,
- (void *)&bsd_shminfo, &bufsz);
+ (void *)&bsd_shminfo, NULL);
if (error)
return error;
bsd_to_linux_shminfo(&bsd_shminfo, &linux_shminfo);
return (linux_shminfo_pushdown(args->cmd & LINUX_IPC_64,
- &linux_shminfo, (caddr_t)PTRIN(args->buf)));
+ &linux_shminfo, PTRIN(args->buf)));
}
case LINUX_SHM_INFO: {
@@ -746,43 +779,43 @@
/* Perform shmctl wanting removed segments lookup */
error = kern_shmctl(td, args->shmid, SHM_INFO,
- (void *)&bsd_shm_info, &bufsz);
+ (void *)&bsd_shm_info, NULL);
if (error)
return error;
bsd_to_linux_shm_info(&bsd_shm_info, &linux_shm_info);
- return copyout(&linux_shm_info, (caddr_t)PTRIN(args->buf),
+ return copyout(&linux_shm_info, PTRIN(args->buf),
sizeof(struct l_shm_info));
}
case LINUX_IPC_STAT:
/* Perform shmctl wanting removed segments lookup */
error = kern_shmctl(td, args->shmid, IPC_STAT,
- (void *)&bsd_shmid, &bufsz);
+ (void *)&bsd_shmid, NULL);
if (error)
return error;
bsd_to_linux_shmid_ds(&bsd_shmid, &linux_shmid);
return (linux_shmid_pushdown(args->cmd & LINUX_IPC_64,
- &linux_shmid, (caddr_t)PTRIN(args->buf)));
+ &linux_shmid, PTRIN(args->buf)));
case LINUX_SHM_STAT:
/* Perform shmctl wanting removed segments lookup */
error = kern_shmctl(td, args->shmid, IPC_STAT,
- (void *)&bsd_shmid, &bufsz);
+ (void *)&bsd_shmid, NULL);
if (error)
return error;
bsd_to_linux_shmid_ds(&bsd_shmid, &linux_shmid);
return (linux_shmid_pushdown(args->cmd & LINUX_IPC_64,
- &linux_shmid, (caddr_t)PTRIN(args->buf)));
+ &linux_shmid, PTRIN(args->buf)));
case LINUX_IPC_SET:
error = linux_shmid_pullup(args->cmd & LINUX_IPC_64,
- &linux_shmid, (caddr_t)PTRIN(args->buf));
+ &linux_shmid, PTRIN(args->buf));
if (error)
return error;
@@ -790,7 +823,7 @@
/* Perform shmctl wanting removed segments lookup */
return kern_shmctl(td, args->shmid, IPC_SET,
- (void *)&bsd_shmid, &bufsz);
+ (void *)&bsd_shmid, NULL);
case LINUX_IPC_RMID: {
void *buf;
@@ -799,13 +832,13 @@
buf = NULL;
else {
error = linux_shmid_pullup(args->cmd & LINUX_IPC_64,
- &linux_shmid, (caddr_t)PTRIN(args->buf));
+ &linux_shmid, PTRIN(args->buf));
if (error)
return error;
linux_to_bsd_shmid_ds(&linux_shmid, &bsd_shmid);
buf = (void *)&bsd_shmid;
}
- return kern_shmctl(td, args->shmid, IPC_RMID, buf, &bufsz);
+ return kern_shmctl(td, args->shmid, IPC_RMID, buf, NULL);
}
case LINUX_SHM_LOCK:
@@ -815,3 +848,7 @@
return EINVAL;
}
}
+
+MODULE_DEPEND(linux, sysvmsg, 1, 1, 1);
+MODULE_DEPEND(linux, sysvsem, 1, 1, 1);
+MODULE_DEPEND(linux, sysvshm, 1, 1, 1);
--- /dev/null
+++ sys/compat/linux/linux_time.c
@@ -0,0 +1,246 @@
+/* $NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Emmanuel Dreyfus.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_time.c,v 1.2 2006/12/20 20:17:34 jkim Exp $");
+#if 0
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.14 2006/05/14 03:40:54 christos Exp $");
+#endif
+
+#include "opt_compat.h"
+
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#include <sys/signal.h>
+#include <sys/stdint.h>
+#include <sys/syscallsubr.h>
+#include <sys/sysproto.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+
+#ifdef COMPAT_LINUX32
+#include <machine/../linux32/linux.h>
+#include <machine/../linux32/linux32_proto.h>
+#else
+#include <machine/../linux/linux.h>
+#include <machine/../linux/linux_proto.h>
+#endif
+
+static void native_to_linux_timespec(struct l_timespec *,
+ struct timespec *);
+static int linux_to_native_timespec(struct timespec *,
+ struct l_timespec *);
+static int linux_to_native_clockid(clockid_t *, clockid_t);
+
+static void
+native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp)
+{
+ ltp->tv_sec = ntp->tv_sec;
+ ltp->tv_nsec = ntp->tv_nsec;
+}
+
+static int
+linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
+{
+ if (ltp->tv_sec < 0 || ltp->tv_nsec > (l_long)999999999L)
+ return (EINVAL);
+ ntp->tv_sec = ltp->tv_sec;
+ ntp->tv_nsec = ltp->tv_nsec;
+
+ return (0);
+}
+
+static int
+linux_to_native_clockid(clockid_t *n, clockid_t l)
+{
+ switch (l) {
+ case LINUX_CLOCK_REALTIME:
+ *n = CLOCK_REALTIME;
+ break;
+ case LINUX_CLOCK_MONOTONIC:
+ *n = CLOCK_MONOTONIC;
+ break;
+ case LINUX_CLOCK_PROCESS_CPUTIME_ID:
+ case LINUX_CLOCK_THREAD_CPUTIME_ID:
+ case LINUX_CLOCK_REALTIME_HR:
+ case LINUX_CLOCK_MONOTONIC_HR:
+ default:
+ return (EINVAL);
+ break;
+ }
+
+ return (0);
+}
+
+int
+linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args)
+{
+ struct l_timespec lts;
+ int error;
+ clockid_t nwhich = 0; /* XXX: GCC */
+ struct timespec tp;
+
+ error = linux_to_native_clockid(&nwhich, args->which);
+ if (error != 0)
+ return (error);
+ error = kern_clock_gettime(td, nwhich, &tp);
+ if (error != 0)
+ return (error);
+ native_to_linux_timespec(<s, &tp);
+
+ return (copyout(<s, args->tp, sizeof lts));
+}
+
+int
+linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args)
+{
+ struct timespec ts;
+ struct l_timespec lts;
+ int error;
+ clockid_t nwhich = 0; /* XXX: GCC */
+
+ error = linux_to_native_clockid(&nwhich, args->which);
+ if (error != 0)
+ return (error);
+ error = copyin(args->tp, <s, sizeof lts);
+ if (error != 0)
+ return (error);
+ error = linux_to_native_timespec(&ts, <s);
+ if (error != 0)
+ return (error);
+
+ return (kern_clock_settime(td, nwhich, &ts));
+}
+
+int
+linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args)
+{
+ struct timespec ts;
+ struct l_timespec lts;
+ int error;
+ clockid_t nwhich = 0; /* XXX: GCC */
+
+ if (args->tp == NULL)
+ return (0);
+
+ error = linux_to_native_clockid(&nwhich, args->which);
+ if (error != 0)
+ return (error);
+ error = kern_clock_getres(td, nwhich, &ts);
+ if (error != 0)
+ return (error);
+ native_to_linux_timespec(<s, &ts);
+
+ return (copyout(<s, args->tp, sizeof lts));
+}
+
+int
+linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args)
+{
+ struct timespec *rmtp;
+ struct l_timespec lrqts, lrmts;
+ struct timespec rqts, rmts;
+ int error;
+
+ error = copyin(args->rqtp, &lrqts, sizeof lrqts);
+ if (error != 0)
+ return (error);
+
+ if (args->rmtp != NULL)
+ rmtp = &rmts;
+ else
+ rmtp = NULL;
+
+ error = linux_to_native_timespec(&rqts, &lrqts);
+ if (error != 0)
+ return (error);
+ error = kern_nanosleep(td, &rqts, rmtp);
+ if (error != 0)
+ return (error);
+
+ if (args->rmtp != NULL) {
+ native_to_linux_timespec(&lrmts, rmtp);
+ error = copyout(&lrmts, args->rmtp, sizeof(lrmts));
+ if (error != 0)
+ return (error);
+ }
+
+ return (0);
+}
+
+int
+linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args)
+{
+ struct timespec *rmtp;
+ struct l_timespec lrqts, lrmts;
+ struct timespec rqts, rmts;
+ int error;
+
+ if (args->flags != 0)
+ return (EINVAL); /* XXX deal with TIMER_ABSTIME */
+
+ if (args->which != LINUX_CLOCK_REALTIME)
+ return (EINVAL);
+
+ error = copyin(args->rqtp, &lrqts, sizeof lrqts);
+ if (error != 0)
+ return (error);
+
+ if (args->rmtp != NULL)
+ rmtp = &rmts;
+ else
+ rmtp = NULL;
+
+ error = linux_to_native_timespec(&rqts, &lrqts);
+ if (error != 0)
+ return (error);
+ error = kern_nanosleep(td, &rqts, rmtp);
+ if (error != 0)
+ return (error);
+
+ if (args->rmtp != NULL) {
+ native_to_linux_timespec(&lrmts, rmtp);
+ error = copyout(&lrmts, args->rmtp, sizeof lrmts );
+ if (error != 0)
+ return (error);
+ }
+
+ return (0);
+}
Index: linux_uid16.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_uid16.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_uid16.c -L sys/compat/linux/linux_uid16.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_uid16.c
+++ sys/compat/linux/linux_uid16.c
@@ -25,19 +25,20 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_uid16.c,v 1.16 2005/01/14 04:44:56 obrien Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_uid16.c,v 1.22 2007/06/12 00:11:57 rwatson Exp $");
+
+#include "opt_compat.h"
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
+#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/systm.h>
-#include "opt_compat.h"
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -123,7 +124,7 @@
* Keep cr_groups[0] unchanged to prevent that.
*/
- if ((error = suser_cred(oldcred, SUSER_ALLOWJAIL)) != 0) {
+ if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS, 0)) != 0) {
PROC_UNLOCK(p);
crfree(newcred);
return (error);
@@ -197,10 +198,9 @@
/*
* The FreeBSD native getgid(2) and getuid(2) also modify td->td_retval[1]
- * when COMPAT_43 is defined. This globbers registers that
- * are assumed to be preserved. The following lightweight syscalls fixes
- * this. See also linux_getpid(2), linux_getgid(2) and linux_getuid(2) in
- * linux_misc.c
+ * when COMPAT_43 is defined. This clobbers registers that are assumed to
+ * be preserved. The following lightweight syscalls fixes this. See also
+ * linux_getpid(2), linux_getgid(2) and linux_getuid(2) in linux_misc.c
*
* linux_getgid16() - MP SAFE
* linux_getuid16() - MP SAFE
Index: linux_getcwd.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_getcwd.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/compat/linux/linux_getcwd.c -L sys/compat/linux/linux_getcwd.c -u -r1.2 -r1.3
--- sys/compat/linux/linux_getcwd.c
+++ sys/compat/linux/linux_getcwd.c
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.19.2.1 2006/03/13 03:04:04 jeff Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_getcwd.c,v 1.27 2006/11/18 17:27:39 kib Exp $");
#include "opt_compat.h"
#include "opt_mac.h"
@@ -54,13 +54,10 @@
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/uio.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/dirent.h>
#include <ufs/ufs/dir.h> /* XXX only for DIRBLKSIZ */
-#include "opt_compat.h"
-
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
#include <machine/../linux32/linux32_proto.h>
@@ -70,6 +67,8 @@
#endif
#include <compat/linux/linux_util.h>
+#include <security/mac/mac_framework.h>
+
static int
linux_getcwd_scandir(struct vnode **, struct vnode **,
char **, char *, struct thread *);
@@ -386,7 +385,7 @@
error = linux_getcwd_scandir(&lvp, &uvp, &bp, bufp, td);
if (error)
goto out;
-#if DIAGNOSTIC
+#ifdef DIAGNOSTIC
if (lvp != NULL)
panic("getcwd: oops, forgot to null lvp");
if (bufp && (bp <= bufp)) {
@@ -426,8 +425,8 @@
int error, len, lenused;
#ifdef DEBUG
- printf("Linux-emul(%ld): getcwd(%p, %ld)\n", (long)td->td_proc->p_pid,
- args->buf, (long)args->bufsize);
+ if (ldebug(getcwd))
+ printf(ARGS(getcwd, "%p, %ld"), args->buf, (long)args->bufsize);
#endif
len = args->bufsize;
--- /dev/null
+++ sys/compat/linux/linux_futex.h
@@ -0,0 +1,61 @@
+/* $NetBSD: linux_futex.h,v 1.2 2005/12/11 12:20:19 christos Exp $ */
+
+/*-
+ * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Emmanuel Dreyfus
+ * 4. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD: src/sys/compat/linux/linux_futex.h,v 1.2 2007/02/25 12:40:35 netchild Exp $
+ */
+
+#ifndef _LINUX_FUTEX_H
+#define _LINUX_FUTEX_H
+
+#define LINUX_FUTEX_WAIT 0
+#define LINUX_FUTEX_WAKE 1
+#define LINUX_FUTEX_FD 2
+#define LINUX_FUTEX_REQUEUE 3
+#define LINUX_FUTEX_CMP_REQUEUE 4
+#define LINUX_FUTEX_WAKE_OP 5
+
+#define FUTEX_OP_SET 0 /* *(int *)UADDR2 = OPARG; */
+#define FUTEX_OP_ADD 1 /* *(int *)UADDR2 += OPARG; */
+#define FUTEX_OP_OR 2 /* *(int *)UADDR2 |= OPARG; */
+#define FUTEX_OP_ANDN 3 /* *(int *)UADDR2 &= ~OPARG; */
+#define FUTEX_OP_XOR 4 /* *(int *)UADDR2 ^= OPARG; */
+
+#define FUTEX_OP_OPARG_SHIFT 8 /* Use (1 << OPARG) instead of OPARG. */
+
+#define FUTEX_OP_CMP_EQ 0 /* if (oldval == CMPARG) wake */
+#define FUTEX_OP_CMP_NE 1 /* if (oldval != CMPARG) wake */
+#define FUTEX_OP_CMP_LT 2 /* if (oldval < CMPARG) wake */
+#define FUTEX_OP_CMP_LE 3 /* if (oldval <= CMPARG) wake */
+#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
+#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
+
+#endif /* !_LINUX_FUTEX_H */
Index: linux_ioctl.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_ioctl.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/compat/linux/linux_ioctl.c -L sys/compat/linux/linux_ioctl.c -u -r1.1.1.2 -r1.2
--- sys/compat/linux/linux_ioctl.c
+++ sys/compat/linux/linux_ioctl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.127.2.3 2006/01/11 15:39:10 delphij Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.138.2.1 2007/11/15 10:38:06 kib Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -43,7 +43,9 @@
#include <sys/filedesc.h>
#include <sys/filio.h>
#include <sys/kbio.h>
+#include <sys/kernel.h>
#include <sys/linker_set.h>
+#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
@@ -51,6 +53,7 @@
#include <sys/sockio.h>
#include <sys/soundcard.h>
#include <sys/stdint.h>
+#include <sys/sx.h>
#include <sys/tty.h>
#include <sys/uio.h>
#include <net/if.h>
@@ -83,6 +86,7 @@
static linux_ioctl_function_t linux_ioctl_termio;
static linux_ioctl_function_t linux_ioctl_private;
static linux_ioctl_function_t linux_ioctl_drm;
+static linux_ioctl_function_t linux_ioctl_sg;
static linux_ioctl_function_t linux_ioctl_special;
static struct linux_ioctl_handler cdrom_handler =
@@ -105,6 +109,8 @@
{ linux_ioctl_private, LINUX_IOCTL_PRIVATE_MIN, LINUX_IOCTL_PRIVATE_MAX };
static struct linux_ioctl_handler drm_handler =
{ linux_ioctl_drm, LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX };
+static struct linux_ioctl_handler sg_handler =
+{ linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX };
DATA_SET(linux_ioctl_handler_set, cdrom_handler);
DATA_SET(linux_ioctl_handler_set, vfat_handler);
@@ -116,6 +122,7 @@
DATA_SET(linux_ioctl_handler_set, termio_handler);
DATA_SET(linux_ioctl_handler_set, private_handler);
DATA_SET(linux_ioctl_handler_set, drm_handler);
+DATA_SET(linux_ioctl_handler_set, sg_handler);
struct handler_element
{
@@ -126,6 +133,8 @@
static TAILQ_HEAD(, handler_element) handlers =
TAILQ_HEAD_INITIALIZER(handlers);
+static struct sx linux_ioctl_sx;
+SX_SYSINIT(linux_ioctl, &linux_ioctl_sx, "linux ioctl handlers");
/*
* hdio related ioctls for VMWare support
@@ -276,15 +285,8 @@
unsigned int c_oflag;
unsigned int c_cflag;
unsigned int c_lflag;
-#ifdef __alpha__
- unsigned char c_cc[LINUX_NCCS];
- unsigned char c_line;
- unsigned int c_ispeed;
- unsigned int c_ospeed;
-#else
unsigned char c_line;
unsigned char c_cc[LINUX_NCCS];
-#endif
};
struct linux_winsize {
@@ -634,20 +636,7 @@
lio->c_cflag = lios.c_cflag;
lio->c_lflag = lios.c_lflag;
lio->c_line = lios.c_line;
-#ifdef __alpha__
- lio->c_cc[LINUX__VINTR] = lios.c_cc[LINUX_VINTR];
- lio->c_cc[LINUX__VQUIT] = lios.c_cc[LINUX_VQUIT];
- lio->c_cc[LINUX__VERASE] = lios.c_cc[LINUX_VERASE];
- lio->c_cc[LINUX__VKILL] = lios.c_cc[LINUX_VKILL];
- lio->c_cc[LINUX__VEOF] =
- lios.c_cc[(lios.c_lflag & ICANON) ? LINUX_VEOF : LINUX_VMIN];
- lio->c_cc[LINUX__VEOL] =
- lios.c_cc[(lios.c_lflag & ICANON) ? LINUX_VEOL : LINUX_VTIME];
- lio->c_cc[LINUX__VEOL2] = lios.c_cc[LINUX_VEOL2];
- lio->c_cc[LINUX__VSWTC] = lios.c_cc[LINUX_VSWTC];
-#else
memcpy(lio->c_cc, lios.c_cc, LINUX_NCC);
-#endif
}
static void
@@ -660,24 +649,9 @@
lios.c_oflag = lio->c_oflag;
lios.c_cflag = lio->c_cflag;
lios.c_lflag = lio->c_lflag;
-#ifdef __alpha__
- for (i=0; i<LINUX_NCCS; i++)
- lios.c_cc[i] = LINUX_POSIX_VDISABLE;
- lios.c_cc[LINUX_VINTR] = lio->c_cc[LINUX__VINTR];
- lios.c_cc[LINUX_VQUIT] = lio->c_cc[LINUX__VQUIT];
- lios.c_cc[LINUX_VERASE] = lio->c_cc[LINUX__VERASE];
- lios.c_cc[LINUX_VKILL] = lio->c_cc[LINUX__VKILL];
- lios.c_cc[LINUX_VEOL2] = lio->c_cc[LINUX__VEOL2];
- lios.c_cc[LINUX_VSWTC] = lio->c_cc[LINUX__VSWTC];
- lios.c_cc[(lio->c_lflag & ICANON) ? LINUX_VEOF : LINUX_VMIN] =
- lio->c_cc[LINUX__VEOF];
- lios.c_cc[(lio->c_lflag & ICANON) ? LINUX_VEOL : LINUX_VTIME] =
- lio->c_cc[LINUX__VEOL];
-#else
for (i=LINUX_NCC; i<LINUX_NCCS; i++)
lios.c_cc[i] = LINUX_POSIX_VDISABLE;
memcpy(lios.c_cc, lio->c_cc, LINUX_NCC);
-#endif
linux_to_bsd_termios(&lios, bios);
}
@@ -1010,7 +984,15 @@
args->cmd = TIOCCBRK;
error = (ioctl(td, (struct ioctl_args *)args));
break;
-
+ case LINUX_TIOCGPTN: {
+ int nb;
+
+ error = fo_ioctl(fp, TIOCGPTN, (caddr_t)&nb, td->td_ucred, td);
+ if (!error)
+ error = copyout(&nb, (void *)args->arg,
+ sizeof(int));
+ break;
+ }
default:
error = ENOIOCTL;
break;
@@ -1605,6 +1587,11 @@
break;
}
+ case LINUX_SCSI_GET_BUS_NUMBER:
+ case LINUX_SCSI_GET_IDLUN:
+ error = linux_ioctl_sg(td, args);
+ break;
+
/* LINUX_CDROM_SEND_PACKET */
/* LINUX_CDROM_NEXT_WRITABLE */
/* LINUX_CDROM_LAST_WRITTEN */
@@ -2272,6 +2259,29 @@
return (ENOENT);
}
+
+ /*
+* If we fault in bsd_to_linux_ifreq() then we will fault when we call
+* the native ioctl(). Thus, we don't really need to check the return
+* value of this function.
+*/
+static int
+bsd_to_linux_ifreq(struct ifreq *arg)
+{
+ struct ifreq ifr;
+ size_t ifr_len = sizeof(struct ifreq);
+ int error;
+
+ if ((error = copyin(arg, &ifr, ifr_len)))
+ return (error);
+
+ *(u_short *)&ifr.ifr_addr = ifr.ifr_addr.sa_family;
+
+ error = copyout(&ifr, arg, ifr_len);
+
+ return (error);
+}
+
/*
* Socket related ioctls
*/
@@ -2313,6 +2323,7 @@
case LINUX_SIOCGIFCONF:
case LINUX_SIOCGPGRP:
case LINUX_SIOCSPGRP:
+ case LINUX_SIOCGIFCOUNT:
/* these ioctls don't take an interface name */
#ifdef DEBUG
printf("%s(): ioctl %d\n", __func__,
@@ -2334,6 +2345,7 @@
case LINUX_SIOCSIFHWADDR:
case LINUX_SIOCDEVPRIVATE:
case LINUX_SIOCDEVPRIVATE+1:
+ case LINUX_SIOCGIFINDEX:
/* copy in the interface name and translate it. */
error = copyin((void *)args->arg, lifname, LINUX_IFNAMSIZ);
if (error != 0)
@@ -2403,8 +2415,9 @@
break;
case LINUX_SIOCGIFADDR:
- args->cmd = OSIOCGIFADDR;
+ args->cmd = SIOCGIFADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCSIFADDR:
@@ -2414,18 +2427,21 @@
break;
case LINUX_SIOCGIFDSTADDR:
- args->cmd = OSIOCGIFDSTADDR;
+ args->cmd = SIOCGIFDSTADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCGIFBRDADDR:
- args->cmd = OSIOCGIFBRDADDR;
+ args->cmd = SIOCGIFBRDADDR;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCGIFNETMASK:
- args->cmd = OSIOCGIFNETMASK;
+ args->cmd = SIOCGIFNETMASK;
error = ioctl(td, (struct ioctl_args *)args);
+ bsd_to_linux_ifreq((struct ifreq *)args->arg);
break;
case LINUX_SIOCSIFNETMASK:
@@ -2464,6 +2480,15 @@
error = ioctl(td, (struct ioctl_args *)args);
break;
+ case LINUX_SIOCGIFINDEX:
+ args->cmd = SIOCGIFINDEX;
+ error = ioctl(td, (struct ioctl_args *)args);
+ break;
+
+ case LINUX_SIOCGIFCOUNT:
+ error = 0;
+ break;
+
/*
* XXX This is slightly bogus, but these ioctls are currently
* XXX only used by the aironet (if_an) network driver.
@@ -2517,6 +2542,24 @@
return ioctl(td, (struct ioctl_args *)args);
}
+static int
+linux_ioctl_sg(struct thread *td, struct linux_ioctl_args *args)
+{
+ struct file *fp;
+ u_long cmd;
+ int error;
+
+ if ((error = fget(td, args->fd, &fp)) != 0) {
+ printf("sg_linux_ioctl: fget returned %d\n", error);
+ return (error);
+ }
+ cmd = args->cmd;
+
+ error = (fo_ioctl(fp, cmd, (caddr_t)args->arg, td->td_ucred, td));
+ fdrop(fp, td);
+ return (error);
+}
+
/*
* Special ioctl handler
*/
@@ -2571,15 +2614,21 @@
/* Iterate over the ioctl handlers */
cmd = args->cmd & 0xffff;
+ sx_slock(&linux_ioctl_sx);
+ mtx_lock(&Giant);
TAILQ_FOREACH(he, &handlers, list) {
if (cmd >= he->low && cmd <= he->high) {
error = (*he->func)(td, args);
if (error != ENOIOCTL) {
+ mtx_unlock(&Giant);
+ sx_sunlock(&linux_ioctl_sx);
fdrop(fp, td);
return (error);
}
}
}
+ mtx_unlock(&Giant);
+ sx_sunlock(&linux_ioctl_sx);
fdrop(fp, td);
linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented",
@@ -2601,6 +2650,7 @@
* Reuse the element if the handler is already on the list, otherwise
* create a new element.
*/
+ sx_xlock(&linux_ioctl_sx);
TAILQ_FOREACH(he, &handlers, list) {
if (he->func == h->func)
break;
@@ -2621,10 +2671,12 @@
TAILQ_FOREACH(cur, &handlers, list) {
if (cur->span > he->span) {
TAILQ_INSERT_BEFORE(cur, he, list);
+ sx_xunlock(&linux_ioctl_sx);
return (0);
}
}
TAILQ_INSERT_TAIL(&handlers, he, list);
+ sx_xunlock(&linux_ioctl_sx);
return (0);
}
@@ -2637,13 +2689,16 @@
if (h == NULL || h->func == NULL)
return (EINVAL);
+ sx_xlock(&linux_ioctl_sx);
TAILQ_FOREACH(he, &handlers, list) {
if (he->func == h->func) {
TAILQ_REMOVE(&handlers, he, list);
+ sx_xunlock(&linux_ioctl_sx);
FREE(he, M_LINUX);
return (0);
}
}
+ sx_xunlock(&linux_ioctl_sx);
return (EINVAL);
}
Index: linux_signal.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_signal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_signal.c -L sys/compat/linux/linux_signal.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_signal.c
+++ sys/compat/linux/linux_signal.c
@@ -27,12 +27,13 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_signal.c,v 1.51 2005/02/13 19:50:57 njl Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_signal.c,v 1.65 2007/01/07 19:14:06 netchild Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/sx.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/syscallsubr.h>
@@ -49,6 +50,7 @@
#endif
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_util.h>
+#include <compat/linux/linux_emul.h>
void
linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
@@ -60,11 +62,7 @@
bss->__bits[1] = lss->__bits[1];
for (l = 1; l <= LINUX_SIGTBLSZ; l++) {
if (LINUX_SIGISMEMBER(*lss, l)) {
-#ifdef __alpha__
- b = _SIG_IDX(l);
-#else
b = linux_to_bsd_signal[_SIG_IDX(l)];
-#endif
if (b)
SIGADDSET(*bss, b);
}
@@ -81,11 +79,7 @@
lss->__bits[1] = bss->__bits[1];
for (b = 1; b <= LINUX_SIGTBLSZ; b++) {
if (SIGISMEMBER(*bss, b)) {
-#if __alpha__
- l = _SIG_IDX(b);
-#else
l = bsd_to_linux_signal[_SIG_IDX(b)];
-#endif
if (l)
LINUX_SIGADDSET(*lss, l);
}
@@ -150,7 +144,7 @@
struct sigaction act, oact, *nsa, *osa;
int error, sig;
- if (linux_sig <= 0 || linux_sig > LINUX_NSIG)
+ if (!LINUX_SIG_VALID(linux_sig))
return (EINVAL);
osa = (linux_osa != NULL) ? &oact : NULL;
@@ -160,11 +154,9 @@
} else
nsa = NULL;
-#ifndef __alpha__
if (linux_sig <= LINUX_SIGTBLSZ)
sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)];
else
-#endif
sig = linux_sig;
error = kern_sigaction(td, sig, nsa, osa, 0);
@@ -178,7 +170,6 @@
}
-#ifndef __alpha__
int
linux_signal(struct thread *td, struct linux_signal_args *args)
{
@@ -200,7 +191,6 @@
return (error);
}
-#endif /*!__alpha__*/
int
linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
@@ -270,7 +260,6 @@
return (error);
}
-#ifndef __alpha__
int
linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
{
@@ -302,7 +291,6 @@
return (error);
}
-#endif /*!__alpha__*/
int
linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
@@ -337,7 +325,6 @@
return (error);
}
-#ifndef __alpha__
int
linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
{
@@ -406,7 +393,119 @@
mask = lset.__bits[0];
return (copyout(&mask, args->mask, sizeof(mask)));
}
-#endif /*!__alpha__*/
+
+/*
+ * MPSAFE
+ */
+int
+linux_rt_sigpending(struct thread *td, struct linux_rt_sigpending_args *args)
+{
+ struct proc *p = td->td_proc;
+ sigset_t bset;
+ l_sigset_t lset;
+
+ if (args->sigsetsize > sizeof(lset))
+ return EINVAL;
+ /* NOT REACHED */
+
+#ifdef DEBUG
+ if (ldebug(rt_sigpending))
+ printf(ARGS(rt_sigpending, "*"));
+#endif
+
+ PROC_LOCK(p);
+ bset = p->p_siglist;
+ SIGSETOR(bset, td->td_siglist);
+ SIGSETAND(bset, td->td_sigmask);
+ PROC_UNLOCK(p);
+ bsd_to_linux_sigset(&bset, &lset);
+ return (copyout(&lset, args->set, args->sigsetsize));
+}
+
+/*
+ * MPSAFE
+ */
+int
+linux_rt_sigtimedwait(struct thread *td,
+ struct linux_rt_sigtimedwait_args *args)
+{
+ int error;
+ l_timeval ltv;
+ struct timeval tv;
+ struct timespec ts, *tsa;
+ l_sigset_t lset;
+ sigset_t bset;
+ l_siginfo_t linfo;
+ ksiginfo_t info;
+
+#ifdef DEBUG
+ if (ldebug(rt_sigtimedwait))
+ printf(ARGS(rt_sigtimedwait, "*"));
+#endif
+ if (args->sigsetsize != sizeof(l_sigset_t))
+ return (EINVAL);
+
+ if ((error = copyin(args->mask, &lset, sizeof(lset))))
+ return (error);
+ linux_to_bsd_sigset(&lset, &bset);
+
+ tsa = NULL;
+ if (args->timeout) {
+ if ((error = copyin(args->timeout, <v, sizeof(ltv))))
+ return (error);
+#ifdef DEBUG
+ if (ldebug(rt_sigtimedwait))
+ printf(LMSG("linux_rt_sigtimedwait: incoming timeout (%d/%d)\n"),
+ ltv.tv_sec, ltv.tv_usec);
+#endif
+ tv.tv_sec = (long)ltv.tv_sec;
+ tv.tv_usec = (suseconds_t)ltv.tv_usec;
+ if (itimerfix(&tv)) {
+ /*
+ * The timeout was invalid. Convert it to something
+ * valid that will act as it does under Linux.
+ */
+ tv.tv_sec += tv.tv_usec / 1000000;
+ tv.tv_usec %= 1000000;
+ if (tv.tv_usec < 0) {
+ tv.tv_sec -= 1;
+ tv.tv_usec += 1000000;
+ }
+ if (tv.tv_sec < 0)
+ timevalclear(&tv);
+#ifdef DEBUG
+ if (ldebug(rt_sigtimedwait))
+ printf(LMSG("linux_rt_sigtimedwait: converted timeout (%jd/%ld)\n"),
+ (intmax_t)tv.tv_sec, tv.tv_usec);
+#endif
+ }
+ TIMEVAL_TO_TIMESPEC(&tv, &ts);
+ tsa = &ts;
+ }
+ error = kern_sigtimedwait(td, bset, &info, tsa);
+#ifdef DEBUG
+ if (ldebug(rt_sigtimedwait))
+ printf(LMSG("linux_rt_sigtimedwait: sigtimedwait returning (%d)\n"), error);
+#endif
+ if (error)
+ return (error);
+
+ if (args->ptr) {
+ memset(&linfo, 0, sizeof(linfo));
+ linfo.lsi_signo = info.ksi_signo;
+ error = copyout(&linfo, args->ptr, sizeof(linfo));
+ }
+
+ /* Repost if we got an error. */
+ if (error && info.ksi_signo) {
+ PROC_LOCK(td->td_proc);
+ tdsignal(td->td_proc, td, info.ksi_signo, &info);
+ PROC_UNLOCK(td->td_proc);
+ } else
+ td->td_retval[0] = info.ksi_signo;
+
+ return (error);
+}
int
linux_kill(struct thread *td, struct linux_kill_args *args)
@@ -424,16 +523,66 @@
/*
* Allow signal 0 as a means to check for privileges
*/
- if (args->signum < 0 || args->signum > LINUX_NSIG)
+ if (!LINUX_SIG_VALID(args->signum) && args->signum != 0)
return EINVAL;
-#ifndef __alpha__
if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ)
tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)];
else
-#endif
tmp.signum = args->signum;
tmp.pid = args->pid;
return (kill(td, &tmp));
}
+
+int
+linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
+{
+ struct linux_emuldata *em;
+ struct linux_kill_args ka;
+ struct proc *p;
+
+#ifdef DEBUG
+ if (ldebug(tgkill))
+ printf(ARGS(tgkill, "%d, %d, %d"), args->tgid, args->pid, args->sig);
+#endif
+
+ ka.pid = args->pid;
+ ka.signum = args->sig;
+
+ if (args->tgid == -1)
+ return linux_kill(td, &ka);
+
+ if ((p = pfind(args->pid)) == NULL)
+ return ESRCH;
+
+ if (p->p_sysent != &elf_linux_sysvec)
+ return ESRCH;
+
+ PROC_UNLOCK(p);
+
+ em = em_find(p, EMUL_DONTLOCK);
+
+ if (em == NULL) {
+#ifdef DEBUG
+ printf("emuldata not found in tgkill.\n");
+#endif
+ return ESRCH;
+ }
+
+ if (em->shared->group_pid != args->tgid)
+ return ESRCH;
+
+ return linux_kill(td, &ka);
+}
+
+int
+linux_tkill(struct thread *td, struct linux_tkill_args *args)
+{
+#ifdef DEBUG
+ if (ldebug(tkill))
+ printf(ARGS(tkill, "%i, %i"), args->tid, args->sig);
+#endif
+
+ return (linux_kill(td, (struct linux_kill_args *) args));
+}
Index: linux_misc.c
===================================================================
RCS file: /home/cvs/src/sys/compat/linux/linux_misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/linux/linux_misc.c -L sys/compat/linux/linux_misc.c -u -r1.1.1.1 -r1.2
--- sys/compat/linux/linux_misc.c
+++ sys/compat/linux/linux_misc.c
@@ -28,29 +28,31 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.170 2005/07/07 19:17:55 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.214 2007/08/28 12:26:35 kib Exp $");
+#include "opt_compat.h"
#include "opt_mac.h"
#include <sys/param.h>
#include <sys/blist.h>
#include <sys/fcntl.h>
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__)
#include <sys/imgact_aout.h>
#endif
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/limits.h>
#include <sys/lock.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
+#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/resourcevar.h>
+#include <sys/sched.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
@@ -62,6 +64,8 @@
#include <sys/vnode.h>
#include <sys/wait.h>
+#include <security/mac/mac_framework.h>
+
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_kern.h>
@@ -70,11 +74,9 @@
#include <vm/vm_object.h>
#include <vm/swap_pager.h>
-#include <posix4/sched.h>
-
-#include "opt_compat.h"
-
#include <compat/linux/linux_sysproto.h>
+#include <compat/linux/linux_emul.h>
+#include <compat/linux/linux_misc.h>
#ifdef COMPAT_LINUX32
#include <machine/../linux32/linux.h>
@@ -85,26 +87,21 @@
#endif
#include <compat/linux/linux_mib.h>
+#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_util.h>
#ifdef __i386__
#include <machine/cputypes.h>
#endif
-#ifdef __alpha__
-#define BSD_TO_LINUX_SIGNAL(sig) (sig)
-#else
#define BSD_TO_LINUX_SIGNAL(sig) \
(((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
-#endif
-#ifndef __alpha__
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
- RLIMIT_MEMLOCK, -1
+ RLIMIT_MEMLOCK, RLIMIT_AS
};
-#endif /*!__alpha__*/
struct l_sysinfo {
l_long uptime; /* Seconds since boot */
@@ -117,12 +114,12 @@
l_ulong totalswap; /* Total swap space size */
l_ulong freeswap; /* swap space still available */
l_ushort procs; /* Number of current processes */
+ l_ushort pads;
l_ulong totalbig;
l_ulong freebig;
l_uint mem_unit;
- char _f[6]; /* Pads structure to 64 bytes */
+ char _f[20-2*sizeof(l_long)-sizeof(l_int)]; /* padding */
};
-#ifndef __alpha__
int
linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args)
{
@@ -155,7 +152,7 @@
sysinfo.bufferram = 0;
swap_pager_status(&i, &j);
- sysinfo.totalswap= i * PAGE_SIZE;
+ sysinfo.totalswap = i * PAGE_SIZE;
sysinfo.freeswap = (i - j) * PAGE_SIZE;
sysinfo.procs = nprocs;
@@ -167,9 +164,7 @@
return copyout(&sysinfo, args->info, sizeof(sysinfo));
}
-#endif /*!__alpha__*/
-#ifndef __alpha__
int
linux_alarm(struct thread *td, struct linux_alarm_args *args)
{
@@ -191,14 +186,13 @@
error = kern_setitimer(td, ITIMER_REAL, &it, &old_it);
if (error)
return (error);
- if (timevalisset(&old_it.it_value)) {
+ if (timevalisset(&old_it.it_value)) {
if (old_it.it_value.tv_usec != 0)
old_it.it_value.tv_sec++;
td->td_retval[0] = old_it.it_value.tv_sec;
}
return (0);
}
-#endif /*!__alpha__*/
int
linux_brk(struct thread *td, struct linux_brk_args *args)
@@ -215,7 +209,7 @@
#endif
old = (vm_offset_t)vm->vm_daddr + ctob(vm->vm_dsize);
new = (vm_offset_t)args->dsend;
- tmp.nsize = (char *) new;
+ tmp.nsize = (char *)new;
if (((caddr_t)new > vm->vm_daddr) && !obreak(td, &tmp))
td->td_retval[0] = (long)new;
else
@@ -224,7 +218,8 @@
return 0;
}
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__)
+/* XXX: what about amd64/linux32? */
int
linux_uselib(struct thread *td, struct linux_uselib_args *args)
@@ -239,7 +234,7 @@
unsigned long bss_size;
char *library;
int error;
- int locked;
+ int locked, vfslocked;
LCONVPATHEXIST(td, args->library, &library);
@@ -249,34 +244,26 @@
#endif
a_out = NULL;
+ vfslocked = 0;
locked = 0;
vp = NULL;
- /*
- * XXX: This code should make use of vn_open(), rather than doing
- * all this stuff itself.
- */
- NDINIT(&ni, LOOKUP, ISOPEN|FOLLOW|LOCKLEAF, UIO_SYSSPACE, library, td);
+ NDINIT(&ni, LOOKUP, ISOPEN | FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1,
+ UIO_SYSSPACE, library, td);
error = namei(&ni);
LFREEPATH(library);
if (error)
goto cleanup;
vp = ni.ni_vp;
- /*
- * XXX - This looks like a bogus check. A LOCKLEAF namei should not
- * succeed without returning a vnode.
- */
- if (vp == NULL) {
- error = ENOEXEC; /* ?? */
- goto cleanup;
- }
+ vfslocked = NDHASGIANT(&ni);
NDFREE(&ni, NDF_ONLY_PNBUF);
/*
* From here on down, we have a locked vnode that must be unlocked.
+ * XXX: The code below largely duplicates exec_check_permissions().
*/
- locked++;
+ locked = 1;
/* Writable? */
if (vp->v_writecount) {
@@ -291,6 +278,7 @@
if ((vp->v_mount->mnt_flag & MNT_NOEXEC) ||
((attr.va_mode & 0111) == 0) || (attr.va_type != VREG)) {
+ /* EACCESS is what exec(2) returns. */
error = ENOEXEC;
goto cleanup;
}
@@ -309,25 +297,21 @@
/*
* XXX: This should use vn_open() so that it is properly authorized,
* and to reduce code redundancy all over the place here.
+ * XXX: Not really, it duplicates far more of exec_check_permissions()
+ * than vn_open().
*/
#ifdef MAC
error = mac_check_vnode_open(td->td_ucred, vp, FREAD);
if (error)
goto cleanup;
#endif
- error = VOP_OPEN(vp, FREAD, td->td_ucred, td, -1);
+ error = VOP_OPEN(vp, FREAD, td->td_ucred, td, NULL);
if (error)
goto cleanup;
/* Pull in executable header into kernel_map */
error = vm_mmap(kernel_map, (vm_offset_t *)&a_out, PAGE_SIZE,
VM_PROT_READ, VM_PROT_READ, 0, OBJT_VNODE, vp, 0);
- /*
- * Lock no longer needed
- */
- locked = 0;
- VOP_UNLOCK(vp, 0, td);
-
if (error)
goto cleanup;
@@ -343,10 +327,10 @@
/* Set file/virtual offset based on a.out variant. */
switch ((int)(a_out->a_magic & 0xffff)) {
- case 0413: /* ZMAGIC */
+ case 0413: /* ZMAGIC */
file_offset = 1024;
break;
- case 0314: /* QMAGIC */
+ case 0314: /* QMAGIC */
file_offset = 0;
break;
default:
@@ -382,11 +366,21 @@
}
PROC_UNLOCK(td->td_proc);
- mp_fixme("Unlocked vflags access.");
- /* prevent more writers */
+ /*
+ * Prevent more writers.
+ * XXX: Note that if any of the VM operations fail below we don't
+ * clear this flag.
+ */
vp->v_vflag |= VV_TEXT;
/*
+ * Lock no longer needed
+ */
+ locked = 0;
+ VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
+
+ /*
* Check if file_offset page aligned. Currently we cannot handle
* misalinged file offsets, and so we read in the entire image
* (what a waste).
@@ -446,8 +440,8 @@
goto cleanup;
}
#ifdef DEBUG
- printf("mem=%08lx = %08lx %08lx\n", (long)vmaddr, ((long*)vmaddr)[0],
- ((long*)vmaddr)[1]);
+ printf("mem=%08lx = %08lx %08lx\n", (long)vmaddr, ((long *)vmaddr)[0],
+ ((long *)vmaddr)[1]);
#endif
if (bss_size != 0) {
/* Calculate BSS start address */
@@ -463,8 +457,10 @@
cleanup:
/* Unlock vnode if needed */
- if (locked)
+ if (locked) {
VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
+ }
/* Release the kernel mapping. */
if (a_out)
@@ -474,7 +470,7 @@
return error;
}
-#endif /* __i386__ || __alpha__ */
+#endif /* __i386__ */
int
linux_select(struct thread *td, struct linux_select_args *args)
@@ -501,8 +497,8 @@
utv.tv_usec = ltv.tv_usec;
#ifdef DEBUG
if (ldebug(select))
- printf(LMSG("incoming timeout (%ld/%ld)"),
- utv.tv_sec, utv.tv_usec);
+ printf(LMSG("incoming timeout (%jd/%ld)"),
+ (intmax_t)utv.tv_sec, utv.tv_usec);
#endif
if (itimerfix(&utv)) {
@@ -558,8 +554,8 @@
timevalclear(&utv);
#ifdef DEBUG
if (ldebug(select))
- printf(LMSG("outgoing timeout (%ld/%ld)"),
- utv.tv_sec, utv.tv_usec);
+ printf(LMSG("outgoing timeout (%jd/%ld)"),
+ (intmax_t)utv.tv_sec, utv.tv_usec);
#endif
ltv.tv_sec = utv.tv_sec;
ltv.tv_usec = utv.tv_usec;
@@ -627,7 +623,6 @@
return msync(td, &bsd_args);
}
-#ifndef __alpha__
int
linux_time(struct thread *td, struct linux_time_args *args)
{
@@ -647,20 +642,15 @@
td->td_retval[0] = tm;
return 0;
}
-#endif /*!__alpha__*/
struct l_times_argv {
- l_long tms_utime;
- l_long tms_stime;
- l_long tms_cutime;
- l_long tms_cstime;
+ l_long tms_utime;
+ l_long tms_stime;
+ l_long tms_cutime;
+ l_long tms_cstime;
};
-#ifdef __alpha__
-#define CLK_TCK 1024 /* Linux uses 1024 on alpha */
-#else
-#define CLK_TCK 100 /* Linux uses 100 */
-#endif
+#define CLK_TCK 100 /* Linux uses 100 */
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
@@ -677,20 +667,24 @@
printf(ARGS(times, "*"));
#endif
- p = td->td_proc;
- PROC_LOCK(p);
- calcru(p, &utime, &stime);
- calccru(p, &cutime, &cstime);
- PROC_UNLOCK(p);
+ if (args->buf != NULL) {
+ p = td->td_proc;
+ PROC_LOCK(p);
+ PROC_SLOCK(p);
+ calcru(p, &utime, &stime);
+ PROC_SUNLOCK(p);
+ calccru(p, &cutime, &cstime);
+ PROC_UNLOCK(p);
- tms.tms_utime = CONVTCK(utime);
- tms.tms_stime = CONVTCK(stime);
+ tms.tms_utime = CONVTCK(utime);
+ tms.tms_stime = CONVTCK(stime);
- tms.tms_cutime = CONVTCK(cutime);
- tms.tms_cstime = CONVTCK(cstime);
+ tms.tms_cutime = CONVTCK(cutime);
+ tms.tms_cstime = CONVTCK(cstime);
- if ((error = copyout(&tms, args->buf, sizeof(tms))))
- return error;
+ if ((error = copyout(&tms, args->buf, sizeof(tms))))
+ return error;
+ }
microuptime(&tv);
td->td_retval[0] = (int)CONVTCK(tv);
@@ -726,6 +720,7 @@
#ifdef __i386__
{
const char *class;
+
switch (cpu_class) {
case CPUCLASS_686:
class = "i686";
@@ -793,11 +788,42 @@
LFREEPATH(fname);
return (error);
}
+
+int
+linux_utimes(struct thread *td, struct linux_utimes_args *args)
+{
+ l_timeval ltv[2];
+ struct timeval tv[2], *tvp = NULL;
+ char *fname;
+ int error;
+
+ LCONVPATHEXIST(td, args->fname, &fname);
+
+#ifdef DEBUG
+ if (ldebug(utimes))
+ printf(ARGS(utimes, "%s, *"), fname);
+#endif
+
+ if (args->tptr != NULL) {
+ if ((error = copyin(args->tptr, ltv, sizeof ltv))) {
+ LFREEPATH(fname);
+ return (error);
+ }
+ tv[0].tv_sec = ltv[0].tv_sec;
+ tv[0].tv_usec = ltv[0].tv_usec;
+ tv[1].tv_sec = ltv[1].tv_sec;
+ tv[1].tv_usec = ltv[1].tv_usec;
+ tvp = tv;
+ }
+
+ error = kern_utimes(td, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE);
+ LFREEPATH(fname);
+ return (error);
+}
#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
#define __WCLONE 0x80000000
-#ifndef __alpha__
int
linux_waitpid(struct thread *td, struct linux_waitpid_args *args)
{
@@ -808,6 +834,12 @@
printf(ARGS(waitpid, "%d, %p, %d"),
args->pid, (void *)args->status, args->options);
#endif
+ /*
+ * this is necessary because the test in kern_wait doesn't work
+ * because we mess with the options here
+ */
+ if (args->options & ~(WUNTRACED | WNOHANG | WCONTINUED | __WCLONE))
+ return (EINVAL);
options = (args->options & (WNOHANG | WUNTRACED));
/* WLINUXCLONE should be equal to __WCLONE, but we make sure */
@@ -831,7 +863,6 @@
return 0;
}
-#endif /*!__alpha__*/
int
linux_wait4(struct thread *td, struct linux_wait4_args *args)
@@ -862,7 +893,7 @@
p = td->td_proc;
PROC_LOCK(p);
- SIGDELSET(p->p_siglist, SIGCHLD);
+ sigqueue_delete(&p->p_sigqueue, SIGCHLD);
PROC_UNLOCK(p);
if (args->status) {
@@ -894,11 +925,34 @@
printf(ARGS(mknod, "%s, %d, %d"), path, args->mode, args->dev);
#endif
- if (args->mode & S_IFIFO)
+ switch (args->mode & S_IFMT) {
+ case S_IFIFO:
+ case S_IFSOCK:
error = kern_mkfifo(td, path, UIO_SYSSPACE, args->mode);
- else
+ break;
+
+ case S_IFCHR:
+ case S_IFBLK:
error = kern_mknod(td, path, UIO_SYSSPACE, args->mode,
args->dev);
+ break;
+
+ case S_IFDIR:
+ error = EPERM;
+ break;
+
+ case 0:
+ args->mode |= S_IFREG;
+ /* FALLTHROUGH */
+ case S_IFREG:
+ error = kern_open(td, path, UIO_SYSSPACE,
+ O_WRONLY | O_CREAT | O_TRUNC, args->mode);
+ break;
+
+ default:
+ error = EINVAL;
+ break;
+ }
LFREEPATH(path);
return (error);
}
@@ -913,10 +967,8 @@
if (ldebug(personality))
printf(ARGS(personality, "%lu"), (unsigned long)args->per);
#endif
-#ifndef __alpha__
if (args->per != 0)
return EINVAL;
-#endif
/* Yes Jim, it's still a Linux... */
td->td_retval[0] = 0;
@@ -958,10 +1010,10 @@
B2L_ITIMERVAL(&aitv, &ls);
#ifdef DEBUG
if (ldebug(setitimer)) {
- printf("setitimer: value: sec: %ld, usec: %ld\n",
- aitv.it_value.tv_sec, aitv.it_value.tv_usec);
- printf("setitimer: interval: sec: %ld, usec: %ld\n",
- aitv.it_interval.tv_sec, aitv.it_interval.tv_usec);
+ printf("setitimer: value: sec: %jd, usec: %ld\n",
+ (intmax_t)aitv.it_value.tv_sec, aitv.it_value.tv_usec);
+ printf("setitimer: interval: sec: %jd, usec: %ld\n",
+ (intmax_t)aitv.it_interval.tv_sec, aitv.it_interval.tv_usec);
}
#endif
error = kern_setitimer(td, uap->which, &aitv, &oitv);
@@ -990,18 +1042,16 @@
return (copyout(&ls, uap->itv, sizeof(ls)));
}
-#ifndef __alpha__
int
linux_nice(struct thread *td, struct linux_nice_args *args)
{
- struct setpriority_args bsd_args;
+ struct setpriority_args bsd_args;
bsd_args.which = PRIO_PROCESS;
- bsd_args.who = 0; /* current process */
+ bsd_args.who = 0; /* current process */
bsd_args.prio = args->inc;
return setpriority(td, &bsd_args);
}
-#endif /*!__alpha__*/
int
linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
@@ -1029,7 +1079,7 @@
* Keep cr_groups[0] unchanged to prevent that.
*/
- if ((error = suser_cred(oldcred, SUSER_ALLOWJAIL)) != 0) {
+ if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS, 0)) != 0) {
PROC_UNLOCK(p);
crfree(newcred);
return (error);
@@ -1045,8 +1095,7 @@
bsd_gidset[ngrp + 1] = linux_gidset[ngrp];
ngrp--;
}
- }
- else
+ } else
newcred->cr_ngroups = 1;
setsugid(p);
@@ -1096,7 +1145,6 @@
return (0);
}
-#ifndef __alpha__
int
linux_setrlimit(struct thread *td, struct linux_setrlimit_args *args)
{
@@ -1199,7 +1247,6 @@
rlim.rlim_max = (l_ulong)bsd_rlim.rlim_max;
return (copyout(&rlim, args->rlim, sizeof(rlim)));
}
-#endif /*!__alpha__*/
int
linux_sched_setscheduler(struct thread *td,
@@ -1319,6 +1366,13 @@
#define REBOOT_CAD_ON 0x89abcdef
#define REBOOT_CAD_OFF 0
#define REBOOT_HALT 0xcdef0123
+#define REBOOT_RESTART 0x01234567
+#define REBOOT_RESTART2 0xA1B2C3D4
+#define REBOOT_POWEROFF 0x4321FEDC
+#define REBOOT_MAGIC1 0xfee1dead
+#define REBOOT_MAGIC2 0x28121969
+#define REBOOT_MAGIC2A 0x05121996
+#define REBOOT_MAGIC2B 0x16041998
int
linux_reboot(struct thread *td, struct linux_reboot_args *args)
@@ -1329,20 +1383,45 @@
if (ldebug(reboot))
printf(ARGS(reboot, "0x%x"), args->cmd);
#endif
- if (args->cmd == REBOOT_CAD_ON || args->cmd == REBOOT_CAD_OFF)
- return (0);
- bsd_args.opt = (args->cmd == REBOOT_HALT) ? RB_HALT : 0;
- return (reboot(td, &bsd_args));
+
+ if (args->magic1 != REBOOT_MAGIC1)
+ return EINVAL;
+
+ switch (args->magic2) {
+ case REBOOT_MAGIC2:
+ case REBOOT_MAGIC2A:
+ case REBOOT_MAGIC2B:
+ break;
+ default:
+ return EINVAL;
+ }
+
+ switch (args->cmd) {
+ case REBOOT_CAD_ON:
+ case REBOOT_CAD_OFF:
+ return (priv_check(td, PRIV_REBOOT));
+ case REBOOT_HALT:
+ bsd_args.opt = RB_HALT;
+ break;
+ case REBOOT_RESTART:
+ case REBOOT_RESTART2:
+ bsd_args.opt = 0;
+ break;
+ case REBOOT_POWEROFF:
+ bsd_args.opt = RB_POWEROFF;
+ break;
+ default:
+ return EINVAL;
+ }
+ return reboot(td, &bsd_args);
}
-#ifndef __alpha__
/*
* The FreeBSD native getpid(2), getgid(2) and getuid(2) also modify
- * td->td_retval[1] when COMPAT_43 is defined. This
- * globbers registers that are assumed to be preserved. The following
- * lightweight syscalls fixes this. See also linux_getgid16() and
- * linux_getuid16() in linux_uid16.c.
+ * td->td_retval[1] when COMPAT_43 is defined. This clobbers registers that
+ * are assumed to be preserved. The following lightweight syscalls fixes
+ * this. See also linux_getgid16() and linux_getuid16() in linux_uid16.c
*
* linux_getpid() - MP SAFE
* linux_getgid() - MP SAFE
@@ -1352,15 +1431,97 @@
int
linux_getpid(struct thread *td, struct linux_getpid_args *args)
{
+ struct linux_emuldata *em;
+
+#ifdef DEBUG
+ if (ldebug(getpid))
+ printf(ARGS(getpid, ""));
+#endif
+
+ if (linux_use26(td)) {
+ em = em_find(td->td_proc, EMUL_DONTLOCK);
+ KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
+ td->td_retval[0] = em->shared->group_pid;
+ } else {
+ td->td_retval[0] = td->td_proc->p_pid;
+ }
+
+ return (0);
+}
+
+int
+linux_gettid(struct thread *td, struct linux_gettid_args *args)
+{
+
+#ifdef DEBUG
+ if (ldebug(gettid))
+ printf(ARGS(gettid, ""));
+#endif
td->td_retval[0] = td->td_proc->p_pid;
return (0);
}
+
+int
+linux_getppid(struct thread *td, struct linux_getppid_args *args)
+{
+ struct linux_emuldata *em;
+ struct proc *p, *pp;
+
+#ifdef DEBUG
+ if (ldebug(getppid))
+ printf(ARGS(getppid, ""));
+#endif
+
+ if (!linux_use26(td)) {
+ PROC_LOCK(td->td_proc);
+ td->td_retval[0] = td->td_proc->p_pptr->p_pid;
+ PROC_UNLOCK(td->td_proc);
+ return (0);
+ }
+
+ em = em_find(td->td_proc, EMUL_DONTLOCK);
+
+ KASSERT(em != NULL, ("getppid: process emuldata not found.\n"));
+
+ /* find the group leader */
+ p = pfind(em->shared->group_pid);
+
+ if (p == NULL) {
+#ifdef DEBUG
+ printf(LMSG("parent process not found.\n"));
+#endif
+ return (0);
+ }
+
+ pp = p->p_pptr; /* switch to parent */
+ PROC_LOCK(pp);
+ PROC_UNLOCK(p);
+
+ /* if its also linux process */
+ if (pp->p_sysent == &elf_linux_sysvec) {
+ em = em_find(pp, EMUL_DONTLOCK);
+ KASSERT(em != NULL, ("getppid: parent emuldata not found.\n"));
+
+ td->td_retval[0] = em->shared->group_pid;
+ } else
+ td->td_retval[0] = pp->p_pid;
+
+ PROC_UNLOCK(pp);
+
+ return (0);
+}
+
int
linux_getgid(struct thread *td, struct linux_getgid_args *args)
{
+#ifdef DEBUG
+ if (ldebug(getgid))
+ printf(ARGS(getgid, ""));
+#endif
+
td->td_retval[0] = td->td_ucred->cr_rgid;
return (0);
}
@@ -1369,16 +1530,26 @@
linux_getuid(struct thread *td, struct linux_getuid_args *args)
{
+#ifdef DEBUG
+ if (ldebug(getuid))
+ printf(ARGS(getuid, ""));
+#endif
+
td->td_retval[0] = td->td_ucred->cr_ruid;
return (0);
}
-#endif /*!__alpha__*/
int
linux_getsid(struct thread *td, struct linux_getsid_args *args)
{
struct getsid_args bsd;
+
+#ifdef DEBUG
+ if (ldebug(getsid))
+ printf(ARGS(getsid, "%i"), args->pid);
+#endif
+
bsd.pid = args->pid;
return getsid(td, &bsd);
}
@@ -1393,12 +1564,173 @@
int
linux_getpriority(struct thread *td, struct linux_getpriority_args *args)
{
- struct getpriority_args bsd_args;
+ struct getpriority_args bsd_args;
int error;
+#ifdef DEBUG
+ if (ldebug(getpriority))
+ printf(ARGS(getpriority, "%i, %i"), args->which, args->who);
+#endif
+
bsd_args.which = args->which;
bsd_args.who = args->who;
error = getpriority(td, &bsd_args);
td->td_retval[0] = 20 - td->td_retval[0];
return error;
}
+
+int
+linux_sethostname(struct thread *td, struct linux_sethostname_args *args)
+{
+ int name[2];
+
+#ifdef DEBUG
+ if (ldebug(sethostname))
+ printf(ARGS(sethostname, "*, %i"), args->len);
+#endif
+
+ name[0] = CTL_KERN;
+ name[1] = KERN_HOSTNAME;
+ return (userland_sysctl(td, name, 2, 0, 0, 0, args->hostname,
+ args->len, 0, 0));
+}
+
+int
+linux_exit_group(struct thread *td, struct linux_exit_group_args *args)
+{
+ struct linux_emuldata *em, *td_em, *tmp_em;
+ struct proc *sp;
+
+#ifdef DEBUG
+ if (ldebug(exit_group))
+ printf(ARGS(exit_group, "%i"), args->error_code);
+#endif
+
+ if (linux_use26(td)) {
+ td_em = em_find(td->td_proc, EMUL_DONTLOCK);
+
+ KASSERT(td_em != NULL, ("exit_group: emuldata not found.\n"));
+
+ EMUL_SHARED_RLOCK(&emul_shared_lock);
+ LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) {
+ if (em->pid == td_em->pid)
+ continue;
+
+ sp = pfind(em->pid);
+ psignal(sp, SIGKILL);
+ PROC_UNLOCK(sp);
+#ifdef DEBUG
+ printf(LMSG("linux_sys_exit_group: kill PID %d\n"), em->pid);
+#endif
+ }
+
+ EMUL_SHARED_RUNLOCK(&emul_shared_lock);
+ }
+ /*
+ * XXX: we should send a signal to the parent if
+ * SIGNAL_EXIT_GROUP is set. We ignore that (temporarily?)
+ * as it doesnt occur often.
+ */
+ exit1(td, W_EXITCODE(args->error_code, 0));
+
+ return (0);
+}
+
+int
+linux_prctl(struct thread *td, struct linux_prctl_args *args)
+{
+ int error = 0, max_size;
+ struct proc *p = td->td_proc;
+ char comm[LINUX_MAX_COMM_LEN];
+ struct linux_emuldata *em;
+ int pdeath_signal;
+
+#ifdef DEBUG
+ if (ldebug(prctl))
+ printf(ARGS(prctl, "%d, %d, %d, %d, %d"), args->option,
+ args->arg2, args->arg3, args->arg4, args->arg5);
+#endif
+
+ switch (args->option) {
+ case LINUX_PR_SET_PDEATHSIG:
+ if (!LINUX_SIG_VALID(args->arg2))
+ return (EINVAL);
+ em = em_find(p, EMUL_DOLOCK);
+ KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
+ em->pdeath_signal = args->arg2;
+ EMUL_UNLOCK(&emul_lock);
+ break;
+ case LINUX_PR_GET_PDEATHSIG:
+ em = em_find(p, EMUL_DOLOCK);
+ KASSERT(em != NULL, ("prctl: emuldata not found.\n"));
+ pdeath_signal = em->pdeath_signal;
+ EMUL_UNLOCK(&emul_lock);
+ error = copyout(&pdeath_signal,
+ (void *)(register_t)args->arg2,
+ sizeof(pdeath_signal));
+ break;
+ case LINUX_PR_SET_NAME:
+ /*
+ * To be on the safe side we need to make sure to not
+ * overflow the size a linux program expects. We already
+ * do this here in the copyin, so that we don't need to
+ * check on copyout.
+ */
+ max_size = MIN(sizeof(comm), sizeof(p->p_comm));
+ error = copyinstr((void *)(register_t)args->arg2, comm,
+ max_size, NULL);
+
+ /* Linux silently truncates the name if it is too long. */
+ if (error == ENAMETOOLONG) {
+ /*
+ * XXX: copyinstr() isn't documented to populate the
+ * array completely, so do a copyin() to be on the
+ * safe side. This should be changed in case
+ * copyinstr() is changed to guarantee this.
+ */
+ error = copyin((void *)(register_t)args->arg2, comm,
+ max_size - 1);
+ comm[max_size - 1] = '\0';
+ }
+ if (error)
+ return (error);
+
+ PROC_LOCK(p);
+ strlcpy(p->p_comm, comm, sizeof(p->p_comm));
+ PROC_UNLOCK(p);
+ break;
+ case LINUX_PR_GET_NAME:
+ PROC_LOCK(p);
+ strlcpy(comm, p->p_comm, sizeof(comm));
+ PROC_UNLOCK(p);
+ error = copyout(comm, (void *)(register_t)args->arg2,
+ strlen(comm) + 1);
+ break;
+ default:
+ error = EINVAL;
+ break;
+ }
+
+ return (error);
+}
+
+/*
+ * XXX: fake one.. waiting for real implementation of affinity mask.
+ */
+int
+linux_sched_getaffinity(struct thread *td,
+ struct linux_sched_getaffinity_args *args)
+{
+ int error;
+ cpumask_t i = ~0;
+
+ if (args->len < sizeof(cpumask_t))
+ return (EINVAL);
+
+ error = copyout(&i, args->user_mask_ptr, sizeof(cpumask_t));
+ if (error)
+ return (EFAULT);
+
+ td->td_retval[0] = sizeof(cpumask_t);
+ return (0);
+}
--- sys/compat/pecoff/imgact_pecoff.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* $NetBSD$ */
-/* $FreeBSD: src/sys/compat/pecoff/imgact_pecoff.h,v 1.2 2005/01/05 22:34:36 imp Exp $ */
-/*-
- * Copyright (c) 2000 Masaru OKI
- */
-
-#ifndef _PECOFF_EXEC_H_
-#define _PECOFF_EXEC_H_
-
-struct pecoff_dos_filehdr {
- u_int16_t d_magic;/* +0x00 'MZ' */
- u_int8_t d_stub[0x3a];
- u_int32_t d_peofs;/* +0x3c */
-};
-
-#define PECOFF_DOS_MAGIC 0x5a4d
-#define PECOFF_DOS_HDR_SIZE (sizeof(struct pecoff_dos_filehdr))
-
-#define DOS_BADMAG(dp) ((dp)->d_magic != PECOFF_DOS_MAGIC)
-
-/*
- * COFF file header
- */
-
-struct coff_filehdr {
- u_short f_magic;/* magic number */
- u_short f_nscns;/* # of sections */
- long f_timdat; /* timestamp */
- long f_symptr; /* file offset of symbol table */
- long f_nsyms;/* # of symbol table entries */
- u_short f_opthdr; /* size of optional header */
- u_short f_flags;/* flags */
-};
-
-/*
- * COFF system header
- */
-
-struct coff_aouthdr {
- short a_magic;
- short a_vstamp;
- long a_tsize;
- long a_dsize;
- long a_bsize;
- long a_entry;
- long a_tstart;
- long a_dstart;
-};
-
-/* magic */
-#define COFF_OMAGIC 0407 /* text not write-protected; data seg is
- * contiguous with text */
-#define COFF_NMAGIC 0410 /* text is write-protected; data starts at
- * next seg following text */
-#define COFF_ZMAGIC 0413 /* text and data segs are aligned for direct
- * paging */
-#define COFF_SMAGIC 0443 /* shared lib */
-
-struct pecoff_imghdr {
- long i_vaddr;
- long i_size;
-};
-
-struct pecoff_opthdr {
- long w_base;
- long w_salign;
- long w_falign;
- long w_osvers;
- long w_imgvers;
- long w_subvers;
- long w_rsvd;
- long w_imgsize;
- long w_hdrsize;
- long w_chksum;
- u_short w_subsys;
- u_short w_dllflags;
- long w_ssize;
- long w_cssize;
- long w_hsize;
- long w_chsize;
- long w_lflag;
- long w_nimghdr;
- struct pecoff_imghdr w_imghdr[16];
-};
-
-/*
- * COFF section header
- */
-
-struct coff_scnhdr {
- char s_name[8];
- long s_paddr;
- long s_vaddr;
- long s_size;
- long s_scnptr;
- long s_relptr;
- long s_lnnoptr;
- u_short s_nreloc;
- u_short s_nlnno;
- long s_flags;
-};
-
-/* s_flags */
-#define COFF_STYP_REG 0x00
-#define COFF_STYP_DSECT 0x01
-#define COFF_STYP_NOLOAD 0x02
-#define COFF_STYP_GROUP 0x04
-#define COFF_STYP_PAD 0x08
-#define COFF_STYP_COPY 0x10
-#define COFF_STYP_TEXT 0x20
-#define COFF_STYP_DATA 0x40
-#define COFF_STYP_BSS 0x80
-#define COFF_STYP_INFO 0x200
-#define COFF_STYP_OVER 0x400
-#define COFF_STYP_SHLIB 0x800
-/* s_flags for PE */
-#define COFF_STYP_DISCARD 0x2000000
-#define COFF_STYP_EXEC 0x20000000
-#define COFF_STYP_READ 0x40000000
-#define COFF_STYP_WRITE 0x80000000
-
-struct pecoff_args {
- u_long a_base;
- u_long a_entry;
- u_long a_end;
- u_long a_subsystem;
- struct pecoff_imghdr a_imghdr[16];
- u_long a_ldbase;
- u_long a_ldexport;
-};
-
-#define COFF_LDPGSZ 4096
-#define COFF_ALIGN(a) ((a) & ~(COFF_LDPGSZ - 1))
-#define COFF_ROUND(a) COFF_ALIGN((a) + COFF_LDPGSZ - 1)
-
-#define COFF_HDR_SIZE \
- (sizeof(struct coff_filehdr) + sizeof(struct coff_aouthdr))
-
-#define PECOFF_HDR_SIZE (COFF_HDR_SIZE + sizeof(struct pecoff_opthdr))
-
-
-#endif
--- sys/compat/pecoff/imgact_pecoff.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/*-
- * Copyright (c) 2000 Masaru OKI
- * Copyright (c) 1994, 1995, 1998 Scott Bartram
- * Copyright (c) 1994 Adam Glass
- * Copyright (c) 1993, 1994 Christopher G. Demetriou
- *
- * originally from NetBSD kern/exec_ecoff.c
- *
- * Copyright (c) 2000 Takanori Watanabe
- * Copyright (c) 2000 KUROSAWA Takahiro
- * Copyright (c) 1995-1996 Sen Schmidt
- * Copyright (c) 1996 Peter Wemm
- * All rights reserved.
- *
- * originally from FreeBSD kern/imgact_elf.c
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Masaru OKI.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/pecoff/imgact_pecoff.c,v 1.39 2005/02/22 01:26:48 sam Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/imgact.h>
-#include <sys/lock.h>
-#include <sys/malloc.h>
-#include <sys/mman.h>
-#include <sys/mutex.h>
-#include <sys/namei.h>
-#include <sys/proc.h>
-#include <sys/signalvar.h>
-#include <sys/sysent.h>
-#include <sys/vnode.h>
-
-#include <machine/reg.h>
-
-#include <vm/vm.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
-#include <vm/vm_map.h>
-#include <vm/vm_object.h>
-#include <vm/vm_extern.h>
-
-#include <sys/exec.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <machine/cpu.h>
-#include <sys/syscall.h>
-#include <sys/sysent.h>
-#include <machine/md_var.h>
-#include <machine/pecoff_machdep.h>
-#include <compat/pecoff/imgact_pecoff.h>
-
-#include "opt_pecoff.h"
-
-#define PECOFF_PE_SIGNATURE "PE\0\0"
-static int pecoff_fixup(register_t **, struct image_params *);
-#ifndef PECOFF_DEBUG
-#define DPRINTF(a)
-#else
-#define DPRINTF(a) printf a
-#endif
-static struct sysentvec pecoff_sysvec = {
- SYS_MAXSYSCALL,
- sysent,
- 0,
- 0,
- NULL,
- 0,
- NULL,
- NULL,
- pecoff_fixup,
- sendsig,
- sigcode,
- &szsigcode,
- 0,
- "FreeBSD PECoff",
- NULL,
- NULL,
- MINSIGSTKSZ,
- PAGE_SIZE,
- VM_MIN_ADDRESS,
- VM_MAXUSER_ADDRESS,
- USRSTACK,
- PS_STRINGS,
- VM_PROT_ALL,
- exec_copyout_strings,
- exec_setregs,
- NULL
-
-};
-
-static const char signature[] = PECOFF_PE_SIGNATURE;
-
-static int
-exec_pecoff_coff_prep_omagic(struct image_params *,
- struct coff_filehdr *,
- struct coff_aouthdr *, int peoffs);
-static int
-exec_pecoff_coff_prep_nmagic(struct image_params *,
- struct coff_filehdr *,
- struct coff_aouthdr *, int peoffs);
-static int
-exec_pecoff_coff_prep_zmagic(struct image_params *,
- struct coff_filehdr *,
- struct coff_aouthdr *, int peoffs);
-
-static int
-exec_pecoff_coff_makecmds(struct image_params *,
- struct coff_filehdr *, int);
-
-static int pecoff_signature(struct thread *, struct vnode *, const struct pecoff_dos_filehdr *);
-static int pecoff_read_from(struct thread *, struct vnode *, int, caddr_t, int);
-static int
-pecoff_load_section(struct thread * td,
- struct vmspace * vmspace, struct vnode * vp,
- vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz,
- vm_prot_t prot);
-
-static int
-pecoff_fixup(register_t ** stack_base, struct image_params * imgp)
-{
- int len = sizeof(struct pecoff_args);
- struct pecoff_imghdr *ap;
- register_t *pos;
-
- pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
- ap = (struct pecoff_imghdr *) imgp->auxargs;
- if (copyout(ap, pos, len)) {
- return 0;
- }
- free(ap, M_TEMP);
- imgp->auxargs = NULL;
- (*stack_base)--;
- suword(*stack_base, (long) imgp->args->argc);
- return 0;
-}
-
-static int
-pecoff_load_section(struct thread * td, struct vmspace * vmspace, struct vnode * vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot)
-{
- size_t map_len;
- vm_offset_t map_addr;
- int error, rv;
- size_t copy_len;
- size_t copy_map_len;
- size_t copy_start;
- vm_object_t object;
- vm_offset_t copy_map_offset;
- vm_offset_t file_addr;
- vm_offset_t data_buf = 0;
-
- object = vp->v_object;
- error = 0;
-
- map_addr = trunc_page((vm_offset_t) vmaddr);
- file_addr = trunc_page(offset);
- DPRINTF(("SECARG:%x %p %x %x\n", offset, vmaddr, memsz, filsz));
- if (file_addr != offset) {
- /*
- * The section is not on page boundary. We can't use
- * vm_map_insert(). Use copyin instead.
- */
- map_len = round_page(memsz);
- copy_len = filsz;
- copy_map_offset = file_addr;
- copy_map_len = round_page(offset + filsz) - file_addr;
- copy_start = offset - file_addr;
-
- DPRINTF(("offset=%x vmaddr=%lx filsz=%x memsz=%x\n",
- offset, (long)vmaddr, filsz, memsz));
- DPRINTF(("map_len=%x copy_len=%x copy_map_offset=%x"
- " copy_map_len=%x copy_start=%x\n",
- map_len, copy_len, copy_map_offset,
- copy_map_len, copy_start));
- } else {
-
- map_len = trunc_page(filsz);
-
- if (map_len != 0) {
- vm_object_reference(object);
- vm_map_lock(&vmspace->vm_map);
- rv = vm_map_insert(&vmspace->vm_map,
- object,
- file_addr, /* file offset */
- map_addr, /* virtual start */
- map_addr + map_len, /* virtual end */
- prot,
- VM_PROT_ALL,
- MAP_COPY_ON_WRITE | MAP_PREFAULT);
-
- vm_map_unlock(&vmspace->vm_map);
- if (rv != KERN_SUCCESS) {
- vm_object_deallocate(object);
- return EINVAL;
- }
- /* we can stop now if we've covered it all */
- if (memsz == filsz)
- return 0;
-
- }
- copy_map_offset = trunc_page(offset + filsz);
- copy_map_len = PAGE_SIZE;
- copy_start = 0;
- copy_len = (offset + filsz) - trunc_page(offset + filsz);
- map_addr = trunc_page((vm_offset_t) vmaddr + filsz);
- map_len = round_page((vm_offset_t) vmaddr + memsz) - map_addr;
-
- }
-
- if (map_len != 0) {
- vm_map_lock(&vmspace->vm_map);
- rv = vm_map_insert(&vmspace->vm_map, NULL, 0,
- map_addr, map_addr + map_len,
- VM_PROT_ALL, VM_PROT_ALL, 0);
- vm_map_unlock(&vmspace->vm_map);
- DPRINTF(("EMP-rv:%d,%x %x\n", rv, map_addr, map_addr + map_len));
- if (rv != KERN_SUCCESS) {
- return EINVAL;
- }
- }
- DPRINTF(("COPYARG %x %x\n", map_addr, copy_len));
- if (copy_len != 0) {
- vm_object_reference(object);
- rv = vm_map_find(exec_map,
- object,
- copy_map_offset,
- &data_buf,
- copy_map_len,
- TRUE,
- VM_PROT_READ,
- VM_PROT_ALL,
- MAP_COPY_ON_WRITE | MAP_PREFAULT_PARTIAL);
- if (rv != KERN_SUCCESS) {
- vm_object_deallocate(object);
- return EINVAL;
- }
- /* send the page fragment to user space */
-
- error = copyout((caddr_t) data_buf + copy_start,
- (caddr_t) map_addr, copy_len);
- vm_map_remove(exec_map, data_buf, data_buf + copy_map_len);
- DPRINTF(("%d\n", error));
- if (error)
- return (error);
- }
- /*
- * set it to the specified protection
- */
- vm_map_protect(&vmspace->vm_map, map_addr,
- map_addr + map_len, prot,
- FALSE);
- return error;
-
-}
-static int
-pecoff_load_file(struct thread * td, const char *file, u_long * addr, u_long * entry, u_long * ldexport)
-{
-
- struct nameidata nd;
- struct pecoff_dos_filehdr dh;
- struct coff_filehdr *fp = 0;
- struct coff_aouthdr *ap;
- struct pecoff_opthdr *wp;
- struct coff_scnhdr *sh = 0;
- struct vmspace *vmspace = td->td_proc->p_vmspace;
- struct vattr attr;
- struct image_params image_params, *imgp;
- int peofs;
- int error, i, scnsiz;
-
- imgp = &image_params;
- /*
- * Initialize part of the common data
- */
- imgp->proc = td->td_proc;
- imgp->execlabel = NULL;
- imgp->attr = &attr;
- imgp->firstpage = NULL;
-
- NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, td);
-
- if ((error = namei(&nd)) != 0) {
- nd.ni_vp = NULL;
- goto fail;
- }
- NDFREE(&nd, NDF_ONLY_PNBUF);
- imgp->vp = nd.ni_vp;
-
- /*
- * Check permissions, modes, uid, etc on the file, and "open" it.
- */
- error = exec_check_permissions(imgp);
- VOP_UNLOCK(nd.ni_vp, 0, td);
- if (error)
- goto fail;
- if ((error = pecoff_read_from(td, imgp->vp, 0, (caddr_t) & dh, sizeof(dh))) != 0)
- goto fail;
- if ((error = pecoff_signature(td, imgp->vp, &dh) != 0))
- goto fail;
- fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK);
- peofs = dh.d_peofs + sizeof(signature) - 1;
- if ((error = pecoff_read_from(td, imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE) != 0))
- goto fail;
- if (COFF_BADMAG(fp)) {
- error = ENOEXEC;
- goto fail;
- }
- ap = (void *) ((char *) fp + sizeof(struct coff_filehdr));
- wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr));
- /* read section header */
- scnsiz = sizeof(struct coff_scnhdr) * fp->f_nscns;
- sh = malloc(scnsiz, M_TEMP, M_WAITOK);
- if ((error = pecoff_read_from(td, imgp->vp, peofs + PECOFF_HDR_SIZE,
- (caddr_t) sh, scnsiz)) != 0)
- goto fail;
-
- /*
- * Read Section infomation and map sections.
- */
-
- for (i = 0; i < fp->f_nscns; i++) {
- int prot = 0;
-
- if (sh[i].s_flags & COFF_STYP_DISCARD)
- continue;
- /* XXX ? */
- if ((sh[i].s_flags & COFF_STYP_TEXT) &&
- (sh[i].s_flags & COFF_STYP_EXEC) == 0)
- continue;
- if ((sh[i].s_flags & (COFF_STYP_TEXT | COFF_STYP_DATA | COFF_STYP_BSS)) == 0)
- continue;
-
- prot |= (sh[i].s_flags & COFF_STYP_READ) ? VM_PROT_READ : 0;
- prot |= (sh[i].s_flags & COFF_STYP_WRITE) ? VM_PROT_WRITE : 0;
- prot |= (sh[i].s_flags & COFF_STYP_EXEC) ? VM_PROT_EXECUTE : 0;
-
- sh[i].s_vaddr += wp->w_base; /* RVA --> VA */
- if ((error = pecoff_load_section(td, vmspace, imgp->vp, sh[i].s_scnptr
- ,(caddr_t) sh[i].s_vaddr,
- sh[i].s_paddr, sh[i].s_size
- ,prot)) != 0)
- goto fail;
-
- }
- *entry = wp->w_base + ap->a_entry;
- *addr = wp->w_base;
- *ldexport = wp->w_imghdr[0].i_vaddr + wp->w_base;
-fail:
- if (fp)
- free(fp, M_TEMP);
- if (sh)
- free(sh, M_TEMP);
- if (nd.ni_vp)
- vrele(nd.ni_vp);
-
- return error;
-}
-static int
-exec_pecoff_coff_prep_omagic(struct image_params * imgp,
- struct coff_filehdr * fp,
- struct coff_aouthdr * ap, int peofs)
-{
- return ENOEXEC;
-}
-static int
-exec_pecoff_coff_prep_nmagic(struct image_params * imgp,
- struct coff_filehdr * fp,
- struct coff_aouthdr * ap, int peofs)
-{
- return ENOEXEC;
-}
-static int
-exec_pecoff_coff_prep_zmagic(struct image_params * imgp,
- struct coff_filehdr * fp,
- struct coff_aouthdr * ap, int peofs)
-{
- int scnsiz = sizeof(struct coff_scnhdr) * fp->f_nscns;
- int error = ENOEXEC, i;
- int prot;
- u_long text_size = 0, data_size = 0, dsize;
- u_long text_addr = 0, data_addr = VM_MAXUSER_ADDRESS;
- u_long ldexport, ldbase;
- struct pecoff_opthdr *wp;
- struct coff_scnhdr *sh;
- struct vmspace *vmspace;
- struct pecoff_args *argp = NULL;
-
- sh = malloc(scnsiz, M_TEMP, M_WAITOK);
-
- wp = (void *) ((char *) ap + sizeof(struct coff_aouthdr));
- error = pecoff_read_from(FIRST_THREAD_IN_PROC(imgp->proc), imgp->vp,
- peofs + PECOFF_HDR_SIZE, (caddr_t) sh, scnsiz);
- exec_new_vmspace(imgp, &pecoff_sysvec);
- vmspace = imgp->proc->p_vmspace;
- for (i = 0; i < fp->f_nscns; i++) {
- prot = VM_PROT_WRITE; /* XXX for relocation? */
- prot |= (sh[i].s_flags & COFF_STYP_READ) ? VM_PROT_READ : 0;
- prot |= (sh[i].s_flags & COFF_STYP_WRITE) ? VM_PROT_WRITE : 0;
- prot |= (sh[i].s_flags & COFF_STYP_EXEC) ? VM_PROT_EXECUTE : 0;
- sh[i].s_vaddr += wp->w_base;
- if (sh[i].s_flags & COFF_STYP_DISCARD)
- continue;
- if ((sh[i].s_flags & COFF_STYP_TEXT) != 0) {
-
- error = pecoff_load_section(
- FIRST_THREAD_IN_PROC(imgp->proc),
- vmspace, imgp->vp, sh[i].s_scnptr,
- (caddr_t) sh[i].s_vaddr, sh[i].s_paddr,
- sh[i].s_size ,prot);
- DPRINTF(("ERROR%d\n", error));
- if (error)
- goto fail;
- text_addr = trunc_page(sh[i].s_vaddr);
- text_size = trunc_page(sh[i].s_size + sh[i].s_vaddr - text_addr);
-
- }
- if ((sh[i].s_flags & (COFF_STYP_DATA|COFF_STYP_BSS)) != 0) {
- if (pecoff_load_section(
- FIRST_THREAD_IN_PROC(imgp->proc), vmspace,
- imgp->vp, sh[i].s_scnptr, (caddr_t) sh[i].s_vaddr,
- sh[i].s_paddr, sh[i].s_size, prot) != 0)
- goto fail;
- data_addr = min(trunc_page(sh[i].s_vaddr), data_addr);
- dsize = round_page(sh[i].s_vaddr + sh[i].s_paddr)
- - data_addr;
- data_size = max(dsize, data_size);
-
- }
- }
- vmspace->vm_tsize = text_size >> PAGE_SHIFT;
- vmspace->vm_taddr = (caddr_t) (uintptr_t) text_addr;
- vmspace->vm_dsize = data_size >> PAGE_SHIFT;
- vmspace->vm_daddr = (caddr_t) (uintptr_t) data_addr;
- argp = malloc(sizeof(struct pecoff_args), M_TEMP, M_WAITOK);
- if (argp == NULL) {
- error = ENOMEM;
- goto fail;
- }
- argp->a_base = wp->w_base;
- argp->a_entry = wp->w_base + ap->a_entry;
- argp->a_end = data_addr + data_size;
- argp->a_subsystem = wp->w_subvers;
- error = pecoff_load_file(FIRST_THREAD_IN_PROC(imgp->proc),
- "/usr/libexec/ld.so.dll", &ldbase, &imgp->entry_addr, &ldexport);
- if (error)
- goto fail;
-
- argp->a_ldbase = ldbase;
- argp->a_ldexport = ldexport;
- memcpy(argp->a_imghdr, wp->w_imghdr, sizeof(struct pecoff_imghdr) * 16);
- for (i = 0; i < 16; i++) {
- argp->a_imghdr[i].i_vaddr += wp->w_base;
- }
- imgp->proc->p_sysent = &pecoff_sysvec;
- imgp->auxargs = argp;
- imgp->auxarg_size = sizeof(struct pecoff_args);
- imgp->interpreted = 0;
-
- if (sh != NULL)
- free(sh, M_TEMP);
- return 0;
-fail:
- error = (error) ? error : ENOEXEC;
- if (sh != NULL)
- free(sh, M_TEMP);
- if (argp != NULL)
- free(argp, M_TEMP);
-
- return error;
-}
-
-int
-exec_pecoff_coff_makecmds(struct image_params * imgp,
- struct coff_filehdr * fp, int peofs)
-{
- struct coff_aouthdr *ap;
- int error;
-
- if (COFF_BADMAG(fp)) {
- return ENOEXEC;
- }
- ap = (void *) ((char *) fp + sizeof(struct coff_filehdr));
- switch (ap->a_magic) {
- case COFF_OMAGIC:
- error = exec_pecoff_coff_prep_omagic(imgp, fp, ap, peofs);
- break;
- case COFF_NMAGIC:
- error = exec_pecoff_coff_prep_nmagic(imgp, fp, ap, peofs);
- break;
- case COFF_ZMAGIC:
- error = exec_pecoff_coff_prep_zmagic(imgp, fp, ap, peofs);
- break;
- default:
- return ENOEXEC;
- }
-
- return error;
-}
-
-static int
-pecoff_signature(td, vp, dp)
- struct thread *td;
- struct vnode *vp;
- const struct pecoff_dos_filehdr *dp;
-{
- int error;
- char buf[512];
- char *pesig;
- if (DOS_BADMAG(dp)) {
- return ENOEXEC;
- }
- error = pecoff_read_from(td, vp, dp->d_peofs, buf, sizeof(buf));
- if (error) {
- return error;
- }
- pesig = buf;
- if (memcmp(pesig, signature, sizeof(signature) - 1) == 0) {
- return 0;
- }
- return EFTYPE;
-}
-int
-pecoff_read_from(td, vp, pos, buf, siz)
- struct thread *td;
- struct vnode *vp;
- int pos;
- caddr_t buf;
- int siz;
-{
- int error;
- size_t resid;
-
- error = vn_rdwr(UIO_READ, vp, buf, siz, pos,
- UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, NOCRED,
- &resid, td);
- if (error)
- return error;
-
- if (resid != 0) {
- return ENOEXEC;
- }
- return 0;
-}
-
-static int
-imgact_pecoff(struct image_params * imgp)
-{
- const struct pecoff_dos_filehdr *dp = (const struct pecoff_dos_filehdr *)
- imgp->image_header;
- struct coff_filehdr *fp;
- int error, peofs;
- struct thread *td = curthread;
-
- error = pecoff_signature(FIRST_THREAD_IN_PROC(imgp->proc),
- imgp->vp, dp);
- if (error) {
- return -1;
- }
- VOP_UNLOCK(imgp->vp, 0, td);
-
- peofs = dp->d_peofs + sizeof(signature) - 1;
- fp = malloc(PECOFF_HDR_SIZE, M_TEMP, M_WAITOK);
- error = pecoff_read_from(FIRST_THREAD_IN_PROC(imgp->proc),
- imgp->vp, peofs, (caddr_t) fp, PECOFF_HDR_SIZE);
- if (error)
- goto fail;
-
- error = exec_pecoff_coff_makecmds(imgp, fp, peofs);
-fail:
- free(fp, M_TEMP);
- vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
- return error;
-}
-
-static struct execsw pecoff_execsw = {imgact_pecoff, "FreeBSD PEcoff"};
-EXEC_SET(pecoff, pecoff_execsw);
Index: subr_hal.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/subr_hal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/subr_hal.c -L sys/compat/ndis/subr_hal.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/subr_hal.c
+++ sys/compat/ndis/subr_hal.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_hal.c,v 1.24.2.2 2005/11/06 19:39:40 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_hal.c,v 1.28 2006/05/16 14:37:57 phk Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -46,7 +46,6 @@
#include <sys/module.h>
#include <sys/systm.h>
-#include <machine/clock.h>
#include <machine/bus.h>
#include <sys/bus.h>
Index: kern_windrv.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/kern_windrv.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/kern_windrv.c -L sys/compat/ndis/kern_windrv.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/kern_windrv.c
+++ sys/compat/ndis/kern_windrv.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_windrv.c,v 1.11.2.2 2005/11/06 03:52:24 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_windrv.c,v 1.14 2007/05/20 22:03:57 jeff Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -883,10 +883,10 @@
struct gdt gtable;
uint16_t ltable;
- mtx_lock_spin(&sched_lock);
-
t = curthread;
+ mtx_lock_spin(&dt_lock);
+
/* Grab location of existing GDT. */
x86_getldt(>able, <able);
@@ -904,7 +904,7 @@
x86_setldt(>able, ltable);
- mtx_unlock_spin(&sched_lock);
+ mtx_unlock_spin(&dt_lock);
return;
}
@@ -918,10 +918,10 @@
struct x86desc *l;
struct thread *t;
- mtx_lock_spin(&sched_lock);
-
t = curthread;
+ mtx_lock_spin(&dt_lock);
+
/* Grab location of existing GDT. */
x86_getldt(>able, <able);
@@ -952,7 +952,7 @@
x86_setldt(>able, ltable);
- mtx_unlock_spin(&sched_lock);
+ mtx_unlock_spin(&dt_lock);
/* Whew. */
Index: subr_pe.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/subr_pe.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/subr_pe.c -L sys/compat/ndis/subr_pe.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/subr_pe.c
+++ sys/compat/ndis/subr_pe.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.11.2.1 2005/10/27 17:06:46 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_pe.c,v 1.13 2007/04/06 11:18:57 pjd Exp $");
/*
* This file contains routines for relocating and dynamically linking
@@ -53,8 +53,6 @@
#include <sys/errno.h>
#ifdef _KERNEL
#include <sys/systm.h>
-extern int ndis_strncasecmp(const char *, const char *, size_t);
-#define strncasecmp(a, b, c) ndis_strncasecmp(a, b, c)
#else
#include <stdio.h>
#include <stddef.h>
Index: pe_var.h
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/pe_var.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/pe_var.h -L sys/compat/ndis/pe_var.h -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/pe_var.h
+++ sys/compat/ndis/pe_var.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/ndis/pe_var.h,v 1.13.2.1 2005/10/27 17:06:45 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/pe_var.h,v 1.14 2005/10/26 18:46:27 wpaul Exp $
*/
#ifndef _PE_VAR_H_
Index: subr_ndis.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/subr_ndis.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/subr_ndis.c -L sys/compat/ndis/subr_ndis.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/subr_ndis.c
+++ sys/compat/ndis/subr_ndis.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.94.2.3 2005/12/16 17:33:47 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.108 2007/05/31 11:51:49 kib Exp $");
/*
* This file implements a translation layer between the BSD networking
@@ -613,53 +613,6 @@
return(NDIS_STATUS_SUCCESS);
}
-int
-ndis_strcasecmp(s1, s2)
- const char *s1;
- const char *s2;
-{
- char a, b;
-
- /*
- * In the kernel, toupper() is a macro. Have to be careful
- * not to use pointer arithmetic when passing it arguments.
- */
-
- while(1) {
- a = *s1;
- b = *s2++;
- if (toupper(a) != toupper(b))
- break;
- if (*s1++ == '\0')
- return(0);
- }
-
- return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
-}
-
-int
-ndis_strncasecmp(s1, s2, n)
- const char *s1;
- const char *s2;
- size_t n;
-{
- char a, b;
-
- if (n != 0) {
- do {
- a = *s1;
- b = *s2++;
- if (toupper(a) != toupper(b))
- return (*(const unsigned char *)s1 -
- *(const unsigned char *)(s2 - 1));
- if (*s1++ == '\0')
- break;
- } while (--n != 0);
- }
-
- return(0);
-}
-
static void
NdisReadConfiguration(status, parm, cfg, key, type)
ndis_status *status;
@@ -700,7 +653,7 @@
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
#endif
oidp = e->entry;
- if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) {
+ if (strcasecmp(oidp->oid_name, keystr) == 0) {
if (strcmp((char *)oidp->oid_arg1, "UNSET") == 0) {
RtlFreeAnsiString(&as);
*status = NDIS_STATUS_FAILURE;
@@ -809,7 +762,7 @@
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
#endif
oidp = e->entry;
- if (ndis_strcasecmp(oidp->oid_name, keystr) == 0) {
+ if (strcasecmp(oidp->oid_name, keystr) == 0) {
/* Found it, set the value. */
strcpy((char *)oidp->oid_arg1, val);
RtlFreeAnsiString(&as);
@@ -2886,6 +2839,32 @@
return(0);
}
+struct ndis_checkmodule {
+ char *afilename;
+ ndis_fh *fh;
+};
+
+/*
+ * See if a single module contains the symbols for a specified file.
+ */
+static int
+NdisCheckModule(linker_file_t lf, void *context)
+{
+ struct ndis_checkmodule *nc;
+ caddr_t kldstart, kldend;
+
+ nc = (struct ndis_checkmodule *)context;
+ if (ndis_find_sym(lf, nc->afilename, "_start", &kldstart))
+ return (0);
+ if (ndis_find_sym(lf, nc->afilename, "_end", &kldend))
+ return (0);
+ nc->fh->nf_vp = lf;
+ nc->fh->nf_map = NULL;
+ nc->fh->nf_type = NDIS_FH_TYPE_MODULE;
+ nc->fh->nf_maplen = (kldend - kldstart) & 0xFFFFFFFF;
+ return (1);
+}
+
/* can also return NDIS_STATUS_RESOURCES/NDIS_STATUS_ERROR_READING_FILE */
static void
NdisOpenFile(status, filehandle, filelength, filename, highestaddr)
@@ -2899,13 +2878,12 @@
char *afilename = NULL;
struct thread *td = curthread;
struct nameidata nd;
- int flags, error;
+ int flags, error, vfslocked;
struct vattr vat;
struct vattr *vap = &vat;
ndis_fh *fh;
char *path;
- linker_file_t head, lf;
- caddr_t kldstart, kldend;
+ struct ndis_checkmodule nc;
if (RtlUnicodeStringToAnsiString(&as, filename, TRUE)) {
*status = NDIS_STATUS_RESOURCES;
@@ -2943,23 +2921,10 @@
* us since the kernel appears to us as just another module.
*/
- /*
- * This is an evil trick for getting the head of the linked
- * file list, which is not exported from kern_linker.o. It
- * happens that linker file #1 is always the kernel, and is
- * always the first element in the list.
- */
-
- head = linker_find_file_by_id(1);
- for (lf = head; lf != NULL; lf = TAILQ_NEXT(lf, link)) {
- if (ndis_find_sym(lf, afilename, "_start", &kldstart))
- continue;
- if (ndis_find_sym(lf, afilename, "_end", &kldend))
- continue;
- fh->nf_vp = lf;
- fh->nf_map = NULL;
- fh->nf_type = NDIS_FH_TYPE_MODULE;
- *filelength = fh->nf_maplen = (kldend - kldstart) & 0xFFFFFFFF;
+ nc.afilename = afilename;
+ nc.fh = fh;
+ if (linker_file_foreach(NdisCheckModule, &nc)) {
+ *filelength = fh->nf_maplen;
*filehandle = fh;
*status = NDIS_STATUS_SUCCESS;
return;
@@ -2986,8 +2951,6 @@
snprintf(path, MAXPATHLEN, "%s/%s", ndis_filepath, afilename);
- mtx_lock(&Giant);
-
/* Some threads don't have a current working directory. */
if (td->td_proc->p_fd->fd_rdir == NULL)
@@ -2995,12 +2958,11 @@
if (td->td_proc->p_fd->fd_cdir == NULL)
td->td_proc->p_fd->fd_cdir = rootvnode;
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, td);
+ NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE, UIO_SYSSPACE, path, td);
flags = FREAD;
- error = vn_open(&nd, &flags, 0, -1);
+ error = vn_open(&nd, &flags, 0, NULL);
if (error) {
- mtx_unlock(&Giant);
*status = NDIS_STATUS_FILE_NOT_FOUND;
ExFreePool(fh);
printf("NDIS: open file %s failed: %d\n", path, error);
@@ -3008,6 +2970,7 @@
free(afilename, M_DEVBUF);
return;
}
+ vfslocked = NDHASGIANT(&nd);
ExFreePool(path);
@@ -3016,7 +2979,7 @@
/* Get the file size. */
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred, td);
VOP_UNLOCK(nd.ni_vp, 0, td);
- mtx_unlock(&Giant);
+ VFS_UNLOCK_GIANT(vfslocked);
fh->nf_vp = nd.ni_vp;
fh->nf_map = NULL;
@@ -3038,7 +3001,8 @@
struct thread *td = curthread;
linker_file_t lf;
caddr_t kldstart;
- int error, resid;
+ int error, resid, vfslocked;
+ struct vnode *vp;
if (filehandle == NULL) {
*status = NDIS_STATUS_FAILURE;
@@ -3076,10 +3040,11 @@
return;
}
- mtx_lock(&Giant);
- error = vn_rdwr(UIO_READ, fh->nf_vp, fh->nf_map, fh->nf_maplen, 0,
+ vp = fh->nf_vp;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+ error = vn_rdwr(UIO_READ, vp, fh->nf_map, fh->nf_maplen, 0,
UIO_SYSSPACE, 0, td->td_ucred, NOCRED, &resid, td);
- mtx_unlock(&Giant);
+ VFS_UNLOCK_GIANT(vfslocked);
if (error)
*status = NDIS_STATUS_FAILURE;
@@ -3114,6 +3079,8 @@
{
struct thread *td = curthread;
ndis_fh *fh;
+ int vfslocked;
+ struct vnode *vp;
if (filehandle == NULL)
return;
@@ -3129,9 +3096,10 @@
return;
if (fh->nf_type == NDIS_FH_TYPE_VFS) {
- mtx_lock(&Giant);
- vn_close(fh->nf_vp, FREAD, td->td_ucred, td);
- mtx_unlock(&Giant);
+ vp = fh->nf_vp;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+ vn_close(vp, FREAD, td->td_ucred, td);
+ VFS_UNLOCK_GIANT(vfslocked);
}
fh->nf_vp = NULL;
Index: ndis_var.h
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/ndis_var.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/ndis_var.h -L sys/compat/ndis/ndis_var.h -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/ndis_var.h
+++ sys/compat/ndis/ndis_var.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.41.2.3 2005/11/07 16:58:23 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.47 2007/04/06 11:18:57 pjd Exp $
*/
#ifndef _NDIS_VAR_H_
@@ -1746,8 +1746,6 @@
extern int ndis_create_sysctls(void *);
extern int ndis_add_sysctl(void *, char *, char *, char *, int);
extern int ndis_flush_sysctls(void *);
-extern int ndis_strcasecmp(const char *, const char *);
-extern int ndis_strncasecmp(const char *, const char *, size_t);
extern uint32_t NdisAddDevice(driver_object *, device_object *);
extern void NdisAllocatePacketPool(ndis_status *,
Index: kern_ndis.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/kern_ndis.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/kern_ndis.c -L sys/compat/ndis/kern_ndis.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/kern_ndis.c
+++ sys/compat/ndis/kern_ndis.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.84.2.3 2005/11/06 03:52:24 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/kern_ndis.c,v 1.96 2007/06/10 04:40:13 mjacob Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -323,8 +323,7 @@
TAILQ_FOREACH(e, device_get_sysctl_ctx(sc->ndis_dev), link) {
#endif
oidp = e->entry;
- if (ndis_strcasecmp(oidp->oid_name,
- vals->nc_cfgkey) == 0)
+ if (strcasecmp(oidp->oid_name, vals->nc_cfgkey) == 0)
break;
oidp = NULL;
}
@@ -405,13 +404,16 @@
cfg->ndis_oid =
#if __FreeBSD_version < 502113
SYSCTL_ADD_STRING(&sc->ndis_ctx, SYSCTL_CHILDREN(sc->ndis_tree),
+ OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
+ cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
+ cfg->ndis_cfg.nc_cfgdesc);
#else
SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)),
-#endif
OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag,
cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val),
cfg->ndis_cfg.nc_cfgdesc);
+#endif
return(0);
}
@@ -943,7 +945,7 @@
ndis_senddone_func senddonefunc;
int i;
ndis_packet *p;
- uint8_t irql;
+ uint8_t irql = 0;
sc = arg;
adapter = sc->ndis_block->nmb_miniportadapterctx;
@@ -986,7 +988,7 @@
ndis_status status;
ndis_sendsingle_handler sendfunc;
ndis_senddone_func senddonefunc;
- uint8_t irql;
+ uint8_t irql = 0;
sc = arg;
adapter = sc->ndis_block->nmb_miniportadapterctx;
@@ -1079,7 +1081,7 @@
ndis_reset_handler resetfunc;
uint8_t addressing_reset;
int rval;
- uint8_t irql;
+ uint8_t irql = 0;
sc = arg;
@@ -1245,7 +1247,7 @@
* expects them to fire before the halt is called.
*/
- tsleep(curthread->td_proc, PWAIT, "ndwait", hz);
+ pause("ndwait", hz);
NDIS_LOCK(sc);
sc->ndis_block->nmb_devicectx = sc;
@@ -1370,7 +1372,7 @@
if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus) {
error = bus_setup_intr(sc->ndis_dev, sc->ndis_irq,
INTR_TYPE_NET | INTR_MPSAFE,
- ntoskrnl_intr, NULL, &sc->ndis_intrhand);
+ NULL, ntoskrnl_intr, NULL, &sc->ndis_intrhand);
if (error)
return(NDIS_STATUS_FAILURE);
}
Index: winx32_wrap.S
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/winx32_wrap.S,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/winx32_wrap.S -L sys/compat/ndis/winx32_wrap.S -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/winx32_wrap.S
+++ sys/compat/ndis/winx32_wrap.S
@@ -29,9 +29,14 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/ndis/winx32_wrap.S,v 1.2.4.2 2005/11/06 03:52:25 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/winx32_wrap.S,v 1.5 2006/06/12 20:35:59 jhb Exp $
*/
+/* The 'ret' macro doesn't work in this file if GPROF is enabled. */
+#ifdef GPROF
+#undef GPROF
+#endif
+
#include <machine/asmacros.h>
/*
Index: ntoskrnl_var.h
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/ntoskrnl_var.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/ntoskrnl_var.h -L sys/compat/ndis/ntoskrnl_var.h -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/ntoskrnl_var.h
+++ sys/compat/ndis/ntoskrnl_var.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.36.2.2 2005/11/06 19:39:40 wpaul Exp $
+ * $FreeBSD: src/sys/compat/ndis/ntoskrnl_var.h,v 1.43 2006/08/17 22:50:32 imp Exp $
*/
#ifndef _NTOSKRNL_VAR_H_
@@ -1257,8 +1257,7 @@
(w)->wqi_func = (func); \
(w)->wqi_ctx = (ctx); \
InitializeListHead(&((w)->wqi_entry)); \
- } while (0); \
-
+ } while (0)
/*
* FreeBSD's kernel stack is 2 pages in size by default. The
Index: subr_ntoskrnl.c
===================================================================
RCS file: /home/cvs/src/sys/compat/ndis/subr_ntoskrnl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/ndis/subr_ntoskrnl.c -L sys/compat/ndis/subr_ntoskrnl.c -u -r1.1.1.1 -r1.2
--- sys/compat/ndis/subr_ntoskrnl.c
+++ sys/compat/ndis/subr_ntoskrnl.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.71.2.5 2005/12/16 17:33:47 wpaul Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ntoskrnl.c,v 1.90 2007/07/22 20:53:28 thompsa Exp $");
#include <sys/ctype.h>
#include <sys/unistd.h>
@@ -57,7 +57,6 @@
#include <sys/sysctl.h>
#include <machine/atomic.h>
-#include <machine/clock.h>
#include <machine/bus.h>
#include <machine/stdarg.h>
#include <machine/resource.h>
@@ -198,6 +197,11 @@
static uint32_t InterlockedIncrement(volatile uint32_t *);
static uint32_t InterlockedDecrement(volatile uint32_t *);
static void ExInterlockedAddLargeStatistic(uint64_t *, uint32_t);
+static void *MmAllocateContiguousMemory(uint32_t, uint64_t);
+static void *MmAllocateContiguousMemorySpecifyCache(uint32_t,
+ uint64_t, uint64_t, uint64_t, uint32_t);
+static void MmFreeContiguousMemory(void *);
+static void MmFreeContiguousMemorySpecifyCache(void *, uint32_t, uint32_t);
static uint32_t MmSizeOfMdl(void *, size_t);
static void *MmMapLockedPages(mdl *, uint8_t);
static void *MmMapLockedPagesSpecifyCache(mdl *,
@@ -235,6 +239,7 @@
static uint32_t IoWMIRegistrationControl(device_object *, uint32_t);
static void *ntoskrnl_memset(void *, int, size_t);
static void *ntoskrnl_memmove(void *, void *, size_t);
+static void *ntoskrnl_memchr(void *, unsigned char, size_t);
static char *ntoskrnl_strstr(char *, char *);
static int ntoskrnl_toupper(int);
static int ntoskrnl_tolower(int);
@@ -434,6 +439,23 @@
return(dst);
}
+static void *
+ntoskrnl_memchr(buf, ch, len)
+ void *buf;
+ unsigned char ch;
+ size_t len;
+{
+ if (len != 0) {
+ unsigned char *p = buf;
+
+ do {
+ if (*p++ == ch)
+ return (p - 1);
+ } while (--len != 0);
+ }
+ return (NULL);
+}
+
static char *
ntoskrnl_strstr(s, find)
char *s, *find;
@@ -2472,6 +2494,52 @@
return;
}
+static void *
+MmAllocateContiguousMemory(size, highest)
+ uint32_t size;
+ uint64_t highest;
+{
+ void *addr;
+ size_t pagelength = roundup(size, PAGE_SIZE);
+
+ addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
+
+ return(addr);
+}
+
+static void *
+MmAllocateContiguousMemorySpecifyCache(size, lowest, highest,
+ boundary, cachetype)
+ uint32_t size;
+ uint64_t lowest;
+ uint64_t highest;
+ uint64_t boundary;
+ uint32_t cachetype;
+{
+ void *addr;
+ size_t pagelength = roundup(size, PAGE_SIZE);
+
+ addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
+
+ return(addr);
+}
+
+static void
+MmFreeContiguousMemory(base)
+ void *base;
+{
+ ExFreePool(base);
+}
+
+static void
+MmFreeContiguousMemorySpecifyCache(base, size, cachetype)
+ void *base;
+ uint32_t size;
+ uint32_t cachetype;
+{
+ ExFreePool(base);
+}
+
static uint32_t
MmSizeOfMdl(vaddr, len)
void *vaddr;
@@ -2710,6 +2778,7 @@
KeAcquireSpinLock(&kq->kq_lock, &irql);
if (kq->kq_exit) {
+ kq->kq_exit = 0;
KeReleaseSpinLock(&kq->kq_lock, irql);
break;
}
@@ -2746,7 +2815,8 @@
kq = wq_queues + i;
kq->kq_exit = 1;
KeSetEvent(&kq->kq_proc, IO_NO_INCREMENT, FALSE);
- tsleep(kq->kq_td->td_proc, PWAIT, "waitiw", 0);
+ while (kq->kq_exit)
+ tsleep(kq->kq_td->td_proc, PWAIT, "waitiw", hz/10);
}
return;
@@ -3756,7 +3826,7 @@
* once scheduled by an ISR.
*/
- mtx_lock_spin(&sched_lock);
+ thread_lock(curthread);
#ifdef NTOSKRNL_MULTIPLE_DPCS
#if __FreeBSD_version >= 502102
sched_bind(curthread, kq->kq_cpu);
@@ -3766,7 +3836,7 @@
#if __FreeBSD_version < 600000
curthread->td_base_pri = PRI_MIN_KERN;
#endif
- mtx_unlock_spin(&sched_lock);
+ thread_unlock(curthread);
while (1) {
KeWaitForSingleObject(&kq->kq_proc, 0, 0, TRUE, NULL);
@@ -3774,6 +3844,7 @@
KeAcquireSpinLock(&kq->kq_lock, &irql);
if (kq->kq_exit) {
+ kq->kq_exit = 0;
KeReleaseSpinLock(&kq->kq_lock, irql);
break;
}
@@ -3823,7 +3894,8 @@
KeInitializeDpc(&dpc, NULL, NULL);
KeSetTargetProcessorDpc(&dpc, i);
KeInsertQueueDpc(&dpc, NULL, NULL);
- tsleep(kq->kq_td->td_proc, PWAIT, "dpcw", 0);
+ while (kq->kq_exit)
+ tsleep(kq->kq_td->td_proc, PWAIT, "dpcw", hz/10);
}
return;
@@ -4145,6 +4217,7 @@
IMPORT_SFUNC(DbgBreakPoint, 0),
IMPORT_CFUNC(strncmp, 0),
IMPORT_CFUNC(strcmp, 0),
+ IMPORT_CFUNC_MAP(stricmp, strcasecmp, 0),
IMPORT_CFUNC(strncpy, 0),
IMPORT_CFUNC(strcpy, 0),
IMPORT_CFUNC(strlen, 0),
@@ -4152,9 +4225,11 @@
IMPORT_CFUNC_MAP(tolower, ntoskrnl_tolower, 0),
IMPORT_CFUNC_MAP(strstr, ntoskrnl_strstr, 0),
IMPORT_CFUNC_MAP(strchr, index, 0),
+ IMPORT_CFUNC_MAP(strrchr, rindex, 0),
IMPORT_CFUNC(memcpy, 0),
IMPORT_CFUNC_MAP(memmove, ntoskrnl_memmove, 0),
IMPORT_CFUNC_MAP(memset, ntoskrnl_memset, 0),
+ IMPORT_CFUNC_MAP(memchr, ntoskrnl_memchr, 0),
IMPORT_SFUNC(IoAllocateDriverObjectExtension, 4),
IMPORT_SFUNC(IoGetDriverObjectExtension, 2),
IMPORT_FFUNC(IofCallDriver, 2),
@@ -4240,6 +4315,11 @@
IMPORT_FFUNC(ExInterlockedAddLargeStatistic, 2),
IMPORT_SFUNC(IoAllocateMdl, 5),
IMPORT_SFUNC(IoFreeMdl, 1),
+ IMPORT_SFUNC(MmAllocateContiguousMemory, 2),
+ IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5),
+ IMPORT_SFUNC(MmFreeContiguousMemory, 1),
+ IMPORT_SFUNC(MmFreeContiguousMemorySpecifyCache, 3),
+ IMPORT_SFUNC_MAP(MmGetPhysicalAddress, pmap_kextract, 1),
IMPORT_SFUNC(MmSizeOfMdl, 1),
IMPORT_SFUNC(MmMapLockedPages, 2),
IMPORT_SFUNC(MmMapLockedPagesSpecifyCache, 6),
Index: syscalls.master
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/syscalls.master,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/syscalls.master -L sys/compat/svr4/syscalls.master -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/syscalls.master
+++ sys/compat/svr4/syscalls.master
@@ -1,4 +1,4 @@
- $FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.17.2.2 2005/07/20 17:42:15 jhb Exp $
+ $FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp $
; from: @(#)syscalls.master 8.1 (Berkeley) 7/19/93
;
; System call name/number master file (or rather, slave, from SVR4).
@@ -39,66 +39,66 @@
#include <compat/svr4/svr4_proto.h>
0 AUE_NULL UNIMPL unused
-1 AUE_NULL MNOPROTO { void sys_exit(int rval); } exit \
+1 AUE_NULL NOPROTO { void sys_exit(int rval); } exit \
sys_exit_args void
-2 AUE_NULL MNOPROTO { int fork(void); }
-3 AUE_NULL MNOPROTO { int read(int fd, char *buf, u_int nbyte); }
-4 AUE_NULL MNOPROTO { int write(int fd, char *buf, u_int nbyte); }
-5 AUE_NULL MSTD { int svr4_sys_open(char *path, int flags, \
+2 AUE_NULL NOPROTO { int fork(void); }
+3 AUE_NULL NOPROTO { int read(int fd, char *buf, u_int nbyte); }
+4 AUE_NULL NOPROTO { int write(int fd, char *buf, u_int nbyte); }
+5 AUE_NULL STD { int svr4_sys_open(char *path, int flags, \
int mode); }
-6 AUE_NULL MNOPROTO { int close(int fd); }
-7 AUE_NULL MSTD { int svr4_sys_wait(int *status); }
-8 AUE_NULL MSTD { int svr4_sys_creat(char *path, int mode); }
-9 AUE_NULL MNOPROTO { int link(char *path, char *link); }
-10 AUE_NULL MNOPROTO { int unlink(char *path); }
-11 AUE_NULL MSTD { int svr4_sys_execv(char *path, char **argp); }
-12 AUE_NULL MNOPROTO { int chdir(char *path); }
-13 AUE_NULL MSTD { int svr4_sys_time(time_t *t); }
-14 AUE_NULL MSTD { int svr4_sys_mknod(char* path, int mode, int dev); }
-15 AUE_NULL MNOPROTO { int chmod(char *path, int mode); }
-16 AUE_NULL MNOPROTO { int chown(char *path, uid_t uid, gid_t gid); }
+6 AUE_NULL NOPROTO { int close(int fd); }
+7 AUE_NULL STD { int svr4_sys_wait(int *status); }
+8 AUE_NULL STD { int svr4_sys_creat(char *path, int mode); }
+9 AUE_NULL NOPROTO { int link(char *path, char *link); }
+10 AUE_NULL NOPROTO { int unlink(char *path); }
+11 AUE_NULL STD { int svr4_sys_execv(char *path, char **argp); }
+12 AUE_NULL NOPROTO { int chdir(char *path); }
+13 AUE_NULL STD { int svr4_sys_time(time_t *t); }
+14 AUE_NULL STD { int svr4_sys_mknod(char* path, int mode, int dev); }
+15 AUE_NULL NOPROTO { int chmod(char *path, int mode); }
+16 AUE_NULL NOPROTO { int chown(char *path, uid_t uid, gid_t gid); }
17 AUE_NULL STD { int svr4_sys_break(caddr_t nsize); }
-18 AUE_NULL MSTD { int svr4_sys_stat(char* path, \
+18 AUE_NULL STD { int svr4_sys_stat(char* path, \
struct svr4_stat* ub); }
-19 AUE_NULL MNOPROTO { int lseek(int filedes, off_t *offset, \
+19 AUE_NULL NOPROTO { int lseek(int filedes, off_t *offset, \
int whence); }
-20 AUE_NULL MNOPROTO { pid_t getpid(void); }
+20 AUE_NULL NOPROTO { pid_t getpid(void); }
21 AUE_NULL UNIMPL old_mount
22 AUE_NULL UNIMPL sysv_umount
-23 AUE_NULL MNOPROTO { int setuid(uid_t uid); }
-24 AUE_NULL MNOPROTO { uid_t getuid(void); }
+23 AUE_NULL NOPROTO { int setuid(uid_t uid); }
+24 AUE_NULL NOPROTO { uid_t getuid(void); }
25 AUE_NULL UNIMPL stime
26 AUE_NULL UNIMPL ptrace
-27 AUE_NULL MSTD { int svr4_sys_alarm(unsigned sec); }
-28 AUE_NULL MSTD { int svr4_sys_fstat(int fd, \
+27 AUE_NULL STD { int svr4_sys_alarm(unsigned sec); }
+28 AUE_NULL STD { int svr4_sys_fstat(int fd, \
struct svr4_stat *sb); }
-29 AUE_NULL MSTD { int svr4_sys_pause(void); }
-30 AUE_NULL MSTD { int svr4_sys_utime(char *path, \
+29 AUE_NULL STD { int svr4_sys_pause(void); }
+30 AUE_NULL STD { int svr4_sys_utime(char *path, \
struct svr4_utimbuf *ubuf); }
31 AUE_NULL UNIMPL stty
32 AUE_NULL UNIMPL gtty
-33 AUE_NULL MSTD { int svr4_sys_access(char *path, \
+33 AUE_NULL STD { int svr4_sys_access(char *path, \
int flags); }
-34 AUE_NULL MSTD { int svr4_sys_nice(int prio); }
+34 AUE_NULL STD { int svr4_sys_nice(int prio); }
35 AUE_NULL UNIMPL statfs
-36 AUE_NULL MNOPROTO { int sync(void); }
-37 AUE_NULL MSTD { int svr4_sys_kill(int pid, int signum); }
+36 AUE_NULL NOPROTO { int sync(void); }
+37 AUE_NULL STD { int svr4_sys_kill(int pid, int signum); }
38 AUE_NULL UNIMPL fstatfs
-39 AUE_NULL MSTD { int svr4_sys_pgrpsys(int cmd, int pid, \
+39 AUE_NULL STD { int svr4_sys_pgrpsys(int cmd, int pid, \
int pgid); }
40 AUE_NULL UNIMPL xenix
-41 AUE_NULL MNOPROTO { int dup(u_int fd); }
-42 AUE_NULL MNOPROTO { int pipe(void); }
-43 AUE_NULL MSTD { int svr4_sys_times(struct tms *tp); }
+41 AUE_NULL NOPROTO { int dup(u_int fd); }
+42 AUE_NULL NOPROTO { int pipe(void); }
+43 AUE_NULL STD { int svr4_sys_times(struct tms *tp); }
44 AUE_NULL UNIMPL profil
45 AUE_NULL UNIMPL plock
-46 AUE_NULL MNOPROTO { int setgid(gid_t gid); }
-47 AUE_NULL MNOPROTO { gid_t getgid(void); }
-48 AUE_NULL MSTD { int svr4_sys_signal(int signum, \
+46 AUE_NULL NOPROTO { int setgid(gid_t gid); }
+47 AUE_NULL NOPROTO { gid_t getgid(void); }
+48 AUE_NULL STD { int svr4_sys_signal(int signum, \
svr4_sig_t handler); }
-49 AUE_NULL MSTD { int svr4_sys_msgsys(int what, int a2, \
+49 AUE_NULL STD { int svr4_sys_msgsys(int what, int a2, \
int a3, int a4, int a5); }
-50 AUE_NULL MSTD { int svr4_sys_sysarch(int op, void *a1); }
+50 AUE_NULL STD { int svr4_sys_sysarch(int op, void *a1); }
51 AUE_NULL UNIMPL acct
52 AUE_NULL STD { int svr4_sys_shmsys(int what, int a2, \
int a3, int a4, int a5); }
@@ -108,16 +108,16 @@
caddr_t data); }
55 AUE_NULL UNIMPL uadmin
56 AUE_NULL UNIMPL exch
-57 AUE_NULL MSTD { int svr4_sys_utssys(void *a1, void *a2, \
+57 AUE_NULL STD { int svr4_sys_utssys(void *a1, void *a2, \
int sel, void *a3); }
-58 AUE_NULL MNOPROTO { int fsync(int fd); }
-59 AUE_NULL MSTD { int svr4_sys_execve(char *path, \
+58 AUE_NULL NOPROTO { int fsync(int fd); }
+59 AUE_NULL STD { int svr4_sys_execve(char *path, \
char **argp, char **envp); }
-60 AUE_NULL MNOPROTO { int umask(int newmask); }
-61 AUE_NULL MNOPROTO { int chroot(char *path); }
-62 AUE_NULL MSTD { int svr4_sys_fcntl(int fd, int cmd, \
+60 AUE_NULL NOPROTO { int umask(int newmask); }
+61 AUE_NULL NOPROTO { int chroot(char *path); }
+62 AUE_NULL STD { int svr4_sys_fcntl(int fd, int cmd, \
char *arg); }
-63 AUE_NULL MSTD { int svr4_sys_ulimit(int cmd, \
+63 AUE_NULL STD { int svr4_sys_ulimit(int cmd, \
long newlimit); }
64 AUE_NULL UNIMPL reserved
65 AUE_NULL UNIMPL reserved
@@ -134,8 +134,8 @@
76 AUE_NULL UNIMPL rdebug
77 AUE_NULL UNIMPL rfstop
78 AUE_NULL UNIMPL rfsys
-79 AUE_NULL MNOPROTO { int rmdir(char *path); }
-80 AUE_NULL MNOPROTO { int mkdir(char *path, int mode); }
+79 AUE_NULL NOPROTO { int rmdir(char *path); }
+80 AUE_NULL NOPROTO { int mkdir(char *path, int mode); }
81 AUE_NULL STD { int svr4_sys_getdents(int fd, char *buf, \
int nbytes); }
82 AUE_NULL UNIMPL libattach
@@ -147,100 +147,100 @@
86 AUE_NULL STD { int svr4_sys_putmsg(int fd, \
struct svr4_strbuf *ctl, \
struct svr4_strbuf *dat, int flags); }
-87 AUE_NULL MSTD { int svr4_sys_poll(struct pollfd *fds, \
+87 AUE_NULL STD { int svr4_sys_poll(struct pollfd *fds, \
unsigned int nfds, int timeout); }
-88 AUE_NULL MSTD { int svr4_sys_lstat(char *path, \
+88 AUE_NULL STD { int svr4_sys_lstat(char *path, \
struct svr4_stat *ub); }
-89 AUE_NULL MNOPROTO { int symlink(char *path, char *link); }
-90 AUE_NULL MNOPROTO { int readlink(char *path, char *buf, \
+89 AUE_NULL NOPROTO { int symlink(char *path, char *link); }
+90 AUE_NULL NOPROTO { int readlink(char *path, char *buf, \
int count); }
-91 AUE_NULL MNOPROTO { int getgroups(u_int gidsetsize, \
+91 AUE_NULL NOPROTO { int getgroups(u_int gidsetsize, \
gid_t *gidset); }
-92 AUE_NULL MNOPROTO { int setgroups(u_int gidsetsize, \
+92 AUE_NULL NOPROTO { int setgroups(u_int gidsetsize, \
gid_t *gidset); }
-93 AUE_NULL MNOPROTO { int fchmod(int fd, int mode); }
-94 AUE_NULL MNOPROTO { int fchown(int fd, int uid, int gid); }
-95 AUE_NULL MSTD { int svr4_sys_sigprocmask(int how, \
+93 AUE_NULL NOPROTO { int fchmod(int fd, int mode); }
+94 AUE_NULL NOPROTO { int fchown(int fd, int uid, int gid); }
+95 AUE_NULL STD { int svr4_sys_sigprocmask(int how, \
svr4_sigset_t *set, \
svr4_sigset_t *oset); }
-96 AUE_NULL MSTD { int svr4_sys_sigsuspend( \
+96 AUE_NULL STD { int svr4_sys_sigsuspend( \
svr4_sigset_t *ss); }
-97 AUE_NULL MSTD { int svr4_sys_sigaltstack( \
+97 AUE_NULL STD { int svr4_sys_sigaltstack( \
struct svr4_sigaltstack *nss, \
struct svr4_sigaltstack *oss); }
-98 AUE_NULL MSTD { int svr4_sys_sigaction(int signum, \
+98 AUE_NULL STD { int svr4_sys_sigaction(int signum, \
struct svr4_sigaction *nsa, \
struct svr4_sigaction *osa); }
-99 AUE_NULL MSTD { int svr4_sys_sigpending(int what, \
+99 AUE_NULL STD { int svr4_sys_sigpending(int what, \
svr4_sigset_t *mask); }
-100 AUE_NULL MSTD { int svr4_sys_context(int func, \
+100 AUE_NULL STD { int svr4_sys_context(int func, \
struct svr4_ucontext *uc); }
101 AUE_NULL UNIMPL evsys
102 AUE_NULL UNIMPL evtrapret
-103 AUE_NULL MSTD { int svr4_sys_statvfs(char *path, \
+103 AUE_NULL STD { int svr4_sys_statvfs(char *path, \
struct svr4_statvfs *fs); }
-104 AUE_NULL MSTD { int svr4_sys_fstatvfs(int fd, \
+104 AUE_NULL STD { int svr4_sys_fstatvfs(int fd, \
struct svr4_statvfs *fs); }
105 AUE_NULL UNIMPL whoknows
106 AUE_NULL UNIMPL nfssvc
107 AUE_NULL STD { int svr4_sys_waitsys(int grp, int id, \
union svr4_siginfo *info, int options); }
108 AUE_NULL UNIMPL sigsendsys
-109 AUE_NULL MSTD { int svr4_sys_hrtsys(int cmd, int fun, \
+109 AUE_NULL STD { int svr4_sys_hrtsys(int cmd, int fun, \
int sub, void *rv1, void *rv2); }
110 AUE_NULL UNIMPL acancel
111 AUE_NULL UNIMPL async
112 AUE_NULL UNIMPL priocntlsys
-113 AUE_NULL MSTD { int svr4_sys_pathconf(char *path, \
+113 AUE_NULL STD { int svr4_sys_pathconf(char *path, \
int name); }
114 AUE_NULL UNIMPL mincore
-115 AUE_NULL MSTD { caddr_t svr4_sys_mmap(caddr_t addr, \
+115 AUE_NULL STD { caddr_t svr4_sys_mmap(caddr_t addr, \
svr4_size_t len, int prot, int flags, \
int fd, svr4_off_t pos); }
-116 AUE_NULL MNOPROTO { int mprotect(void *addr, int len, \
+116 AUE_NULL NOPROTO { int mprotect(void *addr, int len, \
int prot); }
-117 AUE_NULL MNOPROTO { int munmap(void *addr, int len); }
-118 AUE_NULL MSTD { int svr4_sys_fpathconf(int fd, int name); }
-119 AUE_NULL MNOPROTO { int vfork(void); }
-120 AUE_NULL MNOPROTO { int fchdir(int fd); }
-121 AUE_NULL MNOPROTO { int readv(int fd, struct iovec *iovp, \
+117 AUE_NULL NOPROTO { int munmap(void *addr, int len); }
+118 AUE_NULL STD { int svr4_sys_fpathconf(int fd, int name); }
+119 AUE_NULL NOPROTO { int vfork(void); }
+120 AUE_NULL NOPROTO { int fchdir(int fd); }
+121 AUE_NULL NOPROTO { int readv(int fd, struct iovec *iovp, \
u_int iovcnt); }
-122 AUE_NULL MNOPROTO { int writev(int fd, struct iovec *iovp, \
+122 AUE_NULL NOPROTO { int writev(int fd, struct iovec *iovp, \
u_int iovcnt); }
-123 AUE_NULL MSTD { int svr4_sys_xstat(int two, char *path, \
+123 AUE_NULL STD { int svr4_sys_xstat(int two, char *path, \
struct svr4_xstat *ub); }
-124 AUE_NULL MSTD { int svr4_sys_lxstat(int two, char *path, \
+124 AUE_NULL STD { int svr4_sys_lxstat(int two, char *path, \
struct svr4_xstat *ub); }
-125 AUE_NULL MSTD { int svr4_sys_fxstat(int two, int fd, \
+125 AUE_NULL STD { int svr4_sys_fxstat(int two, int fd, \
struct svr4_xstat *sb); }
-126 AUE_NULL MSTD { int svr4_sys_xmknod(int two, char *path, \
+126 AUE_NULL STD { int svr4_sys_xmknod(int two, char *path, \
svr4_mode_t mode, svr4_dev_t dev); }
127 AUE_NULL UNIMPL clocal
-128 AUE_NULL MSTD { int svr4_sys_setrlimit(int which, \
+128 AUE_NULL STD { int svr4_sys_setrlimit(int which, \
const struct svr4_rlimit *rlp); }
-129 AUE_NULL MSTD { int svr4_sys_getrlimit(int which, \
+129 AUE_NULL STD { int svr4_sys_getrlimit(int which, \
struct svr4_rlimit *rlp); }
-130 AUE_NULL MNOPROTO { int lchown(char *path, uid_t uid, \
+130 AUE_NULL NOPROTO { int lchown(char *path, uid_t uid, \
gid_t gid); }
-131 AUE_NULL MSTD { int svr4_sys_memcntl(void * addr, \
+131 AUE_NULL STD { int svr4_sys_memcntl(void * addr, \
svr4_size_t len, int cmd, void * arg, \
int attr, int mask); }
132 AUE_NULL UNIMPL getpmsg
133 AUE_NULL UNIMPL putpmsg
-134 AUE_NULL MNOPROTO { int rename(char *from, char *to); }
-135 AUE_NULL MSTD { int svr4_sys_uname( \
+134 AUE_NULL NOPROTO { int rename(char *from, char *to); }
+135 AUE_NULL STD { int svr4_sys_uname( \
struct svr4_utsname* name, int dummy); }
-136 AUE_NULL MNOPROTO { int setegid(gid_t egid); }
-137 AUE_NULL MSTD { int svr4_sys_sysconfig(int name); }
-138 AUE_NULL MNOPROTO { int adjtime(struct timeval *delta, \
+136 AUE_NULL NOPROTO { int setegid(gid_t egid); }
+137 AUE_NULL STD { int svr4_sys_sysconfig(int name); }
+138 AUE_NULL NOPROTO { int adjtime(struct timeval *delta, \
struct timeval *olddelta); }
-139 AUE_NULL MSTD { long svr4_sys_systeminfo(int what, \
+139 AUE_NULL STD { long svr4_sys_systeminfo(int what, \
char *buf, long len); }
140 AUE_NULL UNIMPL notused
-141 AUE_NULL MNOPROTO { int seteuid(uid_t euid); }
+141 AUE_NULL NOPROTO { int seteuid(uid_t euid); }
142 AUE_NULL UNIMPL vtrace
; fork1
-143 AUE_NULL MUNIMPL { int fork(void); }
+143 AUE_NULL UNIMPL { int fork(void); }
144 AUE_NULL UNIMPL sigtimedwait
145 AUE_NULL UNIMPL lwp_info
146 AUE_NULL UNIMPL yield
@@ -251,14 +251,14 @@
151 AUE_NULL UNIMPL notused
152 AUE_NULL UNIMPL modctl
153 AUE_NULL STD { int svr4_sys_fchroot(int fd); }
-154 AUE_NULL MSTD { int svr4_sys_utimes(char *path, \
+154 AUE_NULL STD { int svr4_sys_utimes(char *path, \
struct timeval *tptr); }
-155 AUE_NULL MSTD { int svr4_sys_vhangup(void); }
-156 AUE_NULL MSTD { int svr4_sys_gettimeofday( \
+155 AUE_NULL STD { int svr4_sys_vhangup(void); }
+156 AUE_NULL STD { int svr4_sys_gettimeofday( \
struct timeval *tp); }
-157 AUE_NULL MNOPROTO { int getitimer(u_int which, \
+157 AUE_NULL NOPROTO { int getitimer(u_int which, \
struct itimerval *itv); }
-158 AUE_NULL MNOPROTO { int setitimer(u_int which, \
+158 AUE_NULL NOPROTO { int setitimer(u_int which, \
struct itimerval *itv, \
struct itimerval *oitv); }
159 AUE_NULL UNIMPL lwp_create
@@ -280,7 +280,7 @@
174 AUE_NULL UNIMPL { ssize_t svr4_sys_pwrite(int fd, \
const void *buf, size_t nbyte, \
svr4_off_t off); }
-175 AUE_NULL MSTD { svr4_off64_t svr4_sys_llseek(int fd, \
+175 AUE_NULL STD { svr4_off64_t svr4_sys_llseek(int fd, \
long offset1, long offset2, int whence); }
176 AUE_NULL UNIMPL inst_sync
177 AUE_NULL UNIMPL whoknows
@@ -291,9 +291,9 @@
182 AUE_NULL UNIMPL whoknows
183 AUE_NULL UNIMPL whoknows
184 AUE_NULL UNIMPL tsolsys
-185 AUE_NULL MSTD { int svr4_sys_acl(char *path, int cmd, \
+185 AUE_NULL STD { int svr4_sys_acl(char *path, int cmd, \
int num, struct svr4_aclent *buf); }
-186 AUE_NULL MSTD { int svr4_sys_auditsys(int code, int a1, \
+186 AUE_NULL STD { int svr4_sys_auditsys(int code, int a1, \
int a2, int a3, int a4, int a5); }
187 AUE_NULL UNIMPL processor_bind
188 AUE_NULL UNIMPL processor_info
@@ -307,14 +307,14 @@
196 AUE_NULL UNIMPL timer_settime
197 AUE_NULL UNIMPL timer_gettime
198 AUE_NULL UNIMPL timer_overrun
-199 AUE_NULL MNOPROTO { int nanosleep( \
+199 AUE_NULL NOPROTO { int nanosleep( \
const struct timespec *rqtp, \
struct timespec *rmtp); }
-200 AUE_NULL MSTD { int svr4_sys_facl(int fd, int cmd, \
+200 AUE_NULL STD { int svr4_sys_facl(int fd, int cmd, \
int num, struct svr4_aclent *buf); }
201 AUE_NULL UNIMPL door
-202 AUE_NULL MNOPROTO { int setreuid(int ruid, int euid); }
-203 AUE_NULL MNOPROTO { int setregid(int rgid, int egid); }
+202 AUE_NULL NOPROTO { int setreuid(int ruid, int euid); }
+203 AUE_NULL NOPROTO { int setregid(int rgid, int egid); }
204 AUE_NULL UNIMPL install_utrap
205 AUE_NULL UNIMPL signotify
206 AUE_NULL UNIMPL schedctl
@@ -328,70 +328,70 @@
213 AUE_NULL STD { int svr4_sys_getdents64(int fd, \
struct svr4_dirent64 *dp, int nbytes); }
;213 AUE_NULL UNIMPL getdents64
-214 AUE_NULL MSTD { caddr_t svr4_sys_mmap64(void *addr, \
+214 AUE_NULL STD { caddr_t svr4_sys_mmap64(void *addr, \
svr4_size_t len, int prot, int flags, \
int fd, svr4_off64_t pos); }
-215 AUE_NULL MSTD { int svr4_sys_stat64(char *path, \
+215 AUE_NULL STD { int svr4_sys_stat64(char *path, \
struct svr4_stat64 *sb); }
-216 AUE_NULL MSTD { int svr4_sys_lstat64(char *path, \
+216 AUE_NULL STD { int svr4_sys_lstat64(char *path, \
struct svr4_stat64 *sb); }
-217 AUE_NULL MSTD { int svr4_sys_fstat64(int fd, \
+217 AUE_NULL STD { int svr4_sys_fstat64(int fd, \
struct svr4_stat64 *sb); }
-218 AUE_NULL MSTD { int svr4_sys_statvfs64(char *path, \
+218 AUE_NULL STD { int svr4_sys_statvfs64(char *path, \
struct svr4_statvfs64 *fs); }
-219 AUE_NULL MSTD { int svr4_sys_fstatvfs64(int fd, \
+219 AUE_NULL STD { int svr4_sys_fstatvfs64(int fd, \
struct svr4_statvfs64 *fs); }
-220 AUE_NULL MSTD { int svr4_sys_setrlimit64(int which, \
+220 AUE_NULL STD { int svr4_sys_setrlimit64(int which, \
const struct svr4_rlimit64 *rlp); }
-221 AUE_NULL MSTD { int svr4_sys_getrlimit64(int which, \
+221 AUE_NULL STD { int svr4_sys_getrlimit64(int which, \
struct svr4_rlimit64 *rlp); }
222 AUE_NULL UNIMPL pread64
223 AUE_NULL UNIMPL pwrite64
-224 AUE_NULL MSTD { int svr4_sys_creat64(char *path, \
+224 AUE_NULL STD { int svr4_sys_creat64(char *path, \
int mode); }
-225 AUE_NULL MSTD { int svr4_sys_open64(char *path, int flags, \
+225 AUE_NULL STD { int svr4_sys_open64(char *path, int flags, \
int mode); }
226 AUE_NULL UNIMPL rpcsys
227 AUE_NULL UNIMPL whoknows
228 AUE_NULL UNIMPL whoknows
229 AUE_NULL UNIMPL whoknows
-230 AUE_NULL MSTD { int svr4_sys_socket(int domain, int type, \
+230 AUE_NULL STD { int svr4_sys_socket(int domain, int type, \
int protocol); }
-231 AUE_NULL MNOPROTO { int socketpair(int domain, int type, \
+231 AUE_NULL NOPROTO { int socketpair(int domain, int type, \
int protocol, int *rsv); }
-232 AUE_NULL MNOPROTO { int bind(int s, \
+232 AUE_NULL NOPROTO { int bind(int s, \
const struct sockaddr *name, \
int namelen); }
-233 AUE_NULL MNOPROTO { int listen(int s, int backlog); }
-234 AUE_NULL MNOPROTO { int accept(int s, struct sockaddr *name, \
+233 AUE_NULL NOPROTO { int listen(int s, int backlog); }
+234 AUE_NULL NOPROTO { int accept(int s, struct sockaddr *name, \
int *anamelen); }
-235 AUE_NULL MNOPROTO { int connect(int s, \
+235 AUE_NULL NOPROTO { int connect(int s, \
const struct sockaddr *name, \
int namelen); }
-236 AUE_NULL MNOPROTO { int shutdown(int s, int how); }
-237 AUE_NULL MSTD { int svr4_sys_recv(int s, caddr_t buf, \
+236 AUE_NULL NOPROTO { int shutdown(int s, int how); }
+237 AUE_NULL STD { int svr4_sys_recv(int s, caddr_t buf, \
int len, int flags); }
-238 AUE_NULL MNOPROTO { ssize_t recvfrom(int s, void *buf, \
+238 AUE_NULL NOPROTO { ssize_t recvfrom(int s, void *buf, \
size_t len, int flags, \
struct sockaddr *from, \
int *fromlenaddr); }
-239 AUE_NULL MNOPROTO { ssize_t recvmsg(int s, struct msghdr *msg, \
+239 AUE_NULL NOPROTO { ssize_t recvmsg(int s, struct msghdr *msg, \
int flags); }
-240 AUE_NULL MSTD { int svr4_sys_send(int s, caddr_t buf, \
+240 AUE_NULL STD { int svr4_sys_send(int s, caddr_t buf, \
int len, int flags); }
-241 AUE_NULL MNOPROTO { ssize_t sendmsg(int s, \
+241 AUE_NULL NOPROTO { ssize_t sendmsg(int s, \
const struct msghdr *msg, int flags); }
-242 AUE_NULL MSTD { ssize_t svr4_sys_sendto(int s, void *buf, \
+242 AUE_NULL STD { ssize_t svr4_sys_sendto(int s, void *buf, \
size_t len, int flags, \
struct sockaddr *to, int tolen); }
-243 AUE_NULL MNOPROTO { int getpeername(int fdes, \
+243 AUE_NULL NOPROTO { int getpeername(int fdes, \
struct sockaddr *asa, int *alen); }
-244 AUE_NULL MNOPROTO { int getsockname(int fdes, \
+244 AUE_NULL NOPROTO { int getsockname(int fdes, \
struct sockaddr *asa, int *alen); }
-245 AUE_NULL MNOPROTO { int getsockopt(int s, int level, int name, \
+245 AUE_NULL NOPROTO { int getsockopt(int s, int level, int name, \
void *val, int *avalsize); }
-246 AUE_NULL MNOPROTO { int setsockopt(int s, int level, int name, \
+246 AUE_NULL NOPROTO { int setsockopt(int s, int level, int name, \
const void *val, int valsize); }
247 AUE_NULL UNIMPL sockconfig
248 AUE_NULL UNIMPL { int ntp_gettime(struct ntptimeval *ntvp); }
-249 AUE_NULL MUNIMPL { int ntp_adjtime(struct timex *tp); }
+249 AUE_NULL UNIMPL { int ntp_adjtime(struct timex *tp); }
Index: svr4_syscall.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_syscall.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_syscall.h -L sys/compat/svr4/svr4_syscall.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_syscall.h
+++ sys/compat/svr4/svr4_syscall.h
@@ -2,8 +2,8 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/svr4/svr4_syscall.h,v 1.15.2.2 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.17.2.2 2005/07/20 17:42:15 jhb Exp
+ * $FreeBSD: src/sys/compat/svr4/svr4_syscall.h,v 1.26 2006/11/11 21:49:08 ru Exp $
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp
*/
#define SVR4_SYS_exit 1
Index: svr4_ioctl.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_ioctl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_ioctl.c -L sys/compat/svr4/svr4_ioctl.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_ioctl.c
+++ sys/compat/svr4/svr4_ioctl.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ioctl.c,v 1.22 2005/01/05 22:34:36 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ioctl.c,v 1.24 2005/09/28 07:03:02 rwatson Exp $");
#include <sys/param.h>
#include <sys/proc.h>
Index: svr4_sysvec.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_sysvec.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_sysvec.c -L sys/compat/svr4/svr4_sysvec.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_sysvec.c
+++ sys/compat/svr4/svr4_sysvec.c
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sysvec.c,v 1.41 2005/02/25 19:34:10 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sysvec.c,v 1.42 2006/07/21 20:40:13 jhb Exp $");
/* XXX we use functions that might not exist. */
#include "opt_compat.h"
@@ -62,6 +62,7 @@
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_syscall.h>
#include <compat/svr4/svr4_signal.h>
+#include <compat/svr4/svr4_socket.h>
#include <compat/svr4/svr4_sockio.h>
#include <compat/svr4/svr4_errno.h>
#include <compat/svr4/svr4_proto.h>
@@ -269,12 +270,14 @@
switch(type) {
case MOD_LOAD:
- if (elf32_insert_brand_entry(&svr4_brand) < 0)
- error = EINVAL;
- if (error)
+ if (elf32_insert_brand_entry(&svr4_brand) < 0) {
printf("cannot insert svr4 elf brand handler\n");
- else if (bootverbose)
+ error = EINVAL;
+ break;
+ }
+ if (bootverbose)
printf("svr4 ELF exec handler installed\n");
+ svr4_sockcache_init();
break;
case MOD_UNLOAD:
/* Only allow the emulator to be removed if it isn't in use. */
@@ -284,11 +287,14 @@
error = EINVAL;
}
- if (error)
+ if (error) {
printf("Could not deinstall ELF interpreter entry (error %d)\n",
error);
- else if (bootverbose)
+ break;
+ }
+ if (bootverbose)
printf("svr4 ELF exec handler removed\n");
+ svr4_sockcache_destroy();
break;
default:
return (EOPNOTSUPP);
Index: svr4_sockio.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_sockio.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_sockio.c -L sys/compat/svr4/svr4_sockio.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_sockio.c
+++ sys/compat/svr4/svr4_sockio.c
@@ -27,8 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sockio.c,v 1.16.2.1 2005/08/25 05:01:03 rwatson Exp $");
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_sockio.c,v 1.18 2006/08/04 21:15:09 brooks Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -105,7 +104,7 @@
*/
IFNET_RLOCK();
TAILQ_FOREACH(ifp, &ifnet, if_link)
- if (TAILQ_FIRST(&ifp->if_addrhead) == NULL)
+ if (TAILQ_EMPTY(&ifp->if_addrhead))
ifnum++;
else
TAILQ_FOREACH(ifa, &ifp->if_addrhead,
Index: svr4_termios.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_termios.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_termios.c -L sys/compat/svr4/svr4_termios.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_termios.c
+++ sys/compat/svr4/svr4_termios.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_termios.c,v 1.12 2005/01/05 22:34:37 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_termios.c,v 1.14 2005/09/28 07:03:02 rwatson Exp $");
#include <sys/param.h>
#include <sys/proc.h>
Index: svr4_fcntl.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_fcntl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_fcntl.c -L sys/compat/svr4/svr4_fcntl.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_fcntl.c
+++ sys/compat/svr4/svr4_fcntl.c
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_fcntl.c,v 1.35 2005/02/07 21:53:41 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_fcntl.c,v 1.40 2007/06/12 00:11:57 rwatson Exp $");
#include "opt_mac.h"
@@ -40,11 +40,11 @@
#include <sys/filedesc.h>
/*#include <sys/ioctl.h>*/
#include <sys/lock.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
+#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
@@ -60,6 +60,8 @@
#include <compat/svr4/svr4_util.h>
#include <compat/svr4/svr4_fcntl.h>
+#include <security/mac/mac_framework.h>
+
static int svr4_to_bsd_flags(int);
static u_long svr4_to_bsd_cmd(u_long);
static int fd_revoke(struct thread *, int);
@@ -279,7 +281,7 @@
goto out;
if (td->td_ucred->cr_uid != vattr.va_uid &&
- (error = suser(td)) != 0)
+ (error = priv_check(td, PRIV_VFS_ADMIN)) != 0)
goto out;
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
Index: svr4_socket.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_socket.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_socket.h -L sys/compat/svr4/svr4_socket.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_socket.h
+++ sys/compat/svr4/svr4_socket.h
@@ -28,7 +28,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4_socket.h,v 1.9 2005/01/05 22:34:36 imp Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4_socket.h,v 1.10 2006/07/21 20:40:13 jhb Exp $
*/
#ifndef _SVR4_SOCKET_H_
@@ -48,22 +48,11 @@
u_char sin_zero[8];
};
-struct sockaddr_un *svr4_find_socket(struct thread *, struct file *,
- dev_t, ino_t);
-void svr4_delete_socket(struct proc *, struct file *);
-int svr4_add_socket(struct thread *, const char *, struct stat *);
-
-struct svr4_sockcache_entry {
- struct proc *p; /* Process for the socket */
- void *cookie; /* Internal cookie used for matching */
- struct sockaddr_un sock;/* Pathname for the socket */
- dev_t dev; /* Device where the socket lives on */
- ino_t ino; /* Inode where the socket lives on */
- TAILQ_ENTRY(svr4_sockcache_entry) entries;
-};
-
-TAILQ_HEAD(svr4_sockcache_head, svr4_sockcache_entry);
-extern struct svr4_sockcache_head svr4_head;
-extern int svr4_str_initialized;
+int svr4_add_socket(struct thread *, const char *, struct stat *);
+void svr4_delete_socket(struct proc *, struct file *);
+int svr4_find_socket(struct thread *, struct file *, dev_t, ino_t,
+ struct sockaddr_un *);
+void svr4_sockcache_init(void);
+void svr4_sockcache_destroy(void);
#endif /* _SVR4_SOCKET_H_ */
Index: svr4_signal.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_signal.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_signal.c -L sys/compat/svr4/svr4_signal.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_signal.c
+++ sys/compat/svr4/svr4_signal.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_signal.c,v 1.33 2005/02/25 19:34:10 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_signal.c,v 1.35 2005/09/28 07:03:02 rwatson Exp $");
#include <sys/param.h>
#include <sys/systm.h>
Index: Makefile
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/Makefile -L sys/compat/svr4/Makefile -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/Makefile
+++ sys/compat/svr4/Makefile
@@ -1,8 +1,6 @@
# Makefile for syscall tables
#
-# $FreeBSD: src/sys/compat/svr4/Makefile,v 1.7 2001/09/13 22:02:48 julian Exp $
-
-MAINTAINER= newton at freebsd.org
+# $FreeBSD: src/sys/compat/svr4/Makefile,v 1.8 2006/07/01 10:51:54 markm Exp $
all:
@echo "make sysent only"
Index: svr4_ipc.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_ipc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_ipc.c -L sys/compat/svr4/svr4_ipc.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_ipc.c
+++ sys/compat/svr4/svr4_ipc.c
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ipc.c,v 1.16 2005/07/07 19:25:47 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ipc.c,v 1.23 2006/07/08 19:51:37 jhb Exp $");
#include "opt_sysvipc.h"
@@ -105,8 +105,6 @@
struct svr4_semid_ds *);
static void svr4_to_bsd_semid_ds(const struct svr4_semid_ds *,
struct semid_ds *);
-static int svr4_setsemun(caddr_t *sgp, union semun **argp,
- union semun *usp);
static int svr4_semop(struct thread *, void *);
static int svr4_semget(struct thread *, void *);
static int svr4_semctl(struct thread *, void *);
@@ -194,16 +192,6 @@
bds->sem_pad2 = sds->sem_pad2;
}
-static int
-svr4_setsemun(sgp, argp, usp)
- caddr_t *sgp;
- union semun **argp;
- union semun *usp;
-{
- *argp = stackgap_alloc(sgp, sizeof(union semun));
- return copyout((caddr_t)usp, *argp, sizeof(union semun));
-}
-
struct svr4_sys_semctl_args {
int what;
int semid;
@@ -217,108 +205,75 @@
struct thread *td;
void *v;
{
- int error;
struct svr4_sys_semctl_args *uap = v;
- struct __semctl_args ap;
struct svr4_semid_ds ss;
- struct semid_ds bs, *bsp;
- caddr_t sg = stackgap_init();
-
- ap.semid = uap->semid;
- ap.semnum = uap->semnum;
+ struct semid_ds bs;
+ union semun semun;
+ register_t rval;
+ int cmd, error;
switch (uap->cmd) {
case SVR4_SEM_GETZCNT:
+ cmd = GETZCNT;
+ break;
+
case SVR4_SEM_GETNCNT:
+ cmd = GETNCNT;
+ break;
+
case SVR4_SEM_GETPID:
+ cmd = GETPID;
+ break;
+
case SVR4_SEM_GETVAL:
- switch (uap->cmd) {
- case SVR4_SEM_GETZCNT:
- ap.cmd = GETZCNT;
- break;
- case SVR4_SEM_GETNCNT:
- ap.cmd = GETNCNT;
- break;
- case SVR4_SEM_GETPID:
- ap.cmd = GETPID;
- break;
- case SVR4_SEM_GETVAL:
- ap.cmd = GETVAL;
- break;
- }
- return __semctl(td, &ap);
+ cmd = GETVAL;
+ break;
case SVR4_SEM_SETVAL:
- error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
- if (error)
- return error;
- ap.cmd = SETVAL;
- return __semctl(td, &ap);
+ cmd = SETVAL;
+ break;
case SVR4_SEM_GETALL:
- error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
- if (error)
- return error;
- ap.cmd = GETVAL;
- return __semctl(td, &ap);
+ cmd = GETVAL;
+ break;
case SVR4_SEM_SETALL:
- error = svr4_setsemun(&sg, &ap.arg, &uap->arg);
- if (error)
- return error;
- ap.cmd = SETVAL;
- return __semctl(td, &ap);
+ cmd = SETVAL;
+ break;
case SVR4_IPC_STAT:
- ap.cmd = IPC_STAT;
- bsp = stackgap_alloc(&sg, sizeof(bs));
- error = svr4_setsemun(&sg, &ap.arg,
- (union semun *)&bsp);
+ cmd = IPC_STAT;
+ semun.buf = &bs;
+ error = kern_semctl(td, uap->semid, uap->semnum, cmd, &semun,
+ &rval);
if (error)
- return error;
- if ((error = __semctl(td, &ap)) != 0)
- return error;
- error = copyin((caddr_t)bsp, (caddr_t)&bs, sizeof(bs));
- if (error)
- return error;
+ return (error);
bsd_to_svr4_semid_ds(&bs, &ss);
- return copyout(&ss, uap->arg.buf, sizeof(ss));
+ error = copyout(&ss, uap->arg.buf, sizeof(ss));
+ if (error == 0)
+ td->td_retval[0] = rval;
+ return (error);
case SVR4_IPC_SET:
- ap.cmd = IPC_SET;
- bsp = stackgap_alloc(&sg, sizeof(bs));
- error = svr4_setsemun(&sg, &ap.arg,
- (union semun *)&bsp);
- if (error)
- return error;
+ cmd = IPC_SET;
error = copyin(uap->arg.buf, (caddr_t) &ss, sizeof ss);
if (error)
- return error;
+ return (error);
svr4_to_bsd_semid_ds(&ss, &bs);
- error = copyout(&bs, bsp, sizeof(bs));
- if (error)
- return error;
- return __semctl(td, &ap);
+ semun.buf = &bs;
+ return (kern_semctl(td, uap->semid, uap->semnum, cmd, &semun,
+ td->td_retval));
case SVR4_IPC_RMID:
- ap.cmd = IPC_RMID;
- bsp = stackgap_alloc(&sg, sizeof(bs));
- error = svr4_setsemun(&sg, &ap.arg,
- (union semun *)&bsp);
- if (error)
- return error;
- error = copyin(uap->arg.buf, &ss, sizeof ss);
- if (error)
- return error;
- svr4_to_bsd_semid_ds(&ss, &bs);
- error = copyout(&bs, bsp, sizeof(bs));
- if (error)
- return error;
- return __semctl(td, &ap);
+ cmd = IPC_RMID;
+ break;
default:
return EINVAL;
}
+
+ return (kern_semctl(td, uap->semid, uap->semnum, cmd, &uap->arg,
+ td->td_retval));
}
struct svr4_sys_semget_args {
@@ -385,6 +340,8 @@
return EINVAL;
}
}
+
+MODULE_DEPEND(svr4elf, sysvsem, 1, 1, 1);
#endif
#ifdef SYSVMSG
@@ -547,11 +504,7 @@
return (kern_msgctl(td, uap->msqid, IPC_SET, &bs));
case SVR4_IPC_RMID:
- error = copyin(uap->buf, &ss, sizeof ss);
- if (error)
- return error;
- svr4_to_bsd_msqid_ds(&ss, &bs);
- return (kern_msgctl(td, uap->msqid, IPC_RMID, &bs));
+ return (kern_msgctl(td, uap->msqid, IPC_RMID, NULL));
default:
return EINVAL;
@@ -579,6 +532,8 @@
return EINVAL;
}
}
+
+MODULE_DEPEND(svr4elf, sysvmsg, 1, 1, 1);
#endif
#ifdef SYSVSHM
@@ -695,76 +650,60 @@
void *v;
{
struct svr4_sys_shmctl_args *uap = v;
- int error;
- caddr_t sg = stackgap_init();
- struct shmctl_args ap;
struct shmid_ds bs;
struct svr4_shmid_ds ss;
-
- ap.shmid = uap->shmid;
+ size_t bufsize;
+ int cmd, error;
if (uap->buf != NULL) {
- ap.buf = stackgap_alloc(&sg, sizeof (struct shmid_ds));
switch (uap->cmd) {
case SVR4_IPC_SET:
- case SVR4_IPC_RMID:
case SVR4_SHM_LOCK:
case SVR4_SHM_UNLOCK:
- error = copyin(uap->buf, (caddr_t) &ss,
- sizeof ss);
+ error = copyin(uap->buf, &ss, sizeof(ss));
if (error)
- return error;
+ return (error);
svr4_to_bsd_shmid_ds(&ss, &bs);
- error = copyout(&bs, ap.buf, sizeof bs);
- if (error)
- return error;
break;
default:
- break;
+ return (EINVAL);
}
}
- else
- ap.buf = NULL;
-
switch (uap->cmd) {
case SVR4_IPC_STAT:
- ap.cmd = IPC_STAT;
- if ((error = shmctl(td, &ap)) != 0)
- return error;
- if (uap->buf == NULL)
- return 0;
- error = copyin(&bs, ap.buf, sizeof bs);
- if (error)
- return error;
- bsd_to_svr4_shmid_ds(&bs, &ss);
- return copyout(&ss, uap->buf, sizeof ss);
-
+ cmd = IPC_STAT;
+ break;
case SVR4_IPC_SET:
- ap.cmd = IPC_SET;
- return shmctl(td, &ap);
-
+ cmd = IPC_SET;
+ break;
case SVR4_IPC_RMID:
+ cmd = IPC_RMID;
+ break;
case SVR4_SHM_LOCK:
+ cmd = SHM_LOCK;
+ break;
case SVR4_SHM_UNLOCK:
- switch (uap->cmd) {
- case SVR4_IPC_RMID:
- ap.cmd = IPC_RMID;
- break;
- case SVR4_SHM_LOCK:
- ap.cmd = SHM_LOCK;
- break;
- case SVR4_SHM_UNLOCK:
- ap.cmd = SHM_UNLOCK;
- break;
- default:
- return EINVAL;
- }
- return shmctl(td, &ap);
-
+ cmd = SHM_UNLOCK;
+ break;
default:
- return EINVAL;
+ return (EINVAL);
+ }
+
+ error = kern_shmctl(td, uap->shmid, cmd, &bs, &bufsize);
+ if (error)
+ return (error);
+
+ switch (uap->cmd) {
+ case SVR4_IPC_STAT:
+ if (uap->buf != NULL) {
+ bsd_to_svr4_shmid_ds(&bs, &ss);
+ error = copyout(&ss, uap->buf, sizeof(ss));
+ }
+ break;
}
+
+ return (error);
}
int
@@ -788,4 +727,6 @@
return ENOSYS;
}
}
+
+MODULE_DEPEND(svr4elf, sysvshm, 1, 1, 1);
#endif /* SYSVSHM */
Index: syscalls.conf
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/syscalls.conf,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/syscalls.conf -L sys/compat/svr4/syscalls.conf -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/syscalls.conf
+++ sys/compat/svr4/syscalls.conf
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/compat/svr4/syscalls.conf,v 1.3 2003/12/24 00:32:07 peter Exp $
+# $FreeBSD: src/sys/compat/svr4/syscalls.conf,v 1.4 2006/08/15 17:25:54 jhb Exp $
sysnames="svr4_syscallnames.c"
sysproto="svr4_proto.h"
sysproto_h=_SVR4_SYSPROTO_H_
@@ -8,4 +8,4 @@
syscallprefix="SVR4_SYS_"
switchname="svr4_sysent"
namesname="svr4_syscallnames"
-sysvec="\n"
+systrace="/dev/null"
Index: svr4_filio.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_filio.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_filio.c -L sys/compat/svr4/svr4_filio.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_filio.c
+++ sys/compat/svr4/svr4_filio.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_filio.c,v 1.34 2005/01/05 22:34:36 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_filio.c,v 1.35 2007/04/04 09:11:31 rwatson Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -211,15 +211,15 @@
switch (cmd) {
case SVR4_FIOCLEX:
- FILEDESC_LOCK_FAST(fdp);
+ FILEDESC_XLOCK(fdp);
fdp->fd_ofileflags[fd] |= UF_EXCLOSE;
- FILEDESC_UNLOCK_FAST(fdp);
+ FILEDESC_XUNLOCK(fdp);
return 0;
case SVR4_FIONCLEX:
- FILEDESC_LOCK_FAST(fdp);
+ FILEDESC_XLOCK(fdp);
fdp->fd_ofileflags[fd] &= ~UF_EXCLOSE;
- FILEDESC_UNLOCK_FAST(fdp);
+ FILEDESC_XUNLOCK(fdp);
return 0;
case SVR4_FIOGETOWN:
Index: svr4_misc.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_misc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_misc.c -L sys/compat/svr4/svr4_misc.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_misc.c
+++ sys/compat/svr4/svr4_misc.c
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.80 2005/07/07 19:26:43 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_misc.c,v 1.97 2007/06/12 00:11:57 rwatson Exp $");
#include "opt_mac.h"
@@ -45,7 +45,6 @@
#include <sys/imgact.h>
#include <sys/kernel.h>
#include <sys/lock.h>
-#include <sys/mac.h>
#include <sys/malloc.h>
#include <sys/file.h> /* Must come after sys/malloc.h */
#include <sys/mman.h>
@@ -53,6 +52,7 @@
#include <sys/msg.h>
#include <sys/mutex.h>
#include <sys/namei.h>
+#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
@@ -83,6 +83,8 @@
#include <compat/svr4/svr4_mman.h>
#include <compat/svr4/svr4_wait.h>
+#include <security/mac/mac_framework.h>
+
#include <machine/vmparam.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -104,7 +106,7 @@
svr4_mode_t, svr4_dev_t);
static __inline clock_t timeval_to_clock_t(struct timeval *);
-static int svr4_setinfo (struct proc *, int, svr4_siginfo_t *);
+static int svr4_setinfo (pid_t , struct rusage *, int, svr4_siginfo_t *);
struct svr4_hrtcntl_args;
static int svr4_hrtcntl (struct thread *, struct svr4_hrtcntl_args *,
@@ -175,7 +177,6 @@
free(path, M_TEMP);
if (error == 0)
error = kern_execve(td, &eargs, NULL);
- exec_free_args(&eargs);
return (error);
}
@@ -195,7 +196,6 @@
free(path, M_TEMP);
if (error == 0)
error = kern_execve(td, &eargs, NULL);
- exec_free_args(&eargs);
return (error);
}
@@ -242,7 +242,7 @@
struct iovec aiov;
off_t off;
struct svr4_dirent64 svr4_dirent;
- int buflen, error, eofflag, nbytes, justone;
+ int buflen, error, eofflag, nbytes, justone, vfslocked;
u_long *cookies = NULL, *cookiep;
int ncookies;
@@ -258,8 +258,9 @@
}
vp = fp->f_vnode;
-
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
if (vp->v_type != VDIR) {
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
return (EINVAL);
}
@@ -396,6 +397,7 @@
td->td_retval[0] = nbytes - resid;
out:
VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
if (cookies)
free(cookies, M_TEMP);
@@ -420,7 +422,7 @@
struct iovec aiov;
struct svr4_dirent idb;
off_t off; /* true file offset */
- int buflen, error, eofflag;
+ int buflen, error, eofflag, vfslocked;
u_long *cookiebuf = NULL, *cookie;
int ncookies = 0, *retval = td->td_retval;
@@ -436,7 +438,9 @@
}
vp = fp->f_vnode;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
if (vp->v_type != VDIR) {
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
return (EINVAL);
}
@@ -526,6 +530,7 @@
*retval = uap->nbytes - resid;
out:
VOP_UNLOCK(vp, 0, td);
+ VFS_UNLOCK_GIANT(vfslocked);
fdrop(fp, td);
if (cookiebuf)
free(cookiebuf, M_TEMP);
@@ -603,34 +608,36 @@
struct svr4_sys_fchroot_args *uap;
{
struct filedesc *fdp = td->td_proc->p_fd;
- struct vnode *vp, *vpold;
+ struct vnode *vp;
struct file *fp;
- int error;
+ int error, vfslocked;
- if ((error = suser(td)) != 0)
+ if ((error = priv_check(td, PRIV_VFS_FCHROOT)) != 0)
return error;
if ((error = getvnode(fdp, uap->fd, &fp)) != 0)
return error;
vp = fp->f_vnode;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
- if (vp->v_type != VDIR)
- error = ENOTDIR;
- else
- error = VOP_ACCESS(vp, VEXEC, td->td_ucred, td);
- VOP_UNLOCK(vp, 0, td);
- if (error) {
- fdrop(fp, td);
- return error;
- }
VREF(vp);
- FILEDESC_LOCK_FAST(fdp);
- vpold = fdp->fd_rdir;
- fdp->fd_rdir = vp;
- FILEDESC_UNLOCK_FAST(fdp);
- if (vpold != NULL)
- vrele(vpold);
fdrop(fp, td);
- return 0;
+ vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = change_dir(vp, td);
+ if (error)
+ goto fail;
+#ifdef MAC
+ error = mac_check_vnode_chroot(td->td_ucred, vp);
+ if (error)
+ goto fail;
+#endif
+ VOP_UNLOCK(vp, 0, td);
+ error = change_root(vp, td);
+ vrele(vp);
+ VFS_UNLOCK_GIANT(vfslocked);
+ return (error);
+fail:
+ vput(vp);
+ VFS_UNLOCK_GIANT(vfslocked);
+ return (error);
}
@@ -794,58 +801,10 @@
struct thread *td;
struct svr4_sys_break_args *uap;
{
- struct proc *p = td->td_proc;
- struct vmspace *vm = p->p_vmspace;
- vm_offset_t new, old, base, ns;
- int rv;
-
- base = round_page((vm_offset_t) vm->vm_daddr);
- ns = (vm_offset_t)uap->nsize;
- new = round_page(ns);
- if (new > base) {
- PROC_LOCK(p);
- if ((new - base) > (unsigned)lim_cur(p, RLIMIT_DATA)) {
- PROC_UNLOCK(p);
- return ENOMEM;
- }
- PROC_UNLOCK(p);
- if (new >= VM_MAXUSER_ADDRESS)
- return (ENOMEM);
- } else if (new < base) {
- /*
- * This is simply an invalid value. If someone wants to
- * do fancy address space manipulations, mmap and munmap
- * can do most of what the user would want.
- */
- return EINVAL;
- }
+ struct obreak_args ap;
- old = base + ctob(vm->vm_dsize);
-
- if (new > old) {
- vm_size_t diff;
- diff = new - old;
- PROC_LOCK(p);
- if (vm->vm_map.size + diff > lim_cur(p, RLIMIT_VMEM)) {
- PROC_UNLOCK(p);
- return(ENOMEM);
- }
- PROC_UNLOCK(p);
- rv = vm_map_find(&vm->vm_map, NULL, 0, &old, diff, FALSE,
- VM_PROT_ALL, VM_PROT_ALL, 0);
- if (rv != KERN_SUCCESS) {
- return (ENOMEM);
- }
- vm->vm_dsize += btoc(diff);
- } else if (new < old) {
- rv = vm_map_remove(&vm->vm_map, new, old);
- if (rv != KERN_SUCCESS) {
- return (ENOMEM);
- }
- vm->vm_dsize -= btoc(old - new);
- }
-
- return (0);
+ ap.nsize = uap->nsize;
+ return (obreak(td, &ap));
}
static __inline clock_t
@@ -868,7 +827,9 @@
p = td->td_proc;
PROC_LOCK(p);
+ PROC_SLOCK(p);
calcru(p, &utime, &stime);
+ PROC_SUNLOCK(p);
calccru(p, &cutime, &cstime);
PROC_UNLOCK(p);
@@ -1128,54 +1089,52 @@
static int
-svr4_setinfo(p, st, s)
- struct proc *p;
+svr4_setinfo(pid, ru, st, s)
+ pid_t pid;
+ struct rusage *ru;
int st;
svr4_siginfo_t *s;
{
- struct timeval utime, stime;
svr4_siginfo_t i;
int sig;
memset(&i, 0, sizeof(i));
- i.si_signo = SVR4_SIGCHLD;
- i.si_errno = 0; /* XXX? */
+ i.svr4_si_signo = SVR4_SIGCHLD;
+ i.svr4_si_errno = 0; /* XXX? */
- if (p) {
- i.si_pid = p->p_pid;
- PROC_LOCK(p);
- calcru(p, &utime, &stime);
- PROC_UNLOCK(p);
- i.si_stime = stime.tv_sec;
- i.si_utime = utime.tv_sec;
+ i.svr4_si_pid = pid;
+ if (ru) {
+ i.svr4_si_stime = ru->ru_stime.tv_sec;
+ i.svr4_si_utime = ru->ru_utime.tv_sec;
}
if (WIFEXITED(st)) {
- i.si_status = WEXITSTATUS(st);
- i.si_code = SVR4_CLD_EXITED;
+ i.svr4_si_status = WEXITSTATUS(st);
+ i.svr4_si_code = SVR4_CLD_EXITED;
} else if (WIFSTOPPED(st)) {
sig = WSTOPSIG(st);
if (sig >= 0 && sig < NSIG)
- i.si_status = SVR4_BSD2SVR4_SIG(sig);
+ i.svr4_si_status = SVR4_BSD2SVR4_SIG(sig);
- if (i.si_status == SVR4_SIGCONT)
- i.si_code = SVR4_CLD_CONTINUED;
+ if (i.svr4_si_status == SVR4_SIGCONT)
+ i.svr4_si_code = SVR4_CLD_CONTINUED;
else
- i.si_code = SVR4_CLD_STOPPED;
+ i.svr4_si_code = SVR4_CLD_STOPPED;
} else {
sig = WTERMSIG(st);
if (sig >= 0 && sig < NSIG)
- i.si_status = SVR4_BSD2SVR4_SIG(sig);
+ i.svr4_si_status = SVR4_BSD2SVR4_SIG(sig);
if (WCOREDUMP(st))
- i.si_code = SVR4_CLD_DUMPED;
+ i.svr4_si_code = SVR4_CLD_DUMPED;
else
- i.si_code = SVR4_CLD_KILLED;
+ i.svr4_si_code = SVR4_CLD_KILLED;
}
DPRINTF(("siginfo [pid %ld signo %d code %d errno %d status %d]\n",
- i.si_pid, i.si_signo, i.si_code, i.si_errno, i.si_status));
+ i.svr4_si_pid, i.svr4_si_signo, i.svr4_si_code, i.svr4_si_errno,
+ i.svr4_si_status));
return copyout(&i, s, sizeof(i));
}
@@ -1186,188 +1145,192 @@
struct thread *td;
struct svr4_sys_waitsys_args *uap;
{
- int nfound;
+ struct rusage ru;
+ pid_t pid;
+ int nfound, status;
int error, *retval = td->td_retval;
- struct proc *p, *q, *t;
+ struct proc *p, *q;
- p = td->td_proc;
+ DPRINTF(("waitsys(%d, %d, %p, %x)\n",
+ uap->grp, uap->id,
+ uap->info, uap->options));
+
+ q = td->td_proc;
switch (uap->grp) {
- case SVR4_P_PID:
+ case SVR4_P_PID:
+ pid = uap->id;
break;
case SVR4_P_PGID:
- PROC_LOCK(p);
- uap->id = -p->p_pgid;
- PROC_UNLOCK(p);
+ PROC_LOCK(q);
+ pid = -q->p_pgid;
+ PROC_UNLOCK(q);
break;
case SVR4_P_ALL:
- uap->id = WAIT_ANY;
+ pid = WAIT_ANY;
break;
default:
return EINVAL;
}
- DPRINTF(("waitsys(%d, %d, %p, %x)\n",
- uap->grp, uap->id,
- uap->info, uap->options));
+ /* Hand off the easy cases to kern_wait(). */
+ if (!(uap->options & (SVR4_WNOWAIT)) &&
+ (uap->options & (SVR4_WEXITED | SVR4_WTRAPPED))) {
+ int options;
+
+ options = 0;
+ if (uap->options & SVR4_WSTOPPED)
+ options |= WUNTRACED;
+ if (uap->options & SVR4_WCONTINUED)
+ options |= WCONTINUED;
+ if (uap->options & SVR4_WNOHANG)
+ options |= WNOHANG;
+
+ error = kern_wait(td, pid, &status, options, &ru);
+ if (error)
+ return (error);
+ if (uap->options & SVR4_WNOHANG && *retval == 0)
+ error = svr4_setinfo(*retval, NULL, 0, uap->info);
+ else
+ error = svr4_setinfo(*retval, &ru, status, uap->info);
+ *retval = 0;
+ return (error);
+ }
+ /*
+ * Ok, handle the weird cases. Either WNOWAIT is set (meaning we
+ * just want to see if there is a process to harvest, we dont'
+ * want to actually harvest it), or WEXIT and WTRAPPED are clear
+ * meaning we want to ignore zombies. Either way, we don't have
+ * to handle harvesting zombies here. We do have to duplicate the
+ * other portions of kern_wait() though, especially for the
+ * WCONTINUED and WSTOPPED.
+ */
loop:
nfound = 0;
sx_slock(&proctree_lock);
- LIST_FOREACH(q, &p->p_children, p_sibling) {
- PROC_LOCK(q);
- if (uap->id != WAIT_ANY &&
- q->p_pid != uap->id &&
- q->p_pgid != -uap->id) {
- PROC_UNLOCK(q);
- DPRINTF(("pid %d pgid %d != %d\n", q->p_pid,
- q->p_pgid, uap->id));
+ LIST_FOREACH(p, &q->p_children, p_sibling) {
+ PROC_LOCK(p);
+ if (pid != WAIT_ANY &&
+ p->p_pid != pid && p->p_pgid != -pid) {
+ PROC_UNLOCK(p);
+ DPRINTF(("pid %d pgid %d != %d\n", p->p_pid,
+ p->p_pgid, pid));
continue;
}
+ if (p_canwait(td, p)) {
+ PROC_UNLOCK(p);
+ continue;
+ }
+
nfound++;
- if ((q->p_state == PRS_ZOMBIE) &&
+
+ PROC_SLOCK(p);
+ /*
+ * See if we have a zombie. If so, WNOWAIT should be set,
+ * as otherwise we should have called kern_wait() up above.
+ */
+ if ((p->p_state == PRS_ZOMBIE) &&
((uap->options & (SVR4_WEXITED|SVR4_WTRAPPED)))) {
- PROC_UNLOCK(q);
+ PROC_SUNLOCK(p);
+ KASSERT(uap->options & SVR4_WNOWAIT,
+ ("WNOWAIT is clear"));
+
+ /* Found a zombie, so cache info in local variables. */
+ pid = p->p_pid;
+ status = p->p_xstat;
+ ru = p->p_ru;
+ PROC_SLOCK(p);
+ calcru(p, &ru.ru_utime, &ru.ru_stime);
+ PROC_SUNLOCK(p);
+ PROC_UNLOCK(p);
sx_sunlock(&proctree_lock);
- *retval = 0;
- DPRINTF(("found %d\n", q->p_pid));
- error = svr4_setinfo(q, q->p_xstat, uap->info);
- if (error != 0)
- return error;
+ /* Copy the info out to userland. */
+ *retval = 0;
+ DPRINTF(("found %d\n", pid));
+ return (svr4_setinfo(pid, &ru, status, uap->info));
+ }
- if ((uap->options & SVR4_WNOWAIT)) {
- DPRINTF(("Don't wait\n"));
- return 0;
- }
+ /*
+ * See if we have a stopped or continued process.
+ * XXX: This duplicates the same code in kern_wait().
+ */
+ if ((p->p_flag & P_STOPPED_SIG) &&
+ (p->p_suspcount == p->p_numthreads) &&
+ (p->p_flag & P_WAITED) == 0 &&
+ (p->p_flag & P_TRACED || uap->options & SVR4_WSTOPPED)) {
+ PROC_SUNLOCK(p);
+ if (((uap->options & SVR4_WNOWAIT)) == 0)
+ p->p_flag |= P_WAITED;
+ sx_sunlock(&proctree_lock);
+ pid = p->p_pid;
+ status = W_STOPCODE(p->p_xstat);
+ ru = p->p_ru;
+ PROC_SLOCK(p);
+ calcru(p, &ru.ru_utime, &ru.ru_stime);
+ PROC_SUNLOCK(p);
+ PROC_UNLOCK(p);
- /*
- * If we got the child via ptrace(2) or procfs, and
- * the parent is different (meaning the process was
- * attached, rather than run as a child), then we need
- * to give it back to the old parent, and send the
- * parent a SIGCHLD. The rest of the cleanup will be
- * done when the old parent waits on the child.
- */
- sx_xlock(&proctree_lock);
- PROC_LOCK(q);
- if (q->p_flag & P_TRACED) {
- if (q->p_oppid != q->p_pptr->p_pid) {
- PROC_UNLOCK(q);
- t = pfind(q->p_oppid);
- if (t == NULL) {
- t = initproc;
- PROC_LOCK(initproc);
- }
- PROC_LOCK(q);
- proc_reparent(q, t);
- q->p_oppid = 0;
- q->p_flag &= ~(P_TRACED | P_WAITED);
- PROC_UNLOCK(q);
- psignal(t, SIGCHLD);
- wakeup(t);
- PROC_UNLOCK(t);
- sx_xunlock(&proctree_lock);
- return 0;
- }
+ if (((uap->options & SVR4_WNOWAIT)) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
}
- PROC_UNLOCK(q);
- sx_xunlock(&proctree_lock);
- q->p_xstat = 0;
- ruadd(&p->p_stats->p_cru, &p->p_crux, q->p_ru,
- &q->p_rux);
- FREE(q->p_ru, M_ZOMBIE);
- q->p_ru = NULL;
-
- /*
- * Decrement the count of procs running with this uid.
- */
- (void)chgproccnt(q->p_ucred->cr_ruidinfo, -1, 0);
-
- /*
- * Release reference to text vnode.
- */
- if (q->p_textvp)
- vrele(q->p_textvp);
-
- /*
- * Free up credentials.
- */
- crfree(q->p_ucred);
- q->p_ucred = NULL;
- /*
- * Remove unused arguments
- */
- pargs_drop(q->p_args);
- PROC_UNLOCK(q);
-
- /*
- * Finally finished with old proc entry.
- * Unlink it from its process group and free it.
- */
- sx_xlock(&proctree_lock);
- leavepgrp(q);
-
- sx_xlock(&allproc_lock);
- LIST_REMOVE(q, p_list); /* off zombproc */
- sx_xunlock(&allproc_lock);
-
- LIST_REMOVE(q, p_sibling);
- sx_xunlock(&proctree_lock);
-
- PROC_LOCK(q);
- sigacts_free(q->p_sigacts);
- q->p_sigacts = NULL;
- PROC_UNLOCK(q);
-
- /*
- * Give machine-dependent layer a chance
- * to free anything that cpu_exit couldn't
- * release while still running in process context.
- */
- vm_waitproc(q);
-#if defined(__NetBSD__)
- pool_put(&proc_pool, q);
-#endif
-#ifdef __FreeBSD__
- mtx_destroy(&q->p_mtx);
-#ifdef MAC
- mac_destroy_proc(q);
-#endif
- uma_zfree(proc_zone, q);
-#endif
- nprocs--;
- return 0;
+ *retval = 0;
+ DPRINTF(("jobcontrol %d\n", pid));
+ return (svr4_setinfo(pid, &ru, status, uap->info));
}
- /* XXXKSE this needs clarification */
- if (P_SHOULDSTOP(q) && ((q->p_flag & P_WAITED) == 0) &&
- (q->p_flag & P_TRACED ||
- (uap->options & (SVR4_WSTOPPED|SVR4_WCONTINUED)))) {
- DPRINTF(("jobcontrol %d\n", q->p_pid));
+ PROC_SUNLOCK(p);
+ if (uap->options & SVR4_WCONTINUED &&
+ (p->p_flag & P_CONTINUED)) {
+ sx_sunlock(&proctree_lock);
if (((uap->options & SVR4_WNOWAIT)) == 0)
- q->p_flag |= P_WAITED;
- PROC_UNLOCK(q);
+ p->p_flag &= ~P_CONTINUED;
+ pid = p->p_pid;
+ ru = p->p_ru;
+ status = SIGCONT;
+ PROC_SLOCK(p);
+ calcru(p, &ru.ru_utime, &ru.ru_stime);
+ PROC_SUNLOCK(p);
+ PROC_UNLOCK(p);
+
+ if (((uap->options & SVR4_WNOWAIT)) == 0) {
+ PROC_LOCK(q);
+ sigqueue_take(p->p_ksi);
+ PROC_UNLOCK(q);
+ }
+
*retval = 0;
- return svr4_setinfo(q, W_STOPCODE(q->p_xstat),
- uap->info);
+ DPRINTF(("jobcontrol %d\n", pid));
+ return (svr4_setinfo(pid, &ru, status, uap->info));
}
- PROC_UNLOCK(q);
+ PROC_UNLOCK(p);
}
- if (nfound == 0)
- return ECHILD;
+ if (nfound == 0) {
+ sx_sunlock(&proctree_lock);
+ return (ECHILD);
+ }
if (uap->options & SVR4_WNOHANG) {
+ sx_sunlock(&proctree_lock);
*retval = 0;
- if ((error = svr4_setinfo(NULL, 0, uap->info)) != 0)
- return error;
- return 0;
+ return (svr4_setinfo(0, NULL, 0, uap->info));
}
- if ((error = tsleep(p, PWAIT | PCATCH, "svr4_wait", 0)) != 0)
+ PROC_LOCK(q);
+ sx_sunlock(&proctree_lock);
+ if (q->p_flag & P_STATCHILD) {
+ q->p_flag &= ~P_STATCHILD;
+ error = 0;
+ } else
+ error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "svr4_wait", 0);
+ PROC_UNLOCK(q);
+ if (error)
return error;
goto loop;
}
@@ -1650,12 +1613,14 @@
struct nameidata nd;
int error, *retval = td->td_retval;
unsigned int ncopy;
+ int vfslocked;
- NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME, UIO_USERSPACE,
+ NDINIT(&nd, LOOKUP, NOFOLLOW | SAVENAME | MPSAFE, UIO_USERSPACE,
uap->path, td);
if ((error = namei(&nd)) != 0)
return error;
+ vfslocked = NDHASGIANT(&nd);
ncopy = min(uap->bufsiz, strlen(nd.ni_cnd.cn_pnbuf) + 1);
if ((error = copyout(nd.ni_cnd.cn_pnbuf, uap->buf, ncopy)) != 0)
@@ -1665,5 +1630,6 @@
bad:
NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
+ VFS_UNLOCK_GIANT(vfslocked);
return error;
}
Index: svr4_stropts.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_stropts.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_stropts.h -L sys/compat/svr4/svr4_stropts.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_stropts.h
+++ sys/compat/svr4/svr4_stropts.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4_stropts.h,v 1.5 2005/01/05 22:34:37 imp Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4_stropts.h,v 1.6 2006/07/28 16:56:17 jhb Exp $
*/
#ifndef _SVR4_STROPTS_H_
@@ -116,12 +116,16 @@
* Our internal state for the stream
* For now we keep almost nothing... In the future we can keep more
* streams state.
+ *
+ * Locking key:
+ * r - Read only field only set during creation
+ * G - Giant
*/
struct svr4_strm {
- int s_family; /* socket family */
- int s_cmd; /* last getmsg reply or putmsg request */
- int s_afd; /* last accepted fd; [for fd_insert] */
- int s_eventmask; /* state info from I_SETSIG et al */
+ int s_family; /* (r) socket family */
+ int s_cmd; /* (G) last getmsg reply or putmsg request */
+ int s_afd; /* (G) last accepted fd; [for fd_insert] */
+ int s_eventmask; /* (G) state info from I_SETSIG et al */
};
/*
Index: svr4_socket.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_socket.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_socket.c -L sys/compat/svr4/svr4_socket.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_socket.c
+++ sys/compat/svr4/svr4_socket.c
@@ -41,12 +41,14 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_socket.c,v 1.25 2005/07/07 19:27:29 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_socket.c,v 1.27 2006/07/21 20:40:13 jhb Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/queue.h>
+#include <sys/eventhandler.h>
#include <sys/file.h>
+#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/socket.h>
@@ -65,28 +67,34 @@
#include <compat/svr4/svr4_sockmod.h>
#include <compat/svr4/svr4_proto.h>
-struct sockaddr_un *
-svr4_find_socket(td, fp, dev, ino)
+struct svr4_sockcache_entry {
+ struct proc *p; /* Process for the socket */
+ void *cookie; /* Internal cookie used for matching */
+ struct sockaddr_un sock;/* Pathname for the socket */
+ dev_t dev; /* Device where the socket lives on */
+ ino_t ino; /* Inode where the socket lives on */
+ TAILQ_ENTRY(svr4_sockcache_entry) entries;
+};
+
+static TAILQ_HEAD(, svr4_sockcache_entry) svr4_head;
+static struct mtx svr4_sockcache_lock;
+static eventhandler_tag svr4_sockcache_exit_tag, svr4_sockcache_exec_tag;
+
+static void svr4_purge_sockcache(void *arg, struct proc *p);
+
+int
+svr4_find_socket(td, fp, dev, ino, saun)
struct thread *td;
struct file *fp;
dev_t dev;
ino_t ino;
+ struct sockaddr_un *saun;
{
struct svr4_sockcache_entry *e;
void *cookie = ((struct socket *)fp->f_data)->so_emuldata;
- if (svr4_str_initialized != 2) {
- if (atomic_cmpset_acq_int(&svr4_str_initialized, 0, 1)) {
- DPRINTF(("svr4_find_socket: uninitialized [%p,%d,%d]\n",
- td, dev, ino));
- TAILQ_INIT(&svr4_head);
- atomic_store_rel_int(&svr4_str_initialized, 2);
- }
- return NULL;
- }
-
-
DPRINTF(("svr4_find_socket: [%p,%d,%d]: ", td, dev, ino));
+ mtx_lock(&svr4_sockcache_lock);
TAILQ_FOREACH(e, &svr4_head, entries)
if (e->p == td->td_proc && e->dev == dev && e->ino == ino) {
#ifdef DIAGNOSTIC
@@ -95,18 +103,16 @@
#endif
e->cookie = cookie;
DPRINTF(("%s\n", e->sock.sun_path));
- return &e->sock;
+ *saun = e->sock;
+ mtx_unlock(&svr4_sockcache_lock);
+ return (0);
}
+ mtx_unlock(&svr4_sockcache_lock);
DPRINTF(("not found\n"));
- return NULL;
+ return (ENOENT);
}
-
-/*
- * svr4_delete_socket() is in sys/dev/streams.c (because it's called by
- * the streams "soo_close()" routine).
- */
int
svr4_add_socket(td, path, st)
struct thread *td;
@@ -116,21 +122,6 @@
struct svr4_sockcache_entry *e;
int len, error;
- mtx_lock(&Giant);
-
- /*
- * Wait for the TAILQ to be initialized. Only the very first CPU
- * will succeed on the atomic_cmpset(). The other CPU's will spin
- * until the first one finishes the initialization. Once the
- * initialization is complete, the condition will always fail
- * avoiding expensive atomic operations in the common case.
- */
- while (svr4_str_initialized != 2)
- if (atomic_cmpset_acq_int(&svr4_str_initialized, 0, 1)) {
- TAILQ_INIT(&svr4_head);
- atomic_store_rel_int(&svr4_str_initialized, 2);
- }
-
e = malloc(sizeof(*e), M_TEMP, M_WAITOK);
e->cookie = NULL;
e->dev = st->st_dev;
@@ -139,7 +130,6 @@
if ((error = copyinstr(path, e->sock.sun_path,
sizeof(e->sock.sun_path), &len)) != 0) {
- mtx_unlock(&Giant);
DPRINTF(("svr4_add_socket: copyinstr failed %d\n", error));
free(e, M_TEMP);
return error;
@@ -148,13 +138,76 @@
e->sock.sun_family = AF_LOCAL;
e->sock.sun_len = len;
+ mtx_lock(&svr4_sockcache_lock);
TAILQ_INSERT_HEAD(&svr4_head, e, entries);
- mtx_unlock(&Giant);
+ mtx_unlock(&svr4_sockcache_lock);
DPRINTF(("svr4_add_socket: %s [%p,%d,%d]\n", e->sock.sun_path,
td->td_proc, e->dev, e->ino));
return 0;
}
+void
+svr4_delete_socket(p, fp)
+ struct proc *p;
+ struct file *fp;
+{
+ struct svr4_sockcache_entry *e;
+ void *cookie = ((struct socket *)fp->f_data)->so_emuldata;
+
+ mtx_lock(&svr4_sockcache_lock);
+ TAILQ_FOREACH(e, &svr4_head, entries)
+ if (e->p == p && e->cookie == cookie) {
+ TAILQ_REMOVE(&svr4_head, e, entries);
+ mtx_unlock(&svr4_sockcache_lock);
+ DPRINTF(("svr4_delete_socket: %s [%p,%d,%d]\n",
+ e->sock.sun_path, p, (int)e->dev, e->ino));
+ free(e, M_TEMP);
+ return;
+ }
+ mtx_unlock(&svr4_sockcache_lock);
+}
+
+void
+svr4_purge_sockcache(arg, p)
+ void *arg;
+ struct proc *p;
+{
+ struct svr4_sockcache_entry *e, *ne;
+
+ mtx_lock(&svr4_sockcache_lock);
+ TAILQ_FOREACH_SAFE(e, &svr4_head, entries, ne) {
+ if (e->p == p) {
+ TAILQ_REMOVE(&svr4_head, e, entries);
+ DPRINTF(("svr4_purge_sockcache: %s [%p,%d,%d]\n",
+ e->sock.sun_path, p, (int)e->dev, e->ino));
+ free(e, M_TEMP);
+ }
+ }
+ mtx_unlock(&svr4_sockcache_lock);
+}
+
+void
+svr4_sockcache_init(void)
+{
+
+ TAILQ_INIT(&svr4_head);
+ mtx_init(&svr4_sockcache_lock, "svr4 socket cache", NULL, MTX_DEF);
+ svr4_sockcache_exit_tag = EVENTHANDLER_REGISTER(process_exit,
+ svr4_purge_sockcache, NULL, EVENTHANDLER_PRI_ANY);
+ svr4_sockcache_exec_tag = EVENTHANDLER_REGISTER(process_exec,
+ svr4_purge_sockcache, NULL, EVENTHANDLER_PRI_ANY);
+}
+
+void
+svr4_sockcache_destroy(void)
+{
+
+ KASSERT(TAILQ_EMPTY(&svr4_head),
+ ("%s: sockcache entries still around", __func__));
+ EVENTHANDLER_DEREGISTER(process_exec, svr4_sockcache_exec_tag);
+ EVENTHANDLER_DEREGISTER(process_exit, svr4_sockcache_exit_tag);
+ mtx_destroy(&svr4_sockcache_lock);
+}
int
svr4_sys_socket(td, uap)
Index: imgact_svr4.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/imgact_svr4.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/imgact_svr4.c -L sys/compat/svr4/imgact_svr4.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/imgact_svr4.c
+++ sys/compat/svr4/imgact_svr4.c
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.25 2005/04/01 20:00:10 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/imgact_svr4.c,v 1.25.14.1 2008/01/19 18:15:03 kib Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -120,7 +120,9 @@
/*
* Destroy old process VM and create a new one (with a new stack)
*/
- exec_new_vmspace(imgp, &svr4_sysvec);
+ error = exec_new_vmspace(imgp, &svr4_sysvec);
+ if (error)
+ goto fail;
vmspace = imgp->proc->p_vmspace;
/*
Index: svr4_ttold.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_ttold.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_ttold.c -L sys/compat/svr4/svr4_ttold.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_ttold.c
+++ sys/compat/svr4/svr4_ttold.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ttold.c,v 1.14 2005/01/05 22:34:37 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_ttold.c,v 1.16 2005/09/28 07:03:02 rwatson Exp $");
#ifndef BURN_BRIDGES
Index: svr4_util.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_util.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_util.h -L sys/compat/svr4/svr4_util.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_util.h
+++ sys/compat/svr4/svr4_util.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4_util.h,v 1.9 2005/02/07 21:53:42 jhb Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4_util.h,v 1.12 2006/07/10 21:38:17 jhb Exp $
*/
#ifndef _SVR4_UTIL_H_
@@ -47,30 +47,6 @@
#define DPRINTF(a)
#endif
-
-static __inline caddr_t stackgap_init(void);
-static __inline void *stackgap_alloc(caddr_t *, size_t);
-
-static __inline caddr_t
-stackgap_init()
-{
-#define szsigcode (*(curthread->td_proc->p_sysent->sv_szsigcode))
- return (caddr_t)(((caddr_t)PS_STRINGS) - szsigcode - SPARE_USRSPACE);
-}
-
-static __inline void *
-stackgap_alloc(sgp, sz)
- caddr_t *sgp;
- size_t sz;
-{
- void *p = (void *) *sgp;
- sz = ALIGN(sz);
- if (*sgp + sz > (caddr_t)(PS_STRINGS - szsigcode))
- return NULL;
- *sgp += sz;
- return p;
-}
-
int svr4_emul_find(struct thread *, char *, enum uio_seg, char **, int);
#define CHECKALT(td, upath, pathp, i) \
Index: svr4_proto.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_proto.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_proto.h -L sys/compat/svr4/svr4_proto.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_proto.h
+++ sys/compat/svr4/svr4_proto.h
@@ -2,8 +2,8 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/svr4/svr4_proto.h,v 1.17.2.2 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.17.2.2 2005/07/20 17:42:15 jhb Exp
+ * $FreeBSD: src/sys/compat/svr4/svr4_proto.h,v 1.28 2006/11/11 21:49:08 ru Exp $
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp
*/
#ifndef _SVR4_SYSPROTO_H_
@@ -11,12 +11,11 @@
#include <sys/signal.h>
#include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
-#include <posix4/_semaphore.h>
-
+#include <sys/_semaphore.h>
#include <sys/ucontext.h>
+#include <bsm/audit_kevents.h>
+
struct proc;
struct thread;
@@ -497,6 +496,86 @@
#endif /* COMPAT_FREEBSD4 */
+#define SVR4_SYS_AUE_svr4_sys_open AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_wait AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_creat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_execv AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_time AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_mknod AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_break AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_stat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_alarm AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fstat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_pause AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_utime AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_access AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_nice AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_kill AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_pgrpsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_times AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_signal AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_msgsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sysarch AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_shmsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_semsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_ioctl AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_utssys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_execve AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fcntl AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_ulimit AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_getdents AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_getmsg AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_putmsg AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_poll AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_lstat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sigprocmask AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sigsuspend AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sigaltstack AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sigaction AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sigpending AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_context AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_statvfs AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fstatvfs AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_waitsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_hrtsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_pathconf AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_mmap AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fpathconf AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_xstat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_lxstat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fxstat AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_xmknod AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_setrlimit AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_getrlimit AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_memcntl AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_uname AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sysconfig AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_systeminfo AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fchroot AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_utimes AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_vhangup AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_gettimeofday AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_llseek AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_acl AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_auditsys AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_facl AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_resolvepath AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_getdents64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_mmap64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_stat64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_lstat64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fstat64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_statvfs64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_fstatvfs64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_setrlimit64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_getrlimit64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_creat64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_open64 AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_socket AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_recv AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_send AUE_NULL
+#define SVR4_SYS_AUE_svr4_sys_sendto AUE_NULL
+
#undef PAD_
#undef PADL_
#undef PADR_
Index: svr4_stat.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_stat.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_stat.c -L sys/compat/svr4/svr4_stat.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_stat.c
+++ sys/compat/svr4/svr4_stat.c
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_stat.c,v 1.20 2005/02/07 21:53:42 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_stat.c,v 1.23 2006/09/02 08:18:22 rwatson Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -470,14 +470,10 @@
break;
#if defined(WHY_DOES_AN_EMULATOR_WANT_TO_SET_HOSTNAMES)
case SVR4_SI_SET_HOSTNAME:
- if ((error = suser(td)) != 0)
- return error;
name = KERN_HOSTNAME;
return kern_sysctl(&name, 1, 0, 0, uap->buf, rlen, td);
case SVR4_SI_SET_SRPC_DOMAIN:
- if ((error = suser(td)) != 0)
- return error;
name = KERN_NISDOMAINNAME;
return kern_sysctl(&name, 1, 0, 0, uap->buf, rlen, td);
#else
Index: svr4_syscallnames.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_syscallnames.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_syscallnames.c -L sys/compat/svr4/svr4_syscallnames.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_syscallnames.c
+++ sys/compat/svr4/svr4_syscallnames.c
@@ -2,8 +2,8 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/svr4/svr4_syscallnames.c,v 1.15.2.2 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.17.2.2 2005/07/20 17:42:15 jhb Exp
+ * $FreeBSD: src/sys/compat/svr4/svr4_syscallnames.c,v 1.26 2006/11/11 21:49:08 ru Exp $
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp
*/
const char *svr4_syscallnames[] = {
Index: svr4_siginfo.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_siginfo.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_siginfo.h -L sys/compat/svr4/svr4_siginfo.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_siginfo.h
+++ sys/compat/svr4/svr4_siginfo.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4_siginfo.h,v 1.4 2005/01/05 22:34:36 imp Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4_siginfo.h,v 1.5 2005/10/19 09:33:15 davidxu Exp $
*/
#ifndef _SVR4_SIGINFO_H_
@@ -96,16 +96,16 @@
} _info;
} svr4_siginfo_t;
-#define si_signo _info._signo
-#define si_code _info._code
-#define si_errno _info._errno
-
-#define si_pid _info._reason._child._pid
-#define si_stime _info._reason._child._stime
-#define si_status _info._reason._child._status
-#define si_utime _info._reason._child._utime
+#define svr4_si_signo _info._signo
+#define svr4_si_code _info._code
+#define svr4_si_errno _info._errno
+
+#define svr4_si_pid _info._reason._child._pid
+#define svr4_si_stime _info._reason._child._stime
+#define svr4_si_status _info._reason._child._status
+#define svr4_si_utime _info._reason._child._utime
-#define si_addr _info._reason._fault._addr
-#define si_trap _info._reason._fault._trap
+#define svr4_si_addr _info._reason._fault._addr
+#define svr4_si_trap _info._reason._fault._trap
#endif /* !_SVR4_SIGINFO_H_ */
Index: svr4_signal.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_signal.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_signal.h -L sys/compat/svr4/svr4_signal.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_signal.h
+++ sys/compat/svr4/svr4_signal.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4_signal.h,v 1.11 2005/02/25 19:34:10 sam Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4_signal.h,v 1.12 2005/10/14 12:43:44 davidxu Exp $
*/
#ifndef _SVR4_SIGNAL_H_
@@ -133,10 +133,12 @@
#define SVR4_MINSIGSTKSZ 8192
+struct ksiginfo;
+
void bsd_to_svr4_sigaltstack(const struct sigaltstack *, struct svr4_sigaltstack *);
void bsd_to_svr4_sigset(const sigset_t *, svr4_sigset_t *);
void svr4_to_bsd_sigaltstack(const struct svr4_sigaltstack *, struct sigaltstack *);
void svr4_to_bsd_sigset(const svr4_sigset_t *, sigset_t *);
-void svr4_sendsig(sig_t, int, sigset_t *, u_long);
+void svr4_sendsig(sig_t, struct ksiginfo *, sigset_t *);
#endif /* !_SVR4_SIGNAL_H_ */
Index: svr4_sysent.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_sysent.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_sysent.c -L sys/compat/svr4/svr4_sysent.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_sysent.c
+++ sys/compat/svr4/svr4_sysent.c
@@ -2,8 +2,8 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/compat/svr4/svr4_sysent.c,v 1.16.2.2 2005/07/20 17:43:53 jhb Exp $
- * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.17.2.2 2005/07/20 17:42:15 jhb Exp
+ * $FreeBSD: src/sys/compat/svr4/svr4_sysent.c,v 1.27 2006/11/11 21:49:08 ru Exp $
+ * created from FreeBSD: src/sys/compat/svr4/syscalls.master,v 1.28 2006/07/28 19:05:27 jhb Exp
*/
#include <bsm/audit_kevents.h>
@@ -20,254 +20,254 @@
/* The casts are bogus but will do for now. */
struct sysent svr4_sysent[] = {
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 0 = unused */
- { SYF_MPSAFE | AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_NULL }, /* 1 = exit */
- { SYF_MPSAFE | 0, (sy_call_t *)fork, AUE_NULL }, /* 2 = fork */
- { SYF_MPSAFE | AS(read_args), (sy_call_t *)read, AUE_NULL }, /* 3 = read */
- { SYF_MPSAFE | AS(write_args), (sy_call_t *)write, AUE_NULL }, /* 4 = write */
- { SYF_MPSAFE | AS(svr4_sys_open_args), (sy_call_t *)svr4_sys_open, AUE_NULL }, /* 5 = svr4_sys_open */
- { SYF_MPSAFE | AS(close_args), (sy_call_t *)close, AUE_NULL }, /* 6 = close */
- { SYF_MPSAFE | AS(svr4_sys_wait_args), (sy_call_t *)svr4_sys_wait, AUE_NULL }, /* 7 = svr4_sys_wait */
- { SYF_MPSAFE | AS(svr4_sys_creat_args), (sy_call_t *)svr4_sys_creat, AUE_NULL }, /* 8 = svr4_sys_creat */
- { SYF_MPSAFE | AS(link_args), (sy_call_t *)link, AUE_NULL }, /* 9 = link */
- { SYF_MPSAFE | AS(unlink_args), (sy_call_t *)unlink, AUE_NULL }, /* 10 = unlink */
- { SYF_MPSAFE | AS(svr4_sys_execv_args), (sy_call_t *)svr4_sys_execv, AUE_NULL }, /* 11 = svr4_sys_execv */
- { SYF_MPSAFE | AS(chdir_args), (sy_call_t *)chdir, AUE_NULL }, /* 12 = chdir */
- { SYF_MPSAFE | AS(svr4_sys_time_args), (sy_call_t *)svr4_sys_time, AUE_NULL }, /* 13 = svr4_sys_time */
- { SYF_MPSAFE | AS(svr4_sys_mknod_args), (sy_call_t *)svr4_sys_mknod, AUE_NULL }, /* 14 = svr4_sys_mknod */
- { SYF_MPSAFE | AS(chmod_args), (sy_call_t *)chmod, AUE_NULL }, /* 15 = chmod */
- { SYF_MPSAFE | AS(chown_args), (sy_call_t *)chown, AUE_NULL }, /* 16 = chown */
- { AS(svr4_sys_break_args), (sy_call_t *)svr4_sys_break, AUE_NULL }, /* 17 = svr4_sys_break */
- { SYF_MPSAFE | AS(svr4_sys_stat_args), (sy_call_t *)svr4_sys_stat, AUE_NULL }, /* 18 = svr4_sys_stat */
- { SYF_MPSAFE | AS(lseek_args), (sy_call_t *)lseek, AUE_NULL }, /* 19 = lseek */
- { SYF_MPSAFE | 0, (sy_call_t *)getpid, AUE_NULL }, /* 20 = getpid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 21 = old_mount */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 22 = sysv_umount */
- { SYF_MPSAFE | AS(setuid_args), (sy_call_t *)setuid, AUE_NULL }, /* 23 = setuid */
- { SYF_MPSAFE | 0, (sy_call_t *)getuid, AUE_NULL }, /* 24 = getuid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 25 = stime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 26 = ptrace */
- { SYF_MPSAFE | AS(svr4_sys_alarm_args), (sy_call_t *)svr4_sys_alarm, AUE_NULL }, /* 27 = svr4_sys_alarm */
- { SYF_MPSAFE | AS(svr4_sys_fstat_args), (sy_call_t *)svr4_sys_fstat, AUE_NULL }, /* 28 = svr4_sys_fstat */
- { SYF_MPSAFE | 0, (sy_call_t *)svr4_sys_pause, AUE_NULL }, /* 29 = svr4_sys_pause */
- { SYF_MPSAFE | AS(svr4_sys_utime_args), (sy_call_t *)svr4_sys_utime, AUE_NULL }, /* 30 = svr4_sys_utime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 31 = stty */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 32 = gtty */
- { SYF_MPSAFE | AS(svr4_sys_access_args), (sy_call_t *)svr4_sys_access, AUE_NULL }, /* 33 = svr4_sys_access */
- { SYF_MPSAFE | AS(svr4_sys_nice_args), (sy_call_t *)svr4_sys_nice, AUE_NULL }, /* 34 = svr4_sys_nice */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 35 = statfs */
- { SYF_MPSAFE | 0, (sy_call_t *)sync, AUE_NULL }, /* 36 = sync */
- { SYF_MPSAFE | AS(svr4_sys_kill_args), (sy_call_t *)svr4_sys_kill, AUE_NULL }, /* 37 = svr4_sys_kill */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 38 = fstatfs */
- { SYF_MPSAFE | AS(svr4_sys_pgrpsys_args), (sy_call_t *)svr4_sys_pgrpsys, AUE_NULL }, /* 39 = svr4_sys_pgrpsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 40 = xenix */
- { SYF_MPSAFE | AS(dup_args), (sy_call_t *)dup, AUE_NULL }, /* 41 = dup */
- { SYF_MPSAFE | 0, (sy_call_t *)pipe, AUE_NULL }, /* 42 = pipe */
- { SYF_MPSAFE | AS(svr4_sys_times_args), (sy_call_t *)svr4_sys_times, AUE_NULL }, /* 43 = svr4_sys_times */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 44 = profil */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 45 = plock */
- { SYF_MPSAFE | AS(setgid_args), (sy_call_t *)setgid, AUE_NULL }, /* 46 = setgid */
- { SYF_MPSAFE | 0, (sy_call_t *)getgid, AUE_NULL }, /* 47 = getgid */
- { SYF_MPSAFE | AS(svr4_sys_signal_args), (sy_call_t *)svr4_sys_signal, AUE_NULL }, /* 48 = svr4_sys_signal */
- { SYF_MPSAFE | AS(svr4_sys_msgsys_args), (sy_call_t *)svr4_sys_msgsys, AUE_NULL }, /* 49 = svr4_sys_msgsys */
- { SYF_MPSAFE | AS(svr4_sys_sysarch_args), (sy_call_t *)svr4_sys_sysarch, AUE_NULL }, /* 50 = svr4_sys_sysarch */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 51 = acct */
- { AS(svr4_sys_shmsys_args), (sy_call_t *)svr4_sys_shmsys, AUE_NULL }, /* 52 = svr4_sys_shmsys */
- { AS(svr4_sys_semsys_args), (sy_call_t *)svr4_sys_semsys, AUE_NULL }, /* 53 = svr4_sys_semsys */
- { AS(svr4_sys_ioctl_args), (sy_call_t *)svr4_sys_ioctl, AUE_NULL }, /* 54 = svr4_sys_ioctl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 55 = uadmin */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 56 = exch */
- { SYF_MPSAFE | AS(svr4_sys_utssys_args), (sy_call_t *)svr4_sys_utssys, AUE_NULL }, /* 57 = svr4_sys_utssys */
- { SYF_MPSAFE | AS(fsync_args), (sy_call_t *)fsync, AUE_NULL }, /* 58 = fsync */
- { SYF_MPSAFE | AS(svr4_sys_execve_args), (sy_call_t *)svr4_sys_execve, AUE_NULL }, /* 59 = svr4_sys_execve */
- { SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask, AUE_NULL }, /* 60 = umask */
- { SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot, AUE_NULL }, /* 61 = chroot */
- { SYF_MPSAFE | AS(svr4_sys_fcntl_args), (sy_call_t *)svr4_sys_fcntl, AUE_NULL }, /* 62 = svr4_sys_fcntl */
- { SYF_MPSAFE | AS(svr4_sys_ulimit_args), (sy_call_t *)svr4_sys_ulimit, AUE_NULL }, /* 63 = svr4_sys_ulimit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 64 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 65 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 66 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 67 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 68 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 69 = reserved */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 70 = advfs */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 71 = unadvfs */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 72 = rmount */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 73 = rumount */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 74 = rfstart */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 75 = sigret */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 76 = rdebug */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 77 = rfstop */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 78 = rfsys */
- { SYF_MPSAFE | AS(rmdir_args), (sy_call_t *)rmdir, AUE_NULL }, /* 79 = rmdir */
- { SYF_MPSAFE | AS(mkdir_args), (sy_call_t *)mkdir, AUE_NULL }, /* 80 = mkdir */
- { AS(svr4_sys_getdents_args), (sy_call_t *)svr4_sys_getdents, AUE_NULL }, /* 81 = svr4_sys_getdents */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 82 = libattach */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 83 = libdetach */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 84 = sysfs */
- { AS(svr4_sys_getmsg_args), (sy_call_t *)svr4_sys_getmsg, AUE_NULL }, /* 85 = svr4_sys_getmsg */
- { AS(svr4_sys_putmsg_args), (sy_call_t *)svr4_sys_putmsg, AUE_NULL }, /* 86 = svr4_sys_putmsg */
- { SYF_MPSAFE | AS(svr4_sys_poll_args), (sy_call_t *)svr4_sys_poll, AUE_NULL }, /* 87 = svr4_sys_poll */
- { SYF_MPSAFE | AS(svr4_sys_lstat_args), (sy_call_t *)svr4_sys_lstat, AUE_NULL }, /* 88 = svr4_sys_lstat */
- { SYF_MPSAFE | AS(symlink_args), (sy_call_t *)symlink, AUE_NULL }, /* 89 = symlink */
- { SYF_MPSAFE | AS(readlink_args), (sy_call_t *)readlink, AUE_NULL }, /* 90 = readlink */
- { SYF_MPSAFE | AS(getgroups_args), (sy_call_t *)getgroups, AUE_NULL }, /* 91 = getgroups */
- { SYF_MPSAFE | AS(setgroups_args), (sy_call_t *)setgroups, AUE_NULL }, /* 92 = setgroups */
- { SYF_MPSAFE | AS(fchmod_args), (sy_call_t *)fchmod, AUE_NULL }, /* 93 = fchmod */
- { SYF_MPSAFE | AS(fchown_args), (sy_call_t *)fchown, AUE_NULL }, /* 94 = fchown */
- { SYF_MPSAFE | AS(svr4_sys_sigprocmask_args), (sy_call_t *)svr4_sys_sigprocmask, AUE_NULL }, /* 95 = svr4_sys_sigprocmask */
- { SYF_MPSAFE | AS(svr4_sys_sigsuspend_args), (sy_call_t *)svr4_sys_sigsuspend, AUE_NULL }, /* 96 = svr4_sys_sigsuspend */
- { SYF_MPSAFE | AS(svr4_sys_sigaltstack_args), (sy_call_t *)svr4_sys_sigaltstack, AUE_NULL }, /* 97 = svr4_sys_sigaltstack */
- { SYF_MPSAFE | AS(svr4_sys_sigaction_args), (sy_call_t *)svr4_sys_sigaction, AUE_NULL }, /* 98 = svr4_sys_sigaction */
- { SYF_MPSAFE | AS(svr4_sys_sigpending_args), (sy_call_t *)svr4_sys_sigpending, AUE_NULL }, /* 99 = svr4_sys_sigpending */
- { SYF_MPSAFE | AS(svr4_sys_context_args), (sy_call_t *)svr4_sys_context, AUE_NULL }, /* 100 = svr4_sys_context */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 101 = evsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 102 = evtrapret */
- { SYF_MPSAFE | AS(svr4_sys_statvfs_args), (sy_call_t *)svr4_sys_statvfs, AUE_NULL }, /* 103 = svr4_sys_statvfs */
- { SYF_MPSAFE | AS(svr4_sys_fstatvfs_args), (sy_call_t *)svr4_sys_fstatvfs, AUE_NULL }, /* 104 = svr4_sys_fstatvfs */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 105 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 106 = nfssvc */
- { AS(svr4_sys_waitsys_args), (sy_call_t *)svr4_sys_waitsys, AUE_NULL }, /* 107 = svr4_sys_waitsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 108 = sigsendsys */
- { SYF_MPSAFE | AS(svr4_sys_hrtsys_args), (sy_call_t *)svr4_sys_hrtsys, AUE_NULL }, /* 109 = svr4_sys_hrtsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 110 = acancel */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 111 = async */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 112 = priocntlsys */
- { SYF_MPSAFE | AS(svr4_sys_pathconf_args), (sy_call_t *)svr4_sys_pathconf, AUE_NULL }, /* 113 = svr4_sys_pathconf */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 114 = mincore */
- { SYF_MPSAFE | AS(svr4_sys_mmap_args), (sy_call_t *)svr4_sys_mmap, AUE_NULL }, /* 115 = svr4_sys_mmap */
- { SYF_MPSAFE | AS(mprotect_args), (sy_call_t *)mprotect, AUE_NULL }, /* 116 = mprotect */
- { SYF_MPSAFE | AS(munmap_args), (sy_call_t *)munmap, AUE_NULL }, /* 117 = munmap */
- { SYF_MPSAFE | AS(svr4_sys_fpathconf_args), (sy_call_t *)svr4_sys_fpathconf, AUE_NULL }, /* 118 = svr4_sys_fpathconf */
- { SYF_MPSAFE | 0, (sy_call_t *)vfork, AUE_NULL }, /* 119 = vfork */
- { SYF_MPSAFE | AS(fchdir_args), (sy_call_t *)fchdir, AUE_NULL }, /* 120 = fchdir */
- { SYF_MPSAFE | AS(readv_args), (sy_call_t *)readv, AUE_NULL }, /* 121 = readv */
- { SYF_MPSAFE | AS(writev_args), (sy_call_t *)writev, AUE_NULL }, /* 122 = writev */
- { SYF_MPSAFE | AS(svr4_sys_xstat_args), (sy_call_t *)svr4_sys_xstat, AUE_NULL }, /* 123 = svr4_sys_xstat */
- { SYF_MPSAFE | AS(svr4_sys_lxstat_args), (sy_call_t *)svr4_sys_lxstat, AUE_NULL }, /* 124 = svr4_sys_lxstat */
- { SYF_MPSAFE | AS(svr4_sys_fxstat_args), (sy_call_t *)svr4_sys_fxstat, AUE_NULL }, /* 125 = svr4_sys_fxstat */
- { SYF_MPSAFE | AS(svr4_sys_xmknod_args), (sy_call_t *)svr4_sys_xmknod, AUE_NULL }, /* 126 = svr4_sys_xmknod */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 127 = clocal */
- { SYF_MPSAFE | AS(svr4_sys_setrlimit_args), (sy_call_t *)svr4_sys_setrlimit, AUE_NULL }, /* 128 = svr4_sys_setrlimit */
- { SYF_MPSAFE | AS(svr4_sys_getrlimit_args), (sy_call_t *)svr4_sys_getrlimit, AUE_NULL }, /* 129 = svr4_sys_getrlimit */
- { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 130 = lchown */
- { SYF_MPSAFE | AS(svr4_sys_memcntl_args), (sy_call_t *)svr4_sys_memcntl, AUE_NULL }, /* 131 = svr4_sys_memcntl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 132 = getpmsg */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 133 = putpmsg */
- { SYF_MPSAFE | AS(rename_args), (sy_call_t *)rename, AUE_NULL }, /* 134 = rename */
- { SYF_MPSAFE | AS(svr4_sys_uname_args), (sy_call_t *)svr4_sys_uname, AUE_NULL }, /* 135 = svr4_sys_uname */
- { SYF_MPSAFE | AS(setegid_args), (sy_call_t *)setegid, AUE_NULL }, /* 136 = setegid */
- { SYF_MPSAFE | AS(svr4_sys_sysconfig_args), (sy_call_t *)svr4_sys_sysconfig, AUE_NULL }, /* 137 = svr4_sys_sysconfig */
- { SYF_MPSAFE | AS(adjtime_args), (sy_call_t *)adjtime, AUE_NULL }, /* 138 = adjtime */
- { SYF_MPSAFE | AS(svr4_sys_systeminfo_args), (sy_call_t *)svr4_sys_systeminfo, AUE_NULL }, /* 139 = svr4_sys_systeminfo */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 140 = notused */
- { SYF_MPSAFE | AS(seteuid_args), (sy_call_t *)seteuid, AUE_NULL }, /* 141 = seteuid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 142 = vtrace */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 143 = { */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 144 = sigtimedwait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 145 = lwp_info */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 146 = yield */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 147 = lwp_sema_wait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 148 = lwp_sema_post */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 149 = lwp_sema_trywait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 150 = notused */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 151 = notused */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 152 = modctl */
- { AS(svr4_sys_fchroot_args), (sy_call_t *)svr4_sys_fchroot, AUE_NULL }, /* 153 = svr4_sys_fchroot */
- { SYF_MPSAFE | AS(svr4_sys_utimes_args), (sy_call_t *)svr4_sys_utimes, AUE_NULL }, /* 154 = svr4_sys_utimes */
- { SYF_MPSAFE | 0, (sy_call_t *)svr4_sys_vhangup, AUE_NULL }, /* 155 = svr4_sys_vhangup */
- { SYF_MPSAFE | AS(svr4_sys_gettimeofday_args), (sy_call_t *)svr4_sys_gettimeofday, AUE_NULL }, /* 156 = svr4_sys_gettimeofday */
- { SYF_MPSAFE | AS(getitimer_args), (sy_call_t *)getitimer, AUE_NULL }, /* 157 = getitimer */
- { SYF_MPSAFE | AS(setitimer_args), (sy_call_t *)setitimer, AUE_NULL }, /* 158 = setitimer */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 159 = lwp_create */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 160 = lwp_exit */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 161 = lwp_suspend */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 162 = lwp_continue */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 163 = lwp_kill */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 164 = lwp_self */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 165 = lwp_getprivate */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 166 = lwp_setprivate */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 167 = lwp_wait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 168 = lwp_mutex_unlock */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 169 = lwp_mutex_lock */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 170 = lwp_cond_wait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 171 = lwp_cond_signal */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 172 = lwp_cond_broadcast */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 173 = { */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 174 = { */
- { SYF_MPSAFE | AS(svr4_sys_llseek_args), (sy_call_t *)svr4_sys_llseek, AUE_NULL }, /* 175 = svr4_sys_llseek */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 176 = inst_sync */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 177 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 178 = kaio */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 179 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 180 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 181 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 182 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 183 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 184 = tsolsys */
- { SYF_MPSAFE | AS(svr4_sys_acl_args), (sy_call_t *)svr4_sys_acl, AUE_NULL }, /* 185 = svr4_sys_acl */
- { SYF_MPSAFE | AS(svr4_sys_auditsys_args), (sy_call_t *)svr4_sys_auditsys, AUE_NULL }, /* 186 = svr4_sys_auditsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 187 = processor_bind */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 188 = processor_info */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 189 = p_online */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 190 = sigqueue */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 191 = clock_gettime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 192 = clock_settime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 193 = clock_getres */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 194 = timer_create */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 195 = timer_delete */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 196 = timer_settime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 197 = timer_gettime */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 198 = timer_overrun */
- { SYF_MPSAFE | AS(nanosleep_args), (sy_call_t *)nanosleep, AUE_NULL }, /* 199 = nanosleep */
- { SYF_MPSAFE | AS(svr4_sys_facl_args), (sy_call_t *)svr4_sys_facl, AUE_NULL }, /* 200 = svr4_sys_facl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 201 = door */
- { SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid, AUE_NULL }, /* 202 = setreuid */
- { SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid, AUE_NULL }, /* 203 = setregid */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 204 = install_utrap */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 205 = signotify */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 206 = schedctl */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 207 = pset */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 208 = whoknows */
- { AS(svr4_sys_resolvepath_args), (sy_call_t *)svr4_sys_resolvepath, AUE_NULL }, /* 209 = svr4_sys_resolvepath */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 210 = signotifywait */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 211 = lwp_sigredirect */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 212 = lwp_alarm */
- { AS(svr4_sys_getdents64_args), (sy_call_t *)svr4_sys_getdents64, AUE_NULL }, /* 213 = svr4_sys_getdents64 */
- { SYF_MPSAFE | AS(svr4_sys_mmap64_args), (sy_call_t *)svr4_sys_mmap64, AUE_NULL }, /* 214 = svr4_sys_mmap64 */
- { SYF_MPSAFE | AS(svr4_sys_stat64_args), (sy_call_t *)svr4_sys_stat64, AUE_NULL }, /* 215 = svr4_sys_stat64 */
- { SYF_MPSAFE | AS(svr4_sys_lstat64_args), (sy_call_t *)svr4_sys_lstat64, AUE_NULL }, /* 216 = svr4_sys_lstat64 */
- { SYF_MPSAFE | AS(svr4_sys_fstat64_args), (sy_call_t *)svr4_sys_fstat64, AUE_NULL }, /* 217 = svr4_sys_fstat64 */
- { SYF_MPSAFE | AS(svr4_sys_statvfs64_args), (sy_call_t *)svr4_sys_statvfs64, AUE_NULL }, /* 218 = svr4_sys_statvfs64 */
- { SYF_MPSAFE | AS(svr4_sys_fstatvfs64_args), (sy_call_t *)svr4_sys_fstatvfs64, AUE_NULL }, /* 219 = svr4_sys_fstatvfs64 */
- { SYF_MPSAFE | AS(svr4_sys_setrlimit64_args), (sy_call_t *)svr4_sys_setrlimit64, AUE_NULL }, /* 220 = svr4_sys_setrlimit64 */
- { SYF_MPSAFE | AS(svr4_sys_getrlimit64_args), (sy_call_t *)svr4_sys_getrlimit64, AUE_NULL }, /* 221 = svr4_sys_getrlimit64 */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 222 = pread64 */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 223 = pwrite64 */
- { SYF_MPSAFE | AS(svr4_sys_creat64_args), (sy_call_t *)svr4_sys_creat64, AUE_NULL }, /* 224 = svr4_sys_creat64 */
- { SYF_MPSAFE | AS(svr4_sys_open64_args), (sy_call_t *)svr4_sys_open64, AUE_NULL }, /* 225 = svr4_sys_open64 */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 226 = rpcsys */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 227 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 228 = whoknows */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 229 = whoknows */
- { SYF_MPSAFE | AS(svr4_sys_socket_args), (sy_call_t *)svr4_sys_socket, AUE_NULL }, /* 230 = svr4_sys_socket */
- { SYF_MPSAFE | AS(socketpair_args), (sy_call_t *)socketpair, AUE_NULL }, /* 231 = socketpair */
- { SYF_MPSAFE | AS(bind_args), (sy_call_t *)bind, AUE_NULL }, /* 232 = bind */
- { SYF_MPSAFE | AS(listen_args), (sy_call_t *)listen, AUE_NULL }, /* 233 = listen */
- { SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept, AUE_NULL }, /* 234 = accept */
- { SYF_MPSAFE | AS(connect_args), (sy_call_t *)connect, AUE_NULL }, /* 235 = connect */
- { SYF_MPSAFE | AS(shutdown_args), (sy_call_t *)shutdown, AUE_NULL }, /* 236 = shutdown */
- { SYF_MPSAFE | AS(svr4_sys_recv_args), (sy_call_t *)svr4_sys_recv, AUE_NULL }, /* 237 = svr4_sys_recv */
- { SYF_MPSAFE | AS(recvfrom_args), (sy_call_t *)recvfrom, AUE_NULL }, /* 238 = recvfrom */
- { SYF_MPSAFE | AS(recvmsg_args), (sy_call_t *)recvmsg, AUE_NULL }, /* 239 = recvmsg */
- { SYF_MPSAFE | AS(svr4_sys_send_args), (sy_call_t *)svr4_sys_send, AUE_NULL }, /* 240 = svr4_sys_send */
- { SYF_MPSAFE | AS(sendmsg_args), (sy_call_t *)sendmsg, AUE_NULL }, /* 241 = sendmsg */
- { SYF_MPSAFE | AS(svr4_sys_sendto_args), (sy_call_t *)svr4_sys_sendto, AUE_NULL }, /* 242 = svr4_sys_sendto */
- { SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL }, /* 243 = getpeername */
- { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL }, /* 244 = getsockname */
- { SYF_MPSAFE | AS(getsockopt_args), (sy_call_t *)getsockopt, AUE_NULL }, /* 245 = getsockopt */
- { SYF_MPSAFE | AS(setsockopt_args), (sy_call_t *)setsockopt, AUE_NULL }, /* 246 = setsockopt */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 247 = sockconfig */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 248 = { */
- { 0, (sy_call_t *)nosys, AUE_NULL }, /* 249 = { */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 0 = unused */
+ { AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_NULL, NULL, 0, 0 }, /* 1 = exit */
+ { 0, (sy_call_t *)fork, AUE_NULL, NULL, 0, 0 }, /* 2 = fork */
+ { AS(read_args), (sy_call_t *)read, AUE_NULL, NULL, 0, 0 }, /* 3 = read */
+ { AS(write_args), (sy_call_t *)write, AUE_NULL, NULL, 0, 0 }, /* 4 = write */
+ { AS(svr4_sys_open_args), (sy_call_t *)svr4_sys_open, AUE_NULL, NULL, 0, 0 }, /* 5 = svr4_sys_open */
+ { AS(close_args), (sy_call_t *)close, AUE_NULL, NULL, 0, 0 }, /* 6 = close */
+ { AS(svr4_sys_wait_args), (sy_call_t *)svr4_sys_wait, AUE_NULL, NULL, 0, 0 }, /* 7 = svr4_sys_wait */
+ { AS(svr4_sys_creat_args), (sy_call_t *)svr4_sys_creat, AUE_NULL, NULL, 0, 0 }, /* 8 = svr4_sys_creat */
+ { AS(link_args), (sy_call_t *)link, AUE_NULL, NULL, 0, 0 }, /* 9 = link */
+ { AS(unlink_args), (sy_call_t *)unlink, AUE_NULL, NULL, 0, 0 }, /* 10 = unlink */
+ { AS(svr4_sys_execv_args), (sy_call_t *)svr4_sys_execv, AUE_NULL, NULL, 0, 0 }, /* 11 = svr4_sys_execv */
+ { AS(chdir_args), (sy_call_t *)chdir, AUE_NULL, NULL, 0, 0 }, /* 12 = chdir */
+ { AS(svr4_sys_time_args), (sy_call_t *)svr4_sys_time, AUE_NULL, NULL, 0, 0 }, /* 13 = svr4_sys_time */
+ { AS(svr4_sys_mknod_args), (sy_call_t *)svr4_sys_mknod, AUE_NULL, NULL, 0, 0 }, /* 14 = svr4_sys_mknod */
+ { AS(chmod_args), (sy_call_t *)chmod, AUE_NULL, NULL, 0, 0 }, /* 15 = chmod */
+ { AS(chown_args), (sy_call_t *)chown, AUE_NULL, NULL, 0, 0 }, /* 16 = chown */
+ { AS(svr4_sys_break_args), (sy_call_t *)svr4_sys_break, AUE_NULL, NULL, 0, 0 }, /* 17 = svr4_sys_break */
+ { AS(svr4_sys_stat_args), (sy_call_t *)svr4_sys_stat, AUE_NULL, NULL, 0, 0 }, /* 18 = svr4_sys_stat */
+ { AS(lseek_args), (sy_call_t *)lseek, AUE_NULL, NULL, 0, 0 }, /* 19 = lseek */
+ { 0, (sy_call_t *)getpid, AUE_NULL, NULL, 0, 0 }, /* 20 = getpid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 21 = old_mount */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 22 = sysv_umount */
+ { AS(setuid_args), (sy_call_t *)setuid, AUE_NULL, NULL, 0, 0 }, /* 23 = setuid */
+ { 0, (sy_call_t *)getuid, AUE_NULL, NULL, 0, 0 }, /* 24 = getuid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 25 = stime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 26 = ptrace */
+ { AS(svr4_sys_alarm_args), (sy_call_t *)svr4_sys_alarm, AUE_NULL, NULL, 0, 0 }, /* 27 = svr4_sys_alarm */
+ { AS(svr4_sys_fstat_args), (sy_call_t *)svr4_sys_fstat, AUE_NULL, NULL, 0, 0 }, /* 28 = svr4_sys_fstat */
+ { 0, (sy_call_t *)svr4_sys_pause, AUE_NULL, NULL, 0, 0 }, /* 29 = svr4_sys_pause */
+ { AS(svr4_sys_utime_args), (sy_call_t *)svr4_sys_utime, AUE_NULL, NULL, 0, 0 }, /* 30 = svr4_sys_utime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 31 = stty */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 32 = gtty */
+ { AS(svr4_sys_access_args), (sy_call_t *)svr4_sys_access, AUE_NULL, NULL, 0, 0 }, /* 33 = svr4_sys_access */
+ { AS(svr4_sys_nice_args), (sy_call_t *)svr4_sys_nice, AUE_NULL, NULL, 0, 0 }, /* 34 = svr4_sys_nice */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 35 = statfs */
+ { 0, (sy_call_t *)sync, AUE_NULL, NULL, 0, 0 }, /* 36 = sync */
+ { AS(svr4_sys_kill_args), (sy_call_t *)svr4_sys_kill, AUE_NULL, NULL, 0, 0 }, /* 37 = svr4_sys_kill */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 38 = fstatfs */
+ { AS(svr4_sys_pgrpsys_args), (sy_call_t *)svr4_sys_pgrpsys, AUE_NULL, NULL, 0, 0 }, /* 39 = svr4_sys_pgrpsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 40 = xenix */
+ { AS(dup_args), (sy_call_t *)dup, AUE_NULL, NULL, 0, 0 }, /* 41 = dup */
+ { 0, (sy_call_t *)pipe, AUE_NULL, NULL, 0, 0 }, /* 42 = pipe */
+ { AS(svr4_sys_times_args), (sy_call_t *)svr4_sys_times, AUE_NULL, NULL, 0, 0 }, /* 43 = svr4_sys_times */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 44 = profil */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 45 = plock */
+ { AS(setgid_args), (sy_call_t *)setgid, AUE_NULL, NULL, 0, 0 }, /* 46 = setgid */
+ { 0, (sy_call_t *)getgid, AUE_NULL, NULL, 0, 0 }, /* 47 = getgid */
+ { AS(svr4_sys_signal_args), (sy_call_t *)svr4_sys_signal, AUE_NULL, NULL, 0, 0 }, /* 48 = svr4_sys_signal */
+ { AS(svr4_sys_msgsys_args), (sy_call_t *)svr4_sys_msgsys, AUE_NULL, NULL, 0, 0 }, /* 49 = svr4_sys_msgsys */
+ { AS(svr4_sys_sysarch_args), (sy_call_t *)svr4_sys_sysarch, AUE_NULL, NULL, 0, 0 }, /* 50 = svr4_sys_sysarch */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 51 = acct */
+ { AS(svr4_sys_shmsys_args), (sy_call_t *)svr4_sys_shmsys, AUE_NULL, NULL, 0, 0 }, /* 52 = svr4_sys_shmsys */
+ { AS(svr4_sys_semsys_args), (sy_call_t *)svr4_sys_semsys, AUE_NULL, NULL, 0, 0 }, /* 53 = svr4_sys_semsys */
+ { AS(svr4_sys_ioctl_args), (sy_call_t *)svr4_sys_ioctl, AUE_NULL, NULL, 0, 0 }, /* 54 = svr4_sys_ioctl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 55 = uadmin */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 56 = exch */
+ { AS(svr4_sys_utssys_args), (sy_call_t *)svr4_sys_utssys, AUE_NULL, NULL, 0, 0 }, /* 57 = svr4_sys_utssys */
+ { AS(fsync_args), (sy_call_t *)fsync, AUE_NULL, NULL, 0, 0 }, /* 58 = fsync */
+ { AS(svr4_sys_execve_args), (sy_call_t *)svr4_sys_execve, AUE_NULL, NULL, 0, 0 }, /* 59 = svr4_sys_execve */
+ { AS(umask_args), (sy_call_t *)umask, AUE_NULL, NULL, 0, 0 }, /* 60 = umask */
+ { AS(chroot_args), (sy_call_t *)chroot, AUE_NULL, NULL, 0, 0 }, /* 61 = chroot */
+ { AS(svr4_sys_fcntl_args), (sy_call_t *)svr4_sys_fcntl, AUE_NULL, NULL, 0, 0 }, /* 62 = svr4_sys_fcntl */
+ { AS(svr4_sys_ulimit_args), (sy_call_t *)svr4_sys_ulimit, AUE_NULL, NULL, 0, 0 }, /* 63 = svr4_sys_ulimit */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 64 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 65 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 66 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 67 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 68 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 69 = reserved */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 70 = advfs */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 71 = unadvfs */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 72 = rmount */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 73 = rumount */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 74 = rfstart */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 75 = sigret */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 76 = rdebug */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 77 = rfstop */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 78 = rfsys */
+ { AS(rmdir_args), (sy_call_t *)rmdir, AUE_NULL, NULL, 0, 0 }, /* 79 = rmdir */
+ { AS(mkdir_args), (sy_call_t *)mkdir, AUE_NULL, NULL, 0, 0 }, /* 80 = mkdir */
+ { AS(svr4_sys_getdents_args), (sy_call_t *)svr4_sys_getdents, AUE_NULL, NULL, 0, 0 }, /* 81 = svr4_sys_getdents */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 82 = libattach */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 83 = libdetach */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 84 = sysfs */
+ { AS(svr4_sys_getmsg_args), (sy_call_t *)svr4_sys_getmsg, AUE_NULL, NULL, 0, 0 }, /* 85 = svr4_sys_getmsg */
+ { AS(svr4_sys_putmsg_args), (sy_call_t *)svr4_sys_putmsg, AUE_NULL, NULL, 0, 0 }, /* 86 = svr4_sys_putmsg */
+ { AS(svr4_sys_poll_args), (sy_call_t *)svr4_sys_poll, AUE_NULL, NULL, 0, 0 }, /* 87 = svr4_sys_poll */
+ { AS(svr4_sys_lstat_args), (sy_call_t *)svr4_sys_lstat, AUE_NULL, NULL, 0, 0 }, /* 88 = svr4_sys_lstat */
+ { AS(symlink_args), (sy_call_t *)symlink, AUE_NULL, NULL, 0, 0 }, /* 89 = symlink */
+ { AS(readlink_args), (sy_call_t *)readlink, AUE_NULL, NULL, 0, 0 }, /* 90 = readlink */
+ { AS(getgroups_args), (sy_call_t *)getgroups, AUE_NULL, NULL, 0, 0 }, /* 91 = getgroups */
+ { AS(setgroups_args), (sy_call_t *)setgroups, AUE_NULL, NULL, 0, 0 }, /* 92 = setgroups */
+ { AS(fchmod_args), (sy_call_t *)fchmod, AUE_NULL, NULL, 0, 0 }, /* 93 = fchmod */
+ { AS(fchown_args), (sy_call_t *)fchown, AUE_NULL, NULL, 0, 0 }, /* 94 = fchown */
+ { AS(svr4_sys_sigprocmask_args), (sy_call_t *)svr4_sys_sigprocmask, AUE_NULL, NULL, 0, 0 }, /* 95 = svr4_sys_sigprocmask */
+ { AS(svr4_sys_sigsuspend_args), (sy_call_t *)svr4_sys_sigsuspend, AUE_NULL, NULL, 0, 0 }, /* 96 = svr4_sys_sigsuspend */
+ { AS(svr4_sys_sigaltstack_args), (sy_call_t *)svr4_sys_sigaltstack, AUE_NULL, NULL, 0, 0 }, /* 97 = svr4_sys_sigaltstack */
+ { AS(svr4_sys_sigaction_args), (sy_call_t *)svr4_sys_sigaction, AUE_NULL, NULL, 0, 0 }, /* 98 = svr4_sys_sigaction */
+ { AS(svr4_sys_sigpending_args), (sy_call_t *)svr4_sys_sigpending, AUE_NULL, NULL, 0, 0 }, /* 99 = svr4_sys_sigpending */
+ { AS(svr4_sys_context_args), (sy_call_t *)svr4_sys_context, AUE_NULL, NULL, 0, 0 }, /* 100 = svr4_sys_context */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 101 = evsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 102 = evtrapret */
+ { AS(svr4_sys_statvfs_args), (sy_call_t *)svr4_sys_statvfs, AUE_NULL, NULL, 0, 0 }, /* 103 = svr4_sys_statvfs */
+ { AS(svr4_sys_fstatvfs_args), (sy_call_t *)svr4_sys_fstatvfs, AUE_NULL, NULL, 0, 0 }, /* 104 = svr4_sys_fstatvfs */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 105 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 106 = nfssvc */
+ { AS(svr4_sys_waitsys_args), (sy_call_t *)svr4_sys_waitsys, AUE_NULL, NULL, 0, 0 }, /* 107 = svr4_sys_waitsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 108 = sigsendsys */
+ { AS(svr4_sys_hrtsys_args), (sy_call_t *)svr4_sys_hrtsys, AUE_NULL, NULL, 0, 0 }, /* 109 = svr4_sys_hrtsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 110 = acancel */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 111 = async */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 112 = priocntlsys */
+ { AS(svr4_sys_pathconf_args), (sy_call_t *)svr4_sys_pathconf, AUE_NULL, NULL, 0, 0 }, /* 113 = svr4_sys_pathconf */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 114 = mincore */
+ { AS(svr4_sys_mmap_args), (sy_call_t *)svr4_sys_mmap, AUE_NULL, NULL, 0, 0 }, /* 115 = svr4_sys_mmap */
+ { AS(mprotect_args), (sy_call_t *)mprotect, AUE_NULL, NULL, 0, 0 }, /* 116 = mprotect */
+ { AS(munmap_args), (sy_call_t *)munmap, AUE_NULL, NULL, 0, 0 }, /* 117 = munmap */
+ { AS(svr4_sys_fpathconf_args), (sy_call_t *)svr4_sys_fpathconf, AUE_NULL, NULL, 0, 0 }, /* 118 = svr4_sys_fpathconf */
+ { 0, (sy_call_t *)vfork, AUE_NULL, NULL, 0, 0 }, /* 119 = vfork */
+ { AS(fchdir_args), (sy_call_t *)fchdir, AUE_NULL, NULL, 0, 0 }, /* 120 = fchdir */
+ { AS(readv_args), (sy_call_t *)readv, AUE_NULL, NULL, 0, 0 }, /* 121 = readv */
+ { AS(writev_args), (sy_call_t *)writev, AUE_NULL, NULL, 0, 0 }, /* 122 = writev */
+ { AS(svr4_sys_xstat_args), (sy_call_t *)svr4_sys_xstat, AUE_NULL, NULL, 0, 0 }, /* 123 = svr4_sys_xstat */
+ { AS(svr4_sys_lxstat_args), (sy_call_t *)svr4_sys_lxstat, AUE_NULL, NULL, 0, 0 }, /* 124 = svr4_sys_lxstat */
+ { AS(svr4_sys_fxstat_args), (sy_call_t *)svr4_sys_fxstat, AUE_NULL, NULL, 0, 0 }, /* 125 = svr4_sys_fxstat */
+ { AS(svr4_sys_xmknod_args), (sy_call_t *)svr4_sys_xmknod, AUE_NULL, NULL, 0, 0 }, /* 126 = svr4_sys_xmknod */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 127 = clocal */
+ { AS(svr4_sys_setrlimit_args), (sy_call_t *)svr4_sys_setrlimit, AUE_NULL, NULL, 0, 0 }, /* 128 = svr4_sys_setrlimit */
+ { AS(svr4_sys_getrlimit_args), (sy_call_t *)svr4_sys_getrlimit, AUE_NULL, NULL, 0, 0 }, /* 129 = svr4_sys_getrlimit */
+ { AS(lchown_args), (sy_call_t *)lchown, AUE_NULL, NULL, 0, 0 }, /* 130 = lchown */
+ { AS(svr4_sys_memcntl_args), (sy_call_t *)svr4_sys_memcntl, AUE_NULL, NULL, 0, 0 }, /* 131 = svr4_sys_memcntl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 132 = getpmsg */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 133 = putpmsg */
+ { AS(rename_args), (sy_call_t *)rename, AUE_NULL, NULL, 0, 0 }, /* 134 = rename */
+ { AS(svr4_sys_uname_args), (sy_call_t *)svr4_sys_uname, AUE_NULL, NULL, 0, 0 }, /* 135 = svr4_sys_uname */
+ { AS(setegid_args), (sy_call_t *)setegid, AUE_NULL, NULL, 0, 0 }, /* 136 = setegid */
+ { AS(svr4_sys_sysconfig_args), (sy_call_t *)svr4_sys_sysconfig, AUE_NULL, NULL, 0, 0 }, /* 137 = svr4_sys_sysconfig */
+ { AS(adjtime_args), (sy_call_t *)adjtime, AUE_NULL, NULL, 0, 0 }, /* 138 = adjtime */
+ { AS(svr4_sys_systeminfo_args), (sy_call_t *)svr4_sys_systeminfo, AUE_NULL, NULL, 0, 0 }, /* 139 = svr4_sys_systeminfo */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 140 = notused */
+ { AS(seteuid_args), (sy_call_t *)seteuid, AUE_NULL, NULL, 0, 0 }, /* 141 = seteuid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 142 = vtrace */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 143 = { */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 144 = sigtimedwait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 145 = lwp_info */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 146 = yield */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 147 = lwp_sema_wait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 148 = lwp_sema_post */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 149 = lwp_sema_trywait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 150 = notused */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 151 = notused */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 152 = modctl */
+ { AS(svr4_sys_fchroot_args), (sy_call_t *)svr4_sys_fchroot, AUE_NULL, NULL, 0, 0 }, /* 153 = svr4_sys_fchroot */
+ { AS(svr4_sys_utimes_args), (sy_call_t *)svr4_sys_utimes, AUE_NULL, NULL, 0, 0 }, /* 154 = svr4_sys_utimes */
+ { 0, (sy_call_t *)svr4_sys_vhangup, AUE_NULL, NULL, 0, 0 }, /* 155 = svr4_sys_vhangup */
+ { AS(svr4_sys_gettimeofday_args), (sy_call_t *)svr4_sys_gettimeofday, AUE_NULL, NULL, 0, 0 }, /* 156 = svr4_sys_gettimeofday */
+ { AS(getitimer_args), (sy_call_t *)getitimer, AUE_NULL, NULL, 0, 0 }, /* 157 = getitimer */
+ { AS(setitimer_args), (sy_call_t *)setitimer, AUE_NULL, NULL, 0, 0 }, /* 158 = setitimer */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 159 = lwp_create */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 160 = lwp_exit */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 161 = lwp_suspend */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 162 = lwp_continue */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 163 = lwp_kill */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 164 = lwp_self */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 165 = lwp_getprivate */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 166 = lwp_setprivate */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 167 = lwp_wait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 168 = lwp_mutex_unlock */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 169 = lwp_mutex_lock */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 170 = lwp_cond_wait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 171 = lwp_cond_signal */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 172 = lwp_cond_broadcast */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 173 = { */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 174 = { */
+ { AS(svr4_sys_llseek_args), (sy_call_t *)svr4_sys_llseek, AUE_NULL, NULL, 0, 0 }, /* 175 = svr4_sys_llseek */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 176 = inst_sync */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 177 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 178 = kaio */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 179 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 180 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 181 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 182 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 183 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 184 = tsolsys */
+ { AS(svr4_sys_acl_args), (sy_call_t *)svr4_sys_acl, AUE_NULL, NULL, 0, 0 }, /* 185 = svr4_sys_acl */
+ { AS(svr4_sys_auditsys_args), (sy_call_t *)svr4_sys_auditsys, AUE_NULL, NULL, 0, 0 }, /* 186 = svr4_sys_auditsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 187 = processor_bind */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 188 = processor_info */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 189 = p_online */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 190 = sigqueue */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 191 = clock_gettime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 192 = clock_settime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 193 = clock_getres */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 194 = timer_create */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 195 = timer_delete */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 196 = timer_settime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 197 = timer_gettime */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 198 = timer_overrun */
+ { AS(nanosleep_args), (sy_call_t *)nanosleep, AUE_NULL, NULL, 0, 0 }, /* 199 = nanosleep */
+ { AS(svr4_sys_facl_args), (sy_call_t *)svr4_sys_facl, AUE_NULL, NULL, 0, 0 }, /* 200 = svr4_sys_facl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 201 = door */
+ { AS(setreuid_args), (sy_call_t *)setreuid, AUE_NULL, NULL, 0, 0 }, /* 202 = setreuid */
+ { AS(setregid_args), (sy_call_t *)setregid, AUE_NULL, NULL, 0, 0 }, /* 203 = setregid */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 204 = install_utrap */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 205 = signotify */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 206 = schedctl */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 207 = pset */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 208 = whoknows */
+ { AS(svr4_sys_resolvepath_args), (sy_call_t *)svr4_sys_resolvepath, AUE_NULL, NULL, 0, 0 }, /* 209 = svr4_sys_resolvepath */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 210 = signotifywait */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 211 = lwp_sigredirect */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 212 = lwp_alarm */
+ { AS(svr4_sys_getdents64_args), (sy_call_t *)svr4_sys_getdents64, AUE_NULL, NULL, 0, 0 }, /* 213 = svr4_sys_getdents64 */
+ { AS(svr4_sys_mmap64_args), (sy_call_t *)svr4_sys_mmap64, AUE_NULL, NULL, 0, 0 }, /* 214 = svr4_sys_mmap64 */
+ { AS(svr4_sys_stat64_args), (sy_call_t *)svr4_sys_stat64, AUE_NULL, NULL, 0, 0 }, /* 215 = svr4_sys_stat64 */
+ { AS(svr4_sys_lstat64_args), (sy_call_t *)svr4_sys_lstat64, AUE_NULL, NULL, 0, 0 }, /* 216 = svr4_sys_lstat64 */
+ { AS(svr4_sys_fstat64_args), (sy_call_t *)svr4_sys_fstat64, AUE_NULL, NULL, 0, 0 }, /* 217 = svr4_sys_fstat64 */
+ { AS(svr4_sys_statvfs64_args), (sy_call_t *)svr4_sys_statvfs64, AUE_NULL, NULL, 0, 0 }, /* 218 = svr4_sys_statvfs64 */
+ { AS(svr4_sys_fstatvfs64_args), (sy_call_t *)svr4_sys_fstatvfs64, AUE_NULL, NULL, 0, 0 }, /* 219 = svr4_sys_fstatvfs64 */
+ { AS(svr4_sys_setrlimit64_args), (sy_call_t *)svr4_sys_setrlimit64, AUE_NULL, NULL, 0, 0 }, /* 220 = svr4_sys_setrlimit64 */
+ { AS(svr4_sys_getrlimit64_args), (sy_call_t *)svr4_sys_getrlimit64, AUE_NULL, NULL, 0, 0 }, /* 221 = svr4_sys_getrlimit64 */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 222 = pread64 */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 223 = pwrite64 */
+ { AS(svr4_sys_creat64_args), (sy_call_t *)svr4_sys_creat64, AUE_NULL, NULL, 0, 0 }, /* 224 = svr4_sys_creat64 */
+ { AS(svr4_sys_open64_args), (sy_call_t *)svr4_sys_open64, AUE_NULL, NULL, 0, 0 }, /* 225 = svr4_sys_open64 */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 226 = rpcsys */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 227 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 228 = whoknows */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 229 = whoknows */
+ { AS(svr4_sys_socket_args), (sy_call_t *)svr4_sys_socket, AUE_NULL, NULL, 0, 0 }, /* 230 = svr4_sys_socket */
+ { AS(socketpair_args), (sy_call_t *)socketpair, AUE_NULL, NULL, 0, 0 }, /* 231 = socketpair */
+ { AS(bind_args), (sy_call_t *)bind, AUE_NULL, NULL, 0, 0 }, /* 232 = bind */
+ { AS(listen_args), (sy_call_t *)listen, AUE_NULL, NULL, 0, 0 }, /* 233 = listen */
+ { AS(accept_args), (sy_call_t *)accept, AUE_NULL, NULL, 0, 0 }, /* 234 = accept */
+ { AS(connect_args), (sy_call_t *)connect, AUE_NULL, NULL, 0, 0 }, /* 235 = connect */
+ { AS(shutdown_args), (sy_call_t *)shutdown, AUE_NULL, NULL, 0, 0 }, /* 236 = shutdown */
+ { AS(svr4_sys_recv_args), (sy_call_t *)svr4_sys_recv, AUE_NULL, NULL, 0, 0 }, /* 237 = svr4_sys_recv */
+ { AS(recvfrom_args), (sy_call_t *)recvfrom, AUE_NULL, NULL, 0, 0 }, /* 238 = recvfrom */
+ { AS(recvmsg_args), (sy_call_t *)recvmsg, AUE_NULL, NULL, 0, 0 }, /* 239 = recvmsg */
+ { AS(svr4_sys_send_args), (sy_call_t *)svr4_sys_send, AUE_NULL, NULL, 0, 0 }, /* 240 = svr4_sys_send */
+ { AS(sendmsg_args), (sy_call_t *)sendmsg, AUE_NULL, NULL, 0, 0 }, /* 241 = sendmsg */
+ { AS(svr4_sys_sendto_args), (sy_call_t *)svr4_sys_sendto, AUE_NULL, NULL, 0, 0 }, /* 242 = svr4_sys_sendto */
+ { AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL, NULL, 0, 0 }, /* 243 = getpeername */
+ { AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL, NULL, 0, 0 }, /* 244 = getsockname */
+ { AS(getsockopt_args), (sy_call_t *)getsockopt, AUE_NULL, NULL, 0, 0 }, /* 245 = getsockopt */
+ { AS(setsockopt_args), (sy_call_t *)setsockopt, AUE_NULL, NULL, 0, 0 }, /* 246 = setsockopt */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 247 = sockconfig */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 248 = { */
+ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 }, /* 249 = { */
};
Index: svr4_stream.c
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4_stream.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4_stream.c -L sys/compat/svr4/svr4_stream.c -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4_stream.c
+++ sys/compat/svr4/svr4_stream.c
@@ -36,11 +36,10 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_stream.c,v 1.53.2.1 2005/07/18 19:48:13 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/svr4/svr4_stream.c,v 1.62 2006/08/05 22:04:21 rwatson Exp $");
#include "opt_compat.h"
#include "opt_ktrace.h"
-#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -50,7 +49,6 @@
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/file.h> /* Must come after sys/malloc.h */
-#include <sys/mac.h>
#include <sys/mbuf.h>
#include <sys/mutex.h>
#include <sys/proc.h>
@@ -133,237 +131,6 @@
struct thread *);
static int ti_bind(struct file *, int, struct svr4_strioctl *, struct thread *);
-/* infrastructure */
-static int svr4_sendit(struct thread *td, int s, struct msghdr *mp, int flags);
-
-static int svr4_recvit(struct thread *td, int s, struct msghdr *mp,
- caddr_t namelenp);
-
-/* <sigh> Ok, so we shouldn't use sendit() in uipc_syscalls.c because
- * it isn't part of a "public" interface; We're supposed to use
- * pru_sosend instead. Same goes for recvit()/pru_soreceive() for
- * that matter. Solution: Suck sendit()/recvit() into here where we
- * can do what we like.
- *
- * I hate code duplication.
- *
- * I will take out all the #ifdef COMPAT_OLDSOCK gumph, though.
- */
-static int
-svr4_sendit(td, s, mp, flags)
- register struct thread *td;
- int s;
- register struct msghdr *mp;
- int flags;
-{
- struct uio auio;
- register struct iovec *iov;
- register int i;
- struct mbuf *control;
- struct sockaddr *to;
- int len, error;
- struct socket *so;
-#ifdef KTRACE
- struct uio *ktruio = NULL;
-#endif
-
- if ((error = fgetsock(td, s, &so, NULL)) != 0)
- return (error);
-
-#ifdef MAC
- SOCK_LOCK(so);
- error = mac_check_socket_send(td->td_ucred, so);
- SOCK_UNLOCK(so);
- if (error)
- goto done1;
-#endif
-
- auio.uio_iov = mp->msg_iov;
- auio.uio_iovcnt = mp->msg_iovlen;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_rw = UIO_WRITE;
- auio.uio_td = td;
- auio.uio_offset = 0; /* XXX */
- auio.uio_resid = 0;
- iov = mp->msg_iov;
- for (i = 0; i < mp->msg_iovlen; i++, iov++) {
- if ((auio.uio_resid += iov->iov_len) < 0) {
- error = EINVAL;
- goto done1;
- }
- }
- if (mp->msg_name) {
- error = getsockaddr(&to, mp->msg_name, mp->msg_namelen);
- if (error)
- goto done1;
- } else {
- to = 0;
- }
- if (mp->msg_control) {
- if (mp->msg_controllen < sizeof(struct cmsghdr)) {
- error = EINVAL;
- goto bad;
- }
- error = sockargs(&control, mp->msg_control,
- mp->msg_controllen, MT_CONTROL);
- if (error)
- goto bad;
- } else {
- control = 0;
- }
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_GENIO))
- ktruio = cloneuio(&auio);
-#endif
- len = auio.uio_resid;
- error = so->so_proto->pr_usrreqs->pru_sosend(so, to, &auio, 0, control,
- flags, td);
- if (error) {
- if (auio.uio_resid != len && (error == ERESTART ||
- error == EINTR || error == EWOULDBLOCK))
- error = 0;
- if (error == EPIPE) {
- PROC_LOCK(td->td_proc);
- psignal(td->td_proc, SIGPIPE);
- PROC_UNLOCK(td->td_proc);
- }
- }
- if (error == 0)
- td->td_retval[0] = len - auio.uio_resid;
-#ifdef KTRACE
- if (ktruio != NULL) {
- ktruio->uio_resid = td->td_retval[0];
- ktrgenio(s, UIO_WRITE, ktruio, error);
- }
-#endif
-bad:
- if (to)
- FREE(to, M_SONAME);
-done1:
- fputsock(so);
- return (error);
-}
-
-static int
-svr4_recvit(td, s, mp, namelenp)
- register struct thread *td;
- int s;
- register struct msghdr *mp;
- caddr_t namelenp;
-{
- struct uio auio;
- register struct iovec *iov;
- register int i;
- int len, error;
- struct mbuf *m, *control = 0;
- caddr_t ctlbuf;
- struct socket *so;
- struct sockaddr *fromsa = 0;
-#ifdef KTRACE
- struct uio *ktruio = NULL;
-#endif
-
- if ((error = fgetsock(td, s, &so, NULL)) != 0)
- return (error);
-
-#ifdef MAC
- SOCK_LOCK(so);
- error = mac_check_socket_receive(td->td_ucred, so);
- SOCK_UNLOCK(so);
- if (error)
- goto done1;
-#endif
-
- auio.uio_iov = mp->msg_iov;
- auio.uio_iovcnt = mp->msg_iovlen;
- auio.uio_segflg = UIO_USERSPACE;
- auio.uio_rw = UIO_READ;
- auio.uio_td = td;
- auio.uio_offset = 0; /* XXX */
- auio.uio_resid = 0;
- iov = mp->msg_iov;
- for (i = 0; i < mp->msg_iovlen; i++, iov++) {
- if ((auio.uio_resid += iov->iov_len) < 0) {
- error = EINVAL;
- goto done1;
- }
- }
-#ifdef KTRACE
- if (KTRPOINT(td, KTR_GENIO))
- ktruio = cloneuio(&auio);
-#endif
- len = auio.uio_resid;
- error = so->so_proto->pr_usrreqs->pru_soreceive(so, &fromsa, &auio,
- (struct mbuf **)0, mp->msg_control ? &control : (struct mbuf **)0,
- &mp->msg_flags);
- if (error) {
- if (auio.uio_resid != len && (error == ERESTART ||
- error == EINTR || error == EWOULDBLOCK))
- error = 0;
- }
-#ifdef KTRACE
- if (ktruio != NULL) {
- ktruio->uio_resid = len - auio.uio_resid;
- ktrgenio(s, UIO_READ, ktruio, error);
- }
-#endif
- if (error)
- goto out;
- td->td_retval[0] = len - auio.uio_resid;
- if (mp->msg_name) {
- len = mp->msg_namelen;
- if (len <= 0 || fromsa == 0)
- len = 0;
- else {
- /* save sa_len before it is destroyed by MSG_COMPAT */
- len = MIN(len, fromsa->sa_len);
- error = copyout(fromsa,
- (caddr_t)mp->msg_name, (unsigned)len);
- if (error)
- goto out;
- }
- mp->msg_namelen = len;
- if (namelenp &&
- (error = copyout((caddr_t)&len, namelenp, sizeof (int)))) {
- goto out;
- }
- }
- if (mp->msg_control) {
- len = mp->msg_controllen;
- m = control;
- mp->msg_controllen = 0;
- ctlbuf = (caddr_t) mp->msg_control;
-
- while (m && len > 0) {
- unsigned int tocopy;
-
- if (len >= m->m_len)
- tocopy = m->m_len;
- else {
- mp->msg_flags |= MSG_CTRUNC;
- tocopy = len;
- }
-
- if ((error = copyout((caddr_t)mtod(m, caddr_t),
- ctlbuf, tocopy)) != 0)
- goto out;
-
- ctlbuf += tocopy;
- len -= tocopy;
- m = m->m_next;
- }
- mp->msg_controllen = ctlbuf - (caddr_t)mp->msg_control;
- }
-out:
- if (fromsa)
- FREE(fromsa, M_SONAME);
- if (control)
- m_freem(control);
-done1:
- fputsock(so);
- return (error);
-}
-
#ifdef DEBUG_SVR4
static void bufprint(u_char *, size_t);
static int show_ioc(const char *, struct svr4_strioctl *);
@@ -981,11 +748,9 @@
struct svr4_strm *st = svr4_stream_get(fp);
struct sockaddr_in sain;
struct sockaddr_un saun;
- caddr_t sg;
- void *skp, *sup = NULL;
+ struct sockaddr *skp;
int sasize;
struct svr4_strmcmd bnd;
- struct bind_args ba;
if (st == NULL) {
DPRINTF(("ti_bind: bad file descriptor\n"));
@@ -1005,11 +770,11 @@
switch (st->s_family) {
case AF_INET:
- skp = &sain;
+ skp = (struct sockaddr *)&sain;
sasize = sizeof(sain);
if (bnd.offs == 0)
- goto reply;
+ goto error;
netaddr_to_sockaddr_in(&sain, &bnd);
@@ -1019,15 +784,15 @@
break;
case AF_LOCAL:
- skp = &saun;
+ skp = (struct sockaddr *)&saun;
sasize = sizeof(saun);
if (bnd.offs == 0)
- goto reply;
+ goto error;
netaddr_to_sockaddr_un(&saun, &bnd);
if (saun.sun_path[0] == '\0')
- goto reply;
+ goto error;
DPRINTF(("TI_BIND: fam %d, path %s\n",
saun.sun_family, saun.sun_path));
@@ -1044,29 +809,20 @@
return ENOSYS;
}
- sg = stackgap_init();
- sup = stackgap_alloc(&sg, sasize);
-
- if ((error = copyout(skp, sup, sasize)) != 0)
- return error;
-
- ba.s = fd;
DPRINTF(("TI_BIND: fileno %d\n", fd));
- ba.name = (void *) sup;
- ba.namelen = sasize;
- if ((error = bind(td, &ba)) != 0) {
+ if ((error = kern_bind(td, fd, skp)) != 0) {
DPRINTF(("TI_BIND: bind failed %d\n", error));
return error;
}
+ goto reply;
-reply:
- if (sup == NULL) {
- memset(&bnd, 0, sizeof(bnd));
- bnd.len = sasize + 4;
- bnd.offs = 0x10; /* XXX */
- }
+error:
+ memset(&bnd, 0, sizeof(bnd));
+ bnd.len = sasize + 4;
+ bnd.offs = 0x10; /* XXX */
+reply:
bnd.cmd = SVR4_TI_BIND_REPLY;
if ((error = copyout(&bnd, ioc->buf, ioc->len)) != 0)
@@ -1119,13 +875,9 @@
struct svr4_strbuf skb, *sub = (struct svr4_strbuf *) dat;
struct svr4_strm *st = svr4_stream_get(fp);
int error;
- void *skp, *sup;
- struct sockaddr_in sain;
- struct sockaddr_un saun;
+ struct sockaddr *sa;
+ socklen_t sasize, oldsasize;
struct svr4_strmcmd sc;
- int sasize, oldsasize;
- caddr_t sg;
- int *lenp;
DPRINTF(("svr4_stream_ti_ioctl\n"));
@@ -1141,13 +893,11 @@
switch (st->s_family) {
case AF_INET:
- skp = &sain;
- sasize = sizeof(sain);
+ sasize = sizeof(struct sockaddr_in);
break;
case AF_LOCAL:
- skp = &saun;
- sasize = sizeof(saun);
+ sasize = sizeof(struct sockaddr_un);
break;
default:
@@ -1155,25 +905,14 @@
st->s_family));
return ENOSYS;
}
-
- sg = stackgap_init();
- sup = stackgap_alloc(&sg, sasize);
- lenp = stackgap_alloc(&sg, sizeof(*lenp));
-
- if ((error = copyout(&sasize, lenp, sizeof(*lenp))) != 0) {
- DPRINTF(("ti_ioctl: error copying out lenp\n"));
- return error;
- }
+ oldsasize = sasize;
switch (cmd) {
case SVR4_TI_GETMYNAME:
DPRINTF(("TI_GETMYNAME\n"));
{
- struct getsockname_args ap;
- ap.fdes = fd;
- ap.asa = sup;
- ap.alen = lenp;
- if ((error = getsockname(td, &ap)) != 0) {
+ error = kern_getsockname(td, fd, &sa, &sasize);
+ if (error) {
DPRINTF(("ti_ioctl: getsockname error\n"));
return error;
}
@@ -1183,11 +922,8 @@
case SVR4_TI_GETPEERNAME:
DPRINTF(("TI_GETPEERNAME\n"));
{
- struct getpeername_args ap;
- ap.fdes = fd;
- ap.asa = sup;
- ap.alen = lenp;
- if ((error = getpeername(td, &ap)) != 0) {
+ error = kern_getpeername(td, fd, &sa, &sasize);
+ if (error) {
DPRINTF(("ti_ioctl: getpeername error\n"));
return error;
}
@@ -1206,36 +942,27 @@
return ENOSYS;
}
- if ((error = copyin(sup, skp, sasize)) != 0) {
- DPRINTF(("ti_ioctl: error copying in socket data\n"));
- return error;
- }
-
- oldsasize = sasize;
-
- if ((error = copyin(lenp, &sasize, sizeof(*lenp))) != 0) {
- DPRINTF(("ti_ioctl: error copying in socket size\n"));
- return error;
- }
-
- if (sasize < 0 || sasize > oldsasize)
+ if (sasize < 0 || sasize > oldsasize) {
+ free(sa, M_SONAME);
return EINVAL;
+ }
switch (st->s_family) {
case AF_INET:
- sockaddr_to_netaddr_in(&sc, &sain);
+ sockaddr_to_netaddr_in(&sc, (struct sockaddr_in *)sa);
skb.len = sasize;
break;
case AF_LOCAL:
- sockaddr_to_netaddr_un(&sc, &saun);
+ sockaddr_to_netaddr_un(&sc, (struct sockaddr_un *)sa);
skb.len = sasize + 4;
break;
default:
+ free(sa, M_SONAME);
return ENOSYS;
}
-
+ free(sa, M_SONAME);
if ((error = copyout(SVR4_ADDROF(&sc), skb.buf, sasize)) != 0) {
DPRINTF(("ti_ioctl: error copying out socket data\n"));
@@ -1306,20 +1033,22 @@
struct svr4_strm *st = svr4_stream_get(fp);
struct svr4_strfdinsert fdi;
struct dup2_args d2p;
- struct close_args clp;
if (st == NULL) {
DPRINTF(("fdinsert: bad file type\n"));
return EINVAL;
}
+ mtx_lock(&Giant);
if (st->s_afd == -1) {
DPRINTF(("fdinsert: accept fd not found\n"));
+ mtx_unlock(&Giant);
return ENOENT;
}
if ((error = copyin(dat, &fdi, sizeof(fdi))) != 0) {
DPRINTF(("fdinsert: copyin failed %d\n", error));
+ mtx_unlock(&Giant);
return error;
}
@@ -1329,18 +1058,19 @@
if ((error = dup2(td, &d2p)) != 0) {
DPRINTF(("fdinsert: dup2(%d, %d) failed %d\n",
st->s_afd, fdi.fd, error));
+ mtx_unlock(&Giant);
return error;
}
- clp.fd = st->s_afd;
-
- if ((error = close(td, &clp)) != 0) {
+ if ((error = kern_close(td, st->s_afd)) != 0) {
DPRINTF(("fdinsert: close(%d) failed %d\n",
st->s_afd, error));
+ mtx_unlock(&Giant);
return error;
}
st->s_afd = -1;
+ mtx_unlock(&Giant);
*retval = 0;
return 0;
@@ -1468,6 +1198,7 @@
oflags = td->td_retval[0];
/* update the flags */
+ mtx_lock(&Giant);
if (dat != NULL) {
int mask;
@@ -1486,6 +1217,7 @@
flags = oflags & ~O_ASYNC;
st->s_eventmask = 0;
}
+ mtx_unlock(&Giant);
/* set the new flags, if changed */
if (flags != oflags) {
@@ -1510,7 +1242,7 @@
u_long cmd;
caddr_t dat;
{
- int error;
+ int error, eventmask;
if (dat != NULL) {
struct svr4_strm *st = svr4_stream_get(fp);
@@ -1519,8 +1251,11 @@
DPRINTF(("i_getsig: bad file descriptor\n"));
return EINVAL;
}
- if ((error = copyout(&st->s_eventmask, dat,
- sizeof(st->s_eventmask))) != 0) {
+ mtx_lock(&Giant);
+ eventmask = st->s_eventmask;
+ mtx_unlock(&Giant);
+ if ((error = copyout(&eventmask, dat,
+ sizeof(eventmask))) != 0) {
DPRINTF(("i_getsig: bad eventmask pointer\n"));
return error;
}
@@ -1734,11 +1469,10 @@
struct svr4_strmcmd sc;
struct sockaddr_in sain;
struct sockaddr_un saun;
- void *skp, *sup;
+ struct sockaddr *sa;
int sasize, *retval;
struct svr4_strm *st;
int error;
- caddr_t sg;
retval = td->td_retval;
@@ -1812,9 +1546,10 @@
return EINVAL;
}
netaddr_to_sockaddr_in(&sain, &sc);
- skp = &sain;
+ sa = (struct sockaddr *)&sain;
sasize = sizeof(sain);
- error = sain.sin_family != st->s_family;
+ if (sain.sin_family != st->s_family)
+ error = EINVAL;
break;
case AF_LOCAL:
@@ -1828,12 +1563,11 @@
/* Maybe we've been given a device/inode pair */
dev_t *dev = SVR4_ADDROF(&sc);
ino_t *ino = (ino_t *) &dev[1];
- skp = svr4_find_socket(td, fp, *dev, *ino);
- if (skp == NULL) {
- skp = &saun;
+ if (svr4_find_socket(td, fp, *dev, *ino, &saun) != 0) {
/* I guess we have it by name */
- netaddr_to_sockaddr_un(skp, &sc);
+ netaddr_to_sockaddr_un(&saun, &sc);
}
+ sa = (struct sockaddr *)&saun;
sasize = sizeof(saun);
}
break;
@@ -1844,22 +1578,14 @@
return ENOSYS;
}
- sg = stackgap_init();
- sup = stackgap_alloc(&sg, sasize);
-
- if ((error = copyout(skp, sup, sasize)) != 0)
- return error;
-
- switch (st->s_cmd = sc.cmd) {
+ mtx_lock(&Giant);
+ st->s_cmd = sc.cmd;
+ mtx_unlock(&Giant);
+ switch (sc.cmd) {
case SVR4_TI_CONNECT_REQUEST: /* connect */
{
- struct connect_args co;
- co.s = uap->fd;
- co.name = (void *) sup;
- co.namelen = (int) sasize;
-
- return connect(td, &co);
+ return (kern_connect(td, uap->fd, sa));
}
case SVR4_TI_SENDTO_REQUEST: /* sendto */
@@ -1867,7 +1593,7 @@
struct msghdr msg;
struct iovec aiov;
- msg.msg_name = (caddr_t) sup;
+ msg.msg_name = sa;
msg.msg_namelen = sasize;
msg.msg_iov = &aiov;
msg.msg_iovlen = 1;
@@ -1875,12 +1601,8 @@
msg.msg_flags = 0;
aiov.iov_base = dat.buf;
aiov.iov_len = dat.len;
-#if 0
- error = so->so_proto->pr_usrreqs->pru_sosend(so, 0,
- uio, 0, 0, 0, uio->uio_td);
-#endif
- error = svr4_sendit(td, uap->fd, &msg,
- uap->flags);
+ error = kern_sendit(td, uap->fd, &msg, uap->flags,
+ NULL, UIO_USERSPACE);
DPRINTF(("sendto_request error: %d\n", error));
*retval = 0;
return error;
@@ -1917,8 +1639,6 @@
struct svr4_sys_getmsg_args *uap;
struct file *fp;
{
- struct getpeername_args ga;
- struct accept_args aa;
struct svr4_strbuf dat, ctl;
struct svr4_strmcmd sc;
int error, *retval;
@@ -1926,14 +1646,15 @@
struct iovec aiov;
struct sockaddr_in sain;
struct sockaddr_un saun;
- void *skp, *sup;
- int sasize;
+ struct sockaddr *sa;
+ socklen_t sasize;
struct svr4_strm *st;
- int *flen;
+ struct file *afp;
int fl;
- caddr_t sg;
retval = td->td_retval;
+ error = 0;
+ afp = NULL;
FILE_LOCK_ASSERT(fp, MA_NOTOWNED);
@@ -1979,12 +1700,10 @@
switch (st->s_family) {
case AF_INET:
- skp = &sain;
sasize = sizeof(sain);
break;
case AF_LOCAL:
- skp = &saun;
sasize = sizeof(saun);
break;
@@ -1994,14 +1713,7 @@
return ENOSYS;
}
- sg = stackgap_init();
- sup = stackgap_alloc(&sg, sasize);
- flen = (int *) stackgap_alloc(&sg, sizeof(*flen));
-
- fl = sasize;
- if ((error = copyout(&fl, flen, sizeof(fl))) != 0)
- return error;
-
+ mtx_lock(&Giant);
switch (st->s_cmd) {
case SVR4_TI_CONNECT_REQUEST:
DPRINTF(("getmsg: TI_CONNECT_REQUEST\n"));
@@ -2025,18 +1737,13 @@
* a connect verification.
*/
- ga.fdes = uap->fd;
- ga.asa = (void *) sup;
- ga.alen = flen;
-
- if ((error = getpeername(td, &ga)) != 0) {
+ error = kern_getpeername(td, uap->fd, &sa, &sasize);
+ if (error) {
+ mtx_unlock(&Giant);
DPRINTF(("getmsg: getpeername failed %d\n", error));
return error;
}
- if ((error = copyin(sup, skp, sasize)) != 0)
- return error;
-
sc.cmd = SVR4_TI_CONNECT_REPLY;
sc.pad[0] = 0x4;
sc.offs = 0x18;
@@ -2046,17 +1753,20 @@
switch (st->s_family) {
case AF_INET:
sc.len = sasize;
- sockaddr_to_netaddr_in(&sc, &sain);
+ sockaddr_to_netaddr_in(&sc, (struct sockaddr_in *)sa);
break;
case AF_LOCAL:
sc.len = sasize + 4;
- sockaddr_to_netaddr_un(&sc, &saun);
+ sockaddr_to_netaddr_un(&sc, (struct sockaddr_un *)sa);
break;
default:
+ mtx_unlock(&Giant);
+ free(sa, M_SONAME);
return ENOSYS;
}
+ free(sa, M_SONAME);
ctl.len = 40;
dat.len = -1;
@@ -2084,11 +1794,10 @@
/*
* We are after a listen, so we try to accept...
*/
- aa.s = uap->fd;
- aa.name = (void *) sup;
- aa.anamelen = flen;
-
- if ((error = accept(td, &aa)) != 0) {
+
+ error = kern_accept(td, uap->fd, &sa, &sasize, &afp);
+ if (error) {
+ mtx_unlock(&Giant);
DPRINTF(("getmsg: accept failed %d\n", error));
return error;
}
@@ -2097,9 +1806,6 @@
DPRINTF(("getmsg: Accept fd = %d\n", st->s_afd));
- if ((error = copyin(sup, skp, sasize)) != 0)
- return error;
-
sc.cmd = SVR4_TI_ACCEPT_REPLY;
sc.offs = 0x18;
sc.pad[0] = 0x0;
@@ -2107,7 +1813,7 @@
switch (st->s_family) {
case AF_INET:
sc.pad[1] = 0x28;
- sockaddr_to_netaddr_in(&sc, &sain);
+ sockaddr_to_netaddr_in(&sc, (struct sockaddr_in *)&sa);
ctl.len = 40;
sc.len = sasize;
break;
@@ -2121,8 +1827,14 @@
break;
default:
+ fdclose(td->td_proc->p_fd, afp, st->s_afd, td);
+ fdrop(afp, td);
+ st->s_afd = -1;
+ mtx_unlock(&Giant);
+ free(sa, M_SONAME);
return ENOSYS;
}
+ free(sa, M_SONAME);
dat.len = -1;
fl = 0;
@@ -2137,23 +1849,28 @@
if (ctl.len > sizeof(sc))
ctl.len = sizeof(sc);
- if ((error = copyin(ctl.buf, &sc, ctl.len)) != 0)
+ if ((error = copyin(ctl.buf, &sc, ctl.len)) != 0) {
+ mtx_unlock(&Giant);
return error;
+ }
switch (st->s_family) {
case AF_INET:
+ sa = (struct sockaddr *)&sain;
sockaddr_to_netaddr_in(&sc, &sain);
break;
case AF_LOCAL:
+ sa = (struct sockaddr *)&saun;
sockaddr_to_netaddr_un(&sc, &saun);
break;
default:
+ mtx_unlock(&Giant);
return ENOSYS;
}
- msg.msg_name = (caddr_t) sup;
+ msg.msg_name = sa;
msg.msg_namelen = sasize;
msg.msg_iov = &aiov;
msg.msg_iovlen = 1;
@@ -2162,16 +1879,14 @@
aiov.iov_len = dat.maxlen;
msg.msg_flags = 0;
- error = svr4_recvit(td, uap->fd, &msg, (caddr_t) flen);
+ error = kern_recvit(td, uap->fd, &msg, UIO_SYSSPACE, NULL);
if (error) {
+ mtx_unlock(&Giant);
DPRINTF(("getmsg: recvit failed %d\n", error));
return error;
}
- if ((error = copyin(msg.msg_name, skp, sasize)) != 0)
- return error;
-
sc.cmd = SVR4_TI_RECVFROM_IND;
switch (st->s_family) {
@@ -2186,6 +1901,7 @@
break;
default:
+ mtx_unlock(&Giant);
return ENOSYS;
}
@@ -2214,6 +1930,7 @@
ra.buf = dat.buf;
ra.nbyte = dat.maxlen;
if ((error = read(td, &ra)) != 0) {
+ mtx_unlock(&Giant);
return error;
}
dat.len = *retval;
@@ -2221,6 +1938,7 @@
st->s_cmd = SVR4_TI_SENDTO_REQUEST;
break;
}
+ mtx_unlock(&Giant);
DPRINTF(("getmsg: Unknown state %x\n", st->s_cmd));
return EINVAL;
}
@@ -2229,22 +1947,34 @@
if (ctl.len > sizeof(sc))
ctl.len = sizeof(sc);
if (ctl.len != -1)
- if ((error = copyout(&sc, ctl.buf, ctl.len)) != 0)
- return error;
+ error = copyout(&sc, ctl.buf, ctl.len);
- if ((error = copyout(&ctl, uap->ctl, sizeof(ctl))) != 0)
- return error;
+ if (error == 0)
+ error = copyout(&ctl, uap->ctl, sizeof(ctl));
}
if (uap->dat) {
- if ((error = copyout(&dat, uap->dat, sizeof(dat))) != 0)
- return error;
+ if (error == 0)
+ error = copyout(&dat, uap->dat, sizeof(dat));
}
if (uap->flags) { /* XXX: Need translation */
- if ((error = copyout(&fl, uap->flags, sizeof(fl))) != 0)
- return error;
+ if (error == 0)
+ error = copyout(&fl, uap->flags, sizeof(fl));
+ }
+
+ if (error) {
+ if (afp) {
+ fdclose(td->td_proc->p_fd, afp, st->s_afd, td);
+ fdrop(afp, td);
+ st->s_afd = -1;
+ }
+ mtx_unlock(&Giant);
+ return (error);
}
+ mtx_unlock(&Giant);
+ if (afp)
+ fdrop(afp, td);
*retval = 0;
Index: svr4.h
===================================================================
RCS file: /home/cvs/src/sys/compat/svr4/svr4.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/compat/svr4/svr4.h -L sys/compat/svr4/svr4.h -u -r1.1.1.1 -r1.2
--- sys/compat/svr4/svr4.h
+++ sys/compat/svr4/svr4.h
@@ -24,7 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/svr4/svr4.h,v 1.8.2.1 2005/07/18 19:48:13 jhb Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4.h,v 1.9 2005/07/13 15:14:33 jhb Exp $
*/
#include "opt_svr4.h"
More information about the Midnightbsd-cvs
mailing list