/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 1995-2004 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
*
* @APPLE_LICENSE_HEADER_END@
*/
-/* Copyright (c) 1995-1999 Apple Computer, Inc. All Rights Reserved */
-/*
- * HISTORY
- * 12-Feb-00 Clark Warner (warner_c) at Apple
- * Added copyfile system call
- * 26-Jul-99 Earsh Nandkeshwar (earsh) at Apple
- * Changed getdirentryattr to getdirentriesattr
- * 22-Jan-98 Clark Warner (warner_c) at Apple
- * Created new system calls for supporting HFS/HFS Plus file system semantics
- *
- * 04-Jun-95 Mac Gillon (mgillon) at NeXT
- * Created new version based on NS3.3 and 4.4BSD
- *
- */
-
+#include <sys/appleapiopts.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signal.h>
#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}
+
/*
* definitions
*/
int profil();
int load_shared_file();
int reset_shared_file();
-#if KTRACE
+int new_system_shared_regions();
int ktrace();
-#else
-#endif
int sigaction();
int getgid();
int sigprocmask();
int socket();
int connect();
int getpriority();
+#ifdef __ppc__
+int osigreturn();
+#endif
int sigreturn();
int bind();
int setsockopt();
#else
#endif
int gettimeofday();
+#ifdef __ppc__
+int ppc_gettimeofday();
+#endif
int getrusage();
int getsockopt();
int readv();
int mkdir();
int rmdir();
int utimes();
+int futimes();
int adjtime();
int setsid();
int quotactl();
int setgid();
int setegid();
int seteuid();
-#if LFS
-int lfs_bmapv();
-int lfs_markv();
-int lfs_segclean();
-int lfs_segwait();
-#else
-#endif
int stat();
int fstat();
int lstat();
int undelete();
int setprivexec();
int add_profil();
-#ifdef NOTEVER
-int table();
-#endif /* NOTEVER */
int kdebug_trace();
int olseek();
int ostat();
int olstat();
-#if KTRACE
-#else
-#endif
int ofstat();
int ogetkerninfo();
int osmmap();
int osigstack();
int orecvmsg();
int osendmsg();
-#if TRACE
-#else
-#endif
int orecvfrom();
int osetreuid();
int osetregid();
int ogetdomainname();
int osetdomainname();
int owait3();
-#if NFS
-#else
-#endif
int ogetdirentries();
-#if NFS
-#else
-#endif
-#if LFS
-#else
-#endif
#if NETAT
int ATsocket();
int searchfs();
int delete();
int copyfile();
-
+
/* end of HFS calls */
#else /* COMPAT_43 */
int sem_init();
int sem_destroy();
-int issetugid();
+int fmod_watch_enable();
+int fmod_watch();
+
+int issetugid();
+int utrace();
+int pread();
+int pwrite();
+int getsid();
+int getpgid();
+
+int __pthread_kill();
+int sigwait();
+int pthread_sigmask();
+int __disable_threadsignal();
+
+int nfsclnt();
+int fhopen();
+
+int aio_cancel();
+int aio_error();
+int aio_fsync();
+int aio_read();
+int aio_return();
+int aio_suspend();
+int aio_write();
+int lio_listio();
+
+int kqueue();
+int kqueue_portset_np();
+int kqueue_from_portset_np();
+int kevent();
+
+int audit();
+int auditon();
+int getauid();
+int setauid();
+int getaudit();
+int setaudit();
+int getaudit_addr();
+int setaudit_addr();
+int auditctl();
+
/*
* System call switch table.
*/
-
+
+/*
+ * N.B.
+ * The argument count numbers in this table are actually
+ * the number of UInt32 words that comprise the arguments
+ * not the number of arguments
+ *
+ * This value is not currently used on PPC but Intel Darwin
+ * does use it and will not work correctly if the values
+ * are wrong
+ */
struct sysent sysent[] = {
syss(nosys,0), /* 0 = indir */
compat(stat,2), /* 38 = old stat */
sysp(getppid,0), /* 39 = getppid */
compat(lstat,2), /* 40 = old lstat */
- syss(dup,2), /* 41 = dup */
+ syss(dup,1), /* 41 = dup */
syss(pipe,0), /* 42 = pipe */
sysp(getegid,0), /* 43 = getegid */
syss(profil,4), /* 44 = profil */
-#if KTRACE
syss(ktrace,4), /* 45 = ktrace */
-#else
- syss(nosys,0), /* 45 = nosys */
-#endif
syss(sigaction,3), /* 46 = sigaction */
sysp(getgid,0), /* 47 = getgid */
- syss(sigprocmask,2), /* 48 = sigprocmask */
+ syss(sigprocmask,3), /* 48 = sigprocmask */
syss(getlogin,2), /* 49 = getlogin */
syss(setlogin,1), /* 50 = setlogin */
syss(acct,1), /* 51 = turn acct off/on */
- syss(sigpending,0), /* 52 = sigpending */
+ syss(sigpending,1), /* 52 = sigpending */
syss(sigaltstack,2), /* 53 = sigaltstack */
syss(ioctl,3), /* 54 = ioctl */
syss(reboot,2), /* 55 = reboot */
syss(sstk,1), /* 70 = sstk */
compat(smmap,6), /* 71 = old mmap */
syss(ovadvise,1), /* 72 = old vadvise */
- syss(munmap,2), /* 73 = munmap */
+ sysnofnl(munmap,2), /* 73 = munmap */
syss(mprotect,3), /* 74 = mprotect */
syss(madvise,3), /* 75 = madvise */
syss(nosys,0), /* 76 was obsolete vhangup */
sysp(getpgrp,0), /* 81 = getpgrp */
sysp(setpgid,2), /* 82 = setpgid */
syss(setitimer,3), /* 83 = setitimer */
- compat(wait,0), /* 84 = old wait */
+ compat(wait,1), /* 84 = old wait */
syss(swapon,1), /* 85 = swapon */
syss(getitimer,2), /* 86 = getitimer */
compat(gethostname,2), /* 87 = old gethostname */
syss(nosys,0), /* 94 was obsolete setdopt */
syss(fsync,1), /* 95 = fsync */
sysp(setpriority,3), /* 96 = setpriority */
- sysnets(socket,3), /* 97 = socket */
+ sysnets(socket,3), /* 97 = socket */
sysnets(connect,3), /* 98 = connect */
comaptnet(accept,3), /* 99 = accept */
sysp(getpriority,2), /* 100 = getpriority */
comaptnet(send,4), /* 101 = old send */
comaptnet(recv,4), /* 102 = old recv */
- syss(sigreturn,1), /* 103 = sigreturn */
- sysnets(bind,3), /* 104 = bind */
- sysnets(setsockopt,5), /* 105 = setsockopt */
- sysnets(listen,2), /* 106 = listen */
+#ifdef __ppc__
+ syss(osigreturn,1), /* 103 = sigreturn ; compat for jaguar*/
+#else
+ syss(sigreturn,1), /* 103 = sigreturn */
+#endif
+ sysnets(bind,3), /* 104 = bind */
+ sysnets(setsockopt,5), /* 105 = setsockopt */
+ sysnets(listen,2), /* 106 = listen */
syss(nosys,0), /* 107 was vtimes */
compat(sigvec,3), /* 108 = sigvec */
compat(sigblock,1), /* 109 = sigblock */
compat(sigsetmask,1), /* 110 = sigsetmask */
syss(sigsuspend,1), /* 111 = sigpause */
- compat(sigstack,2), /* 112 = sigstack */
+ compat(sigstack,2), /* 112 = sigstack */
comaptnet(recvmsg,3), /* 113 = recvmsg */
comaptnet(sendmsg,3), /* 114 = sendmsg */
syss(nosys,0), /* 115 = old vtrace */
- syss(gettimeofday,2), /* 116 = gettimeofday */
+
+/*
+ * N.B.
+ * The argument count numbers in this table are actually
+ * the number of UInt32 words that comprise the arguments
+ * not the number of arguments
+ *
+ * This value is not currently used on PPC but Intel Darwin
+ * does use it and will not work correctly if the values
+ * are wrong
+ */
+
+#ifdef __ppc__
+ sysnofnl(ppc_gettimeofday,2), /* 116 = gettimeofday */
+#else
+ sysnofnl(gettimeofday,2), /* 116 = gettimeofday */
+#endif
sysp(getrusage,2), /* 117 = getrusage */
- sysnets(getsockopt,5), /* 118 = getsockopt */
+ sysnets(getsockopt,5), /* 118 = getsockopt */
syss(nosys,0), /* 119 = old resuba */
sysp(readv,3), /* 120 = readv */
sysp(writev,3), /* 121 = writev */
syss(fchown,3), /* 123 = fchown */
syss(fchmod,2), /* 124 = fchmod */
comaptnet(recvfrom,6), /* 125 = recvfrom */
- compat(setreuid,2), /* 126 = setreuid */
- compat(setregid,2), /* 127 = setregid */
+ compat(setreuid,2), /* 126 = setreuid */
+ compat(setregid,2), /* 127 = setregid */
syss(rename,2), /* 128 = rename */
- compat(truncate,2), /* 129 = old truncate */
+ compat(truncate,2), /* 129 = old truncate */
compat(ftruncate,2), /* 130 = ftruncate */
syss(flock,2), /* 131 = flock */
- syss(mkfifo,2), /* 132 = nosys */
+ syss(mkfifo,2), /* 132 = mkfifo */
sysnets(sendto,6), /* 133 = sendto */
- sysnets(shutdown,2), /* 134 = shutdown */
- sysnets(socketpair,5), /* 135 = socketpair */
+ sysnets(shutdown,2), /* 134 = shutdown */
+ sysnets(socketpair,4), /* 135 = socketpair */
syss(mkdir,2), /* 136 = mkdir */
syss(rmdir,1), /* 137 = rmdir */
syss(utimes,2), /* 138 = utimes */
- syss(nosys,0), /* 139 = used internally */
+ syss(futimes,2), /* 139 = futimes */
syss(adjtime,2), /* 140 = adjtime */
comaptnet(getpeername,3),/* 141 = getpeername */
compat(gethostid,0), /* 142 = old gethostid */
syss(nosys,0), /* 148 was setquota */
syss(nosys,0), /* 149 was qquota */
comaptnet(getsockname,3),/* 150 = getsockname */
- /*
- * Syscalls 151-183 inclusive are reserved for vendor-specific
- * system calls. (This includes various calls added for compatibity
- * with other Unix variants.)
- */
- syss(nosys,0), /* 151 was m68k specific machparam */
+ syss(getpgid,1), /* 151 = getpgid */
sysp(setprivexec,1),/* 152 = setprivexec */
- syss(nosys,0), /* 153 */
- syss(nosys,0), /* 154 */
+#ifdef DOUBLE_ALIGN_PARAMS
+ syss(pread,6), /* 153 = pread */
+ syss(pwrite,6), /* 154 = pwrite */
+#else
+ syss(pread,5), /* 153 = pread */
+ syss(pwrite,5), /* 154 = pwrite */
+#endif
syss(nfssvc,2), /* 155 = nfs_svc */
compat(getdirentries,4), /* 156 = old getdirentries */
syss(statfs, 2), /* 157 = statfs */
syss(unmount, 2), /* 159 = unmount */
syss(nosys,0), /* 160 was async_daemon */
syss(getfh,2), /* 161 = get file handle */
- /*?????*/
compat(getdomainname,2), /* 162 = getdomainname */
compat(setdomainname,2), /* 163 = setdomainname */
syss(nosys,0), /* 164 */
#if QUOTA
syss(quotactl, 4), /* 165 = quotactl */
-#else QUOTA
+#else /* QUOTA */
syss(nosys, 0), /* 165 = not configured */
#endif /* QUOTA */
syss(nosys,0), /* 166 was exportfs */
syss(nosys,0), /* 177 */
syss(nosys,0), /* 178 */
syss(nosys,0), /* 179 */
- syss(kdebug_trace,0), /* 180 */
+ sysnofnl(kdebug_trace,6), /* 180 */
syss(setgid,1), /* 181 */
syss(setegid,1), /* 182 */
- syss(seteuid,1), /* 183 */
-#if LFS
- syss(lfs_bmapv,3), /* 184 = lfs_bmapv */
- syss(lfs_markv,3), /* 185 = lfs_markv */
- syss(lfs_segclean,2), /* 186 = lfs_segclean */
- syss(lfs_segwait,2), /* 187 = lfs_segwait */
+ syss(seteuid,1), /* 183 */
+#ifdef __ppc__
+ syss(sigreturn, 2), /* 184 = nosys */
#else
syss(nosys,0), /* 184 = nosys */
+#endif
syss(nosys,0), /* 185 = nosys */
syss(nosys,0), /* 186 = nosys */
syss(nosys,0), /* 187 = nosys */
-#endif
syss(stat,2), /* 188 = stat */
syss(fstat,2), /* 189 = fstat */
syss(lstat,2), /* 190 = lstat */
syss(pathconf,2), /* 191 = pathconf */
syss(fpathconf,2), /* 192 = fpathconf */
+
+/*
+ * N.B.
+ * The argument count numbers in this table are actually
+ * the number of UInt32 words that comprise the arguments
+ * not the number of arguments
+ *
+ * This value is not currently used on PPC but Intel Darwin
+ * does use it and will not work correctly if the values
+ * are wrong
+ */
+
#if COMPAT_GETFSSTAT
- syss(getfsstat,0), /* 193 = getfsstat */
+ syss(getfsstat,3), /* 193 = getfsstat */
#else
syss(nosys,0), /* 193 is unused */
#endif
syss(mmap,7), /* 197 = mmap */
#endif
syss(nosys,0), /* 198 = __syscall */
+#ifdef DOUBLE_ALIGN_PARAMS
syss(lseek,5), /* 199 = lseek */
+#else
+ syss(lseek,4), /* 199 = lseek */
+#endif
+#ifdef DOUBLE_ALIGN_PARAMS
syss(truncate,4), /* 200 = truncate */
syss(ftruncate,4), /* 201 = ftruncate */
+#else
+ syss(truncate,3), /* 200 = truncate */
+ syss(ftruncate,3), /* 201 = ftruncate */
+#endif
syss(__sysctl,6), /* 202 = __sysctl */
sysp(mlock, 2), /* 203 = mlock */
syss(munlock, 2), /* 204 = munlock */
-#if NETAT
syss(undelete,1), /* 205 = undelete */
- sysnets(ATsocket,1), /* 206 = AppleTalk ATsocket */
- sysnets(ATgetmsg,4), /* 207 = AppleTalk ATgetmsg*/
- sysnets(ATputmsg,4), /* 208 = AppleTalk ATputmsg*/
- sysnets(ATPsndreq,4), /* 209 = AppleTalk ATPsndreq*/
- sysnets(ATPsndrsp,4), /* 210 = AppleTalk ATPsndrsp*/
- sysnets(ATPgetreq,3), /* 211 = AppleTalk ATPgetreq*/
- sysnets(ATPgetrsp,2), /* 212 = AppleTalk ATPgetrsp*/
- syss(nosys,0), /* 213 = Reserved for AT expansion */
- syss(nosys,0), /* 214 = Reserved for AT expansion */
- syss(nosys,0), /* 215 = Reserved for AT expansion */
+#if NETAT
+ sysnets(ATsocket,1), /* 206 = ATsocket */
+ sysnets(ATgetmsg,4), /* 207 = ATgetmsg*/
+ sysnets(ATputmsg,4), /* 208 = ATputmsg*/
+ sysnets(ATPsndreq,4), /* 209 = ATPsndreq*/
+ sysnets(ATPsndrsp,4), /* 210 = ATPsndrsp*/
+ sysnets(ATPgetreq,3), /* 211 = ATPgetreq*/
+ sysnets(ATPgetrsp,2), /* 212 = ATPgetrsp*/
+ syss(nosys,0), /* 213 = Reserved for AppleTalk */
+ syss(kqueue_from_portset_np,1), /* 214 = kqueue_from_portset_np */
+ syss(kqueue_portset_np,1), /* 215 = kqueue_portset_np */
#else
- syss(undelete,1), /* 205 = undelete */
-
-/* System calls 205 - 215 are reserved to allow HFS and AT to coexist */
-/* CHW 1/22/98 */
-
syss(nosys,0), /* 206 = Reserved for AppleTalk */
syss(nosys,0), /* 207 = Reserved for AppleTalk */
syss(nosys,0), /* 208 = Reserved for AppleTalk */
* We expect all filesystems to recognize the call and report that it is
* not supported or to actually implement it.
*/
+
+/*
+ * N.B.
+ * The argument count numbers in this table are actually
+ * the number of UInt32 words that comprise the arguments
+ * not the number of arguments
+ *
+ * This value is not currently used on PPC but Intel Darwin
+ * does use it and will not work correctly if the values
+ * are wrong
+ */
+
syss(nosys,3), /* 216 = HFS make complex file call (multipel forks */
syss(nosys,2), /* 217 = HFS statv extended stat call for HFS */
syss(nosys,2), /* 218 = HFS lstatv extended lstat call for HFS */
syss(setattrlist,5), /* 221 = HFS setattrlist set attribute list */
syss(getdirentriesattr,8), /* 222 = HFS getdirentriesattr get directory attributes */
syss(exchangedata,3), /* 223 = HFS exchangedata exchange file contents */
+#ifdef __APPLE_API_OBSOLETE
syss(checkuseraccess,6),/* 224 = HFS checkuseraccess check access to a file */
+#else
+ syss(nosys,6),/* 224 = HFS checkuseraccess check access to a file */
+#endif /* __APPLE_API_OBSOLETE */
syss(searchfs,6), /* 225 = HFS searchfs to implement catalog searching */
- syss(delete,1), /* 226 = private HFS delete (with Mac OS semantics) */
- syss(copyfile,4), /* 227 = Copyfile for orignally for AFP */
+ syss(delete,1), /* 226 = private delete (Carbon semantics) */
+ syss(copyfile,6), /* 227 = copyfile - orignally for AFP */
syss(nosys,0), /* 228 */
syss(nosys,0), /* 229 */
syss(nosys,0), /* 230 */
syss(nosys,0), /* 239 */
syss(nosys,0), /* 240 */
syss(nosys,0), /* 241 */
- syss(fsctl,0), /* 242 */
+ syss(fsctl,4), /* 242 = fsctl */
syss(nosys,0), /* 243 */
syss(nosys,0), /* 244 */
syss(nosys,0), /* 245 */
syss(nosys,0), /* 246 */
- syss(nosys,0), /* 247 */
- syss(nosys,0), /* 248 */
+ syss(nfsclnt,2), /* 247 = nfsclnt*/
+ syss(fhopen,2), /* 248 = fhopen */
syss(nosys,0), /* 249 */
- syss(minherit,3), /* 250 */
+ syss(minherit,3), /* 250 = minherit */
syss(semsys,5), /* 251 = semsys */
syss(msgsys,6), /* 252 = msgsys */
syss(shmsys,4), /* 253 = shmsys */
syss(nosys,0), /* 286 */
syss(nosys,0), /* 287 */
syss(nosys,0), /* 288 */
- syss(nosys,0), /* 289 */
- syss(nosys,0), /* 290 */
+ syss(fmod_watch_enable, 1), /* 289 = fmod_watching */
+ syss(fmod_watch, 4), /* 290 = fmod_watch */
syss(nosys,0), /* 291 */
syss(nosys,0), /* 292 */
syss(nosys,0), /* 293 */
syss(nosys,0), /* 294 */
syss(nosys,0), /* 295 */
- syss(load_shared_file,7), /* 296 */
- syss(reset_shared_file,3), /* 297 */
- syss(nosys,0), /* 298 */
+ syss(load_shared_file,7), /* 296 = load_shared_file */
+ syss(reset_shared_file,3), /* 297 = reset_shared_file */
+ syss(new_system_shared_regions,0), /* 298 = new_system_shared_regions */
syss(nosys,0), /* 299 */
syss(nosys,0), /* 300 */
syss(nosys,0), /* 301 */
syss(nosys,0), /* 307 */
syss(nosys,0), /* 308 */
syss(nosys,0), /* 309 */
- syss(nosys,0), /* 310 */
+ syss(getsid,1), /* 310 = getsid */
syss(nosys,0), /* 311 */
syss(nosys,0), /* 312 */
- syss(nosys,0), /* 313 */
- syss(nosys,0), /* 314 */
- syss(nosys,0), /* 315 */
- syss(nosys,0), /* 316 */
- syss(nosys,0), /* 317 */
- syss(nosys,0), /* 318 */
- syss(nosys,0), /* 319 */
- syss(nosys,0), /* 320 */
+ sysnofnl(aio_fsync,1), /* 313 = aio_fsync */
+ sysnofnl(aio_return,1), /* 314 = aio_return */
+ sysnofnl(aio_suspend,3), /* 315 = aio_suspend */
+ sysnofnl(aio_cancel,2), /* 316 = aio_cancel */
+ sysnofnl(aio_error,1), /* 317 = aio_error */
+ sysnofnl(aio_read,1), /* 318 = aio_read */
+ sysnofnl(aio_write,1), /* 319 = aio_write */
+ sysnofnl(lio_listio,4), /* 320 = lio_listio */
syss(nosys,0), /* 321 */
syss(nosys,0), /* 322 */
syss(nosys,0), /* 323 */
- syss(mlockall,1), /* 324 */
- syss(munlockall,1), /* 325 */
+ syss(mlockall,1), /* 324 = mlockall*/
+ syss(munlockall,1), /* 325 = munlockall*/
syss(nosys,0), /* 326 */
sysp(issetugid,0), /* 327 = issetugid */
- syss(nosys,0), /* 328 */
- syss(nosys,0), /* 329 */
- syss(nosys,0), /* 330 */
- syss(nosys,0), /* 331 */
+ syss(__pthread_kill,2), /* 328 */
+ syss(pthread_sigmask,3), /* 329 */
+ syss(sigwait,2), /* 330 */
+ syss(__disable_threadsignal,1), /* 331 */
syss(nosys,0), /* 332 */
syss(nosys,0), /* 333 */
syss(nosys,0), /* 334 */
- syss(nosys,0), /* 335 */
+ syss(utrace,2), /* 335 = utrace */
syss(nosys,0), /* 336 */
syss(nosys,0), /* 337 */
syss(nosys,0), /* 338 */
syss(nosys,0), /* 346 */
syss(nosys,0), /* 347 */
syss(nosys,0), /* 348 */
- syss(nosys,0) /* 349 */
+ syss(nosys,0), /* 349 */
+ syss(audit,2), /* 350 */
+ syss(auditon,3), /* 351 */
+ syss(nosys,0), /* 352 */
+ syss(getauid,1), /* 353 */
+ syss(setauid,1), /* 354 */
+ syss(getaudit,1), /* 355 */
+ syss(setaudit,1), /* 356 */
+ syss(getaudit_addr,2), /* 357 */
+ syss(setaudit_addr,2), /* 358 */
+ syss(auditctl,1), /* 359 */
+ syss(nosys,0), /* 360 */
+ syss(nosys,0), /* 361 */
+ syss(kqueue,0), /* 362 = kqueue */
+ syss(kevent,6), /* 363 = kevent */
+ syss(nosys,0), /* 364 */
+ syss(nosys,0), /* 365 */
+ syss(nosys,0), /* 366 */
+ syss(nosys,0), /* 367 */
+ syss(nosys,0), /* 368 */
+ syss(nosys,0) /* 369 */
+
+/*
+ * N.B.
+ * The argument count numbers in this table are actually
+ * the number of UInt32 words that comprise the arguments
+ * not the number of arguments
+ *
+ * This value is not currently used on PPC but Intel Darwin
+ * does use it and will not work correctly if the values
+ * are wrong
+ */
+
};
int nsysent = sizeof(sysent) / sizeof(sysent[0]);