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