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