1: /* 2: * Copyright (c) 1982, 1986 Regents of the University of California. 3: * All rights reserved. The Berkeley software License Agreement 4: * specifies the terms and conditions for redistribution. 5: * 6: * @(#)init_sysent.c 7.1 (Berkeley) 6/5/86 7: */ 8: 9: /* 10: * System call switch table. 11: */ 12: 13: #include "param.h" 14: #include "systm.h" 15: 16: int nosys(); 17: 18: /* 1.1 processes and protection */ 19: int sethostid(),gethostid(),sethostname(),gethostname(),getpid(); 20: int fork(),rexit(),execv(),execve(),wait(); 21: int getuid(),setreuid(),getgid(),getgroups(),setregid(),setgroups(); 22: int getpgrp(),setpgrp(); 23: 24: /* 1.2 memory management */ 25: int sbrk(),sstk(); 26: int getpagesize(),smmap(),mremap(),munmap(),mprotect(),madvise(),mincore(); 27: 28: /* 1.3 signals */ 29: int sigvec(),sigblock(),sigsetmask(),sigpause(),sigstack(),sigreturn(); 30: int kill(), killpg(); 31: 32: /* 1.4 timing and statistics */ 33: int gettimeofday(),settimeofday(); 34: int getitimer(),setitimer(); 35: int adjtime(); 36: 37: /* 1.5 descriptors */ 38: int getdtablesize(),dup(),dup2(),close(); 39: int select(),getdopt(),setdopt(),fcntl(),flock(); 40: 41: /* 1.6 resource controls */ 42: int getpriority(),setpriority(),getrusage(),getrlimit(),setrlimit(); 43: int setquota(),qquota(); 44: 45: /* 1.7 system operation support */ 46: int umount(),smount(),swapon(); 47: int sync(),reboot(),sysacct(); 48: 49: /* 2.1 generic operations */ 50: int read(),write(),readv(),writev(),ioctl(); 51: 52: /* 2.2 file system */ 53: int chdir(),chroot(); 54: int mkdir(),rmdir(); 55: int creat(),open(),mknod(),unlink(),stat(),fstat(),lstat(); 56: int chown(),fchown(),chmod(),fchmod(),utimes(); 57: int link(),symlink(),readlink(),rename(); 58: int lseek(),truncate(),ftruncate(),saccess(),fsync(); 59: 60: /* 2.3 communications */ 61: int socket(),bind(),listen(),accept(),connect(); 62: int socketpair(),sendto(),send(),recvfrom(),recv(); 63: int sendmsg(),recvmsg(),shutdown(),setsockopt(),getsockopt(); 64: int getsockname(),getpeername(),pipe(); 65: 66: int umask(); /* XXX */ 67: 68: /* 2.4 processes */ 69: int ptrace(); 70: 71: /* 2.5 terminals */ 72: 73: #ifdef COMPAT 74: /* emulations for backwards compatibility */ 75: #define compat(n, name) n, o/**/name 76: 77: int owait(); /* now receive message on channel */ 78: int otime(); /* now use gettimeofday */ 79: int ostime(); /* now use settimeofday */ 80: int oalarm(); /* now use setitimer */ 81: int outime(); /* now use utimes */ 82: int opause(); /* now use sigpause */ 83: int onice(); /* now use setpriority,getpriority */ 84: int oftime(); /* now use gettimeofday */ 85: int osetpgrp(); /* ??? */ 86: int otimes(); /* now use getrusage */ 87: int ossig(); /* now use sigvec, etc */ 88: int ovlimit(); /* now use setrlimit,getrlimit */ 89: int ovtimes(); /* now use getrusage */ 90: int osetuid(); /* now use setreuid */ 91: int osetgid(); /* now use setregid */ 92: int ostat(); /* now use stat */ 93: int ofstat(); /* now use fstat */ 94: #else 95: #define compat(n, name) 0, nosys 96: #endif 97: 98: /* BEGIN JUNK */ 99: #ifdef vax 100: int resuba(); 101: #ifdef TRACE 102: int vtrace(); 103: #endif 104: #endif 105: int profil(); /* 'cuz sys calls are interruptible */ 106: int vhangup(); /* should just do in exit() */ 107: int vfork(); /* awaiting fork w/ copy on write */ 108: int obreak(); /* awaiting new sbrk */ 109: int ovadvise(); /* awaiting new madvise */ 110: /* END JUNK */ 111: 112: /* 113: * Reserved/unimplemented system calls in the range 0-150 inclusive 114: * are reserved for use in future Berkeley releases. 115: * Additional system calls implemented in vendor and other 116: * redistributions should be placed in the reserved range at the end 117: * of the current calls. 118: */ 119: struct sysent sysent[] = { 120: 0, nosys, /* 0 = indir or out-of-range */ 121: 1, rexit, /* 1 = exit */ 122: 0, fork, /* 2 = fork */ 123: 3, read, /* 3 = read */ 124: 3, write, /* 4 = write */ 125: 3, open, /* 5 = open */ 126: 1, close, /* 6 = close */ 127: compat(0,wait), /* 7 = old wait */ 128: 2, creat, /* 8 = creat */ 129: 2, link, /* 9 = link */ 130: 1, unlink, /* 10 = unlink */ 131: 2, execv, /* 11 = execv */ 132: 1, chdir, /* 12 = chdir */ 133: compat(0,time), /* 13 = old time */ 134: 3, mknod, /* 14 = mknod */ 135: 2, chmod, /* 15 = chmod */ 136: 3, chown, /* 16 = chown; now 3 args */ 137: 1, obreak, /* 17 = old break */ 138: compat(2,stat), /* 18 = old stat */ 139: 3, lseek, /* 19 = lseek */ 140: 0, getpid, /* 20 = getpid */ 141: 3, smount, /* 21 = mount */ 142: 1, umount, /* 22 = umount */ 143: compat(1,setuid), /* 23 = old setuid */ 144: 0, getuid, /* 24 = getuid */ 145: compat(1,stime), /* 25 = old stime */ 146: 4, ptrace, /* 26 = ptrace */ 147: compat(1,alarm), /* 27 = old alarm */ 148: compat(2,fstat), /* 28 = old fstat */ 149: compat(0,pause), /* 29 = opause */ 150: compat(2,utime), /* 30 = old utime */ 151: 0, nosys, /* 31 = was stty */ 152: 0, nosys, /* 32 = was gtty */ 153: 2, saccess, /* 33 = access */ 154: compat(1,nice), /* 34 = old nice */ 155: compat(1,ftime), /* 35 = old ftime */ 156: 0, sync, /* 36 = sync */ 157: 2, kill, /* 37 = kill */ 158: 2, stat, /* 38 = stat */ 159: compat(2,setpgrp), /* 39 = old setpgrp */ 160: 2, lstat, /* 40 = lstat */ 161: 2, dup, /* 41 = dup */ 162: 0, pipe, /* 42 = pipe */ 163: compat(1,times), /* 43 = old times */ 164: 4, profil, /* 44 = profil */ 165: 0, nosys, /* 45 = nosys */ 166: compat(1,setgid), /* 46 = old setgid */ 167: 0, getgid, /* 47 = getgid */ 168: compat(2,ssig), /* 48 = old sig */ 169: 0, nosys, /* 49 = reserved for USG */ 170: 0, nosys, /* 50 = reserved for USG */ 171: 1, sysacct, /* 51 = turn acct off/on */ 172: 0, nosys, /* 52 = old set phys addr */ 173: 0, nosys, /* 53 = old lock in core */ 174: 3, ioctl, /* 54 = ioctl */ 175: 1, reboot, /* 55 = reboot */ 176: 0, nosys, /* 56 = old mpxchan */ 177: 2, symlink, /* 57 = symlink */ 178: 3, readlink, /* 58 = readlink */ 179: 3, execve, /* 59 = execve */ 180: 1, umask, /* 60 = umask */ 181: 1, chroot, /* 61 = chroot */ 182: 2, fstat, /* 62 = fstat */ 183: 0, nosys, /* 63 = reserved */ 184: 1, getpagesize, /* 64 = getpagesize */ 185: 5, mremap, /* 65 = mremap */ 186: 0, vfork, /* 66 = vfork */ 187: 0, read, /* 67 = old vread */ 188: 0, write, /* 68 = old vwrite */ 189: 1, sbrk, /* 69 = sbrk */ 190: 1, sstk, /* 70 = sstk */ 191: 6, smmap, /* 71 = mmap */ 192: 1, ovadvise, /* 72 = old vadvise */ 193: 2, munmap, /* 73 = munmap */ 194: 3, mprotect, /* 74 = mprotect */ 195: 3, madvise, /* 75 = madvise */ 196: 1, vhangup, /* 76 = vhangup */ 197: compat(2,vlimit), /* 77 = old vlimit */ 198: 3, mincore, /* 78 = mincore */ 199: 2, getgroups, /* 79 = getgroups */ 200: 2, setgroups, /* 80 = setgroups */ 201: 1, getpgrp, /* 81 = getpgrp */ 202: 2, setpgrp, /* 82 = setpgrp */ 203: 3, setitimer, /* 83 = setitimer */ 204: 0, wait, /* 84 = wait */ 205: 1, swapon, /* 85 = swapon */ 206: 2, getitimer, /* 86 = getitimer */ 207: 2, gethostname, /* 87 = gethostname */ 208: 2, sethostname, /* 88 = sethostname */ 209: 0, getdtablesize, /* 89 = getdtablesize */ 210: 2, dup2, /* 90 = dup2 */ 211: 2, getdopt, /* 91 = getdopt */ 212: 3, fcntl, /* 92 = fcntl */ 213: 5, select, /* 93 = select */ 214: 2, setdopt, /* 94 = setdopt */ 215: 1, fsync, /* 95 = fsync */ 216: 3, setpriority, /* 96 = setpriority */ 217: 3, socket, /* 97 = socket */ 218: 3, connect, /* 98 = connect */ 219: 3, accept, /* 99 = accept */ 220: 2, getpriority, /* 100 = getpriority */ 221: 4, send, /* 101 = send */ 222: 4, recv, /* 102 = recv */ 223: 1, sigreturn, /* 103 = sigreturn */ 224: 3, bind, /* 104 = bind */ 225: 5, setsockopt, /* 105 = setsockopt */ 226: 2, listen, /* 106 = listen */ 227: compat(2,vtimes), /* 107 = old vtimes */ 228: 3, sigvec, /* 108 = sigvec */ 229: 1, sigblock, /* 109 = sigblock */ 230: 1, sigsetmask, /* 110 = sigsetmask */ 231: 1, sigpause, /* 111 = sigpause */ 232: 2, sigstack, /* 112 = sigstack */ 233: 3, recvmsg, /* 113 = recvmsg */ 234: 3, sendmsg, /* 114 = sendmsg */ 235: #ifdef TRACE 236: 2, vtrace, /* 115 = vtrace */ 237: #else 238: 0, nosys, /* 115 = nosys */ 239: #endif 240: 2, gettimeofday, /* 116 = gettimeofday */ 241: 2, getrusage, /* 117 = getrusage */ 242: 5, getsockopt, /* 118 = getsockopt */ 243: #ifdef vax 244: 1, resuba, /* 119 = resuba */ 245: #else 246: 0, nosys, /* 119 = nosys */ 247: #endif 248: 3, readv, /* 120 = readv */ 249: 3, writev, /* 121 = writev */ 250: 2, settimeofday, /* 122 = settimeofday */ 251: 3, fchown, /* 123 = fchown */ 252: 2, fchmod, /* 124 = fchmod */ 253: 6, recvfrom, /* 125 = recvfrom */ 254: 2, setreuid, /* 126 = setreuid */ 255: 2, setregid, /* 127 = setregid */ 256: 2, rename, /* 128 = rename */ 257: 2, truncate, /* 129 = truncate */ 258: 2, ftruncate, /* 130 = ftruncate */ 259: 2, flock, /* 131 = flock */ 260: 0, nosys, /* 132 = nosys */ 261: 6, sendto, /* 133 = sendto */ 262: 2, shutdown, /* 134 = shutdown */ 263: 5, socketpair, /* 135 = socketpair */ 264: 2, mkdir, /* 136 = mkdir */ 265: 1, rmdir, /* 137 = rmdir */ 266: 2, utimes, /* 138 = utimes */ 267: 0, nosys, /* 139 = internal (4.2 sigreturn) */ 268: 2, adjtime, /* 140 = adjtime */ 269: 3, getpeername, /* 141 = getpeername */ 270: 0, gethostid, /* 142 = gethostid */ 271: 1, sethostid, /* 143 = sethostid */ 272: 2, getrlimit, /* 144 = getrlimit */ 273: 2, setrlimit, /* 145 = setrlimit */ 274: 2, killpg, /* 146 = killpg */ 275: 0, nosys, /* 147 = nosys */ 276: 2, setquota, /* 148 = quota */ 277: 4, qquota, /* 149 = qquota */ 278: 3, getsockname, /* 150 = getsockname */ 279: /* 280: * Syscalls 151-180 inclusive are reserved for vendor-specific 281: * system calls. (This includes various calls added for compatibity 282: * with other Unix variants.) 283: */ 284: }; 285: int nsysent = sizeof (sysent) / sizeof (sysent[0]);