---  amd64/linux32/linux.h.orig
+++  amd64/linux32/linux.h
@@ -34,6 +34,10 @@
 #define	_AMD64_LINUX_LINUX_H_
 
 #include <sys/signal.h> /* for sigval union */
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
 
 #include <amd64/linux32/linux32_syscall.h>
 
@@ -495,6 +499,7 @@
 
 extern int bsd_to_linux_signal[];
 extern int linux_to_bsd_signal[];
+extern struct sysentvec elf_linux_sysvec;
 
 /*
  * Pluggable ioctl handlers
@@ -527,6 +532,11 @@
 #define	LINUX_O_NDELAY		LINUX_O_NONBLOCK
 #define	LINUX_O_SYNC		010000
 #define	LINUX_FASYNC		020000
+#define	LINUX_O_DIRECT		040000	/* direct disk access hint */
+#define	LINUX_O_LARGEFILE	0100000
+#define	LINUX_O_DIRECTORY	0200000	/* must be a directory */
+#define	LINUX_O_NOFOLLOW	0400000	/* don't follow links */
+#define	LINUX_O_NOATIME		01000000
 
 #define	LINUX_F_DUPFD		0
 #define	LINUX_F_GETFD		1
@@ -737,4 +747,99 @@
 	l_short		revents;
 } __packed;
 
+struct l_user_desc {
+	l_uint		entry_number;
+	l_uint		base_addr;
+	l_uint		limit;
+	l_uint		seg_32bit:1;
+	l_uint		contents:2;
+	l_uint		read_exec_only:1;
+	l_uint		limit_in_pages:1;
+	l_uint		seg_not_present:1;
+	l_uint		useable:1;
+};
+
+struct l_desc_struct {
+           unsigned long a,b;
+};
+
+
+#define LINUX_LOWERWORD	0x0000ffff
+
+/* macros which does the same thing as those in linux include/asm-um/ldt-i386.h 
+ * these convert linux user-space descriptor to machine one
+ */
+#define LDT_entry_a(info) \
+        ((((info)->base_addr & LINUX_LOWERWORD) << 16) | ((info)->limit & LINUX_LOWERWORD))
+
+#define ENTRY_B_READ_EXEC_ONLY	9
+#define ENTRY_B_CONTENTS	10
+#define ENTRY_B_SEG_NOT_PRESENT	15
+#define ENTRY_B_BASE_ADDR	16
+#define ENTRY_B_USEABLE		20
+#define ENTRY_B_SEG32BIT	22
+#define ENTRY_B_LIMIT		23
+
+#define LDT_entry_b(info) \
+        (((info)->base_addr & 0xff000000) | \
+        ((info)->limit & 0xf0000) | \
+        ((info)->contents << ENTRY_B_CONTENTS) | \
+        (((info)->seg_not_present == 0) << ENTRY_B_SEG_NOT_PRESENT) | \
+        (((info)->base_addr & 0x00ff0000) >> ENTRY_B_BASE_ADDR) | \
+        (((info)->read_exec_only == 0) << ENTRY_B_READ_EXEC_ONLY) | \
+        ((info)->seg_32bit << ENTRY_B_SEG32BIT) | \
+        ((info)->useable << ENTRY_B_USEABLE) | \
+        ((info)->limit_in_pages << ENTRY_B_LIMIT) | 0x7000)
+
+#define LDT_empty(info) (\
+        (info)->base_addr       == 0    && \
+        (info)->limit           == 0    && \
+        (info)->contents        == 0    && \
+        (info)->seg_not_present == 1    && \
+        (info)->read_exec_only  == 1    && \
+        (info)->seg_32bit       == 0    && \
+        (info)->limit_in_pages  == 0    && \
+        (info)->useable         == 0    )
+
+/* macros for converting segments, they do the same as those in arch/i386/kernel/process.c */
+#define GET_BASE(desc) ( \
+        (((desc)->a >> 16) & LINUX_LOWERWORD) | \
+        (((desc)->b << 16) & 0x00ff0000) | \
+        ( (desc)->b        & 0xff000000)   )
+
+#define GET_LIMIT(desc) ( \
+        ((desc)->a & LINUX_LOWERWORD) | \
+         ((desc)->b & 0xf0000) )
+
+#define GET_32BIT(desc)         (((desc)->b >> ENTRY_B_SEG32BIT) & 1)
+#define GET_CONTENTS(desc)      (((desc)->b >> ENTRY_B_CONTENTS) & 3)
+#define GET_WRITABLE(desc)      (((desc)->b >> ENTRY_B_READ_EXEC_ONLY) & 1)
+#define GET_LIMIT_PAGES(desc)   (((desc)->b >> ENTRY_B_LIMIT) & 1)
+#define GET_PRESENT(desc)       (((desc)->b >> ENTRY_B_SEG_NOT_PRESENT) & 1)
+#define GET_USEABLE(desc)       (((desc)->b >> ENTRY_B_USEABLE) & 1)
+
+#define LINUX_CLOCK_REALTIME            0
+#define LINUX_CLOCK_MONOTONIC           1
+#define LINUX_CLOCK_PROCESS_CPUTIME_ID  2
+#define LINUX_CLOCK_THREAD_CPUTIME_ID   3
+#define LINUX_CLOCK_REALTIME_HR         4
+#define LINUX_CLOCK_MONOTONIC_HR        5
+
+typedef int l_timer_t;
+typedef int l_mqd_t;
+
+#define CLONE_VM        0x100
+#define CLONE_FS        0x200
+#define CLONE_FILES     0x400
+#define CLONE_SIGHAND   0x800
+#define CLONE_PID       0x1000          /* this flag does not exist in linux anymore */
+#define CLONE_PARENT    0x00008000
+#define CLONE_THREAD    0x10000
+#define CLONE_SETTLS    0x80000
+#define CLONE_CHILD_CLEARTID    0x00200000
+#define CLONE_CHILD_SETTID      0x01000000
+#define CLONE_PARENT_SETTID     0x00100000
+
+#define THREADING_FLAGS (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
+
 #endif /* !_AMD64_LINUX_LINUX_H_ */
---  amd64/linux32/linux32_dummy.c.orig
+++  amd64/linux32/linux32_dummy.c
@@ -72,19 +72,13 @@
 DUMMY(epoll_ctl);
 DUMMY(epoll_wait);
 DUMMY(remap_file_pages);
-DUMMY(set_tid_address);
 DUMMY(timer_create);
 DUMMY(timer_settime);
 DUMMY(timer_gettime);
 DUMMY(timer_getoverrun);
 DUMMY(timer_delete);
-DUMMY(clock_settime);
-DUMMY(clock_gettime);
-DUMMY(clock_getres);
-DUMMY(clock_nanosleep);
 DUMMY(statfs64);
 DUMMY(fstatfs64);
-DUMMY(tgkill);
 DUMMY(utimes);
 DUMMY(fadvise64_64);
 DUMMY(mbind);
---  amd64/linux32/linux32_machdep.c.orig
+++  amd64/linux32/linux32_machdep.c
@@ -35,6 +35,7 @@
 #include <sys/kernel.h>
 #include <sys/systm.h>
 #include <sys/imgact.h>
+#include <sys/limits.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mman.h>
@@ -472,12 +473,6 @@
 	return (0);
 }
 
-#define CLONE_VM	0x100
-#define CLONE_FS	0x200
-#define CLONE_FILES	0x400
-#define CLONE_SIGHAND	0x800
-#define CLONE_PID	0x1000
-
 int
 linux_clone(struct thread *td, struct linux_clone_args *args)
 {
@@ -491,14 +486,9 @@
 		printf(ARGS(clone, "flags %x, stack %x"),
 		    (unsigned int)(uintptr_t)args->flags,
 		    (unsigned int)(uintptr_t)args->stack);
-		if (args->flags & CLONE_PID)
-			printf(LMSG("CLONE_PID not yet supported"));
 	}
 #endif
 
-	if (!args->stack)
-		return (EINVAL);
-
 	exit_signal = args->flags & 0x000000ff;
 	if (exit_signal >= LINUX_NSIG)
 		return (EINVAL);
@@ -522,7 +512,11 @@
 	p2->p_sigparent = exit_signal;
 	PROC_UNLOCK(p2);
 	td2 = FIRST_THREAD_IN_PROC(p2);
-	td2->td_frame->tf_rsp = PTROUT(args->stack);
+	/* in a case of stack = NULL we are supposed to COW calling process stack
+	 * this is what normal fork() does so we just keep the tf_rsp arg intact
+	 */
+	if (args->stack)
+   	   	td2->td_frame->tf_rsp = PTROUT(args->stack);
 
 #ifdef DEBUG
 	if (ldebug(clone))
---  amd64/linux32/linux32_proto.h.orig
+++  amd64/linux32/linux32_proto.h
@@ -2,7 +2,7 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.19 2006/07/28 19:08:35 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.18 2006/07/28 19:05:26 jhb Exp 
  */
 
@@ -11,10 +11,7 @@
 
 #include <sys/signal.h>
 #include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
 #include <posix4/_semaphore.h>
-
 #include <sys/ucontext.h>
 
 struct proc;
@@ -197,6 +194,9 @@
 	char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
 	char ubuf_l_[PADL_(struct l_ustat *)]; struct l_ustat * ubuf; char ubuf_r_[PADR_(struct l_ustat *)];
 };
+struct linux_getppid_args {
+	register_t dummy;
+};
 struct linux_sigaction_args {
 	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
 	char nsa_l_[PADL_(l_osigaction_t *)]; l_osigaction_t * nsa; char nsa_r_[PADR_(l_osigaction_t *)];
@@ -367,7 +367,9 @@
 };
 struct linux_clone_args {
 	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
-	char stack_l_[PADL_(void *)]; void * stack; char stack_r_[PADR_(void *)];
+	char parent_tidptr_l_[PADL_(void *stack void *)]; void *stack void * parent_tidptr; char parent_tidptr_r_[PADR_(void *stack void *)];
+	char dummy_l_[PADL_(int)]; int dummy; char dummy_r_[PADR_(int)];
+	char child_tidptr_l_[PADL_(void *)]; void * child_tidptr; char child_tidptr_r_[PADR_(void *)];
 };
 struct linux_newuname_args {
 	char buf_l_[PADL_(struct l_new_utsname *)]; struct l_new_utsname * buf; char buf_r_[PADR_(struct l_new_utsname *)];
@@ -668,6 +670,9 @@
 	char cmd_l_[PADL_(l_uint)]; l_uint cmd; char cmd_r_[PADR_(l_uint)];
 	char arg_l_[PADL_(uintptr_t)]; uintptr_t arg; char arg_r_[PADR_(uintptr_t)];
 };
+struct linux_gettid_args {
+	register_t dummy;
+};
 struct linux_setxattr_args {
 	register_t dummy;
 };
@@ -704,9 +709,24 @@
 struct linux_fremovexattr_args {
 	register_t dummy;
 };
+struct linux_tkill_args {
+	char tid_l_[PADL_(int)]; int tid; char tid_r_[PADR_(int)];
+	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
+};
+struct linux_sys_futex_args {
+	char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)];
+	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
+	char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)];
+	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
+	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
+	char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)];
+};
 struct linux_fadvise64_args {
 	register_t dummy;
 };
+struct linux_exit_group_args {
+	char error_code_l_[PADL_(int)]; int error_code; char error_code_r_[PADR_(int)];
+};
 struct linux_lookup_dcookie_args {
 	register_t dummy;
 };
@@ -723,7 +743,7 @@
 	register_t dummy;
 };
 struct linux_set_tid_address_args {
-	register_t dummy;
+	char tidptr_l_[PADL_(int *)]; int * tidptr; char tidptr_r_[PADR_(int *)];
 };
 struct linux_timer_create_args {
 	register_t dummy;
@@ -741,16 +761,22 @@
 	register_t dummy;
 };
 struct linux_clock_settime_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_gettime_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_getres_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_nanosleep_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+	char rqtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rqtp; char rqtp_r_[PADR_(struct l_timespec *)];
