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