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