+	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_statfs64_args {
 	register_t dummy;
@@ -759,7 +785,9 @@
 	register_t dummy;
 };
 struct linux_tgkill_args {
-	register_t dummy;
+	char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)];
+	char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
+	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
 };
 struct linux_utimes_args {
 	register_t dummy;
@@ -919,6 +947,7 @@
 int	linux_fcntl(struct thread *, struct linux_fcntl_args *);
 int	linux_olduname(struct thread *, struct linux_olduname_args *);
 int	linux_ustat(struct thread *, struct linux_ustat_args *);
+int	linux_getppid(struct thread *, struct linux_getppid_args *);
 int	linux_sigaction(struct thread *, struct linux_sigaction_args *);
 int	linux_sgetmask(struct thread *, struct linux_sgetmask_args *);
 int	linux_ssetmask(struct thread *, struct linux_ssetmask_args *);
@@ -1033,6 +1062,7 @@
 int	linux_mincore(struct thread *, struct linux_mincore_args *);
 int	linux_getdents64(struct thread *, struct linux_getdents64_args *);
 int	linux_fcntl64(struct thread *, struct linux_fcntl64_args *);
+int	linux_gettid(struct thread *, struct linux_gettid_args *);
 int	linux_setxattr(struct thread *, struct linux_setxattr_args *);
 int	linux_lsetxattr(struct thread *, struct linux_lsetxattr_args *);
 int	linux_fsetxattr(struct thread *, struct linux_fsetxattr_args *);
@@ -1045,7 +1075,10 @@
 int	linux_removexattr(struct thread *, struct linux_removexattr_args *);
 int	linux_lremovexattr(struct thread *, struct linux_lremovexattr_args *);
 int	linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
+int	linux_tkill(struct thread *, struct linux_tkill_args *);
+int	linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
 int	linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
+int	linux_exit_group(struct thread *, struct linux_exit_group_args *);
 int	linux_lookup_dcookie(struct thread *, struct linux_lookup_dcookie_args *);
 int	linux_epoll_create(struct thread *, struct linux_epoll_create_args *);
 int	linux_epoll_ctl(struct thread *, struct linux_epoll_ctl_args *);
---  amd64/linux32/linux32_syscall.h.orig
+++  amd64/linux32/linux32_syscall.h
@@ -2,7 +2,7 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.19 2006/07/28 19:08:35 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.18 2006/07/28 19:05:26 jhb Exp 
  */
 
@@ -60,7 +60,7 @@
 #define	LINUX_SYS_chroot	61
 #define	LINUX_SYS_linux_ustat	62
 #define	LINUX_SYS_dup2	63
-#define	LINUX_SYS_getppid	64
+#define	LINUX_SYS_linux_getppid	64
 #define	LINUX_SYS_getpgrp	65
 #define	LINUX_SYS_setsid	66
 #define	LINUX_SYS_linux_sigaction	67
@@ -206,7 +206,7 @@
 #define	LINUX_SYS_madvise	219
 #define	LINUX_SYS_linux_getdents64	220
 #define	LINUX_SYS_linux_fcntl64	221
-#define	LINUX_SYS_gettid	224
+#define	LINUX_SYS_linux_gettid	224
 #define	LINUX_SYS_linux_setxattr	226
 #define	LINUX_SYS_linux_lsetxattr	227
 #define	LINUX_SYS_linux_fsetxattr	228
@@ -219,8 +219,10 @@
 #define	LINUX_SYS_linux_removexattr	235
 #define	LINUX_SYS_linux_lremovexattr	236
 #define	LINUX_SYS_linux_fremovexattr	237
+#define	LINUX_SYS_linux_tkill	238
+#define	LINUX_SYS_linux_sys_futex	240
 #define	LINUX_SYS_linux_fadvise64	250
-#define	LINUX_SYS_exit_group	252
+#define	LINUX_SYS_linux_exit_group	252
 #define	LINUX_SYS_linux_lookup_dcookie	253
 #define	LINUX_SYS_linux_epoll_create	254
 #define	LINUX_SYS_linux_epoll_ctl	255
---  amd64/linux32/linux32_sysent.c.orig
+++  amd64/linux32/linux32_sysent.c
@@ -2,7 +2,7 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.19 2006/07/28 19:08:35 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.18 2006/07/28 19:05:26 jhb Exp 
  */
 
@@ -20,315 +20,315 @@
 /* The casts are bogus but will do for now. */
 struct sysent linux_sysent[] = {
 #define	nosys	linux_nosys
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 0 = setup */
-	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT },	/* 1 = exit */
-	{ 0, (sy_call_t *)linux_fork, AUE_FORK },		/* 2 = linux_fork */
-	{ AS(read_args), (sy_call_t *)read, AUE_NULL },	/* 3 = read */
-	{ AS(write_args), (sy_call_t *)write, AUE_NULL },	/* 4 = write */
-	{ AS(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC },	/* 5 = linux_open */
-	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE },	/* 6 = close */
-	{ AS(linux_waitpid_args), (sy_call_t *)linux_waitpid, AUE_WAIT4 },	/* 7 = linux_waitpid */
-	{ AS(linux_creat_args), (sy_call_t *)linux_creat, AUE_O_CREAT },	/* 8 = linux_creat */
-	{ AS(linux_link_args), (sy_call_t *)linux_link, AUE_LINK },	/* 9 = linux_link */
-	{ AS(linux_unlink_args), (sy_call_t *)linux_unlink, AUE_UNLINK },	/* 10 = linux_unlink */
-	{ AS(linux_execve_args), (sy_call_t *)linux_execve, AUE_EXECVE },	/* 11 = linux_execve */
-	{ AS(linux_chdir_args), (sy_call_t *)linux_chdir, AUE_CHDIR },	/* 12 = linux_chdir */
-	{ AS(linux_time_args), (sy_call_t *)linux_time, AUE_NULL },	/* 13 = linux_time */
-	{ AS(linux_mknod_args), (sy_call_t *)linux_mknod, AUE_MKNOD },	/* 14 = linux_mknod */
-	{ AS(linux_chmod_args), (sy_call_t *)linux_chmod, AUE_CHMOD },	/* 15 = linux_chmod */
-	{ AS(linux_lchown16_args), (sy_call_t *)linux_lchown16, AUE_LCHOWN },	/* 16 = linux_lchown16 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 17 = break */
-	{ AS(linux_stat_args), (sy_call_t *)linux_stat, AUE_STAT },	/* 18 = linux_stat */
-	{ AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK },	/* 19 = linux_lseek */
-	{ 0, (sy_call_t *)linux_getpid, AUE_GETPID },	/* 20 = linux_getpid */
-	{ AS(linux_mount_args), (sy_call_t *)linux_mount, AUE_MOUNT },	/* 21 = linux_mount */
-	{ AS(linux_oldumount_args), (sy_call_t *)linux_oldumount, AUE_UMOUNT },	/* 22 = linux_oldumount */
-	{ AS(linux_setuid16_args), (sy_call_t *)linux_setuid16, AUE_SETUID },	/* 23 = linux_setuid16 */
-	{ 0, (sy_call_t *)linux_getuid16, AUE_GETUID },	/* 24 = linux_getuid16 */
-	{ 0, (sy_call_t *)linux_stime, AUE_SETTIMEOFDAY },	/* 25 = linux_stime */
-	{ AS(linux_ptrace_args), (sy_call_t *)linux_ptrace, AUE_PTRACE },	/* 26 = linux_ptrace */
-	{ AS(linux_alarm_args), (sy_call_t *)linux_alarm, AUE_NULL },	/* 27 = linux_alarm */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 28 = fstat */
-	{ 0, (sy_call_t *)linux_pause, AUE_NULL },	/* 29 = linux_pause */
-	{ AS(linux_utime_args), (sy_call_t *)linux_utime, AUE_UTIME },	/* 30 = linux_utime */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 31 = stty */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 32 = gtty */
-	{ AS(linux_access_args), (sy_call_t *)linux_access, AUE_ACCESS },	/* 33 = linux_access */
-	{ AS(linux_nice_args), (sy_call_t *)linux_nice, AUE_NICE },	/* 34 = linux_nice */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 35 = ftime */
-	{ 0, (sy_call_t *)sync, AUE_SYNC },		/* 36 = sync */
-	{ AS(linux_kill_args), (sy_call_t *)linux_kill, AUE_KILL },	/* 37 = linux_kill */
-	{ AS(linux_rename_args), (sy_call_t *)linux_rename, AUE_RENAME },	/* 38 = linux_rename */
-	{ AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR },	/* 39 = linux_mkdir */
-	{ AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR },	/* 40 = linux_rmdir */
-	{ AS(dup_args), (sy_call_t *)dup, AUE_DUP },	/* 41 = dup */
-	{ AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE },	/* 42 = linux_pipe */
-	{ AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL },	/* 43 = linux_times */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 44 = prof */
-	{ AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL },	/* 45 = linux_brk */
-	{ AS(linux_setgid16_args), (sy_call_t *)linux_setgid16, AUE_SETGID },	/* 46 = linux_setgid16 */
-	{ 0, (sy_call_t *)linux_getgid16, AUE_GETGID },	/* 47 = linux_getgid16 */
-	{ AS(linux_signal_args), (sy_call_t *)linux_signal, AUE_NULL },	/* 48 = linux_signal */
-	{ 0, (sy_call_t *)linux_geteuid16, AUE_GETEUID },	/* 49 = linux_geteuid16 */
-	{ 0, (sy_call_t *)linux_getegid16, AUE_GETEGID },	/* 50 = linux_getegid16 */
-	{ AS(acct_args), (sy_call_t *)acct, AUE_ACCT },	/* 51 = acct */
-	{ AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT },	/* 52 = linux_umount */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 53 = lock */
-	{ AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL },	/* 54 = linux_ioctl */
-	{ AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL },	/* 55 = linux_fcntl */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 56 = mpx */
-	{ AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP },	/* 57 = setpgid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 58 = ulimit */
-	{ 0, (sy_call_t *)linux_olduname, AUE_NULL },	/* 59 = linux_olduname */
-	{ AS(umask_args), (sy_call_t *)umask, AUE_UMASK },	/* 60 = umask */
-	{ AS(chroot_args), (sy_call_t *)chroot, AUE_CHROOT },	/* 61 = chroot */
-	{ AS(linux_ustat_args), (sy_call_t *)linux_ustat, AUE_NULL },	/* 62 = linux_ustat */
-	{ AS(dup2_args), (sy_call_t *)dup2, AUE_DUP2 },	/* 63 = dup2 */
-	{ 0, (sy_call_t *)getppid, AUE_GETPPID },		/* 64 = getppid */
-	{ 0, (sy_call_t *)getpgrp, AUE_GETPGRP },		/* 65 = getpgrp */
-	{ 0, (sy_call_t *)setsid, AUE_SETSID },		/* 66 = setsid */
-	{ AS(linux_sigaction_args), (sy_call_t *)linux_sigaction, AUE_NULL },	/* 67 = linux_sigaction */
-	{ 0, (sy_call_t *)linux_sgetmask, AUE_NULL },	/* 68 = linux_sgetmask */
-	{ AS(linux_ssetmask_args), (sy_call_t *)linux_ssetmask, AUE_NULL },	/* 69 = linux_ssetmask */
-	{ AS(linux_setreuid16_args), (sy_call_t *)linux_setreuid16, AUE_SETREUID },	/* 70 = linux_setreuid16 */
-	{ AS(linux_setregid16_args), (sy_call_t *)linux_setregid16, AUE_SETREGID },	/* 71 = linux_setregid16 */
-	{ AS(linux_sigsuspend_args), (sy_call_t *)linux_sigsuspend, AUE_NULL },	/* 72 = linux_sigsuspend */
-	{ AS(linux_sigpending_args), (sy_call_t *)linux_sigpending, AUE_NULL },	/* 73 = linux_sigpending */
-	{ AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL },	/* 74 = linux_sethostname */
-	{ AS(linux_setrlimit_args), (sy_call_t *)linux_setrlimit, AUE_SETRLIMIT },	/* 75 = linux_setrlimit */
-	{ AS(linux_old_getrlimit_args), (sy_call_t *)linux_old_getrlimit, AUE_GETRLIMIT },	/* 76 = linux_old_getrlimit */
-	{ AS(linux_getrusage_args), (sy_call_t *)linux_getrusage, AUE_GETRUSAGE },	/* 77 = linux_getrusage */
-	{ AS(linux_gettimeofday_args), (sy_call_t *)linux_gettimeofday, AUE_NULL },	/* 78 = linux_gettimeofday */
-	{ AS(linux_settimeofday_args), (sy_call_t *)linux_settimeofday, AUE_SETTIMEOFDAY },	/* 79 = linux_settimeofday */
-	{ AS(linux_getgroups16_args), (sy_call_t *)linux_getgroups16, AUE_GETGROUPS },	/* 80 = linux_getgroups16 */
-	{ AS(linux_setgroups16_args), (sy_call_t *)linux_setgroups16, AUE_SETGROUPS },	/* 81 = linux_setgroups16 */
-	{ AS(linux_old_select_args), (sy_call_t *)linux_old_select, AUE_SELECT },	/* 82 = linux_old_select */
-	{ AS(linux_symlink_args), (sy_call_t *)linux_symlink, AUE_SYMLINK },	/* 83 = linux_symlink */
-	{ AS(linux_lstat_args), (sy_call_t *)linux_lstat, AUE_LSTAT },	/* 84 = linux_lstat */
-	{ AS(linux_readlink_args), (sy_call_t *)linux_readlink, AUE_READLINK },	/* 85 = linux_readlink */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 86 = linux_uselib */
-	{ AS(swapon_args), (sy_call_t *)swapon, AUE_SWAPON },	/* 87 = swapon */
-	{ AS(linux_reboot_args), (sy_call_t *)linux_reboot, AUE_REBOOT },	/* 88 = linux_reboot */
-	{ AS(linux_readdir_args), (sy_call_t *)linux_readdir, AUE_O_GETDENTS },	/* 89 = linux_readdir */
-	{ AS(linux_mmap_args), (sy_call_t *)linux_mmap, AUE_MMAP },	/* 90 = linux_mmap */
-	{ AS(munmap_args), (sy_call_t *)munmap, AUE_MUNMAP },	/* 91 = munmap */
-	{ AS(linux_truncate_args), (sy_call_t *)linux_truncate, AUE_TRUNCATE },	/* 92 = linux_truncate */
-	{ AS(linux_ftruncate_args), (sy_call_t *)linux_ftruncate, AUE_FTRUNCATE },	/* 93 = linux_ftruncate */
-	{ AS(fchmod_args), (sy_call_t *)fchmod, AUE_FCHMOD },	/* 94 = fchmod */
-	{ AS(fchown_args), (sy_call_t *)fchown, AUE_FCHOWN },	/* 95 = fchown */
-	{ AS(linux_getpriority_args), (sy_call_t *)linux_getpriority, AUE_GETPRIORITY },	/* 96 = linux_getpriority */
-	{ AS(setpriority_args), (sy_call_t *)setpriority, AUE_SETPRIORITY },	/* 97 = setpriority */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 98 = profil */
-	{ AS(linux_statfs_args), (sy_call_t *)linux_statfs, AUE_STATFS },	/* 99 = linux_statfs */
-	{ AS(linux_fstatfs_args), (sy_call_t *)linux_fstatfs, AUE_FSTATFS },	/* 100 = linux_fstatfs */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 101 = ioperm */
-	{ AS(linux_socketcall_args), (sy_call_t *)linux_socketcall, AUE_NULL },	/* 102 = linux_socketcall */
-	{ AS(linux_syslog_args), (sy_call_t *)linux_syslog, AUE_NULL },	/* 103 = linux_syslog */
-	{ AS(linux_setitimer_args), (sy_call_t *)linux_setitimer, AUE_SETITIMER },	/* 104 = linux_setitimer */
-	{ AS(linux_getitimer_args), (sy_call_t *)linux_getitimer, AUE_GETITIMER },	/* 105 = linux_getitimer */
-	{ AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT },	/* 106 = linux_newstat */
-	{ AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT },	/* 107 = linux_newlstat */
-	{ AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT },	/* 108 = linux_newfstat */
-	{ 0, (sy_call_t *)linux_uname, AUE_NULL },	/* 109 = linux_uname */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 110 = iopl */
-	{ 0, (sy_call_t *)linux_vhangup, AUE_NULL },	/* 111 = linux_vhangup */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 112 = idle */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 113 = vm86old */
-	{ AS(linux_wait4_args), (sy_call_t *)linux_wait4, AUE_WAIT4 },	/* 114 = linux_wait4 */
-	{ 0, (sy_call_t *)linux_swapoff, AUE_SWAPOFF },	/* 115 = linux_swapoff */
-	{ AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo, AUE_NULL },	/* 116 = linux_sysinfo */
-	{ AS(linux_ipc_args), (sy_call_t *)linux_ipc, AUE_NULL },	/* 117 = linux_ipc */
-	{ AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC },	/* 118 = fsync */
-	{ AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn, AUE_SIGRETURN },	/* 119 = linux_sigreturn */
-	{ AS(linux_clone_args), (sy_call_t *)linux_clone, AUE_RFORK },	/* 120 = linux_clone */
-	{ AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_SYSCTL },	/* 121 = setdomainname */
-	{ AS(linux_newuname_args), (sy_call_t *)linux_newuname, AUE_NULL },	/* 122 = linux_newuname */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 123 = modify_ldt */
-	{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME },	/* 124 = linux_adjtimex */
-	{ AS(linux_mprotect_args), (sy_call_t *)linux_mprotect, AUE_MPROTECT },	/* 125 = linux_mprotect */
-	{ AS(linux_sigprocmask_args), (sy_call_t *)linux_sigprocmask, AUE_SIGPROCMASK },	/* 126 = linux_sigprocmask */
-	{ 0, (sy_call_t *)linux_create_module, AUE_NULL },	/* 127 = linux_create_module */
-	{ 0, (sy_call_t *)linux_init_module, AUE_NULL },	/* 128 = linux_init_module */
-	{ 0, (sy_call_t *)linux_delete_module, AUE_NULL },	/* 129 = linux_delete_module */
-	{ 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL },	/* 130 = linux_get_kernel_syms */
-	{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL },	/* 131 = linux_quotactl */
-	{ AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID },	/* 132 = getpgid */
-	{ AS(fchdir_args), (sy_call_t *)fchdir, AUE_FCHDIR },	/* 133 = fchdir */
-	{ 0, (sy_call_t *)linux_bdflush, AUE_BDFLUSH },	/* 134 = linux_bdflush */
-	{ AS(linux_sysfs_args), (sy_call_t *)linux_sysfs, AUE_NULL },	/* 135 = linux_sysfs */
-	{ AS(linux_personality_args), (sy_call_t *)linux_personality, AUE_PERSONALITY },	/* 136 = linux_personality */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 137 = afs_syscall */
-	{ AS(linux_setfsuid16_args), (sy_call_t *)linux_setfsuid16, AUE_SETFSUID },	/* 138 = linux_setfsuid16 */
-	{ AS(linux_setfsgid16_args), (sy_call_t *)linux_setfsgid16, AUE_SETFSGID },	/* 139 = linux_setfsgid16 */
-	{ AS(linux_llseek_args), (sy_call_t *)linux_llseek, AUE_LSEEK },	/* 140 = linux_llseek */
-	{ AS(linux_getdents_args), (sy_call_t *)linux_getdents, AUE_O_GETDENTS },	/* 141 = linux_getdents */
-	{ AS(linux_select_args), (sy_call_t *)linux_select, AUE_SELECT },	/* 142 = linux_select */
-	{ AS(flock_args), (sy_call_t *)flock, AUE_FLOCK },	/* 143 = flock */
-	{ AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC },	/* 144 = linux_msync */
-	{ AS(linux_readv_args), (sy_call_t *)linux_readv, AUE_READV },	/* 145 = linux_readv */
-	{ AS(linux_writev_args), (sy_call_t *)linux_writev, AUE_WRITEV },	/* 146 = linux_writev */
-	{ AS(linux_getsid_args), (sy_call_t *)linux_getsid, AUE_GETSID },	/* 147 = linux_getsid */
-	{ AS(linux_fdatasync_args), (sy_call_t *)linux_fdatasync, AUE_NULL },	/* 148 = linux_fdatasync */
-	{ AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL },	/* 149 = linux_sysctl */
-	{ AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK },	/* 150 = mlock */
-	{ AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK },	/* 151 = munlock */
-	{ AS(mlockall_args), (sy_call_t *)mlockall, AUE_MLOCKALL },	/* 152 = mlockall */
-	{ 0, (sy_call_t *)munlockall, AUE_MUNLOCKALL },	/* 153 = munlockall */
-	{ AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_SCHED_SETPARAM },	/* 154 = sched_setparam */
-	{ AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_SCHED_GETPARAM },	/* 155 = sched_getparam */
-	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER },	/* 156 = linux_sched_setscheduler */
-	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER },	/* 157 = linux_sched_getscheduler */
-	{ 0, (sy_call_t *)sched_yield, AUE_NULL },	/* 158 = sched_yield */
-	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX },	/* 159 = linux_sched_get_priority_max */
-	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN },	/* 160 = linux_sched_get_priority_min */
-	{ AS(linux_sched_rr_get_interval_args), (sy_call_t *)linux_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL },	/* 161 = linux_sched_rr_get_interval */
-	{ AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL },	/* 162 = linux_nanosleep */
-	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL },	/* 163 = linux_mremap */
-	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID },	/* 164 = linux_setresuid16 */
-	{ AS(linux_getresuid16_args), (sy_call_t *)linux_getresuid16, AUE_GETRESUID },	/* 165 = linux_getresuid16 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 166 = vm86 */
-	{ 0, (sy_call_t *)linux_query_module, AUE_NULL },	/* 167 = linux_query_module */
-	{ AS(poll_args), (sy_call_t *)poll, AUE_POLL },	/* 168 = poll */
-	{ 0, (sy_call_t *)linux_nfsservctl, AUE_NULL },	/* 169 = linux_nfsservctl */
-	{ AS(linux_setresgid16_args), (sy_call_t *)linux_setresgid16, AUE_SETRESGID },	/* 170 = linux_setresgid16 */
-	{ AS(linux_getresgid16_args), (sy_call_t *)linux_getresgid16, AUE_GETRESGID },	/* 171 = linux_getresgid16 */
-	{ 0, (sy_call_t *)linux_prctl, AUE_PRCTL },	/* 172 = linux_prctl */
-	{ AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL },	/* 173 = linux_rt_sigreturn */
-	{ AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL },	/* 174 = linux_rt_sigaction */
-	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL },	/* 175 = linux_rt_sigprocmask */
-	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL },	/* 176 = linux_rt_sigpending */
-	{ 0, (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL },	/* 177 = linux_rt_sigtimedwait */
-	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL },	/* 178 = linux_rt_sigqueueinfo */
-	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL },	/* 179 = linux_rt_sigsuspend */
-	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD },	/* 180 = linux_pread */
-	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE },	/* 181 = linux_pwrite */
-	{ AS(linux_chown16_args), (sy_call_t *)linux_chown16, AUE_CHOWN },	/* 182 = linux_chown16 */
-	{ AS(linux_getcwd_args), (sy_call_t *)linux_getcwd, AUE_GETCWD },	/* 183 = linux_getcwd */
-	{ 0, (sy_call_t *)linux_capget, AUE_CAPGET },	/* 184 = linux_capget */
-	{ 0, (sy_call_t *)linux_capset, AUE_CAPSET },	/* 185 = linux_capset */
-	{ AS(linux_sigaltstack_args), (sy_call_t *)linux_sigaltstack, AUE_NULL },	/* 186 = linux_sigaltstack */
-	{ 0, (sy_call_t *)linux_sendfile, AUE_SENDFILE },	/* 187 = linux_sendfile */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 188 = getpmsg */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 189 = putpmsg */
-	{ 0, (sy_call_t *)linux_vfork, AUE_VFORK },	/* 190 = linux_vfork */
-	{ AS(linux_getrlimit_args), (sy_call_t *)linux_getrlimit, AUE_GETRLIMIT },	/* 191 = linux_getrlimit */
-	{ AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP },	/* 192 = linux_mmap2 */
-	{ AS(linux_truncate64_args), (sy_call_t *)linux_truncate64, AUE_TRUNCATE },	/* 193 = linux_truncate64 */
-	{ AS(linux_ftruncate64_args), (sy_call_t *)linux_ftruncate64, AUE_FTRUNCATE },	/* 194 = linux_ftruncate64 */
-	{ AS(linux_stat64_args), (sy_call_t *)linux_stat64, AUE_STAT },	/* 195 = linux_stat64 */
-	{ AS(linux_lstat64_args), (sy_call_t *)linux_lstat64, AUE_LSTAT },	/* 196 = linux_lstat64 */
-	{ AS(linux_fstat64_args), (sy_call_t *)linux_fstat64, AUE_FSTAT },	/* 197 = linux_fstat64 */
-	{ AS(linux_lchown_args), (sy_call_t *)linux_lchown, AUE_LCHOWN },	/* 198 = linux_lchown */
-	{ 0, (sy_call_t *)linux_getuid, AUE_GETUID },	/* 199 = linux_getuid */
-	{ 0, (sy_call_t *)linux_getgid, AUE_GETGID },	/* 200 = linux_getgid */
-	{ 0, (sy_call_t *)geteuid, AUE_GETEUID },		/* 201 = geteuid */
-	{ 0, (sy_call_t *)getegid, AUE_GETEGID },		/* 202 = getegid */
-	{ AS(setreuid_args), (sy_call_t *)setreuid, AUE_SETREUID },	/* 203 = setreuid */
-	{ AS(setregid_args), (sy_call_t *)setregid, AUE_SETREGID },	/* 204 = setregid */
-	{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups, AUE_GETGROUPS },	/* 205 = linux_getgroups */
-	{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups, AUE_SETGROUPS },	/* 206 = linux_setgroups */
-	{ AS(fchown_args), (sy_call_t *)fchown, AUE_NULL },	/* 207 = fchown */
-	{ AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID },	/* 208 = setresuid */
-	{ AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID },	/* 209 = getresuid */
-	{ AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID },	/* 210 = setresgid */
-	{ AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID },	/* 211 = getresgid */
-	{ AS(linux_chown_args), (sy_call_t *)linux_chown, AUE_CHOWN },	/* 212 = linux_chown */
-	{ AS(setuid_args), (sy_call_t *)setuid, AUE_SETUID },	/* 213 = setuid */
-	{ AS(setgid_args), (sy_call_t *)setgid, AUE_SETGID },	/* 214 = setgid */
-	{ AS(linux_setfsuid_args), (sy_call_t *)linux_setfsuid, AUE_SETFSUID },	/* 215 = linux_setfsuid */
-	{ AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID },	/* 216 = linux_setfsgid */
-	{ AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT },	/* 217 = linux_pivot_root */
-	{ AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE },	/* 218 = linux_mincore */
-	{ AS(madvise_args), (sy_call_t *)madvise, AUE_MADVISE },	/* 219 = madvise */
-	{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_O_GETDENTS },	/* 220 = linux_getdents64 */
-	{ AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL },	/* 221 = linux_fcntl64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 222 =  */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 223 =  */
-	{ 0, (sy_call_t *)linux_getpid, AUE_NULL },	/* 224 = gettid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 225 = linux_readahead */
-	{ 0, (sy_call_t *)linux_setxattr, AUE_NULL },	/* 226 = linux_setxattr */
-	{ 0, (sy_call_t *)linux_lsetxattr, AUE_NULL },	/* 227 = linux_lsetxattr */
-	{ 0, (sy_call_t *)linux_fsetxattr, AUE_NULL },	/* 228 = linux_fsetxattr */
-	{ 0, (sy_call_t *)linux_getxattr, AUE_NULL },	/* 229 = linux_getxattr */
-	{ 0, (sy_call_t *)linux_lgetxattr, AUE_NULL },	/* 230 = linux_lgetxattr */
-	{ 0, (sy_call_t *)linux_fgetxattr, AUE_NULL },	/* 231 = linux_fgetxattr */
-	{ 0, (sy_call_t *)linux_listxattr, AUE_NULL },	/* 232 = linux_listxattr */
-	{ 0, (sy_call_t *)linux_llistxattr, AUE_NULL },	/* 233 = linux_llistxattr */
-	{ 0, (sy_call_t *)linux_flistxattr, AUE_NULL },	/* 234 = linux_flistxattr */
-	{ 0, (sy_call_t *)linux_removexattr, AUE_NULL },	/* 235 = linux_removexattr */
-	{ 0, (sy_call_t *)linux_lremovexattr, AUE_NULL },	/* 236 = linux_lremovexattr */
-	{ 0, (sy_call_t *)linux_fremovexattr, AUE_NULL },	/* 237 = linux_fremovexattr */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 238 = linux_tkill */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 239 = linux_sendfile64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 240 = linux_futex */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 241 = linux_sched_setaffinity */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 242 = linux_sched_getaffinity */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 243 = linux_set_thread_area */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 244 = linux_get_thread_area */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 245 = linux_io_setup */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 246 = linux_io_destroy */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 247 = linux_io_getevents */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 248 = linux_io_submit */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 249 = linux_io_cancel */
-	{ 0, (sy_call_t *)linux_fadvise64, AUE_NULL },	/* 250 = linux_fadvise64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 251 =  */
-	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT },	/* 252 = exit_group */
-	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL },	/* 253 = linux_lookup_dcookie */
-	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL },	/* 254 = linux_epoll_create */
-	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL },	/* 255 = linux_epoll_ctl */
-	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL },	/* 256 = linux_epoll_wait */
-	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL },	/* 257 = linux_remap_file_pages */
-	{ 0, (sy_call_t *)linux_set_tid_address, AUE_NULL },	/* 258 = linux_set_tid_address */
-	{ 0, (sy_call_t *)linux_timer_create, AUE_NULL },	/* 259 = linux_timer_create */
-	{ 0, (sy_call_t *)linux_timer_settime, AUE_NULL },	/* 260 = linux_timer_settime */
-	{ 0, (sy_call_t *)linux_timer_gettime, AUE_NULL },	/* 261 = linux_timer_gettime */
-	{ 0, (sy_call_t *)linux_timer_getoverrun, AUE_NULL },	/* 262 = linux_timer_getoverrun */
-	{ 0, (sy_call_t *)linux_timer_delete, AUE_NULL },	/* 263 = linux_timer_delete */
-	{ 0, (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME },	/* 264 = linux_clock_settime */
-	{ 0, (sy_call_t *)linux_clock_gettime, AUE_NULL },	/* 265 = linux_clock_gettime */
-	{ 0, (sy_call_t *)linux_clock_getres, AUE_NULL },	/* 266 = linux_clock_getres */
-	{ 0, (sy_call_t *)linux_clock_nanosleep, AUE_NULL },	/* 267 = linux_clock_nanosleep */
-	{ 0, (sy_call_t *)linux_statfs64, AUE_NULL },	/* 268 = linux_statfs64 */
-	{ 0, (sy_call_t *)linux_fstatfs64, AUE_NULL },	/* 269 = linux_fstatfs64 */
-	{ 0, (sy_call_t *)linux_tgkill, AUE_NULL },	/* 270 = linux_tgkill */
-	{ 0, (sy_call_t *)linux_utimes, AUE_NULL },	/* 271 = linux_utimes */
-	{ 0, (sy_call_t *)linux_fadvise64_64, AUE_NULL },	/* 272 = linux_fadvise64_64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 273 =  */
-	{ 0, (sy_call_t *)linux_mbind, AUE_NULL },	/* 274 = linux_mbind */
-	{ 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL },	/* 275 = linux_get_mempolicy */
-	{ 0, (sy_call_t *)linux_set_mempolicy, AUE_NULL },	/* 276 = linux_set_mempolicy */
-	{ 0, (sy_call_t *)linux_mq_open, AUE_NULL },	/* 277 = linux_mq_open */
-	{ 0, (sy_call_t *)linux_mq_unlink, AUE_NULL },	/* 278 = linux_mq_unlink */
-	{ 0, (sy_call_t *)linux_mq_timedsend, AUE_NULL },	/* 279 = linux_mq_timedsend */
-	{ 0, (sy_call_t *)linux_mq_timedreceive, AUE_NULL },	/* 280 = linux_mq_timedreceive */
-	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL },	/* 281 = linux_mq_notify */
-	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL },	/* 282 = linux_mq_getsetattr */
-	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL },	/* 283 = linux_kexec_load */
-	{ 0, (sy_call_t *)linux_waitid, AUE_NULL },	/* 284 = linux_waitid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 285 =  */
-	{ 0, (sy_call_t *)linux_add_key, AUE_NULL },	/* 286 = linux_add_key */
-	{ 0, (sy_call_t *)linux_request_key, AUE_NULL },	/* 287 = linux_request_key */
-	{ 0, (sy_call_t *)linux_keyctl, AUE_NULL },	/* 288 = linux_keyctl */
-	{ 0, (sy_call_t *)linux_ioprio_set, AUE_NULL },	/* 289 = linux_ioprio_set */
-	{ 0, (sy_call_t *)linux_ioprio_get, AUE_NULL },	/* 290 = linux_ioprio_get */
-	{ 0, (sy_call_t *)linux_inotify_init, AUE_NULL },	/* 291 = linux_inotify_init */
-	{ 0, (sy_call_t *)linux_inotify_add_watch, AUE_NULL },	/* 292 = linux_inotify_add_watch */
-	{ 0, (sy_call_t *)linux_inotify_rm_watch, AUE_NULL },	/* 293 = linux_inotify_rm_watch */
-	{ 0, (sy_call_t *)linux_migrate_pages, AUE_NULL },	/* 294 = linux_migrate_pages */
-	{ 0, (sy_call_t *)linux_openat, AUE_NULL },	/* 295 = linux_openat */
-	{ 0, (sy_call_t *)linux_mkdirat, AUE_NULL },	/* 296 = linux_mkdirat */
-	{ 0, (sy_call_t *)linux_mknodat, AUE_NULL },	/* 297 = linux_mknodat */
-	{ 0, (sy_call_t *)linux_fchownat, AUE_NULL },	/* 298 = linux_fchownat */
-	{ 0, (sy_call_t *)linux_futimesat, AUE_NULL },	/* 299 = linux_futimesat */
-	{ 0, (sy_call_t *)linux_fstatat64, AUE_NULL },	/* 300 = linux_fstatat64 */
-	{ 0, (sy_call_t *)linux_unlinkat, AUE_NULL },	/* 301 = linux_unlinkat */
-	{ 0, (sy_call_t *)linux_renameat, AUE_NULL },	/* 302 = linux_renameat */
-	{ 0, (sy_call_t *)linux_linkat, AUE_NULL },	/* 303 = linux_linkat */
-	{ 0, (sy_call_t *)linux_symlinkat, AUE_NULL },	/* 304 = linux_symlinkat */
-	{ 0, (sy_call_t *)linux_readlinkat, AUE_NULL },	/* 305 = linux_readlinkat */
-	{ 0, (sy_call_t *)linux_fchmodat, AUE_NULL },	/* 306 = linux_fchmodat */
-	{ 0, (sy_call_t *)linux_faccessat, AUE_NULL },	/* 307 = linux_faccessat */
-	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL },	/* 308 = linux_pselect6 */
-	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL },	/* 309 = linux_ppoll */
-	{ 0, (sy_call_t *)linux_unshare, AUE_NULL },	/* 310 = linux_unshare */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 0 = setup */
+	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT, NULL, 0, 0 },	/* 1 = exit */
+	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0 },		/* 2 = linux_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(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC, NULL, 0, 0 },	/* 5 = linux_open */
+	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0 },	/* 6 = close */
+	{ AS(linux_waitpid_args), (sy_call_t *)linux_waitpid, AUE_WAIT4, NULL, 0, 0 },	/* 7 = linux_waitpid */
+	{ AS(linux_creat_args), (sy_call_t *)linux_creat, AUE_O_CREAT, NULL, 0, 0 },	/* 8 = linux_creat */
+	{ AS(linux_link_args), (sy_call_t *)linux_link, AUE_LINK, NULL, 0, 0 },	/* 9 = linux_link */
+	{ AS(linux_unlink_args), (sy_call_t *)linux_unlink, AUE_UNLINK, NULL, 0, 0 },	/* 10 = linux_unlink */
+	{ AS(linux_execve_args), (sy_call_t *)linux_execve, AUE_EXECVE, NULL, 0, 0 },	/* 11 = linux_execve */
+	{ AS(linux_chdir_args), (sy_call_t *)linux_chdir, AUE_CHDIR, NULL, 0, 0 },	/* 12 = linux_chdir */
+	{ AS(linux_time_args), (sy_call_t *)linux_time, AUE_NULL, NULL, 0, 0 },	/* 13 = linux_time */
+	{ AS(linux_mknod_args), (sy_call_t *)linux_mknod, AUE_MKNOD, NULL, 0, 0 },	/* 14 = linux_mknod */
+	{ AS(linux_chmod_args), (sy_call_t *)linux_chmod, AUE_CHMOD, NULL, 0, 0 },	/* 15 = linux_chmod */
+	{ AS(linux_lchown16_args), (sy_call_t *)linux_lchown16, AUE_LCHOWN, NULL, 0, 0 },	/* 16 = linux_lchown16 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 17 = break */
+	{ AS(linux_stat_args), (sy_call_t *)linux_stat, AUE_STAT, NULL, 0, 0 },	/* 18 = linux_stat */
+	{ AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK, NULL, 0, 0 },	/* 19 = linux_lseek */
+	{ 0, (sy_call_t *)linux_getpid, AUE_GETPID, NULL, 0, 0 },	/* 20 = linux_getpid */
+	{ AS(linux_mount_args), (sy_call_t *)linux_mount, AUE_MOUNT, NULL, 0, 0 },	/* 21 = linux_mount */
+	{ AS(linux_oldumount_args), (sy_call_t *)linux_oldumount, AUE_UMOUNT, NULL, 0, 0 },	/* 22 = linux_oldumount */
+	{ AS(linux_setuid16_args), (sy_call_t *)linux_setuid16, AUE_SETUID, NULL, 0, 0 },	/* 23 = linux_setuid16 */
+	{ 0, (sy_call_t *)linux_getuid16, AUE_GETUID, NULL, 0, 0 },	/* 24 = linux_getuid16 */
+	{ 0, (sy_call_t *)linux_stime, AUE_SETTIMEOFDAY, NULL, 0, 0 },	/* 25 = linux_stime */
+	{ AS(linux_ptrace_args), (sy_call_t *)linux_ptrace, AUE_PTRACE, NULL, 0, 0 },	/* 26 = linux_ptrace */
+	{ AS(linux_alarm_args), (sy_call_t *)linux_alarm, AUE_NULL, NULL, 0, 0 },	/* 27 = linux_alarm */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 28 = fstat */
+	{ 0, (sy_call_t *)linux_pause, AUE_NULL, NULL, 0, 0 },	/* 29 = linux_pause */
+	{ AS(linux_utime_args), (sy_call_t *)linux_utime, AUE_UTIME, NULL, 0, 0 },	/* 30 = linux_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(linux_access_args), (sy_call_t *)linux_access, AUE_ACCESS, NULL, 0, 0 },	/* 33 = linux_access */
+	{ AS(linux_nice_args), (sy_call_t *)linux_nice, AUE_NICE, NULL, 0, 0 },	/* 34 = linux_nice */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 35 = ftime */
+	{ 0, (sy_call_t *)sync, AUE_SYNC, NULL, 0, 0 },		/* 36 = sync */
+	{ AS(linux_kill_args), (sy_call_t *)linux_kill, AUE_KILL, NULL, 0, 0 },	/* 37 = linux_kill */
+	{ AS(linux_rename_args), (sy_call_t *)linux_rename, AUE_RENAME, NULL, 0, 0 },	/* 38 = linux_rename */
+	{ AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR, NULL, 0, 0 },	/* 39 = linux_mkdir */
+	{ AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR, NULL, 0, 0 },	/* 40 = linux_rmdir */
+	{ AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 },	/* 41 = dup */
+	{ AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE, NULL, 0, 0 },	/* 42 = linux_pipe */
+	{ AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL, NULL, 0, 0 },	/* 43 = linux_times */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 44 = prof */
+	{ AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0 },	/* 45 = linux_brk */
+	{ AS(linux_setgid16_args), (sy_call_t *)linux_setgid16, AUE_SETGID, NULL, 0, 0 },	/* 46 = linux_setgid16 */
+	{ 0, (sy_call_t *)linux_getgid16, AUE_GETGID, NULL, 0, 0 },	/* 47 = linux_getgid16 */
+	{ AS(linux_signal_args), (sy_call_t *)linux_signal, AUE_NULL, NULL, 0, 0 },	/* 48 = linux_signal */
+	{ 0, (sy_call_t *)linux_geteuid16, AUE_GETEUID, NULL, 0, 0 },	/* 49 = linux_geteuid16 */
+	{ 0, (sy_call_t *)linux_getegid16, AUE_GETEGID, NULL, 0, 0 },	/* 50 = linux_getegid16 */
+	{ AS(acct_args), (sy_call_t *)acct, AUE_ACCT, NULL, 0, 0 },	/* 51 = acct */
+	{ AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT, NULL, 0, 0 },	/* 52 = linux_umount */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 53 = lock */
+	{ AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL, NULL, 0, 0 },	/* 54 = linux_ioctl */
+	{ AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL, NULL, 0, 0 },	/* 55 = linux_fcntl */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 56 = mpx */
+	{ AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP, NULL, 0, 0 },	/* 57 = setpgid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 58 = ulimit */
+	{ 0, (sy_call_t *)linux_olduname, AUE_NULL, NULL, 0, 0 },	/* 59 = linux_olduname */
+	{ 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 */
+	{ AS(linux_ustat_args), (sy_call_t *)linux_ustat, AUE_NULL, NULL, 0, 0 },	/* 62 = linux_ustat */
+	{ AS(dup2_args), (sy_call_t *)dup2, AUE_DUP2, NULL, 0, 0 },	/* 63 = dup2 */
+	{ 0, (sy_call_t *)linux_getppid, AUE_GETPPID, NULL, 0, 0 },	/* 64 = linux_getppid */
+	{ 0, (sy_call_t *)getpgrp, AUE_GETPGRP, NULL, 0, 0 },		/* 65 = getpgrp */
+	{ 0, (sy_call_t *)setsid, AUE_SETSID, NULL, 0, 0 },		/* 66 = setsid */
+	{ AS(linux_sigaction_args), (sy_call_t *)linux_sigaction, AUE_NULL, NULL, 0, 0 },	/* 67 = linux_sigaction */
+	{ 0, (sy_call_t *)linux_sgetmask, AUE_NULL, NULL, 0, 0 },	/* 68 = linux_sgetmask */
+	{ AS(linux_ssetmask_args), (sy_call_t *)linux_ssetmask, AUE_NULL, NULL, 0, 0 },	/* 69 = linux_ssetmask */
+	{ AS(linux_setreuid16_args), (sy_call_t *)linux_setreuid16, AUE_SETREUID, NULL, 0, 0 },	/* 70 = linux_setreuid16 */
+	{ AS(linux_setregid16_args), (sy_call_t *)linux_setregid16, AUE_SETREGID, NULL, 0, 0 },	/* 71 = linux_setregid16 */
+	{ AS(linux_sigsuspend_args), (sy_call_t *)linux_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 72 = linux_sigsuspend */
+	{ AS(linux_sigpending_args), (sy_call_t *)linux_sigpending, AUE_NULL, NULL, 0, 0 },	/* 73 = linux_sigpending */
+	{ AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL, NULL, 0, 0 },	/* 74 = linux_sethostname */
+	{ AS(linux_setrlimit_args), (sy_call_t *)linux_setrlimit, AUE_SETRLIMIT, NULL, 0, 0 },	/* 75 = linux_setrlimit */
+	{ AS(linux_old_getrlimit_args), (sy_call_t *)linux_old_getrlimit, AUE_GETRLIMIT, NULL, 0, 0 },	/* 76 = linux_old_getrlimit */
+	{ AS(linux_getrusage_args), (sy_call_t *)linux_getrusage, AUE_GETRUSAGE, NULL, 0, 0 },	/* 77 = linux_getrusage */
+	{ AS(linux_gettimeofday_args), (sy_call_t *)linux_gettimeofday, AUE_NULL, NULL, 0, 0 },	/* 78 = linux_gettimeofday */
+	{ AS(linux_settimeofday_args), (sy_call_t *)linux_settimeofday, AUE_SETTIMEOFDAY, NULL, 0, 0 },	/* 79 = linux_settimeofday */
+	{ AS(linux_getgroups16_args), (sy_call_t *)linux_getgroups16, AUE_GETGROUPS, NULL, 0, 0 },	/* 80 = linux_getgroups16 */
+	{ AS(linux_setgroups16_args), (sy_call_t *)linux_setgroups16, AUE_SETGROUPS, NULL, 0, 0 },	/* 81 = linux_setgroups16 */
+	{ AS(linux_old_select_args), (sy_call_t *)linux_old_select, AUE_SELECT, NULL, 0, 0 },	/* 82 = linux_old_select */
+	{ AS(linux_symlink_args), (sy_call_t *)linux_symlink, AUE_SYMLINK, NULL, 0, 0 },	/* 83 = linux_symlink */
+	{ AS(linux_lstat_args), (sy_call_t *)linux_lstat, AUE_LSTAT, NULL, 0, 0 },	/* 84 = linux_lstat */
+	{ AS(linux_readlink_args), (sy_call_t *)linux_readlink, AUE_READLINK, NULL, 0, 0 },	/* 85 = linux_readlink */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 86 = linux_uselib */
+	{ AS(swapon_args), (sy_call_t *)swapon, AUE_SWAPON, NULL, 0, 0 },	/* 87 = swapon */
+	{ AS(linux_reboot_args), (sy_call_t *)linux_reboot, AUE_REBOOT, NULL, 0, 0 },	/* 88 = linux_reboot */
+	{ AS(linux_readdir_args), (sy_call_t *)linux_readdir, AUE_O_GETDENTS, NULL, 0, 0 },	/* 89 = linux_readdir */
+	{ AS(linux_mmap_args), (sy_call_t *)linux_mmap, AUE_MMAP, NULL, 0, 0 },	/* 90 = linux_mmap */
+	{ AS(munmap_args), (sy_call_t *)munmap, AUE_MUNMAP, NULL, 0, 0 },	/* 91 = munmap */
+	{ AS(linux_truncate_args), (sy_call_t *)linux_truncate, AUE_TRUNCATE, NULL, 0, 0 },	/* 92 = linux_truncate */
+	{ AS(linux_ftruncate_args), (sy_call_t *)linux_ftruncate, AUE_FTRUNCATE, NULL, 0, 0 },	/* 93 = linux_ftruncate */
+	{ AS(fchmod_args), (sy_call_t *)fchmod, AUE_FCHMOD, NULL, 0, 0 },	/* 94 = fchmod */
+	{ AS(fchown_args), (sy_call_t *)fchown, AUE_FCHOWN, NULL, 0, 0 },	/* 95 = fchown */
+	{ AS(linux_getpriority_args), (sy_call_t *)linux_getpriority, AUE_GETPRIORITY, NULL, 0, 0 },	/* 96 = linux_getpriority */
+	{ AS(setpriority_args), (sy_call_t *)setpriority, AUE_SETPRIORITY, NULL, 0, 0 },	/* 97 = setpriority */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 98 = profil */
+	{ AS(linux_statfs_args), (sy_call_t *)linux_statfs, AUE_STATFS, NULL, 0, 0 },	/* 99 = linux_statfs */
+	{ AS(linux_fstatfs_args), (sy_call_t *)linux_fstatfs, AUE_FSTATFS, NULL, 0, 0 },	/* 100 = linux_fstatfs */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 101 = ioperm */
+	{ AS(linux_socketcall_args), (sy_call_t *)linux_socketcall, AUE_NULL, NULL, 0, 0 },	/* 102 = linux_socketcall */
+	{ AS(linux_syslog_args), (sy_call_t *)linux_syslog, AUE_NULL, NULL, 0, 0 },	/* 103 = linux_syslog */
+	{ AS(linux_setitimer_args), (sy_call_t *)linux_setitimer, AUE_SETITIMER, NULL, 0, 0 },	/* 104 = linux_setitimer */
+	{ AS(linux_getitimer_args), (sy_call_t *)linux_getitimer, AUE_GETITIMER, NULL, 0, 0 },	/* 105 = linux_getitimer */
+	{ AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT, NULL, 0, 0 },	/* 106 = linux_newstat */
+	{ AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT, NULL, 0, 0 },	/* 107 = linux_newlstat */
+	{ AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT, NULL, 0, 0 },	/* 108 = linux_newfstat */
+	{ 0, (sy_call_t *)linux_uname, AUE_NULL, NULL, 0, 0 },	/* 109 = linux_uname */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 110 = iopl */
+	{ 0, (sy_call_t *)linux_vhangup, AUE_NULL, NULL, 0, 0 },	/* 111 = linux_vhangup */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 112 = idle */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 113 = vm86old */
+	{ AS(linux_wait4_args), (sy_call_t *)linux_wait4, AUE_WAIT4, NULL, 0, 0 },	/* 114 = linux_wait4 */
+	{ 0, (sy_call_t *)linux_swapoff, AUE_SWAPOFF, NULL, 0, 0 },	/* 115 = linux_swapoff */
+	{ AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo, AUE_NULL, NULL, 0, 0 },	/* 116 = linux_sysinfo */
+	{ AS(linux_ipc_args), (sy_call_t *)linux_ipc, AUE_NULL, NULL, 0, 0 },	/* 117 = linux_ipc */
+	{ AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC, NULL, 0, 0 },	/* 118 = fsync */
+	{ AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn, AUE_SIGRETURN, NULL, 0, 0 },	/* 119 = linux_sigreturn */
+	{ AS(linux_clone_args), (sy_call_t *)linux_clone, AUE_RFORK, NULL, 0, 0 },	/* 120 = linux_clone */
+	{ AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_SYSCTL, NULL, 0, 0 },	/* 121 = setdomainname */
+	{ AS(linux_newuname_args), (sy_call_t *)linux_newuname, AUE_NULL, NULL, 0, 0 },	/* 122 = linux_newuname */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 123 = modify_ldt */
+	{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME, NULL, 0, 0 },	/* 124 = linux_adjtimex */
+	{ AS(linux_mprotect_args), (sy_call_t *)linux_mprotect, AUE_MPROTECT, NULL, 0, 0 },	/* 125 = linux_mprotect */
+	{ AS(linux_sigprocmask_args), (sy_call_t *)linux_sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 },	/* 126 = linux_sigprocmask */
+	{ 0, (sy_call_t *)linux_create_module, AUE_NULL, NULL, 0, 0 },	/* 127 = linux_create_module */
+	{ 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0 },	/* 128 = linux_init_module */
+	{ 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0 },	/* 129 = linux_delete_module */
+	{ 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL, NULL, 0, 0 },	/* 130 = linux_get_kernel_syms */
+	{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL, NULL, 0, 0 },	/* 131 = linux_quotactl */
+	{ AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID, NULL, 0, 0 },	/* 132 = getpgid */
+	{ AS(fchdir_args), (sy_call_t *)fchdir, AUE_FCHDIR, NULL, 0, 0 },	/* 133 = fchdir */
+	{ 0, (sy_call_t *)linux_bdflush, AUE_BDFLUSH, NULL, 0, 0 },	/* 134 = linux_bdflush */
+	{ AS(linux_sysfs_args), (sy_call_t *)linux_sysfs, AUE_NULL, NULL, 0, 0 },	/* 135 = linux_sysfs */
+	{ AS(linux_personality_args), (sy_call_t *)linux_personality, AUE_PERSONALITY, NULL, 0, 0 },	/* 136 = linux_personality */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 137 = afs_syscall */
+	{ AS(linux_setfsuid16_args), (sy_call_t *)linux_setfsuid16, AUE_SETFSUID, NULL, 0, 0 },	/* 138 = linux_setfsuid16 */
+	{ AS(linux_setfsgid16_args), (sy_call_t *)linux_setfsgid16, AUE_SETFSGID, NULL, 0, 0 },	/* 139 = linux_setfsgid16 */
+	{ AS(linux_llseek_args), (sy_call_t *)linux_llseek, AUE_LSEEK, NULL, 0, 0 },	/* 140 = linux_llseek */
+	{ AS(linux_getdents_args), (sy_call_t *)linux_getdents, AUE_O_GETDENTS, NULL, 0, 0 },	/* 141 = linux_getdents */
+	{ AS(linux_select_args), (sy_call_t *)linux_select, AUE_SELECT, NULL, 0, 0 },	/* 142 = linux_select */
+	{ AS(flock_args), (sy_call_t *)flock, AUE_FLOCK, NULL, 0, 0 },	/* 143 = flock */
+	{ AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC, NULL, 0, 0 },	/* 144 = linux_msync */
+	{ AS(linux_readv_args), (sy_call_t *)linux_readv, AUE_READV, NULL, 0, 0 },	/* 145 = linux_readv */
+	{ AS(linux_writev_args), (sy_call_t *)linux_writev, AUE_WRITEV, NULL, 0, 0 },	/* 146 = linux_writev */
+	{ AS(linux_getsid_args), (sy_call_t *)linux_getsid, AUE_GETSID, NULL, 0, 0 },	/* 147 = linux_getsid */
+	{ AS(linux_fdatasync_args), (sy_call_t *)linux_fdatasync, AUE_NULL, NULL, 0, 0 },	/* 148 = linux_fdatasync */
+	{ AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL, NULL, 0, 0 },	/* 149 = linux_sysctl */
+	{ AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK, NULL, 0, 0 },	/* 150 = mlock */
+	{ AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK, NULL, 0, 0 },	/* 151 = munlock */
+	{ AS(mlockall_args), (sy_call_t *)mlockall, AUE_MLOCKALL, NULL, 0, 0 },	/* 152 = mlockall */
+	{ 0, (sy_call_t *)munlockall, AUE_MUNLOCKALL, NULL, 0, 0 },	/* 153 = munlockall */
+	{ AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0 },	/* 154 = sched_setparam */
+	{ AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0 },	/* 155 = sched_getparam */
+	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0 },	/* 156 = linux_sched_setscheduler */
+	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0 },	/* 157 = linux_sched_getscheduler */
+	{ 0, (sy_call_t *)sched_yield, AUE_NULL, NULL, 0, 0 },	/* 158 = sched_yield */
+	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0 },	/* 159 = linux_sched_get_priority_max */
+	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0 },	/* 160 = linux_sched_get_priority_min */
+	{ AS(linux_sched_rr_get_interval_args), (sy_call_t *)linux_sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0 },	/* 161 = linux_sched_rr_get_interval */
+	{ AS(linux_nanosleep_args), (sy_call_t *)linux_nanosleep, AUE_NULL, NULL, 0, 0 },	/* 162 = linux_nanosleep */
+	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0 },	/* 163 = linux_mremap */
+	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0 },	/* 164 = linux_setresuid16 */
+	{ AS(linux_getresuid16_args), (sy_call_t *)linux_getresuid16, AUE_GETRESUID, NULL, 0, 0 },	/* 165 = linux_getresuid16 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 166 = vm86 */
+	{ 0, (sy_call_t *)linux_query_module, AUE_NULL, NULL, 0, 0 },	/* 167 = linux_query_module */
+	{ AS(poll_args), (sy_call_t *)poll, AUE_POLL, NULL, 0, 0 },	/* 168 = poll */
+	{ 0, (sy_call_t *)linux_nfsservctl, AUE_NULL, NULL, 0, 0 },	/* 169 = linux_nfsservctl */
+	{ AS(linux_setresgid16_args), (sy_call_t *)linux_setresgid16, AUE_SETRESGID, NULL, 0, 0 },	/* 170 = linux_setresgid16 */
+	{ AS(linux_getresgid16_args), (sy_call_t *)linux_getresgid16, AUE_GETRESGID, NULL, 0, 0 },	/* 171 = linux_getresgid16 */
+	{ 0, (sy_call_t *)linux_prctl, AUE_PRCTL, NULL, 0, 0 },	/* 172 = linux_prctl */
+	{ AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL, NULL, 0, 0 },	/* 173 = linux_rt_sigreturn */
+	{ AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL, NULL, 0, 0 },	/* 174 = linux_rt_sigaction */
+	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0 },	/* 175 = linux_rt_sigprocmask */
+	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0 },	/* 176 = linux_rt_sigpending */
+	{ 0, (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0 },	/* 177 = linux_rt_sigtimedwait */
+	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0 },	/* 178 = linux_rt_sigqueueinfo */
+	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 179 = linux_rt_sigsuspend */
+	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0 },	/* 180 = linux_pread */
+	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0 },	/* 181 = linux_pwrite */
+	{ AS(linux_chown16_args), (sy_call_t *)linux_chown16, AUE_CHOWN, NULL, 0, 0 },	/* 182 = linux_chown16 */
+	{ AS(linux_getcwd_args), (sy_call_t *)linux_getcwd, AUE_GETCWD, NULL, 0, 0 },	/* 183 = linux_getcwd */
+	{ 0, (sy_call_t *)linux_capget, AUE_CAPGET, NULL, 0, 0 },	/* 184 = linux_capget */
+	{ 0, (sy_call_t *)linux_capset, AUE_CAPSET, NULL, 0, 0 },	/* 185 = linux_capset */
+	{ AS(linux_sigaltstack_args), (sy_call_t *)linux_sigaltstack, AUE_NULL, NULL, 0, 0 },	/* 186 = linux_sigaltstack */
+	{ 0, (sy_call_t *)linux_sendfile, AUE_SENDFILE, NULL, 0, 0 },	/* 187 = linux_sendfile */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 188 = getpmsg */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 189 = putpmsg */
+	{ 0, (sy_call_t *)linux_vfork, AUE_VFORK, NULL, 0, 0 },	/* 190 = linux_vfork */
+	{ AS(linux_getrlimit_args), (sy_call_t *)linux_getrlimit, AUE_GETRLIMIT, NULL, 0, 0 },	/* 191 = linux_getrlimit */
+	{ AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP, NULL, 0, 0 },	/* 192 = linux_mmap2 */
+	{ AS(linux_truncate64_args), (sy_call_t *)linux_truncate64, AUE_TRUNCATE, NULL, 0, 0 },	/* 193 = linux_truncate64 */
+	{ AS(linux_ftruncate64_args), (sy_call_t *)linux_ftruncate64, AUE_FTRUNCATE, NULL, 0, 0 },	/* 194 = linux_ftruncate64 */
+	{ AS(linux_stat64_args), (sy_call_t *)linux_stat64, AUE_STAT, NULL, 0, 0 },	/* 195 = linux_stat64 */
+	{ AS(linux_lstat64_args), (sy_call_t *)linux_lstat64, AUE_LSTAT, NULL, 0, 0 },	/* 196 = linux_lstat64 */
+	{ AS(linux_fstat64_args), (sy_call_t *)linux_fstat64, AUE_FSTAT, NULL, 0, 0 },	/* 197 = linux_fstat64 */
+	{ AS(linux_lchown_args), (sy_call_t *)linux_lchown, AUE_LCHOWN, NULL, 0, 0 },	/* 198 = linux_lchown */
+	{ 0, (sy_call_t *)linux_getuid, AUE_GETUID, NULL, 0, 0 },	/* 199 = linux_getuid */
+	{ 0, (sy_call_t *)linux_getgid, AUE_GETGID, NULL, 0, 0 },	/* 200 = linux_getgid */
+	{ 0, (sy_call_t *)geteuid, AUE_GETEUID, NULL, 0, 0 },		/* 201 = geteuid */
+	{ 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 },		/* 202 = getegid */
+	{ AS(setreuid_args), (sy_call_t *)setreuid, AUE_SETREUID, NULL, 0, 0 },	/* 203 = setreuid */
+	{ AS(setregid_args), (sy_call_t *)setregid, AUE_SETREGID, NULL, 0, 0 },	/* 204 = setregid */
+	{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups, AUE_GETGROUPS, NULL, 0, 0 },	/* 205 = linux_getgroups */
+	{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups, AUE_SETGROUPS, NULL, 0, 0 },	/* 206 = linux_setgroups */
+	{ AS(fchown_args), (sy_call_t *)fchown, AUE_NULL, NULL, 0, 0 },	/* 207 = fchown */
+	{ AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID, NULL, 0, 0 },	/* 208 = setresuid */
+	{ AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID, NULL, 0, 0 },	/* 209 = getresuid */
+	{ AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID, NULL, 0, 0 },	/* 210 = setresgid */
+	{ AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID, NULL, 0, 0 },	/* 211 = getresgid */
+	{ AS(linux_chown_args), (sy_call_t *)linux_chown, AUE_CHOWN, NULL, 0, 0 },	/* 212 = linux_chown */
+	{ AS(setuid_args), (sy_call_t *)setuid, AUE_SETUID, NULL, 0, 0 },	/* 213 = setuid */
+	{ AS(setgid_args), (sy_call_t *)setgid, AUE_SETGID, NULL, 0, 0 },	/* 214 = setgid */
+	{ AS(linux_setfsuid_args), (sy_call_t *)linux_setfsuid, AUE_SETFSUID, NULL, 0, 0 },	/* 215 = linux_setfsuid */
+	{ AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID, NULL, 0, 0 },	/* 216 = linux_setfsgid */
+	{ AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0 },	/* 217 = linux_pivot_root */
+	{ AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0 },	/* 218 = linux_mincore */
+	{ AS(madvise_args), (sy_call_t *)madvise, AUE_MADVISE, NULL, 0, 0 },	/* 219 = madvise */
+	{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_O_GETDENTS, NULL, 0, 0 },	/* 220 = linux_getdents64 */
+	{ AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL, NULL, 0, 0 },	/* 221 = linux_fcntl64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 222 =  */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 223 =  */
+	{ 0, (sy_call_t *)linux_gettid, AUE_NULL, NULL, 0, 0 },	/* 224 = linux_gettid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 225 = linux_readahead */
+	{ 0, (sy_call_t *)linux_setxattr, AUE_NULL, NULL, 0, 0 },	/* 226 = linux_setxattr */
+	{ 0, (sy_call_t *)linux_lsetxattr, AUE_NULL, NULL, 0, 0 },	/* 227 = linux_lsetxattr */
+	{ 0, (sy_call_t *)linux_fsetxattr, AUE_NULL, NULL, 0, 0 },	/* 228 = linux_fsetxattr */
+	{ 0, (sy_call_t *)linux_getxattr, AUE_NULL, NULL, 0, 0 },	/* 229 = linux_getxattr */
+	{ 0, (sy_call_t *)linux_lgetxattr, AUE_NULL, NULL, 0, 0 },	/* 230 = linux_lgetxattr */
+	{ 0, (sy_call_t *)linux_fgetxattr, AUE_NULL, NULL, 0, 0 },	/* 231 = linux_fgetxattr */
+	{ 0, (sy_call_t *)linux_listxattr, AUE_NULL, NULL, 0, 0 },	/* 232 = linux_listxattr */
+	{ 0, (sy_call_t *)linux_llistxattr, AUE_NULL, NULL, 0, 0 },	/* 233 = linux_llistxattr */
+	{ 0, (sy_call_t *)linux_flistxattr, AUE_NULL, NULL, 0, 0 },	/* 234 = linux_flistxattr */
+	{ 0, (sy_call_t *)linux_removexattr, AUE_NULL, NULL, 0, 0 },	/* 235 = linux_removexattr */
+	{ 0, (sy_call_t *)linux_lremovexattr, AUE_NULL, NULL, 0, 0 },	/* 236 = linux_lremovexattr */
+	{ 0, (sy_call_t *)linux_fremovexattr, AUE_NULL, NULL, 0, 0 },	/* 237 = linux_fremovexattr */
+	{ AS(linux_tkill_args), (sy_call_t *)linux_tkill, AUE_NULL, NULL, 0, 0 },	/* 238 = linux_tkill */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 239 = linux_sendfile64 */
+	{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 },	/* 240 = linux_sys_futex */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 241 = linux_sched_setaffinity */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 242 = linux_sched_getaffinity */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 243 = linux_set_thread_area */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 244 = linux_get_thread_area */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 245 = linux_io_setup */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 246 = linux_io_destroy */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 247 = linux_io_getevents */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 248 = linux_io_submit */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 249 = linux_io_cancel */
+	{ 0, (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0 },	/* 250 = linux_fadvise64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 251 =  */
+	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0 },	/* 252 = linux_exit_group */
+	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0 },	/* 253 = linux_lookup_dcookie */
+	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0 },	/* 254 = linux_epoll_create */
+	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0 },	/* 255 = linux_epoll_ctl */
+	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0 },	/* 256 = linux_epoll_wait */
+	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0 },	/* 257 = linux_remap_file_pages */
+	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0 },	/* 258 = linux_set_tid_address */
+	{ 0, (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0 },	/* 259 = linux_timer_create */
+	{ 0, (sy_call_t *)linux_timer_settime, AUE_NULL, NULL, 0, 0 },	/* 260 = linux_timer_settime */
+	{ 0, (sy_call_t *)linux_timer_gettime, AUE_NULL, NULL, 0, 0 },	/* 261 = linux_timer_gettime */
+	{ 0, (sy_call_t *)linux_timer_getoverrun, AUE_NULL, NULL, 0, 0 },	/* 262 = linux_timer_getoverrun */
+	{ 0, (sy_call_t *)linux_timer_delete, AUE_NULL, NULL, 0, 0 },	/* 263 = linux_timer_delete */
+	{ AS(linux_clock_settime_args), (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME, NULL, 0, 0 },	/* 264 = linux_clock_settime */
+	{ AS(linux_clock_gettime_args), (sy_call_t *)linux_clock_gettime, AUE_NULL, NULL, 0, 0 },	/* 265 = linux_clock_gettime */
+	{ AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0 },	/* 266 = linux_clock_getres */
+	{ AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, AUE_NULL, NULL, 0, 0 },	/* 267 = linux_clock_nanosleep */
+	{ 0, (sy_call_t *)linux_statfs64, AUE_NULL, NULL, 0, 0 },	/* 268 = linux_statfs64 */
+	{ 0, (sy_call_t *)linux_fstatfs64, AUE_NULL, NULL, 0, 0 },	/* 269 = linux_fstatfs64 */
+	{ AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 0 },	/* 270 = linux_tgkill */
+	{ 0, (sy_call_t *)linux_utimes, AUE_NULL, NULL, 0, 0 },	/* 271 = linux_utimes */
+	{ 0, (sy_call_t *)linux_fadvise64_64, AUE_NULL, NULL, 0, 0 },	/* 272 = linux_fadvise64_64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 273 =  */
+	{ 0, (sy_call_t *)linux_mbind, AUE_NULL, NULL, 0, 0 },	/* 274 = linux_mbind */
+	{ 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL, NULL, 0, 0 },	/* 275 = linux_get_mempolicy */
+	{ 0, (sy_call_t *)linux_set_mempolicy, AUE_NULL, NULL, 0, 0 },	/* 276 = linux_set_mempolicy */
+	{ 0, (sy_call_t *)linux_mq_open, AUE_NULL, NULL, 0, 0 },	/* 277 = linux_mq_open */
+	{ 0, (sy_call_t *)linux_mq_unlink, AUE_NULL, NULL, 0, 0 },	/* 278 = linux_mq_unlink */
+	{ 0, (sy_call_t *)linux_mq_timedsend, AUE_NULL, NULL, 0, 0 },	/* 279 = linux_mq_timedsend */
+	{ 0, (sy_call_t *)linux_mq_timedreceive, AUE_NULL, NULL, 0, 0 },	/* 280 = linux_mq_timedreceive */
+	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0 },	/* 281 = linux_mq_notify */
+	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0 },	/* 282 = linux_mq_getsetattr */
+	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0 },	/* 283 = linux_kexec_load */
+	{ 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0 },	/* 284 = linux_waitid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 285 =  */
+	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0 },	/* 286 = linux_add_key */
+	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0 },	/* 287 = linux_request_key */
+	{ 0, (sy_call_t *)linux_keyctl, AUE_NULL, NULL, 0, 0 },	/* 288 = linux_keyctl */
+	{ 0, (sy_call_t *)linux_ioprio_set, AUE_NULL, NULL, 0, 0 },	/* 289 = linux_ioprio_set */
+	{ 0, (sy_call_t *)linux_ioprio_get, AUE_NULL, NULL, 0, 0 },	/* 290 = linux_ioprio_get */
+	{ 0, (sy_call_t *)linux_inotify_init, AUE_NULL, NULL, 0, 0 },	/* 291 = linux_inotify_init */
+	{ 0, (sy_call_t *)linux_inotify_add_watch, AUE_NULL, NULL, 0, 0 },	/* 292 = linux_inotify_add_watch */
+	{ 0, (sy_call_t *)linux_inotify_rm_watch, AUE_NULL, NULL, 0, 0 },	/* 293 = linux_inotify_rm_watch */
+	{ 0, (sy_call_t *)linux_migrate_pages, AUE_NULL, NULL, 0, 0 },	/* 294 = linux_migrate_pages */
+	{ 0, (sy_call_t *)linux_openat, AUE_NULL, NULL, 0, 0 },	/* 295 = linux_openat */
+	{ 0, (sy_call_t *)linux_mkdirat, AUE_NULL, NULL, 0, 0 },	/* 296 = linux_mkdirat */
+	{ 0, (sy_call_t *)linux_mknodat, AUE_NULL, NULL, 0, 0 },	/* 297 = linux_mknodat */
+	{ 0, (sy_call_t *)linux_fchownat, AUE_NULL, NULL, 0, 0 },	/* 298 = linux_fchownat */
+	{ 0, (sy_call_t *)linux_futimesat, AUE_NULL, NULL, 0, 0 },	/* 299 = linux_futimesat */
+	{ 0, (sy_call_t *)linux_fstatat64, AUE_NULL, NULL, 0, 0 },	/* 300 = linux_fstatat64 */
+	{ 0, (sy_call_t *)linux_unlinkat, AUE_NULL, NULL, 0, 0 },	/* 301 = linux_unlinkat */
+	{ 0, (sy_call_t *)linux_renameat, AUE_NULL, NULL, 0, 0 },	/* 302 = linux_renameat */
+	{ 0, (sy_call_t *)linux_linkat, AUE_NULL, NULL, 0, 0 },	/* 303 = linux_linkat */
+	{ 0, (sy_call_t *)linux_symlinkat, AUE_NULL, NULL, 0, 0 },	/* 304 = linux_symlinkat */
+	{ 0, (sy_call_t *)linux_readlinkat, AUE_NULL, NULL, 0, 0 },	/* 305 = linux_readlinkat */
+	{ 0, (sy_call_t *)linux_fchmodat, AUE_NULL, NULL, 0, 0 },	/* 306 = linux_fchmodat */
+	{ 0, (sy_call_t *)linux_faccessat, AUE_NULL, NULL, 0, 0 },	/* 307 = linux_faccessat */
+	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 },	/* 308 = linux_pselect6 */
+	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 },	/* 309 = linux_ppoll */
+	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 },	/* 310 = linux_unshare */
 };
