#include <sys/appleapiopts.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signal.h>
#include <sys/mount.h>
#define syss(fn,no) {no, 0, KERNEL_FUNNEL, fn}
#define sysp(fn,no) {no, 1, KERNEL_FUNNEL, fn}
#define sysnets(fn,no) {no, 0, NETWORK_FUNNEL, fn}
#define sysnetp(fn,no) {no, 1, NETWORK_FUNNEL, fn}
#define sysnofnl(fn,no) {no, 0, NO_FUNNEL, fn}
int nosys();
int exit();
int fork();
int read();
int write();
int open();
int close();
int wait4();
int link();
int unlink();
int chdir();
int fchdir();
int mknod();
int chmod();
int chown();
int obreak();
int getfsstat();
#if COMPAT_GETFSSTAT
int ogetfsstat();
#endif
int getpid();
int mount();
int unmount();
int setuid();
int getuid();
int geteuid();
int ptrace();
int recvmsg();
int sendmsg();
int recvfrom();
int accept();
int getpeername();
int getsockname();
int access();
int chflags();
int fchflags();
int sync();
int kill();
int getppid();
int dup();
int pipe();
int getegid();
int profil();
int load_shared_file();
int reset_shared_file();
int new_system_shared_regions();
int ktrace();
int sigaction();
int getgid();
int sigprocmask();
int getlogin();
int setlogin();
int acct();
int sigpending();
int sigaltstack();
int ioctl();
int reboot();
int revoke();
int symlink();
int readlink();
int execve();
int umask();
int chroot();
int msync();
int vfork();
int sbrk();
int sstk();
int ovadvise();
int munmap();
int mprotect();
int madvise();
int mincore();
int getgroups();
int setgroups();
int getpgrp();
int setpgid();
int setitimer();
int swapon();
int getitimer();
int getdtablesize();
int dup2();
int fcntl();
int select();
int fsync();
int setpriority();
int socket();
int connect();
int getpriority();
#ifdef __ppc__
int osigreturn();
#endif
int sigreturn();
int bind();
int setsockopt();
int listen();
int sigsuspend();
#if TRACE
int vtrace();
#else
#endif
int gettimeofday();
#ifdef __ppc__
int ppc_gettimeofday();
#endif
int getrusage();
int getsockopt();
int readv();
int writev();
int settimeofday();
int fchown();
int fchmod();
int rename();
int flock();
int mkfifo();
int sendto();
int shutdown();
int socketpair();
int mkdir();
int rmdir();
int utimes();
int futimes();
int adjtime();
int setsid();
int quotactl();
int nfssvc();
int statfs();
int fstatfs();
int getfh();
int setgid();
int setegid();
int seteuid();
int stat();
int fstat();
int lstat();
int pathconf();
int fpathconf();
int getrlimit();
int setrlimit();
int getdirentries();
int mmap();
int nosys();
int lseek();
int truncate();
int ftruncate();
int __sysctl();
int undelete();
int setprivexec();
int add_profil();
int kdebug_trace();
int mlock();
int munlock();
int minherit();
int mlockall();
int munlockall();
#if COMPAT_43
#define compat(name,n) syss(__CONCAT(o,name),n)
#define compatp(name,n) sysp(__CONCAT(o,name),n)
#define comaptnet(name,n) sysnets(__CONCAT(o,name),n)
#define comaptnetp(name,n) sysnetp(__CONCAT(o,name),n)
int ocreat();
int olseek();
int ostat();
int olstat();
int ofstat();
int ogetkerninfo();
int osmmap();
int ogetpagesize();
int ommap();
int owait();
int ogethostname();
int osethostname();
int oaccept();
int osend();
int orecv();
int osigvec();
int osigblock();
int osigsetmask();
int osigstack();
int orecvmsg();
int osendmsg();
int orecvfrom();
int osetreuid();
int osetregid();
int otruncate();
int oftruncate();
int ogetpeername();
int ogethostid();
int osethostid();
int ogetrlimit();
int osetrlimit();
int okillpg();
int oquota();
int ogetsockname();
int ogetdomainname();
int osetdomainname();
int owait3();
int ogetdirentries();
#if NETAT
int ATsocket();
int ATgetmsg();
int ATputmsg();
int ATPsndreq();
int ATPsndrsp();
int ATPgetreq();
int ATPgetrsp();
#endif
int mkcomplex();
int statv();
int lstatv();
int fstatv();
int getattrlist();
int setattrlist();
int getdirentriesattr();
int exchangedata();
int checkuseraccess();
int searchfs();
int delete();
int copyfile();
#else
#define compat(n, name) syss(nosys,0)
#define compatp(n, name) sysp(nosys,0)
#define comaptnet(n, name) sysnets(nosys,0)
#define comaptnetp(n, name) sysnetp(nosys,0)
#endif
int watchevent();
int waitevent();
int modwatch();
int fsctl();
int semsys();
int msgsys();
int shmsys();
int semctl();
int semget();
int semop();
int semconfig();
int msgctl();
int msgget();
int msgsnd();
int msgrcv();
int shmat();
int shmctl();
int shmdt();
int shmget();
int shm_open();
int shm_unlink();
int sem_open();
int sem_close();
int sem_unlink();
int sem_wait();
int sem_trywait();
int sem_post();
int sem_getvalue();
int sem_init();
int sem_destroy();
int issetugid();
int utrace();
int pread();
int pwrite();
int getsid();
int getpgid();
int __pthread_kill();
int sigwait();
int pthread_sigmask();
int __disable_threadsignal();
struct sysent sysent[] = {
syss(nosys,0),
syss(exit,1),
syss(fork,0),
sysp(read,3),
sysp(write,3),
syss(open,3),
syss(close,1),
syss(wait4, 4),
compat(creat,2),
syss(link,2),
syss(unlink,1),
syss(nosys, 0),
syss(chdir,1),
syss(fchdir,1),
syss(mknod,3),
syss(chmod,2),
syss(chown,3),
syss(obreak,1),
#if COMPAT_GETFSSTAT
syss(ogetfsstat, 3),
#else
syss(getfsstat, 3),
#endif
compat(lseek,3),
sysp(getpid,0),
syss(nosys, 0),
syss(nosys, 0),
syss(setuid,1),
sysp(getuid,0),
sysp(geteuid,0),
syss(ptrace,4),
sysnets(recvmsg,3),
sysnets(sendmsg,3),
sysnets(recvfrom,6),
sysnets(accept,3),
sysnets(getpeername,3),
sysnets(getsockname,3),
syss(access,2),
syss(chflags,2),
syss(fchflags,2),
syss(sync,0),
syss(kill,2),
compat(stat,2),
sysp(getppid,0),
compat(lstat,2),
syss(dup,1),
syss(pipe,0),
sysp(getegid,0),
syss(profil,4),
syss(ktrace,4),
syss(sigaction,3),
sysp(getgid,0),
syss(sigprocmask,3),
syss(getlogin,2),
syss(setlogin,1),
syss(acct,1),
syss(sigpending,1),
syss(sigaltstack,2),
syss(ioctl,3),
syss(reboot,2),
syss(revoke,1),
syss(symlink,2),
syss(readlink,3),
syss(execve,3),
syss(umask,1),
syss(chroot,1),
compat(fstat,2),
syss(nosys,0),
compat(getpagesize,0),
syss(msync,3),
syss(vfork,0),
syss(nosys,0),
syss(nosys,0),
syss(sbrk,1),
syss(sstk,1),
compat(smmap,6),
syss(ovadvise,1),
syss(munmap,2),
syss(mprotect,3),
syss(madvise,3),
syss(nosys,0),
syss(nosys,0),
syss(mincore,3),
sysp(getgroups,2),
sysp(setgroups,2),
sysp(getpgrp,0),
sysp(setpgid,2),
syss(setitimer,3),
compat(wait,0),
syss(swapon,1),
syss(getitimer,2),
compat(gethostname,2),
compat(sethostname,2),
sysp(getdtablesize, 0),
syss(dup2,2),
syss(nosys,0),
syss(fcntl,3),
syss(select,5),
syss(nosys,0),
syss(fsync,1),
sysp(setpriority,3),
sysnets(socket,3),
sysnets(connect,3),
comaptnet(accept,3),
sysp(getpriority,2),
comaptnet(send,4),
comaptnet(recv,4),
#ifdef __ppc__
syss(osigreturn,1),
#else
syss(sigreturn,1),
#endif
sysnets(bind,3),
sysnets(setsockopt,5),
sysnets(listen,2),
syss(nosys,0),
compat(sigvec,3),
compat(sigblock,1),
compat(sigsetmask,1),
syss(sigsuspend,1),
compat(sigstack,2),
comaptnet(recvmsg,3),
comaptnet(sendmsg,3),
syss(nosys,0),
#ifdef __ppc__
sysnofnl(ppc_gettimeofday,2),
#else
sysnofnl(gettimeofday,2),
#endif
sysp(getrusage,2),
sysnets(getsockopt,5),
syss(nosys,0),
sysp(readv,3),
sysp(writev,3),
syss(settimeofday,2),
syss(fchown,3),
syss(fchmod,2),
comaptnet(recvfrom,6),
compat(setreuid,2),
compat(setregid,2),
syss(rename,2),
compat(truncate,2),
compat(ftruncate,2),
syss(flock,2),
syss(mkfifo,2),
sysnets(sendto,6),
sysnets(shutdown,2),
sysnets(socketpair,4),
syss(mkdir,2),
syss(rmdir,1),
syss(utimes,2),
syss(futimes,2),
syss(adjtime,2),
comaptnet(getpeername,3),
compat(gethostid,0),
sysp(nosys,0),
compat(getrlimit,2),
compat(setrlimit,2),
compat(killpg,2),
syss(setsid,0),
syss(nosys,0),
syss(nosys,0),
comaptnet(getsockname,3),
syss(getpgid,1),
sysp(setprivexec,1),
#ifdef DOUBLE_ALIGN_PARAMS
syss(pread,5),
syss(pwrite,5),
#else
syss(pread,4),
syss(pwrite,4),
#endif
syss(nfssvc,2),
compat(getdirentries,4),
syss(statfs, 2),
syss(fstatfs, 2),
syss(unmount, 2),
syss(nosys,0),
syss(getfh,2),
compat(getdomainname,2),
compat(setdomainname,2),
syss(nosys,0),
#if QUOTA
syss(quotactl, 4),
#else QUOTA
syss(nosys, 0),
#endif
syss(nosys,0),
syss(mount, 4),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
compat(wait3,3),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(add_profil,4),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(kdebug_trace,6),
syss(setgid,1),
syss(setegid,1),
syss(seteuid,1),
#ifdef __ppc__
syss(sigreturn, 2),
#else
syss(nosys,0),
#endif
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(stat,2),
syss(fstat,2),
syss(lstat,2),
syss(pathconf,2),
syss(fpathconf,2),
#if COMPAT_GETFSSTAT
syss(getfsstat,3),
#else
syss(nosys,0),
#endif
syss(getrlimit,2),
syss(setrlimit,2),
syss(getdirentries,4),
#ifdef DOUBLE_ALIGN_PARAMS
syss(mmap,8),
#else
syss(mmap,7),
#endif
syss(nosys,0),
#ifdef DOUBLE_ALIGN_PARAMS
syss(lseek,5),
#else
syss(lseek,4),
#endif
#ifdef DOUBLE_ALIGN_PARAMS
syss(truncate,4),
syss(ftruncate,4),
#else
syss(truncate,3),
syss(ftruncate,3),
#endif
syss(__sysctl,6),
sysp(mlock, 2),
syss(munlock, 2),
syss(undelete,1),
#if NETAT
sysnets(ATsocket,1),
sysnets(ATgetmsg,4),
sysnets(ATputmsg,4),
sysnets(ATPsndreq,4),
sysnets(ATPsndrsp,4),
sysnets(ATPgetreq,3),
sysnets(ATPgetrsp,2),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
#else
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
#endif
syss(nosys,3),
syss(nosys,2),
syss(nosys,2),
syss(nosys,2),
syss(getattrlist,5),
syss(setattrlist,5),
syss(getdirentriesattr,8),
syss(exchangedata,3),
#ifdef __APPLE_API_OBSOLETE
syss(checkuseraccess,6),
#else
syss(nosys,6),
#endif
syss(searchfs,6),
syss(delete,1),
syss(copyfile,4),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
sysnets(watchevent,2),
sysnets(waitevent,2),
sysnets(modwatch,2),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(fsctl,4),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(minherit,3),
syss(semsys,5),
syss(msgsys,6),
syss(shmsys,4),
syss(semctl,4),
syss(semget,3),
syss(semop,3),
syss(semconfig,1),
syss(msgctl,3),
syss(msgget,2),
syss(msgsnd,4),
syss(msgrcv,5),
syss(shmat,3),
syss(shmctl,3),
syss(shmdt,1),
syss(shmget,3),
syss(shm_open,3),
syss(shm_unlink,1),
syss(sem_open,4),
syss(sem_close,1),
syss(sem_unlink,1),
syss(sem_wait,1),
syss(sem_trywait,1),
syss(sem_post,1),
syss(sem_getvalue,2),
syss(sem_init,3),
syss(sem_destroy,1),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(load_shared_file,7),
syss(reset_shared_file,3),
syss(new_system_shared_regions,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(getsid,1),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(mlockall,1),
syss(munlockall,1),
syss(nosys,0),
sysp(issetugid,0),
syss(__pthread_kill,2),
syss(pthread_sigmask,3),
syss(sigwait,2),
syss(__disable_threadsignal,1),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(utrace,2),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0),
syss(nosys,0)
};
int nsysent = sizeof(sysent) / sizeof(sysent[0]);