1 /* bsdtrap.h. Definitions for values and structures used in bsdtrap.c
4 * $Date: 1999/03/01 19:14:16 $
7 /* In this file, we list the trap number for each system call,
8 * and the structures associated with several of the systems
9 * calls in 2.11BSD UNIX
42 #define S_GETFSSTAT 30
43 #define S_SIGACTION 31
44 #define S_SIGPROCMASK 32
46 #define S_SIGPENDING 34
47 #define S_SIGALTSTACK 35
74 #define S_GETPAGESIZE 64
78 #define S_GETGROUPS 79
79 #define S_SETGROUPS 80
82 #define S_SETITIMER 83
84 #define S_GETITIMER 86
85 #define S_GETHOSTNAME 87
86 #define S_SETHOSTNAME 88
87 #define S_GETDTABLESIZE 89
94 #define S_SETPRIORITY 96
98 #define S_GETPRIORITY 100
101 #define S_SIGRETURN 103
103 #define S_SETSOCKOPT 105
105 #define S_SIGSUSPEND 107
107 #define S_SIGBLOCK 109
108 #define S_SIGSETMASK 110
109 #define S_SIGPAUSE 111
110 #define S_SIGSTACK 112
111 #define S_RECVMSG 113
112 #define S_SENDMSG 114
113 #define S_GETTIMEOFDAY 116
114 #define S_GETRUSAGE 117
115 #define S_GETSOCKOPT 118
118 #define S_SETTIMEOFDAY 122
121 #define S_RECVFROM 125
122 #define S_SETREUID 126
123 #define S_SETREGID 127
125 #define S_TRUNCATE 129
126 #define S_FTRUNCATE 130
129 #define S_SHUTDOWN 134
130 #define S_SOCKETPAIR 135
134 #define S_ADJTIME 140
135 #define S_GETPEERNAME 141
136 #define S_GETHOSTID 142
137 #define S_SETHOSTID 143
138 #define S_GETRLIMIT 144
139 #define S_SETRLIMIT 145
141 #define S_NOSYS147 147
142 #define S_SETQUOTA 148
144 #define S_GETSOCKNAME 150
151 char *bsdtrap_name[] = {
152 "indir", /* 0 = indir */
153 "exit", /* 1 = exit */
154 "fork", /* 2 = fork */
155 "read", /* 3 = read */
156 "write", /* 4 = write */
157 "open", /* 5 = open */
158 "close", /* 6 = close */
159 "wait4", /* 7 = wait4 */
160 "creat", /* 8 = creat */
161 "link", /* 9 = link */
162 "unlink", /* 10 = unlink */
163 "execv", /* 11 = execv */
164 "chdir", /* 12 = chdir */
165 "fchdir", /* 13 = fchdir */
166 "mknod", /* 14 = mknod */
167 "chmod", /* 15 = chmod */
168 "chown", /* 16 = chown; now 3 args */
169 "chflags", /* 17 = chflags */
170 "fchflags", /* 18 = fchflags */
171 "lseek", /* 19 = lseek */
172 "getpid", /* 20 = getpid */
173 "mount", /* 21 = mount */
174 "umount", /* 22 = umount */
175 "__sysctl", /* 23 = __sysctl */
176 "getuid", /* 24 = getuid */
177 "geteuid", /* 25 = geteuid */
178 "ptrace", /* 26 = ptrace */
179 "getppid", /* 27 = getppid */
180 "statfs", /* 28 = statfs */
181 "fstatfs", /* 29 = fstatfs */
182 "getfsstat", /* 30 = getfsstat */
183 "sigaction", /* 31 = sigaction */
184 "sigprocmask", /* 32 = sigprocmask */
185 "access", /* 33 = access */
186 "sigpending", /* 34 = sigpending */
187 "sigaltstack", /* 35 = sigaltstack */
188 "sync", /* 36 = sync */
189 "kill", /* 37 = kill */
190 "stat", /* 38 = stat */
191 "getlogin", /* 39 = getlogin */
192 "lstat", /* 40 = lstat */
193 "dup", /* 41 = dup */
194 "pipe", /* 42 = pipe */
195 "setlogin", /* 43 = setlogin */
196 "profil", /* 44 = profil */
197 "setuid", /* 45 = setuid */
198 "seteuid", /* 46 = seteuid */
199 "getgid", /* 47 = getgid */
200 "getegid", /* 48 = getegid */
201 "setgid", /* 49 = setgid */
202 "setegid", /* 50 = setegid */
203 "acct", /* 51 = turn acct off/on */
204 "old phys", /* 52 = old set phys addr */
205 "old lock", /* 53 = old lock in core */
206 "ioctl", /* 54 = ioctl */
207 "reboot", /* 55 = reboot */
208 "old mpx - nosys", /* 56 = old mpxchan */
209 "symlink", /* 57 = symlink */
210 "readlink", /* 58 = readlink */
211 "execve", /* 59 = execve */
212 "umask", /* 60 = umask */
213 "chroot", /* 61 = chroot */
214 "fstat", /* 62 = fstat */
215 "#63", /* 63 = used internally */
216 "getpagesize", /* 64 = getpagesize */
217 "4.3 mremap - nosys", /* 65 = mremap */
218 "vfork", /* 66 = vfork */
219 "old vread - nosys", /* 67 = old vread */
220 "old vwrite - nosys", /* 68 = old vwrite */
221 "sbrk", /* 69 = sbrk */
222 "4.3 sstk - nosys", /* 70 = sstk */
223 "4.3 mmap - nosys", /* 71 = mmap */
224 "old vadvise - nosys", /* 72 = old vadvise */
225 "4.3 munmap - nosys", /* 73 = munmap */
226 "4.3 mprotect - nosys", /* 74 = mprotect */
227 "4.3 madvise - nosys", /* 75 = madvise */
228 "vhangup", /* 76 = vhangup */
229 "old vlimit - nosys", /* 77 = old vlimit */
230 "4.3 mincore - nosys", /* 78 = mincore */
231 "getgroups", /* 79 = getgroups */
232 "setgroups", /* 80 = setgroups */
233 "getpgrp", /* 81 = getpgrp */
234 "setpgrp", /* 82 = setpgrp */
235 "setitimer", /* 83 = setitimer */
236 "wait", /* 84 = wait */
237 "4.3 swapon - nosys", /* 85 = swapon */
238 "getitimer", /* 86 = getitimer */
239 "gethostname", /* 87 = gethostname */
240 "sethostname", /* 88 = sethostname */
241 "getdtablesize", /* 89 = getdtablesize */
242 "dup2", /* 90 = dup2 */
243 "nosys", /* 91 = unused */
244 "fcntl", /* 92 = fcntl */
245 "select", /* 93 = select */
246 "nosys", /* 94 = unused */
247 "fsync", /* 95 = fsync */
248 "setpriority", /* 96 = setpriority */
249 "socket", /* 97 = socket */
250 "connect", /* 98 = connect */
251 "accept", /* 99 = accept */
252 "getpriority", /* 100 = getpriority */
253 "send", /* 101 = send */
254 "recv", /* 102 = recv */
255 "sigreturn", /* 103 = sigreturn */
256 "bind", /* 104 = bind */
257 "setsockopt", /* 105 = setsockopt */
258 "listen", /* 106 = listen */
259 "sigsuspend", /* 107 = sigsuspend */
260 "sigvec", /* 108 = sigvec */
261 "sigblock", /* 109 = sigblock */
262 "sigsetmask", /* 110 = sigsetmask */
263 "sigpause", /* 111 = sigpause */
264 "sigstack", /* 112 = sigstack */
265 "recvmsg", /* 113 = recvmsg */
266 "sendmsg", /* 114 = sendmsg */
267 "old vtrace - nosys", /* 115 = old vtrace */
268 "gettimeofday", /* 116 = gettimeofday */
269 "getrusage", /* 117 = getrusage */
270 "getsockopt", /* 118 = getsockopt */
271 "4.3 resuba - nosys", /* 119 = resuba */
272 "readv", /* 120 = readv */
273 "writev", /* 121 = writev */
274 "settimeofday", /* 122 = settimeofday */
275 "fchown", /* 123 = fchown */
276 "fchmod", /* 124 = fchmod */
277 "recvfrom", /* 125 = recvfrom */
278 "setreuid", /* 126 = setreuid */
279 "setregid", /* 127 = setregid */
280 "rename", /* 128 = rename */
281 "truncate", /* 129 = truncate */
282 "ftruncate", /* 130 = ftruncate */
283 "flock", /* 131 = flock */
284 "old portal - nosys", /* 132 = old portal */
285 "sendto", /* 133 = sendto */
286 "shutdown", /* 134 = shutdown */
287 "socketpair", /* 135 = socketpair */
288 "mkdir", /* 136 = mkdir */
289 "rmdir", /* 137 = rmdir */
290 "utimes", /* 138 = utimes */
291 "4.2 sigreturn - nosys", /* 139 = old 4.2 sigreturn */
292 "adjtime", /* 140 = adjtime */
293 "getpeername", /* 141 = getpeername */
294 "gethostid", /* 142 = gethostid */
295 "sethostid", /* 143 = sethostid */
296 "getrlimit", /* 144 = getrlimit */
297 "setrlimit", /* 145 = setrlimit */
298 "killpg", /* 146 = killpg */
299 "#147", /* 147 = nosys */
300 "setquota", /* 148 = setquota */
301 "quota", /* 149 = quota */
302 "getsockname", /* 150 = getsockname */
306 /* fcntl defines used by open */
307 #define BSD_RDONLY 0x0000 /* open for reading only */
308 #define BSD_WRONLY 0x0001 /* open for writing only */
309 #define BSD_RDWR 0x0002 /* open for reading and writing */
310 #define BSD_NONBLOCK 0x0004 /* no delay */
311 #define BSD_APPEND 0x0008 /* set append mode */
312 #define BSD_SHLOCK 0x0010 /* open with shared file lock */
313 #define BSD_EXLOCK 0x0020 /* open with exclusive file lock */
314 #define BSD_ASYNC 0x0040 /* signal pgrp when data ready */
315 #define BSD_FSYNC 0x0080 /* synchronous writes */
316 #define BSD_CREAT 0x0200 /* create if nonexistant */
317 #define BSD_TRUNC 0x0400 /* truncate to zero length */
318 #define BSD_EXCL 0x0800 /* error if already exists */
321 /* stat struct, used by S_STAT, S_FSTAT, S_LSTAT */
330 int8_t st_size[4]; /* Alignment problems */
331 int8_t st_atim[4]; /* Alignment problems */
333 int8_t st_mtim[4]; /* Alignment problems */
335 int8_t st_ctim[4]; /* Alignment problems */
337 int8_t st_blksize[4]; /* Alignment problems */
338 int8_t st_blocks[4]; /* Alignment problems */
340 u_int16_t st_spare4[3];
343 /* Directory entry */
344 #define TR_DIRBLKSIZ 512
345 #define TR_MAXNAMLEN 63
347 u_int16_t d_ino; /* inode number of entry */
348 u_int16_t d_reclen; /* length of this record */
349 u_int16_t d_namlen; /* length of string in d_name */
350 char d_name[TR_MAXNAMLEN + 1]; /* name must be no longer than this */
353 /* used by S_ADJTIME */
355 u_int32_t tv_sec; /* seconds */
356 u_int32_t tv_usec; /* and microseconds */
358 /* Used by S_GETTIMEOFDAY */
360 int16_t tz_minuteswest; /* minutes west of Greenwich */
361 int16_t tz_dsttime; /* type of dst correction */
364 /* used in itimer calls */
365 struct tr_itimerval {
366 struct tr_timeval it_interval; /* timer interval */
367 struct tr_timeval it_value; /* current value */
370 /* Used by socket calls */
372 u_int16_t sa_family; /* address family */
373 char sa_data[14]; /* up to 14 bytes of direct address */
376 /* used in rlimit calls */
378 int32_t rlim_cur; /* current (soft) limit */
379 int32_t rlim_max; /* maximum value for rlim_cur */
383 struct tr_timeval ru_utime; /* user time used */
384 struct tr_timeval ru_stime; /* system time used */
386 u_int32_t ru_ixrss; /* integral shared memory size */
387 u_int32_t ru_idrss; /* integral unshared data size */
388 u_int32_t ru_isrss; /* integral unshared stack size */
389 u_int32_t ru_minflt; /* page reclaims */
390 u_int32_t ru_majflt; /* page faults */
391 u_int32_t ru_ovly; /* overlay changes */
392 u_int32_t ru_nswap; /* swaps */
393 u_int32_t ru_inblock; /* block input operations */
394 u_int32_t ru_oublock; /* block output operations */
395 u_int32_t ru_msgsnd; /* messages sent */
396 u_int32_t ru_msgrcv; /* messages received */
397 u_int32_t ru_nsignals; /* signals received */
398 u_int32_t ru_nvcsw; /* voluntary context switches */
399 u_int32_t ru_nivcsw; /* involuntary context switches */
402 /* for writev, readv */
409 /* A union which will point at the trap args, so that
410 * we can get at the various args of different types
413 int16_t sarg[6]; /* Signed 16-bit args */
414 u_int16_t uarg[6]; /* Unsigned 16-bit args */
417 #define sarg1 A->sarg[0]
418 #define sarg2 A->sarg[1]
419 #define sarg3 A->sarg[2]
420 #define sarg4 A->sarg[3]
421 #define sarg5 A->sarg[4]
422 #define sarg6 A->sarg[5]
423 #define uarg1 A->uarg[0]
424 #define uarg2 A->uarg[1]
425 #define uarg3 A->uarg[2]
426 #define uarg4 A->uarg[3]
427 #define uarg5 A->uarg[4]
428 #define uarg6 A->uarg[5]