---  amd64/linux32/linux32_sysvec.c.orig
+++  amd64/linux32/linux32_sysvec.c
@@ -993,7 +993,7 @@
 struct sysentvec elf_linux_sysvec = {
 	LINUX_SYS_MAXSYSCALL,
 	linux_sysent,
-	0xff,
+	0,
 	LINUX_SIGTBLSZ,
 	bsd_to_linux_signal,
 	ELAST + 1,
---  amd64/linux32/syscalls.master.orig
+++  amd64/linux32/syscalls.master
@@ -121,7 +121,7 @@
 62	AUE_NULL	STD	{ int linux_ustat(l_dev_t dev, \
 				    struct l_ustat *ubuf); }
 63	AUE_DUP2	NOPROTO	{ int dup2(u_int from, u_int to); }
-64	AUE_GETPPID	NOPROTO	{ int getppid(void); }
+64	AUE_GETPPID	STD	{ int linux_getppid(void); }
 65	AUE_GETPGRP	NOPROTO	{ int getpgrp(void); }
 66	AUE_SETSID	NOPROTO	{ int setsid(void); }
 67	AUE_NULL	STD	{ int linux_sigaction(l_int sig, \
@@ -213,7 +213,9 @@
 118	AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
 119	AUE_SIGRETURN	STD	{ int linux_sigreturn( \
 				    struct l_sigframe *sfp); }
-120	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack); }
+; linux uses some strange calling convention here so we have to use the dummy arg
+120	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack, \
+				    void *parent_tidptr, int dummy, void * child_tidptr); }
 121	AUE_SYSCTL	NOPROTO	{ int setdomainname(char *name, \
 				    int len); }
 122	AUE_NULL	STD	{ int linux_newuname( \
@@ -382,8 +384,7 @@
 				    uintptr_t arg); }
 222	AUE_NULL	UNIMPL
 223	AUE_NULL	UNIMPL
-224	AUE_NULL	NOPROTO	{ long linux_getpid(void); } gettid \
-					linux_getpid_args void
+224	AUE_NULL	STD	{ long linux_gettid(void); }
 225	AUE_NULL	UNIMPL	linux_readahead
 226	AUE_NULL	STD	{ int linux_setxattr(void); }
 227	AUE_NULL	STD	{ int linux_lsetxattr(void); }
@@ -397,9 +398,10 @@
 235	AUE_NULL	STD	{ int linux_removexattr(void); }
 236	AUE_NULL	STD	{ int linux_lremovexattr(void); }
 237	AUE_NULL	STD	{ int linux_fremovexattr(void); }
-238	AUE_NULL	UNIMPL	linux_tkill
+238	AUE_NULL	STD	{ int linux_tkill(int tid, int sig); }
 239	AUE_SENDFILE	UNIMPL	linux_sendfile64
-240	AUE_NULL	UNIMPL	linux_futex
+240	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
+					struct l_timespec *timeout, void *uaddr2, int val3); }
 241	AUE_NULL	UNIMPL	linux_sched_setaffinity
 242	AUE_NULL	UNIMPL	linux_sched_getaffinity
 243	AUE_NULL	UNIMPL	linux_set_thread_area
@@ -411,26 +413,26 @@
 249	AUE_NULL	UNIMPL	linux_io_cancel
 250	AUE_NULL	STD	{ int linux_fadvise64(void); }
 251	AUE_NULL	UNIMPL
-252	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit_group \
-				    sys_exit_args void
+252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
 253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
 254	AUE_NULL	STD	{ int linux_epoll_create(void); }
 255	AUE_NULL	STD	{ int linux_epoll_ctl(void); }
 256	AUE_NULL	STD	{ int linux_epoll_wait(void); }
 257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
-258	AUE_NULL	STD	{ int linux_set_tid_address(void); }
+258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
 259	AUE_NULL	STD	{ int linux_timer_create(void); }
 260	AUE_NULL	STD	{ int linux_timer_settime(void); }
 261	AUE_NULL	STD	{ int linux_timer_gettime(void); }
 262	AUE_NULL	STD	{ int linux_timer_getoverrun(void); }
 263	AUE_NULL	STD	{ int linux_timer_delete(void); }
