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