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