xref: /titanic_52/usr/src/cmd/truss/systable.c (revision 96a62ada8aa6cb19b04270da282e7e21ba74b808)
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 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved  	*/
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <fcntl.h>
33 #include <unistd.h>
34 #include <string.h>
35 #include <signal.h>
36 #include <sys/types.h>
37 #include <libproc.h>
38 #include <sys/aio.h>
39 #include <sys/port_impl.h>
40 #include "ramdata.h"
41 #include "systable.h"
42 #include "print.h"
43 #include "proto.h"
44 
45 /*
46  * Tables of information about system calls - read-only data.
47  */
48 
49 const	char *const	errcode[] = {	/* error code names */
50 	NULL,		/*  0 */
51 	"EPERM",	/*  1 */
52 	"ENOENT",	/*  2 */
53 	"ESRCH",	/*  3 */
54 	"EINTR",	/*  4 */
55 	"EIO",		/*  5 */
56 	"ENXIO",	/*  6 */
57 	"E2BIG",	/*  7 */
58 	"ENOEXEC",	/*  8 */
59 	"EBADF",	/*  9 */
60 	"ECHILD",	/* 10 */
61 	"EAGAIN",	/* 11 */
62 	"ENOMEM",	/* 12 */
63 	"EACCES",	/* 13 */
64 	"EFAULT",	/* 14 */
65 	"ENOTBLK",	/* 15 */
66 	"EBUSY",	/* 16 */
67 	"EEXIST",	/* 17 */
68 	"EXDEV",	/* 18 */
69 	"ENODEV",	/* 19 */
70 	"ENOTDIR",	/* 20 */
71 	"EISDIR",	/* 21 */
72 	"EINVAL",	/* 22 */
73 	"ENFILE",	/* 23 */
74 	"EMFILE",	/* 24 */
75 	"ENOTTY",	/* 25 */
76 	"ETXTBSY",	/* 26 */
77 	"EFBIG",	/* 27 */
78 	"ENOSPC",	/* 28 */
79 	"ESPIPE",	/* 29 */
80 	"EROFS",	/* 30 */
81 	"EMLINK",	/* 31 */
82 	"EPIPE",	/* 32 */
83 	"EDOM",		/* 33 */
84 	"ERANGE",	/* 34 */
85 	"ENOMSG",	/* 35 */
86 	"EIDRM",	/* 36 */
87 	"ECHRNG",	/* 37 */
88 	"EL2NSYNC",	/* 38 */
89 	"EL3HLT",	/* 39 */
90 	"EL3RST",	/* 40 */
91 	"ELNRNG",	/* 41 */
92 	"EUNATCH",	/* 42 */
93 	"ENOCSI",	/* 43 */
94 	"EL2HLT",	/* 44 */
95 	"EDEADLK",	/* 45 */
96 	"ENOLCK",	/* 46 */
97 	"ECANCELED",	/* 47 */
98 	"ENOTSUP",	/* 48 */
99 	"EDQUOT",	/* 49 */
100 	"EBADE",	/* 50 */
101 	"EBADR",	/* 51 */
102 	"EXFULL",	/* 52 */
103 	"ENOANO",	/* 53 */
104 	"EBADRQC",	/* 54 */
105 	"EBADSLT",	/* 55 */
106 	"EDEADLOCK",	/* 56 */
107 	"EBFONT",	/* 57 */
108 	"EOWNERDEAD",	/* 58 */
109 	"ENOTRECOVERABLE",	/* 59 */
110 	"ENOSTR",	/* 60 */
111 	"ENODATA",	/* 61 */
112 	"ETIME",	/* 62 */
113 	"ENOSR",	/* 63 */
114 	"ENONET",	/* 64 */
115 	"ENOPKG",	/* 65 */
116 	"EREMOTE",	/* 66 */
117 	"ENOLINK",	/* 67 */
118 	"EADV",		/* 68 */
119 	"ESRMNT",	/* 69 */
120 	"ECOMM",	/* 70 */
121 	"EPROTO",	/* 71 */
122 	"ELOCKUNMAPPED",	/* 72 */
123 	"ENOTACTIVE",	/* 73 */
124 	"EMULTIHOP",	/* 74 */
125 	NULL,		/* 75 */
126 	NULL,		/* 76 */
127 	"EBADMSG",	/* 77 */
128 	"ENAMETOOLONG",	/* 78 */
129 	"EOVERFLOW",	/* 79 */
130 	"ENOTUNIQ",	/* 80 */
131 	"EBADFD",	/* 81 */
132 	"EREMCHG",	/* 82 */
133 	"ELIBACC",	/* 83 */
134 	"ELIBBAD",	/* 84 */
135 	"ELIBSCN",	/* 85 */
136 	"ELIBMAX",	/* 86 */
137 	"ELIBEXEC",	/* 87 */
138 	"EILSEQ",	/* 88 */
139 	"ENOSYS",	/* 89 */
140 	"ELOOP",	/* 90 */
141 	"ERESTART",	/* 91 */
142 	"ESTRPIPE",	/* 92 */
143 	"ENOTEMPTY",	/* 93 */
144 	"EUSERS",	/* 94 */
145 	"ENOTSOCK",	/* 95 */
146 	"EDESTADDRREQ",	/* 96 */
147 	"EMSGSIZE",	/* 97 */
148 	"EPROTOTYPE",	/* 98 */
149 	"ENOPROTOOPT",	/* 99 */
150 	NULL,		/* 100 */
151 	NULL,		/* 101 */
152 	NULL,		/* 102 */
153 	NULL,		/* 103 */
154 	NULL,		/* 104 */
155 	NULL,		/* 105 */
156 	NULL,		/* 106 */
157 	NULL,		/* 107 */
158 	NULL,		/* 108 */
159 	NULL,		/* 109 */
160 	NULL,		/* 110 */
161 	NULL,		/* 111 */
162 	NULL,		/* 112 */
163 	NULL,		/* 113 */
164 	NULL,		/* 114 */
165 	NULL,		/* 115 */
166 	NULL,		/* 116 */
167 	NULL,		/* 117 */
168 	NULL,		/* 118 */
169 	NULL,		/* 119 */
170 	"EPROTONOSUPPORT",	/* 120 */
171 	"ESOCKTNOSUPPORT",	/* 121 */
172 	"EOPNOTSUPP",	/* 122 */
173 	"EPFNOSUPPORT",	/* 123 */
174 	"EAFNOSUPPORT",	/* 124 */
175 	"EADDRINUSE",	/* 125 */
176 	"EADDRNOTAVAIL", /* 126 */
177 	"ENETDOWN",	/* 127 */
178 	"ENETUNREACH",	/* 128 */
179 	"ENETRESET",	/* 129 */
180 	"ECONNABORTED",	/* 130 */
181 	"ECONNRESET",	/* 131 */
182 	"ENOBUFS",	/* 132 */
183 	"EISCONN",	/* 133 */
184 	"ENOTCONN",	/* 134 */
185 	NULL,		/* 135 */
186 	NULL,		/* 136 */
187 	NULL,		/* 137 */
188 	NULL,		/* 138 */
189 	NULL,		/* 139 */
190 	NULL,		/* 140 */
191 	NULL,		/* 141 */
192 	NULL,		/* 142 */
193 	"ESHUTDOWN",	/* 143 */
194 	"ETOOMANYREFS",	/* 144 */
195 	"ETIMEDOUT",	/* 145 */
196 	"ECONNREFUSED",	/* 146 */
197 	"EHOSTDOWN",	/* 147 */
198 	"EHOSTUNREACH",	/* 148 */
199 	"EALREADY",	/* 149 */
200 	"EINPROGRESS",	/* 150 */
201 	"ESTALE"	/* 151 */
202 };
203 
204 #define	NERRCODE	(sizeof (errcode) / sizeof (char *))
205 
206 
207 const char *
208 errname(int err)	/* return the error code name (NULL if none) */
209 {
210 	const char *ename = NULL;
211 
212 	if (err >= 0 && err < NERRCODE)
213 		ename = errcode[err];
214 
215 	return (ename);
216 }
217 
218 
219 const struct systable systable[] = {
220 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
221 {"_exit",	1, DEC, NOV, DEC},				/*   1 */
222 {"forkall",	0, DEC, NOV},					/*   2 */
223 {"read",	3, DEC, NOV, DEC, IOB, UNS},			/*   3 */
224 {"write",	3, DEC, NOV, DEC, IOB, UNS},			/*   4 */
225 {"open",	3, DEC, NOV, STG, OPN, OCT},			/*   5 */
226 {"close",	1, DEC, NOV, DEC},				/*   6 */
227 {"wait",	0, DEC, HHX},					/*   7 */
228 {"creat",	2, DEC, NOV, STG, OCT},				/*   8 */
229 {"link",	2, DEC, NOV, STG, STG},				/*   9 */
230 {"unlink",	1, DEC, NOV, STG},				/*  10 */
231 {"exec",	2, DEC, NOV, STG, DEC},				/*  11 */
232 {"chdir",	1, DEC, NOV, STG},				/*  12 */
233 {"time",	0, DEC, NOV},					/*  13 */
234 {"mknod",	3, DEC, NOV, STG, OCT, HEX},			/*  14 */
235 {"chmod",	2, DEC, NOV, STG, OCT},				/*  15 */
236 {"chown",	3, DEC, NOV, STG, DEC, DEC},			/*  16 */
237 {"brk",		1, DEC, NOV, HEX},				/*  17 */
238 {"stat",	2, DEC, NOV, STG, HEX},				/*  18 */
239 {"lseek",	3, DEC, NOV, DEC, DEX, WHN},			/*  19 */
240 {"getpid",	0, DEC, DEC},					/*  20 */
241 {"mount",	8, DEC, NOV, STG, STG, MTF, MFT, HEX, DEC, HEX, DEC},	/* 21 */
242 {"umount",	1, DEC, NOV, STG},				/*  22 */
243 {"setuid",	1, DEC, NOV, UNS},				/*  23 */
244 {"getuid",	0, UNS, UNS},					/*  24 */
245 {"stime",	1, DEC, NOV, DEC},				/*  25 */
246 {"pcsample",	2, DEC, NOV, HEX, DEC},				/*  26 */
247 {"alarm",	1, DEC, NOV, UNS},				/*  27 */
248 {"fstat",	2, DEC, NOV, DEC, HEX},				/*  28 */
249 {"pause",	0, DEC, NOV},					/*  29 */
250 {"utime",	2, DEC, NOV, STG, HEX},				/*  30 */
251 {"stty",	2, DEC, NOV, DEC, DEC},				/*  31 */
252 {"gtty",	2, DEC, NOV, DEC, DEC},				/*  32 */
253 {"access",	2, DEC, NOV, STG, ACC},				/*  33 */
254 {"nice",	1, DEC, NOV, DEC},				/*  34 */
255 {"statfs",	4, DEC, NOV, STG, HEX, DEC, DEC},		/*  35 */
256 {"sync",	0, DEC, NOV},					/*  36 */
257 {"kill",	2, DEC, NOV, DEC, SIG},				/*  37 */
258 {"fstatfs",	4, DEC, NOV, DEC, HEX, DEC, DEC},		/*  38 */
259 {"pgrpsys",	3, DEC, NOV, DEC, DEC, DEC},			/*  39 */
260 {"uucopystr",	3, DEC, NOV, STG, RST, UNS},			/*  40 */
261 {"dup",		1, DEC, NOV, DEC},				/*  41 */
262 {"pipe",	0, DEC, DEC},					/*  42 */
263 {"times",	1, DEC, NOV, HEX},				/*  43 */
264 {"profil",	4, DEC, NOV, HEX, UNS, HEX, OCT},		/*  44 */
265 {"plock",	1, DEC, NOV, PLK},				/*  45 */
266 {"setgid",	1, DEC, NOV, UNS},				/*  46 */
267 {"getgid",	0, UNS, UNS},					/*  47 */
268 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
269 {"msgsys",	6, DEC, NOV, DEC, DEC, DEC, DEC, DEC, DEC},	/*  49 */
270 {"sysi86",	4, HEX, NOV, S86, HEX, HEX, HEX, DEC, DEC},	/*  50 */
271 {"acct",	1, DEC, NOV, STG},				/*  51 */
272 {"shmsys",	4, DEC, NOV, DEC, HEX, HEX, HEX},		/*  52 */
273 {"semsys",	5, DEC, NOV, DEC, HEX, HEX, HEX, HEX},		/*  53 */
274 {"ioctl",	3, DEC, NOV, DEC, IOC, IOA},			/*  54 */
275 {"uadmin",	3, DEC, NOV, DEC, DEC, DEC},			/*  55 */
276 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
277 {"utssys",	4, DEC, NOV, HEX, DEC, UTS, HEX},		/*  57 */
278 {"fdsync",	2, DEC, NOV, DEC, FFG},				/*  58 */
279 {"execve",	3, DEC, NOV, STG, HEX, HEX},			/*  59 */
280 {"umask",	1, OCT, NOV, OCT},				/*  60 */
281 {"chroot",	1, DEC, NOV, STG},				/*  61 */
282 {"fcntl",	3, DEC, NOV, DEC, FCN, HEX},			/*  62 */
283 {"ulimit",	2, DEX, NOV, ULM, DEC},				/*  63 */
284 
285 /*  The following 6 entries were reserved for the UNIX PC */
286 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
287 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
288 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
289 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
290 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
291 { NULL,		8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX},
292 
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 {"fsat",	6, DEC, NOV, HEX, HEX, HEX, HEX, HEX, HEX},	/*  76 */
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 {"poll",	3, DEC, NOV, HEX, DEC, DEC},			/*  87 */
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 {"evsys",	3, DEC, NOV, DEC, DEC, HEX},			/* 101 */
325 {"evtrapret",	0, DEC, NOV},					/* 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 {"xstat",	3, DEC, NOV, DEC, STG, HEX},			/* 123 */
347 {"lxstat",	3, DEC, NOV, DEC, STG, HEX},			/* 124 */
348 {"fxstat",	3, DEC, NOV, DEC, DEC, HEX},			/* 125 */
349 {"xmknod",	4, DEC, NOV, DEC, STG, OCT, HEX},		/* 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 {"fork1",	0, DEC, NOV},					/* 143 */
367 {"sigtimedwait", 3, DEC, NOV, HEX, HEX, HEX},			/* 144 */
368 {"lwp_info",	1, DEC, NOV, HEX},				/* 145 */
369 {"yield",	0, DEC, NOV},					/* 146 */
370 {"lwp_sema_wait", 1, DEC, NOV, HEX},				/* 147 */
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 {"utimes",	2, DEC, NOV, STG, HEX},				/* 154 */
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",	3, HEX, HEX, SPM, 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 {"lwp_mutex_lock", 1, DEC, NOV, HEX},				/* 169 */
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 {"creat64",	2, DEC, NOV, STG, OCT},				/* 224 */
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",	4, DEC, NOV, DEC, HEX, HEX, SKV},		/* 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",	4, DEC, NOV, DEC, DEC, DEC, STG},		/* 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 opentable[] = {
491 {"open",	2, DEC, NOV, STG, OPN},				/* 0 */
492 {"open",	3, DEC, NOV, STG, OPN, OCT},			/* 1 */
493 };
494 #define	NOPENCODE	(sizeof (opentable) / sizeof (struct systable))
495 
496 const	struct systable open64table[] = {
497 {"open64",	2, DEC, NOV, STG, OPN},				/* 0 */
498 {"open64",	3, DEC, NOV, STG, OPN, OCT},			/* 1 */
499 };
500 #define	NOPEN64CODE	(sizeof (open64table) / sizeof (struct systable))
501 
502 const	struct systable fcntltable[] = {
503 {"fcntl",	3, DEC, NOV, DEC, FCN, HEX},			/* 0: default */
504 {"fcntl",	2, DEC, NOV, DEC, FCN},				/* 1: no arg */
505 {"fcntl",	3, DEC, NOV, DEC, FCN, FFG},			/* 2: F_SETFL */
506 };
507 #define	NFCNTLCODE	(sizeof (fcntltable) / sizeof (struct systable))
508 
509 const	struct systable msgtable[] = {
510 {"msgget",	3, DEC, NOV, HID, KEY, MSF},			/* 0 */
511 {"msgctl",	4, DEC, NOV, HID, DEC, MSC, HEX},		/* 1 */
512 {"msgrcv",	6, DEC, NOV, HID, DEC, HEX, UNS, DEC, MSF},	/* 2 */
513 {"msgsnd",	5, DEC, NOV, HID, DEC, HEX, UNS, MSF},		/* 3 */
514 {"msgids",	4, DEC, NOV, HID, HEX, UNS, HEX},		/* 4 */
515 {"msgsnap",	5, DEC, NOV, HID, DEC, HEX, UNS, DEC},		/* 5 */
516 };
517 #define	NMSGCODE	(sizeof (msgtable) / sizeof (struct systable))
518 
519 const	struct systable semtable[] = {
520 {"semctl",	5, DEC, NOV, HID, DEC, DEC, SMC, DEX},		/* 0 */
521 {"semget",	4, DEC, NOV, HID, KEY, DEC, SEF},		/* 1 */
522 {"semop",	4, DEC, NOV, HID, DEC, HEX, UNS},		/* 2 */
523 {"semids",	4, DEC, NOV, HID, HEX, UNS, HEX},		/* 3 */
524 {"semtimedop",	5, DEC, NOV, HID, DEC, HEX, UNS, HEX},		/* 4 */
525 };
526 #define	NSEMCODE	(sizeof (semtable) / sizeof (struct systable))
527 
528 const	struct systable shmtable[] = {
529 {"shmat",	4, HEX, NOV, HID, DEC, DEX, SHF},		/* 0 */
530 {"shmctl",	4, DEC, NOV, HID, DEC, SHC, DEX},		/* 1 */
531 {"shmdt",	2, DEC, NOV, HID, HEX},				/* 2 */
532 {"shmget",	4, DEC, NOV, HID, KEY, UNS, SHF},		/* 3 */
533 {"shmids",	4, DEC, NOV, HID, HEX, UNS, HEX},		/* 4 */
534 };
535 #define	NSHMCODE	(sizeof (shmtable) / sizeof (struct systable))
536 
537 const	struct systable pidtable[] = {
538 {"getpgrp",	1, DEC, NOV, HID},				/* 0 */
539 {"setpgrp",	1, DEC, NOV, HID},				/* 1 */
540 {"getsid",	2, DEC, NOV, HID, DEC},				/* 2 */
541 {"setsid",	1, DEC, NOV, HID},				/* 3 */
542 {"getpgid",	2, DEC, NOV, HID, DEC},				/* 4 */
543 {"setpgid",	3, DEC, NOV, HID, DEC, DEC},			/* 5 */
544 };
545 #define	NPIDCODE	(sizeof (pidtable) / sizeof (struct systable))
546 
547 const	struct systable sfstable[] = {
548 {"sysfs",	3, DEC, NOV, SFS, DEX, DEX},			/* 0 */
549 {"sysfs",	2, DEC, NOV, SFS, STG},				/* 1 */
550 {"sysfs",	3, DEC, NOV, SFS, DEC, RST},			/* 2 */
551 {"sysfs",	1, DEC, NOV, SFS},				/* 3 */
552 };
553 #define	NSFSCODE	(sizeof (sfstable) / sizeof (struct systable))
554 
555 const	struct systable utstable[] = {
556 {"utssys",	3, DEC, NOV, HEX, DEC, UTS},			/* 0 */
557 {"utssys",	4, DEC, NOV, HEX, HEX, HEX, HEX},		/* err */
558 {"utssys",	3, DEC, NOV, HEX, HHX, UTS},			/* 2 */
559 {"utssys",	4, DEC, NOV, STG, FUI, UTS, HEX}		/* 3 */
560 };
561 #define	NUTSCODE	(sizeof (utstable) / sizeof (struct systable))
562 
563 const	struct systable rctltable[] = {
564 {"getrctl",	6, DEC, NOV, HID, STG, HEX, HEX, HID, RGF},	/* 0 */
565 {"setrctl",	6, DEC, NOV, HID, STG, HEX, HEX, HID, RSF},	/* 1 */
566 {"rctlsys_lst",	6, DEC, NOV, HID, HID, HEX, HID, HEX, HID},	/* 2 */
567 {"rctlsys_ctl",	6, DEC, NOV, HID, STG, HEX, HID, HID, RCF},	/* 3 */
568 {"setprojrctl",	6, DEC, NOV, HID, STG, HID, HEX, HEX, SPF},	/* 4 */
569 };
570 #define	NRCTLCODE	(sizeof (rctltable) / sizeof (struct systable))
571 
572 const	struct systable sgptable[] = {
573 {"sigpendsys",	2, DEC, NOV, DEC, HEX},				/* err */
574 {"sigpending",	2, DEC, NOV, HID, HEX},				/* 1 */
575 {"sigfillset",	2, DEC, NOV, HID, HEX},				/* 2 */
576 };
577 #define	NSGPCODE	(sizeof (sgptable) / sizeof (struct systable))
578 
579 const	struct systable ctxtable[] = {
580 {"getcontext",	2, DEC, NOV, HID, HEX},				/* 0 */
581 {"setcontext",	2, DEC, NOV, HID, HEX},				/* 1 */
582 {"getustack",	2, DEC, NOV, HID, HEX},				/* 2 */
583 {"setustack",	2, DEC, NOV, HID, HEX},				/* 3 */
584 };
585 #define	NCTXCODE	(sizeof (ctxtable) / sizeof (struct systable))
586 
587 const	struct systable hrttable[] = {
588 {"hrtcntl",	5, DEC, NOV, HID, DEC, DEC, HEX, HEX},		/* 0 */
589 {"hrtalarm",	3, DEC, NOV, HID, HEX, DEC},			/* 1 */
590 {"hrtsleep",	2, DEC, NOV, HID, HEX},				/* 2 */
591 {"hrtcancel",	3, DEC, NOV, HID, HEX, DEC},			/* 3 */
592 };
593 #define	NHRTCODE	(sizeof (hrttable) / sizeof (struct systable))
594 
595 const	struct systable cortable[] = {
596 {"corectl",	4, DEC, NOV, COR, HEX, HEX, HEX},		/* 0 */
597 {"corectl",	2, DEC, NOV, COR, CCO},				/* 1 */
598 {"corectl",	1, HHX, NOV, COR},				/* 2 */
599 {"corectl",	3, DEC, NOV, COR, STG, DEC},			/* 3 */
600 {"corectl",	3, DEC, NOV, COR, RST, DEC},			/* 4 */
601 {"corectl",	4, DEC, NOV, COR, STG, DEC, DEC},		/* 5 */
602 {"corectl",	4, DEC, NOV, COR, RST, DEC, DEC},		/* 6 */
603 {"corectl",	2, DEC, NOV, COR, CCC},				/* 7 */
604 {"corectl",	2, DEC, NOV, COR, RCC},				/* 8 */
605 {"corectl",	3, DEC, NOV, COR, CCC, DEC},			/* 9 */
606 {"corectl",	3, DEC, NOV, COR, RCC, DEC},			/* 10 */
607 {"corectl",	3, DEC, NOV, COR, STG, DEC},			/* 11 */
608 {"corectl",	3, DEC, NOV, COR, RST, DEC},			/* 12 */
609 {"corectl",	2, DEC, NOV, COR, CCC},				/* 13 */
610 {"corectl",	2, DEC, NOV, COR, RCC},				/* 14 */
611 };
612 #define	NCORCODE	(sizeof (cortable) / sizeof (struct systable))
613 
614 const	struct systable aiotable[] = {
615 {"kaio",	7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 0 */
616 {"kaio",	7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 1 */
617 {"kaio",	3, DEC, NOV, AIO, HEX, DEC},			/* 2 */
618 {"kaio",	3, DEC, NOV, AIO, DEC, HEX},			/* 3 */
619 {"kaio",	1, DEC, NOV, AIO},				/* 4 */
620 {"kaio",	1, DEC, NOV, AIO},				/* 5 */
621 {"kaio",	1, DEC, NOV, AIO},				/* 6 */
622 {"kaio",	5, DEC, NOV, AIO, LIO, HEX, DEC, HEX},		/* 7 */
623 {"kaio",	5, DEC, NOV, AIO, HEX, DEC, HEX, DEC},		/* 8 */
624 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 9 */
625 {"kaio",	5, DEC, NOV, AIO, LIO, HEX, DEC, HEX},		/* 10 */
626 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 11 */
627 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 12 */
628 {"kaio",	5, DEC, NOV, AIO, LIO, HEX, DEC, HEX},		/* 13 */
629 {"kaio",	5, DEC, NOV, AIO, HEX, DEC, HEX, DEC},		/* 14 */
630 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 15 */
631 {"kaio",	5, DEC, NOV, AIO, LIO, HEX, DEC, HEX},		/* 16 */
632 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 17 */
633 {"kaio",	2, DEC, NOV, AIO, HEX},				/* 18 */
634 {"kaio",	3, DEC, NOV, AIO, DEC, HEX},			/* 19 */
635 {"kaio",	1, DEC, NOV, AIO},				/* 20 */
636 {"kaio",	5, DEC, NOV, AIO, HEX, DEC, HEX, HEX},		/* 21 */
637 };
638 #define	NAIOCODE	(sizeof (aiotable) / sizeof (struct systable))
639 
640 const	struct systable doortable[] = {
641 {"door_create", 3, DEC, NOV, HEX, HEX, DFL},			/* 0 */
642 {"door_revoke", 1, DEC, NOV, DEC},				/* 1 */
643 {"door_info",	2, DEC, NOV, DEC, HEX},				/* 2 */
644 {"door_call",	2, DEC, NOV, DEC, HEX},				/* 3 */
645 {"door_return", 4, DEC, NOV, HEX, DEC, HEX, DEC},		/* 4 (old) */
646 {"door_cred",	1, DEC, NOV, HEX},				/* 5 (old) */
647 {"door_bind",	1, DEC, NOV, DEC},				/* 6 */
648 {"door_unbind", 0, DEC, NOV},					/* 7 */
649 {"door_unref",	0, DEC, NOV},					/* 8 */
650 {"door_ucred",	1, DEC, NOV, HEX},				/* 9 */
651 {"door_return", 5, DEC, NOV, HEX, DEC, HEX, HEX, DEC},		/* 10 */
652 {"door_getparam", 3, DEC, NOV, DEC, DPM, HEX},			/* 11 */
653 {"door_setparam", 3, DEC, NOV, DEC, DPM, DEC},			/* 12 */
654 };
655 #define	NDOORCODE	(sizeof (doortable) / sizeof (struct systable))
656 
657 const	struct systable psettable[] = {
658 {"pset_create", 2, DEC, NOV, HID, HEX},				/* 0 */
659 {"pset_destroy", 2, DEC, NOV, HID, PST},			/* 1 */
660 {"pset_assign",	4, DEC, NOV, HID, PST, DEC, HEX},		/* 2 */
661 {"pset_info",	5, DEC, NOV, HID, PST, HEX, HEX, HEX},		/* 3 */
662 {"pset_bind",	5, DEC, NOV, HID, PST, IDT, DEC, HEX},		/* 4 */
663 {"pset_getloadavg", 4, DEC, NOV, HID, PST, HEX, DEC},		/* 5 */
664 {"pset_list",	3, DEC, NOV, HID, HEX, HEX},			/* 6 */
665 {"pset_setattr", 3, DEC, NOV, HID, PST, HEX},			/* 7 */
666 {"pset_getattr", 3, DEC, NOV, HID, PST, HEX},			/* 8 */
667 {"pset_assign_forced",	4, DEC, NOV, HID, PST, DEC, HEX},	/* 9 */
668 };
669 #define	NPSETCODE	(sizeof (psettable) / sizeof (struct systable))
670 
671 const	struct systable lwpcreatetable[] = {
672 {"lwp_create",	3, DEC, NOV, HEX, LWF, HEX},			/* 0 */
673 {"lwp_create",	0, DEC, NOV},					/* 1 */
674 };
675 #define	NLWPCREATECODE	(sizeof (lwpcreatetable) / sizeof (struct systable))
676 
677 static	const	struct systable tasksystable[] = {
678 {"settaskid",	3, DEC, NOV, HID, DEC, HEX},			/* 0 */
679 {"gettaskid",	1, DEC, NOV, HID},				/* 1 */
680 {"getprojid",	1, DEC, NOV, HID},				/* 2 */
681 };
682 #define	NTASKSYSCODE	(sizeof (tasksystable) / sizeof (struct systable))
683 
684 static const	struct systable privsystable[] = {
685 {"setppriv",		4, DEC, NOV, HID, PRO, PRN, PRS},	/* 0 */
686 {"getppriv",		4, DEC, NOV, HID, HID, PRN, PRS},	/* 1 */
687 {"getprivimplinfo",	5, DEC, NOV, HID, HID, HID, HEX, DEC},	/* 2 */
688 {"setpflags",		3, DEC, NOV, HID, PFL, DEC},		/* 3 */
689 {"getpflags",		2, DEC, NOV, HID, PFL},			/* 4 */
690 {"issetugid",		0, DEC, NOV, HID},			/* 5 */
691 };
692 #define	NPRIVSYSCODE	(sizeof (privsystable) / sizeof (struct systable))
693 
694 static	const	struct systable exacctsystable[] = {
695 {"getacct",	5, DEC, NOV, HID, IDT, DEC, HEX, UNS},		/* 0 */
696 {"putacct",	6, DEC, NOV, HID, IDT, DEC, HEX, UNS, HEX},	/* 1 */
697 {"wracct",	4, DEC, NOV, HID, IDT, DEC, HEX},		/* 2 */
698 };
699 #define	NEXACCTSYSCODE	(sizeof (exacctsystable) / sizeof (struct systable))
700 
701 static const	struct systable fsatsystable[] = {
702 {"openat",	5, DEC, NOV, HID, ATC, STG, OPN, OCT},		/* 0 */
703 {"openat64",	5, DEC, NOV, HID, ATC, STG, OPN, OCT},		/* 1 */
704 {"fstatat64",	5, DEC, NOV, HID, ATC, STG, HEX, HEX},		/* 2 */
705 {"fstatat",	5, DEC, NOV, HID, ATC, STG, HEX, HEX},		/* 3 */
706 {"fchownat",	6, DEC, NOV, HID, ATC, STG, HEX, HEX, HEX},	/* 4 */
707 {"unlinkat",	4, DEC, NOV, HID, ATC, STG, HEX},		/* 5 */
708 {"futimesat",	4, DEC, NOV, HID, ATC, STG, HEX},		/* 6 */
709 {"renameat",	5, DEC, NOV, HID, ATC, STG, DEC, STG},		/* 7 */
710 {"faccessat",	5, DEC, NOV, HID, ATC, STG, ACC, ACC},		/* 8 */
711 {"__openattrdirat", 3, DEC, NOV, HID, ATC, STG},		/* 9 */
712 {"openat",	4, DEC, NOV, HID, ATC, STG, OPN},		/* N - 2 */
713 {"openat64",	4, DEC, NOV, HID, ATC, STG, OPN},		/* N - 1 */
714 };
715 #define	NFSATSYSCODE	(sizeof (fsatsystable) / sizeof (struct systable))
716 
717 static	const	struct systable lwpparktable[] = {
718 {"lwp_park",	3, DEC, NOV, HID, HEX, DEC},			/* 0 */
719 {"lwp_unpark",	2, DEC, NOV, HID, DEC},				/* 1 */
720 {"lwp_unpark_all", 3, DEC, NOV, HID, HEX, DEC},			/* 2 */
721 {"lwp_unpark_cancel",	2, DEC, NOV, HID, DEC},			/* 3 */
722 {"lwp_set_park",	3, DEC, NOV, HID, HEX, DEC},		/* 4 */
723 };
724 #define	NLWPPARKCODE	(sizeof (lwpparktable) / sizeof (struct systable))
725 
726 static	const	struct systable lwprwlocktable[] = {
727 {"lwp_rwlock_rdlock", 3, DEC, NOV, HID, HEX, HEX},		/* 0 */
728 {"lwp_rwlock_wrlock", 3, DEC, NOV, HID, HEX, HEX},		/* 1 */
729 {"lwp_rwlock_tryrdlock", 2, DEC, NOV, HID, HEX},		/* 2 */
730 {"lwp_rwlock_trywrlock", 2, DEC, NOV, HID, HEX},		/* 3 */
731 {"lwp_rwlock_unlock", 2, DEC, NOV, HID, HEX},			/* 4 */
732 };
733 #define	NLWPRWLOCKCODE	(sizeof (lwprwlocktable) / sizeof (struct systable))
734 
735 static	const	struct systable sendfilevsystable[] = {
736 {"sendfilev",	5, DEC, NOV, DEC, DEC, HEX, DEC, HEX},		/* 0 */
737 {"sendfilev64",	5, DEC, NOV, DEC, DEC, HEX, DEC, HEX},		/* 1 */
738 };
739 #define	NSENDFILESYSCODE \
740 		(sizeof (sendfilevsystable) / sizeof (struct systable))
741 
742 static	const	struct systable lgrpsystable[] = {
743 {"meminfo",		3, DEC, NOV, HID, NOV, MIF},		/* 0 */
744 {"_lgrpsys",		3, DEC, NOV, DEC, DEC, NOV},		/* 1 */
745 {"lgrp_version",	3, DEC, NOV, HID, DEC, NOV},		/* 2 */
746 {"_lgrpsys",		3, DEC, NOV, DEC, HEX, HEX},		/* 3 */
747 {"lgrp_affinity_get",	3, DEC, NOV, HID, NOV, LAF},		/* 4 */
748 {"lgrp_affinity_set",	3, DEC, NOV, HID, NOV, LAF},		/* 5 */
749 {"lgrp_latency",	3, DEC, NOV, HID, DEC, DEC},		/* 6 */
750 };
751 #define	NLGRPSYSCODE	(sizeof (lgrpsystable) / sizeof (struct systable))
752 
753 static	const	struct systable rusagesystable[] = {
754 {"getrusage",		2, DEC, NOV, HID, HEX},			/* 0 */
755 {"getrusage_chld",	2, DEC, NOV, HID, HEX},			/* 1 */
756 {"getrusage_lwp",	2, DEC, NOV, HID, HEX},			/* 2 */
757 {"getvmusage",		5, DEC, NOV, HID, HEX, DEC, HEX, HEX},	/* 3 */
758 };
759 #define	NRUSAGESYSCODE \
760 		(sizeof (rusagesystable) / sizeof (struct systable))
761 
762 static const	struct systable ucredsystable[] = {
763 {"ucred_get",	3, DEC, NOV, HID, DEC, HEX},
764 {"getpeerucred", 3, DEC, NOV, HID, DEC, HEX},
765 };
766 #define	NUCREDSYSCODE \
767 		(sizeof (ucredsystable) / sizeof (struct systable))
768 
769 const	struct systable portfstable[] = {
770 {"port_create",	2, DEC, NOV, HID, DEC},				/* 0 */
771 {"port_associate",	6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX}, /* 1 */
772 {"port_dissociate",	4, DEC, NOV, HID, DEC, DEC, HEX}, 	/* 2 */
773 {"port_send",	4, DEC, NOV, HID, DEC, HEX, HEX},		/* 3 */
774 {"port_sendn",	6, DEC, DEC, HID, HEX, HEX, DEC, HEX, HEX},	/* 4 */
775 {"port_get",	4, DEC, NOV, HID, DEC, HEX, HEX},		/* 5 */
776 {"port_getn",	6, DEC, DEC, HID, DEC, HEX, DEC, DEC, HEX},	/* 6 */
777 {"port_alert",	5, DEC, NOV, HID, DEC, HEX, HEX, HEX},		/* 7 */
778 {"port_dispatch", 6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX},	/* 8 */
779 };
780 #define	NPORTCODE	(sizeof (portfstable) / sizeof (struct systable))
781 
782 static const struct systable zonetable[] = {
783 {"zone_create",	2, DEC, NOV, HID, HEX},				/* 0 */
784 {"zone_destroy", 2, DEC, NOV, HID, DEC},			/* 1 */
785 {"zone_getattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC},		/* 2 */
786 {"zone_enter",	2, DEC, NOV, HID, DEC},				/* 3 */
787 {"zone_list",	3, DEC, NOV, HID, HEX, HEX},			/* 4 */
788 {"zone_shutdown", 2, DEC, NOV, HID, DEC},			/* 5 */
789 {"zone_lookup",	2, DEC, NOV, HID, STG},				/* 6 */
790 {"zone_boot",	2, DEC, NOV, HID, DEC},				/* 7 */
791 {"zone_version", 2, HEX, NOV, HID, DEC},			/* 8 */
792 {"zone_setattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC},		/* 9 */
793 {"zone_add_datalink", 3, DEC, NOV, HID, DEC, STG},		/* 10 */
794 {"zone_remove_datalink", 3, DEC, NOV, HID, DEC, STG},		/* 11 */
795 {"zone_check_datalink", 3, DEC, NOV, HID, HEX, STG},		/* 12 */
796 {"zone_list_datalink", 4, DEC, NOV, HID, DEC, HEX, HEX},	/* 13 */
797 };
798 #define	NZONECODE	(sizeof (zonetable) / sizeof (struct systable))
799 
800 static const struct systable labeltable[] = {
801 {"labelsys",	3, DEC, NOV, HID, HEX, HEX},			/* 0 */
802 {"is_system_labeled", 1, DEC, NOV, HID},			/* 1 */
803 {"tnrh",	3, DEC, NOV, HID, TND, HEX},			/* 2 */
804 {"tnrhtp",	3, DEC, NOV, HID, TND, HEX},			/* 3 */
805 {"tnmlp",	3, DEC, NOV, HID, TND, HEX},			/* 4 */
806 {"getlabel",	3, DEC, NOV, HID, STG, HEX},			/* 5 */
807 {"fgetlabel",	3, DEC, NOV, HID, DEC, HEX},			/* 6 */
808 };
809 #define	NLABELCODE	(sizeof (labeltable) / sizeof (struct systable))
810 
811 const	struct systable forktable[] = {
812 /* parent codes */
813 {"forkx",	2, DEC, NOV, HID, FXF},				/* 0 */
814 {"forkallx",	2, DEC, NOV, HID, FXF},				/* 1 */
815 {"vforkx",	2, DEC, NOV, HID, FXF},				/* 2 */
816 /* child codes */
817 {"forkx",	0, DEC, NOV},					/* 3 */
818 {"forkallx",	0, DEC, NOV},					/* 4 */
819 {"vforkx",	0, DEC, NOV},					/* 5 */
820 };
821 #define	NFORKCODE	(sizeof (forktable) / sizeof (struct systable))
822 
823 const	struct systable sidsystable[] = {
824 {"allocids",	4, UNS, UNS, HID, DEC, DEC, DEC},		/* 0 */
825 {"idmap_reg",	2, DEC, NOV, HID, DEC},				/* 1 */
826 {"idmap_unreg",	2, DEC, NOV, HID, DEC},				/* 2 */
827 };
828 #define	NSIDSYSCODE	(sizeof (sidsystable) / sizeof (struct systable))
829 
830 const	struct systable utimesystable[] = {
831 {"futimens",	3, DEC, NOV, HID, DEC, HEX},			/* 0 */
832 {"utimensat",	5, DEC, NOV, HID, ATC, STG, HEX, UTF},		/* 1 */
833 };
834 #define	NUTIMESYSCODE	(sizeof (utimesystable) / sizeof (struct systable))
835 
836 const	struct sysalias sysalias[] = {
837 	{ "exit",	SYS_exit	},
838 	{ "fork",	SYS_forksys	},
839 	{ "forkx",	SYS_forksys	},
840 	{ "forkallx",	SYS_forksys	},
841 	{ "vforkx",	SYS_forksys	},
842 	{ "sbrk",	SYS_brk		},
843 	{ "getppid",	SYS_getpid	},
844 	{ "geteuid",	SYS_getuid	},
845 	{ "getpgrp",	SYS_pgrpsys	},
846 	{ "setpgrp",	SYS_pgrpsys	},
847 	{ "getsid",	SYS_pgrpsys	},
848 	{ "setsid",	SYS_pgrpsys	},
849 	{ "getpgid",	SYS_pgrpsys	},
850 	{ "setpgid",	SYS_pgrpsys	},
851 	{ "getegid",	SYS_getgid	},
852 	{ "msgget",	SYS_msgsys	},
853 	{ "msgctl",	SYS_msgsys	},
854 	{ "msgctl64",	SYS_msgsys	},
855 	{ "msgrcv",	SYS_msgsys	},
856 	{ "msgsnd",	SYS_msgsys	},
857 	{ "msgids",	SYS_msgsys	},
858 	{ "msgsnap",	SYS_msgsys	},
859 	{ "msgop",	SYS_msgsys	},
860 	{ "shmat",	SYS_shmsys	},
861 	{ "shmctl",	SYS_shmsys	},
862 	{ "shmctl64",	SYS_shmsys	},
863 	{ "shmdt",	SYS_shmsys	},
864 	{ "shmget",	SYS_shmsys	},
865 	{ "shmids",	SYS_shmsys	},
866 	{ "shmop",	SYS_shmsys	},
867 	{ "semctl",	SYS_semsys	},
868 	{ "semctl64",	SYS_semsys	},
869 	{ "semget",	SYS_semsys	},
870 	{ "semids",	SYS_semsys	},
871 	{ "semop",	SYS_semsys	},
872 	{ "semtimedop",	SYS_semsys	},
873 	{ "uname",	SYS_utssys	},
874 	{ "ustat",	SYS_utssys	},
875 	{ "fusers",	SYS_utssys	},
876 	{ "exec",	SYS_execve	},
877 	{ "execl",	SYS_execve	},
878 	{ "execv",	SYS_execve	},
879 	{ "execle",	SYS_execve	},
880 	{ "execlp",	SYS_execve	},
881 	{ "execvp",	SYS_execve	},
882 	{ "sigfillset",	SYS_sigpending	},
883 	{ "getcontext",	SYS_context	},
884 	{ "setcontext",	SYS_context	},
885 	{ "getustack",	SYS_context	},
886 	{ "setustack",	SYS_context	},
887 	{ "hrtcntl",	SYS_hrtsys	},
888 	{ "hrtalarm",	SYS_hrtsys	},
889 	{ "hrtsleep",	SYS_hrtsys	},
890 	{ "hrtcancel",	SYS_hrtsys	},
891 	{ "aioread",	SYS_kaio	},
892 	{ "aiowrite",	SYS_kaio	},
893 	{ "aiowait",	SYS_kaio	},
894 	{ "aiocancel",	SYS_kaio	},
895 	{ "aionotify",	SYS_kaio	},
896 	{ "audit",	SYS_auditsys	},
897 	{ "door_create",	SYS_door	},
898 	{ "door_revoke",	SYS_door	},
899 	{ "door_info",		SYS_door	},
900 	{ "door_call",		SYS_door	},
901 	{ "door_return",	SYS_door	},
902 	{ "door_bind",		SYS_door	},
903 	{ "door_unbind",	SYS_door	},
904 	{ "door_unref",		SYS_door	},
905 	{ "door_ucred",		SYS_door	},
906 	{ "door_getparam",	SYS_door	},
907 	{ "door_setparam",	SYS_door	},
908 	{ "pset_create",	SYS_pset	},
909 	{ "pset_destroy",	SYS_pset	},
910 	{ "pset_assign",	SYS_pset	},
911 	{ "pset_info",		SYS_pset	},
912 	{ "pset_bind",		SYS_pset	},
913 	{ "pset_getloadavg",	SYS_pset	},
914 	{ "pset_list",		SYS_pset	},
915 	{ "pset_setattr",	SYS_pset	},
916 	{ "pset_getattr",	SYS_pset	},
917 	{ "pset_assign_forced",	SYS_pset	},
918 	{ "settaskid",		SYS_tasksys	},
919 	{ "gettaskid",		SYS_tasksys	},
920 	{ "getprojid",		SYS_tasksys	},
921 	{ "setppriv",		SYS_privsys	},
922 	{ "getppriv",		SYS_privsys	},
923 	{ "getprivimplinfo",	SYS_privsys	},
924 	{ "setpflags",		SYS_privsys	},
925 	{ "getpflags",		SYS_privsys	},
926 	{ "getacct",		SYS_exacctsys	},
927 	{ "putacct",		SYS_exacctsys	},
928 	{ "wracct",		SYS_exacctsys	},
929 	{ "lwp_cond_timedwait",	SYS_lwp_cond_wait },
930 	{ "lwp_park",		SYS_lwp_park	},
931 	{ "lwp_unpark",		SYS_lwp_park	},
932 	{ "lwp_unpark_all",	SYS_lwp_park	},
933 	{ "lwp_rwlock_rdlock",	SYS_lwp_rwlock_sys },
934 	{ "lwp_rwlock_wrlock",	SYS_lwp_rwlock_sys },
935 	{ "lwp_rwlock_tryrdlock", SYS_lwp_rwlock_sys },
936 	{ "lwp_rwlock_trywrlock", SYS_lwp_rwlock_sys },
937 	{ "lwp_rwlock_unlock",	SYS_lwp_rwlock_sys },
938 	{ "sendfilev64",	SYS_sendfilev	},
939 	{ "openat",		SYS_fsat	},
940 	{ "openat64",		SYS_fsat	},
941 	{ "fstatat64",		SYS_fsat	},
942 	{ "fstatat",		SYS_fsat	},
943 	{ "fchownat",		SYS_fsat	},
944 	{ "unlinkat",		SYS_fsat	},
945 	{ "futimesat",		SYS_fsat	},
946 	{ "renameat",		SYS_fsat	},
947 	{ "faccessat",		SYS_fsat	},
948 	{ "__openattrdirat",	SYS_fsat	},
949 	{ "lgrpsys",		SYS_lgrpsys	},
950 	{ "getrusage",		SYS_rusagesys	},
951 	{ "getrusage_chld",	SYS_rusagesys	},
952 	{ "getrusage_lwp",	SYS_rusagesys	},
953 	{ "getvmusage",		SYS_rusagesys	},
954 	{ "getpeerucred",	SYS_ucredsys	},
955 	{ "ucred_get",		SYS_ucredsys	},
956 	{ "port_create",	SYS_port	},
957 	{ "port_associate",	SYS_port	},
958 	{ "port_dissociate",	SYS_port	},
959 	{ "port_send",		SYS_port	},
960 	{ "port_sendn",		SYS_port	},
961 	{ "port_get",		SYS_port	},
962 	{ "port_getn",		SYS_port	},
963 	{ "port_alert",		SYS_port	},
964 	{ "port_dispatch",	SYS_port	},
965 	{ "zone_create",	SYS_zone	},
966 	{ "zone_destroy",	SYS_zone	},
967 	{ "zone_getattr",	SYS_zone	},
968 	{ "zone_setattr",	SYS_zone	},
969 	{ "zone_enter",		SYS_zone	},
970 	{ "getzoneid",		SYS_zone	},
971 	{ "zone_list",		SYS_zone	},
972 	{ "zone_shutdown",	SYS_zone	},
973 	{ "zone_add_datalink",	SYS_zone	},
974 	{ "zone_remove_datalink", SYS_zone	},
975 	{ "zone_check_datalink", SYS_zone	},
976 	{ "zone_list_datalink",	SYS_zone	},
977 	{ "is_system_labeled",	SYS_labelsys	},
978 	{ "tnrh",		SYS_labelsys	},
979 	{ "tnrhtp",		SYS_labelsys	},
980 	{ "tnmlp",		SYS_labelsys	},
981 	{ "getlabel",		SYS_labelsys	},
982 	{ "fgetlabel",		SYS_labelsys	},
983 	{ "getrctl",		SYS_rctlsys	},
984 	{ "setrctl",		SYS_rctlsys	},
985 	{ "rctlsys_lst",	SYS_rctlsys	},
986 	{ "rctlsys_ctl",	SYS_rctlsys	},
987 	{ "allocids",		SYS_sidsys	},
988 	{ "futimens",		SYS_utimesys	},
989 	{ "utimensat",		SYS_utimesys	},
990 	{  NULL,	0	}	/* end-of-list */
991 };
992 
993 /*
994  * Return structure to interpret system call with sub-codes.
995  */
996 const struct systable *
997 subsys(int syscall, int subcode)
998 {
999 	const struct systable *stp = NULL;
1000 
1001 	if (subcode != -1) {
1002 		switch (syscall) {
1003 		case SYS_open:
1004 			if ((unsigned)subcode < NOPENCODE)
1005 				stp = &opentable[subcode];
1006 			break;
1007 		case SYS_open64:
1008 			if ((unsigned)subcode < NOPEN64CODE)
1009 				stp = &open64table[subcode];
1010 			break;
1011 		case SYS_msgsys:	/* msgsys() */
1012 			if ((unsigned)subcode < NMSGCODE)
1013 				stp = &msgtable[subcode];
1014 			break;
1015 		case SYS_semsys:	/* semsys() */
1016 			if ((unsigned)subcode < NSEMCODE)
1017 				stp = &semtable[subcode];
1018 			break;
1019 		case SYS_shmsys:	/* shmsys() */
1020 			if ((unsigned)subcode < NSHMCODE)
1021 				stp = &shmtable[subcode];
1022 			break;
1023 		case SYS_pgrpsys:	/* pgrpsys() */
1024 			if ((unsigned)subcode < NPIDCODE)
1025 				stp = &pidtable[subcode];
1026 			break;
1027 		case SYS_utssys:	/* utssys() */
1028 			if ((unsigned)subcode < NUTSCODE)
1029 				stp = &utstable[subcode];
1030 			break;
1031 		case SYS_sysfs:		/* sysfs() */
1032 			if ((unsigned)subcode < NSFSCODE)
1033 				stp = &sfstable[subcode];
1034 			break;
1035 		case SYS_sigpending:	/* sigpending()/sigfillset() */
1036 			if ((unsigned)subcode < NSGPCODE)
1037 				stp = &sgptable[subcode];
1038 			break;
1039 		case SYS_context:	/* [get|set]context() */
1040 			if ((unsigned)subcode < NCTXCODE)
1041 				stp = &ctxtable[subcode];
1042 			break;
1043 		case SYS_hrtsys:	/* hrtsys() */
1044 			if ((unsigned)subcode < NHRTCODE)
1045 				stp = &hrttable[subcode];
1046 			break;
1047 		case SYS_corectl:	/* corectl() */
1048 			if ((unsigned)subcode < NCORCODE)
1049 				stp = &cortable[subcode];
1050 			break;
1051 		case SYS_kaio:		/* kaio() */
1052 			if ((unsigned)subcode < NAIOCODE)
1053 				stp = &aiotable[subcode];
1054 			break;
1055 		case SYS_door:		/* doors */
1056 			if ((unsigned)subcode < NDOORCODE)
1057 				stp = &doortable[subcode];
1058 			break;
1059 		case SYS_pset:		/* pset() */
1060 			if ((unsigned)subcode < NPSETCODE)
1061 				stp = &psettable[subcode];
1062 			break;
1063 		case SYS_lwp_create:	/* lwp_create() */
1064 			if ((unsigned)subcode < NLWPCREATECODE)
1065 				stp = &lwpcreatetable[subcode];
1066 			break;
1067 		case SYS_tasksys:	/* tasks */
1068 			if ((unsigned)subcode < NTASKSYSCODE)
1069 				stp = &tasksystable[subcode];
1070 			break;
1071 		case SYS_exacctsys:	/* exacct */
1072 			if ((unsigned)subcode < NEXACCTSYSCODE)
1073 				stp = &exacctsystable[subcode];
1074 			break;
1075 		case SYS_fsat:
1076 			if ((unsigned)subcode < NFSATSYSCODE)
1077 				stp = &fsatsystable[subcode];
1078 			break;
1079 		case SYS_privsys:	/* privileges */
1080 			if ((unsigned)subcode < NPRIVSYSCODE)
1081 				stp = &privsystable[subcode];
1082 			break;
1083 		case SYS_lwp_park:	/* lwp_park */
1084 			if ((unsigned)subcode < NLWPPARKCODE)
1085 				stp = &lwpparktable[subcode];
1086 			break;
1087 		case SYS_lwp_rwlock_sys:
1088 			if ((unsigned)subcode < NLWPRWLOCKCODE)
1089 				stp = &lwprwlocktable[subcode];
1090 			break;
1091 		case SYS_sendfilev:	/* sendfilev */
1092 			if ((unsigned)subcode < NSENDFILESYSCODE)
1093 				stp = &sendfilevsystable[subcode];
1094 			break;
1095 		case SYS_lgrpsys:	/* lgrpsys */
1096 			if ((unsigned)subcode < NLGRPSYSCODE)
1097 				stp = &lgrpsystable[subcode];
1098 			break;
1099 		case SYS_rusagesys:	/* rusagesys */
1100 			if ((unsigned)subcode < NRUSAGESYSCODE)
1101 				stp = &rusagesystable[subcode];
1102 			break;
1103 		case SYS_fcntl:		/* fcntl */
1104 			if ((unsigned)subcode < NFCNTLCODE)
1105 				stp = &fcntltable[subcode];
1106 			break;
1107 		case SYS_ucredsys:
1108 			if ((unsigned)subcode < NUCREDSYSCODE)
1109 				stp = &ucredsystable[subcode];
1110 			break;
1111 		case SYS_port:	/* portfs */
1112 			if ((unsigned)subcode < NPORTCODE)
1113 				stp = &portfstable[subcode];
1114 			break;
1115 		case SYS_zone:		/* zone family */
1116 			if ((unsigned)subcode < NZONECODE)
1117 				stp = &zonetable[subcode];
1118 			break;
1119 		case SYS_labelsys:	/* label family */
1120 			if ((unsigned)subcode < NLABELCODE)
1121 				stp = &labeltable[subcode];
1122 			break;
1123 		case SYS_rctlsys:	/* rctl family */
1124 			if ((unsigned)subcode < NRCTLCODE)
1125 				stp = &rctltable[subcode];
1126 			break;
1127 		case SYS_forksys:	/* fork family */
1128 			if ((unsigned)subcode < NFORKCODE)
1129 				stp = &forktable[subcode];
1130 			break;
1131 		case SYS_sidsys:	/* SID family */
1132 			if ((unsigned)subcode < NSIDSYSCODE)
1133 				stp = &sidsystable[subcode];
1134 			break;
1135 		case SYS_utimesys:	/* utime family */
1136 			if ((unsigned)subcode < NUTIMESYSCODE)
1137 				stp = &utimesystable[subcode];
1138 			break;
1139 		}
1140 	}
1141 
1142 	if (stp == NULL)
1143 		stp = &systable[((unsigned)syscall < SYSEND)? syscall : 0];
1144 
1145 	return (stp);
1146 }
1147 
1148 /*
1149  * Return the name of the system call.
1150  */
1151 const char *
1152 sysname(private_t *pri, int syscall, int subcode)
1153 {
1154 	const struct systable *stp = subsys(syscall, subcode);
1155 	const char *name = stp->name;	/* may be NULL */
1156 
1157 	if (name == NULL) {		/* manufacture a name */
1158 		(void) sprintf(pri->sys_name, "sys#%d", syscall);
1159 		name = pri->sys_name;
1160 	}
1161 
1162 	return (name);
1163 }
1164 
1165 /*
1166  * Return the name of the signal.
1167  * Return NULL if unknown signal.
1168  */
1169 const char *
1170 rawsigname(private_t *pri, int sig)
1171 {
1172 	/*
1173 	 * The C library function sig2str() omits the leading "SIG".
1174 	 */
1175 	(void) strcpy(pri->raw_sig_name, "SIG");
1176 
1177 	if (sig > 0 && sig2str(sig, pri->raw_sig_name+3) == 0)
1178 		return (pri->raw_sig_name);
1179 	return (NULL);
1180 }
1181 
1182 /*
1183  * Return the name of the signal.
1184  * Manufacture a name for unknown signal.
1185  */
1186 const char *
1187 signame(private_t *pri, int sig)
1188 {
1189 	const char *name = rawsigname(pri, sig);
1190 
1191 	if (name == NULL) {			/* manufacture a name */
1192 		(void) sprintf(pri->sig_name, "SIG#%d", sig);
1193 		name = pri->sig_name;
1194 	}
1195 
1196 	return (name);
1197 }
1198 
1199 /*
1200  * Determine the subcode for this syscall, if any.
1201  */
1202 int
1203 getsubcode(private_t *pri)
1204 {
1205 	const lwpstatus_t *Lsp = pri->lwpstat;
1206 	int syscall = Lsp->pr_syscall;
1207 	int nsysarg = Lsp->pr_nsysarg;
1208 	int subcode = -1;
1209 	int arg0;
1210 
1211 	if (syscall > 0 && nsysarg > 0) {
1212 		arg0 = Lsp->pr_sysarg[0];
1213 		switch (syscall) {
1214 		case SYS_utssys:	/* utssys() */
1215 			if (nsysarg > 2)
1216 				subcode = Lsp->pr_sysarg[2];
1217 			break;
1218 		case SYS_open:		/* open() w/ and w/o O_CREAT */
1219 		case SYS_open64:
1220 			if (nsysarg > 1)
1221 				subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0;
1222 			break;
1223 		case SYS_fsat:
1224 			switch (arg0) {
1225 			case 0:  /* openat */
1226 				if (nsysarg > 3)
1227 					subcode =
1228 					    (Lsp->pr_sysarg[3] & O_CREAT) ?
1229 					    0 : NFSATSYSCODE - 2;
1230 				break;
1231 			case 1: /* openat64 */
1232 				if (nsysarg > 3)
1233 					subcode =
1234 					    (Lsp->pr_sysarg[3] & O_CREAT) ?
1235 					    1 : NFSATSYSCODE - 1;
1236 				break;
1237 			case 2:
1238 			case 3:
1239 			case 4:
1240 			case 5:
1241 			case 6:
1242 			case 7:
1243 			case 8:
1244 			case 9:
1245 				subcode = arg0;
1246 			}
1247 			break;
1248 		case SYS_kaio:		/* kaio() */
1249 			subcode = arg0 & ~AIO_POLL_BIT;
1250 			break;
1251 		case SYS_door:		/* doors */
1252 			if (nsysarg > 5)
1253 				subcode = Lsp->pr_sysarg[5];
1254 			break;
1255 		case SYS_lwp_create:	/* lwp_create() */
1256 			subcode =	/* 0 for parent, 1 for child */
1257 			    (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 &&
1258 			    Lsp->pr_rval1 == 0);
1259 			break;
1260 		case SYS_forksys:	/* forksys */
1261 			subcode = arg0;
1262 			if (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 &&
1263 			    pri->Rval2 != 0)	/* this is the child */
1264 				subcode += 3;
1265 			break;
1266 		case SYS_msgsys:	/* msgsys() */
1267 		case SYS_semsys:	/* semsys() */
1268 		case SYS_shmsys:	/* shmsys() */
1269 		case SYS_pgrpsys:	/* pgrpsys() */
1270 		case SYS_sysfs:		/* sysfs() */
1271 		case SYS_sigpending:	/* sigpending()/sigfillset() */
1272 		case SYS_context:	/* [get|set]context() */
1273 		case SYS_hrtsys:	/* hrtsys() */
1274 		case SYS_corectl:	/* corectl() */
1275 		case SYS_pset:		/* pset() */
1276 		case SYS_tasksys:	/* tasks */
1277 		case SYS_privsys:	/* privileges */
1278 		case SYS_exacctsys:	/* exacct */
1279 		case SYS_lwp_park:	/* lwp_park */
1280 		case SYS_lwp_rwlock_sys: /* lwp_rwlock_*() */
1281 		case SYS_sendfilev:	/* sendfilev */
1282 		case SYS_lgrpsys:	/* lgrpsys */
1283 		case SYS_rusagesys:	/* rusagesys */
1284 		case SYS_ucredsys:	/* ucredsys */
1285 		case SYS_zone:		/* zone */
1286 		case SYS_labelsys:	/* labelsys */
1287 		case SYS_rctlsys:	/* rctlsys */
1288 		case SYS_sidsys:	/* sidsys */
1289 		case SYS_utimesys:	/* utimesys */
1290 			subcode = arg0;
1291 			break;
1292 		case SYS_fcntl:		/* fcntl() */
1293 			if (nsysarg > 2) {
1294 				switch (Lsp->pr_sysarg[1]) {
1295 				default:	subcode = 0; break;
1296 				case F_GETFL:
1297 				case F_GETOWN:
1298 				case F_GETXFL:	subcode = 1; break;
1299 				case F_SETFL:	subcode = 2; break;
1300 				}
1301 			}
1302 			break;
1303 		case SYS_port:		/* portfs */
1304 			subcode = arg0 & PORT_CODE_MASK;
1305 			break;
1306 		}
1307 	}
1308 
1309 	return (subcode);
1310 }
1311 
1312 /*
1313  * Return the maximum number of system calls, counting
1314  * all system calls with subcodes as separate calls.
1315  */
1316 int
1317 maxsyscalls()
1318 {
1319 	return (PRMAXSYS + 1
1320 	    + NOPENCODE - 1
1321 	    + NOPEN64CODE - 1
1322 	    + NMSGCODE - 1
1323 	    + NSEMCODE - 1
1324 	    + NSHMCODE - 1
1325 	    + NPIDCODE - 1
1326 	    + NSFSCODE - 1
1327 	    + NUTSCODE - 1
1328 	    + NSGPCODE - 1
1329 	    + NCTXCODE - 1
1330 	    + NHRTCODE - 1
1331 	    + NCORCODE - 1
1332 	    + NAIOCODE - 1
1333 	    + NDOORCODE - 1
1334 	    + NPSETCODE - 1
1335 	    + NLWPCREATECODE - 1
1336 	    + NTASKSYSCODE - 1
1337 	    + NEXACCTSYSCODE - 1
1338 	    + NFSATSYSCODE - 1
1339 	    + NLWPPARKCODE - 1
1340 	    + NLWPRWLOCKCODE - 1
1341 	    + NSENDFILESYSCODE - 1
1342 	    + NLGRPSYSCODE - 1
1343 	    + NRUSAGESYSCODE - 1
1344 	    + NFCNTLCODE - 1
1345 	    + NPRIVSYSCODE - 1
1346 	    + NUCREDSYSCODE - 1
1347 	    + NPORTCODE - 1
1348 	    + NZONECODE - 1
1349 	    + NLABELCODE - 1
1350 	    + NRCTLCODE - 1
1351 	    + NFORKCODE - 1
1352 	    + NSIDSYSCODE - 1
1353 	    + NUTIMESYSCODE - 1);
1354 }
1355 
1356 /*
1357  * Return the number of subcodes for the specified system call number.
1358  */
1359 int
1360 nsubcodes(int syscall)
1361 {
1362 	switch (syscall) {
1363 	case SYS_open:
1364 		return (NOPENCODE);
1365 	case SYS_open64:
1366 		return (NOPEN64CODE);
1367 	case SYS_msgsys:	/* msgsys() */
1368 		return (NMSGCODE);
1369 	case SYS_semsys:	/* semsys() */
1370 		return (NSEMCODE);
1371 	case SYS_shmsys:	/* shmsys() */
1372 		return (NSHMCODE);
1373 	case SYS_pgrpsys:	/* pgrpsys() */
1374 		return (NPIDCODE);
1375 	case SYS_utssys:	/* utssys() */
1376 		return (NUTSCODE);
1377 	case SYS_sysfs:		/* sysfs() */
1378 		return (NSFSCODE);
1379 	case SYS_sigpending:	/* sigpending()/sigfillset() */
1380 		return (NSGPCODE);
1381 	case SYS_context:	/* [get|set]context() */
1382 		return (NCTXCODE);
1383 	case SYS_hrtsys:	/* hrtsys() */
1384 		return (NHRTCODE);
1385 	case SYS_corectl:	/* corectl() */
1386 		return (NCORCODE);
1387 	case SYS_kaio:		/* kaio() */
1388 		return (NAIOCODE);
1389 	case SYS_door:		/* doors */
1390 		return (NDOORCODE);
1391 	case SYS_pset:		/* pset() */
1392 		return (NPSETCODE);
1393 	case SYS_lwp_create:	/* lwp_create() */
1394 		return (NLWPCREATECODE);
1395 	case SYS_tasksys:	/* tasks */
1396 		return (NTASKSYSCODE);
1397 	case SYS_exacctsys:	/* exacct */
1398 		return (NEXACCTSYSCODE);
1399 	case SYS_fsat:
1400 		return (NFSATSYSCODE);
1401 	case SYS_privsys:	/* privileges */
1402 		return (NPRIVSYSCODE);
1403 	case SYS_lwp_park:	/* lwp_park */
1404 		return (NLWPPARKCODE);
1405 	case SYS_lwp_rwlock_sys:
1406 		return (NLWPRWLOCKCODE);
1407 	case SYS_sendfilev:	/* sendfilev */
1408 		return (NSENDFILESYSCODE);
1409 	case SYS_lgrpsys:	/* lgrpsys */
1410 		return (NLGRPSYSCODE);
1411 	case SYS_rusagesys:
1412 		return (NRUSAGESYSCODE);
1413 	case SYS_fcntl:
1414 		return (NFCNTLCODE);
1415 	case SYS_ucredsys:
1416 		return (NUCREDSYSCODE);
1417 	case SYS_port:
1418 		return (NPORTCODE);
1419 	case SYS_zone:		/* zone */
1420 		return (NZONECODE);
1421 	case SYS_labelsys:
1422 		return (NLABELCODE);
1423 	case SYS_rctlsys:
1424 		return (NRCTLCODE);
1425 	case SYS_forksys:
1426 		return (NFORKCODE);
1427 	case SYS_sidsys:
1428 		return (NSIDSYSCODE);
1429 	case SYS_utimesys:
1430 		return (NUTIMESYSCODE);
1431 	default:
1432 		return (1);
1433 	}
1434 }
1435 
1436 
1437 
1438 /* Socket address families (and protocol families) */
1439 const char * const afcodes[] = {
1440 	"UNSPEC",	/* 0 */
1441 	"UNIX",		/* 1 */
1442 	"INET",		/* 2 */
1443 	"IMPLINK",	/* 3 */
1444 	"PUP",		/* 4 */
1445 	"CHAOS",	/* 5 */
1446 	"NS",		/* 6 */
1447 	"NBS",		/* 7 */
1448 	"ECMA",		/* 8 */
1449 	"DATAKIT",	/* 9 */
1450 	"CCITT",	/* 10 */
1451 	"SNA",		/* 11 */
1452 	"DECnet",	/* 12 */
1453 	"DLI",		/* 13 */
1454 	"LAT",		/* 14 */
1455 	"HYLINK",	/* 15 */
1456 	"APPLETALK",	/* 16 */
1457 	"NIT",		/* 17 */
1458 	"802",		/* 18 */
1459 	"OSI",		/* 19 */
1460 	"X25",		/* 20 */
1461 	"OSINET",	/* 21 */
1462 	"GOSIP",	/* 22 */
1463 	"IPX",		/* 23 */
1464 	"ROUTE",	/* 24 */
1465 	"LINK",		/* 25 */
1466 	"INET6",	/* 26 */
1467 	"KEY",		/* 27 */
1468 	"NCA",		/* 28 */
1469 	"POLICY",	/* 29 */
1470 	"RDS",		/* 30 */
1471 	"TRILL",	/* 31 */
1472 	"PACKET"	/* 32 */
1473 };
1474 #if MAX_AFCODES != 33
1475 #error Need to update address-family table
1476 #endif
1477 
1478 
1479 const char * const socktype_codes[] = {		/* cf socket.h */
1480 	NULL,
1481 	"SOCK_DGRAM",		/* 1 */
1482 	"SOCK_STREAM",		/* 2 */
1483 	NULL,
1484 	"SOCK_RAW",		/* 4 */
1485 	"SOCK_RDM",		/* 5 */
1486 	"SOCK_SEQPACKET"	/* 6 */
1487 };
1488 #if MAX_SOCKTYPES != 7
1489 #error Need to update socket-type table
1490 #endif
1491