-264	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(void); }
-265	AUE_NULL	STD	{ int linux_clock_gettime(void); }
-266	AUE_NULL	STD	{ int linux_clock_getres(void); }
-267	AUE_NULL	STD	{ int linux_clock_nanosleep(void); }
+264	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(clockid_t which, struct l_timespec *tp); }
+265	AUE_NULL	STD	{ int linux_clock_gettime(clockid_t which, struct l_timespec *tp); }
+266	AUE_NULL	STD	{ int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
+267	AUE_NULL	STD	{ int linux_clock_nanosleep(clockid_t which, int flags, \
+					struct l_timespec *rqtp, struct l_timespec *rmtp); }
 268	AUE_NULL	STD	{ int linux_statfs64(void); }
 269	AUE_NULL	STD	{ int linux_fstatfs64(void); }
-270	AUE_NULL	STD	{ int linux_tgkill(void); }
+270	AUE_NULL	STD	{ int linux_tgkill(int tgid, int pid, int sig); }
 271	AUE_NULL	STD	{ int linux_utimes(void); }
 272	AUE_NULL	STD	{ int linux_fadvise64_64(void); }
 273	AUE_NULL	UNIMPL
--- /dev/null	Mon Aug 14 18:44:00 2006
+++ compat/linux/linux_emul.c	Mon Aug 14 18:46:20 2006
@@ -0,0 +1,297 @@
+/*-
+ * 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$");
+
+#include "opt_compat.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/imgact.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 sx 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_UNLOCKED)
+   		EMUL_LOCK(&emul_lock);
+
+	em = p->p_emuldata;	   	
+
+	if (em == NULL && locked == EMUL_UNLOCKED)
+	   	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 */
+   		MALLOC(em, struct linux_emuldata *, sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
+		em->pid = child;
+		if (flags & CLONE_VM) {
+		   	/* handled later in the code */
+		} else {
+		   	struct linux_emuldata_shared *s;
+
+   			MALLOC(s, struct linux_emuldata_shared *, sizeof *s, M_LINUX, M_WAITOK | M_ZERO);
+			em->shared = s;
+			s->refs = 1;
+			s->group_pid = child;
+
+			LIST_INIT(&s->threads);
+		}
+		p = pfind(child);
+		if (p == NULL)
+		   	panic("process not found in proc_init\n");
+		p->p_emuldata = em;
+		PROC_UNLOCK(p);
+	} else {
+		/* lookup the old one */
+		em = em_find(td->td_proc, EMUL_UNLOCKED);
+		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 & CLONE_VM) {
+   		   	/* lookup the parent */
+		   	p_em = em_find(td->td_proc, EMUL_LOCKED);
+			KASSERT(p_em != NULL, ("proc_init: parent emuldata not found for CLONE_VM\n"));
+			em->shared = p_em->shared;
+			em->shared->refs++;
+		} 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);
+		PROC_UNLOCK(p);
+		/* we might have a sleeping linux_schedtail */
+		wakeup(&p->p_emuldata);
+	} 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;
+
+	if (__predict_true(p->p_sysent != &elf_linux_sysvec))
+	   	return;
+
+	/* find the emuldata */
+	em = em_find(p, EMUL_UNLOCKED);
+
+	KASSERT(em != NULL, ("proc_exit: emuldata not found.\n"));
+
+	child_clear_tid = em->child_clear_tid;
+	
+	EMUL_UNLOCK(&emul_lock);
+
+	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)
+		FREE(em->shared, M_LINUX);
+	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)
+		   	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 mean there is a userspace bug
+		*/
+		if (error)
+		   	printf(LMSG("futex stuff in proc_exit failed.\n"));
+	}
+
+	/* clean the stuff up */
+	FREE(em, M_LINUX);
+}
+
+/* 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;
+
+		em = em_find(p, EMUL_UNLOCKED);
+
+		KASSERT(em != NULL, ("proc_exec: emuldata not found.\n"));
+		
+		EMUL_UNLOCK(&emul_lock);
+
+		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)
+		   	FREE(em->shared, M_LINUX);
+		EMUL_SHARED_WUNLOCK(&emul_shared_lock);
+
+		FREE(em, M_LINUX);
+	}
+}
+
+extern int hz;		/* in subr_param.c */
+
+void
+linux_schedtail(void *arg __unused, struct proc *p)
+{
+	struct linux_emuldata *em;
+	int error = 0;
+#ifdef	DEBUG
+	struct thread *td = FIRST_THREAD_IN_PROC(p);
+#endif
+	int *child_set_tid;
+
+	if (p->p_sysent != &elf_linux_sysvec)
+	   	return;
+
+retry:	
+	/* find the emuldata */
+	em = em_find(p, EMUL_UNLOCKED);
+
+	if (em == NULL) {
+	   	/* We might have been called before proc_init for this process so
+		 * tsleep and be woken up by it. We use p->p_emuldata for this
+		 */
+
+	   	error = tsleep(&p->p_emuldata, PLOCK, "linux_schedtail", hz);
+		if (error == 0)
+		   	goto retry;
+	   	panic("no emuldata found for userreting process.\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_UNLOCKED);
+
+	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	Mon Aug 14 18:44:00 2006
+++ compat/linux/linux_emul.h	Mon Aug 14 18:46:21 2006
@@ -0,0 +1,74 @@
+/*-
+ * 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$
+ */
+
+#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;
+
+	LIST_ENTRY(linux_emuldata) threads;	/* list of linux threads */
+};
+
+struct linux_emuldata *em_find(struct proc *, int locked);
+
+#define EMUL_LOCK(l)	sx_xlock(l)
+#define EMUL_UNLOCK(l)	sx_xunlock(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_LOCKED		1
+#define EMUL_UNLOCKED		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 *);
+
+#endif /* !_LINUX_EMUL_H_ */
--- /dev/null	Mon Aug 14 18:44:00 2006
+++ compat/linux/linux_futex.c	Mon Aug 14 18:46:22 2006
@@ -0,0 +1,500 @@
+/*	$NetBSD: linux_futex.c,v 1.5 2005/11/23 16:14:57 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$");
+#if 0
+ __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.5 2005/11/23 16:14:57 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/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 mtx futex_mtx;		/* this protects the LIST of futexes */
+
+#define FUTEX_LOCK mtx_lock(&futex_mtx)
+#define FUTEX_UNLOCK mtx_unlock(&futex_mtx)
+
+#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 *);
+#ifdef __i386__
+static int futex_atomic_op(struct thread *td, int encoded_op, caddr_t uaddr);
+#endif 
+
+/* 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_andnl(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};
+#ifdef __i386__
+	struct futex *f2;
+	int op_ret;
+#endif
+
+#ifdef	DEBUG
+	if (ldebug(sys_futex))
+	   	printf(ARGS(futex,"%p, %i, %i"), args->uaddr, args->op, args->val);
+#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.%09ld\n", 
+		    		td->td_proc->p_pid, args->val, 
+		    		args->uaddr, val, timeout.tv_sec, 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 cope with different addresses 
+		 * corresponding to the same mapped memory in the sleeping 
+		 * and the waker process.
+		 */
+#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);
+		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);
+		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);
+		futex_put(f);
+		futex_put(newf);
+		
+		FUTEX_SYSTEM_UNLOCK;
+		break;
+
+	case LINUX_FUTEX_FD:
+		printf("linux_sys_futex: unimplemented op %d\n", 
+		    args->op);
+		break;
+
+	case LINUX_FUTEX_WAKE_OP:
+#ifdef	__i386__
+		FUTEX_SYSTEM_LOCK;
+#ifdef DEBUG
+		if (ldebug(sys_futex))
+   		   	printf("FUTEX_WAKE_OP: %d: uaddr = %p, op = %d, val = %d, uaddr2 = %p, val3 = %d\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);
+		if (op_ret < 0) {
+
+		   	/* XXX: we dont 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);
+		futex_put(f);
+		if (op_ret > 0) {
+		   	printf("second wakeup\n");
+		   	op_ret = 0;
+		   	/* Linux always puts there 0 retries */
+   		   	op_ret += futex_wake(f2, 0, NULL);
+			ret += op_ret;
+		}
+		futex_put(f2);
+		td->td_retval[0] = ret;
+
+		FUTEX_SYSTEM_UNLOCK;
+#else
+		printf("linux_sys_futex: wake_op not implemented");
+#endif
+	   	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;
+		}
+	}
+	if (locked == FUTEX_UNLOCKED)
+   	   	FUTEX_UNLOCK;
+
+	/* Not found, create it */
+	f = malloc(sizeof(*f), M_LINUX, M_WAITOK);
+	f->f_uaddr = uaddr;
+	f->f_refcount = 1;
+	TAILQ_INIT(&f->f_waiting_proc);
+	if (locked == FUTEX_UNLOCKED)
+   	   	FUTEX_LOCK;
+	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);
+
+	FUTEX_LOCK;
+	TAILQ_REMOVE(&f->f_waiting_proc, wp, wp_list);
+	FUTEX_UNLOCK;
+
+	if ((ret == 0) && (wp->wp_new_futex != NULL)) {
+		ret = futex_sleep(wp->wp_new_futex, td, timeout);
+		futex_put(wp->wp_new_futex); /* futex_get called in wakeup */
+	}
+
+	free(wp, M_LINUX);
+
+	return ret;
+}
+
+static int
+futex_wake(struct futex *f, int n, struct futex *newf)
+{
+	struct waiting_proc *wp;
+	int count = 0; 
+
+	FUTEX_LOCK;
+	TAILQ_FOREACH(wp, &f->f_waiting_proc, wp_list) {
+		if (count <= n) {
+			wakeup(wp);
+			count++;
+		} else {
+			if (newf != NULL) {
+				/* futex_put called after tsleep */
+				wp->wp_new_futex = futex_get(newf->f_uaddr, FUTEX_LOCKED);
+				wakeup(wp);
+			}
+		}
+	}
+	FUTEX_UNLOCK;
+
+	return count;
+}
+
+#ifdef __i386__
+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	
+	printf("futex_atomic_op: op = %d, cmp = %d, oparg = %d, cmparg = %d, uaddr = %p\n",
+	      op, cmp, oparg, cmparg, uaddr);
+#endif
+	/* XXX: linux verifies access here and returns EFAULT */
+
+	critical_enter();
+
+	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_andnl(oparg, uaddr, &oldval);
+			break;
+		case FUTEX_OP_XOR:
+			ret = futex_xorl(oparg, uaddr, &oldval);
+			break;
+		default:
+			ret = -ENOSYS;
+	}
+
+	critical_exit();
+
+	if (!ret)
+	   	switch (cmp) {
+		      case FUTEX_OP_CMP_EQ: 
+			 	ret = (oldval == cmparg); 
+				break;
+		      case FUTEX_OP_CMP_NE: 
+				ret = (oldval != cmparg); 
+				break;
+		      case FUTEX_OP_CMP_LT: 
+				ret = (oldval < cmparg); 
+				break;
+		      case FUTEX_OP_CMP_GE: 
+				ret = (oldval >= cmparg); 
+				break;
+		      case FUTEX_OP_CMP_LE: 
+				ret = (oldval <= cmparg); 
+				break;
+		      case FUTEX_OP_CMP_GT: 
+				ret = (oldval > cmparg); 
+				break;
+		      default: ret = -ENOSYS;
+		}
+
+	return (ret);
+}
+#endif
--- /dev/null	Mon Aug 14 18:44:00 2006
+++ compat/linux/linux_futex.h	Mon Aug 14 18:46:24 2006
@@ -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$
+ */
+
+#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 */
--- compat/linux/linux_mib.c.orig
+++ compat/linux/linux_mib.c
@@ -81,7 +81,7 @@
 	    0, 0, linux_sysctl_osname, "A",
 	    "Linux kernel OS name");
 
-static char	linux_osrelease[LINUX_MAX_UTSNAME] = "2.4.2";
+static char	linux_osrelease[LINUX_MAX_UTSNAME] = "2.6.16";
 
 static int
 linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS)
--- compat/linux/linux_misc.c.orig
+++ compat/linux/linux_misc.c
@@ -74,6 +74,7 @@
 #include <posix4/sched.h>
 
 #include <compat/linux/linux_sysproto.h>
+#include <compat/linux/linux_emul.h>
 
 #ifdef COMPAT_LINUX32
 #include <machine/../linux32/linux.h>
@@ -93,6 +94,9 @@
 #define BSD_TO_LINUX_SIGNAL(sig)	\
 	(((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
 
+extern struct sx emul_shared_lock;
+extern struct sx emul_lock;
+
 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,
@@ -1330,11 +1334,69 @@
 int
 linux_getpid(struct thread *td, struct linux_getpid_args *args)
 {
+   	struct linux_emuldata *em;
+
+	em = em_find(td->td_proc, EMUL_UNLOCKED);
 
+	KASSERT(em != NULL, ("getpid: emuldata not found.\n"));
+
+	td->td_retval[0] = em->shared->group_pid;
+	EMUL_UNLOCK(&emul_lock);
+	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;
+
+	em = em_find(td->td_proc, EMUL_UNLOCKED);
+
+	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_LOCKED);
+		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;
+
+	EMUL_UNLOCK(&emul_lock);
+	PROC_UNLOCK(pp);
+
+	return (0);
+}
+
 int
 linux_getgid(struct thread *td, struct linux_getgid_args *args)
 {
@@ -1394,3 +1456,39 @@
 		 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
+
+	td_em = em_find(td->td_proc, EMUL_UNLOCKED);
+
+	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);
+	EMUL_UNLOCK(&emul_lock);
+
+	exit1(td, W_EXITCODE(args->error_code,0));
+
+   	return (0);
+}
+
--- compat/linux/linux_signal.c.orig
+++ compat/linux/linux_signal.c
@@ -49,6 +49,10 @@
 #endif
 #include <compat/linux/linux_signal.h>
 #include <compat/linux/linux_util.h>
+#include <compat/linux/linux_emul.h>
+
+extern struct sx emul_shared_lock;
+extern struct sx emul_lock;
 
 void
 linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
@@ -447,3 +451,57 @@
 	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_UNLOCKED);
+
+	if (em == NULL) {
+#ifdef DEBUG
+		printf("emuldata not found in tgkill.\n");
+#endif
+		return ESRCH;
+	}
+
+	if (em->shared->group_pid != args->tgid)
+	   	return ESRCH;
+
+	EMUL_UNLOCK(&emul_lock);
+
+	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));
+}
--- /dev/null	Mon Aug 14 18:44:00 2006
+++ compat/linux/linux_time.c	Mon Aug 14 18:46:25 2006
@@ -0,0 +1,208 @@
+/*	$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$");
+#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 void 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 void
+linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp)
+{
+	ntp->tv_sec = ltp->tv_sec;
+	ntp->tv_nsec = ltp->tv_nsec;
+}
+
+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:
+		return EINVAL;
+	}
+
+	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(&lts, &tp);
+
+	return copyout(&lts, 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, &lts, sizeof lts);
+	if (error != 0)
+		return error;
+
+	linux_to_native_timespec(&ts, &lts);
+
+	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(&lts, &ts);
+	
+	return copyout(&lts, args->tp, sizeof lts);
+}
+
+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;
+
+	linux_to_native_timespec(&rqts, &lrqts);
+
+	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;
+}
--- compat/linux/linux_util.c.orig
+++ compat/linux/linux_util.c
@@ -32,6 +32,8 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD: src/sys/compat/linux/linux_util.c,v 1.30 2006/05/05 16:10:45 ambrisko Exp $");
 
+#include "opt_compat.h"
+
 #include <sys/param.h>
 #include <sys/bus.h>
 #include <sys/lock.h>
@@ -47,6 +49,11 @@
 #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";
 
@@ -85,8 +92,6 @@
 	printf("\n");
 }
 
-MALLOC_DECLARE(M_LINUX);
-
 struct device_element
 {
 	TAILQ_ENTRY(device_element) list;
--- conf/files.amd64.orig
+++ conf/files.amd64
@@ -233,7 +233,9 @@
 amd64/linux32/linux32_machdep.c	optional	compat_linux32
 amd64/linux32/linux32_sysent.c	optional	compat_linux32
 amd64/linux32/linux32_sysvec.c	optional	compat_linux32
+compat/linux/linux_emul.c       optional	compat_linux32
 compat/linux/linux_file.c	optional	compat_linux32
+compat/linux/linux_futex.c	optional	compat_linux32
 compat/linux/linux_getcwd.c	optional	compat_linux32
 compat/linux/linux_ioctl.c	optional	compat_linux32
 compat/linux/linux_ipc.c	optional	compat_linux32
@@ -243,6 +245,7 @@
 compat/linux/linux_socket.c	optional	compat_linux32
 compat/linux/linux_stats.c	optional	compat_linux32
 compat/linux/linux_sysctl.c	optional	compat_linux32
+compat/linux/linux_time.c	optional	compat_linux32
 compat/linux/linux_uid16.c	optional	compat_linux32
 compat/linux/linux_util.c	optional	compat_linux32
 dev/amr/amr_linux.c		optional	compat_linux32 amr
--- conf/files.i386.orig
+++ conf/files.i386
@@ -85,7 +85,9 @@
 #
 compat/linprocfs/linprocfs.c	optional linprocfs
 compat/linsysfs/linsysfs.c	optional linsysfs
+compat/linux/linux_emul.c	optional compat_linux
 compat/linux/linux_file.c	optional compat_linux
+compat/linux/linux_futex.c	optional compat_linux
 compat/linux/linux_getcwd.c	optional compat_linux
 compat/linux/linux_ioctl.c	optional compat_linux
 compat/linux/linux_ipc.c	optional compat_linux
@@ -95,6 +97,7 @@
 compat/linux/linux_socket.c	optional compat_linux
 compat/linux/linux_stats.c	optional compat_linux
 compat/linux/linux_sysctl.c	optional compat_linux
+compat/linux/linux_time.c	optional compat_linux
 compat/linux/linux_uid16.c	optional compat_linux
 compat/linux/linux_util.c	optional compat_linux
 compat/ndis/kern_ndis.c		optional ndisapi pci
--- i386/i386/support.s.orig
+++ i386/i386/support.s
@@ -1522,6 +1522,12 @@
 bbhead:
 	.long 0
 
+#if defined(SMP) || !defined(_KERNEL)
+#define MPLOCKED        lock ;
+#else
+#define MPLOCKED
+#endif
+
 	.text
 NON_GPROF_ENTRY(__bb_init_func)
 	movl	4(%esp),%eax
@@ -1530,3 +1536,108 @@
 	movl	%edx,16(%eax)
 	movl	%eax,bbhead
 	NON_GPROF_RET
+
+/* necessary for linux_futex support */
+	.text
+
+futex_fault:
+	movl	PCPU(CURPCB), %edx
+	movl	$0, PCB_ONFAULT(%edx)
+	movl	$-EFAULT, %eax
+	ret
+
+/* int futex_xchgl(int oparg, caddr_t uaddr, int *oldval); */
+	.globl	futex_xchgl
+futex_xchgl:
+	movl	PCPU(CURPCB), %eax
+	movl	$futex_fault, PCB_ONFAULT(%eax)
+	movl	4(%esp), %eax
+	movl	8(%esp), %edx
+	cmpl    $VM_MAXUSER_ADDRESS,%edx
+	ja     	futex_fault
+
+	MPLOCKED xchgl	%eax, (%edx)
+	movl	0xc(%esp), %edx
+	movl	%eax, (%edx)
+	xorl	%eax, %eax
+
+	movl	PCPU(CURPCB), %edx	
+	movl	$0, PCB_ONFAULT(%edx)
+	ret
+
+/* int futex_addl(int oparg, caddr_t uaddr, int *oldval); */
+	.globl	futex_addl
+futex_addl:
+	movl	PCPU(CURPCB), %eax
+	movl	$futex_fault, PCB_ONFAULT(%eax)
+	movl	4(%esp), %eax
+	movl	8(%esp), %edx
+	cmpl    $VM_MAXUSER_ADDRESS,%edx
+	ja     	futex_fault
+
+	MPLOCKED xaddl	%eax, (%edx)
+	movl	0xc(%esp), %edx
+	movl	%eax, (%edx)
+	xorl	%eax, %eax
+
+	movl	PCPU(CURPCB), %edx
+	movl	$0, PCB_ONFAULT(%edx)
+	ret
+
+/* int futex_orl(int oparg, caddr_t uaddr, int *oldval); */
+	.globl	futex_orl
+futex_orl:
+	movl	PCPU(CURPCB), %eax
+	movl	$futex_fault, PCB_ONFAULT(%eax)
+	movl	4(%esp), %eax
+	movl	8(%esp), %edx
+	cmpl    $VM_MAXUSER_ADDRESS,%edx
+	ja     	futex_fault
+
+	MPLOCKED orl 	%eax, (%edx)
+	movl	0xc(%esp), %edx
+	movl	%eax, (%edx)
+	xorl	%eax, %eax
+
+	movl	PCPU(CURPCB), %edx
+	movl	$0, PCB_ONFAULT(%edx)
+	ret
+
+/* int futex_andnl(int oparg, caddr_t uaddr, int *oldval); */
+	.globl	futex_andnl
+futex_andnl:
+	movl	PCPU(CURPCB), %eax
+	movl	$futex_fault, PCB_ONFAULT(%eax)
+	movl	4(%esp), %eax
+	movl	8(%esp), %edx
+	cmpl    $VM_MAXUSER_ADDRESS,%edx
+	ja     	futex_fault
+
+	notl	(%edx)
+	MPLOCKED andl 	%eax, (%edx)
+	movl	0xc(%esp), %edx
+	movl	%eax, (%edx)
+	xorl	%eax, %eax
+
+	movl	PCPU(CURPCB), %edx
+	movl	$0, PCB_ONFAULT(%edx)
+	ret
+
+/* int futex_xorl(int oparg, caddr_t uaddr, int *oldval); */
+	.globl	futex_xorl
+futex_xorl:
+	movl	PCPU(CURPCB), %eax
+	movl	$futex_fault, PCB_ONFAULT(%eax)
+	movl	4(%esp), %eax
+	movl	8(%esp), %edx
+	cmpl    $VM_MAXUSER_ADDRESS,%edx
+	ja     	futex_fault
+
+	MPLOCKED xorl 	%eax, (%edx)
+	movl	0xc(%esp), %edx
+	movl	%eax, (%edx)
+	xorl	%eax, %eax
+
+	movl	PCPU(CURPCB), %edx
+	movl	$0, PCB_ONFAULT(%edx)
+	ret
--- i386/linux/linux.h.orig
+++ i386/linux/linux.h
@@ -32,6 +32,10 @@
 #define	_I386_LINUX_LINUX_H_
 
 #include <sys/signal.h> /* for sigval union */
+#include <sys/param.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/sx.h>
 
 #include <i386/linux/linux_syscall.h>
 
@@ -706,4 +710,99 @@
 	l_short		revents;
 };
 
+struct l_user_desc {
+	l_uint		entry_number;
+	l_uint		base_addr;
+	l_uint		limit;
+	l_uint		seg_32bit:1;
+	l_uint		contents:2;
+	l_uint		read_exec_only:1;
+	l_uint		limit_in_pages:1;
+	l_uint		seg_not_present:1;
+	l_uint		useable:1;
+};
+
+struct l_desc_struct {
+           unsigned long a,b;
+};
+
+
+#define LINUX_LOWERWORD	0x0000ffff
+
+/* macros which does the same thing as those in linux include/asm-um/ldt-i386.h 
+ * these convert linux user-space descriptor to machine one
+ */
+#define LDT_entry_a(info) \
+        ((((info)->base_addr & LINUX_LOWERWORD) << 16) | ((info)->limit & LINUX_LOWERWORD))
+
+#define ENTRY_B_READ_EXEC_ONLY	9
+#define ENTRY_B_CONTENTS	10
+#define ENTRY_B_SEG_NOT_PRESENT	15
+#define ENTRY_B_BASE_ADDR	16
+#define ENTRY_B_USEABLE		20
+#define ENTRY_B_SEG32BIT	22
+#define ENTRY_B_LIMIT		23
+
+#define LDT_entry_b(info) \
+        (((info)->base_addr & 0xff000000) | \
+        ((info)->limit & 0xf0000) | \
+        ((info)->contents << ENTRY_B_CONTENTS) | \
+        (((info)->seg_not_present == 0) << ENTRY_B_SEG_NOT_PRESENT) | \
+        (((info)->base_addr & 0x00ff0000) >> ENTRY_B_BASE_ADDR) | \
+        (((info)->read_exec_only == 0) << ENTRY_B_READ_EXEC_ONLY) | \
+        ((info)->seg_32bit << ENTRY_B_SEG32BIT) | \
+        ((info)->useable << ENTRY_B_USEABLE) | \
+        ((info)->limit_in_pages << ENTRY_B_LIMIT) | 0x7000)
+
+#define LDT_empty(info) (\
+        (info)->base_addr       == 0    && \
+        (info)->limit           == 0    && \
+        (info)->contents        == 0    && \
+        (info)->seg_not_present == 1    && \
+        (info)->read_exec_only  == 1    && \
+        (info)->seg_32bit       == 0    && \
+        (info)->limit_in_pages  == 0    && \
+        (info)->useable         == 0    )
+
+/* macros for converting segments, they do the same as those in arch/i386/kernel/process.c */
+#define GET_BASE(desc) ( \
+        (((desc)->a >> 16) & LINUX_LOWERWORD) | \
+        (((desc)->b << 16) & 0x00ff0000) | \
+        ( (desc)->b        & 0xff000000)   )
+
+#define GET_LIMIT(desc) ( \
+        ((desc)->a & LINUX_LOWERWORD) | \
+         ((desc)->b & 0xf0000) )
+
+#define GET_32BIT(desc)         (((desc)->b >> ENTRY_B_SEG32BIT) & 1)
+#define GET_CONTENTS(desc)      (((desc)->b >> ENTRY_B_CONTENTS) & 3)
+#define GET_WRITABLE(desc)      (((desc)->b >> ENTRY_B_READ_EXEC_ONLY) & 1)
+#define GET_LIMIT_PAGES(desc)   (((desc)->b >> ENTRY_B_LIMIT) & 1)
+#define GET_PRESENT(desc)       (((desc)->b >> ENTRY_B_SEG_NOT_PRESENT) & 1)
+#define GET_USEABLE(desc)       (((desc)->b >> ENTRY_B_USEABLE) & 1)
+
+#define LINUX_CLOCK_REALTIME            0
+#define LINUX_CLOCK_MONOTONIC           1
+#define LINUX_CLOCK_PROCESS_CPUTIME_ID  2
+#define LINUX_CLOCK_THREAD_CPUTIME_ID   3
+#define LINUX_CLOCK_REALTIME_HR         4
+#define LINUX_CLOCK_MONOTONIC_HR        5
+
+typedef int l_timer_t;
+typedef int l_mqd_t;
+
+#define CLONE_VM        0x100
+#define CLONE_FS        0x200
+#define CLONE_FILES     0x400
+#define CLONE_SIGHAND   0x800
+#define CLONE_PID       0x1000          /* this flag does not exist in linux anymore */
+#define CLONE_PARENT    0x00008000
+#define CLONE_THREAD    0x10000
+#define CLONE_SETTLS    0x80000
+#define CLONE_CHILD_CLEARTID    0x00200000
+#define CLONE_CHILD_SETTID      0x01000000
+#define CLONE_PARENT_SETTID     0x00100000
+
+#define THREADING_FLAGS (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
+
 #endif /* !_I386_LINUX_LINUX_H_ */
--- i386/linux/linux_dummy.c.orig
+++ i386/linux/linux_dummy.c
@@ -61,7 +61,7 @@
 DUMMY(rt_sigqueueinfo);
 DUMMY(capget);
 DUMMY(capset);
-DUMMY(sendfile);
+DUMMY(sendfile);		/* different semantics */
 DUMMY(truncate64);
 DUMMY(setfsuid);
 DUMMY(setfsgid);
@@ -73,30 +73,13 @@
 DUMMY(epoll_ctl);
 DUMMY(epoll_wait);
 DUMMY(remap_file_pages);
-DUMMY(set_tid_address);
-DUMMY(timer_create);
-DUMMY(timer_settime);
-DUMMY(timer_gettime);
-DUMMY(timer_getoverrun);
-DUMMY(timer_delete);
-DUMMY(clock_settime);
-DUMMY(clock_gettime);
-DUMMY(clock_getres);
-DUMMY(clock_nanosleep);
 DUMMY(statfs64);
 DUMMY(fstatfs64);
-DUMMY(tgkill);
 DUMMY(utimes);
 DUMMY(fadvise64_64);
 DUMMY(mbind);
 DUMMY(get_mempolicy);
 DUMMY(set_mempolicy);
-DUMMY(mq_open);
-DUMMY(mq_unlink);
-DUMMY(mq_timedsend);
-DUMMY(mq_timedreceive);
-DUMMY(mq_notify);
-DUMMY(mq_getsetattr);
 DUMMY(kexec_load);
 DUMMY(waitid);
 DUMMY(add_key);
--- i386/linux/linux_machdep.c.orig
+++ i386/linux/linux_machdep.c
@@ -36,13 +36,16 @@
 #include <sys/malloc.h>
 #include <sys/mman.h>
 #include <sys/mutex.h>
+#include <sys/sx.h>
 #include <sys/proc.h>
+#include <sys/queue.h>
 #include <sys/resource.h>
 #include <sys/resourcevar.h>
 #include <sys/signalvar.h>
 #include <sys/syscallsubr.h>
 #include <sys/sysproto.h>
 #include <sys/unistd.h>
+#include <sys/wait.h>
 
 #include <machine/frame.h>
 #include <machine/psl.h>
@@ -58,6 +61,16 @@
 #include <compat/linux/linux_ipc.h>
 #include <compat/linux/linux_signal.h>
 #include <compat/linux/linux_util.h>
+#include <compat/linux/linux_emul.h>
+
+#include <i386/include/pcb.h>			/* needed for pcb definition in linux_set_thread_area */
+
+#include "opt_posix.h"
+
+extern struct sx emul_shared_lock;
+extern struct sx emul_lock;
+
+extern struct sysentvec elf32_freebsd_sysvec;	/* defined in i386/i386/elf_machdep.c */
 
 struct l_descriptor {
 	l_uint		entry_number;
@@ -122,6 +135,14 @@
 	free(newpath, M_TEMP);
 	if (error == 0)
 		error = kern_execve(td, &eargs, NULL);
+	if (error == 0)
+	   	/* linux process can exec fbsd one, dont attempt
+		 * to create emuldata for such process using
+		 * linux_proc_init, this leads to a panic on KASSERT
+		 * because such process has p->p_emuldata == NULL
+		 */
+	   	if (td->td_proc->p_sysent == &elf_linux_sysvec)
+   		   	error = linux_proc_init(td, 0, 0);
 	return (error);
 }
 
@@ -287,6 +308,10 @@
 
 	if (td->td_retval[1] == 1)
 		td->td_retval[0] = 0;
+	error = linux_proc_init(td, td->td_retval[0], 0);
+	if (error)
+		return (error);
+
 	return (0);
 }
 
@@ -305,18 +330,12 @@
 	/* Are we the child? */
 	if (td->td_retval[1] == 1)
 		td->td_retval[0] = 0;
+	error = linux_proc_init(td, td->td_retval[0], 0);
+	if (error)
+		return (error);
 	return (0);
 }
 
