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