|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1995-98 Apple Computer, Inc. All Rights Reserved */
26: /*
27: *
28: * The NEXTSTEP Software License Agreement specifies the terms
29: * and conditions for redistribution.
30: *
31: * HISTORY
32: *
33: * 22-Jan-98 Clark Warner (warner_c) at Apple
34: * Created new system calls for supporting HFS/HFS Plus file system semantics
35: *
36: * 04-Jun-95 Mac Gillon (mgillon) at NeXT
37: * Created new version based on NS3.3 and 4.4BSD
38: *
39: */
40:
41: #include <sys/param.h>
42: #include <sys/systm.h>
43: #include <sys/signal.h>
44: #include <sys/mount.h>
45:
46: /*
47: * definitions
48: */
49: int nosys();
50: int exit();
51: int fork();
52: int read();
53: int write();
54: int open();
55: int close();
56: int wait4();
57: int link();
58: int unlink();
59: int chdir();
60: int fchdir();
61: int mknod();
62: int chmod();
63: int chown();
64: int obreak();
65: int getfsstat();
66: int getpid();
67: int mount();
68: int unmount();
69: int setuid();
70: int getuid();
71: int geteuid();
72: int ptrace();
73: int recvmsg();
74: int sendmsg();
75: int recvfrom();
76: int accept();
77: int getpeername();
78: int getsockname();
79: int access();
80: int chflags();
81: int fchflags();
82: int sync();
83: int kill();
84: int getppid();
85: int dup();
86: int pipe();
87: int getegid();
88: int profil();
89: #if KTRACE
90: int ktrace();
91: #else
92: #endif
93: int sigaction();
94: int getgid();
95: int sigprocmask();
96: int getlogin();
97: int setlogin();
98: int acct();
99: int sigpending();
100: int sigaltstack();
101: int ioctl();
102: int reboot();
103: int revoke();
104: int symlink();
105: int readlink();
106: int execve();
107: int umask();
108: int chroot();
109: /* int msync(); */
110: int vfork();
111: int sbrk();
112: int sstk();
113: int ovadvise();
114: int munmap();
115: int mprotect();
116: int madvise();
117: int mincore();
118: int getgroups();
119: int setgroups();
120: int getpgrp();
121: int setpgid();
122: int setitimer();
123: int swapon();
124: int getitimer();
125: int getdtablesize();
126: int dup2();
127: int fcntl();
128: int select();
129: int fsync();
130: int setpriority();
131: int socket();
132: int connect();
133: int getpriority();
134: int sigreturn();
135: int bind();
136: int setsockopt();
137: int listen();
138: int sigsuspend();
139: #if TRACE
140: int vtrace();
141: #else
142: #endif
143: int gettimeofday();
144: int getrusage();
145: int getsockopt();
146: int readv();
147: int writev();
148: int settimeofday();
149: int fchown();
150: int fchmod();
151: int rename();
152: int flock();
153: int mkfifo();
154: int sendto();
155: int shutdown();
156: int socketpair();
157: int mkdir();
158: int rmdir();
159: int utimes();
160: int adjtime();
161: int setsid();
162: int quotactl();
163: int nfssvc();
164: int statfs();
165: int fstatfs();
166: int getfh();
167: int setgid();
168: int setegid();
169: int seteuid();
170: #if LFS
171: int lfs_bmapv();
172: int lfs_markv();
173: int lfs_segclean();
174: int lfs_segwait();
175: #else
176: #endif
177: int stat();
178: int fstat();
179: int lstat();
180: int pathconf();
181: int fpathconf();
182: int getrlimit();
183: int setrlimit();
184: int getdirentries();
185: int mmap();
186: int nosys();
187: int lseek();
188: int truncate();
189: int ftruncate();
190: int __sysctl();
191: int undelete();
192: int mlock();
193: int munlock();
194: int setprivexec();
195: int add_profil();
196: int table();
197: #if KDEBUG
198: int syscall_kdebug();
199: #else
200: #endif
201:
202: #if COMPAT_43
203: #define compat(name,n) syss(__CONCAT(o,name),n)
204: #define compatp(name,n) sysp(__CONCAT(o,name),n)
205:
206: int ocreat();
207: int olseek();
208: int ostat();
209: int olstat();
210: #if KTRACE
211: #else
212: #endif
213: int ofstat();
214: int ogetkerninfo();
215: int ogetdtablesize();
216: int osmmap();
217: int ogetpagesize();
218: int ommap();
219: int owait();
220: int ogethostname();
221: int osethostname();
222: int oaccept();
223: int osend();
224: int orecv();
225: int osigvec();
226: int osigblock();
227: int osigsetmask();
228: int osigstack();
229: int orecvmsg();
230: int osendmsg();
231: #if TRACE
232: #else
233: #endif
234: int orecvfrom();
235: int osetreuid();
236: int osetregid();
237: int otruncate();
238: int oftruncate();
239: int ogetpeername();
240: int ogethostid();
241: int osethostid();
242: int ogetrlimit();
243: int osetrlimit();
244: int okillpg();
245: int oquota();
246: int ogetsockname();
247: int ogetdomainname();
248: int osetdomainname();
249: int owait3();
250: #if NFS
251: #else
252: #endif
253: int ogetdirentries();
254: #if NFS
255: #else
256: #endif
257: #if LFS
258: #else
259: #endif
260:
261: #if NETAT
262: int ATsocket();
263: int ATgetmsg();
264: int ATputmsg();
265: int ATPsndreq();
266: int ATPsndrsp();
267: int ATPgetreq();
268: int ATPgetrsp();
269: #endif /* NETAT */
270:
271: /* Calls for supporting HFS Semantics */
272:
273: int mkcomplex();
274: int statv();
275: int lstatv();
276: int fstatv();
277: int getattrlist();
278: int setattrlist();
279: int getdirentryattr();
280: int exchangedata();
281: int checkuseraccess();
282: int searchfs();
283:
284: /* end of HFS calls */
285:
286: #else /* COMPAT_43 */
287: #define compat(n, name) syss(nosys,0)
288: #define compatp(n, name) sysp(nosys,0)
289: #endif /* COMPAT_43 */
290:
291: int watchevent();
292: int waitevent();
293: int modwatch();
294:
295: /*
296: * System call switch table.
297: */
298:
299: /* serial or parallel system call */
300: #define syss(fn,no) {no, 0, fn}
301: #define sysp(fn,no) {no, 1, fn}
302:
303: struct sysent sysent[] = {
304: syss(nosys,0), /* 0 = indir */
305: syss(exit,1), /* 1 = exit */
306: syss(fork,0), /* 2 = fork */
307: sysp(read,3), /* 3 = read */
308: sysp(write,3), /* 4 = write */
309: syss(open,3), /* 5 = open */
310: syss(close,1), /* 6 = close */
311: syss(wait4, 4), /* 7 = wait4 */
312: compat(creat,2), /* 8 = old creat */
313: syss(link,2), /* 9 = link */
314: syss(unlink,1), /* 10 = unlink */
315: syss(nosys, 0), /* 11 was obsolete execv */
316: syss(chdir,1), /* 12 = chdir */
317: syss(fchdir,1), /* 13 = fchdir */
318: syss(mknod,3), /* 14 = mknod */
319: syss(chmod,2), /* 15 = chmod */
320: syss(chown,3), /* 16 = chown; now 3 args */
321: syss(obreak,1), /* 17 = old break */
322: syss(getfsstat, 3), /* 18 = getfsstat */
323: compat(lseek,3), /* 19 = old lseek */
324: sysp(getpid,0), /* 20 = getpid */
325: syss(nosys, 0), /* 21 was obsolete mount */
326: syss(nosys, 0), /* 22 was obsolete umount */
327: syss(setuid,1), /* 23 = setuid */
328: sysp(getuid,0), /* 24 = getuid */
329: sysp(geteuid,0), /* 25 = geteuid */
330: syss(ptrace,4), /* 26 = ptrace */
331: syss(recvmsg,3), /* 27 = recvmsg */
332: syss(sendmsg,3), /* 28 = sendmsg */
333: syss(recvfrom,6), /* 29 = recvfrom */
334: syss(accept,3), /* 30 = accept */
335: syss(getpeername,3), /* 31 = getpeername */
336: syss(getsockname,3), /* 32 = getsockname */
337: syss(access,2), /* 33 = access */
338: syss(chflags,2), /* 34 = chflags */
339: syss(fchflags,2), /* 35 = fchflags */
340: syss(sync,0), /* 36 = sync */
341: syss(kill,2), /* 37 = kill */
342: compat(stat,2), /* 38 = old stat */
343: sysp(getppid,0), /* 39 = getppid */
344: compat(lstat,2), /* 40 = old lstat */
345: syss(dup,2), /* 41 = dup */
346: syss(pipe,0), /* 42 = pipe */
347: sysp(getegid,0), /* 43 = getegid */
348: syss(profil,4), /* 44 = profil */
349: #if KTRACE
350: syss(ktrace,4), /* 45 = ktrace */
351: #else
352: syss(nosys,0), /* 45 = nosys */
353: #endif
354: syss(sigaction,3), /* 46 = sigaction */
355: sysp(getgid,0), /* 47 = getgid */
356: syss(sigprocmask,2), /* 48 = sigprocmask */
357: syss(getlogin,2), /* 49 = getlogin */
358: syss(setlogin,1), /* 50 = setlogin */
359: syss(acct,1), /* 51 = turn acct off/on */
360: syss(sigpending,0), /* 52 = sigpending */
361: syss(sigaltstack,2), /* 53 = sigaltstack */
362: syss(ioctl,3), /* 54 = ioctl */
363: syss(reboot,2), /* 55 = reboot */
364: syss(revoke,1), /* 56 = revoke */
365: syss(symlink,2), /* 57 = symlink */
366: syss(readlink,3), /* 58 = readlink */
367: syss(execve,3), /* 59 = execve */
368: syss(umask,1), /* 60 = umask */
369: syss(chroot,1), /* 61 = chroot */
370: compat(fstat,2), /* 62 = old fstat */
371: syss(nosys,0), /* 63 = used internally, reserved */
372: compat(getpagesize,0), /* 64 = old getpagesize */
373: // syss(msync,5), /* 65 = msync */
374: #warning stubbed out msync
375: syss(nosys, 0),
376: syss(vfork,0), /* 66 = vfork */
377: syss(nosys,0), /* 67 was obsolete vread */
378: syss(nosys,0), /* 68 was obsolete vwrite */
379: syss(sbrk,1), /* 69 = sbrk */
380: syss(sstk,1), /* 70 = sstk */
381: compat(smmap,6), /* 71 = old mmap */
382: syss(ovadvise,1), /* 72 = old vadvise */
383: syss(munmap,2), /* 73 = munmap */
384: syss(mprotect,3), /* 74 = mprotect */
385: syss(madvise,3), /* 75 = madvise */
386: syss(nosys,0), /* 76 was obsolete vhangup */
387: syss(nosys,0), /* 77 was obsolete vlimit */
388: syss(mincore,3), /* 78 = mincore */
389: sysp(getgroups,2), /* 79 = getgroups */
390: sysp(setgroups,2), /* 80 = setgroups */
391: sysp(getpgrp,0), /* 81 = getpgrp */
392: sysp(setpgid,2), /* 82 = setpgid */
393: syss(setitimer,3), /* 83 = setitimer */
394: compat(wait,0), /* 84 = old wait */
395: syss(swapon,1), /* 85 = swapon */
396: syss(getitimer,2), /* 86 = getitimer */
397: compat(gethostname,2), /* 87 = old gethostname */
398: compat(sethostname,2), /* 88 = old sethostname */
399: compatp(getdtablesize,0), /* 89 = old getdtablesize */
400: syss(dup2,2), /* 90 = dup2 */
401: syss(nosys,0), /* 91 was obsolete getdopt */
402: syss(fcntl,3), /* 92 = fcntl */
403: syss(select,5), /* 93 = select */
404: syss(nosys,0), /* 94 was obsolete setdopt */
405: syss(fsync,1), /* 95 = fsync */
406: sysp(setpriority,3), /* 96 = setpriority */
407: syss(socket,3), /* 97 = socket */
408: syss(connect,3), /* 98 = connect */
409: compat(accept,3), /* 99 = accept */
410: sysp(getpriority,2), /* 100 = getpriority */
411: compat(send,4), /* 101 = old send */
412: compat(recv,4), /* 102 = old recv */
413: syss(sigreturn,1), /* 103 = sigreturn */
414: syss(bind,3), /* 104 = bind */
415: syss(setsockopt,5), /* 105 = setsockopt */
416: syss(listen,2), /* 106 = listen */
417: syss(nosys,0), /* 107 was vtimes */
418: compat(sigvec,3), /* 108 = sigvec */
419: compat(sigblock,1), /* 109 = sigblock */
420: compat(sigsetmask,1), /* 110 = sigsetmask */
421: syss(sigsuspend,1), /* 111 = sigpause */
422: compat(sigstack,2), /* 112 = sigstack */
423: compat(recvmsg,3), /* 113 = recvmsg */
424: compat(sendmsg,3), /* 114 = sendmsg */
425: syss(nosys,0), /* 115 = old vtrace */
426: syss(gettimeofday,2), /* 116 = gettimeofday */
427: sysp(getrusage,2), /* 117 = getrusage */
428: syss(getsockopt,5), /* 118 = getsockopt */
429: syss(nosys,0), /* 119 = old resuba */
430: sysp(readv,3), /* 120 = readv */
431: sysp(writev,3), /* 121 = writev */
432: syss(settimeofday,2), /* 122 = settimeofday */
433: syss(fchown,3), /* 123 = fchown */
434: syss(fchmod,2), /* 124 = fchmod */
435: compat(recvfrom,6), /* 125 = recvfrom */
436: compat(setreuid,2), /* 126 = setreuid */
437: compat(setregid,2), /* 127 = setregid */
438: syss(rename,2), /* 128 = rename */
439: compat(truncate,2), /* 129 = old truncate */
440: compat(ftruncate,2), /* 130 = ftruncate */
441: syss(flock,2), /* 131 = flock */
442: syss(mkfifo,2), /* 132 = nosys */
443: syss(sendto,6), /* 133 = sendto */
444: syss(shutdown,2), /* 134 = shutdown */
445: syss(socketpair,5), /* 135 = socketpair */
446: syss(mkdir,2), /* 136 = mkdir */
447: syss(rmdir,1), /* 137 = rmdir */
448: syss(utimes,2), /* 138 = utimes */
449: syss(nosys,0), /* 139 = used internally */
450: syss(adjtime,2), /* 140 = adjtime */
451: compat(getpeername,3),/* 141 = getpeername */
452: compat(gethostid,0), /* 142 = old gethostid */
453: sysp(nosys,0), /* 143 = old sethostid */
454: compat(getrlimit,2), /* 144 = old getrlimit */
455: compat(setrlimit,2), /* 145 = old setrlimit */
456: compat(killpg,2), /* 146 = old killpg */
457: syss(setsid,0), /* 147 = setsid */
458: syss(nosys,0), /* 148 was setquota */
459: syss(nosys,0), /* 149 was qquota */
460: compat(getsockname,3),/* 150 = getsockname */
461: /*
462: * Syscalls 151-183 inclusive are reserved for vendor-specific
463: * system calls. (This includes various calls added for compatibity
464: * with other Unix variants.)
465: */
466: syss(nosys,0), /* 151 was m68k specific machparam */
467: sysp(setprivexec,1),/* 152 = setprivexec */
468: syss(nosys,0), /* 153 */
469: syss(nosys,0), /* 154 */
470: syss(nfssvc,2), /* 155 = nfs_svc */
471: compat(getdirentries,4), /* 156 = old getdirentries */
472: syss(statfs, 2), /* 157 = statfs */
473: syss(fstatfs, 2), /* 158 = fstatfs */
474: syss(unmount, 2), /* 159 = unmount */
475: syss(nosys,0), /* 160 was async_daemon */
476: syss(getfh,2), /* 161 = get file handle */
477: compat(getdomainname,2), /* 162 = getdomainname */
478: compat(setdomainname,2), /* 163 = setdomainname */
479: syss(nosys,0), /* 164 */
480: #if QUOTA
481: syss(quotactl, 4), /* 165 = quotactl */
482: #else QUOTA
483: syss(nosys, 0), /* 165 = not configured */
484: #endif /* QUOTA */
485: syss(nosys,0), /* 166 was exportfs */
486: syss(mount, 4), /* 167 = mount */
487: syss(nosys,0), /* 168 was ustat */
488: syss(nosys,0), /* 169 = nosys */
489: syss(table,5), /* 170 = table */
490: compat(wait3,3), /* 171 = old wait3 */
491: syss(nosys,0), /* 172 was rpause */
492: syss(nosys,0), /* 173 = nosys */
493: syss(nosys,0), /* 174 was getdents */
494: syss(nosys,0), /* 175 was gc_control */
495: syss(add_profil,4), /* 176 = add_profil */
496: syss(nosys,0), /* 177 */
497: syss(nosys,0), /* 178 */
498: syss(nosys,0), /* 179 */
499: #if KDEBUG
500: syss(syscall_kdebug,0), /* 180 */
501: #else
502: syss(nosys,0), /* 180 */
503: #endif
504: syss(setgid,1), /* 181 */
505: syss(setegid,1), /* 182 */
506: syss(seteuid,1), /* 183 */
507: #if LFS
508: syss(lfs_bmapv,3), /* 184 = lfs_bmapv */
509: syss(lfs_markv,3), /* 185 = lfs_markv */
510: syss(lfs_segclean,2), /* 186 = lfs_segclean */
511: syss(lfs_segwait,2), /* 187 = lfs_segwait */
512: #else
513: syss(nosys,0), /* 184 = nosys */
514: syss(nosys,0), /* 185 = nosys */
515: syss(nosys,0), /* 186 = nosys */
516: syss(nosys,0), /* 187 = nosys */
517: #endif
518: syss(stat,2), /* 188 = stat */
519: syss(fstat,2), /* 189 = fstat */
520: syss(lstat,2), /* 190 = lstat */
521: syss(pathconf,2), /* 191 = pathconf */
522: syss(fpathconf,2), /* 192 = fpathconf */
523: syss(nosys,0), /* 193 = nosys */
524: syss(getrlimit,2), /* 194 = getrlimit */
525: syss(setrlimit,2), /* 195 = setrlimit */
526: syss(getdirentries,4), /* 196 = getdirentries */
527: #ifdef DOUBLE_ALIGN_PARAMS
528: syss(mmap,8), /* 197 = mmap */
529: #else
530: syss(mmap,7), /* 197 = mmap */
531: #endif
532: syss(nosys,0), /* 198 = __syscall */
533: syss(lseek,5), /* 199 = lseek */
534: syss(truncate,4), /* 200 = truncate */
535: syss(ftruncate,4), /* 201 = ftruncate */
536: syss(__sysctl,6), /* 202 = __sysctl */
537: sysp(getdtablesize, 0), /* 203 getdtablesize */
538: syss(nosys, 0), /* 204 unused */
539: #if NETAT
540: syss(undelete,1), /* 205 = undelete */
541: syss(ATsocket,1), /* 206 = AppleTalk ATsocket */
542: syss(ATgetmsg,4), /* 207 = AppleTalk ATgetmsg*/
543: syss(ATputmsg,4), /* 208 = AppleTalk ATputmsg*/
544: syss(ATPsndreq,4), /* 209 = AppleTalk ATPsndreq*/
545: syss(ATPsndrsp,4), /* 210 = AppleTalk ATPsndrsp*/
546: syss(ATPgetreq,3), /* 211 = AppleTalk ATPgetreq*/
547: syss(ATPgetrsp,2), /* 212 = AppleTalk ATPgetrsp*/
548: syss(nosys,0), /* 213 = Reserved for AT expansion */
549: syss(nosys,0), /* 214 = Reserved for AT expansion */
550: syss(nosys,0), /* 215 = Reserved for AT expansion */
551: #else
552: syss(undelete,1), /* 205 = undelete */
553:
554: /* System calls 205 - 215 are reserved to allow HFS and AT to coexist */
555: /* CHW 1/22/98 */
556:
557: syss(nosys,0), /* 206 = Reserved for AppleTalk */
558: syss(nosys,0), /* 207 = Reserved for AppleTalk */
559: syss(nosys,0), /* 208 = Reserved for AppleTalk */
560: syss(nosys,0), /* 209 = Reserved for AppleTalk */
561: syss(nosys,0), /* 210 = Reserved for AppleTalk */
562: syss(nosys,0), /* 211 = Reserved for AppleTalk */
563: syss(nosys,0), /* 212 = Reserved for AppleTalk */
564: syss(nosys,0), /* 213 = Reserved for AppleTalk */
565: syss(nosys,0), /* 214 = Reserved for AppleTalk */
566: syss(nosys,0), /* 215 = Reserved for AppleTalk */
567: #endif /* NETAT */
568:
569: /*
570: * System Calls 216 - 230 are reserved for calls to support HFS/HFS Plus
571: * file system semantics. Currently, we only use 215-225. The rest is
572: * for future expansion in anticipation of new MacOS APIs for HFS Plus.
573: * These calls are not conditionalized becuase while they are specific
574: * to HFS semantics, they are not specific to the HFS filesystem.
575: * We expect all filesystems to recognize the call and report that it is
576: * not supported or to actually implement it.
577: */
578: syss(mkcomplex,3), /* 216 = HFS make complex file call (multipel forks */
579: syss(statv,2), /* 217 = HFS statv extended stat call for HFS */
580: syss(lstatv,2), /* 218 = HFS lstatv extended lstat call for HFS */
581: syss(fstatv,2), /* 219 = HFS fstatv extended fstat call for HFS */
582: syss(getattrlist,3), /* 220 = HFS getarrtlist get attribute list cal */
583: syss(setattrlist,3), /* 221 = HFS setattrlist set attribute list */
584: syss(getdirentryattr,4), /* 222 = HFS getdirenttryattr get directory attributes */
585: syss(exchangedata,2), /* 223 = HFS exchangedata exchange file contents */
586: syss(checkuseraccess,5), /* 224 = HFS checkuseraccess check access to a file */
587: syss(searchfs,6), /* 225 = HFS searchfs to implement catalog searching */
588: syss(nosys,0), /* 226 */
589: syss(nosys,0), /* 227 */
590: syss(nosys,0), /* 228 */
591: syss(nosys,0), /* 229 */
592: syss(nosys,0), /* 230 */
593: syss(watchevent,2), /* 231 */
594: syss(waitevent,2), /* 232 */
595: syss(modwatch,2) /* 233 */
596: };
597: int nsysent = sizeof(sysent) / sizeof(sysent[0]);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.