-#define CLONE_VM	0x100
-#define CLONE_FS	0x200
-#define CLONE_FILES	0x400
-#define CLONE_SIGHAND	0x800
-#define CLONE_PID	0x1000
-#define CLONE_THREAD	0x10000
-
-#define THREADING_FLAGS	(CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)
-
 int
 linux_clone(struct thread *td, struct linux_clone_args *args)
 {
@@ -324,19 +343,16 @@
 	struct proc *p2;
 	struct thread *td2;
 	int exit_signal;
+	struct linux_emuldata *em;
 
 #ifdef DEBUG
 	if (ldebug(clone)) {
-		printf(ARGS(clone, "flags %x, stack %x"),
-		    (unsigned int)args->flags, (unsigned int)args->stack);
-		if (args->flags & CLONE_PID)
-			printf(LMSG("CLONE_PID not yet supported"));
+   	   	printf(ARGS(clone, "flags %x, stack %x, parent tid: %x, child tid: %x"),
+		    (unsigned int)args->flags, (unsigned int)args->stack, 
+		    (unsigned int)args->parent_tidptr, (unsigned int)args->child_tidptr);
 	}
 #endif
 
-	if (!args->stack)
-		return (EINVAL);
-
 	exit_signal = args->flags & 0x000000ff;
 	if (exit_signal >= LINUX_NSIG)
 		return (EINVAL);
@@ -371,12 +387,118 @@
 	if (error)
 		return (error);
 	
+	/* create the emuldata */
+	error = linux_proc_init(td, p2->p_pid, args->flags);
+	/* reference it - no need to check this */
+	em = em_find(p2, EMUL_UNLOCKED);
+	KASSERT(em != NULL, ("clone: emuldata not found.\n"));
+	/* and adjust it */
+	if (args->flags & CLONE_PARENT_SETTID) {
+	   	if (args->parent_tidptr == NULL) {
+		   	EMUL_UNLOCK(&emul_lock);
+			return (EINVAL);
+		}
+		error = copyout(&p2->p_pid, args->parent_tidptr, sizeof(p2->p_pid));
+		if (error) {
+		   	EMUL_UNLOCK(&emul_lock);
+			return (error);
+		}
+	}
+
+	if (args->flags & CLONE_PARENT) {
+#ifdef DEBUG
+	   	printf("linux_clone: CLONE_PARENT\n");
+#endif
+	}
+	   	
+	if (args->flags & CLONE_THREAD) {
+	   	/* XXX: linux mangles pgrp and pptr somehow
+		 * I think it might be this but I am not sure.
+		 */
+#ifdef notyet
+	   	p2->p_pgrp = td->td_proc->p_pgrp;
+	 	p2->p_pptr = td->td_proc->p_pptr;
+#endif
+	 	exit_signal = 0;
+#ifdef DEBUG
+	   	printf("linux_clone: CLONE_THREADS\n");
+#endif
+	}
+
+	if (args->flags & CLONE_CHILD_SETTID)
+		em->child_set_tid = args->child_tidptr;
+	else
+	   	em->child_set_tid = NULL;
+
+	if (args->flags & CLONE_CHILD_CLEARTID)
+		em->child_clear_tid = args->child_tidptr;
+	else
+	   	em->child_clear_tid = NULL;
+	EMUL_UNLOCK(&emul_lock);
 
 	PROC_LOCK(p2);
 	p2->p_sigparent = exit_signal;
 	PROC_UNLOCK(p2);
 	td2 = FIRST_THREAD_IN_PROC(p2);
-	td2->td_frame->tf_esp = (unsigned int)args->stack;
+	/* in a case of stack = NULL we are supposed to COW calling process stack
+	 * this is what normal fork() does so we just keep the tf_esp arg intact
+	 */
+	if (args->stack)
+   	   	td2->td_frame->tf_esp = (unsigned int)args->stack;
+
+	if (args->flags & CLONE_SETTLS) {
+   	   	struct l_user_desc info;
+   	   	int idx;
+	   	int a[2];
+		struct segment_descriptor sd;
+
+	   	error = copyin((void *)td->td_frame->tf_esi, &info, sizeof(struct l_user_desc));
+		if (error)
+   		   	return (error);
+		
+		idx = info.entry_number;
+		
+		/* looks like we're getting the idx we returned
+		 * in the set_thread_area() syscall
+		 */
+		if (idx != 6 && idx != 3)
+			return (EINVAL);
+
+		/* this doesnt happen in practice */
+		if (idx == 6) {
+		   	/* we might copy out the entry_number as 3 */
+		   	info.entry_number = 3;
+			error = copyout(&info, (void *) td->td_frame->tf_esi, sizeof(struct l_user_desc));
+			if (error)
+	   		   	return (error);
+		}
+
+		a[0] = LDT_entry_a(&info);
+		a[1] = LDT_entry_b(&info);
+
+		memcpy(&sd, &a, sizeof(a));
+#ifdef DEBUG
+	if (ldebug(clone))
+	   	printf("Segment created in clone with CLONE_SETTLS: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase,
+			sd.sd_hibase,
+			sd.sd_lolimit,
+			sd.sd_hilimit,
+			sd.sd_type,
+			sd.sd_dpl,
+			sd.sd_p,
+			sd.sd_xx,
+			sd.sd_def32,
+			sd.sd_gran);
+#endif
+
+		/* this is taken from i386 version of cpu_set_user_tls() */
+		critical_enter();
+		/* set %gs */
+		td2->td_pcb->pcb_gsd = sd;
+		PCPU_GET(fsgs_gdt)[1] = sd;
+		load_gs(GSEL(GUGS_SEL, SEL_UPL));
+		critical_exit();
+	} 
 
 #ifdef DEBUG
 	if (ldebug(clone))
@@ -847,25 +969,234 @@
 int
 linux_set_thread_area(struct thread *td, struct linux_set_thread_area_args *args)
 {
-	/*
-	 * Return an error code instead of raising a SIGSYS so that
-	 * the caller will fall back to simpler LDT methods.
+	struct l_user_desc info;
+	int error;
+	int idx;
+	int a[2];
+	struct segment_descriptor sd;
+
+	error = copyin(args->desc, &info, sizeof(struct l_user_desc));
+	if (error)
+		return (error);
+
+#ifdef DEBUG
+	if (ldebug(set_thread_area))
+	   	printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, %i, %i, %i\n"),
+		      info.entry_number,
+      		      info.base_addr,
+      		      info.limit,
+      		      info.seg_32bit,
+		      info.contents,
+      		      info.read_exec_only,
+      		      info.limit_in_pages,
+      		      info.seg_not_present,
+      		      info.useable);
+#endif
+
+	idx = info.entry_number;
+	/* Semantics of linux version: every thread in the system has array
+	 * of 3 tls descriptors. 1st is GLIBC TLS, 2nd is WINE, 3rd unknown. This
+	 * syscall loads one of the selected tls decriptors with a value
+	 * and also loads GDT descriptors 6, 7 and 8 with the content of the per-thread 
+	 * descriptors.
+	 *
+	 * Semantics of fbsd version: I think we can ignore that linux has 3 per-thread
+	 * descriptors and use just the 1st one. The tls_array[] is used only in 
+	 * set/get-thread_area() syscalls and for loading the GDT descriptors. In fbsd 
+	 * we use just one GDT descriptor for TLS so we will load just one. 
+	 * XXX: this doesnt work when user-space process tries to use more then 1 TLS segment
+	 * comment in the linux sources says wine might do that.
+	 */
+
+	/* we support just GLIBC TLS now 
+	 * we should let 3 proceed as well because we use this segment so
+	 * if code does two subsequent calls it should succeed
+	 */
+	if (idx != 6 && idx != -1 && idx != 3)
+		return (EINVAL);
+
+	/* we have to copy out the GDT entry we use
+	 * FreeBSD uses GDT entry #3 for storing %gs so load that 
+	 * XXX: what if userspace program doesnt check this value and tries
+	 * to use 6, 7 or 8? 
 	 */
+	idx = info.entry_number = 3;
+	error = copyout(&info, args->desc, sizeof(struct l_user_desc));
+	if (error)
+		return (error);
+
+	if (LDT_empty(&info)) {
+		a[0] = 0;
+		a[1] = 0;
+	} else {
+		a[0] = LDT_entry_a(&info);
+		a[1] = LDT_entry_b(&info);
+	}
+
+	memcpy(&sd, &a, sizeof(a));
+#ifdef DEBUG
+	if (ldebug(set_thread_area))
+	   	printf("Segment created in set_thread_area: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase,
+			sd.sd_hibase,
+			sd.sd_lolimit,
+			sd.sd_hilimit,
+			sd.sd_type,
+			sd.sd_dpl,
+			sd.sd_p,
+			sd.sd_xx,
+			sd.sd_def32,
+			sd.sd_gran);
+#endif
+
+	/* this is taken from i386 version of cpu_set_user_tls() */
+	critical_enter();
+	/* set %gs */
+	td->td_pcb->pcb_gsd = sd;
+	PCPU_GET(fsgs_gdt)[1] = sd;
+	load_gs(GSEL(GUGS_SEL, SEL_UPL));
+	critical_exit();
+   
+	return (0);
+}
+
+int
+linux_get_thread_area(struct thread *td, struct linux_get_thread_area_args *args)
+{
+   	
+	struct l_user_desc info;
+	int error;
+	int idx;
+	struct l_desc_struct desc;
+	struct segment_descriptor sd;
+
+#ifdef DEBUG
+	if (ldebug(get_thread_area))
+		printf(ARGS(get_thread_area, "%p"), args->desc);
+#endif
+
+	error = copyin(args->desc, &info, sizeof(struct l_user_desc));
+	if (error)
+		return (error);
+
+	idx = info.entry_number;
+	/* XXX: I am not sure if we want 3 to be allowed too. */
+	if (idx != 6 && idx != 3)
+		return (EINVAL);
+
+	idx = 3;
+
+	memset(&info, 0, sizeof(info));
+
+	sd = PCPU_GET(fsgs_gdt)[1];
+
+	memcpy(&desc, &sd, sizeof(desc));
+
+	info.entry_number = idx;
+	info.base_addr = GET_BASE(&desc);
+	info.limit = GET_LIMIT(&desc);
+	info.seg_32bit = GET_32BIT(&desc);
+	info.contents = GET_CONTENTS(&desc);
+	info.read_exec_only = !GET_WRITABLE(&desc);
+	info.limit_in_pages = GET_LIMIT_PAGES(&desc);
+	info.seg_not_present = !GET_PRESENT(&desc);
+	info.useable = GET_USEABLE(&desc);
+
+	error = copyout(&info, args->desc, sizeof(struct l_user_desc));
+	if (error)
+	   	return (EFAULT);
+
+	return (0);
+}
+
+/* copied from kern/kern_time.c */
+int
+linux_timer_create(struct thread *td, struct linux_timer_create_args *args)
+{
+   	return ktimer_create(td, (struct ktimer_create_args *) args);
+}
+
+int
+linux_timer_settime(struct thread *td, struct linux_timer_settime_args *args)
+{
+   	return ktimer_settime(td, (struct ktimer_settime_args *) args);
+}
+
+int
+linux_timer_gettime(struct thread *td, struct linux_timer_gettime_args *args)
+{
+   	return ktimer_gettime(td, (struct ktimer_gettime_args *) args);
+}
+
+int
+linux_timer_getoverrun(struct thread *td, struct linux_timer_getoverrun_args *args)
+{
+   	return ktimer_getoverrun(td, (struct ktimer_getoverrun_args *) args);
+}
+
+int
+linux_timer_delete(struct thread *td, struct linux_timer_delete_args *args)
+{
+   	return ktimer_delete(td, (struct ktimer_delete_args *) args);
+}
+
+/* XXX: this wont work with module - convert it */
+int
+linux_mq_open(struct thread *td, struct linux_mq_open_args *args)
+{
+#ifdef P1003_1B_MQUEUE
+   	return kmq_open(td, (struct kmq_open_args *) args);
+#else
+	return (ENOSYS);
+#endif
+}
+
+int
+linux_mq_unlink(struct thread *td, struct linux_mq_unlink_args *args)
+{
+#ifdef P1003_1B_MQUEUE
+   	return kmq_unlink(td, (struct kmq_unlink_args *) args);
+#else
 	return (ENOSYS);
+#endif
 }
 
 int
-linux_gettid(struct thread *td, struct linux_gettid_args *args)
+linux_mq_timedsend(struct thread *td, struct linux_mq_timedsend_args *args)
 {
+#ifdef P1003_1B_MQUEUE
+   	return kmq_timedsend(td, (struct kmq_timedsend_args *) args);
+#else
+	return (ENOSYS);
+#endif
+}
 
-	td->td_retval[0] = td->td_proc->p_pid;
-	return (0);
+int
+linux_mq_timedreceive(struct thread *td, struct linux_mq_timedreceive_args *args)
+{
+#ifdef P1003_1B_MQUEUE
+   	return kmq_timedreceive(td, (struct kmq_timedreceive_args *) args);
+#else
+	return (ENOSYS);
+#endif
 }
 
 int
-linux_tkill(struct thread *td, struct linux_tkill_args *args)
+linux_mq_notify(struct thread *td, struct linux_mq_notify_args *args)
 {
+#ifdef P1003_1B_MQUEUE
+	return kmq_notify(td, (struct kmq_notify_args *) args);
+#else
+	return (ENOSYS);
+#endif
+}
 
-	return (linux_kill(td, (struct linux_kill_args *) args));
+int
+linux_mq_getsetattr(struct thread *td, struct linux_mq_getsetattr_args *args)
+{
+#ifdef P1003_1B_MQUEUE
+   	return kmq_setattr(td, (struct kmq_setattr_args *) args);
+#else
+	return (ENOSYS);
+#endif
 }
 
--- i386/linux/linux_proto.h.orig
+++ i386/linux/linux_proto.h
@@ -2,7 +2,7 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_proto.h,v 1.78 2006/07/28 19:08:36 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.76 2006/07/28 19:05:27 jhb Exp 
  */
 
@@ -11,10 +11,7 @@
 
 #include <sys/signal.h>
 #include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
 #include <posix4/_semaphore.h>
-
 #include <sys/ucontext.h>
 
 struct proc;
@@ -201,6 +198,9 @@
 	char dev_l_[PADL_(l_dev_t)]; l_dev_t dev; char dev_r_[PADR_(l_dev_t)];
 	char ubuf_l_[PADL_(struct l_ustat *)]; struct l_ustat * ubuf; char ubuf_r_[PADR_(struct l_ustat *)];
 };
+struct linux_getppid_args {
+	register_t dummy;
+};
 struct linux_sigaction_args {
 	char sig_l_[PADL_(l_int)]; l_int sig; char sig_r_[PADR_(l_int)];
 	char nsa_l_[PADL_(l_osigaction_t *)]; l_osigaction_t * nsa; char nsa_r_[PADR_(l_osigaction_t *)];
@@ -374,6 +374,9 @@
 struct linux_clone_args {
 	char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
 	char stack_l_[PADL_(void *)]; void * stack; char stack_r_[PADR_(void *)];
+	char parent_tidptr_l_[PADL_(void *)]; void * parent_tidptr; char parent_tidptr_r_[PADR_(void *)];
+	char dummy_l_[PADL_(int)]; int dummy; char dummy_r_[PADR_(int)];
+	char child_tidptr_l_[PADL_(void *)]; void * child_tidptr; char child_tidptr_r_[PADR_(void *)];
 };
 struct linux_newuname_args {
 	char buf_l_[PADL_(struct l_new_utsname *)]; struct l_new_utsname * buf; char buf_r_[PADR_(struct l_new_utsname *)];
@@ -702,12 +705,26 @@
 	char tid_l_[PADL_(int)]; int tid; char tid_r_[PADR_(int)];
 	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
 };
+struct linux_sys_futex_args {
+	char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)];
+	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
+	char val_l_[PADL_(int)]; int val; char val_r_[PADR_(int)];
+	char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)];
+	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
+	char val3_l_[PADL_(int)]; int val3; char val3_r_[PADR_(int)];
+};
 struct linux_set_thread_area_args {
-	char entry_l_[PADL_(void *)]; void * entry; char entry_r_[PADR_(void *)];
+	char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)];
+};
+struct linux_get_thread_area_args {
+	char desc_l_[PADL_(struct l_user_desc *)]; struct l_user_desc * desc; char desc_r_[PADR_(struct l_user_desc *)];
 };
 struct linux_fadvise64_args {
 	register_t dummy;
 };
+struct linux_exit_group_args {
+	char error_code_l_[PADL_(int)]; int error_code; char error_code_r_[PADR_(int)];
+};
 struct linux_lookup_dcookie_args {
 	register_t dummy;
 };
