1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2015, Joyent, Inc. All rights reserved.
25 * Copyright 2024 Oxide Computer Company
26 */
27
28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
29 /* All Rights Reserved */
30
31 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
32
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <fcntl.h>
36 #include <unistd.h>
37 #include <string.h>
38 #include <signal.h>
39 #include <sys/types.h>
40 #include <libproc.h>
41 #include <sys/aio.h>
42 #include <sys/port_impl.h>
43 #include "ramdata.h"
44 #include "systable.h"
45 #include "print.h"
46 #include "proto.h"
47
48 /*
49 * Tables of information about system calls - read-only data.
50 */
51
52 const char *const errcode[] = { /* error code names */
53 NULL, /* 0 */
54 "EPERM", /* 1 */
55 "ENOENT", /* 2 */
56 "ESRCH", /* 3 */
57 "EINTR", /* 4 */
58 "EIO", /* 5 */
59 "ENXIO", /* 6 */
60 "E2BIG", /* 7 */
61 "ENOEXEC", /* 8 */
62 "EBADF", /* 9 */
63 "ECHILD", /* 10 */
64 "EAGAIN", /* 11 */
65 "ENOMEM", /* 12 */
66 "EACCES", /* 13 */
67 "EFAULT", /* 14 */
68 "ENOTBLK", /* 15 */
69 "EBUSY", /* 16 */
70 "EEXIST", /* 17 */
71 "EXDEV", /* 18 */
72 "ENODEV", /* 19 */
73 "ENOTDIR", /* 20 */
74 "EISDIR", /* 21 */
75 "EINVAL", /* 22 */
76 "ENFILE", /* 23 */
77 "EMFILE", /* 24 */
78 "ENOTTY", /* 25 */
79 "ETXTBSY", /* 26 */
80 "EFBIG", /* 27 */
81 "ENOSPC", /* 28 */
82 "ESPIPE", /* 29 */
83 "EROFS", /* 30 */
84 "EMLINK", /* 31 */
85 "EPIPE", /* 32 */
86 "EDOM", /* 33 */
87 "ERANGE", /* 34 */
88 "ENOMSG", /* 35 */
89 "EIDRM", /* 36 */
90 "ECHRNG", /* 37 */
91 "EL2NSYNC", /* 38 */
92 "EL3HLT", /* 39 */
93 "EL3RST", /* 40 */
94 "ELNRNG", /* 41 */
95 "EUNATCH", /* 42 */
96 "ENOCSI", /* 43 */
97 "EL2HLT", /* 44 */
98 "EDEADLK", /* 45 */
99 "ENOLCK", /* 46 */
100 "ECANCELED", /* 47 */
101 "ENOTSUP", /* 48 */
102 "EDQUOT", /* 49 */
103 "EBADE", /* 50 */
104 "EBADR", /* 51 */
105 "EXFULL", /* 52 */
106 "ENOANO", /* 53 */
107 "EBADRQC", /* 54 */
108 "EBADSLT", /* 55 */
109 "EDEADLOCK", /* 56 */
110 "EBFONT", /* 57 */
111 "EOWNERDEAD", /* 58 */
112 "ENOTRECOVERABLE", /* 59 */
113 "ENOSTR", /* 60 */
114 "ENODATA", /* 61 */
115 "ETIME", /* 62 */
116 "ENOSR", /* 63 */
117 "ENONET", /* 64 */
118 "ENOPKG", /* 65 */
119 "EREMOTE", /* 66 */
120 "ENOLINK", /* 67 */
121 "EADV", /* 68 */
122 "ESRMNT", /* 69 */
123 "ECOMM", /* 70 */
124 "EPROTO", /* 71 */
125 "ELOCKUNMAPPED", /* 72 */
126 "ENOTACTIVE", /* 73 */
127 "EMULTIHOP", /* 74 */
128 NULL, /* 75 */
129 NULL, /* 76 */
130 "EBADMSG", /* 77 */
131 "ENAMETOOLONG", /* 78 */
132 "EOVERFLOW", /* 79 */
133 "ENOTUNIQ", /* 80 */
134 "EBADFD", /* 81 */
135 "EREMCHG", /* 82 */
136 "ELIBACC", /* 83 */
137 "ELIBBAD", /* 84 */
138 "ELIBSCN", /* 85 */
139 "ELIBMAX", /* 86 */
140 "ELIBEXEC", /* 87 */
141 "EILSEQ", /* 88 */
142 "ENOSYS", /* 89 */
143 "ELOOP", /* 90 */
144 "ERESTART", /* 91 */
145 "ESTRPIPE", /* 92 */
146 "ENOTEMPTY", /* 93 */
147 "EUSERS", /* 94 */
148 "ENOTSOCK", /* 95 */
149 "EDESTADDRREQ", /* 96 */
150 "EMSGSIZE", /* 97 */
151 "EPROTOTYPE", /* 98 */
152 "ENOPROTOOPT", /* 99 */
153 NULL, /* 100 */
154 NULL, /* 101 */
155 NULL, /* 102 */
156 NULL, /* 103 */
157 NULL, /* 104 */
158 NULL, /* 105 */
159 NULL, /* 106 */
160 NULL, /* 107 */
161 NULL, /* 108 */
162 NULL, /* 109 */
163 NULL, /* 110 */
164 NULL, /* 111 */
165 NULL, /* 112 */
166 NULL, /* 113 */
167 NULL, /* 114 */
168 NULL, /* 115 */
169 NULL, /* 116 */
170 NULL, /* 117 */
171 NULL, /* 118 */
172 NULL, /* 119 */
173 "EPROTONOSUPPORT", /* 120 */
174 "ESOCKTNOSUPPORT", /* 121 */
175 "EOPNOTSUPP", /* 122 */
176 "EPFNOSUPPORT", /* 123 */
177 "EAFNOSUPPORT", /* 124 */
178 "EADDRINUSE", /* 125 */
179 "EADDRNOTAVAIL", /* 126 */
180 "ENETDOWN", /* 127 */
181 "ENETUNREACH", /* 128 */
182 "ENETRESET", /* 129 */
183 "ECONNABORTED", /* 130 */
184 "ECONNRESET", /* 131 */
185 "ENOBUFS", /* 132 */
186 "EISCONN", /* 133 */
187 "ENOTCONN", /* 134 */
188 NULL, /* 135 */
189 NULL, /* 136 */
190 NULL, /* 137 */
191 NULL, /* 138 */
192 NULL, /* 139 */
193 NULL, /* 140 */
194 NULL, /* 141 */
195 NULL, /* 142 */
196 "ESHUTDOWN", /* 143 */
197 "ETOOMANYREFS", /* 144 */
198 "ETIMEDOUT", /* 145 */
199 "ECONNREFUSED", /* 146 */
200 "EHOSTDOWN", /* 147 */
201 "EHOSTUNREACH", /* 148 */
202 "EALREADY", /* 149 */
203 "EINPROGRESS", /* 150 */
204 "ESTALE" /* 151 */
205 };
206
207 #define NERRCODE (sizeof (errcode) / sizeof (char *))
208
209
210 const char *
errname(int err)211 errname(int err) /* return the error code name (NULL if none) */
212 {
213 const char *ename = NULL;
214
215 if (err >= 0 && err < NERRCODE)
216 ename = errcode[err];
217
218 return (ename);
219 }
220
221
222 const struct systable systable[] = {
223 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
224 {"_exit", 1, DEC, NOV, DEC}, /* 1 */
225 {"psecflags", 3, DEC, NOV, HEX, PSFW, PSDLT}, /* 2 */
226 {"read", 3, DEC, NOV, DEC, IOB, UNS}, /* 3 */
227 {"write", 3, DEC, NOV, DEC, IOB, UNS}, /* 4 */
228 {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 5 */
229 {"close", 1, DEC, NOV, DEC}, /* 6 */
230 {"linkat", 5, DEC, NOV, ATC, STG, ATC, STG, SNF}, /* 7 */
231 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
232 {"link", 2, DEC, NOV, STG, STG}, /* 9 */
233 {"unlink", 1, DEC, NOV, STG}, /* 10 */
234 {"symlinkat", 3, DEC, NOV, STG, ATC, STG}, /* 11 */
235 {"chdir", 1, DEC, NOV, STG}, /* 12 */
236 {"time", 0, DEC, NOV}, /* 13 */
237 {"mknod", 3, DEC, NOV, STG, OCT, HEX}, /* 14 */
238 {"chmod", 2, DEC, NOV, STG, OCT}, /* 15 */
239 {"chown", 3, DEC, NOV, STG, DEC, DEC}, /* 16 */
240 {"brk", 1, DEC, NOV, HEX}, /* 17 */
241 {"stat", 2, DEC, NOV, STG, HEX}, /* 18 */
242 {"lseek", 3, DEC, NOV, DEC, DEX, WHN}, /* 19 */
243 {"getpid", 0, DEC, DEC}, /* 20 */
244 {"mount", 8, DEC, NOV, STG, STG, MTF, MFT, HEX, DEC, HEX, DEC}, /* 21 */
245 {"readlinkat", 4, DEC, NOV, ATC, STG, RLK, UNS}, /* 22 */
246 {"setuid", 1, DEC, NOV, UNS}, /* 23 */
247 {"getuid", 0, UNS, UNS}, /* 24 */
248 {"stime", 1, DEC, NOV, DEC}, /* 25 */
249 {"pcsample", 2, DEC, NOV, HEX, DEC}, /* 26 */
250 {"alarm", 1, DEC, NOV, UNS}, /* 27 */
251 {"fstat", 2, DEC, NOV, DEC, HEX}, /* 28 */
252 {"pause", 0, DEC, NOV}, /* 29 */
253 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
254 {"stty", 2, DEC, NOV, DEC, DEC}, /* 31 */
255 {"gtty", 2, DEC, NOV, DEC, DEC}, /* 32 */
256 {"access", 2, DEC, NOV, STG, ACC}, /* 33 */
257 {"nice", 1, DEC, NOV, DEC}, /* 34 */
258 {"statfs", 4, DEC, NOV, STG, HEX, DEC, DEC}, /* 35 */
259 {"sync", 0, DEC, NOV}, /* 36 */
260 {"kill", 2, DEC, NOV, DEC, SIG}, /* 37 */
261 {"fstatfs", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 38 */
262 {"pgrpsys", 3, DEC, NOV, DEC, DEC, DEC}, /* 39 */
263 {"uucopystr", 3, DEC, NOV, STG, RST, UNS}, /* 40 */
264 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
265 {"pipe", 2, DEC, NOV, PFD, PIP}, /* 42 */
266 {"times", 1, DEC, NOV, HEX}, /* 43 */
267 {"profil", 4, DEC, NOV, HEX, UNS, HEX, OCT}, /* 44 */
268 {"faccessat", 4, DEC, NOV, ATC, STG, ACC, FAT}, /* 45 */
269 {"setgid", 1, DEC, NOV, UNS}, /* 46 */
270 {"getgid", 0, UNS, UNS}, /* 47 */
271 {"mknodat", 4, DEC, NOV, ATC, STG, OCT, HEX}, /* 48 */
272 {"msgsys", 6, DEC, NOV, DEC, DEC, DEC, DEC, DEC, DEC}, /* 49 */
273 {"sysi86", 4, HEX, NOV, S86, HEX, HEX, HEX, DEC, DEC}, /* 50 */
274 {"acct", 1, DEC, NOV, STG}, /* 51 */
275 {"shmsys", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 52 */
276 {"semsys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 53 */
277 {"ioctl", 3, DEC, NOV, DEC, IOC, IOA}, /* 54 */
278 {"uadmin", 3, DEC, NOV, DEC, DEC, DEC}, /* 55 */
279 {"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, SNF}, /* 56 */
280 {"utssys", 4, DEC, NOV, HEX, DEC, UTS, HEX}, /* 57 */
281 {"fdsync", 2, DEC, NOV, DEC, FDS}, /* 58 */
282 {"execvex", 4, DEC, NOV, STG, HEX, HEX, EXC}, /* 59 */
283 {"umask", 1, OCT, NOV, OCT}, /* 60 */
284 {"chroot", 1, DEC, NOV, STG}, /* 61 */
285 {"fcntl", 4, DEC, NOV, DEC, FCN, HEX, HEX}, /* 62 */
286 {"ulimit", 2, DEX, NOV, ULM, DEC}, /* 63 */
287 {"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 64 */
288 {"unlinkat", 3, DEC, NOV, ATC, STG, UAT}, /* 65 */
289 {"fstatat", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 66 */
290 {"fstatat64", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 67 */
291 {"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 68 */
292 {"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 69 */
293 {"tasksys", 5, DEC, NOV, DEC, DEC, DEC, HEX, DEC}, /* 70 */
294 {"acctctl", 3, DEC, NOV, HEX, HEX, UNS}, /* 71 */
295 {"exacctsys", 6, DEC, NOV, DEC, IDT, DEC, HEX, DEC, HEX}, /* 72 */
296 {"getpagesizes", 2, DEC, NOV, HEX, DEC}, /* 73 */
297 {"rctlsys", 6, DEC, NOV, RSC, STG, HEX, HEX, DEC, DEC}, /* 74 */
298 {"sidsys", 4, UNS, UNS, DEC, DEC, DEC, DEC}, /* 75 */
299 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
300 {"lwp_park", 3, DEC, NOV, DEC, HEX, DEC}, /* 77 */
301 {"sendfilev", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 78 */
302 {"rmdir", 1, DEC, NOV, STG}, /* 79 */
303 {"mkdir", 2, DEC, NOV, STG, OCT}, /* 80 */
304 {"getdents", 3, DEC, NOV, DEC, HEX, UNS}, /* 81 */
305 {"privsys", 5, HEX, NOV, DEC, DEC, DEC, HEX, DEC}, /* 82 */
306 {"ucredsys", 3, DEC, NOV, DEC, DEC, HEX}, /* 83 */
307 {"sysfs", 3, DEC, NOV, SFS, DEX, DEX}, /* 84 */
308 {"getmsg", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 85 */
309 {"putmsg", 4, DEC, NOV, DEC, HEX, HEX, SMF}, /* 86 */
310 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
311 {"lstat", 2, DEC, NOV, STG, HEX}, /* 88 */
312 {"symlink", 2, DEC, NOV, STG, STG}, /* 89 */
313 {"readlink", 3, DEC, NOV, STG, RLK, UNS}, /* 90 */
314 {"setgroups", 2, DEC, NOV, DEC, HEX}, /* 91 */
315 {"getgroups", 2, DEC, NOV, DEC, HEX}, /* 92 */
316 {"fchmod", 2, DEC, NOV, DEC, OCT}, /* 93 */
317 {"fchown", 3, DEC, NOV, DEC, DEC, DEC}, /* 94 */
318 {"sigprocmask", 3, DEC, NOV, SPM, HEX, HEX}, /* 95 */
319 {"sigsuspend", 1, DEC, NOV, HEX}, /* 96 */
320 {"sigaltstack", 2, DEC, NOV, HEX, HEX}, /* 97 */
321 {"sigaction", 3, DEC, NOV, SIG, HEX, HEX}, /* 98 */
322 {"sigpendsys", 2, DEC, NOV, DEC, HEX}, /* 99 */
323 {"context", 2, DEC, NOV, DEC, HEX}, /* 100 */
324 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 101 */
325 {"mkdirat", 3, DEC, NOV, ATC, STG, OCT}, /* 102 */
326 {"statvfs", 2, DEC, NOV, STG, HEX}, /* 103 */
327 {"fstatvfs", 2, DEC, NOV, DEC, HEX}, /* 104 */
328 {"getloadavg", 2, DEC, NOV, HEX, DEC}, /* 105 */
329 {"nfssys", 2, DEC, NOV, DEC, HEX}, /* 106 */
330 {"waitid", 4, DEC, NOV, IDT, DEC, HEX, WOP}, /* 107 */
331 {"sigsendsys", 2, DEC, NOV, HEX, SIG}, /* 108 */
332 {"hrtsys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 109 */
333 {"utimesys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 110 */
334 {"sigresend", 3, DEC, NOV, SIG, HEX, HEX}, /* 111 */
335 {"priocntlsys", 5, DEC, NOV, DEC, HEX, DEC, PC4, PC5}, /* 112 */
336 {"pathconf", 2, DEC, NOV, STG, PTC}, /* 113 */
337 {"mincore", 3, DEC, NOV, HEX, UNS, HEX}, /* 114 */
338 {"mmap", 6, HEX, NOV, HEX, UNS, MPR, MTY, DEC, DEC}, /* 115 */
339 {"mprotect", 3, DEC, NOV, HEX, UNS, MPR}, /* 116 */
340 {"munmap", 2, DEC, NOV, HEX, UNS}, /* 117 */
341 {"fpathconf", 2, DEC, NOV, DEC, PTC}, /* 118 */
342 {"vfork", 0, DEC, NOV}, /* 119 */
343 {"fchdir", 1, DEC, NOV, DEC}, /* 120 */
344 {"readv", 3, DEC, NOV, DEC, HEX, DEC}, /* 121 */
345 {"writev", 3, DEC, NOV, DEC, HEX, DEC}, /* 122 */
346 {"preadv", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 123 */
347 {"pwritev", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 124 */
348 {"upanic", 2, DEC, NOV, HEX, DEC}, /* 125 */
349 {"getrandom", 3, DEC, NOV, IOB, UNS, GRF}, /* 126 */
350 {"mmapobj", 5, DEC, NOV, DEC, MOB, HEX, HEX, HEX}, /* 127 */
351 {"setrlimit", 2, DEC, NOV, RLM, HEX}, /* 128 */
352 {"getrlimit", 2, DEC, NOV, RLM, HEX}, /* 129 */
353 {"lchown", 3, DEC, NOV, STG, DEC, DEC}, /* 130 */
354 {"memcntl", 6, DEC, NOV, HEX, UNS, MCF, MC4, MC5, DEC}, /* 131 */
355 {"getpmsg", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 132 */
356 {"putpmsg", 5, DEC, NOV, DEC, HEX, HEX, DEC, HHX}, /* 133 */
357 {"rename", 2, DEC, NOV, STG, STG}, /* 134 */
358 {"uname", 1, DEC, NOV, HEX}, /* 135 */
359 {"setegid", 1, DEC, NOV, UNS}, /* 136 */
360 {"sysconfig", 1, DEC, NOV, CNF}, /* 137 */
361 {"adjtime", 2, DEC, NOV, HEX, HEX}, /* 138 */
362 {"sysinfo", 3, DEC, NOV, INF, RST, DEC}, /* 139 */
363 {"sharefs", 3, DEC, NOV, DEC, HEX, DEC}, /* 140 */
364 {"seteuid", 1, DEC, NOV, UNS}, /* 141 */
365 {"forksys", 2, DEC, NOV, DEC, HHX}, /* 142 */
366 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
367 {"sigtimedwait", 3, DEC, NOV, HEX, HEX, HEX}, /* 144 */
368 {"lwp_info", 1, DEC, NOV, HEX}, /* 145 */
369 {"yield", 0, DEC, NOV}, /* 146 */
370 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
371 {"lwp_sema_post", 1, DEC, NOV, HEX}, /* 148 */
372 {"lwp_sema_trywait", 1, DEC, NOV, HEX}, /* 149 */
373 {"lwp_detach", 1, DEC, NOV, DEC}, /* 150 */
374 {"corectl", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 151 */
375 {"modctl", 5, DEC, NOV, MOD, HEX, HEX, HEX, HEX}, /* 152 */
376 {"fchroot", 1, DEC, NOV, DEC}, /* 153 */
377 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
378 {"vhangup", 0, DEC, NOV}, /* 155 */
379 {"gettimeofday", 1, DEC, NOV, HEX}, /* 156 */
380 {"getitimer", 2, DEC, NOV, ITM, HEX}, /* 157 */
381 {"setitimer", 3, DEC, NOV, ITM, HEX, HEX}, /* 158 */
382 {"lwp_create", 3, DEC, NOV, HEX, LWF, HEX}, /* 159 */
383 {"lwp_exit", 0, DEC, NOV}, /* 160 */
384 {"lwp_suspend", 1, DEC, NOV, DEC}, /* 161 */
385 {"lwp_continue", 1, DEC, NOV, DEC}, /* 162 */
386 {"lwp_kill", 2, DEC, NOV, DEC, SIG}, /* 163 */
387 {"lwp_self", 0, DEC, NOV}, /* 164 */
388 {"lwp_sigmask", 5, HEX, HEX, SPM, HEX, HEX, HEX, HEX}, /* 165 */
389 {"lwp_private", 3, HEX, NOV, DEC, DEC, HEX}, /* 166 */
390 {"lwp_wait", 2, DEC, NOV, DEC, HEX}, /* 167 */
391 {"lwp_mutex_wakeup", 2, DEC, NOV, HEX, DEC}, /* 168 */
392 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
393 {"lwp_cond_wait", 4, DEC, NOV, HEX, HEX, HEX, DEC}, /* 170 */
394 {"lwp_cond_signal", 1, DEC, NOV, HEX}, /* 171 */
395 {"lwp_cond_broadcast", 1, DEC, NOV, HEX}, /* 172 */
396 {"pread", 4, DEC, NOV, DEC, IOB, UNS, DEX}, /* 173 */
397 {"pwrite", 4, DEC, NOV, DEC, IOB, UNS, DEX}, /* 174 */
398 {"llseek", 4, LLO, NOV, DEC, LLO, HID, WHN}, /* 175 */
399 {"inst_sync", 2, DEC, NOV, STG, DEC}, /* 176 */
400 {"brand", 6, DEC, NOV, DEC, HEX, HEX, HEX, HEX, HEX}, /* 177 */
401 {"kaio", 7, DEC, NOV, AIO, HEX, HEX, HEX, HEX, HEX, HEX}, /* 178 */
402 {"cpc", 5, DEC, NOV, CPC, DEC, HEX, HEX, HEX}, /* 179 */
403 {"lgrpsys", 3, DEC, NOV, DEC, DEC, HEX}, /* 180 */
404 {"rusagesys", 5, DEC, NOV, DEC, HEX, DEC, HEX, HEX}, /* 181 */
405 {"portfs", 6, HEX, HEX, DEC, HEX, HEX, HEX, HEX, HEX}, /* 182 */
406 {"pollsys", 4, DEC, NOV, HEX, DEC, HEX, HEX}, /* 183 */
407 {"labelsys", 2, DEC, NOV, DEC, HEX}, /* 184 */
408 {"acl", 4, DEC, NOV, STG, ACL, DEC, HEX}, /* 185 */
409 {"auditsys", 4, DEC, NOV, AUD, HEX, HEX, HEX}, /* 186 */
410 {"processor_bind", 4, DEC, NOV, IDT, DEC, DEC, HEX}, /* 187 */
411 {"processor_info", 2, DEC, NOV, DEC, HEX}, /* 188 */
412 {"p_online", 2, DEC, NOV, DEC, DEC}, /* 189 */
413 {"sigqueue", 5, DEC, NOV, DEC, SIG, HEX, SQC, DEC}, /* 190 */
414 {"clock_gettime", 2, DEC, NOV, DEC, HEX}, /* 191 */
415 {"clock_settime", 2, DEC, NOV, DEC, HEX}, /* 192 */
416 {"clock_getres", 2, DEC, NOV, DEC, HEX}, /* 193 */
417 {"timer_create", 3, DEC, NOV, DEC, HEX, HEX}, /* 194 */
418 {"timer_delete", 1, DEC, NOV, DEC}, /* 195 */
419 {"timer_settime", 4, DEC, NOV, DEC, DEC, HEX, HEX}, /* 196 */
420 {"timer_gettime", 2, DEC, NOV, DEC, HEX}, /* 197 */
421 {"timer_getoverrun", 1, DEC, NOV, DEC}, /* 198 */
422 {"nanosleep", 2, DEC, NOV, HEX, HEX}, /* 199 */
423 {"facl", 4, DEC, NOV, DEC, ACL, DEC, HEX}, /* 200 */
424 {"door", 6, DEC, NOV, DEC, HEX, HEX, HEX, HEX, DEC}, /* 201 */
425 {"setreuid", 2, DEC, NOV, UN1, UN1}, /* 202 */
426 {"setregid", 2, DEC, NOV, UN1, UN1}, /* 203 */
427 {"install_utrap", 3, DEC, NOV, DEC, HEX, HEX}, /* 204 */
428 {"signotify", 3, DEC, NOV, DEC, HEX, HEX}, /* 205 */
429 {"schedctl", 0, HEX, NOV}, /* 206 */
430 {"pset", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 207 */
431 {"sparc_utrap_install", 5, DEC, NOV, UTT, UTH, UTH, HEX, HEX}, /* 208 */
432 {"resolvepath", 3, DEC, NOV, STG, RLK, DEC}, /* 209 */
433 {"lwp_mutex_timedlock", 3, DEC, NOV, HEX, HEX, HEX}, /* 210 */
434 {"lwp_sema_timedwait", 3, DEC, NOV, HEX, HEX, DEC}, /* 211 */
435 {"lwp_rwlock_sys", 3, DEC, NOV, DEC, HEX, HEX}, /* 212 */
436 {"getdents64", 3, DEC, NOV, DEC, HEX, UNS}, /* 213 */
437 {"mmap64", 7, HEX, NOV, HEX, UNS, MPR, MTY, DEC, LLO, HID}, /* 214 */
438 {"stat64", 2, DEC, NOV, STG, HEX}, /* 215 */
439 {"lstat64", 2, DEC, NOV, STG, HEX}, /* 216 */
440 {"fstat64", 2, DEC, NOV, DEC, HEX}, /* 217 */
441 {"statvfs64", 2, DEC, NOV, STG, HEX}, /* 218 */
442 {"fstatvfs64", 2, DEC, NOV, DEC, HEX}, /* 219 */
443 {"setrlimit64", 2, DEC, NOV, RLM, HEX}, /* 220 */
444 {"getrlimit64", 2, DEC, NOV, RLM, HEX}, /* 221 */
445 {"pread64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 222 */
446 {"pwrite64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 223 */
447 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
448 {"open64", 3, DEC, NOV, STG, OPN, OCT}, /* 225 */
449 {"rpcmod", 3, DEC, NOV, DEC, HEX}, /* 226 */
450 {"zone", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 227 */
451 {"autofssys", 2, DEC, NOV, DEC, HEX}, /* 228 */
452 {"getcwd", 3, DEC, NOV, RST, DEC}, /* 229 */
453 {"so_socket", 5, DEC, NOV, PFM, SKT, SKP, STG, SKV}, /* 230 */
454 {"so_socketpair", 1, DEC, NOV, HEX}, /* 231 */
455 {"bind", 4, DEC, NOV, DEC, HEX, DEC, SKV}, /* 232 */
456 {"listen", 3, DEC, NOV, DEC, DEC, SKV}, /* 233 */
457 {"accept", 5, DEC, NOV, DEC, HEX, HEX, SKV, ACF}, /* 234 */
458 {"connect", 4, DEC, NOV, DEC, HEX, DEC, SKV}, /* 235 */
459 {"shutdown", 3, DEC, NOV, DEC, SHT, SKV}, /* 236 */
460 {"recv", 4, DEC, NOV, DEC, IOB, DEC, SRF}, /* 237 */
461 {"recvfrom", 6, DEC, NOV, DEC, IOB, DEC, SRF, HEX, HEX}, /* 238 */
462 {"recvmsg", 3, DEC, NOV, DEC, HEX, SRF}, /* 239 */
463 {"send", 4, DEC, NOV, DEC, IOB, DEC, SRF}, /* 240 */
464 {"sendmsg", 3, DEC, NOV, DEC, HEX, SRF}, /* 241 */
465 {"sendto", 6, DEC, NOV, DEC, IOB, DEC, SRF, HEX, DEC}, /* 242 */
466 {"getpeername", 4, DEC, NOV, DEC, HEX, HEX, SKV}, /* 243 */
467 {"getsockname", 4, DEC, NOV, DEC, HEX, HEX, SKV}, /* 244 */
468 {"getsockopt", 6, DEC, NOV, DEC, SOL, SON, HEX, HEX, SKV}, /* 245 */
469 {"setsockopt", 6, DEC, NOV, DEC, SOL, SON, HEX, DEC, SKV}, /* 246 */
470 {"sockconfig", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 247 */
471 {"ntp_gettime", 1, DEC, NOV, HEX}, /* 248 */
472 {"ntp_adjtime", 1, DEC, NOV, HEX}, /* 249 */
473 {"lwp_mutex_unlock", 1, DEC, NOV, HEX}, /* 250 */
474 {"lwp_mutex_trylock", 2, DEC, NOV, HEX, HEX}, /* 251 */
475 {"lwp_mutex_register", 2, DEC, NOV, HEX, HEX}, /* 252 */
476 {"cladm", 3, DEC, NOV, CLC, CLF, HEX}, /* 253 */
477 {"uucopy", 3, DEC, NOV, HEX, HEX, UNS}, /* 254 */
478 {"umount2", 2, DEC, NOV, STG, MTF}, /* 255 */
479 { NULL, -1, DEC, NOV},
480 };
481
482 /* SYSEND == max syscall number + 1 */
483 #define SYSEND ((sizeof (systable) / sizeof (struct systable))-1)
484
485
486 /*
487 * The following are for interpreting syscalls with sub-codes.
488 */
489
490 const struct systable faccessattable[] = {
491 {"faccessat", 4, DEC, NOV, ATC, STG, ACC, FAT}, /* 0 */
492 {"access", 3, DEC, NOV, HID, STG, ACC}, /* 1 */
493 };
494 #define NACCESSCODE (sizeof (faccessattable) / sizeof (struct systable))
495
496 const struct systable fchmodattable[] = {
497 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 0 */
498 {"chmod", 3, DEC, NOV, HID, STG, OCT}, /* 1 */
499 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 2 */
500 {"fchmod", 3, DEC, NOV, DEC, HID, OCT}, /* 3 */
501 };
502 #define NCHMODCODE (sizeof (fchmodattable) / sizeof (struct systable))
503
504 const struct systable fchownattable[] = {
505 {"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, SNF}, /* 0 */
506 {"chown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 1 */
507 {"lchown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 2 */
508 {"fchown", 4, DEC, NOV, DEC, HID, DEC, DEC}, /* 3 */
509 };
510 #define NCHOWNCODE (sizeof (fchownattable) / sizeof (struct systable))
511
512 const struct systable mkdiratattable[] = {
513 {"mkdirat", 3, DEC, NOV, ATC, STG, OCT}, /* 0 */
514 {"mkdir", 3, DEC, NOV, HID, STG, OCT}, /* 1 */
515 };
516 #define NMKDIRCODE (sizeof (mkdiratattable) / sizeof (struct systable))
517
518 const struct systable mknodatattable[] = {
519 {"mknodat", 4, DEC, NOV, ATC, STG, OCT, HEX}, /* 0 */
520 {"mknod", 4, DEC, NOV, HID, STG, OCT, HEX}, /* 1 */
521 };
522 #define NMKMODCODE (sizeof (mknodatattable) / sizeof (struct systable))
523
524 const struct systable renameattable[] = {
525 {"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 0 */
526 {"rename", 4, DEC, NOV, HID, STG, HID, STG}, /* 1 */
527 };
528 #define NRENAMECODE (sizeof (renameattable) / sizeof (struct systable))
529
530 const struct systable linkattable[] = {
531 {"linkat", 5, DEC, NOV, ATC, STG, ATC, STG, SNF}, /* 0 */
532 {"link", 4, DEC, NOV, HID, STG, HID, STG}, /* 1 */
533 };
534 #define NLINKATCODE (sizeof (linkattable) / sizeof (struct systable))
535
536 const struct systable unlinkattable[] = {
537 {"unlinkat", 3, DEC, NOV, ATC, STG, UAT}, /* 0 */
538 {"unlink", 2, DEC, NOV, HID, STG}, /* 1 */
539 {"rmdir", 2, DEC, NOV, HID, STG}, /* 2 */
540 };
541 #define NUNLINKCODE (sizeof (unlinkattable) / sizeof (struct systable))
542
543 const struct systable symlinkattable[] = {
544 {"symlinkat", 3, DEC, NOV, STG, ATC, STG}, /* 0 */
545 {"symlink", 3, DEC, NOV, STG, HID, STG}, /* 1 */
546 };
547 #define NSYMLINKCODE (sizeof (symlinkattable) / sizeof (struct systable))
548
549 const struct systable readlinkattable[] = {
550 {"readlinkat", 4, DEC, NOV, ATC, STG, RLK, UNS}, /* 0 */
551 {"readlink", 4, DEC, NOV, HID, STG, RLK, UNS}, /* 1 */
552 };
553 #define NREADLINKCODE (sizeof (readlinkattable) / sizeof (struct systable))
554
555 const struct systable fstatattable[] = {
556 {"fstatat", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 0 */
557 {"stat", 3, DEC, NOV, HID, STG, HEX}, /* 1 */
558 {"lstat", 3, DEC, NOV, HID, STG, HEX}, /* 2 */
559 {"fstat", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */
560 };
561 #define NSTATCODE (sizeof (fstatattable) / sizeof (struct systable))
562
563 const struct systable fstatat64table[] = {
564 {"fstatat64", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 0 */
565 {"stat64", 3, DEC, NOV, HID, STG, HEX}, /* 1 */
566 {"lstat64", 3, DEC, NOV, HID, STG, HEX}, /* 2 */
567 {"fstat64", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */
568 };
569 #define NSTAT64CODE (sizeof (fstatat64table) / sizeof (struct systable))
570
571 const struct systable openattable[] = {
572 {"openat", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */
573 {"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */
574 {"open", 3, DEC, NOV, HID, STG, OPN}, /* 2 */
575 {"open", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */
576 };
577 #define NOPENATCODE (sizeof (openattable) / sizeof (struct systable))
578
579 const struct systable openat64table[] = {
580 {"openat64", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */
581 {"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */
582 {"open64", 3, DEC, NOV, HID, STG, OPN}, /* 2 */
583 {"open64", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */
584 };
585 #define NOPENAT64CODE (sizeof (openat64table) / sizeof (struct systable))
586
587 const struct systable opentable[] = {
588 {"open", 2, DEC, NOV, STG, OPN}, /* 0 */
589 {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 1 */
590 };
591 #define NOPENCODE (sizeof (opentable) / sizeof (struct systable))
592
593 const struct systable open64table[] = {
594 {"open64", 2, DEC, NOV, STG, OPN}, /* 0 */
595 {"open64", 3, DEC, NOV, STG, OPN, OCT}, /* 1 */
596 };
597 #define NOPEN64CODE (sizeof (open64table) / sizeof (struct systable))
598
599 const struct systable fcntltable[] = {
600 {"fcntl", 3, DEC, NOV, DEC, FCN, HEX}, /* 0: default */
601 {"fcntl", 2, DEC, NOV, DEC, FCN}, /* 1: no arg */
602 {"fcntl", 3, DEC, NOV, DEC, FCN, FFG}, /* 2: F_SETFL */
603 {"fcntl", 3, DEC, NOV, DEC, FCN, FFD}, /* 3: F_SETFD */
604 {"fcntl", 4, DEC, NOV, DEC, FCN, DEC, FFD}, /* 4: F_DUP3FD */
605 };
606 #define NFCNTLCODE (sizeof (fcntltable) / sizeof (struct systable))
607
608 const struct systable msgtable[] = {
609 {"msgget", 3, DEC, NOV, HID, KEY, MSF}, /* 0 */
610 {"msgctl", 4, DEC, NOV, HID, DEC, MSC, HEX}, /* 1 */
611 {"msgrcv", 6, DEC, NOV, HID, DEC, HEX, UNS, DEC, MSF}, /* 2 */
612 {"msgsnd", 5, DEC, NOV, HID, DEC, HEX, UNS, MSF}, /* 3 */
613 {"msgids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 4 */
614 {"msgsnap", 5, DEC, NOV, HID, DEC, HEX, UNS, DEC}, /* 5 */
615 };
616 #define NMSGCODE (sizeof (msgtable) / sizeof (struct systable))
617
618 const struct systable semtable[] = {
619 {"semctl", 5, DEC, NOV, HID, DEC, DEC, SMC, DEX}, /* 0 */
620 {"semget", 4, DEC, NOV, HID, KEY, DEC, SEF}, /* 1 */
621 {"semop", 4, DEC, NOV, HID, DEC, HEX, UNS}, /* 2 */
622 {"semids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 3 */
623 {"semtimedop", 5, DEC, NOV, HID, DEC, HEX, UNS, HEX}, /* 4 */
624 };
625 #define NSEMCODE (sizeof (semtable) / sizeof (struct systable))
626
627 const struct systable shmtable[] = {
628 {"shmat", 4, HEX, NOV, HID, DEC, DEX, SHF}, /* 0 */
629 {"shmctl", 4, DEC, NOV, HID, DEC, SHC, DEX}, /* 1 */
630 {"shmdt", 2, DEC, NOV, HID, HEX}, /* 2 */
631 {"shmget", 4, DEC, NOV, HID, KEY, UNS, SHF}, /* 3 */
632 {"shmids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 4 */
633 };
634 #define NSHMCODE (sizeof (shmtable) / sizeof (struct systable))
635
636 const struct systable pidtable[] = {
637 {"getpgrp", 1, DEC, NOV, HID}, /* 0 */
638 {"setpgrp", 1, DEC, NOV, HID}, /* 1 */
639 {"getsid", 2, DEC, NOV, HID, DEC}, /* 2 */
640 {"setsid", 1, DEC, NOV, HID}, /* 3 */
641 {"getpgid", 2, DEC, NOV, HID, DEC}, /* 4 */
642 {"setpgid", 3, DEC, NOV, HID, DEC, DEC}, /* 5 */
643 };
644 #define NPIDCODE (sizeof (pidtable) / sizeof (struct systable))
645
646 const struct systable sfstable[] = {
647 {"sysfs", 3, DEC, NOV, SFS, DEX, DEX}, /* 0 */
648 {"sysfs", 2, DEC, NOV, SFS, STG}, /* 1 */
649 {"sysfs", 3, DEC, NOV, SFS, DEC, RST}, /* 2 */
650 {"sysfs", 1, DEC, NOV, SFS}, /* 3 */
651 };
652 #define NSFSCODE (sizeof (sfstable) / sizeof (struct systable))
653
654 const struct systable utstable[] = {
655 {"utssys", 3, DEC, NOV, HEX, DEC, UTS}, /* 0 */
656 {"utssys", 4, DEC, NOV, HEX, HEX, HEX, HEX}, /* err */
657 {"utssys", 3, DEC, NOV, HEX, HHX, UTS}, /* 2 */
658 {"utssys", 4, DEC, NOV, STG, FUI, UTS, HEX} /* 3 */
659 };
660 #define NUTSCODE (sizeof (utstable) / sizeof (struct systable))
661
662 const struct systable rctltable[] = {
663 {"getrctl", 6, DEC, NOV, HID, STG, HEX, HEX, HID, RGF}, /* 0 */
664 {"setrctl", 6, DEC, NOV, HID, STG, HEX, HEX, HID, RSF}, /* 1 */
665 {"rctlsys_lst", 6, DEC, NOV, HID, HID, HEX, HID, HEX, HID}, /* 2 */
666 {"rctlsys_ctl", 6, DEC, NOV, HID, STG, HEX, HID, HID, RCF}, /* 3 */
667 {"setprojrctl", 6, DEC, NOV, HID, STG, HID, HEX, HEX, SPF}, /* 4 */
668 };
669 #define NRCTLCODE (sizeof (rctltable) / sizeof (struct systable))
670
671 const struct systable sgptable[] = {
672 {"sigpendsys", 2, DEC, NOV, DEC, HEX}, /* err */
673 {"sigpending", 2, DEC, NOV, HID, HEX}, /* 1 */
674 {"sigfillset", 2, DEC, NOV, HID, HEX}, /* 2 */
675 };
676 #define NSGPCODE (sizeof (sgptable) / sizeof (struct systable))
677
678 const struct systable ctxtable[] = {
679 {"getcontext", 2, DEC, NOV, HID, HEX}, /* 0 */
680 {"setcontext", 2, DEC, NOV, HID, HEX}, /* 1 */
681 {"getustack", 2, DEC, NOV, HID, HEX}, /* 2 */
682 {"setustack", 2, DEC, NOV, HID, HEX}, /* 3 */
683 {"getcontext_extd", 2, DEC, NOV, HID, HEX}, /* 4 */
684 };
685 #define NCTXCODE (sizeof (ctxtable) / sizeof (struct systable))
686
687 const struct systable hrttable[] = {
688 {"hrtcntl", 5, DEC, NOV, HID, DEC, DEC, HEX, HEX}, /* 0 */
689 {"hrtalarm", 3, DEC, NOV, HID, HEX, DEC}, /* 1 */
690 {"hrtsleep", 2, DEC, NOV, HID, HEX}, /* 2 */
691 {"hrtcancel", 3, DEC, NOV, HID, HEX, DEC}, /* 3 */
692 };
693 #define NHRTCODE (sizeof (hrttable) / sizeof (struct systable))
694
695 const struct systable cortable[] = {
696 {"corectl", 4, DEC, NOV, COR, HEX, HEX, HEX}, /* 0 */
697 {"corectl", 2, DEC, NOV, COR, CCO}, /* 1 */
698 {"corectl", 1, HHX, NOV, COR}, /* 2 */
699 {"corectl", 3, DEC, NOV, COR, STG, DEC}, /* 3 */
700 {"corectl", 3, DEC, NOV, COR, RST, DEC}, /* 4 */
701 {"corectl", 4, DEC, NOV, COR, STG, DEC, DEC}, /* 5 */
702 {"corectl", 4, DEC, NOV, COR, RST, DEC, DEC}, /* 6 */
703 {"corectl", 2, DEC, NOV, COR, CCC}, /* 7 */
704 {"corectl", 2, DEC, NOV, COR, RCC}, /* 8 */
705 {"corectl", 3, DEC, NOV, COR, CCC, DEC}, /* 9 */
706 {"corectl", 3, DEC, NOV, COR, RCC, DEC}, /* 10 */
707 {"corectl", 3, DEC, NOV, COR, STG, DEC}, /* 11 */
708 {"corectl", 3, DEC, NOV, COR, RST, DEC}, /* 12 */
709 {"corectl", 2, DEC, NOV, COR, CCC}, /* 13 */
710 {"corectl", 2, DEC, NOV, COR, RCC}, /* 14 */
711 };
712 #define NCORCODE (sizeof (cortable) / sizeof (struct systable))
713
714 const struct systable aiotable[] = {
715 {"kaio", 7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 0 */
716 {"kaio", 7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 1 */
717 {"kaio", 3, DEC, NOV, AIO, HEX, DEC}, /* 2 */
718 {"kaio", 3, DEC, NOV, AIO, DEC, HEX}, /* 3 */
719 {"kaio", 1, DEC, NOV, AIO}, /* 4 */
720 {"kaio", 1, DEC, NOV, AIO}, /* 5 */
721 {"kaio", 1, DEC, NOV, AIO}, /* 6 */
722 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 7 */
723 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, DEC}, /* 8 */
724 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 9 */
725 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 10 */
726 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 11 */
727 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 12 */
728 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 13 */
729 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, DEC}, /* 14 */
730 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 15 */
731 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 16 */
732 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 17 */
733 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 18 */
734 {"kaio", 3, DEC, NOV, AIO, DEC, HEX}, /* 19 */
735 {"kaio", 1, DEC, NOV, AIO}, /* 20 */
736 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, HEX}, /* 21 */
737 };
738 #define NAIOCODE (sizeof (aiotable) / sizeof (struct systable))
739
740 const struct systable doortable[] = {
741 {"door_create", 3, DEC, NOV, HEX, HEX, DFL}, /* 0 */
742 {"door_revoke", 1, DEC, NOV, DEC}, /* 1 */
743 {"door_info", 2, DEC, NOV, DEC, HEX}, /* 2 */
744 {"door_call", 2, DEC, NOV, DEC, HEX}, /* 3 */
745 {"door_return", 4, DEC, NOV, HEX, DEC, HEX, DEC}, /* 4 (old) */
746 {"door_cred", 1, DEC, NOV, HEX}, /* 5 (old) */
747 {"door_bind", 1, DEC, NOV, DEC}, /* 6 */
748 {"door_unbind", 0, DEC, NOV}, /* 7 */
749 {"door_unref", 0, DEC, NOV}, /* 8 */
750 {"door_ucred", 1, DEC, NOV, HEX}, /* 9 */
751 {"door_return", 5, DEC, NOV, HEX, DEC, HEX, HEX, DEC}, /* 10 */
752 {"door_getparam", 3, DEC, NOV, DEC, DPM, HEX}, /* 11 */
753 {"door_setparam", 3, DEC, NOV, DEC, DPM, DEC}, /* 12 */
754 };
755 #define NDOORCODE (sizeof (doortable) / sizeof (struct systable))
756
757 const struct systable psettable[] = {
758 {"pset_create", 2, DEC, NOV, HID, HEX}, /* 0 */
759 {"pset_destroy", 2, DEC, NOV, HID, PST}, /* 1 */
760 {"pset_assign", 4, DEC, NOV, HID, PST, DEC, HEX}, /* 2 */
761 {"pset_info", 5, DEC, NOV, HID, PST, HEX, HEX, HEX}, /* 3 */
762 {"pset_bind", 5, DEC, NOV, HID, PST, IDT, DEC, HEX}, /* 4 */
763 {"pset_getloadavg", 4, DEC, NOV, HID, PST, HEX, DEC}, /* 5 */
764 {"pset_list", 3, DEC, NOV, HID, HEX, HEX}, /* 6 */
765 {"pset_setattr", 3, DEC, NOV, HID, PST, HEX}, /* 7 */
766 {"pset_getattr", 3, DEC, NOV, HID, PST, HEX}, /* 8 */
767 {"pset_assign_forced", 4, DEC, NOV, HID, PST, DEC, HEX}, /* 9 */
768 };
769 #define NPSETCODE (sizeof (psettable) / sizeof (struct systable))
770
771 const struct systable lwpcreatetable[] = {
772 {"lwp_create", 3, DEC, NOV, HEX, LWF, HEX}, /* 0 */
773 {"lwp_create", 0, DEC, NOV}, /* 1 */
774 };
775 #define NLWPCREATECODE (sizeof (lwpcreatetable) / sizeof (struct systable))
776
777 static const struct systable tasksystable[] = {
778 {"settaskid", 3, DEC, NOV, HID, DEC, HEX}, /* 0 */
779 {"gettaskid", 1, DEC, NOV, HID}, /* 1 */
780 {"getprojid", 1, DEC, NOV, HID}, /* 2 */
781 };
782 #define NTASKSYSCODE (sizeof (tasksystable) / sizeof (struct systable))
783
784 static const struct systable privsystable[] = {
785 {"setppriv", 4, DEC, NOV, HID, PRO, PRN, PRS}, /* 0 */
786 {"getppriv", 4, DEC, NOV, HID, HID, PRN, PRS}, /* 1 */
787 {"getprivimplinfo", 5, DEC, NOV, HID, HID, HID, HEX, DEC}, /* 2 */
788 {"setpflags", 3, DEC, NOV, HID, PFL, DEC}, /* 3 */
789 {"getpflags", 2, DEC, NOV, HID, PFL}, /* 4 */
790 {"issetugid", 0, DEC, NOV, HID}, /* 5 */
791 };
792 #define NPRIVSYSCODE (sizeof (privsystable) / sizeof (struct systable))
793
794 static const struct systable exacctsystable[] = {
795 {"getacct", 5, DEC, NOV, HID, IDT, DEC, HEX, UNS}, /* 0 */
796 {"putacct", 6, DEC, NOV, HID, IDT, DEC, HEX, UNS, HEX}, /* 1 */
797 {"wracct", 4, DEC, NOV, HID, IDT, DEC, HEX}, /* 2 */
798 };
799 #define NEXACCTSYSCODE (sizeof (exacctsystable) / sizeof (struct systable))
800
801 static const struct systable lwpparktable[] = {
802 {"lwp_park", 3, DEC, NOV, HID, HEX, DEC}, /* 0 */
803 {"lwp_unpark", 2, DEC, NOV, HID, DEC}, /* 1 */
804 {"lwp_unpark_all", 3, DEC, NOV, HID, HEX, DEC}, /* 2 */
805 {"lwp_unpark_cancel", 2, DEC, NOV, HID, DEC}, /* 3 */
806 {"lwp_set_park", 3, DEC, NOV, HID, HEX, DEC}, /* 4 */
807 };
808 #define NLWPPARKCODE (sizeof (lwpparktable) / sizeof (struct systable))
809
810 static const struct systable lwprwlocktable[] = {
811 {"lwp_rwlock_rdlock", 3, DEC, NOV, HID, HEX, HEX}, /* 0 */
812 {"lwp_rwlock_wrlock", 3, DEC, NOV, HID, HEX, HEX}, /* 1 */
813 {"lwp_rwlock_tryrdlock", 2, DEC, NOV, HID, HEX}, /* 2 */
814 {"lwp_rwlock_trywrlock", 2, DEC, NOV, HID, HEX}, /* 3 */
815 {"lwp_rwlock_unlock", 2, DEC, NOV, HID, HEX}, /* 4 */
816 };
817 #define NLWPRWLOCKCODE (sizeof (lwprwlocktable) / sizeof (struct systable))
818
819 static const struct systable sendfilevsystable[] = {
820 {"sendfilev", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 0 */
821 {"sendfilev64", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 1 */
822 };
823 #define NSENDFILESYSCODE \
824 (sizeof (sendfilevsystable) / sizeof (struct systable))
825
826 static const struct systable lgrpsystable[] = {
827 {"meminfo", 3, DEC, NOV, HID, NOV, MIF}, /* 0 */
828 {"_lgrpsys", 3, DEC, NOV, DEC, DEC, NOV}, /* 1 */
829 {"lgrp_version", 3, DEC, NOV, HID, DEC, NOV}, /* 2 */
830 {"_lgrpsys", 3, DEC, NOV, DEC, HEX, HEX}, /* 3 */
831 {"lgrp_affinity_get", 3, DEC, NOV, HID, NOV, LAF}, /* 4 */
832 {"lgrp_affinity_set", 3, DEC, NOV, HID, NOV, LAF}, /* 5 */
833 {"lgrp_latency", 3, DEC, NOV, HID, DEC, DEC}, /* 6 */
834 };
835 #define NLGRPSYSCODE (sizeof (lgrpsystable) / sizeof (struct systable))
836
837 static const struct systable rusagesystable[] = {
838 {"getrusage", 2, DEC, NOV, HID, HEX}, /* 0 */
839 {"getrusage_chld", 2, DEC, NOV, HID, HEX}, /* 1 */
840 {"getrusage_lwp", 2, DEC, NOV, HID, HEX}, /* 2 */
841 {"getvmusage", 5, DEC, NOV, HID, HEX, DEC, HEX, HEX}, /* 3 */
842 };
843 #define NRUSAGESYSCODE \
844 (sizeof (rusagesystable) / sizeof (struct systable))
845
846 static const struct systable ucredsystable[] = {
847 {"ucred_get", 3, DEC, NOV, HID, DEC, HEX},
848 {"getpeerucred", 3, DEC, NOV, HID, DEC, HEX},
849 };
850 #define NUCREDSYSCODE \
851 (sizeof (ucredsystable) / sizeof (struct systable))
852
853 const struct systable portfstable[] = {
854 {"port_create", 2, DEC, NOV, HID, DEC}, /* 0 */
855 {"port_associate", 6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX}, /* 1 */
856 {"port_dissociate", 4, DEC, NOV, HID, DEC, DEC, HEX}, /* 2 */
857 {"port_send", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 3 */
858 {"port_sendn", 6, DEC, DEC, HID, HEX, HEX, DEC, HEX, HEX}, /* 4 */
859 {"port_get", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 5 */
860 {"port_getn", 6, DEC, DEC, HID, DEC, HEX, DEC, DEC, HEX}, /* 6 */
861 {"port_alert", 5, DEC, NOV, HID, DEC, HEX, HEX, HEX}, /* 7 */
862 {"port_dispatch", 6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX}, /* 8 */
863 };
864 #define NPORTCODE (sizeof (portfstable) / sizeof (struct systable))
865
866 static const struct systable zonetable[] = {
867 {"zone_create", 2, DEC, NOV, HID, HEX}, /* 0 */
868 {"zone_destroy", 2, DEC, NOV, HID, DEC}, /* 1 */
869 {"zone_getattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC}, /* 2 */
870 {"zone_enter", 2, DEC, NOV, HID, DEC}, /* 3 */
871 {"zone_list", 3, DEC, NOV, HID, HEX, HEX}, /* 4 */
872 {"zone_shutdown", 2, DEC, NOV, HID, DEC}, /* 5 */
873 {"zone_lookup", 2, DEC, NOV, HID, STG}, /* 6 */
874 {"zone_boot", 2, DEC, NOV, HID, DEC}, /* 7 */
875 {"zone_version", 2, HEX, NOV, HID, DEC}, /* 8 */
876 {"zone_setattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC}, /* 9 */
877 {"zone_add_datalink", 3, DEC, NOV, HID, DEC, STG}, /* 10 */
878 {"zone_remove_datalink", 3, DEC, NOV, HID, DEC, STG}, /* 11 */
879 {"zone_check_datalink", 3, DEC, NOV, HID, HEX, STG}, /* 12 */
880 {"zone_list_datalink", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 13 */
881 };
882 #define NZONECODE (sizeof (zonetable) / sizeof (struct systable))
883
884 static const struct systable labeltable[] = {
885 {"labelsys", 3, DEC, NOV, HID, HEX, HEX}, /* 0 */
886 {"is_system_labeled", 1, DEC, NOV, HID}, /* 1 */
887 {"tnrh", 3, DEC, NOV, HID, TND, HEX}, /* 2 */
888 {"tnrhtp", 3, DEC, NOV, HID, TND, HEX}, /* 3 */
889 {"tnmlp", 3, DEC, NOV, HID, TND, HEX}, /* 4 */
890 {"getlabel", 3, DEC, NOV, HID, STG, HEX}, /* 5 */
891 {"fgetlabel", 3, DEC, NOV, HID, DEC, HEX}, /* 6 */
892 };
893 #define NLABELCODE (sizeof (labeltable) / sizeof (struct systable))
894
895 const struct systable forktable[] = {
896 /* parent codes */
897 {"forkx", 2, DEC, NOV, HID, FXF}, /* 0 */
898 {"forkallx", 2, DEC, NOV, HID, FXF}, /* 1 */
899 {"vforkx", 2, DEC, NOV, HID, FXF}, /* 2 */
900 /* child codes */
901 {"forkx", 0, DEC, NOV}, /* 3 */
902 {"forkallx", 0, DEC, NOV}, /* 4 */
903 {"vforkx", 0, DEC, NOV}, /* 5 */
904 };
905 #define NFORKCODE (sizeof (forktable) / sizeof (struct systable))
906
907 const struct systable sidsystable[] = {
908 {"allocids", 4, UNS, UNS, HID, DEC, DEC, DEC}, /* 0 */
909 {"idmap_reg", 2, DEC, NOV, HID, DEC}, /* 1 */
910 {"idmap_unreg", 2, DEC, NOV, HID, DEC}, /* 2 */
911 };
912 #define NSIDSYSCODE (sizeof (sidsystable) / sizeof (struct systable))
913
914 const struct systable utimesystable[] = {
915 {"futimens", 3, DEC, NOV, HID, DEC, HEX}, /* 0 */
916 {"utimensat", 5, DEC, NOV, HID, ATC, STG, HEX, SNF}, /* 1 */
917 };
918 #define NUTIMESYSCODE (sizeof (utimesystable) / sizeof (struct systable))
919
920 const struct systable sockconfigtable[] = {
921 {"sockconfig", 5, DEC, NOV, SKC, DEC, DEC, DEC, STG}, /* 0 */
922 {"sockconfig", 4, DEC, NOV, SKC, DEC, DEC, DEC}, /* 1 */
923 {"sockconfig", 3, DEC, NOV, SKC, STG, HEX }, /* 2 */
924 {"sockconfig", 2, DEC, NOV, SKC, STG }, /* 3 */
925 };
926 #define NSOCKCONFIGCODE (sizeof (sockconfigtable) / sizeof (struct systable))
927
928 const struct sysalias sysalias[] = {
929 { "exit", SYS_exit },
930 { "fork", SYS_forksys },
931 { "fork1", SYS_forksys },
932 { "forkall", SYS_forksys },
933 { "forkx", SYS_forksys },
934 { "forkallx", SYS_forksys },
935 { "vforkx", SYS_forksys },
936 { "sbrk", SYS_brk },
937 { "getppid", SYS_getpid },
938 { "geteuid", SYS_getuid },
939 { "getpgrp", SYS_pgrpsys },
940 { "setpgrp", SYS_pgrpsys },
941 { "getsid", SYS_pgrpsys },
942 { "setsid", SYS_pgrpsys },
943 { "getpgid", SYS_pgrpsys },
944 { "setpgid", SYS_pgrpsys },
945 { "getegid", SYS_getgid },
946 { "msgget", SYS_msgsys },
947 { "msgctl", SYS_msgsys },
948 { "msgctl64", SYS_msgsys },
949 { "msgrcv", SYS_msgsys },
950 { "msgsnd", SYS_msgsys },
951 { "msgids", SYS_msgsys },
952 { "msgsnap", SYS_msgsys },
953 { "msgop", SYS_msgsys },
954 { "shmat", SYS_shmsys },
955 { "shmctl", SYS_shmsys },
956 { "shmctl64", SYS_shmsys },
957 { "shmdt", SYS_shmsys },
958 { "shmget", SYS_shmsys },
959 { "shmids", SYS_shmsys },
960 { "shmop", SYS_shmsys },
961 { "semctl", SYS_semsys },
962 { "semctl64", SYS_semsys },
963 { "semget", SYS_semsys },
964 { "semids", SYS_semsys },
965 { "semop", SYS_semsys },
966 { "semtimedop", SYS_semsys },
967 { "uname", SYS_utssys },
968 { "ustat", SYS_utssys },
969 { "fusers", SYS_utssys },
970 { "exec", SYS_execve },
971 { "execl", SYS_execve },
972 { "execv", SYS_execve },
973 { "execle", SYS_execve },
974 { "execlp", SYS_execve },
975 { "execve", SYS_execve },
976 { "execvp", SYS_execve },
977 { "fexecve", SYS_execve },
978 { "sigfillset", SYS_sigpending },
979 { "getcontext", SYS_context },
980 { "setcontext", SYS_context },
981 { "getustack", SYS_context },
982 { "setustack", SYS_context },
983 { "hrtcntl", SYS_hrtsys },
984 { "hrtalarm", SYS_hrtsys },
985 { "hrtsleep", SYS_hrtsys },
986 { "hrtcancel", SYS_hrtsys },
987 { "aioread", SYS_kaio },
988 { "aiowrite", SYS_kaio },
989 { "aiowait", SYS_kaio },
990 { "aiocancel", SYS_kaio },
991 { "aionotify", SYS_kaio },
992 { "audit", SYS_auditsys },
993 { "door_create", SYS_door },
994 { "door_revoke", SYS_door },
995 { "door_info", SYS_door },
996 { "door_call", SYS_door },
997 { "door_return", SYS_door },
998 { "door_bind", SYS_door },
999 { "door_unbind", SYS_door },
1000 { "door_unref", SYS_door },
1001 { "door_ucred", SYS_door },
1002 { "door_getparam", SYS_door },
1003 { "door_setparam", SYS_door },
1004 { "pset_create", SYS_pset },
1005 { "pset_destroy", SYS_pset },
1006 { "pset_assign", SYS_pset },
1007 { "pset_info", SYS_pset },
1008 { "pset_bind", SYS_pset },
1009 { "pset_getloadavg", SYS_pset },
1010 { "pset_list", SYS_pset },
1011 { "pset_setattr", SYS_pset },
1012 { "pset_getattr", SYS_pset },
1013 { "pset_assign_forced", SYS_pset },
1014 { "settaskid", SYS_tasksys },
1015 { "gettaskid", SYS_tasksys },
1016 { "getprojid", SYS_tasksys },
1017 { "setppriv", SYS_privsys },
1018 { "getppriv", SYS_privsys },
1019 { "getprivimplinfo", SYS_privsys },
1020 { "setpflags", SYS_privsys },
1021 { "getpflags", SYS_privsys },
1022 { "getacct", SYS_exacctsys },
1023 { "putacct", SYS_exacctsys },
1024 { "wracct", SYS_exacctsys },
1025 { "lwp_cond_timedwait", SYS_lwp_cond_wait },
1026 { "lwp_sema_wait", SYS_lwp_sema_timedwait },
1027 { "lwp_park", SYS_lwp_park },
1028 { "lwp_unpark", SYS_lwp_park },
1029 { "lwp_unpark_all", SYS_lwp_park },
1030 { "lwp_rwlock_rdlock", SYS_lwp_rwlock_sys },
1031 { "lwp_rwlock_wrlock", SYS_lwp_rwlock_sys },
1032 { "lwp_rwlock_tryrdlock", SYS_lwp_rwlock_sys },
1033 { "lwp_rwlock_trywrlock", SYS_lwp_rwlock_sys },
1034 { "lwp_rwlock_unlock", SYS_lwp_rwlock_sys },
1035 { "lwp_mutex_lock", SYS_lwp_mutex_timedlock },
1036 { "sendfilev64", SYS_sendfilev },
1037 { "creat", SYS_open },
1038 { "creat64", SYS_open64 },
1039 { "openattrdirat", SYS_openat },
1040 { "lgrpsys", SYS_lgrpsys },
1041 { "getrusage", SYS_rusagesys },
1042 { "getrusage_chld", SYS_rusagesys },
1043 { "getrusage_lwp", SYS_rusagesys },
1044 { "getvmusage", SYS_rusagesys },
1045 { "getpeerucred", SYS_ucredsys },
1046 { "ucred_get", SYS_ucredsys },
1047 { "port_create", SYS_port },
1048 { "port_associate", SYS_port },
1049 { "port_dissociate", SYS_port },
1050 { "port_send", SYS_port },
1051 { "port_sendn", SYS_port },
1052 { "port_get", SYS_port },
1053 { "port_getn", SYS_port },
1054 { "port_alert", SYS_port },
1055 { "port_dispatch", SYS_port },
1056 { "zone_create", SYS_zone },
1057 { "zone_destroy", SYS_zone },
1058 { "zone_getattr", SYS_zone },
1059 { "zone_setattr", SYS_zone },
1060 { "zone_enter", SYS_zone },
1061 { "getzoneid", SYS_zone },
1062 { "zone_list", SYS_zone },
1063 { "zone_shutdown", SYS_zone },
1064 { "zone_add_datalink", SYS_zone },
1065 { "zone_remove_datalink", SYS_zone },
1066 { "zone_check_datalink", SYS_zone },
1067 { "zone_list_datalink", SYS_zone },
1068 { "is_system_labeled", SYS_labelsys },
1069 { "tnrh", SYS_labelsys },
1070 { "tnrhtp", SYS_labelsys },
1071 { "tnmlp", SYS_labelsys },
1072 { "getlabel", SYS_labelsys },
1073 { "fgetlabel", SYS_labelsys },
1074 { "getrctl", SYS_rctlsys },
1075 { "setrctl", SYS_rctlsys },
1076 { "rctlsys_lst", SYS_rctlsys },
1077 { "rctlsys_ctl", SYS_rctlsys },
1078 { "allocids", SYS_sidsys },
1079 { "futimens", SYS_utimesys },
1080 { "utimensat", SYS_utimesys },
1081 { "poll", SYS_pollsys },
1082 { "umount", SYS_umount2 },
1083 { "wait", SYS_waitid },
1084 { NULL, 0 } /* end-of-list */
1085 };
1086
1087 /*
1088 * Return structure to interpret system call with sub-codes.
1089 */
1090 const struct systable *
subsys(int syscall,int subcode)1091 subsys(int syscall, int subcode)
1092 {
1093 const struct systable *stp = NULL;
1094
1095 if (subcode != -1) {
1096 switch (syscall) {
1097 case SYS_faccessat:
1098 if ((unsigned)subcode < NACCESSCODE)
1099 stp = &faccessattable[subcode];
1100 break;
1101 case SYS_fchmodat:
1102 if ((unsigned)subcode < NCHMODCODE)
1103 stp = &fchmodattable[subcode];
1104 break;
1105 case SYS_fchownat:
1106 if ((unsigned)subcode < NCHOWNCODE)
1107 stp = &fchownattable[subcode];
1108 break;
1109 case SYS_mkdirat:
1110 if ((unsigned)subcode < NMKDIRCODE)
1111 stp = &mkdiratattable[subcode];
1112 break;
1113 case SYS_mknodat:
1114 if ((unsigned)subcode < NMKMODCODE)
1115 stp = &mknodatattable[subcode];
1116 break;
1117 case SYS_renameat:
1118 if ((unsigned)subcode < NRENAMECODE)
1119 stp = &renameattable[subcode];
1120 break;
1121 case SYS_linkat:
1122 if ((unsigned)subcode < NLINKATCODE)
1123 stp = &linkattable[subcode];
1124 break;
1125 case SYS_unlinkat:
1126 if ((unsigned)subcode < NUNLINKCODE)
1127 stp = &unlinkattable[subcode];
1128 break;
1129 case SYS_symlinkat:
1130 if ((unsigned)subcode < NSYMLINKCODE)
1131 stp = &symlinkattable[subcode];
1132 break;
1133 case SYS_readlinkat:
1134 if ((unsigned)subcode < NREADLINKCODE)
1135 stp = &readlinkattable[subcode];
1136 break;
1137 case SYS_fstatat:
1138 if ((unsigned)subcode < NSTATCODE)
1139 stp = &fstatattable[subcode];
1140 break;
1141 case SYS_fstatat64:
1142 if ((unsigned)subcode < NSTAT64CODE)
1143 stp = &fstatat64table[subcode];
1144 break;
1145 case SYS_openat:
1146 if ((unsigned)subcode < NOPENATCODE)
1147 stp = &openattable[subcode];
1148 break;
1149 case SYS_openat64:
1150 if ((unsigned)subcode < NOPENAT64CODE)
1151 stp = &openat64table[subcode];
1152 break;
1153 case SYS_open:
1154 if ((unsigned)subcode < NOPENCODE)
1155 stp = &opentable[subcode];
1156 break;
1157 case SYS_open64:
1158 if ((unsigned)subcode < NOPEN64CODE)
1159 stp = &open64table[subcode];
1160 break;
1161 case SYS_msgsys: /* msgsys() */
1162 if ((unsigned)subcode < NMSGCODE)
1163 stp = &msgtable[subcode];
1164 break;
1165 case SYS_semsys: /* semsys() */
1166 if ((unsigned)subcode < NSEMCODE)
1167 stp = &semtable[subcode];
1168 break;
1169 case SYS_shmsys: /* shmsys() */
1170 if ((unsigned)subcode < NSHMCODE)
1171 stp = &shmtable[subcode];
1172 break;
1173 case SYS_pgrpsys: /* pgrpsys() */
1174 if ((unsigned)subcode < NPIDCODE)
1175 stp = &pidtable[subcode];
1176 break;
1177 case SYS_utssys: /* utssys() */
1178 if ((unsigned)subcode < NUTSCODE)
1179 stp = &utstable[subcode];
1180 break;
1181 case SYS_sysfs: /* sysfs() */
1182 if ((unsigned)subcode < NSFSCODE)
1183 stp = &sfstable[subcode];
1184 break;
1185 case SYS_sigpending: /* sigpending()/sigfillset() */
1186 if ((unsigned)subcode < NSGPCODE)
1187 stp = &sgptable[subcode];
1188 break;
1189 case SYS_context: /* [get|set]context() */
1190 if ((unsigned)subcode < NCTXCODE)
1191 stp = &ctxtable[subcode];
1192 break;
1193 case SYS_hrtsys: /* hrtsys() */
1194 if ((unsigned)subcode < NHRTCODE)
1195 stp = &hrttable[subcode];
1196 break;
1197 case SYS_corectl: /* corectl() */
1198 if ((unsigned)subcode < NCORCODE)
1199 stp = &cortable[subcode];
1200 break;
1201 case SYS_kaio: /* kaio() */
1202 if ((unsigned)subcode < NAIOCODE)
1203 stp = &aiotable[subcode];
1204 break;
1205 case SYS_door: /* doors */
1206 if ((unsigned)subcode < NDOORCODE)
1207 stp = &doortable[subcode];
1208 break;
1209 case SYS_pset: /* pset() */
1210 if ((unsigned)subcode < NPSETCODE)
1211 stp = &psettable[subcode];
1212 break;
1213 case SYS_lwp_create: /* lwp_create() */
1214 if ((unsigned)subcode < NLWPCREATECODE)
1215 stp = &lwpcreatetable[subcode];
1216 break;
1217 case SYS_tasksys: /* tasks */
1218 if ((unsigned)subcode < NTASKSYSCODE)
1219 stp = &tasksystable[subcode];
1220 break;
1221 case SYS_exacctsys: /* exacct */
1222 if ((unsigned)subcode < NEXACCTSYSCODE)
1223 stp = &exacctsystable[subcode];
1224 break;
1225 case SYS_privsys: /* privileges */
1226 if ((unsigned)subcode < NPRIVSYSCODE)
1227 stp = &privsystable[subcode];
1228 break;
1229 case SYS_lwp_park: /* lwp_park */
1230 if ((unsigned)subcode < NLWPPARKCODE)
1231 stp = &lwpparktable[subcode];
1232 break;
1233 case SYS_lwp_rwlock_sys:
1234 if ((unsigned)subcode < NLWPRWLOCKCODE)
1235 stp = &lwprwlocktable[subcode];
1236 break;
1237 case SYS_sendfilev: /* sendfilev */
1238 if ((unsigned)subcode < NSENDFILESYSCODE)
1239 stp = &sendfilevsystable[subcode];
1240 break;
1241 case SYS_lgrpsys: /* lgrpsys */
1242 if ((unsigned)subcode < NLGRPSYSCODE)
1243 stp = &lgrpsystable[subcode];
1244 break;
1245 case SYS_rusagesys: /* rusagesys */
1246 if ((unsigned)subcode < NRUSAGESYSCODE)
1247 stp = &rusagesystable[subcode];
1248 break;
1249 case SYS_fcntl: /* fcntl */
1250 if ((unsigned)subcode < NFCNTLCODE)
1251 stp = &fcntltable[subcode];
1252 break;
1253 case SYS_ucredsys:
1254 if ((unsigned)subcode < NUCREDSYSCODE)
1255 stp = &ucredsystable[subcode];
1256 break;
1257 case SYS_port: /* portfs */
1258 if ((unsigned)subcode < NPORTCODE)
1259 stp = &portfstable[subcode];
1260 break;
1261 case SYS_zone: /* zone family */
1262 if ((unsigned)subcode < NZONECODE)
1263 stp = &zonetable[subcode];
1264 break;
1265 case SYS_labelsys: /* label family */
1266 if ((unsigned)subcode < NLABELCODE)
1267 stp = &labeltable[subcode];
1268 break;
1269 case SYS_rctlsys: /* rctl family */
1270 if ((unsigned)subcode < NRCTLCODE)
1271 stp = &rctltable[subcode];
1272 break;
1273 case SYS_forksys: /* fork family */
1274 if ((unsigned)subcode < NFORKCODE)
1275 stp = &forktable[subcode];
1276 break;
1277 case SYS_sidsys: /* SID family */
1278 if ((unsigned)subcode < NSIDSYSCODE)
1279 stp = &sidsystable[subcode];
1280 break;
1281 case SYS_utimesys: /* utime family */
1282 if ((unsigned)subcode < NUTIMESYSCODE)
1283 stp = &utimesystable[subcode];
1284 break;
1285 case SYS_sockconfig: /* sockconfig family */
1286 if ((unsigned)subcode < NSOCKCONFIGCODE)
1287 stp = &sockconfigtable[subcode];
1288 break;
1289 }
1290 }
1291
1292 if (stp == NULL)
1293 stp = &systable[((unsigned)syscall < SYSEND)? syscall : 0];
1294
1295 return (stp);
1296 }
1297
1298 /*
1299 * Return the name of the system call.
1300 */
1301 const char *
sysname(private_t * pri,int syscall,int subcode)1302 sysname(private_t *pri, int syscall, int subcode)
1303 {
1304 const struct systable *stp = subsys(syscall, subcode);
1305 const char *name = stp->name; /* may be NULL */
1306
1307 if (name == NULL) { /* manufacture a name */
1308 (void) sprintf(pri->sys_name, "sys#%d", syscall);
1309 name = pri->sys_name;
1310 }
1311
1312 return (name);
1313 }
1314
1315 /*
1316 * Return the name of the signal.
1317 * Return NULL if unknown signal.
1318 */
1319 const char *
rawsigname(private_t * pri,int sig)1320 rawsigname(private_t *pri, int sig)
1321 {
1322 /*
1323 * The C library function sig2str() omits the leading "SIG".
1324 */
1325 (void) strcpy(pri->raw_sig_name, "SIG");
1326
1327 if (sig > 0 && sig2str(sig, pri->raw_sig_name+3) == 0)
1328 return (pri->raw_sig_name);
1329 return (NULL);
1330 }
1331
1332 /*
1333 * Return the name of the signal.
1334 * Manufacture a name for unknown signal.
1335 */
1336 const char *
signame(private_t * pri,int sig)1337 signame(private_t *pri, int sig)
1338 {
1339 const char *name = rawsigname(pri, sig);
1340
1341 if (name == NULL) { /* manufacture a name */
1342 (void) sprintf(pri->sig_name, "SIG#%d", sig);
1343 name = pri->sig_name;
1344 }
1345
1346 return (name);
1347 }
1348
1349 /*
1350 * Determine the subcode for this syscall, if any.
1351 */
1352 int
getsubcode(private_t * pri)1353 getsubcode(private_t *pri)
1354 {
1355 const lwpstatus_t *Lsp = pri->lwpstat;
1356 int syscall = Lsp->pr_syscall;
1357 int nsysarg = Lsp->pr_nsysarg;
1358 int subcode = -1;
1359 int arg0;
1360
1361 if (syscall > 0 && nsysarg > 0 && !prismember(&rawout, syscall)) {
1362 arg0 = Lsp->pr_sysarg[0];
1363 switch (syscall) {
1364 case SYS_utssys: /* utssys() */
1365 if (nsysarg > 2)
1366 subcode = Lsp->pr_sysarg[2];
1367 break;
1368 case SYS_faccessat:
1369 if (nsysarg > 3)
1370 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD &&
1371 Lsp->pr_sysarg[3] == 0)? 1 : 0;
1372 break;
1373 case SYS_fchmodat:
1374 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) {
1375 subcode = 3;
1376 break;
1377 }
1378 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) {
1379 subcode = 0;
1380 break;
1381 }
1382 if (nsysarg > 3)
1383 subcode = (Lsp->pr_sysarg[3] == 0)? 1 :
1384 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)?
1385 2 : 0;
1386 break;
1387 case SYS_fchownat:
1388 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) {
1389 subcode = 3;
1390 break;
1391 }
1392 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) {
1393 subcode = 0;
1394 break;
1395 }
1396 if (nsysarg > 4)
1397 subcode = (Lsp->pr_sysarg[4] == 0)? 1 :
1398 (Lsp->pr_sysarg[4] == AT_SYMLINK_NOFOLLOW)?
1399 2 : 0;
1400 break;
1401 case SYS_mkdirat:
1402 case SYS_mknodat:
1403 case SYS_readlinkat:
1404 if (nsysarg > 0)
1405 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)?
1406 1 : 0;
1407 break;
1408 case SYS_renameat:
1409 if (nsysarg > 2)
1410 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD &&
1411 (int)Lsp->pr_sysarg[2] == AT_FDCWD)? 1 : 0;
1412 break;
1413 case SYS_linkat:
1414 if (nsysarg > 4)
1415 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD &&
1416 (int)Lsp->pr_sysarg[2] == AT_FDCWD &&
1417 Lsp->pr_sysarg[4] == 0)? 1 : 0;
1418 break;
1419 case SYS_unlinkat:
1420 if (nsysarg > 2)
1421 subcode =
1422 ((int)Lsp->pr_sysarg[0] != AT_FDCWD)? 0 :
1423 (Lsp->pr_sysarg[2] == AT_REMOVEDIR)? 2 :
1424 (Lsp->pr_sysarg[2] == 0)? 1 : 0;
1425 break;
1426 case SYS_symlinkat:
1427 if (nsysarg > 1)
1428 subcode = ((int)Lsp->pr_sysarg[1] == AT_FDCWD)?
1429 1 : 0;
1430 break;
1431 case SYS_fstatat:
1432 case SYS_fstatat64:
1433 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) {
1434 subcode = 3;
1435 break;
1436 }
1437 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) {
1438 subcode = 0;
1439 break;
1440 }
1441 if (nsysarg > 3)
1442 subcode = (Lsp->pr_sysarg[3] == 0)? 1 :
1443 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)?
1444 2 : 0;
1445 break;
1446 case SYS_openat: /* openat() w/ and w/o AT_FDCWD */
1447 case SYS_openat64: /* and with and w/o O_CREAT */
1448 if (nsysarg > 2)
1449 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)?
1450 ((Lsp->pr_sysarg[2] & O_CREAT)? 3 : 2) :
1451 ((Lsp->pr_sysarg[2] & O_CREAT)? 1 : 0);
1452 break;
1453 case SYS_open: /* open() w/ and w/o O_CREAT */
1454 case SYS_open64:
1455 if (nsysarg > 1)
1456 subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0;
1457 break;
1458 case SYS_kaio: /* kaio() */
1459 subcode = arg0 & ~AIO_POLL_BIT;
1460 break;
1461 case SYS_door: /* doors */
1462 if (nsysarg > 5)
1463 subcode = Lsp->pr_sysarg[5];
1464 break;
1465 case SYS_lwp_create: /* lwp_create() */
1466 subcode = /* 0 for parent, 1 for child */
1467 (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 &&
1468 Lsp->pr_rval1 == 0);
1469 break;
1470 case SYS_forksys: /* forksys */
1471 subcode = arg0;
1472 if (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 &&
1473 pri->Rval2 != 0) /* this is the child */
1474 subcode += 3;
1475 break;
1476 case SYS_msgsys: /* msgsys() */
1477 case SYS_semsys: /* semsys() */
1478 case SYS_shmsys: /* shmsys() */
1479 case SYS_pgrpsys: /* pgrpsys() */
1480 case SYS_sysfs: /* sysfs() */
1481 case SYS_sigpending: /* sigpending()/sigfillset() */
1482 case SYS_context: /* [get|set]context() */
1483 case SYS_hrtsys: /* hrtsys() */
1484 case SYS_corectl: /* corectl() */
1485 case SYS_pset: /* pset() */
1486 case SYS_tasksys: /* tasks */
1487 case SYS_privsys: /* privileges */
1488 case SYS_exacctsys: /* exacct */
1489 case SYS_lwp_park: /* lwp_park */
1490 case SYS_lwp_rwlock_sys: /* lwp_rwlock_*() */
1491 case SYS_sendfilev: /* sendfilev */
1492 case SYS_lgrpsys: /* lgrpsys */
1493 case SYS_rusagesys: /* rusagesys */
1494 case SYS_ucredsys: /* ucredsys */
1495 case SYS_zone: /* zone */
1496 case SYS_labelsys: /* labelsys */
1497 case SYS_rctlsys: /* rctlsys */
1498 case SYS_sidsys: /* sidsys */
1499 case SYS_utimesys: /* utimesys */
1500 case SYS_sockconfig: /* sockconfig */
1501 subcode = arg0;
1502 break;
1503 case SYS_fcntl: /* fcntl() */
1504 if (nsysarg > 2) {
1505 switch (Lsp->pr_sysarg[1]) {
1506 default: subcode = 0; break;
1507 case F_GETFL:
1508 case F_GETOWN:
1509 case F_GETXFL: subcode = 1; break;
1510 case F_SETFL: subcode = 2; break;
1511 case F_SETFD: subcode = 3; break;
1512 case F_DUP3FD: subcode = 4; break;
1513 }
1514 }
1515 break;
1516 case SYS_port: /* portfs */
1517 subcode = arg0 & PORT_CODE_MASK;
1518 break;
1519 }
1520 }
1521
1522 return (subcode);
1523 }
1524
1525 /*
1526 * Return the maximum number of system calls, counting
1527 * all system calls with subcodes as separate calls.
1528 */
1529 int
maxsyscalls()1530 maxsyscalls()
1531 {
1532 return (PRMAXSYS + 1
1533 + NACCESSCODE - 1
1534 + NCHMODCODE - 1
1535 + NCHOWNCODE - 1
1536 + NMKDIRCODE - 1
1537 + NMKMODCODE - 1
1538 + NRENAMECODE - 1
1539 + NLINKATCODE - 1
1540 + NUNLINKCODE - 1
1541 + NSYMLINKCODE - 1
1542 + NREADLINKCODE - 1
1543 + NSTATCODE - 1
1544 + NSTAT64CODE - 1
1545 + NOPENATCODE - 1
1546 + NOPENAT64CODE - 1
1547 + NOPENCODE - 1
1548 + NOPEN64CODE - 1
1549 + NMSGCODE - 1
1550 + NSEMCODE - 1
1551 + NSHMCODE - 1
1552 + NPIDCODE - 1
1553 + NSFSCODE - 1
1554 + NUTSCODE - 1
1555 + NSGPCODE - 1
1556 + NCTXCODE - 1
1557 + NHRTCODE - 1
1558 + NCORCODE - 1
1559 + NAIOCODE - 1
1560 + NDOORCODE - 1
1561 + NPSETCODE - 1
1562 + NLWPCREATECODE - 1
1563 + NTASKSYSCODE - 1
1564 + NEXACCTSYSCODE - 1
1565 + NLWPPARKCODE - 1
1566 + NLWPRWLOCKCODE - 1
1567 + NSENDFILESYSCODE - 1
1568 + NLGRPSYSCODE - 1
1569 + NRUSAGESYSCODE - 1
1570 + NFCNTLCODE - 1
1571 + NPRIVSYSCODE - 1
1572 + NUCREDSYSCODE - 1
1573 + NPORTCODE - 1
1574 + NZONECODE - 1
1575 + NLABELCODE - 1
1576 + NRCTLCODE - 1
1577 + NFORKCODE - 1
1578 + NSIDSYSCODE - 1
1579 + NUTIMESYSCODE - 1
1580 + NSOCKCONFIGCODE - 1);
1581 }
1582
1583 /*
1584 * Return the number of subcodes for the specified system call number.
1585 */
1586 int
nsubcodes(int syscall)1587 nsubcodes(int syscall)
1588 {
1589 switch (syscall) {
1590 case SYS_faccessat:
1591 return (NACCESSCODE);
1592 case SYS_fchmodat:
1593 return (NCHMODCODE);
1594 case SYS_fchownat:
1595 return (NCHOWNCODE);
1596 case SYS_mkdirat:
1597 return (NMKDIRCODE);
1598 case SYS_mknodat:
1599 return (NMKMODCODE);
1600 case SYS_renameat:
1601 return (NRENAMECODE);
1602 case SYS_linkat:
1603 return (NLINKATCODE);
1604 case SYS_unlinkat:
1605 return (NUNLINKCODE);
1606 case SYS_symlinkat:
1607 return (NSYMLINKCODE);
1608 case SYS_readlinkat:
1609 return (NREADLINKCODE);
1610 case SYS_fstatat:
1611 return (NSTATCODE);
1612 case SYS_fstatat64:
1613 return (NSTAT64CODE);
1614 case SYS_openat:
1615 return (NOPENATCODE);
1616 case SYS_openat64:
1617 return (NOPENAT64CODE);
1618 case SYS_open:
1619 return (NOPENCODE);
1620 case SYS_open64:
1621 return (NOPEN64CODE);
1622 case SYS_msgsys:
1623 return (NMSGCODE);
1624 case SYS_semsys:
1625 return (NSEMCODE);
1626 case SYS_shmsys:
1627 return (NSHMCODE);
1628 case SYS_pgrpsys:
1629 return (NPIDCODE);
1630 case SYS_utssys:
1631 return (NUTSCODE);
1632 case SYS_sysfs:
1633 return (NSFSCODE);
1634 case SYS_sigpending:
1635 return (NSGPCODE);
1636 case SYS_context:
1637 return (NCTXCODE);
1638 case SYS_hrtsys:
1639 return (NHRTCODE);
1640 case SYS_corectl:
1641 return (NCORCODE);
1642 case SYS_kaio:
1643 return (NAIOCODE);
1644 case SYS_door:
1645 return (NDOORCODE);
1646 case SYS_pset:
1647 return (NPSETCODE);
1648 case SYS_lwp_create:
1649 return (NLWPCREATECODE);
1650 case SYS_tasksys:
1651 return (NTASKSYSCODE);
1652 case SYS_exacctsys:
1653 return (NEXACCTSYSCODE);
1654 case SYS_privsys:
1655 return (NPRIVSYSCODE);
1656 case SYS_lwp_park:
1657 return (NLWPPARKCODE);
1658 case SYS_lwp_rwlock_sys:
1659 return (NLWPRWLOCKCODE);
1660 case SYS_sendfilev:
1661 return (NSENDFILESYSCODE);
1662 case SYS_lgrpsys:
1663 return (NLGRPSYSCODE);
1664 case SYS_rusagesys:
1665 return (NRUSAGESYSCODE);
1666 case SYS_fcntl:
1667 return (NFCNTLCODE);
1668 case SYS_ucredsys:
1669 return (NUCREDSYSCODE);
1670 case SYS_port:
1671 return (NPORTCODE);
1672 case SYS_zone:
1673 return (NZONECODE);
1674 case SYS_labelsys:
1675 return (NLABELCODE);
1676 case SYS_rctlsys:
1677 return (NRCTLCODE);
1678 case SYS_forksys:
1679 return (NFORKCODE);
1680 case SYS_sidsys:
1681 return (NSIDSYSCODE);
1682 case SYS_utimesys:
1683 return (NUTIMESYSCODE);
1684 case SYS_sockconfig:
1685 return (NSOCKCONFIGCODE);
1686 default:
1687 return (1);
1688 }
1689 }
1690
1691
1692
1693 /* Socket address families (and protocol families) */
1694 const char * const afcodes[] = {
1695 "UNSPEC", /* 0 */
1696 "UNIX", /* 1 */
1697 "INET", /* 2 */
1698 "IMPLINK", /* 3 */
1699 "PUP", /* 4 */
1700 "CHAOS", /* 5 */
1701 "NS", /* 6 */
1702 "NBS", /* 7 */
1703 "ECMA", /* 8 */
1704 "DATAKIT", /* 9 */
1705 "CCITT", /* 10 */
1706 "SNA", /* 11 */
1707 "DECnet", /* 12 */
1708 "DLI", /* 13 */
1709 "LAT", /* 14 */
1710 "HYLINK", /* 15 */
1711 "APPLETALK", /* 16 */
1712 "NIT", /* 17 */
1713 "802", /* 18 */
1714 "OSI", /* 19 */
1715 "X25", /* 20 */
1716 "OSINET", /* 21 */
1717 "GOSIP", /* 22 */
1718 "IPX", /* 23 */
1719 "ROUTE", /* 24 */
1720 "LINK", /* 25 */
1721 "INET6", /* 26 */
1722 "KEY", /* 27 */
1723 "NCA", /* 28 */
1724 "POLICY", /* 29 */
1725 "RDS", /* 30 */
1726 "TRILL", /* 31 */
1727 "PACKET" /* 32 */
1728 };
1729 #if MAX_AFCODES != 33
1730 #error Need to update address-family table
1731 #endif
1732
1733
1734 const char * const socktype_codes[] = { /* cf socket.h */
1735 NULL,
1736 "SOCK_DGRAM", /* 1 */
1737 "SOCK_STREAM", /* 2 */
1738 NULL,
1739 "SOCK_RAW", /* 4 */
1740 "SOCK_RDM", /* 5 */
1741 "SOCK_SEQPACKET" /* 6 */
1742 };
1743 #if MAX_SOCKTYPES != 7
1744 #error Need to update socket-type table
1745 #endif
1746