@@ -724,34 +741,45 @@
 	register_t dummy;
 };
 struct linux_set_tid_address_args {
-	register_t dummy;
+	char tidptr_l_[PADL_(int *)]; int * tidptr; char tidptr_r_[PADR_(int *)];
 };
 struct linux_timer_create_args {
-	register_t dummy;
+	char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
+	char evp_l_[PADL_(struct sigevent *)]; struct sigevent * evp; char evp_r_[PADR_(struct sigevent *)];
+	char timerid_l_[PADL_(l_timer_t *)]; l_timer_t * timerid; char timerid_r_[PADR_(l_timer_t *)];
 };
 struct linux_timer_settime_args {
-	register_t dummy;
+	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
+	char new_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * new; char new_r_[PADR_(const struct itimerspec *)];
+	char old_l_[PADL_(struct itimerspec *)]; struct itimerspec * old; char old_r_[PADR_(struct itimerspec *)];
 };
 struct linux_timer_gettime_args {
-	register_t dummy;
+	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
+	char setting_l_[PADL_(struct itimerspec *)]; struct itimerspec * setting; char setting_r_[PADR_(struct itimerspec *)];
 };
 struct linux_timer_getoverrun_args {
-	register_t dummy;
+	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
 };
 struct linux_timer_delete_args {
-	register_t dummy;
+	char timerid_l_[PADL_(l_timer_t)]; l_timer_t timerid; char timerid_r_[PADR_(l_timer_t)];
 };
 struct linux_clock_settime_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_gettime_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_getres_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char tp_l_[PADL_(struct l_timespec *)]; struct l_timespec * tp; char tp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_clock_nanosleep_args {
-	register_t dummy;
+	char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+	char rqtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rqtp; char rqtp_r_[PADR_(struct l_timespec *)];
+	char rmtp_l_[PADL_(struct l_timespec *)]; struct l_timespec * rmtp; char rmtp_r_[PADR_(struct l_timespec *)];
 };
 struct linux_statfs64_args {
 	register_t dummy;
@@ -760,7 +788,9 @@
 	register_t dummy;
 };
 struct linux_tgkill_args {
-	register_t dummy;
+	char tgid_l_[PADL_(int)]; int tgid; char tgid_r_[PADR_(int)];
+	char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];
+	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
 };
 struct linux_utimes_args {
 	register_t dummy;
@@ -778,22 +808,36 @@
 	register_t dummy;
 };
 struct linux_mq_open_args {
-	register_t dummy;
+	char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];
+	char oflag_l_[PADL_(int)]; int oflag; char oflag_r_[PADR_(int)];
+	char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];
+	char attr_l_[PADL_(struct mq_attr *)]; struct mq_attr * attr; char attr_r_[PADR_(struct mq_attr *)];
 };
 struct linux_mq_unlink_args {
-	register_t dummy;
+	char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];
 };
 struct linux_mq_timedsend_args {
-	register_t dummy;
+	char mqd_l_[PADL_(l_mqd_t)]; l_mqd_t mqd; char mqd_r_[PADR_(l_mqd_t)];
+	char msg_ptr_l_[PADL_(const char *)]; const char * msg_ptr; char msg_ptr_r_[PADR_(const char *)];
+	char msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];
+	char msg_prio_l_[PADL_(unsigned int)]; unsigned int msg_prio; char msg_prio_r_[PADR_(unsigned int)];
+	char abs_timeout_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct l_timespec *)];
 };
 struct linux_mq_timedreceive_args {
-	register_t dummy;
+	char mqd_l_[PADL_(l_mqd_t)]; l_mqd_t mqd; char mqd_r_[PADR_(l_mqd_t)];
+	char msg_ptr_l_[PADL_(char *)]; char * msg_ptr; char msg_ptr_r_[PADR_(char *)];
+	char msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];
+	char msg_prio_l_[PADL_(unsigned int)]; unsigned int msg_prio; char msg_prio_r_[PADR_(unsigned int)];
+	char abs_timeout_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct l_timespec *)];
 };
 struct linux_mq_notify_args {
-	register_t dummy;
+	char mqd_l_[PADL_(l_mqd_t)]; l_mqd_t mqd; char mqd_r_[PADR_(l_mqd_t)];
+	char abs_timeout_l_[PADL_(const struct l_timespec *)]; const struct l_timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct l_timespec *)];
 };
 struct linux_mq_getsetattr_args {
-	register_t dummy;
+	char mqd_l_[PADL_(l_mqd_t)]; l_mqd_t mqd; char mqd_r_[PADR_(l_mqd_t)];
+	char attr_l_[PADL_(const struct mq_attr *)]; const struct mq_attr * attr; char attr_r_[PADR_(const struct mq_attr *)];
+	char oattr_l_[PADL_(struct mq_attr *)]; struct mq_attr * oattr; char oattr_r_[PADR_(struct mq_attr *)];
 };
 struct linux_kexec_load_args {
 	register_t dummy;
@@ -921,6 +965,7 @@
 int	linux_fcntl(struct thread *, struct linux_fcntl_args *);
 int	linux_olduname(struct thread *, struct linux_olduname_args *);
 int	linux_ustat(struct thread *, struct linux_ustat_args *);
+int	linux_getppid(struct thread *, struct linux_getppid_args *);
 int	linux_sigaction(struct thread *, struct linux_sigaction_args *);
 int	linux_sgetmask(struct thread *, struct linux_sgetmask_args *);
 int	linux_ssetmask(struct thread *, struct linux_ssetmask_args *);
@@ -1047,8 +1092,11 @@
 int	linux_lremovexattr(struct thread *, struct linux_lremovexattr_args *);
 int	linux_fremovexattr(struct thread *, struct linux_fremovexattr_args *);
 int	linux_tkill(struct thread *, struct linux_tkill_args *);
+int	linux_sys_futex(struct thread *, struct linux_sys_futex_args *);
 int	linux_set_thread_area(struct thread *, struct linux_set_thread_area_args *);
+int	linux_get_thread_area(struct thread *, struct linux_get_thread_area_args *);
 int	linux_fadvise64(struct thread *, struct linux_fadvise64_args *);
+int	linux_exit_group(struct thread *, struct linux_exit_group_args *);
 int	linux_lookup_dcookie(struct thread *, struct linux_lookup_dcookie_args *);
 int	linux_epoll_create(struct thread *, struct linux_epoll_create_args *);
 int	linux_epoll_ctl(struct thread *, struct linux_epoll_ctl_args *);
--- i386/linux/linux_syscall.h.orig
+++ i386/linux/linux_syscall.h
@@ -2,7 +2,7 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_syscall.h,v 1.72 2006/07/28 19:08:36 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.76 2006/07/28 19:05:27 jhb Exp 
  */
 
@@ -61,7 +61,7 @@
 #define	LINUX_SYS_chroot	61
 #define	LINUX_SYS_linux_ustat	62
 #define	LINUX_SYS_dup2	63
-#define	LINUX_SYS_getppid	64
+#define	LINUX_SYS_linux_getppid	64
 #define	LINUX_SYS_getpgrp	65
 #define	LINUX_SYS_setsid	66
 #define	LINUX_SYS_linux_sigaction	67
@@ -227,9 +227,11 @@
 #define	LINUX_SYS_linux_lremovexattr	236
 #define	LINUX_SYS_linux_fremovexattr	237
 #define	LINUX_SYS_linux_tkill	238
+#define	LINUX_SYS_linux_sys_futex	240
 #define	LINUX_SYS_linux_set_thread_area	243
+#define	LINUX_SYS_linux_get_thread_area	244
 #define	LINUX_SYS_linux_fadvise64	250
-#define	LINUX_SYS_exit_group	252
+#define	LINUX_SYS_linux_exit_group	252
 #define	LINUX_SYS_linux_lookup_dcookie	253
 #define	LINUX_SYS_linux_epoll_create	254
 #define	LINUX_SYS_linux_epoll_ctl	255
--- i386/linux/linux_sysent.c.orig
+++ i386/linux/linux_sysent.c
@@ -2,7 +2,7 @@
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/i386/linux/linux_sysent.c,v 1.79 2006/07/28 19:08:36 jhb Exp $
+ * $FreeBSD$
  * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.76 2006/07/28 19:05:27 jhb Exp 
  */
 
@@ -19,315 +19,315 @@
 /* The casts are bogus but will do for now. */
 struct sysent linux_sysent[] = {
 #define	nosys	linux_nosys
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 0 = setup */
-	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT },	/* 1 = exit */
-	{ 0, (sy_call_t *)linux_fork, AUE_FORK },		/* 2 = linux_fork */
-	{ AS(read_args), (sy_call_t *)read, AUE_NULL },	/* 3 = read */
-	{ AS(write_args), (sy_call_t *)write, AUE_NULL },	/* 4 = write */
-	{ AS(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC },	/* 5 = linux_open */
-	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE },	/* 6 = close */
-	{ AS(linux_waitpid_args), (sy_call_t *)linux_waitpid, AUE_WAIT4 },	/* 7 = linux_waitpid */
-	{ AS(linux_creat_args), (sy_call_t *)linux_creat, AUE_O_CREAT },	/* 8 = linux_creat */
-	{ AS(linux_link_args), (sy_call_t *)linux_link, AUE_LINK },	/* 9 = linux_link */
-	{ AS(linux_unlink_args), (sy_call_t *)linux_unlink, AUE_UNLINK },	/* 10 = linux_unlink */
-	{ AS(linux_execve_args), (sy_call_t *)linux_execve, AUE_EXECVE },	/* 11 = linux_execve */
-	{ AS(linux_chdir_args), (sy_call_t *)linux_chdir, AUE_CHDIR },	/* 12 = linux_chdir */
-	{ AS(linux_time_args), (sy_call_t *)linux_time, AUE_NULL },	/* 13 = linux_time */
-	{ AS(linux_mknod_args), (sy_call_t *)linux_mknod, AUE_MKNOD },	/* 14 = linux_mknod */
-	{ AS(linux_chmod_args), (sy_call_t *)linux_chmod, AUE_CHMOD },	/* 15 = linux_chmod */
-	{ AS(linux_lchown16_args), (sy_call_t *)linux_lchown16, AUE_LCHOWN },	/* 16 = linux_lchown16 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 17 = break */
-	{ AS(linux_stat_args), (sy_call_t *)linux_stat, AUE_STAT },	/* 18 = linux_stat */
-	{ AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK },	/* 19 = linux_lseek */
-	{ 0, (sy_call_t *)linux_getpid, AUE_GETPID },	/* 20 = linux_getpid */
-	{ AS(linux_mount_args), (sy_call_t *)linux_mount, AUE_MOUNT },	/* 21 = linux_mount */
-	{ AS(linux_oldumount_args), (sy_call_t *)linux_oldumount, AUE_UMOUNT },	/* 22 = linux_oldumount */
-	{ AS(linux_setuid16_args), (sy_call_t *)linux_setuid16, AUE_SETUID },	/* 23 = linux_setuid16 */
-	{ 0, (sy_call_t *)linux_getuid16, AUE_GETUID },	/* 24 = linux_getuid16 */
-	{ 0, (sy_call_t *)linux_stime, AUE_SETTIMEOFDAY },	/* 25 = linux_stime */
-	{ AS(linux_ptrace_args), (sy_call_t *)linux_ptrace, AUE_PTRACE },	/* 26 = linux_ptrace */
-	{ AS(linux_alarm_args), (sy_call_t *)linux_alarm, AUE_NULL },	/* 27 = linux_alarm */
-	{ AS(linux_fstat_args), (sy_call_t *)linux_fstat, AUE_FSTAT },	/* 28 = linux_fstat */
-	{ 0, (sy_call_t *)linux_pause, AUE_NULL },	/* 29 = linux_pause */
-	{ AS(linux_utime_args), (sy_call_t *)linux_utime, AUE_UTIME },	/* 30 = linux_utime */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 31 = stty */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 32 = gtty */
-	{ AS(linux_access_args), (sy_call_t *)linux_access, AUE_ACCESS },	/* 33 = linux_access */
-	{ AS(linux_nice_args), (sy_call_t *)linux_nice, AUE_NICE },	/* 34 = linux_nice */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 35 = ftime */
-	{ 0, (sy_call_t *)sync, AUE_SYNC },		/* 36 = sync */
-	{ AS(linux_kill_args), (sy_call_t *)linux_kill, AUE_KILL },	/* 37 = linux_kill */
-	{ AS(linux_rename_args), (sy_call_t *)linux_rename, AUE_RENAME },	/* 38 = linux_rename */
-	{ AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR },	/* 39 = linux_mkdir */
-	{ AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR },	/* 40 = linux_rmdir */
-	{ AS(dup_args), (sy_call_t *)dup, AUE_DUP },	/* 41 = dup */
-	{ AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE },	/* 42 = linux_pipe */
-	{ AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL },	/* 43 = linux_times */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 44 = prof */
-	{ AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL },	/* 45 = linux_brk */
-	{ AS(linux_setgid16_args), (sy_call_t *)linux_setgid16, AUE_SETGID },	/* 46 = linux_setgid16 */
-	{ 0, (sy_call_t *)linux_getgid16, AUE_GETGID },	/* 47 = linux_getgid16 */
-	{ AS(linux_signal_args), (sy_call_t *)linux_signal, AUE_NULL },	/* 48 = linux_signal */
-	{ 0, (sy_call_t *)linux_geteuid16, AUE_GETEUID },	/* 49 = linux_geteuid16 */
-	{ 0, (sy_call_t *)linux_getegid16, AUE_GETEGID },	/* 50 = linux_getegid16 */
-	{ AS(acct_args), (sy_call_t *)acct, AUE_ACCT },	/* 51 = acct */
-	{ AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT },	/* 52 = linux_umount */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 53 = lock */
-	{ AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL },	/* 54 = linux_ioctl */
-	{ AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL },	/* 55 = linux_fcntl */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 56 = mpx */
-	{ AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP },	/* 57 = setpgid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 58 = ulimit */
-	{ 0, (sy_call_t *)linux_olduname, AUE_NULL },	/* 59 = linux_olduname */
-	{ AS(umask_args), (sy_call_t *)umask, AUE_UMASK },	/* 60 = umask */
-	{ AS(chroot_args), (sy_call_t *)chroot, AUE_CHROOT },	/* 61 = chroot */
-	{ AS(linux_ustat_args), (sy_call_t *)linux_ustat, AUE_NULL },	/* 62 = linux_ustat */
-	{ AS(dup2_args), (sy_call_t *)dup2, AUE_DUP2 },	/* 63 = dup2 */
-	{ 0, (sy_call_t *)getppid, AUE_GETPPID },		/* 64 = getppid */
-	{ 0, (sy_call_t *)getpgrp, AUE_GETPGRP },		/* 65 = getpgrp */
-	{ 0, (sy_call_t *)setsid, AUE_SETSID },		/* 66 = setsid */
-	{ AS(linux_sigaction_args), (sy_call_t *)linux_sigaction, AUE_NULL },	/* 67 = linux_sigaction */
-	{ 0, (sy_call_t *)linux_sgetmask, AUE_NULL },	/* 68 = linux_sgetmask */
-	{ AS(linux_ssetmask_args), (sy_call_t *)linux_ssetmask, AUE_NULL },	/* 69 = linux_ssetmask */
-	{ AS(linux_setreuid16_args), (sy_call_t *)linux_setreuid16, AUE_SETREUID },	/* 70 = linux_setreuid16 */
-	{ AS(linux_setregid16_args), (sy_call_t *)linux_setregid16, AUE_SETREGID },	/* 71 = linux_setregid16 */
-	{ AS(linux_sigsuspend_args), (sy_call_t *)linux_sigsuspend, AUE_NULL },	/* 72 = linux_sigsuspend */
-	{ AS(linux_sigpending_args), (sy_call_t *)linux_sigpending, AUE_NULL },	/* 73 = linux_sigpending */
-	{ AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL },	/* 74 = linux_sethostname */
-	{ AS(linux_setrlimit_args), (sy_call_t *)linux_setrlimit, AUE_SETRLIMIT },	/* 75 = linux_setrlimit */
-	{ AS(linux_old_getrlimit_args), (sy_call_t *)linux_old_getrlimit, AUE_GETRLIMIT },	/* 76 = linux_old_getrlimit */
-	{ AS(getrusage_args), (sy_call_t *)getrusage, AUE_GETRUSAGE },	/* 77 = getrusage */
-	{ AS(gettimeofday_args), (sy_call_t *)gettimeofday, AUE_NULL },	/* 78 = gettimeofday */
-	{ AS(settimeofday_args), (sy_call_t *)settimeofday, AUE_SETTIMEOFDAY },	/* 79 = settimeofday */
-	{ AS(linux_getgroups16_args), (sy_call_t *)linux_getgroups16, AUE_GETGROUPS },	/* 80 = linux_getgroups16 */
-	{ AS(linux_setgroups16_args), (sy_call_t *)linux_setgroups16, AUE_SETGROUPS },	/* 81 = linux_setgroups16 */
-	{ AS(linux_old_select_args), (sy_call_t *)linux_old_select, AUE_SELECT },	/* 82 = linux_old_select */
-	{ AS(linux_symlink_args), (sy_call_t *)linux_symlink, AUE_SYMLINK },	/* 83 = linux_symlink */
-	{ AS(linux_lstat_args), (sy_call_t *)linux_lstat, AUE_LSTAT },	/* 84 = linux_lstat */
-	{ AS(linux_readlink_args), (sy_call_t *)linux_readlink, AUE_READLINK },	/* 85 = linux_readlink */
-	{ AS(linux_uselib_args), (sy_call_t *)linux_uselib, AUE_USELIB },	/* 86 = linux_uselib */
-	{ AS(swapon_args), (sy_call_t *)swapon, AUE_SWAPON },	/* 87 = swapon */
-	{ AS(linux_reboot_args), (sy_call_t *)linux_reboot, AUE_REBOOT },	/* 88 = linux_reboot */
-	{ AS(linux_readdir_args), (sy_call_t *)linux_readdir, AUE_O_GETDENTS },	/* 89 = linux_readdir */
-	{ AS(linux_mmap_args), (sy_call_t *)linux_mmap, AUE_MMAP },	/* 90 = linux_mmap */
-	{ AS(munmap_args), (sy_call_t *)munmap, AUE_MUNMAP },	/* 91 = munmap */
-	{ AS(linux_truncate_args), (sy_call_t *)linux_truncate, AUE_TRUNCATE },	/* 92 = linux_truncate */
-	{ AS(linux_ftruncate_args), (sy_call_t *)linux_ftruncate, AUE_FTRUNCATE },	/* 93 = linux_ftruncate */
-	{ AS(fchmod_args), (sy_call_t *)fchmod, AUE_FCHMOD },	/* 94 = fchmod */
-	{ AS(fchown_args), (sy_call_t *)fchown, AUE_FCHOWN },	/* 95 = fchown */
-	{ AS(linux_getpriority_args), (sy_call_t *)linux_getpriority, AUE_GETPRIORITY },	/* 96 = linux_getpriority */
-	{ AS(setpriority_args), (sy_call_t *)setpriority, AUE_SETPRIORITY },	/* 97 = setpriority */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 98 = profil */
-	{ AS(linux_statfs_args), (sy_call_t *)linux_statfs, AUE_STATFS },	/* 99 = linux_statfs */
-	{ AS(linux_fstatfs_args), (sy_call_t *)linux_fstatfs, AUE_FSTATFS },	/* 100 = linux_fstatfs */
-	{ AS(linux_ioperm_args), (sy_call_t *)linux_ioperm, AUE_NULL },	/* 101 = linux_ioperm */
-	{ AS(linux_socketcall_args), (sy_call_t *)linux_socketcall, AUE_NULL },	/* 102 = linux_socketcall */
-	{ AS(linux_syslog_args), (sy_call_t *)linux_syslog, AUE_NULL },	/* 103 = linux_syslog */
-	{ AS(linux_setitimer_args), (sy_call_t *)linux_setitimer, AUE_SETITIMER },	/* 104 = linux_setitimer */
-	{ AS(linux_getitimer_args), (sy_call_t *)linux_getitimer, AUE_GETITIMER },	/* 105 = linux_getitimer */
-	{ AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT },	/* 106 = linux_newstat */
-	{ AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT },	/* 107 = linux_newlstat */
-	{ AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT },	/* 108 = linux_newfstat */
-	{ 0, (sy_call_t *)linux_uname, AUE_NULL },	/* 109 = linux_uname */
-	{ AS(linux_iopl_args), (sy_call_t *)linux_iopl, AUE_NULL },	/* 110 = linux_iopl */
-	{ 0, (sy_call_t *)linux_vhangup, AUE_NULL },	/* 111 = linux_vhangup */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 112 = idle */
-	{ 0, (sy_call_t *)linux_vm86old, AUE_NULL },	/* 113 = linux_vm86old */
-	{ AS(linux_wait4_args), (sy_call_t *)linux_wait4, AUE_WAIT4 },	/* 114 = linux_wait4 */
-	{ 0, (sy_call_t *)linux_swapoff, AUE_SWAPOFF },	/* 115 = linux_swapoff */
-	{ AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo, AUE_NULL },	/* 116 = linux_sysinfo */
-	{ AS(linux_ipc_args), (sy_call_t *)linux_ipc, AUE_NULL },	/* 117 = linux_ipc */
-	{ AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC },	/* 118 = fsync */
-	{ AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn, AUE_SIGRETURN },	/* 119 = linux_sigreturn */
-	{ AS(linux_clone_args), (sy_call_t *)linux_clone, AUE_RFORK },	/* 120 = linux_clone */
-	{ AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_SYSCTL },	/* 121 = setdomainname */
-	{ AS(linux_newuname_args), (sy_call_t *)linux_newuname, AUE_NULL },	/* 122 = linux_newuname */
-	{ AS(linux_modify_ldt_args), (sy_call_t *)linux_modify_ldt, AUE_NULL },	/* 123 = linux_modify_ldt */
-	{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME },	/* 124 = linux_adjtimex */
-	{ AS(mprotect_args), (sy_call_t *)mprotect, AUE_MPROTECT },	/* 125 = mprotect */
-	{ AS(linux_sigprocmask_args), (sy_call_t *)linux_sigprocmask, AUE_SIGPROCMASK },	/* 126 = linux_sigprocmask */
-	{ 0, (sy_call_t *)linux_create_module, AUE_NULL },	/* 127 = linux_create_module */
-	{ 0, (sy_call_t *)linux_init_module, AUE_NULL },	/* 128 = linux_init_module */
-	{ 0, (sy_call_t *)linux_delete_module, AUE_NULL },	/* 129 = linux_delete_module */
-	{ 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL },	/* 130 = linux_get_kernel_syms */
-	{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL },	/* 131 = linux_quotactl */
-	{ AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID },	/* 132 = getpgid */
-	{ AS(fchdir_args), (sy_call_t *)fchdir, AUE_FCHDIR },	/* 133 = fchdir */
-	{ 0, (sy_call_t *)linux_bdflush, AUE_BDFLUSH },	/* 134 = linux_bdflush */
-	{ AS(linux_sysfs_args), (sy_call_t *)linux_sysfs, AUE_NULL },	/* 135 = linux_sysfs */
-	{ AS(linux_personality_args), (sy_call_t *)linux_personality, AUE_PERSONALITY },	/* 136 = linux_personality */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 137 = afs_syscall */
-	{ AS(linux_setfsuid16_args), (sy_call_t *)linux_setfsuid16, AUE_SETFSUID },	/* 138 = linux_setfsuid16 */
-	{ AS(linux_setfsgid16_args), (sy_call_t *)linux_setfsgid16, AUE_SETFSGID },	/* 139 = linux_setfsgid16 */
-	{ AS(linux_llseek_args), (sy_call_t *)linux_llseek, AUE_LSEEK },	/* 140 = linux_llseek */
-	{ AS(linux_getdents_args), (sy_call_t *)linux_getdents, AUE_O_GETDENTS },	/* 141 = linux_getdents */
-	{ AS(linux_select_args), (sy_call_t *)linux_select, AUE_SELECT },	/* 142 = linux_select */
-	{ AS(flock_args), (sy_call_t *)flock, AUE_FLOCK },	/* 143 = flock */
-	{ AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC },	/* 144 = linux_msync */
-	{ AS(readv_args), (sy_call_t *)readv, AUE_READV },	/* 145 = readv */
-	{ AS(writev_args), (sy_call_t *)writev, AUE_WRITEV },	/* 146 = writev */
-	{ AS(linux_getsid_args), (sy_call_t *)linux_getsid, AUE_GETSID },	/* 147 = linux_getsid */
-	{ AS(linux_fdatasync_args), (sy_call_t *)linux_fdatasync, AUE_NULL },	/* 148 = linux_fdatasync */
-	{ AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL },	/* 149 = linux_sysctl */
-	{ AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK },	/* 150 = mlock */
-	{ AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK },	/* 151 = munlock */
-	{ AS(mlockall_args), (sy_call_t *)mlockall, AUE_MLOCKALL },	/* 152 = mlockall */
-	{ 0, (sy_call_t *)munlockall, AUE_MUNLOCKALL },	/* 153 = munlockall */
-	{ AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_SCHED_SETPARAM },	/* 154 = sched_setparam */
-	{ AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_SCHED_GETPARAM },	/* 155 = sched_getparam */
-	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER },	/* 156 = linux_sched_setscheduler */
-	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER },	/* 157 = linux_sched_getscheduler */
-	{ 0, (sy_call_t *)sched_yield, AUE_NULL },	/* 158 = sched_yield */
-	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX },	/* 159 = linux_sched_get_priority_max */
-	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN },	/* 160 = linux_sched_get_priority_min */
-	{ AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL },	/* 161 = sched_rr_get_interval */
-	{ AS(nanosleep_args), (sy_call_t *)nanosleep, AUE_NULL },	/* 162 = nanosleep */
-	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL },	/* 163 = linux_mremap */
-	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID },	/* 164 = linux_setresuid16 */
-	{ AS(linux_getresuid16_args), (sy_call_t *)linux_getresuid16, AUE_GETRESUID },	/* 165 = linux_getresuid16 */
-	{ 0, (sy_call_t *)linux_vm86, AUE_NULL },		/* 166 = linux_vm86 */
-	{ 0, (sy_call_t *)linux_query_module, AUE_NULL },	/* 167 = linux_query_module */
-	{ AS(poll_args), (sy_call_t *)poll, AUE_POLL },	/* 168 = poll */
-	{ 0, (sy_call_t *)linux_nfsservctl, AUE_NULL },	/* 169 = linux_nfsservctl */
-	{ AS(linux_setresgid16_args), (sy_call_t *)linux_setresgid16, AUE_SETRESGID },	/* 170 = linux_setresgid16 */
-	{ AS(linux_getresgid16_args), (sy_call_t *)linux_getresgid16, AUE_GETRESGID },	/* 171 = linux_getresgid16 */
-	{ 0, (sy_call_t *)linux_prctl, AUE_PRCTL },	/* 172 = linux_prctl */
-	{ AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL },	/* 173 = linux_rt_sigreturn */
-	{ AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL },	/* 174 = linux_rt_sigaction */
-	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL },	/* 175 = linux_rt_sigprocmask */
-	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL },	/* 176 = linux_rt_sigpending */
-	{ 0, (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL },	/* 177 = linux_rt_sigtimedwait */
-	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL },	/* 178 = linux_rt_sigqueueinfo */
-	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL },	/* 179 = linux_rt_sigsuspend */
-	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD },	/* 180 = linux_pread */
-	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE },	/* 181 = linux_pwrite */
-	{ AS(linux_chown16_args), (sy_call_t *)linux_chown16, AUE_CHOWN },	/* 182 = linux_chown16 */
-	{ AS(linux_getcwd_args), (sy_call_t *)linux_getcwd, AUE_GETCWD },	/* 183 = linux_getcwd */
-	{ 0, (sy_call_t *)linux_capget, AUE_CAPGET },	/* 184 = linux_capget */
-	{ 0, (sy_call_t *)linux_capset, AUE_CAPSET },	/* 185 = linux_capset */
-	{ AS(linux_sigaltstack_args), (sy_call_t *)linux_sigaltstack, AUE_NULL },	/* 186 = linux_sigaltstack */
-	{ 0, (sy_call_t *)linux_sendfile, AUE_SENDFILE },	/* 187 = linux_sendfile */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 188 = getpmsg */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 189 = putpmsg */
-	{ 0, (sy_call_t *)linux_vfork, AUE_VFORK },	/* 190 = linux_vfork */
-	{ AS(linux_getrlimit_args), (sy_call_t *)linux_getrlimit, AUE_GETRLIMIT },	/* 191 = linux_getrlimit */
-	{ AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP },	/* 192 = linux_mmap2 */
-	{ AS(linux_truncate64_args), (sy_call_t *)linux_truncate64, AUE_TRUNCATE },	/* 193 = linux_truncate64 */
-	{ AS(linux_ftruncate64_args), (sy_call_t *)linux_ftruncate64, AUE_FTRUNCATE },	/* 194 = linux_ftruncate64 */
-	{ AS(linux_stat64_args), (sy_call_t *)linux_stat64, AUE_STAT },	/* 195 = linux_stat64 */
-	{ AS(linux_lstat64_args), (sy_call_t *)linux_lstat64, AUE_LSTAT },	/* 196 = linux_lstat64 */
-	{ AS(linux_fstat64_args), (sy_call_t *)linux_fstat64, AUE_FSTAT },	/* 197 = linux_fstat64 */
-	{ AS(linux_lchown_args), (sy_call_t *)linux_lchown, AUE_LCHOWN },	/* 198 = linux_lchown */
-	{ 0, (sy_call_t *)linux_getuid, AUE_GETUID },	/* 199 = linux_getuid */
-	{ 0, (sy_call_t *)linux_getgid, AUE_GETGID },	/* 200 = linux_getgid */
-	{ 0, (sy_call_t *)geteuid, AUE_GETEUID },		/* 201 = geteuid */
-	{ 0, (sy_call_t *)getegid, AUE_GETEGID },		/* 202 = getegid */
-	{ AS(setreuid_args), (sy_call_t *)setreuid, AUE_SETREUID },	/* 203 = setreuid */
-	{ AS(setregid_args), (sy_call_t *)setregid, AUE_SETREGID },	/* 204 = setregid */
-	{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups, AUE_GETGROUPS },	/* 205 = linux_getgroups */
-	{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups, AUE_SETGROUPS },	/* 206 = linux_setgroups */
-	{ AS(fchown_args), (sy_call_t *)fchown, AUE_NULL },	/* 207 = fchown */
-	{ AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID },	/* 208 = setresuid */
-	{ AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID },	/* 209 = getresuid */
-	{ AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID },	/* 210 = setresgid */
-	{ AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID },	/* 211 = getresgid */
-	{ AS(linux_chown_args), (sy_call_t *)linux_chown, AUE_CHOWN },	/* 212 = linux_chown */
-	{ AS(setuid_args), (sy_call_t *)setuid, AUE_SETUID },	/* 213 = setuid */
-	{ AS(setgid_args), (sy_call_t *)setgid, AUE_SETGID },	/* 214 = setgid */
-	{ AS(linux_setfsuid_args), (sy_call_t *)linux_setfsuid, AUE_SETFSUID },	/* 215 = linux_setfsuid */
-	{ AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID },	/* 216 = linux_setfsgid */
-	{ AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT },	/* 217 = linux_pivot_root */
-	{ AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE },	/* 218 = linux_mincore */
-	{ AS(madvise_args), (sy_call_t *)madvise, AUE_MADVISE },	/* 219 = madvise */
-	{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_O_GETDENTS },	/* 220 = linux_getdents64 */
-	{ AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL },	/* 221 = linux_fcntl64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 222 =  */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 223 =  */
-	{ 0, (sy_call_t *)linux_gettid, AUE_NULL },	/* 224 = linux_gettid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 225 = linux_readahead */
-	{ 0, (sy_call_t *)linux_setxattr, AUE_NULL },	/* 226 = linux_setxattr */
-	{ 0, (sy_call_t *)linux_lsetxattr, AUE_NULL },	/* 227 = linux_lsetxattr */
-	{ 0, (sy_call_t *)linux_fsetxattr, AUE_NULL },	/* 228 = linux_fsetxattr */
-	{ 0, (sy_call_t *)linux_getxattr, AUE_NULL },	/* 229 = linux_getxattr */
-	{ 0, (sy_call_t *)linux_lgetxattr, AUE_NULL },	/* 230 = linux_lgetxattr */
-	{ 0, (sy_call_t *)linux_fgetxattr, AUE_NULL },	/* 231 = linux_fgetxattr */
-	{ 0, (sy_call_t *)linux_listxattr, AUE_NULL },	/* 232 = linux_listxattr */
-	{ 0, (sy_call_t *)linux_llistxattr, AUE_NULL },	/* 233 = linux_llistxattr */
-	{ 0, (sy_call_t *)linux_flistxattr, AUE_NULL },	/* 234 = linux_flistxattr */
-	{ 0, (sy_call_t *)linux_removexattr, AUE_NULL },	/* 235 = linux_removexattr */
-	{ 0, (sy_call_t *)linux_lremovexattr, AUE_NULL },	/* 236 = linux_lremovexattr */
-	{ 0, (sy_call_t *)linux_fremovexattr, AUE_NULL },	/* 237 = linux_fremovexattr */
-	{ AS(linux_tkill_args), (sy_call_t *)linux_tkill, AUE_NULL },	/* 238 = linux_tkill */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 239 = linux_sendfile64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 240 = linux_futex */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 241 = linux_sched_setaffinity */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 242 = linux_sched_getaffinity */
-	{ AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL },	/* 243 = linux_set_thread_area */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 244 = linux_get_thread_area */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 245 = linux_io_setup */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 246 = linux_io_destroy */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 247 = linux_io_getevents */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 248 = linux_io_submit */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 249 = linux_io_cancel */
-	{ 0, (sy_call_t *)linux_fadvise64, AUE_NULL },	/* 250 = linux_fadvise64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 251 =  */
-	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT },	/* 252 = exit_group */
-	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL },	/* 253 = linux_lookup_dcookie */
-	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL },	/* 254 = linux_epoll_create */
-	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL },	/* 255 = linux_epoll_ctl */
-	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL },	/* 256 = linux_epoll_wait */
-	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL },	/* 257 = linux_remap_file_pages */
-	{ 0, (sy_call_t *)linux_set_tid_address, AUE_NULL },	/* 258 = linux_set_tid_address */
-	{ 0, (sy_call_t *)linux_timer_create, AUE_NULL },	/* 259 = linux_timer_create */
-	{ 0, (sy_call_t *)linux_timer_settime, AUE_NULL },	/* 260 = linux_timer_settime */
-	{ 0, (sy_call_t *)linux_timer_gettime, AUE_NULL },	/* 261 = linux_timer_gettime */
-	{ 0, (sy_call_t *)linux_timer_getoverrun, AUE_NULL },	/* 262 = linux_timer_getoverrun */
-	{ 0, (sy_call_t *)linux_timer_delete, AUE_NULL },	/* 263 = linux_timer_delete */
-	{ 0, (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME },	/* 264 = linux_clock_settime */
-	{ 0, (sy_call_t *)linux_clock_gettime, AUE_NULL },	/* 265 = linux_clock_gettime */
-	{ 0, (sy_call_t *)linux_clock_getres, AUE_NULL },	/* 266 = linux_clock_getres */
-	{ 0, (sy_call_t *)linux_clock_nanosleep, AUE_NULL },	/* 267 = linux_clock_nanosleep */
-	{ 0, (sy_call_t *)linux_statfs64, AUE_NULL },	/* 268 = linux_statfs64 */
-	{ 0, (sy_call_t *)linux_fstatfs64, AUE_NULL },	/* 269 = linux_fstatfs64 */
-	{ 0, (sy_call_t *)linux_tgkill, AUE_NULL },	/* 270 = linux_tgkill */
-	{ 0, (sy_call_t *)linux_utimes, AUE_NULL },	/* 271 = linux_utimes */
-	{ 0, (sy_call_t *)linux_fadvise64_64, AUE_NULL },	/* 272 = linux_fadvise64_64 */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 273 =  */
-	{ 0, (sy_call_t *)linux_mbind, AUE_NULL },	/* 274 = linux_mbind */
-	{ 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL },	/* 275 = linux_get_mempolicy */
-	{ 0, (sy_call_t *)linux_set_mempolicy, AUE_NULL },	/* 276 = linux_set_mempolicy */
-	{ 0, (sy_call_t *)linux_mq_open, AUE_NULL },	/* 277 = linux_mq_open */
-	{ 0, (sy_call_t *)linux_mq_unlink, AUE_NULL },	/* 278 = linux_mq_unlink */
-	{ 0, (sy_call_t *)linux_mq_timedsend, AUE_NULL },	/* 279 = linux_mq_timedsend */
-	{ 0, (sy_call_t *)linux_mq_timedreceive, AUE_NULL },	/* 280 = linux_mq_timedreceive */
-	{ 0, (sy_call_t *)linux_mq_notify, AUE_NULL },	/* 281 = linux_mq_notify */
-	{ 0, (sy_call_t *)linux_mq_getsetattr, AUE_NULL },	/* 282 = linux_mq_getsetattr */
-	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL },	/* 283 = linux_kexec_load */
-	{ 0, (sy_call_t *)linux_waitid, AUE_NULL },	/* 284 = linux_waitid */
-	{ 0, (sy_call_t *)nosys, AUE_NULL },			/* 285 =  */
-	{ 0, (sy_call_t *)linux_add_key, AUE_NULL },	/* 286 = linux_add_key */
-	{ 0, (sy_call_t *)linux_request_key, AUE_NULL },	/* 287 = linux_request_key */
-	{ 0, (sy_call_t *)linux_keyctl, AUE_NULL },	/* 288 = linux_keyctl */
-	{ 0, (sy_call_t *)linux_ioprio_set, AUE_NULL },	/* 289 = linux_ioprio_set */
-	{ 0, (sy_call_t *)linux_ioprio_get, AUE_NULL },	/* 290 = linux_ioprio_get */
-	{ 0, (sy_call_t *)linux_inotify_init, AUE_NULL },	/* 291 = linux_inotify_init */
-	{ 0, (sy_call_t *)linux_inotify_add_watch, AUE_NULL },	/* 292 = linux_inotify_add_watch */
-	{ 0, (sy_call_t *)linux_inotify_rm_watch, AUE_NULL },	/* 293 = linux_inotify_rm_watch */
-	{ 0, (sy_call_t *)linux_migrate_pages, AUE_NULL },	/* 294 = linux_migrate_pages */
-	{ 0, (sy_call_t *)linux_openat, AUE_NULL },	/* 295 = linux_openat */
-	{ 0, (sy_call_t *)linux_mkdirat, AUE_NULL },	/* 296 = linux_mkdirat */
-	{ 0, (sy_call_t *)linux_mknodat, AUE_NULL },	/* 297 = linux_mknodat */
-	{ 0, (sy_call_t *)linux_fchownat, AUE_NULL },	/* 298 = linux_fchownat */
-	{ 0, (sy_call_t *)linux_futimesat, AUE_NULL },	/* 299 = linux_futimesat */
-	{ 0, (sy_call_t *)linux_fstatat64, AUE_NULL },	/* 300 = linux_fstatat64 */
-	{ 0, (sy_call_t *)linux_unlinkat, AUE_NULL },	/* 301 = linux_unlinkat */
-	{ 0, (sy_call_t *)linux_renameat, AUE_NULL },	/* 302 = linux_renameat */
-	{ 0, (sy_call_t *)linux_linkat, AUE_NULL },	/* 303 = linux_linkat */
-	{ 0, (sy_call_t *)linux_symlinkat, AUE_NULL },	/* 304 = linux_symlinkat */
-	{ 0, (sy_call_t *)linux_readlinkat, AUE_NULL },	/* 305 = linux_readlinkat */
-	{ 0, (sy_call_t *)linux_fchmodat, AUE_NULL },	/* 306 = linux_fchmodat */
-	{ 0, (sy_call_t *)linux_faccessat, AUE_NULL },	/* 307 = linux_faccessat */
-	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL },	/* 308 = linux_pselect6 */
-	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL },	/* 309 = linux_ppoll */
-	{ 0, (sy_call_t *)linux_unshare, AUE_NULL },	/* 310 = linux_unshare */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 0 = setup */
+	{ AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_EXIT, NULL, 0, 0 },	/* 1 = exit */
+	{ 0, (sy_call_t *)linux_fork, AUE_FORK, NULL, 0, 0 },		/* 2 = linux_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(linux_open_args), (sy_call_t *)linux_open, AUE_OPEN_RWTC, NULL, 0, 0 },	/* 5 = linux_open */
+	{ AS(close_args), (sy_call_t *)close, AUE_CLOSE, NULL, 0, 0 },	/* 6 = close */
+	{ AS(linux_waitpid_args), (sy_call_t *)linux_waitpid, AUE_WAIT4, NULL, 0, 0 },	/* 7 = linux_waitpid */
+	{ AS(linux_creat_args), (sy_call_t *)linux_creat, AUE_O_CREAT, NULL, 0, 0 },	/* 8 = linux_creat */
+	{ AS(linux_link_args), (sy_call_t *)linux_link, AUE_LINK, NULL, 0, 0 },	/* 9 = linux_link */
+	{ AS(linux_unlink_args), (sy_call_t *)linux_unlink, AUE_UNLINK, NULL, 0, 0 },	/* 10 = linux_unlink */
+	{ AS(linux_execve_args), (sy_call_t *)linux_execve, AUE_EXECVE, NULL, 0, 0 },	/* 11 = linux_execve */
+	{ AS(linux_chdir_args), (sy_call_t *)linux_chdir, AUE_CHDIR, NULL, 0, 0 },	/* 12 = linux_chdir */
+	{ AS(linux_time_args), (sy_call_t *)linux_time, AUE_NULL, NULL, 0, 0 },	/* 13 = linux_time */
+	{ AS(linux_mknod_args), (sy_call_t *)linux_mknod, AUE_MKNOD, NULL, 0, 0 },	/* 14 = linux_mknod */
+	{ AS(linux_chmod_args), (sy_call_t *)linux_chmod, AUE_CHMOD, NULL, 0, 0 },	/* 15 = linux_chmod */
+	{ AS(linux_lchown16_args), (sy_call_t *)linux_lchown16, AUE_LCHOWN, NULL, 0, 0 },	/* 16 = linux_lchown16 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 17 = break */
+	{ AS(linux_stat_args), (sy_call_t *)linux_stat, AUE_STAT, NULL, 0, 0 },	/* 18 = linux_stat */
+	{ AS(linux_lseek_args), (sy_call_t *)linux_lseek, AUE_LSEEK, NULL, 0, 0 },	/* 19 = linux_lseek */
+	{ 0, (sy_call_t *)linux_getpid, AUE_GETPID, NULL, 0, 0 },	/* 20 = linux_getpid */
+	{ AS(linux_mount_args), (sy_call_t *)linux_mount, AUE_MOUNT, NULL, 0, 0 },	/* 21 = linux_mount */
+	{ AS(linux_oldumount_args), (sy_call_t *)linux_oldumount, AUE_UMOUNT, NULL, 0, 0 },	/* 22 = linux_oldumount */
+	{ AS(linux_setuid16_args), (sy_call_t *)linux_setuid16, AUE_SETUID, NULL, 0, 0 },	/* 23 = linux_setuid16 */
+	{ 0, (sy_call_t *)linux_getuid16, AUE_GETUID, NULL, 0, 0 },	/* 24 = linux_getuid16 */
+	{ 0, (sy_call_t *)linux_stime, AUE_SETTIMEOFDAY, NULL, 0, 0 },	/* 25 = linux_stime */
+	{ AS(linux_ptrace_args), (sy_call_t *)linux_ptrace, AUE_PTRACE, NULL, 0, 0 },	/* 26 = linux_ptrace */
+	{ AS(linux_alarm_args), (sy_call_t *)linux_alarm, AUE_NULL, NULL, 0, 0 },	/* 27 = linux_alarm */
+	{ AS(linux_fstat_args), (sy_call_t *)linux_fstat, AUE_FSTAT, NULL, 0, 0 },	/* 28 = linux_fstat */
+	{ 0, (sy_call_t *)linux_pause, AUE_NULL, NULL, 0, 0 },	/* 29 = linux_pause */
+	{ AS(linux_utime_args), (sy_call_t *)linux_utime, AUE_UTIME, NULL, 0, 0 },	/* 30 = linux_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(linux_access_args), (sy_call_t *)linux_access, AUE_ACCESS, NULL, 0, 0 },	/* 33 = linux_access */
+	{ AS(linux_nice_args), (sy_call_t *)linux_nice, AUE_NICE, NULL, 0, 0 },	/* 34 = linux_nice */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 35 = ftime */
+	{ 0, (sy_call_t *)sync, AUE_SYNC, NULL, 0, 0 },		/* 36 = sync */
+	{ AS(linux_kill_args), (sy_call_t *)linux_kill, AUE_KILL, NULL, 0, 0 },	/* 37 = linux_kill */
+	{ AS(linux_rename_args), (sy_call_t *)linux_rename, AUE_RENAME, NULL, 0, 0 },	/* 38 = linux_rename */
+	{ AS(linux_mkdir_args), (sy_call_t *)linux_mkdir, AUE_MKDIR, NULL, 0, 0 },	/* 39 = linux_mkdir */
+	{ AS(linux_rmdir_args), (sy_call_t *)linux_rmdir, AUE_RMDIR, NULL, 0, 0 },	/* 40 = linux_rmdir */
+	{ AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 },	/* 41 = dup */
+	{ AS(linux_pipe_args), (sy_call_t *)linux_pipe, AUE_PIPE, NULL, 0, 0 },	/* 42 = linux_pipe */
+	{ AS(linux_times_args), (sy_call_t *)linux_times, AUE_NULL, NULL, 0, 0 },	/* 43 = linux_times */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 44 = prof */
+	{ AS(linux_brk_args), (sy_call_t *)linux_brk, AUE_NULL, NULL, 0, 0 },	/* 45 = linux_brk */
+	{ AS(linux_setgid16_args), (sy_call_t *)linux_setgid16, AUE_SETGID, NULL, 0, 0 },	/* 46 = linux_setgid16 */
+	{ 0, (sy_call_t *)linux_getgid16, AUE_GETGID, NULL, 0, 0 },	/* 47 = linux_getgid16 */
+	{ AS(linux_signal_args), (sy_call_t *)linux_signal, AUE_NULL, NULL, 0, 0 },	/* 48 = linux_signal */
+	{ 0, (sy_call_t *)linux_geteuid16, AUE_GETEUID, NULL, 0, 0 },	/* 49 = linux_geteuid16 */
+	{ 0, (sy_call_t *)linux_getegid16, AUE_GETEGID, NULL, 0, 0 },	/* 50 = linux_getegid16 */
+	{ AS(acct_args), (sy_call_t *)acct, AUE_ACCT, NULL, 0, 0 },	/* 51 = acct */
+	{ AS(linux_umount_args), (sy_call_t *)linux_umount, AUE_UMOUNT, NULL, 0, 0 },	/* 52 = linux_umount */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 53 = lock */
+	{ AS(linux_ioctl_args), (sy_call_t *)linux_ioctl, AUE_IOCTL, NULL, 0, 0 },	/* 54 = linux_ioctl */
+	{ AS(linux_fcntl_args), (sy_call_t *)linux_fcntl, AUE_FCNTL, NULL, 0, 0 },	/* 55 = linux_fcntl */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 56 = mpx */
+	{ AS(setpgid_args), (sy_call_t *)setpgid, AUE_SETPGRP, NULL, 0, 0 },	/* 57 = setpgid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 58 = ulimit */
+	{ 0, (sy_call_t *)linux_olduname, AUE_NULL, NULL, 0, 0 },	/* 59 = linux_olduname */
+	{ 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 */
+	{ AS(linux_ustat_args), (sy_call_t *)linux_ustat, AUE_NULL, NULL, 0, 0 },	/* 62 = linux_ustat */
+	{ AS(dup2_args), (sy_call_t *)dup2, AUE_DUP2, NULL, 0, 0 },	/* 63 = dup2 */
+	{ 0, (sy_call_t *)linux_getppid, AUE_GETPPID, NULL, 0, 0 },	/* 64 = linux_getppid */
+	{ 0, (sy_call_t *)getpgrp, AUE_GETPGRP, NULL, 0, 0 },		/* 65 = getpgrp */
+	{ 0, (sy_call_t *)setsid, AUE_SETSID, NULL, 0, 0 },		/* 66 = setsid */
+	{ AS(linux_sigaction_args), (sy_call_t *)linux_sigaction, AUE_NULL, NULL, 0, 0 },	/* 67 = linux_sigaction */
+	{ 0, (sy_call_t *)linux_sgetmask, AUE_NULL, NULL, 0, 0 },	/* 68 = linux_sgetmask */
+	{ AS(linux_ssetmask_args), (sy_call_t *)linux_ssetmask, AUE_NULL, NULL, 0, 0 },	/* 69 = linux_ssetmask */
+	{ AS(linux_setreuid16_args), (sy_call_t *)linux_setreuid16, AUE_SETREUID, NULL, 0, 0 },	/* 70 = linux_setreuid16 */
+	{ AS(linux_setregid16_args), (sy_call_t *)linux_setregid16, AUE_SETREGID, NULL, 0, 0 },	/* 71 = linux_setregid16 */
+	{ AS(linux_sigsuspend_args), (sy_call_t *)linux_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 72 = linux_sigsuspend */
+	{ AS(linux_sigpending_args), (sy_call_t *)linux_sigpending, AUE_NULL, NULL, 0, 0 },	/* 73 = linux_sigpending */
+	{ AS(linux_sethostname_args), (sy_call_t *)linux_sethostname, AUE_SYSCTL, NULL, 0, 0 },	/* 74 = linux_sethostname */
+	{ AS(linux_setrlimit_args), (sy_call_t *)linux_setrlimit, AUE_SETRLIMIT, NULL, 0, 0 },	/* 75 = linux_setrlimit */
+	{ AS(linux_old_getrlimit_args), (sy_call_t *)linux_old_getrlimit, AUE_GETRLIMIT, NULL, 0, 0 },	/* 76 = linux_old_getrlimit */
+	{ AS(getrusage_args), (sy_call_t *)getrusage, AUE_GETRUSAGE, NULL, 0, 0 },	/* 77 = getrusage */
+	{ AS(gettimeofday_args), (sy_call_t *)gettimeofday, AUE_NULL, NULL, 0, 0 },	/* 78 = gettimeofday */
+	{ AS(settimeofday_args), (sy_call_t *)settimeofday, AUE_SETTIMEOFDAY, NULL, 0, 0 },	/* 79 = settimeofday */
+	{ AS(linux_getgroups16_args), (sy_call_t *)linux_getgroups16, AUE_GETGROUPS, NULL, 0, 0 },	/* 80 = linux_getgroups16 */
+	{ AS(linux_setgroups16_args), (sy_call_t *)linux_setgroups16, AUE_SETGROUPS, NULL, 0, 0 },	/* 81 = linux_setgroups16 */
+	{ AS(linux_old_select_args), (sy_call_t *)linux_old_select, AUE_SELECT, NULL, 0, 0 },	/* 82 = linux_old_select */
+	{ AS(linux_symlink_args), (sy_call_t *)linux_symlink, AUE_SYMLINK, NULL, 0, 0 },	/* 83 = linux_symlink */
+	{ AS(linux_lstat_args), (sy_call_t *)linux_lstat, AUE_LSTAT, NULL, 0, 0 },	/* 84 = linux_lstat */
+	{ AS(linux_readlink_args), (sy_call_t *)linux_readlink, AUE_READLINK, NULL, 0, 0 },	/* 85 = linux_readlink */
+	{ AS(linux_uselib_args), (sy_call_t *)linux_uselib, AUE_USELIB, NULL, 0, 0 },	/* 86 = linux_uselib */
+	{ AS(swapon_args), (sy_call_t *)swapon, AUE_SWAPON, NULL, 0, 0 },	/* 87 = swapon */
+	{ AS(linux_reboot_args), (sy_call_t *)linux_reboot, AUE_REBOOT, NULL, 0, 0 },	/* 88 = linux_reboot */
+	{ AS(linux_readdir_args), (sy_call_t *)linux_readdir, AUE_O_GETDENTS, NULL, 0, 0 },	/* 89 = linux_readdir */
+	{ AS(linux_mmap_args), (sy_call_t *)linux_mmap, AUE_MMAP, NULL, 0, 0 },	/* 90 = linux_mmap */
+	{ AS(munmap_args), (sy_call_t *)munmap, AUE_MUNMAP, NULL, 0, 0 },	/* 91 = munmap */
+	{ AS(linux_truncate_args), (sy_call_t *)linux_truncate, AUE_TRUNCATE, NULL, 0, 0 },	/* 92 = linux_truncate */
+	{ AS(linux_ftruncate_args), (sy_call_t *)linux_ftruncate, AUE_FTRUNCATE, NULL, 0, 0 },	/* 93 = linux_ftruncate */
+	{ AS(fchmod_args), (sy_call_t *)fchmod, AUE_FCHMOD, NULL, 0, 0 },	/* 94 = fchmod */
+	{ AS(fchown_args), (sy_call_t *)fchown, AUE_FCHOWN, NULL, 0, 0 },	/* 95 = fchown */
+	{ AS(linux_getpriority_args), (sy_call_t *)linux_getpriority, AUE_GETPRIORITY, NULL, 0, 0 },	/* 96 = linux_getpriority */
+	{ AS(setpriority_args), (sy_call_t *)setpriority, AUE_SETPRIORITY, NULL, 0, 0 },	/* 97 = setpriority */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 98 = profil */
+	{ AS(linux_statfs_args), (sy_call_t *)linux_statfs, AUE_STATFS, NULL, 0, 0 },	/* 99 = linux_statfs */
+	{ AS(linux_fstatfs_args), (sy_call_t *)linux_fstatfs, AUE_FSTATFS, NULL, 0, 0 },	/* 100 = linux_fstatfs */
+	{ AS(linux_ioperm_args), (sy_call_t *)linux_ioperm, AUE_NULL, NULL, 0, 0 },	/* 101 = linux_ioperm */
+	{ AS(linux_socketcall_args), (sy_call_t *)linux_socketcall, AUE_NULL, NULL, 0, 0 },	/* 102 = linux_socketcall */
+	{ AS(linux_syslog_args), (sy_call_t *)linux_syslog, AUE_NULL, NULL, 0, 0 },	/* 103 = linux_syslog */
+	{ AS(linux_setitimer_args), (sy_call_t *)linux_setitimer, AUE_SETITIMER, NULL, 0, 0 },	/* 104 = linux_setitimer */
+	{ AS(linux_getitimer_args), (sy_call_t *)linux_getitimer, AUE_GETITIMER, NULL, 0, 0 },	/* 105 = linux_getitimer */
+	{ AS(linux_newstat_args), (sy_call_t *)linux_newstat, AUE_STAT, NULL, 0, 0 },	/* 106 = linux_newstat */
+	{ AS(linux_newlstat_args), (sy_call_t *)linux_newlstat, AUE_LSTAT, NULL, 0, 0 },	/* 107 = linux_newlstat */
+	{ AS(linux_newfstat_args), (sy_call_t *)linux_newfstat, AUE_FSTAT, NULL, 0, 0 },	/* 108 = linux_newfstat */
+	{ 0, (sy_call_t *)linux_uname, AUE_NULL, NULL, 0, 0 },	/* 109 = linux_uname */
+	{ AS(linux_iopl_args), (sy_call_t *)linux_iopl, AUE_NULL, NULL, 0, 0 },	/* 110 = linux_iopl */
+	{ 0, (sy_call_t *)linux_vhangup, AUE_NULL, NULL, 0, 0 },	/* 111 = linux_vhangup */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 112 = idle */
+	{ 0, (sy_call_t *)linux_vm86old, AUE_NULL, NULL, 0, 0 },	/* 113 = linux_vm86old */
+	{ AS(linux_wait4_args), (sy_call_t *)linux_wait4, AUE_WAIT4, NULL, 0, 0 },	/* 114 = linux_wait4 */
+	{ 0, (sy_call_t *)linux_swapoff, AUE_SWAPOFF, NULL, 0, 0 },	/* 115 = linux_swapoff */
+	{ AS(linux_sysinfo_args), (sy_call_t *)linux_sysinfo, AUE_NULL, NULL, 0, 0 },	/* 116 = linux_sysinfo */
+	{ AS(linux_ipc_args), (sy_call_t *)linux_ipc, AUE_NULL, NULL, 0, 0 },	/* 117 = linux_ipc */
+	{ AS(fsync_args), (sy_call_t *)fsync, AUE_FSYNC, NULL, 0, 0 },	/* 118 = fsync */
+	{ AS(linux_sigreturn_args), (sy_call_t *)linux_sigreturn, AUE_SIGRETURN, NULL, 0, 0 },	/* 119 = linux_sigreturn */
+	{ AS(linux_clone_args), (sy_call_t *)linux_clone, AUE_RFORK, NULL, 0, 0 },	/* 120 = linux_clone */
+	{ AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_SYSCTL, NULL, 0, 0 },	/* 121 = setdomainname */
+	{ AS(linux_newuname_args), (sy_call_t *)linux_newuname, AUE_NULL, NULL, 0, 0 },	/* 122 = linux_newuname */
+	{ AS(linux_modify_ldt_args), (sy_call_t *)linux_modify_ldt, AUE_NULL, NULL, 0, 0 },	/* 123 = linux_modify_ldt */
+	{ 0, (sy_call_t *)linux_adjtimex, AUE_ADJTIME, NULL, 0, 0 },	/* 124 = linux_adjtimex */
+	{ AS(mprotect_args), (sy_call_t *)mprotect, AUE_MPROTECT, NULL, 0, 0 },	/* 125 = mprotect */
+	{ AS(linux_sigprocmask_args), (sy_call_t *)linux_sigprocmask, AUE_SIGPROCMASK, NULL, 0, 0 },	/* 126 = linux_sigprocmask */
+	{ 0, (sy_call_t *)linux_create_module, AUE_NULL, NULL, 0, 0 },	/* 127 = linux_create_module */
+	{ 0, (sy_call_t *)linux_init_module, AUE_NULL, NULL, 0, 0 },	/* 128 = linux_init_module */
+	{ 0, (sy_call_t *)linux_delete_module, AUE_NULL, NULL, 0, 0 },	/* 129 = linux_delete_module */
+	{ 0, (sy_call_t *)linux_get_kernel_syms, AUE_NULL, NULL, 0, 0 },	/* 130 = linux_get_kernel_syms */
+	{ 0, (sy_call_t *)linux_quotactl, AUE_QUOTACTL, NULL, 0, 0 },	/* 131 = linux_quotactl */
+	{ AS(getpgid_args), (sy_call_t *)getpgid, AUE_GETPGID, NULL, 0, 0 },	/* 132 = getpgid */
+	{ AS(fchdir_args), (sy_call_t *)fchdir, AUE_FCHDIR, NULL, 0, 0 },	/* 133 = fchdir */
+	{ 0, (sy_call_t *)linux_bdflush, AUE_BDFLUSH, NULL, 0, 0 },	/* 134 = linux_bdflush */
+	{ AS(linux_sysfs_args), (sy_call_t *)linux_sysfs, AUE_NULL, NULL, 0, 0 },	/* 135 = linux_sysfs */
+	{ AS(linux_personality_args), (sy_call_t *)linux_personality, AUE_PERSONALITY, NULL, 0, 0 },	/* 136 = linux_personality */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 137 = afs_syscall */
+	{ AS(linux_setfsuid16_args), (sy_call_t *)linux_setfsuid16, AUE_SETFSUID, NULL, 0, 0 },	/* 138 = linux_setfsuid16 */
+	{ AS(linux_setfsgid16_args), (sy_call_t *)linux_setfsgid16, AUE_SETFSGID, NULL, 0, 0 },	/* 139 = linux_setfsgid16 */
+	{ AS(linux_llseek_args), (sy_call_t *)linux_llseek, AUE_LSEEK, NULL, 0, 0 },	/* 140 = linux_llseek */
+	{ AS(linux_getdents_args), (sy_call_t *)linux_getdents, AUE_O_GETDENTS, NULL, 0, 0 },	/* 141 = linux_getdents */
+	{ AS(linux_select_args), (sy_call_t *)linux_select, AUE_SELECT, NULL, 0, 0 },	/* 142 = linux_select */
+	{ AS(flock_args), (sy_call_t *)flock, AUE_FLOCK, NULL, 0, 0 },	/* 143 = flock */
+	{ AS(linux_msync_args), (sy_call_t *)linux_msync, AUE_MSYNC, NULL, 0, 0 },	/* 144 = linux_msync */
+	{ AS(readv_args), (sy_call_t *)readv, AUE_READV, NULL, 0, 0 },	/* 145 = readv */
+	{ AS(writev_args), (sy_call_t *)writev, AUE_WRITEV, NULL, 0, 0 },	/* 146 = writev */
+	{ AS(linux_getsid_args), (sy_call_t *)linux_getsid, AUE_GETSID, NULL, 0, 0 },	/* 147 = linux_getsid */
+	{ AS(linux_fdatasync_args), (sy_call_t *)linux_fdatasync, AUE_NULL, NULL, 0, 0 },	/* 148 = linux_fdatasync */
+	{ AS(linux_sysctl_args), (sy_call_t *)linux_sysctl, AUE_SYSCTL, NULL, 0, 0 },	/* 149 = linux_sysctl */
+	{ AS(mlock_args), (sy_call_t *)mlock, AUE_MLOCK, NULL, 0, 0 },	/* 150 = mlock */
+	{ AS(munlock_args), (sy_call_t *)munlock, AUE_MUNLOCK, NULL, 0, 0 },	/* 151 = munlock */
+	{ AS(mlockall_args), (sy_call_t *)mlockall, AUE_MLOCKALL, NULL, 0, 0 },	/* 152 = mlockall */
+	{ 0, (sy_call_t *)munlockall, AUE_MUNLOCKALL, NULL, 0, 0 },	/* 153 = munlockall */
+	{ AS(sched_setparam_args), (sy_call_t *)sched_setparam, AUE_SCHED_SETPARAM, NULL, 0, 0 },	/* 154 = sched_setparam */
+	{ AS(sched_getparam_args), (sy_call_t *)sched_getparam, AUE_SCHED_GETPARAM, NULL, 0, 0 },	/* 155 = sched_getparam */
+	{ AS(linux_sched_setscheduler_args), (sy_call_t *)linux_sched_setscheduler, AUE_SCHED_SETSCHEDULER, NULL, 0, 0 },	/* 156 = linux_sched_setscheduler */
+	{ AS(linux_sched_getscheduler_args), (sy_call_t *)linux_sched_getscheduler, AUE_SCHED_GETSCHEDULER, NULL, 0, 0 },	/* 157 = linux_sched_getscheduler */
+	{ 0, (sy_call_t *)sched_yield, AUE_NULL, NULL, 0, 0 },	/* 158 = sched_yield */
+	{ AS(linux_sched_get_priority_max_args), (sy_call_t *)linux_sched_get_priority_max, AUE_SCHED_GET_PRIORITY_MAX, NULL, 0, 0 },	/* 159 = linux_sched_get_priority_max */
+	{ AS(linux_sched_get_priority_min_args), (sy_call_t *)linux_sched_get_priority_min, AUE_SCHED_GET_PRIORITY_MIN, NULL, 0, 0 },	/* 160 = linux_sched_get_priority_min */
+	{ AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval, AUE_SCHED_RR_GET_INTERVAL, NULL, 0, 0 },	/* 161 = sched_rr_get_interval */
+	{ AS(nanosleep_args), (sy_call_t *)nanosleep, AUE_NULL, NULL, 0, 0 },	/* 162 = nanosleep */
+	{ AS(linux_mremap_args), (sy_call_t *)linux_mremap, AUE_NULL, NULL, 0, 0 },	/* 163 = linux_mremap */
+	{ AS(linux_setresuid16_args), (sy_call_t *)linux_setresuid16, AUE_SETRESUID, NULL, 0, 0 },	/* 164 = linux_setresuid16 */
+	{ AS(linux_getresuid16_args), (sy_call_t *)linux_getresuid16, AUE_GETRESUID, NULL, 0, 0 },	/* 165 = linux_getresuid16 */
+	{ 0, (sy_call_t *)linux_vm86, AUE_NULL, NULL, 0, 0 },		/* 166 = linux_vm86 */
+	{ 0, (sy_call_t *)linux_query_module, AUE_NULL, NULL, 0, 0 },	/* 167 = linux_query_module */
+	{ AS(poll_args), (sy_call_t *)poll, AUE_POLL, NULL, 0, 0 },	/* 168 = poll */
+	{ 0, (sy_call_t *)linux_nfsservctl, AUE_NULL, NULL, 0, 0 },	/* 169 = linux_nfsservctl */
+	{ AS(linux_setresgid16_args), (sy_call_t *)linux_setresgid16, AUE_SETRESGID, NULL, 0, 0 },	/* 170 = linux_setresgid16 */
+	{ AS(linux_getresgid16_args), (sy_call_t *)linux_getresgid16, AUE_GETRESGID, NULL, 0, 0 },	/* 171 = linux_getresgid16 */
+	{ 0, (sy_call_t *)linux_prctl, AUE_PRCTL, NULL, 0, 0 },	/* 172 = linux_prctl */
+	{ AS(linux_rt_sigreturn_args), (sy_call_t *)linux_rt_sigreturn, AUE_NULL, NULL, 0, 0 },	/* 173 = linux_rt_sigreturn */
+	{ AS(linux_rt_sigaction_args), (sy_call_t *)linux_rt_sigaction, AUE_NULL, NULL, 0, 0 },	/* 174 = linux_rt_sigaction */
+	{ AS(linux_rt_sigprocmask_args), (sy_call_t *)linux_rt_sigprocmask, AUE_NULL, NULL, 0, 0 },	/* 175 = linux_rt_sigprocmask */
+	{ AS(linux_rt_sigpending_args), (sy_call_t *)linux_rt_sigpending, AUE_NULL, NULL, 0, 0 },	/* 176 = linux_rt_sigpending */
+	{ 0, (sy_call_t *)linux_rt_sigtimedwait, AUE_NULL, NULL, 0, 0 },	/* 177 = linux_rt_sigtimedwait */
+	{ 0, (sy_call_t *)linux_rt_sigqueueinfo, AUE_NULL, NULL, 0, 0 },	/* 178 = linux_rt_sigqueueinfo */
+	{ AS(linux_rt_sigsuspend_args), (sy_call_t *)linux_rt_sigsuspend, AUE_NULL, NULL, 0, 0 },	/* 179 = linux_rt_sigsuspend */
+	{ AS(linux_pread_args), (sy_call_t *)linux_pread, AUE_PREAD, NULL, 0, 0 },	/* 180 = linux_pread */
+	{ AS(linux_pwrite_args), (sy_call_t *)linux_pwrite, AUE_PWRITE, NULL, 0, 0 },	/* 181 = linux_pwrite */
+	{ AS(linux_chown16_args), (sy_call_t *)linux_chown16, AUE_CHOWN, NULL, 0, 0 },	/* 182 = linux_chown16 */
+	{ AS(linux_getcwd_args), (sy_call_t *)linux_getcwd, AUE_GETCWD, NULL, 0, 0 },	/* 183 = linux_getcwd */
+	{ 0, (sy_call_t *)linux_capget, AUE_CAPGET, NULL, 0, 0 },	/* 184 = linux_capget */
+	{ 0, (sy_call_t *)linux_capset, AUE_CAPSET, NULL, 0, 0 },	/* 185 = linux_capset */
+	{ AS(linux_sigaltstack_args), (sy_call_t *)linux_sigaltstack, AUE_NULL, NULL, 0, 0 },	/* 186 = linux_sigaltstack */
+	{ 0, (sy_call_t *)linux_sendfile, AUE_SENDFILE, NULL, 0, 0 },	/* 187 = linux_sendfile */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 188 = getpmsg */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 189 = putpmsg */
+	{ 0, (sy_call_t *)linux_vfork, AUE_VFORK, NULL, 0, 0 },	/* 190 = linux_vfork */
+	{ AS(linux_getrlimit_args), (sy_call_t *)linux_getrlimit, AUE_GETRLIMIT, NULL, 0, 0 },	/* 191 = linux_getrlimit */
+	{ AS(linux_mmap2_args), (sy_call_t *)linux_mmap2, AUE_MMAP, NULL, 0, 0 },	/* 192 = linux_mmap2 */
+	{ AS(linux_truncate64_args), (sy_call_t *)linux_truncate64, AUE_TRUNCATE, NULL, 0, 0 },	/* 193 = linux_truncate64 */
+	{ AS(linux_ftruncate64_args), (sy_call_t *)linux_ftruncate64, AUE_FTRUNCATE, NULL, 0, 0 },	/* 194 = linux_ftruncate64 */
+	{ AS(linux_stat64_args), (sy_call_t *)linux_stat64, AUE_STAT, NULL, 0, 0 },	/* 195 = linux_stat64 */
+	{ AS(linux_lstat64_args), (sy_call_t *)linux_lstat64, AUE_LSTAT, NULL, 0, 0 },	/* 196 = linux_lstat64 */
+	{ AS(linux_fstat64_args), (sy_call_t *)linux_fstat64, AUE_FSTAT, NULL, 0, 0 },	/* 197 = linux_fstat64 */
+	{ AS(linux_lchown_args), (sy_call_t *)linux_lchown, AUE_LCHOWN, NULL, 0, 0 },	/* 198 = linux_lchown */
+	{ 0, (sy_call_t *)linux_getuid, AUE_GETUID, NULL, 0, 0 },	/* 199 = linux_getuid */
+	{ 0, (sy_call_t *)linux_getgid, AUE_GETGID, NULL, 0, 0 },	/* 200 = linux_getgid */
+	{ 0, (sy_call_t *)geteuid, AUE_GETEUID, NULL, 0, 0 },		/* 201 = geteuid */
+	{ 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 },		/* 202 = getegid */
+	{ AS(setreuid_args), (sy_call_t *)setreuid, AUE_SETREUID, NULL, 0, 0 },	/* 203 = setreuid */
+	{ AS(setregid_args), (sy_call_t *)setregid, AUE_SETREGID, NULL, 0, 0 },	/* 204 = setregid */
+	{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups, AUE_GETGROUPS, NULL, 0, 0 },	/* 205 = linux_getgroups */
+	{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups, AUE_SETGROUPS, NULL, 0, 0 },	/* 206 = linux_setgroups */
+	{ AS(fchown_args), (sy_call_t *)fchown, AUE_NULL, NULL, 0, 0 },	/* 207 = fchown */
+	{ AS(setresuid_args), (sy_call_t *)setresuid, AUE_SETRESUID, NULL, 0, 0 },	/* 208 = setresuid */
+	{ AS(getresuid_args), (sy_call_t *)getresuid, AUE_GETRESUID, NULL, 0, 0 },	/* 209 = getresuid */
+	{ AS(setresgid_args), (sy_call_t *)setresgid, AUE_SETRESGID, NULL, 0, 0 },	/* 210 = setresgid */
+	{ AS(getresgid_args), (sy_call_t *)getresgid, AUE_GETRESGID, NULL, 0, 0 },	/* 211 = getresgid */
+	{ AS(linux_chown_args), (sy_call_t *)linux_chown, AUE_CHOWN, NULL, 0, 0 },	/* 212 = linux_chown */
+	{ AS(setuid_args), (sy_call_t *)setuid, AUE_SETUID, NULL, 0, 0 },	/* 213 = setuid */
+	{ AS(setgid_args), (sy_call_t *)setgid, AUE_SETGID, NULL, 0, 0 },	/* 214 = setgid */
+	{ AS(linux_setfsuid_args), (sy_call_t *)linux_setfsuid, AUE_SETFSUID, NULL, 0, 0 },	/* 215 = linux_setfsuid */
+	{ AS(linux_setfsgid_args), (sy_call_t *)linux_setfsgid, AUE_SETFSGID, NULL, 0, 0 },	/* 216 = linux_setfsgid */
+	{ AS(linux_pivot_root_args), (sy_call_t *)linux_pivot_root, AUE_PIVOT_ROOT, NULL, 0, 0 },	/* 217 = linux_pivot_root */
+	{ AS(linux_mincore_args), (sy_call_t *)linux_mincore, AUE_MINCORE, NULL, 0, 0 },	/* 218 = linux_mincore */
+	{ AS(madvise_args), (sy_call_t *)madvise, AUE_MADVISE, NULL, 0, 0 },	/* 219 = madvise */
+	{ AS(linux_getdents64_args), (sy_call_t *)linux_getdents64, AUE_O_GETDENTS, NULL, 0, 0 },	/* 220 = linux_getdents64 */
+	{ AS(linux_fcntl64_args), (sy_call_t *)linux_fcntl64, AUE_FCNTL, NULL, 0, 0 },	/* 221 = linux_fcntl64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 222 =  */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 223 =  */
+	{ 0, (sy_call_t *)linux_gettid, AUE_NULL, NULL, 0, 0 },	/* 224 = linux_gettid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 225 = linux_readahead */
+	{ 0, (sy_call_t *)linux_setxattr, AUE_NULL, NULL, 0, 0 },	/* 226 = linux_setxattr */
+	{ 0, (sy_call_t *)linux_lsetxattr, AUE_NULL, NULL, 0, 0 },	/* 227 = linux_lsetxattr */
+	{ 0, (sy_call_t *)linux_fsetxattr, AUE_NULL, NULL, 0, 0 },	/* 228 = linux_fsetxattr */
+	{ 0, (sy_call_t *)linux_getxattr, AUE_NULL, NULL, 0, 0 },	/* 229 = linux_getxattr */
+	{ 0, (sy_call_t *)linux_lgetxattr, AUE_NULL, NULL, 0, 0 },	/* 230 = linux_lgetxattr */
+	{ 0, (sy_call_t *)linux_fgetxattr, AUE_NULL, NULL, 0, 0 },	/* 231 = linux_fgetxattr */
+	{ 0, (sy_call_t *)linux_listxattr, AUE_NULL, NULL, 0, 0 },	/* 232 = linux_listxattr */
+	{ 0, (sy_call_t *)linux_llistxattr, AUE_NULL, NULL, 0, 0 },	/* 233 = linux_llistxattr */
+	{ 0, (sy_call_t *)linux_flistxattr, AUE_NULL, NULL, 0, 0 },	/* 234 = linux_flistxattr */
+	{ 0, (sy_call_t *)linux_removexattr, AUE_NULL, NULL, 0, 0 },	/* 235 = linux_removexattr */
+	{ 0, (sy_call_t *)linux_lremovexattr, AUE_NULL, NULL, 0, 0 },	/* 236 = linux_lremovexattr */
+	{ 0, (sy_call_t *)linux_fremovexattr, AUE_NULL, NULL, 0, 0 },	/* 237 = linux_fremovexattr */
+	{ AS(linux_tkill_args), (sy_call_t *)linux_tkill, AUE_NULL, NULL, 0, 0 },	/* 238 = linux_tkill */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 239 = linux_sendfile64 */
+	{ AS(linux_sys_futex_args), (sy_call_t *)linux_sys_futex, AUE_NULL, NULL, 0, 0 },	/* 240 = linux_sys_futex */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 241 = linux_sched_setaffinity */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 242 = linux_sched_getaffinity */
+	{ AS(linux_set_thread_area_args), (sy_call_t *)linux_set_thread_area, AUE_NULL, NULL, 0, 0 },	/* 243 = linux_set_thread_area */
+	{ AS(linux_get_thread_area_args), (sy_call_t *)linux_get_thread_area, AUE_NULL, NULL, 0, 0 },	/* 244 = linux_get_thread_area */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 245 = linux_io_setup */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 246 = linux_io_destroy */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 247 = linux_io_getevents */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 248 = linux_io_submit */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 249 = linux_io_cancel */
+	{ 0, (sy_call_t *)linux_fadvise64, AUE_NULL, NULL, 0, 0 },	/* 250 = linux_fadvise64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 251 =  */
+	{ AS(linux_exit_group_args), (sy_call_t *)linux_exit_group, AUE_EXIT, NULL, 0, 0 },	/* 252 = linux_exit_group */
+	{ 0, (sy_call_t *)linux_lookup_dcookie, AUE_NULL, NULL, 0, 0 },	/* 253 = linux_lookup_dcookie */
+	{ 0, (sy_call_t *)linux_epoll_create, AUE_NULL, NULL, 0, 0 },	/* 254 = linux_epoll_create */
+	{ 0, (sy_call_t *)linux_epoll_ctl, AUE_NULL, NULL, 0, 0 },	/* 255 = linux_epoll_ctl */
+	{ 0, (sy_call_t *)linux_epoll_wait, AUE_NULL, NULL, 0, 0 },	/* 256 = linux_epoll_wait */
+	{ 0, (sy_call_t *)linux_remap_file_pages, AUE_NULL, NULL, 0, 0 },	/* 257 = linux_remap_file_pages */
+	{ AS(linux_set_tid_address_args), (sy_call_t *)linux_set_tid_address, AUE_NULL, NULL, 0, 0 },	/* 258 = linux_set_tid_address */
+	{ AS(linux_timer_create_args), (sy_call_t *)linux_timer_create, AUE_NULL, NULL, 0, 0 },	/* 259 = linux_timer_create */
+	{ AS(linux_timer_settime_args), (sy_call_t *)linux_timer_settime, AUE_NULL, NULL, 0, 0 },	/* 260 = linux_timer_settime */
+	{ AS(linux_timer_gettime_args), (sy_call_t *)linux_timer_gettime, AUE_NULL, NULL, 0, 0 },	/* 261 = linux_timer_gettime */
+	{ AS(linux_timer_getoverrun_args), (sy_call_t *)linux_timer_getoverrun, AUE_NULL, NULL, 0, 0 },	/* 262 = linux_timer_getoverrun */
+	{ AS(linux_timer_delete_args), (sy_call_t *)linux_timer_delete, AUE_NULL, NULL, 0, 0 },	/* 263 = linux_timer_delete */
+	{ AS(linux_clock_settime_args), (sy_call_t *)linux_clock_settime, AUE_CLOCK_SETTIME, NULL, 0, 0 },	/* 264 = linux_clock_settime */
+	{ AS(linux_clock_gettime_args), (sy_call_t *)linux_clock_gettime, AUE_NULL, NULL, 0, 0 },	/* 265 = linux_clock_gettime */
+	{ AS(linux_clock_getres_args), (sy_call_t *)linux_clock_getres, AUE_NULL, NULL, 0, 0 },	/* 266 = linux_clock_getres */
+	{ AS(linux_clock_nanosleep_args), (sy_call_t *)linux_clock_nanosleep, AUE_NULL, NULL, 0, 0 },	/* 267 = linux_clock_nanosleep */
+	{ 0, (sy_call_t *)linux_statfs64, AUE_NULL, NULL, 0, 0 },	/* 268 = linux_statfs64 */
+	{ 0, (sy_call_t *)linux_fstatfs64, AUE_NULL, NULL, 0, 0 },	/* 269 = linux_fstatfs64 */
+	{ AS(linux_tgkill_args), (sy_call_t *)linux_tgkill, AUE_NULL, NULL, 0, 0 },	/* 270 = linux_tgkill */
+	{ 0, (sy_call_t *)linux_utimes, AUE_NULL, NULL, 0, 0 },	/* 271 = linux_utimes */
+	{ 0, (sy_call_t *)linux_fadvise64_64, AUE_NULL, NULL, 0, 0 },	/* 272 = linux_fadvise64_64 */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 273 =  */
+	{ 0, (sy_call_t *)linux_mbind, AUE_NULL, NULL, 0, 0 },	/* 274 = linux_mbind */
+	{ 0, (sy_call_t *)linux_get_mempolicy, AUE_NULL, NULL, 0, 0 },	/* 275 = linux_get_mempolicy */
+	{ 0, (sy_call_t *)linux_set_mempolicy, AUE_NULL, NULL, 0, 0 },	/* 276 = linux_set_mempolicy */
+	{ AS(linux_mq_open_args), (sy_call_t *)linux_mq_open, AUE_NULL, NULL, 0, 0 },	/* 277 = linux_mq_open */
+	{ AS(linux_mq_unlink_args), (sy_call_t *)linux_mq_unlink, AUE_NULL, NULL, 0, 0 },	/* 278 = linux_mq_unlink */
+	{ AS(linux_mq_timedsend_args), (sy_call_t *)linux_mq_timedsend, AUE_NULL, NULL, 0, 0 },	/* 279 = linux_mq_timedsend */
+	{ AS(linux_mq_timedreceive_args), (sy_call_t *)linux_mq_timedreceive, AUE_NULL, NULL, 0, 0 },	/* 280 = linux_mq_timedreceive */
+	{ AS(linux_mq_notify_args), (sy_call_t *)linux_mq_notify, AUE_NULL, NULL, 0, 0 },	/* 281 = linux_mq_notify */
+	{ AS(linux_mq_getsetattr_args), (sy_call_t *)linux_mq_getsetattr, AUE_NULL, NULL, 0, 0 },	/* 282 = linux_mq_getsetattr */
+	{ 0, (sy_call_t *)linux_kexec_load, AUE_NULL, NULL, 0, 0 },	/* 283 = linux_kexec_load */
+	{ 0, (sy_call_t *)linux_waitid, AUE_NULL, NULL, 0, 0 },	/* 284 = linux_waitid */
+	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 285 =  */
+	{ 0, (sy_call_t *)linux_add_key, AUE_NULL, NULL, 0, 0 },	/* 286 = linux_add_key */
+	{ 0, (sy_call_t *)linux_request_key, AUE_NULL, NULL, 0, 0 },	/* 287 = linux_request_key */
+	{ 0, (sy_call_t *)linux_keyctl, AUE_NULL, NULL, 0, 0 },	/* 288 = linux_keyctl */
+	{ 0, (sy_call_t *)linux_ioprio_set, AUE_NULL, NULL, 0, 0 },	/* 289 = linux_ioprio_set */
+	{ 0, (sy_call_t *)linux_ioprio_get, AUE_NULL, NULL, 0, 0 },	/* 290 = linux_ioprio_get */
+	{ 0, (sy_call_t *)linux_inotify_init, AUE_NULL, NULL, 0, 0 },	/* 291 = linux_inotify_init */
+	{ 0, (sy_call_t *)linux_inotify_add_watch, AUE_NULL, NULL, 0, 0 },	/* 292 = linux_inotify_add_watch */
+	{ 0, (sy_call_t *)linux_inotify_rm_watch, AUE_NULL, NULL, 0, 0 },	/* 293 = linux_inotify_rm_watch */
+	{ 0, (sy_call_t *)linux_migrate_pages, AUE_NULL, NULL, 0, 0 },	/* 294 = linux_migrate_pages */
+	{ 0, (sy_call_t *)linux_openat, AUE_NULL, NULL, 0, 0 },	/* 295 = linux_openat */
+	{ 0, (sy_call_t *)linux_mkdirat, AUE_NULL, NULL, 0, 0 },	/* 296 = linux_mkdirat */
+	{ 0, (sy_call_t *)linux_mknodat, AUE_NULL, NULL, 0, 0 },	/* 297 = linux_mknodat */
+	{ 0, (sy_call_t *)linux_fchownat, AUE_NULL, NULL, 0, 0 },	/* 298 = linux_fchownat */
+	{ 0, (sy_call_t *)linux_futimesat, AUE_NULL, NULL, 0, 0 },	/* 299 = linux_futimesat */
+	{ 0, (sy_call_t *)linux_fstatat64, AUE_NULL, NULL, 0, 0 },	/* 300 = linux_fstatat64 */
+	{ 0, (sy_call_t *)linux_unlinkat, AUE_NULL, NULL, 0, 0 },	/* 301 = linux_unlinkat */
+	{ 0, (sy_call_t *)linux_renameat, AUE_NULL, NULL, 0, 0 },	/* 302 = linux_renameat */
+	{ 0, (sy_call_t *)linux_linkat, AUE_NULL, NULL, 0, 0 },	/* 303 = linux_linkat */
+	{ 0, (sy_call_t *)linux_symlinkat, AUE_NULL, NULL, 0, 0 },	/* 304 = linux_symlinkat */
+	{ 0, (sy_call_t *)linux_readlinkat, AUE_NULL, NULL, 0, 0 },	/* 305 = linux_readlinkat */
+	{ 0, (sy_call_t *)linux_fchmodat, AUE_NULL, NULL, 0, 0 },	/* 306 = linux_fchmodat */
+	{ 0, (sy_call_t *)linux_faccessat, AUE_NULL, NULL, 0, 0 },	/* 307 = linux_faccessat */
+	{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 },	/* 308 = linux_pselect6 */
+	{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 },	/* 309 = linux_ppoll */
+	{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 },	/* 310 = linux_unshare */
 };
--- i386/linux/linux_sysvec.c.orig
+++ i386/linux/linux_sysvec.c
@@ -46,6 +46,7 @@
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/vnode.h>
+#include <sys/eventhandler.h>
 
 #include <vm/vm.h>
 #include <vm/pmap.h>
@@ -105,6 +106,18 @@
 static void	exec_linux_setregs(struct thread *td, u_long entry,
 				   u_long stack, u_long ps_strings);
 
+extern void linux_proc_exit(void *, struct proc *, struct image_params *);
+extern void linux_proc_exec(void *, struct proc *, struct image_params *);
+extern void linux_schedtail(void *, struct proc *);
+extern LIST_HEAD(futex_list, futex) futex_list;
+extern struct sx emul_shared_lock;
+extern struct sx emul_lock;
+extern struct mtx futex_mtx;
+
+static eventhandler_tag linux_exit_tag;
+static eventhandler_tag linux_schedtail_tag;
+static eventhandler_tag linux_exec_tag;
+
 /*
  * Linux syscalls return negative errno's, we do positive and map them
  * Reference:
@@ -804,7 +817,7 @@
 struct sysentvec linux_sysvec = {
 	LINUX_SYS_MAXSYSCALL,
 	linux_sysent,
-	0xff,
+	0,
 	LINUX_SIGTBLSZ,
 	bsd_to_linux_signal,
 	ELAST + 1,
@@ -833,7 +846,7 @@
 struct sysentvec elf_linux_sysvec = {
 	LINUX_SYS_MAXSYSCALL,
 	linux_sysent,
-	0xff,
+	0,
 	LINUX_SIGTBLSZ,
 	bsd_to_linux_signal,
 	ELAST + 1,
@@ -908,6 +921,16 @@
 				linux_ioctl_register_handler(*lihp);
 			SET_FOREACH(ldhp, linux_device_handler_set)
 				linux_device_register_handler(*ldhp);
+			sx_init(&emul_lock, "emuldata lock");
+			sx_init(&emul_shared_lock, "emuldata->shared lock");
+			LIST_INIT(&futex_list);
+			mtx_init(&futex_mtx, "futex protection lock", NULL, MTX_DEF);
+			linux_exit_tag = EVENTHANDLER_REGISTER(process_exit, linux_proc_exit,
+			      NULL, 1000);
+			linux_schedtail_tag = EVENTHANDLER_REGISTER(schedtail, linux_schedtail,
+			      NULL, 1000);
+			linux_exec_tag = EVENTHANDLER_REGISTER(process_exec, linux_proc_exec,
+			      NULL, 1000);
 			if (bootverbose)
 				printf("Linux ELF exec handler installed\n");
 		} else
@@ -929,6 +952,12 @@
 				linux_ioctl_unregister_handler(*lihp);
 			SET_FOREACH(ldhp, linux_device_handler_set)
 				linux_device_unregister_handler(*ldhp);
+			sx_destroy(&emul_lock);
+			sx_destroy(&emul_shared_lock);
+			mtx_destroy(&futex_mtx);
+			EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
+			EVENTHANDLER_DEREGISTER(schedtail, linux_schedtail_tag);
+			EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
 			if (bootverbose)
 				printf("Linux ELF exec handler removed\n");
 		} else
--- i386/linux/syscalls.master.orig
+++ i386/linux/syscalls.master
@@ -120,10 +120,10 @@
 61	AUE_CHROOT	NOPROTO	{ int chroot(char *path); }
 62	AUE_NULL	STD	{ int linux_ustat(l_dev_t dev, \
 				    struct l_ustat *ubuf); }
-63	AUE_DUP2	NOPROTO	{ int dup2(u_int from, u_int to); }
-64	AUE_GETPPID	NOPROTO	{ int getppid(void); }
-65	AUE_GETPGRP	NOPROTO	{ int getpgrp(void); }
-66	AUE_SETSID	NOPROTO	{ int setsid(void); }
+63	AUE_DUP2	NOPROTO { int dup2(u_int from, u_int to); }
+64	AUE_GETPPID	STD	{ int linux_getppid(void); }
+65	AUE_GETPGRP	NOPROTO { int getpgrp(void); }
+66	AUE_SETSID	NOPROTO { int setsid(void); }
 67	AUE_NULL	STD	{ int linux_sigaction(l_int sig, \
 				    l_osigaction_t *nsa, \
 				    l_osigaction_t *osa); }
@@ -214,8 +214,10 @@
 118	AUE_FSYNC	NOPROTO	{ int fsync(int fd); }
 119	AUE_SIGRETURN	STD	{ int linux_sigreturn( \
 				    struct l_sigframe *sfp); }
-120	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack); }
-121	AUE_SYSCTL	NOPROTO	{ int setdomainname(char *name, \
+; linux uses some strange calling convention here so we have to use the dummy arg
+120	AUE_RFORK	STD	{ int linux_clone(l_int flags, void *stack, \
+				    void *parent_tidptr, int dummy, void * child_tidptr); }
+121	AUE_SYSCTL	NOPROTO { int setdomainname(char *name, \
 				    int len); }
 122	AUE_NULL	STD	{ int linux_newuname( \
 				    struct l_new_utsname *buf); }
@@ -400,11 +402,12 @@
 237	AUE_NULL	STD	{ int linux_fremovexattr(void); }
 238	AUE_NULL	STD	{ int linux_tkill(int tid, int sig); }
 239	AUE_SENDFILE	UNIMPL	linux_sendfile64
-240	AUE_NULL	UNIMPL	linux_futex
+240	AUE_NULL	STD	{ int linux_sys_futex(void *uaddr, int op, int val, \
+					struct l_timespec *timeout, void *uaddr2, int val3); }
 241	AUE_NULL	UNIMPL	linux_sched_setaffinity
 242	AUE_NULL	UNIMPL	linux_sched_getaffinity
-243	AUE_NULL	STD	{ int linux_set_thread_area(void *entry); }
-244	AUE_NULL	UNIMPL	linux_get_thread_area
+243	AUE_NULL	STD	{ int linux_set_thread_area(struct l_user_desc *desc); }
+244	AUE_NULL	STD	{ int linux_get_thread_area(struct l_user_desc *desc); }
 245	AUE_NULL	UNIMPL	linux_io_setup
 246	AUE_NULL	UNIMPL	linux_io_destroy
 247	AUE_NULL	UNIMPL	linux_io_getevents
@@ -412,38 +415,46 @@
 249	AUE_NULL	UNIMPL	linux_io_cancel
 250	AUE_NULL	STD	{ int linux_fadvise64(void); }
 251	AUE_NULL	UNIMPL
-252	AUE_EXIT	NOPROTO	{ void sys_exit(int rval); } exit_group \
-				    sys_exit_args void
+252	AUE_EXIT	STD	{ int linux_exit_group(int error_code); }
 253	AUE_NULL	STD	{ int linux_lookup_dcookie(void); }
 254	AUE_NULL	STD	{ int linux_epoll_create(void); }
 255	AUE_NULL	STD	{ int linux_epoll_ctl(void); }
 256	AUE_NULL	STD	{ int linux_epoll_wait(void); }
 257	AUE_NULL	STD	{ int linux_remap_file_pages(void); }
-258	AUE_NULL	STD	{ int linux_set_tid_address(void); }
-259	AUE_NULL	STD	{ int linux_timer_create(void); }
-260	AUE_NULL	STD	{ int linux_timer_settime(void); }
-261	AUE_NULL	STD	{ int linux_timer_gettime(void); }
-262	AUE_NULL	STD	{ int linux_timer_getoverrun(void); }
-263	AUE_NULL	STD	{ int linux_timer_delete(void); }
-264	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(void); }
-265	AUE_NULL	STD	{ int linux_clock_gettime(void); }
-266	AUE_NULL	STD	{ int linux_clock_getres(void); }
-267	AUE_NULL	STD	{ int linux_clock_nanosleep(void); }
+258	AUE_NULL	STD	{ int linux_set_tid_address(int *tidptr); }
+259	AUE_NULL	STD	{ int linux_timer_create(clockid_t clock_id, \
+					struct sigevent *evp, l_timer_t *timerid); }
+260	AUE_NULL	STD	{ int linux_timer_settime(l_timer_t timerid, \
+					const struct itimerspec *new, struct itimerspec *old); }
+261	AUE_NULL	STD	{ int linux_timer_gettime(l_timer_t timerid, struct itimerspec *setting); }
+262	AUE_NULL	STD	{ int linux_timer_getoverrun(l_timer_t timerid); }
+263	AUE_NULL	STD	{ int linux_timer_delete(l_timer_t timerid); }
+264	AUE_CLOCK_SETTIME	STD	{ int linux_clock_settime(clockid_t which, struct l_timespec *tp); }
+265	AUE_NULL	STD	{ int linux_clock_gettime(clockid_t which, struct l_timespec *tp); }
+266	AUE_NULL	STD	{ int linux_clock_getres(clockid_t which, struct l_timespec *tp); }
+267	AUE_NULL	STD	{ int linux_clock_nanosleep(clockid_t which, int flags, \
+					struct l_timespec *rqtp, struct l_timespec *rmtp); }
 268	AUE_NULL	STD	{ int linux_statfs64(void); }
 269	AUE_NULL	STD	{ int linux_fstatfs64(void); }
-270	AUE_NULL	STD	{ int linux_tgkill(void); }
+270	AUE_NULL	STD	{ int linux_tgkill(int tgid, int pid, int sig); }
 271	AUE_NULL	STD	{ int linux_utimes(void); }
 272	AUE_NULL	STD	{ int linux_fadvise64_64(void); }
 273	AUE_NULL	UNIMPL
 274	AUE_NULL	STD	{ int linux_mbind(void); }
 275	AUE_NULL	STD	{ int linux_get_mempolicy(void); }
 276	AUE_NULL	STD	{ int linux_set_mempolicy(void); }
-277	AUE_NULL	STD	{ int linux_mq_open(void); }
-278	AUE_NULL	STD	{ int linux_mq_unlink(void); }
-279	AUE_NULL	STD	{ int linux_mq_timedsend(void); }
-280	AUE_NULL	STD	{ int linux_mq_timedreceive(void); }
-281	AUE_NULL	STD	{ int linux_mq_notify(void); }
-282	AUE_NULL	STD	{ int linux_mq_getsetattr(void); }
+277	AUE_NULL	STD	{ int linux_mq_open(const char *name, int oflag, mode_t mode, \
+					struct mq_attr *attr); }
+278	AUE_NULL	STD	{ int linux_mq_unlink(const char *name); }
+279	AUE_NULL	STD	{ int linux_mq_timedsend(l_mqd_t mqd, const char *msg_ptr, \
+					size_t msg_len, unsigned int msg_prio, const struct \
+					l_timespec *abs_timeout); }
+280	AUE_NULL	STD	{ int linux_mq_timedreceive(l_mqd_t mqd, char *msg_ptr, \
+					size_t msg_len, unsigned int msg_prio, const struct \
+					l_timespec *abs_timeout); }
+281	AUE_NULL	STD	{ int linux_mq_notify(l_mqd_t mqd, const struct l_timespec *abs_timeout); }
+282	AUE_NULL	STD	{ int linux_mq_getsetattr(l_mqd_t mqd, const struct mq_attr *attr, \
+					struct mq_attr *oattr); }
 283	AUE_NULL	STD	{ int linux_kexec_load(void); }
 284	AUE_NULL	STD	{ int linux_waitid(void); }
 285	AUE_NULL	UNIMPL
--- kern/kern_exec.c.orig
+++ kern/kern_exec.c
@@ -889,9 +889,10 @@
 	vm_map_t map;
 
 	imgp->vmspace_destroyed = 1;
+	imgp->sysent = sv;
 
 	/* Called with Giant held, do not depend on it! */
-	EVENTHANDLER_INVOKE(process_exec, p);
+	EVENTHANDLER_INVOKE(process_exec, p, imgp);
 
 	/*
 	 * Here is as good a place as any to do any resource limit cleanups.
--- kern/kern_fork.c.orig
+++ kern/kern_fork.c
@@ -827,6 +827,8 @@
 		kthread_exit(0);
 	}
 	mtx_assert(&Giant, MA_NOTOWNED);
+
+	EVENTHANDLER_INVOKE(schedtail, p);
 }
 
 /*
--- kern/kern_time.c.orig
+++ kern/kern_time.c
@@ -88,7 +88,8 @@
 static void	itimer_leave(struct itimer *);
 static struct itimer *itimer_find(struct proc *, int, int);
 static void	itimers_alloc(struct proc *);
-static void	itimers_event_hook(void *arg, struct proc *p);
+static void	itimers_event_hook_exec(void *arg, struct proc *p, struct image_params *imgp);
+static void	itimers_event_hook_exit(void *arg, struct proc *p);
 static int	realtimer_create(struct itimer *);
 static int	realtimer_gettime(struct itimer *, struct itimerspec *);
 static int	realtimer_settime(struct itimer *, int,
@@ -892,9 +893,9 @@
 	p31b_setcfg(CTL_P1003_1B_TIMERS, 200112L);
 	p31b_setcfg(CTL_P1003_1B_DELAYTIMER_MAX, INT_MAX);
 	p31b_setcfg(CTL_P1003_1B_TIMER_MAX, TIMER_MAX);
-	EVENTHANDLER_REGISTER(process_exit, itimers_event_hook,
+	EVENTHANDLER_REGISTER(process_exit, itimers_event_hook_exit,
 		(void *)ITIMER_EV_EXIT, EVENTHANDLER_PRI_ANY);
-	EVENTHANDLER_REGISTER(process_exec, itimers_event_hook,
+	EVENTHANDLER_REGISTER(process_exec, itimers_event_hook_exec,
 		(void *)ITIMER_EV_EXEC, EVENTHANDLER_PRI_ANY);
 }
 
@@ -1510,9 +1511,15 @@
 	}
 }
 
+static void
+itimers_event_hook_exec(void *arg, struct proc *p, struct image_params *imgp __unused)
+{
+   	itimers_event_hook_exit(arg, p);
+}
+
 /* Clean up timers when some process events are being triggered. */
 static void
-itimers_event_hook(void *arg, struct proc *p)
+itimers_event_hook_exit(void *arg, struct proc *p)
 {
 	struct itimers *its;
 	struct itimer *it;
--- kern/link_elf_obj.c.orig
+++ kern/link_elf_obj.c
@@ -1114,6 +1114,51 @@
 }
 
 static void
+link_elf_fix_link_set(elf_file_t ef)
+{
+	static const char startn[] = "__start_";
+	static const char stopn[] = "__stop_";
+	Elf_Sym *sym;
+	const char *sym_name, *linkset_name;
+	Elf_Addr startp, stopp;
+	Elf_Size symidx;
+	int start, i;
+
+	startp = stopp = 0;
+	for (symidx = 1 /* zero entry is special */;
+		symidx < ef->ddbsymcnt; symidx++) {
+		sym = ef->ddbsymtab + symidx;
+		if (sym->st_shndx != SHN_UNDEF)
+			continue;
+
+		sym_name = ef->ddbstrtab + sym->st_name;
+		if (strncmp(sym_name, startn, sizeof(startn) - 1) == 0) {
+			start = 1;
+			linkset_name = sym_name + sizeof(startn) - 1;
+		}
+		else if (strncmp(sym_name, stopn, sizeof(stopn) - 1) == 0) {
+			start = 0;
+			linkset_name = sym_name + sizeof(stopn) - 1;
+		}
+		else
+			continue;
+
+		for (i = 0; i < ef->nprogtab; i++) {
+			if (strcmp(ef->progtab[i].name, linkset_name) == 0) {
+				startp = (Elf_Addr)ef->progtab[i].addr;
+				stopp = (Elf_Addr)(startp + ef->progtab[i].size);
+				break;
+			}
+		}
+		if (i == ef->nprogtab)
+			continue;
+
+		sym->st_value = start ? startp : stopp;
+		sym->st_shndx = i;
+	}
+}
+
+static void
 link_elf_reloc_local(linker_file_t lf)
 {
 	elf_file_t ef = (elf_file_t)lf;
@@ -1126,6 +1171,8 @@
 	int i;
 	Elf_Size symidx;
 
+	link_elf_fix_link_set(ef);
+
 	/* Perform relocations without addend if there are any: */
 	for (i = 0; i < ef->nrel; i++) {
 		rel = ef->reltab[i].rel;
--- kern/uipc_sem.c.orig
+++ kern/uipc_sem.c
@@ -71,6 +71,7 @@
 static int sem_perm(struct thread *td, struct ksem *ks);
 static void sem_enter(struct proc *p, struct ksem *ks);
 static int sem_leave(struct proc *p, struct ksem *ks);
+static void sem_exechook(void *arg, struct proc *p, struct image_params *imgp);
 static void sem_exithook(void *arg, struct proc *p);
 static void sem_forkhook(void *arg, struct proc *p1, struct proc *p2,
     int flags);
@@ -919,7 +920,13 @@
 }
 
 static void
-sem_exithook(void *arg, struct proc *p)
+sem_exithook(void *arg, struct proc *p, struct image_params *imgp __unused)
+{
+   	sem_exechook(arg, p);   	
+}
+
+static void
+sem_exechook(void *arg, struct proc *p)
 {
 	struct ksem *ks, *ksnext;
 
--- kern/vfs_aio.c.orig
+++ kern/vfs_aio.c
@@ -322,6 +322,7 @@
 			struct aioliojob *lio, int type, int osigev);
 static void	aio_physwakeup(struct buf *bp);
 static void	aio_proc_rundown(void *arg, struct proc *p);
+static void	aio_proc_rundown_exec(void *arg, struct proc *p, struct image_params *imgp);
 static int	aio_qphysio(struct proc *p, struct aiocblist *iocb);
 static void	biohelper(void *, int);
 static void	aio_daemon(void *param);
@@ -419,7 +420,7 @@
 	aio_swake = &aio_swake_cb;
 	exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL,
 	    EVENTHANDLER_PRI_ANY);
-	exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown, NULL,
+	exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, NULL,
 	    EVENTHANDLER_PRI_ANY);
 	kqueue_add_filteropts(EVFILT_AIO, &aio_filtops);
 	kqueue_add_filteropts(EVFILT_LIO, &lio_filtops);
@@ -630,6 +631,12 @@
 	return (0);
 }
 
+static void
+aio_proc_rundown_exec(void *arg, struct proc *p, struct image_params *imgp __unused)
+{
+   	aio_proc_rundown(arg, p);
+}
+
 /*
  * Rundown the jobs for a given process.
  */
--- modules/Makefile.orig
+++ modules/Makefile
@@ -465,6 +465,9 @@
 _ips=		ips
 _ipw=		ipw
 _iwi=		iwi
+_linprocfs=     linprocfs
+_linsysfs=      linsysfs
+_linux=		linux
 _mly=		mly
 _mxge=		mxge
 _ndis=		ndis
--- modules/linprocfs/Makefile.orig
+++ modules/linprocfs/Makefile
@@ -7,4 +7,8 @@
 	linprocfs.c \
 	opt_compat.h
 
+.if ${MACHINE_ARCH} == "amd64"
+CFLAGS+=-DCOMPAT_LINUX32
+.endif
+
 .include <bsd.kmod.mk>
--- modules/linsysfs/Makefile.orig
+++ modules/linsysfs/Makefile
@@ -8,4 +8,8 @@
 	linsysfs.c \
 	opt_compat.h
 
+.if ${MACHINE_ARCH} == "amd64"
+CFLAGS+=-DCOMPAT_LINUX32
+.endif
+
 .include <bsd.kmod.mk>
--- modules/linux/Makefile.orig
+++ modules/linux/Makefile
@@ -1,17 +1,22 @@
 # $FreeBSD: src/sys/modules/linux/Makefile,v 1.67 2006/05/05 16:10:45 ambrisko Exp $
 
-.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux
+.if ${MACHINE_ARCH} == "amd64"
+SFX= 32
+CFLAGS+=-DCOMPAT_IA32 -DCOMPAT_LINUX32
+.endif
+
+.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux${SFX}
 
 KMOD=	linux
-SRCS=	linux_dummy.c linux_file.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
-	linux_machdep.c linux_mib.c linux_misc.c linux_signal.c linux_socket.c \
-	linux_stats.c linux_sysctl.c linux_sysent.c linux_sysvec.c \
-	linux_util.c opt_inet6.h opt_mac.h \
+SRCS=	linux${SFX}_dummy.c linux_emul.c linux_file.c linux_futex.c linux_getcwd.c linux_ioctl.c \
+	linux_ipc.c linux${SFX}_machdep.c linux_mib.c linux_misc.c linux_signal.c \
+	linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c linux${SFX}_sysvec.c \
+	linux_uid16.c linux_util.c linux_time.c opt_inet6.h opt_mac.h opt_compat.h opt_posix.h \
 	vnode_if.h device_if.h bus_if.h
-OBJS=	linux_locore.o
+OBJS=	linux${SFX}_locore.o
 
 .if ${MACHINE_ARCH} == "i386"
-SRCS+=	linux_ptrace.c linux_uid16.c imgact_linux.c opt_cpu.h
+SRCS+=	linux_ptrace.c imgact_linux.c opt_cpu.h
 .endif
 
 EXPORT_SYMS=
@@ -22,19 +27,19 @@
 EXPORT_SYMS+=	linux_ioctl_register_handler
 EXPORT_SYMS+=	linux_ioctl_unregister_handler
 
-CLEANFILES=	linux_assym.h linux_genassym.o
+CLEANFILES=	linux${SFX}_assym.h linux${SFX}_genassym.o
 
-linux_assym.h: linux_genassym.o
+linux${SFX}_assym.h: linux${SFX}_genassym.o
 .if exists(@)
-linux_assym.h: @/kern/genassym.sh
+linux${SFX}_assym.h: @/kern/genassym.sh
 .endif
-	sh @/kern/genassym.sh linux_genassym.o > ${.TARGET}
+	sh @/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET}
 
-linux_locore.o: linux_locore.s linux_assym.h
+linux${SFX}_locore.o: linux${SFX}_locore.s linux${SFX}_assym.h
 	${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \
 	    ${.IMPSRC} -o ${.TARGET}
 
-linux_genassym.o: linux_genassym.c linux.h @ machine
+linux${SFX}_genassym.o: linux${SFX}_genassym.c linux.h @ machine
 	${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC}
 
 .if !defined(KERNBUILDDIR)
--- sys/eventhandler.h.orig
+++ sys/eventhandler.h
@@ -162,10 +162,11 @@
  * exec handlers are called with Giant, but that is by accident.
  */
 struct proc;
+struct image_params;
 
 typedef void (*exitlist_fn)(void *, struct proc *);
 typedef void (*forklist_fn)(void *, struct proc *, struct proc *, int);
-typedef void (*execlist_fn)(void *, struct proc *);
+typedef void (*execlist_fn)(void *, struct proc *, struct image_params *);
 
 EVENTHANDLER_DECLARE(process_exit, exitlist_fn);
 EVENTHANDLER_DECLARE(process_fork, forklist_fn);
@@ -174,4 +175,7 @@
 typedef void (*uma_zone_chfn)(void *);
 EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);
 EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
+
+typedef void(*schedtail_fn)(void *, struct proc *);
+EVENTHANDLER_DECLARE(schedtail, schedtail_fn);
 #endif /* SYS_EVENTHANDLER_H */
--- sys/imgact.h.orig
+++ sys/imgact.h
@@ -63,6 +63,7 @@
 	unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
 	size_t auxarg_size;
 	struct image_args *args;	/* system call arguments */
+	struct sysentvec *sysent;	/* system entry vector */
 };
 
 #ifdef _KERNEL
