xref: /titanic_51/usr/src/cmd/truss/codes.c (revision 5c59319b8761ccd4b952eec8d5caecf298024607)
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 2009 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 #include <stdio.h>
31 #include <stdlib.h>
32 #include <unistd.h>
33 #include <sys/types.h>
34 #include <libproc.h>
35 
36 #include <ctype.h>
37 #include <string.h>
38 #include <sys/dlpi.h>
39 #include <sys/ipc.h>
40 #include <sys/ipc_impl.h>
41 #include <sys/msg.h>
42 #include <sys/sem.h>
43 #include <sys/shm.h>
44 #include <sys/fstyp.h>
45 #if defined(__i386) || defined(__amd64)
46 #include <sys/sysi86.h>
47 #endif /* __i386 */
48 #include <sys/unistd.h>
49 #include <sys/file.h>
50 #include <sys/tiuser.h>
51 #include <sys/timod.h>
52 #include <sys/stream.h>
53 #include <sys/stropts.h>
54 #include <sys/termios.h>
55 #include <sys/termiox.h>
56 #include <sys/jioctl.h>
57 #include <sys/filio.h>
58 #include <fcntl.h>
59 #include <sys/termio.h>
60 #include <sys/stermio.h>
61 #include <sys/ttold.h>
62 #include <sys/lock.h>
63 #include <sys/mount.h>
64 #include <sys/utssys.h>
65 #include <sys/sysconfig.h>
66 #include <sys/statvfs.h>
67 #include <sys/kstat.h>
68 #include <sys/audio.h>
69 #include <sys/mixer.h>
70 #include <sys/cpc_impl.h>
71 #include <sys/devpoll.h>
72 #include <sys/strredir.h>
73 #include <sys/sockio.h>
74 #include <netinet/ip_mroute.h>
75 #include <net/if.h>
76 #include <net/if_arp.h>
77 #include <sys/ptyvar.h>
78 #include <sys/des.h>
79 #include <sys/prnio.h>
80 #include <sys/dtrace.h>
81 #include <sys/crypto/ioctladmin.h>
82 #include <sys/crypto/ioctl.h>
83 #include <sys/kbio.h>
84 #include <sys/ptms.h>
85 #include <sys/aggr.h>
86 #include <sys/dld.h>
87 #include <sys/vnic.h>
88 #include <sys/fs/zfs.h>
89 #include <inet/kssl/kssl.h>
90 #include <sys/dkio.h>
91 #include <sys/dumpadm.h>
92 #include <sys/mntio.h>
93 #include <sys/zcons.h>
94 
95 #include "ramdata.h"
96 #include "proto.h"
97 
98 #define	FCNTLMIN	F_DUPFD
99 #define	FCNTLMAX	F_BADFD
100 const char *const FCNTLname[] = {
101 	"F_DUPFD",
102 	"F_GETFD",
103 	"F_SETFD",
104 	"F_GETFL",
105 	"F_SETFL",
106 	"F_O_GETLK",
107 	"F_SETLK",
108 	"F_SETLKW",
109 	"F_CHKFL",
110 	"F_DUP2FD",
111 	"F_ALLOCSP",
112 	"F_FREESP",
113 	NULL,		/* 12 */
114 	NULL,		/* 13 */
115 	"F_GETLK",
116 	NULL,		/* 15 */
117 	NULL,		/* 16 */
118 	NULL,		/* 17 */
119 	NULL,		/* 18 */
120 	NULL,		/* 19 */
121 	NULL,		/* 20 */
122 	NULL,		/* 21 */
123 	NULL,		/* 22 */
124 	"F_GETOWN",
125 	"F_SETOWN",
126 	"F_REVOKE",
127 	"F_HASREMOTELOCKS",
128 	"F_FREESP64",
129 	NULL,		/* 28 */
130 	NULL,		/* 29 */
131 	NULL,		/* 30 */
132 	NULL,		/* 31 */
133 	NULL,		/* 32 */
134 	"F_GETLK64",
135 	"F_SETLK64",
136 	"F_SETLKW64",
137 	NULL,		/* 36 */
138 	NULL,		/* 37 */
139 	NULL,		/* 38 */
140 	NULL,		/* 39 */
141 	"F_SHARE",
142 	"F_UNSHARE",
143 	"F_SETLK_NBMAND",
144 	"F_SHARE_NBMAND",
145 	"F_SETLK64_NBMAND",
146 	NULL,		/* 45 */
147 	"F_BADFD"
148 };
149 
150 #define	SYSFSMIN	GETFSIND
151 #define	SYSFSMAX	GETNFSTYP
152 const char *const SYSFSname[] = {
153 	"GETFSIND",
154 	"GETFSTYP",
155 	"GETNFSTYP"
156 };
157 
158 #define	PLOCKMIN	UNLOCK
159 #define	PLOCKMAX	DATLOCK
160 const char *const PLOCKname[] = {
161 	"UNLOCK",
162 	"PROCLOCK",
163 	"TXTLOCK",
164 	NULL,
165 	"DATLOCK"
166 };
167 
168 #define	SCONFMIN	_CONFIG_NGROUPS
169 #define	SCONFMAX	_CONFIG_EPHID_MAX
170 const char *const SCONFname[] = {
171 	"_CONFIG_NGROUPS",		/*  2 */
172 	"_CONFIG_CHILD_MAX",		/*  3 */
173 	"_CONFIG_OPEN_FILES",		/*  4 */
174 	"_CONFIG_POSIX_VER",		/*  5 */
175 	"_CONFIG_PAGESIZE",		/*  6 */
176 	"_CONFIG_CLK_TCK",		/*  7 */
177 	"_CONFIG_XOPEN_VER",		/*  8 */
178 	"_CONFIG_HRESCLK_TCK",		/*  9 */
179 	"_CONFIG_PROF_TCK",		/* 10 */
180 	"_CONFIG_NPROC_CONF",		/* 11 */
181 	"_CONFIG_NPROC_ONLN",		/* 12 */
182 	"_CONFIG_AIO_LISTIO_MAX",	/* 13 */
183 	"_CONFIG_AIO_MAX",		/* 14 */
184 	"_CONFIG_AIO_PRIO_DELTA_MAX",	/* 15 */
185 	"_CONFIG_DELAYTIMER_MAX",	/* 16 */
186 	"_CONFIG_MQ_OPEN_MAX",		/* 17 */
187 	"_CONFIG_MQ_PRIO_MAX",		/* 18 */
188 	"_CONFIG_RTSIG_MAX",		/* 19 */
189 	"_CONFIG_SEM_NSEMS_MAX",	/* 20 */
190 	"_CONFIG_SEM_VALUE_MAX",	/* 21 */
191 	"_CONFIG_SIGQUEUE_MAX",		/* 22 */
192 	"_CONFIG_SIGRT_MIN",		/* 23 */
193 	"_CONFIG_SIGRT_MAX",		/* 24 */
194 	"_CONFIG_TIMER_MAX",		/* 25 */
195 	"_CONFIG_PHYS_PAGES",		/* 26 */
196 	"_CONFIG_AVPHYS_PAGES",		/* 27 */
197 	"_CONFIG_COHERENCY",		/* 28 */
198 	"_CONFIG_SPLIT_CACHE",		/* 29 */
199 	"_CONFIG_ICACHESZ",		/* 30 */
200 	"_CONFIG_DCACHESZ",		/* 31 */
201 	"_CONFIG_ICACHELINESZ",		/* 32 */
202 	"_CONFIG_DCACHELINESZ",		/* 33 */
203 	"_CONFIG_ICACHEBLKSZ",		/* 34 */
204 	"_CONFIG_DCACHEBLKSZ",		/* 35 */
205 	"_CONFIG_DCACHETBLKSZ",		/* 36 */
206 	"_CONFIG_ICACHE_ASSOC",		/* 37 */
207 	"_CONFIG_DCACHE_ASSOC",		/* 38 */
208 	NULL,				/* 39 */
209 	NULL,				/* 40 */
210 	NULL,				/* 41 */
211 	"_CONFIG_MAXPID",		/* 42 */
212 	"_CONFIG_STACK_PROT",		/* 43 */
213 	"_CONFIG_NPROC_MAX",		/* 44 */
214 	"_CONFIG_CPUID_MAX",		/* 45 */
215 	"_CONFIG_SYMLOOP_MAX",		/* 46 */
216 	"_CONFIG_EPHID_MAX",		/* 47 */
217 };
218 
219 #define	PATHCONFMIN	_PC_LINK_MAX
220 #define	PATHCONFMAX	_PC_XATTR_EXISTS
221 const char *const PATHCONFname[] = {
222 	"_PC_LINK_MAX",			/*  1 */
223 	"_PC_MAX_CANON",		/*  2 */
224 	"_PC_MAX_INPUT",		/*  3 */
225 	"_PC_NAME_MAX",			/*  4 */
226 	"_PC_PATH_MAX",			/*  5 */
227 	"_PC_PIPE_BUF",			/*  6 */
228 	"_PC_NO_TRUNC",			/*  7 */
229 	"_PC_VDISABLE",			/*  8 */
230 	"_PC_CHOWN_RESTRICTED",		/*  9 */
231 	"_PC_ASYNC_IO",			/* 10 */
232 	"_PC_PRIO_IO",			/* 11 */
233 	"_PC_SYNC_IO",			/* 12 */
234 	"_PC_ALLOC_SIZE_MIN",		/* 13 */
235 	"_PC_REC_INCR_XFER_SIZE",	/* 14 */
236 	"_PC_REC_MAX_XFER_SIZE",	/* 15 */
237 	"_PC_REC_MIN_XFER_SIZE",	/* 16 */
238 	"_PC_REC_XFER_ALIGN",		/* 17 */
239 	"_PC_SYMLINK_MAX",		/* 18 */
240 	"_PC_2_SYMLINKS",		/* 19 */
241 	"_PC_ACL_ENABLED",		/* 20 */
242 	"_PC_MIN_HOLE_SIZE",		/* 21 */
243 	"_PC_CASE_BEHAVIOR",		/* 22 */
244 	"_PC_SATTR_ENABLED",		/* 23 */
245 	"_PC_SATTR_EXISTS",		/* 24 */
246 	NULL,				/* 25 */
247 	NULL,				/* 26 */
248 	NULL,				/* 27 */
249 	NULL,				/* 28 */
250 	NULL,				/* 29 */
251 	NULL,				/* 30 */
252 	NULL,				/* 31 */
253 	NULL,				/* 32 */
254 	NULL,				/* 33 */
255 	NULL,				/* 34 */
256 	NULL,				/* 35 */
257 	NULL,				/* 36 */
258 	NULL,				/* 37 */
259 	NULL,				/* 38 */
260 	NULL,				/* 39 */
261 	NULL,				/* 40 */
262 	NULL,				/* 41 */
263 	NULL,				/* 42 */
264 	NULL,				/* 43 */
265 	NULL,				/* 44 */
266 	NULL,				/* 45 */
267 	NULL,				/* 46 */
268 	NULL,				/* 47 */
269 	NULL,				/* 48 */
270 	NULL,				/* 49 */
271 	NULL,				/* 50 */
272 	NULL,				/* 51 */
273 	NULL,				/* 52 */
274 	NULL,				/* 53 */
275 	NULL,				/* 54 */
276 	NULL,				/* 55 */
277 	NULL,				/* 56 */
278 	NULL,				/* 57 */
279 	NULL,				/* 58 */
280 	NULL,				/* 59 */
281 	NULL,				/* 60 */
282 	NULL,				/* 61 */
283 	NULL,				/* 62 */
284 	NULL,				/* 63 */
285 	NULL,				/* 64 */
286 	NULL,				/* 65 */
287 	NULL,				/* 66 */
288 	"_PC_FILESIZEBITS",		/* 67 */
289 	NULL,				/* 68 */
290 	NULL,				/* 69 */
291 	NULL,				/* 70 */
292 	NULL,				/* 71 */
293 	NULL,				/* 72 */
294 	NULL,				/* 73 */
295 	NULL,				/* 74 */
296 	NULL,				/* 75 */
297 	NULL,				/* 76 */
298 	NULL,				/* 77 */
299 	NULL,				/* 78 */
300 	NULL,				/* 79 */
301 	NULL,				/* 80 */
302 	NULL,				/* 81 */
303 	NULL,				/* 82 */
304 	NULL,				/* 83 */
305 	NULL,				/* 84 */
306 	NULL,				/* 85 */
307 	NULL,				/* 86 */
308 	NULL,				/* 87 */
309 	NULL,				/* 88 */
310 	NULL,				/* 89 */
311 	NULL,				/* 90 */
312 	NULL,				/* 91 */
313 	NULL,				/* 92 */
314 	NULL,				/* 93 */
315 	NULL,				/* 94 */
316 	NULL,				/* 95 */
317 	NULL,				/* 96 */
318 	NULL,				/* 97 */
319 	NULL,				/* 98 */
320 	NULL,				/* 99 */
321 	"_PC_XATTR_ENABLED",		/* 100 */
322 	"_PC_XATTR_EXISTS",		/* 101, _PC_LAST */
323 };
324 
325 const struct ioc {
326 	uint_t	code;
327 	const char *name;
328 	const char *datastruct;
329 } ioc[] = {
330 	{ (uint_t)TCGETA,	"TCGETA",	NULL },
331 	{ (uint_t)TCSETA,	"TCSETA",	NULL },
332 	{ (uint_t)TCSETAW,	"TCSETAW",	NULL },
333 	{ (uint_t)TCSETAF,	"TCSETAF",	NULL },
334 	{ (uint_t)TCFLSH,	"TCFLSH",	NULL },
335 	{ (uint_t)TIOCKBON,	"TIOCKBON",	NULL },
336 	{ (uint_t)TIOCKBOF,	"TIOCKBOF",	NULL },
337 	{ (uint_t)KBENABLED,	"KBENABLED",	NULL },
338 	{ (uint_t)TCGETS,	"TCGETS",	NULL },
339 	{ (uint_t)TCSETS,	"TCSETS",	NULL },
340 	{ (uint_t)TCSETSW,	"TCSETSW",	NULL },
341 	{ (uint_t)TCSETSF,	"TCSETSF",	NULL },
342 	{ (uint_t)TCXONC,	"TCXONC",	NULL },
343 	{ (uint_t)TCSBRK,	"TCSBRK",	NULL },
344 	{ (uint_t)TCDSET,	"TCDSET",	NULL },
345 	{ (uint_t)RTS_TOG,	"RTS_TOG",	NULL },
346 	{ (uint_t)TIOCSWINSZ,	"TIOCSWINSZ",	NULL },
347 	{ (uint_t)TIOCGWINSZ,	"TIOCGWINSZ",	NULL },
348 	{ (uint_t)TIOCGETD,	"TIOCGETD",	NULL },
349 	{ (uint_t)TIOCSETD,	"TIOCSETD",	NULL },
350 	{ (uint_t)TIOCHPCL,	"TIOCHPCL",	NULL },
351 	{ (uint_t)TIOCGETP,	"TIOCGETP",	NULL },
352 	{ (uint_t)TIOCSETP,	"TIOCSETP",	NULL },
353 	{ (uint_t)TIOCSETN,	"TIOCSETN",	NULL },
354 	{ (uint_t)TIOCEXCL,	"TIOCEXCL",	NULL },
355 	{ (uint_t)TIOCNXCL,	"TIOCNXCL",	NULL },
356 	{ (uint_t)TIOCFLUSH,	"TIOCFLUSH",	NULL },
357 	{ (uint_t)TIOCSETC,	"TIOCSETC",	NULL },
358 	{ (uint_t)TIOCGETC,	"TIOCGETC",	NULL },
359 	{ (uint_t)TIOCGPGRP,	"TIOCGPGRP",	NULL },
360 	{ (uint_t)TIOCSPGRP,	"TIOCSPGRP",	NULL },
361 	{ (uint_t)TIOCGSID,	"TIOCGSID",	NULL },
362 	{ (uint_t)TIOCSTI,	"TIOCSTI",	NULL },
363 	{ (uint_t)TIOCMSET,	"TIOCMSET",	NULL },
364 	{ (uint_t)TIOCMBIS,	"TIOCMBIS",	NULL },
365 	{ (uint_t)TIOCMBIC,	"TIOCMBIC",	NULL },
366 	{ (uint_t)TIOCMGET,	"TIOCMGET",	NULL },
367 	{ (uint_t)TIOCREMOTE,	"TIOCREMOTE",	NULL },
368 	{ (uint_t)TIOCSIGNAL,	"TIOCSIGNAL",	NULL },
369 	{ (uint_t)TIOCSTART,	"TIOCSTART",	NULL },
370 	{ (uint_t)TIOCSTOP,	"TIOCSTOP",	NULL },
371 	{ (uint_t)TIOCNOTTY,	"TIOCNOTTY",	NULL },
372 	{ (uint_t)TIOCOUTQ,	"TIOCOUTQ",	NULL },
373 	{ (uint_t)TIOCGLTC,	"TIOCGLTC",	NULL },
374 	{ (uint_t)TIOCSLTC,	"TIOCSLTC",	NULL },
375 	{ (uint_t)TIOCCDTR,	"TIOCCDTR",	NULL },
376 	{ (uint_t)TIOCSDTR,	"TIOCSDTR",	NULL },
377 	{ (uint_t)TIOCCBRK,	"TIOCCBRK",	NULL },
378 	{ (uint_t)TIOCSBRK,	"TIOCSBRK",	NULL },
379 	{ (uint_t)TIOCLGET,	"TIOCLGET",	NULL },
380 	{ (uint_t)TIOCLSET,	"TIOCLSET",	NULL },
381 	{ (uint_t)TIOCLBIC,	"TIOCLBIC",	NULL },
382 	{ (uint_t)TIOCLBIS,	"TIOCLBIS",	NULL },
383 
384 	{ (uint_t)TIOCPKT,	"TIOCPKT",	NULL },	/* ptyvar.h */
385 	{ (uint_t)TIOCUCNTL,	"TIOCUCNTL",	NULL },
386 	{ (uint_t)TIOCTCNTL,	"TIOCTCNTL",	NULL },
387 	{ (uint_t)TIOCISPACE,	"TIOCISPACE",	NULL },
388 	{ (uint_t)TIOCISIZE,	"TIOCISIZE",	NULL },
389 	{ (uint_t)TIOCSSIZE,	"TIOCSSIZE",	"ttysize" },
390 	{ (uint_t)TIOCGSIZE,	"TIOCGSIZE",	"ttysize" },
391 
392 	/*
393 	 * Unfortunately, the DLIOC and LDIOC codes overlap.  Since the LDIOC
394 	 * ioctls (for xenix compatibility) are far less likely to be used, we
395 	 * give preference to DLIOC.
396 	 */
397 	{ (uint_t)DLIOCRAW,	"DLIOCRAW",	NULL },
398 	{ (uint_t)DLIOCNATIVE,	"DLIOCNATIVE",	NULL },
399 	{ (uint_t)DLIOCIPNETINFO, "DLIOCIPNETINFO", NULL},
400 
401 	{ (uint_t)LDOPEN,	"LDOPEN",	NULL },
402 	{ (uint_t)LDCLOSE,	"LDCLOSE",	NULL },
403 	{ (uint_t)LDCHG,	"LDCHG",	NULL },
404 	{ (uint_t)LDGETT,	"LDGETT",	NULL },
405 	{ (uint_t)LDSETT,	"LDSETT",	NULL },
406 	{ (uint_t)LDSMAP,	"LDSMAP",	NULL },
407 	{ (uint_t)LDGMAP,	"LDGMAP",	NULL },
408 	{ (uint_t)LDNMAP,	"LDNMAP",	NULL },
409 	{ (uint_t)TCGETX,	"TCGETX",	NULL },
410 	{ (uint_t)TCSETX,	"TCSETX",	NULL },
411 	{ (uint_t)TCSETXW,	"TCSETXW",	NULL },
412 	{ (uint_t)TCSETXF,	"TCSETXF",	NULL },
413 	{ (uint_t)FIORDCHK,	"FIORDCHK",	NULL },
414 	{ (uint_t)FIOCLEX,	"FIOCLEX",	NULL },
415 	{ (uint_t)FIONCLEX,	"FIONCLEX",	NULL },
416 	{ (uint_t)FIONREAD,	"FIONREAD",	NULL },
417 	{ (uint_t)FIONBIO,	"FIONBIO",	NULL },
418 	{ (uint_t)FIOASYNC,	"FIOASYNC",	NULL },
419 	{ (uint_t)FIOSETOWN,	"FIOSETOWN",	NULL },
420 	{ (uint_t)FIOGETOWN,	"FIOGETOWN",	NULL },
421 #ifdef DIOCGETP
422 	{ (uint_t)DIOCGETP,	"DIOCGETP",	NULL },
423 	{ (uint_t)DIOCSETP,	"DIOCSETP",	NULL },
424 #endif
425 #ifdef DIOCGETC
426 	{ (uint_t)DIOCGETC,	"DIOCGETC",	NULL },
427 	{ (uint_t)DIOCGETB,	"DIOCGETB",	NULL },
428 	{ (uint_t)DIOCSETE,	"DIOCSETE",	NULL },
429 #endif
430 #ifdef IFFORMAT
431 	{ (uint_t)IFFORMAT,	"IFFORMAT",	NULL },
432 	{ (uint_t)IFBCHECK,	"IFBCHECK",	NULL },
433 	{ (uint_t)IFCONFIRM,	"IFCONFIRM",	NULL },
434 #endif
435 #ifdef LIOCGETP
436 	{ (uint_t)LIOCGETP,	"LIOCGETP",	NULL },
437 	{ (uint_t)LIOCSETP,	"LIOCSETP",	NULL },
438 	{ (uint_t)LIOCGETS,	"LIOCGETS",	NULL },
439 	{ (uint_t)LIOCSETS,	"LIOCSETS",	NULL },
440 #endif
441 #ifdef JBOOT
442 	{ (uint_t)JBOOT,	"JBOOT",	NULL },
443 	{ (uint_t)JTERM,	"JTERM",	NULL },
444 	{ (uint_t)JMPX,		"JMPX",	NULL },
445 #ifdef JTIMO
446 	{ (uint_t)JTIMO,	"JTIMO",	NULL },
447 #endif
448 	{ (uint_t)JWINSIZE,	"JWINSIZE",	NULL },
449 	{ (uint_t)JTIMOM,	"JTIMOM",	NULL },
450 	{ (uint_t)JZOMBOOT,	"JZOMBOOT",	NULL },
451 	{ (uint_t)JAGENT,	"JAGENT",	NULL },
452 	{ (uint_t)JTRUN,	"JTRUN",	NULL },
453 	{ (uint_t)JXTPROTO,	"JXTPROTO",	NULL },
454 #endif
455 	{ (uint_t)KSTAT_IOC_CHAIN_ID,	"KSTAT_IOC_CHAIN_ID",	NULL },
456 	{ (uint_t)KSTAT_IOC_READ,	"KSTAT_IOC_READ",	NULL },
457 	{ (uint_t)KSTAT_IOC_WRITE,	"KSTAT_IOC_WRITE",	NULL },
458 	{ (uint_t)STGET,	"STGET",	NULL },
459 	{ (uint_t)STSET,	"STSET",	NULL },
460 	{ (uint_t)STTHROW,	"STTHROW",	NULL },
461 	{ (uint_t)STWLINE,	"STWLINE",	NULL },
462 	{ (uint_t)STTSV,	"STTSV",	NULL },
463 	{ (uint_t)I_NREAD,	"I_NREAD",	NULL },
464 	{ (uint_t)I_PUSH,	"I_PUSH",	NULL },
465 	{ (uint_t)I_POP,	"I_POP",	NULL },
466 	{ (uint_t)I_LOOK,	"I_LOOK",	NULL },
467 	{ (uint_t)I_FLUSH,	"I_FLUSH",	NULL },
468 	{ (uint_t)I_SRDOPT,	"I_SRDOPT",	NULL },
469 	{ (uint_t)I_GRDOPT,	"I_GRDOPT",	NULL },
470 	{ (uint_t)I_STR,	"I_STR",	NULL },
471 	{ (uint_t)I_SETSIG,	"I_SETSIG",	NULL },
472 	{ (uint_t)I_GETSIG,	"I_GETSIG",	NULL },
473 	{ (uint_t)I_FIND,	"I_FIND",	NULL },
474 	{ (uint_t)I_LINK,	"I_LINK",	NULL },
475 	{ (uint_t)I_UNLINK,	"I_UNLINK",	NULL },
476 	{ (uint_t)I_PEEK,	"I_PEEK",	NULL },
477 	{ (uint_t)I_FDINSERT,	"I_FDINSERT",	NULL },
478 	{ (uint_t)I_SENDFD,	"I_SENDFD",	NULL },
479 	{ (uint_t)I_RECVFD,	"I_RECVFD",	NULL },
480 	{ (uint_t)I_SWROPT,	"I_SWROPT",	NULL },
481 	{ (uint_t)I_GWROPT,	"I_GWROPT",	NULL },
482 	{ (uint_t)I_LIST,	"I_LIST",	NULL },
483 	{ (uint_t)I_PLINK,	"I_PLINK",	NULL },
484 	{ (uint_t)I_PUNLINK,	"I_PUNLINK",	NULL },
485 	{ (uint_t)I_FLUSHBAND,	"I_FLUSHBAND",	NULL },
486 	{ (uint_t)I_CKBAND,	"I_CKBAND",	NULL },
487 	{ (uint_t)I_GETBAND,	"I_GETBAND",	NULL },
488 	{ (uint_t)I_ATMARK,	"I_ATMARK",	NULL },
489 	{ (uint_t)I_SETCLTIME,	"I_SETCLTIME",	NULL },
490 	{ (uint_t)I_GETCLTIME,	"I_GETCLTIME",	NULL },
491 	{ (uint_t)I_CANPUT,	"I_CANPUT",	NULL },
492 	{ (uint_t)I_ANCHOR,	"I_ANCHOR",	NULL },
493 	{ (uint_t)_I_CMD,	"_I_CMD",	NULL },
494 #ifdef TI_GETINFO
495 	{ (uint_t)TI_GETINFO,	"TI_GETINFO",	NULL },
496 	{ (uint_t)TI_OPTMGMT,	"TI_OPTMGMT",	NULL },
497 	{ (uint_t)TI_BIND,	"TI_BIND",	NULL },
498 	{ (uint_t)TI_UNBIND,	"TI_UNBIND",	NULL },
499 #endif
500 #ifdef	TI_CAPABILITY
501 	{ (uint_t)TI_CAPABILITY,	"TI_CAPABILITY",	NULL },
502 #endif
503 #ifdef TI_GETMYNAME
504 	{ (uint_t)TI_GETMYNAME,		"TI_GETMYNAME",		NULL },
505 	{ (uint_t)TI_GETPEERNAME,	"TI_GETPEERNAME",	NULL },
506 	{ (uint_t)TI_SETMYNAME,		"TI_SETMYNAME",		NULL },
507 	{ (uint_t)TI_SETPEERNAME,	"TI_SETPEERNAME",	NULL },
508 #endif
509 #ifdef V_PREAD
510 	{ (uint_t)V_PREAD,	"V_PREAD",	NULL },
511 	{ (uint_t)V_PWRITE,	"V_PWRITE",	NULL },
512 	{ (uint_t)V_PDREAD,	"V_PDREAD",	NULL },
513 	{ (uint_t)V_PDWRITE,	"V_PDWRITE",	NULL },
514 #if !defined(__i386) && !defined(__amd64)
515 	{ (uint_t)V_GETSSZ,	"V_GETSSZ",	NULL },
516 #endif /* !__i386 */
517 #endif
518 	/* audio */
519 	{ (uint_t)AUDIO_GETINFO,	"AUDIO_GETINFO",	NULL },
520 	{ (uint_t)AUDIO_SETINFO,	"AUDIO_SETINFO",	NULL },
521 	{ (uint_t)AUDIO_DRAIN,		"AUDIO_DRAIN",		NULL },
522 	{ (uint_t)AUDIO_GETDEV,		"AUDIO_GETDEV",		NULL },
523 	{ (uint_t)AUDIO_DIAG_LOOPBACK,	"AUDIO_DIAG_LOOPBACK",	NULL },
524 	{ (uint_t)AUDIO_GET_CH_NUMBER,	"AUDIO_GET_CH_NUMBER",	NULL },
525 	{ (uint_t)AUDIO_GET_CH_TYPE,	"AUDIO_GET_CH_TYPE",	NULL },
526 	{ (uint_t)AUDIO_GET_NUM_CHS,	"AUDIO_GET_NUM_CHS",	NULL },
527 	{ (uint_t)AUDIO_GET_AD_DEV,	"AUDIO_GET_AD_DEV",	NULL },
528 	{ (uint_t)AUDIO_GET_APM_DEV,	"AUDIO_GET_APM_DEV",	NULL },
529 	{ (uint_t)AUDIO_GET_AS_DEV,	"AUDIO_GET_AS_DEV",	NULL },
530 	{ (uint_t)AUDIO_MIXER_MULTIPLE_OPEN,	"AUDIO_MIXER_MULTIPLE_OPEN",
531 	    NULL },
532 	{ (uint_t)AUDIO_MIXER_SINGLE_OPEN,	"AUDIO_MIXER_SINGLE_OPEN",
533 	    NULL },
534 	{ (uint_t)AUDIO_MIXER_GET_SAMPLE_RATES,	"AUDIO_MIXER_GET_SAMPLE_RATES",
535 	    NULL },
536 	{ (uint_t)AUDIO_MIXERCTL_GETINFO,	"AUDIO_MIXERCTL_GETINFO",
537 	    NULL },
538 	{ (uint_t)AUDIO_MIXERCTL_SETINFO,	"AUDIO_MIXERCTL_SETINFO",
539 	    NULL },
540 	{ (uint_t)AUDIO_MIXERCTL_GET_CHINFO,	"AUDIO_MIXERCTL_GET_CHINFO",
541 	    NULL },
542 	{ (uint_t)AUDIO_MIXERCTL_SET_CHINFO,	"AUDIO_MIXERCTL_SET_CHINFO",
543 	    NULL },
544 	{ (uint_t)AUDIO_MIXERCTL_GET_MODE,	"AUDIO_MIXERCTL_GET_MODE",
545 	    NULL },
546 	{ (uint_t)AUDIO_MIXERCTL_SET_MODE,	"AUDIO_MIXERCTL_SET_MODE",
547 	    NULL },
548 	/* STREAMS redirection ioctls */
549 	{ (uint_t)SRIOCSREDIR,		"SRIOCSREDIR",	NULL },
550 	{ (uint_t)SRIOCISREDIR,		"SRIOCISREDIR",	NULL },
551 	{ (uint_t)CPCIO_BIND,		"CPCIO_BIND",		NULL },
552 	{ (uint_t)CPCIO_SAMPLE,		"CPCIO_SAMPLE",		NULL },
553 	{ (uint_t)CPCIO_RELE,		"CPCIO_RELE",		NULL },
554 	/* /dev/poll ioctl() control codes */
555 	{ (uint_t)DP_POLL,	"DP_POLL",	NULL },
556 	{ (uint_t)DP_ISPOLLED,	"DP_ISPOLLED",	NULL },
557 	/* the old /proc ioctl() control codes */
558 #define	PIOC	('q'<<8)
559 	{ (uint_t)(PIOC|1),	"PIOCSTATUS",	NULL },
560 	{ (uint_t)(PIOC|2),	"PIOCSTOP",	NULL },
561 	{ (uint_t)(PIOC|3),	"PIOCWSTOP",	NULL },
562 	{ (uint_t)(PIOC|4),	"PIOCRUN",	NULL },
563 	{ (uint_t)(PIOC|5),	"PIOCGTRACE",	NULL },
564 	{ (uint_t)(PIOC|6),	"PIOCSTRACE",	NULL },
565 	{ (uint_t)(PIOC|7),	"PIOCSSIG",	NULL },
566 	{ (uint_t)(PIOC|8),	"PIOCKILL",	NULL },
567 	{ (uint_t)(PIOC|9),	"PIOCUNKILL",	NULL },
568 	{ (uint_t)(PIOC|10),	"PIOCGHOLD",	NULL },
569 	{ (uint_t)(PIOC|11),	"PIOCSHOLD",	NULL },
570 	{ (uint_t)(PIOC|12),	"PIOCMAXSIG",	NULL },
571 	{ (uint_t)(PIOC|13),	"PIOCACTION",	NULL },
572 	{ (uint_t)(PIOC|14),	"PIOCGFAULT",	NULL },
573 	{ (uint_t)(PIOC|15),	"PIOCSFAULT",	NULL },
574 	{ (uint_t)(PIOC|16),	"PIOCCFAULT",	NULL },
575 	{ (uint_t)(PIOC|17),	"PIOCGENTRY",	NULL },
576 	{ (uint_t)(PIOC|18),	"PIOCSENTRY",	NULL },
577 	{ (uint_t)(PIOC|19),	"PIOCGEXIT",	NULL },
578 	{ (uint_t)(PIOC|20),	"PIOCSEXIT",	NULL },
579 	{ (uint_t)(PIOC|21),	"PIOCSFORK",	NULL },
580 	{ (uint_t)(PIOC|22),	"PIOCRFORK",	NULL },
581 	{ (uint_t)(PIOC|23),	"PIOCSRLC",	NULL },
582 	{ (uint_t)(PIOC|24),	"PIOCRRLC",	NULL },
583 	{ (uint_t)(PIOC|25),	"PIOCGREG",	NULL },
584 	{ (uint_t)(PIOC|26),	"PIOCSREG",	NULL },
585 	{ (uint_t)(PIOC|27),	"PIOCGFPREG",	NULL },
586 	{ (uint_t)(PIOC|28),	"PIOCSFPREG",	NULL },
587 	{ (uint_t)(PIOC|29),	"PIOCNICE",	NULL },
588 	{ (uint_t)(PIOC|30),	"PIOCPSINFO",	NULL },
589 	{ (uint_t)(PIOC|31),	"PIOCNMAP",	NULL },
590 	{ (uint_t)(PIOC|32),	"PIOCMAP",	NULL },
591 	{ (uint_t)(PIOC|33),	"PIOCOPENM",	NULL },
592 	{ (uint_t)(PIOC|34),	"PIOCCRED",	NULL },
593 	{ (uint_t)(PIOC|35),	"PIOCGROUPS",	NULL },
594 	{ (uint_t)(PIOC|36),	"PIOCGETPR",	NULL },
595 	{ (uint_t)(PIOC|37),	"PIOCGETU",	NULL },
596 	{ (uint_t)(PIOC|38),	"PIOCSET",	NULL },
597 	{ (uint_t)(PIOC|39),	"PIOCRESET",	NULL },
598 	{ (uint_t)(PIOC|43),	"PIOCUSAGE",	NULL },
599 	{ (uint_t)(PIOC|44),	"PIOCOPENPD",	NULL },
600 	{ (uint_t)(PIOC|45),	"PIOCLWPIDS",	NULL },
601 	{ (uint_t)(PIOC|46),	"PIOCOPENLWP",	NULL },
602 	{ (uint_t)(PIOC|47),	"PIOCLSTATUS",	NULL },
603 	{ (uint_t)(PIOC|48),	"PIOCLUSAGE",	NULL },
604 	{ (uint_t)(PIOC|49),	"PIOCNAUXV",	NULL },
605 	{ (uint_t)(PIOC|50),	"PIOCAUXV",	NULL },
606 	{ (uint_t)(PIOC|51),	"PIOCGXREGSIZE",	NULL },
607 	{ (uint_t)(PIOC|52),	"PIOCGXREG",	NULL },
608 	{ (uint_t)(PIOC|53),	"PIOCSXREG",	NULL },
609 	{ (uint_t)(PIOC|101),	"PIOCGWIN",	NULL },
610 	{ (uint_t)(PIOC|103),	"PIOCNLDT",	NULL },
611 	{ (uint_t)(PIOC|104),	"PIOCLDT",	NULL },
612 
613 	/* ioctl's applicable on sockets */
614 	{ (uint_t)SIOCSHIWAT,	"SIOCSHIWAT",	NULL },
615 	{ (uint_t)SIOCGHIWAT,	"SIOCGHIWAT",	NULL },
616 	{ (uint_t)SIOCSLOWAT,	"SIOCSLOWAT",	NULL },
617 	{ (uint_t)SIOCGLOWAT,	"SIOCGLOWAT",	NULL },
618 	{ (uint_t)SIOCATMARK,	"SIOCATMARK",	NULL },
619 	{ (uint_t)SIOCSPGRP,	"SIOCSPGRP",	NULL },
620 	{ (uint_t)SIOCGPGRP,	"SIOCGPGRP",	NULL },
621 	{ (uint_t)SIOCADDRT,	"SIOCADDRT",	"rtentry" },
622 	{ (uint_t)SIOCDELRT,	"SIOCDELRT",	"rtentry" },
623 	{ (uint_t)SIOCGETVIFCNT,	"SIOCGETVIFCNT", "sioc_vif_req" },
624 	{ (uint_t)SIOCGETSGCNT,	"SIOCGETSGCNT",	"sioc_sg_req" },
625 	{ (uint_t)SIOCGETLSGCNT,	"SIOCGETLSGCNT", "sioc_lsg_req" },
626 	{ (uint_t)SIOCSIFADDR,	"SIOCSIFADDR",	"ifreq" },
627 	{ (uint_t)SIOCGIFADDR,	"SIOCGIFADDR",	"ifreq" },
628 	{ (uint_t)SIOCSIFDSTADDR,	"SIOCSIFDSTADDR", "ifreq" },
629 	{ (uint_t)SIOCGIFDSTADDR,	"SIOCGIFDSTADDR", "ifreq" },
630 	{ (uint_t)SIOCSIFFLAGS,	"SIOCSIFFLAGS",	"ifreq" },
631 	{ (uint_t)SIOCGIFFLAGS,	"SIOCGIFFLAGS",	"ifreq" },
632 	{ (uint_t)SIOCSIFMEM,	"SIOCSIFMEM",	"ifreq" },
633 	{ (uint_t)SIOCGIFMEM,	"SIOCGIFMEM",	"ifreq" },
634 	{ (uint_t)SIOCGIFCONF,	"SIOCGIFCONF",	"ifconf" },
635 	{ (uint_t)SIOCSIFMTU,	"SIOCSIFMTU",	"ifreq" },
636 	{ (uint_t)SIOCGIFMTU,	"SIOCGIFMTU",	"ifreq" },
637 	{ (uint_t)SIOCGIFBRDADDR,	"SIOCGIFBRDADDR",	"ifreq" },
638 	{ (uint_t)SIOCSIFBRDADDR,	"SIOCSIFBRDADDR",	"ifreq" },
639 	{ (uint_t)SIOCGIFNETMASK,	"SIOCGIFNETMASK",	"ifreq" },
640 	{ (uint_t)SIOCSIFNETMASK,	"SIOCSIFNETMASK",	"ifreq" },
641 	{ (uint_t)SIOCGIFMETRIC,	"SIOCGIFMETRIC",	"ifreq" },
642 	{ (uint_t)SIOCSIFMETRIC,	"SIOCSIFMETRIC",	"ifreq" },
643 	{ (uint_t)SIOCSARP,	"SIOCSARP",	"arpreq" },
644 	{ (uint_t)SIOCGARP,	"SIOCGARP",	"arpreq" },
645 	{ (uint_t)SIOCDARP,	"SIOCDARP",	"arpreq" },
646 	{ (uint_t)SIOCUPPER,	"SIOCUPPER",	"ifreq" },
647 	{ (uint_t)SIOCLOWER,	"SIOCLOWER",	"ifreq" },
648 	{ (uint_t)SIOCSETSYNC,	"SIOCSETSYNC",	"ifreq" },
649 	{ (uint_t)SIOCGETSYNC,	"SIOCGETSYNC",	"ifreq" },
650 	{ (uint_t)SIOCSSDSTATS,	"SIOCSSDSTATS",	"ifreq" },
651 	{ (uint_t)SIOCSSESTATS,	"SIOCSSESTATS",	"ifreq" },
652 	{ (uint_t)SIOCSPROMISC,	"SIOCSPROMISC",	NULL },
653 	{ (uint_t)SIOCADDMULTI,	"SIOCADDMULTI",	"ifreq" },
654 	{ (uint_t)SIOCDELMULTI,	"SIOCDELMULTI",	"ifreq" },
655 	{ (uint_t)SIOCGETNAME,	"SIOCGETNAME",	"sockaddr" },
656 	{ (uint_t)SIOCGETPEER,	"SIOCGETPEER",	"sockaddr" },
657 	{ (uint_t)IF_UNITSEL,	"IF_UNITSEL",	NULL },
658 	{ (uint_t)SIOCXPROTO,	"SIOCXPROTO",	NULL },
659 	{ (uint_t)SIOCIFDETACH,	"SIOCIFDETACH",	"ifreq" },
660 	{ (uint_t)SIOCGENPSTATS,	"SIOCGENPSTATS",	"ifreq" },
661 	{ (uint_t)SIOCX25XMT,	"SIOCX25XMT",	"ifreq" },
662 	{ (uint_t)SIOCX25RCV,	"SIOCX25RCV",	"ifreq" },
663 	{ (uint_t)SIOCX25TBL,	"SIOCX25TBL",	"ifreq" },
664 	{ (uint_t)SIOCSLGETREQ,	"SIOCSLGETREQ",	"ifreq" },
665 	{ (uint_t)SIOCSLSTAT,	"SIOCSLSTAT",	"ifreq" },
666 	{ (uint_t)SIOCSIFNAME,	"SIOCSIFNAME",	"ifreq" },
667 	{ (uint_t)SIOCGENADDR,	"SIOCGENADDR",	"ifreq" },
668 	{ (uint_t)SIOCGIFNUM,	"SIOCGIFNUM",	NULL },
669 	{ (uint_t)SIOCGIFMUXID,	"SIOCGIFMUXID",	"ifreq" },
670 	{ (uint_t)SIOCSIFMUXID,	"SIOCSIFMUXID",	"ifreq" },
671 	{ (uint_t)SIOCGIFINDEX,	"SIOCGIFINDEX",	"ifreq" },
672 	{ (uint_t)SIOCSIFINDEX,	"SIOCSIFINDEX",	"ifreq" },
673 	{ (uint_t)SIOCLIFREMOVEIF,	"SIOCLIFREMOVEIF",	"lifreq" },
674 	{ (uint_t)SIOCLIFADDIF,		"SIOCLIFADDIF",		"lifreq" },
675 	{ (uint_t)SIOCSLIFADDR,		"SIOCSLIFADDR",		"lifreq" },
676 	{ (uint_t)SIOCGLIFADDR,		"SIOCGLIFADDR",		"lifreq" },
677 	{ (uint_t)SIOCSLIFDSTADDR,	"SIOCSLIFDSTADDR",	"lifreq" },
678 	{ (uint_t)SIOCGLIFDSTADDR,	"SIOCGLIFDSTADDR",	"lifreq" },
679 	{ (uint_t)SIOCSLIFFLAGS,	"SIOCSLIFFLAGS",	"lifreq" },
680 	{ (uint_t)SIOCGLIFFLAGS,	"SIOCGLIFFLAGS",	"lifreq" },
681 	{ (uint_t)SIOCGLIFCONF,		"SIOCGLIFCONF",		"lifconf" },
682 	{ (uint_t)SIOCSLIFMTU,		"SIOCSLIFMTU",		"lifreq" },
683 	{ (uint_t)SIOCGLIFMTU,		"SIOCGLIFMTU",		"lifreq" },
684 	{ (uint_t)SIOCGLIFBRDADDR,	"SIOCGLIFBRDADDR",	"lifreq" },
685 	{ (uint_t)SIOCSLIFBRDADDR,	"SIOCSLIFBRDADDR",	"lifreq" },
686 	{ (uint_t)SIOCGLIFNETMASK,	"SIOCGLIFNETMASK",	"lifreq" },
687 	{ (uint_t)SIOCSLIFNETMASK,	"SIOCSLIFNETMASK",	"lifreq" },
688 	{ (uint_t)SIOCGLIFMETRIC,	"SIOCGLIFMETRIC",	"lifreq" },
689 	{ (uint_t)SIOCSLIFMETRIC,	"SIOCSLIFMETRIC",	"lifreq" },
690 	{ (uint_t)SIOCSLIFNAME,		"SIOCSLIFNAME",		"lifreq" },
691 	{ (uint_t)SIOCGLIFNUM,		"SIOCGLIFNUM",		"lifnum" },
692 	{ (uint_t)SIOCGLIFMUXID,	"SIOCGLIFMUXID",	"lifreq" },
693 	{ (uint_t)SIOCSLIFMUXID,	"SIOCSLIFMUXID",	"lifreq" },
694 	{ (uint_t)SIOCGLIFINDEX,	"SIOCGLIFINDEX",	"lifreq" },
695 	{ (uint_t)SIOCSLIFINDEX,	"SIOCSLIFINDEX",	"lifreq" },
696 	{ (uint_t)SIOCSLIFTOKEN,	"SIOCSLIFTOKEN",	"lifreq" },
697 	{ (uint_t)SIOCGLIFTOKEN,	"SIOCGLIFTOKEN",	"lifreq" },
698 	{ (uint_t)SIOCSLIFSUBNET,	"SIOCSLIFSUBNET",	"lifreq" },
699 	{ (uint_t)SIOCGLIFSUBNET,	"SIOCGLIFSUBNET",	"lifreq" },
700 	{ (uint_t)SIOCSLIFLNKINFO,	"SIOCSLIFLNKINFO",	"lifreq" },
701 	{ (uint_t)SIOCGLIFLNKINFO,	"SIOCGLIFLNKINFO",	"lifreq" },
702 	{ (uint_t)SIOCLIFDELND,		"SIOCLIFDELND",		"lifreq" },
703 	{ (uint_t)SIOCLIFGETND,		"SIOCLIFGETND",		"lifreq" },
704 	{ (uint_t)SIOCLIFSETND,		"SIOCLIFSETND",		"lifreq" },
705 	{ (uint_t)SIOCTMYADDR,		"SIOCTMYADDR",	"sioc_addrreq" },
706 	{ (uint_t)SIOCTONLINK,		"SIOCTONLINK",	"sioc_addrreq" },
707 	{ (uint_t)SIOCTMYSITE,		"SIOCTMYSITE",	"sioc_addrreq" },
708 	{ (uint_t)SIOCGTUNPARAM,        "SIOCGTUNPARAM",        "iftun_req" },
709 	{ (uint_t)SIOCSTUNPARAM,        "SIOCSTUNPARAM",        "iftun_req" },
710 	{ (uint_t)SIOCFIPSECONFIG,	"SIOCFIPSECONFIG",	NULL },
711 	{ (uint_t)SIOCSIPSECONFIG,	"SIOCSIPSECONFIG",	NULL },
712 	{ (uint_t)SIOCDIPSECONFIG,	"SIOCDIPSECONFIG",	NULL },
713 	{ (uint_t)SIOCLIPSECONFIG,	"SIOCLIPSECONFIG",	NULL },
714 	{ (uint_t)SIOCGLIFBINDING,	"SIOCGLIFBINDING",	"lifreq" },
715 	{ (uint_t)SIOCSLIFGROUPNAME,	"SIOCSLIFGROUPNAME",	"lifreq" },
716 	{ (uint_t)SIOCGLIFGROUPNAME,	"SIOCGLIFGROUPNAME",	"lifreq" },
717 	{ (uint_t)SIOCGLIFGROUPINFO,	"SIOCGLIFGROUPINFO", "lifgroupinfo" },
718 	{ (uint_t)SIOCGDSTINFO,		"SIOCGDSTINFO",		NULL },
719 	{ (uint_t)SIOCGIP6ADDRPOLICY,	"SIOCGIP6ADDRPOLICY",	NULL },
720 	{ (uint_t)SIOCSIP6ADDRPOLICY,	"SIOCSIP6ADDRPOLICY", 	NULL },
721 	{ (uint_t)SIOCSXARP,		"SIOCSXARP",		"xarpreq" },
722 	{ (uint_t)SIOCGXARP,		"SIOCGXARP",		"xarpreq" },
723 	{ (uint_t)SIOCDXARP,		"SIOCDXARP",		"xarpreq" },
724 	{ (uint_t)SIOCGLIFZONE,		"SIOCGLIFZONE",		"lifreq" },
725 	{ (uint_t)SIOCSLIFZONE,		"SIOCSLIFZONE",		"lifreq" },
726 	{ (uint_t)SIOCSCTPSOPT,		"SIOCSCTPSOPT",		NULL },
727 	{ (uint_t)SIOCSCTPGOPT,		"SIOCSCTPGOPT",		NULL },
728 	{ (uint_t)SIOCSCTPPEELOFF,	"SIOPCSCTPPEELOFF",	"int" },
729 	{ (uint_t)SIOCGLIFUSESRC,	"SIOCGLIFUSESRC",	"lifreq" },
730 	{ (uint_t)SIOCSLIFUSESRC,	"SIOCSLIFUSESRC",	"lifreq" },
731 	{ (uint_t)SIOCGLIFSRCOF,	"SIOCGLIFSRCOF",	"lifsrcof" },
732 	{ (uint_t)SIOCGMSFILTER,	"SIOCGMSFILTER",    "group_filter" },
733 	{ (uint_t)SIOCSMSFILTER,	"SIOCSMSFILTER",    "group_filter" },
734 	{ (uint_t)SIOCGIPMSFILTER,	"SIOCGIPMSFILTER",  "ip_msfilter" },
735 	{ (uint_t)SIOCSIPMSFILTER,	"SIOCSIPMSFILTER",  "ip_msfilter" },
736 
737 	/* DES encryption */
738 	{ (uint_t)DESIOCBLOCK,	"DESIOCBLOCK", 	"desparams" },
739 	{ (uint_t)DESIOCQUICK,	"DESIOCQUICK", 	"desparams" },
740 
741 	/* Printing system */
742 	{ (uint_t)PRNIOC_GET_IFCAP,	"PRNIOC_GET_IFCAP", 	NULL },
743 	{ (uint_t)PRNIOC_SET_IFCAP,	"PRNIOC_SET_IFCAP", 	NULL },
744 	{ (uint_t)PRNIOC_GET_IFINFO,	"PRNIOC_GET_IFINFO",
745 	    "prn_interface_info" },
746 	{ (uint_t)PRNIOC_GET_STATUS,	"PRNIOC_GET_STATUS", 	NULL },
747 	{ (uint_t)PRNIOC_GET_1284_DEVID,	"PRNIOC_GET_1284_DEVID",
748 	    "prn_1284_device_id" },
749 	{ (uint_t)PRNIOC_GET_1284_STATUS,
750 	    "PRNIOC_GET_IFCANIOC_GET_1284_STATUS", NULL },
751 	{ (uint_t)PRNIOC_GET_TIMEOUTS,	"PRNIOC_GET_TIMEOUTS",
752 	    "prn_timeouts" },
753 	{ (uint_t)PRNIOC_SET_TIMEOUTS,	"PRNIOC_SET_TIMEOUTS",
754 	    "prn_timeouts" },
755 	{ (uint_t)PRNIOC_RESET,	"PRNIOC_RESET", 	NULL },
756 
757 	/* DTrace */
758 	{ (uint_t)DTRACEIOC_PROVIDER,	"DTRACEIOC_PROVIDER",	NULL },
759 	{ (uint_t)DTRACEIOC_PROBES,	"DTRACEIOC_PROBES",	NULL },
760 	{ (uint_t)DTRACEIOC_BUFSNAP,	"DTRACEIOC_BUFSNAP",	NULL },
761 	{ (uint_t)DTRACEIOC_PROBEMATCH,	"DTRACEIOC_PROBEMATCH",	NULL },
762 	{ (uint_t)DTRACEIOC_ENABLE,	"DTRACEIOC_ENABLE",	NULL },
763 	{ (uint_t)DTRACEIOC_AGGSNAP,	"DTRACEIOC_AGGSNAP",	NULL },
764 	{ (uint_t)DTRACEIOC_EPROBE,	"DTRACEIOC_EPROBE",	NULL },
765 	{ (uint_t)DTRACEIOC_PROBEARG,   "DTRACEIOC_PROBEARG",   NULL },
766 	{ (uint_t)DTRACEIOC_CONF,	"DTRACEIOC_CONF",	NULL },
767 	{ (uint_t)DTRACEIOC_STATUS,	"DTRACEIOC_STATUS",	NULL },
768 	{ (uint_t)DTRACEIOC_GO,		"DTRACEIOC_GO",		NULL },
769 	{ (uint_t)DTRACEIOC_STOP,	"DTRACEIOC_STOP",	NULL },
770 	{ (uint_t)DTRACEIOC_AGGDESC,	"DTRACEIOC_AGGDESC",	NULL },
771 	{ (uint_t)DTRACEIOC_FORMAT,	"DTRACEIOC_FORMAT",	NULL },
772 	{ (uint_t)DTRACEIOC_DOFGET,	"DTRACEIOC_DOFGET",	NULL },
773 	{ (uint_t)DTRACEIOC_REPLICATE,	"DTRACEIOC_REPLICATE",	NULL },
774 
775 	{ (uint_t)DTRACEHIOC_ADD,	"DTRACEHIOC_ADD",	NULL },
776 	{ (uint_t)DTRACEHIOC_REMOVE,	"DTRACEHIOC_REMOVE",	NULL },
777 	{ (uint_t)DTRACEHIOC_ADDDOF,	"DTRACEHIOC_ADDDOF",	NULL },
778 
779 	/* /dev/cryptoadm ioctl() control codes */
780 	{ (uint_t)CRYPTO_GET_VERSION,	"CRYPTO_GET_VERSION",	NULL },
781 	{ (uint_t)CRYPTO_GET_DEV_LIST,	"CRYPTO_GET_DEV_LIST",	NULL },
782 	{ (uint_t)CRYPTO_GET_SOFT_LIST,	"CRYPTO_GET_SOFT_LIST",	NULL },
783 	{ (uint_t)CRYPTO_GET_DEV_INFO,	"CRYPTO_GET_DEV_INFO",	NULL },
784 	{ (uint_t)CRYPTO_GET_SOFT_INFO,	"CRYPTO_GET_SOFT_INFO",	NULL },
785 	{ (uint_t)CRYPTO_LOAD_DEV_DISABLED,	"CRYPTO_LOAD_DEV_DISABLED",
786 	    NULL },
787 	{ (uint_t)CRYPTO_LOAD_SOFT_DISABLED,	"CRYPTO_LOAD_SOFT_DISABLED",
788 	    NULL },
789 	{ (uint_t)CRYPTO_UNLOAD_SOFT_MODULE,	"CRYPTO_UNLOAD_SOFT_MODULE",
790 	    NULL },
791 	{ (uint_t)CRYPTO_LOAD_SOFT_CONFIG,	"CRYPTO_LOAD_SOFT_CONFIG",
792 	    NULL },
793 	{ (uint_t)CRYPTO_POOL_CREATE,	"CRYPTO_POOL_CREATE",	NULL },
794 	{ (uint_t)CRYPTO_POOL_WAIT,	"CRYPTO_POOL_WAIT",	NULL },
795 	{ (uint_t)CRYPTO_POOL_RUN,	"CRYPTO_POOL_RUN",	NULL },
796 	{ (uint_t)CRYPTO_LOAD_DOOR,	"CRYPTO_LOAD_DOOR",	NULL },
797 
798 	/* /dev/crypto ioctl() control codes */
799 	{ (uint_t)CRYPTO_GET_FUNCTION_LIST,	"CRYPTO_GET_FUNCTION_LIST",
800 	    NULL },
801 	{ (uint_t)CRYPTO_GET_MECHANISM_NUMBER,	"CRYPTO_GET_MECHANISM_NUMBER",
802 	    NULL },
803 	{ (uint_t)CRYPTO_OPEN_SESSION,	"CRYPTO_OPEN_SESSION",	NULL },
804 	{ (uint_t)CRYPTO_CLOSE_SESSION,	"CRYPTO_CLOSE_SESSION",	NULL },
805 	{ (uint_t)CRYPTO_CLOSE_ALL_SESSIONS,	"CRYPTO_CLOSE_ALL_SESSIONS",
806 	    NULL },
807 	{ (uint_t)CRYPTO_LOGIN,		"CRYPTO_LOGIN",		NULL },
808 	{ (uint_t)CRYPTO_LOGOUT,	"CRYPTO_LOGOUT",	NULL },
809 	{ (uint_t)CRYPTO_ENCRYPT,	"CRYPTO_ENCRYPT",	NULL },
810 	{ (uint_t)CRYPTO_ENCRYPT_INIT,	"CRYPTO_ENCRYPT_INIT",	NULL },
811 	{ (uint_t)CRYPTO_ENCRYPT_UPDATE,	"CRYPTO_ENCRYPT_UPDATE",
812 	    NULL },
813 	{ (uint_t)CRYPTO_ENCRYPT_FINAL,	"CRYPTO_ENCRYPT_FINAL",	NULL },
814 	{ (uint_t)CRYPTO_DECRYPT,	"CRYPTO_DECRYPT",	NULL },
815 	{ (uint_t)CRYPTO_DECRYPT_INIT,	"CRYPTO_DECRYPT_INIT",	NULL },
816 	{ (uint_t)CRYPTO_DECRYPT_UPDATE,	"CRYPTO_DECRYPT_UPDATE",
817 	    NULL },
818 	{ (uint_t)CRYPTO_DECRYPT_FINAL,	"CRYPTO_DECRYPT_FINAL",	NULL },
819 	{ (uint_t)CRYPTO_DIGEST,	"CRYPTO_DIGEST",	NULL },
820 	{ (uint_t)CRYPTO_DIGEST_INIT,	"CRYPTO_DIGEST_INIT",	NULL },
821 	{ (uint_t)CRYPTO_DIGEST_UPDATE,	"CRYPTO_DIGEST_UPDATE",	NULL },
822 	{ (uint_t)CRYPTO_DIGEST_KEY,	"CRYPTO_DIGEST_KEY",	NULL },
823 	{ (uint_t)CRYPTO_DIGEST_FINAL,	"CRYPTO_DIGEST_FINAL",	NULL },
824 	{ (uint_t)CRYPTO_MAC,		"CRYPTO_MAC",		NULL },
825 	{ (uint_t)CRYPTO_MAC_INIT,	"CRYPTO_MAC_INIT",	NULL },
826 	{ (uint_t)CRYPTO_MAC_UPDATE,	"CRYPTO_MAC_UPDATE",	NULL },
827 	{ (uint_t)CRYPTO_MAC_FINAL,	"CRYPTO_MAC_FINAL",	NULL },
828 	{ (uint_t)CRYPTO_SIGN,		"CRYPTO_SIGN",		NULL },
829 	{ (uint_t)CRYPTO_SIGN_INIT,	"CRYPTO_SIGN_INIT",	NULL },
830 	{ (uint_t)CRYPTO_SIGN_UPDATE,	"CRYPTO_SIGN_UPDATE",	NULL },
831 	{ (uint_t)CRYPTO_SIGN_FINAL,	"CRYPTO_SIGN_FINAL",	NULL },
832 	{ (uint_t)CRYPTO_SIGN_RECOVER_INIT,	"CRYPTO_SIGN_RECOVER_INIT",
833 	    NULL },
834 	{ (uint_t)CRYPTO_SIGN_RECOVER,	"CRYPTO_SIGN_RECOVER",	NULL },
835 	{ (uint_t)CRYPTO_VERIFY,	"CRYPTO_VERIFY",	NULL },
836 	{ (uint_t)CRYPTO_VERIFY_INIT,	"CRYPTO_VERIFY_INIT",	NULL },
837 	{ (uint_t)CRYPTO_VERIFY_UPDATE,	"CRYPTO_VERIFY_UPDATE",	NULL },
838 	{ (uint_t)CRYPTO_VERIFY_FINAL,	"CRYPTO_VERIFY_FINAL",	NULL },
839 	{ (uint_t)CRYPTO_VERIFY_RECOVER_INIT,	"CRYPTO_VERIFY_RECOVER_INIT",
840 	    NULL },
841 	{ (uint_t)CRYPTO_VERIFY_RECOVER,	"CRYPTO_VERIFY_RECOVER",
842 	    NULL },
843 	{ (uint_t)CRYPTO_DIGEST_ENCRYPT_UPDATE,	"CRYPTO_DIGEST_ENCRYPT_UPDATE",
844 	    NULL },
845 	{ (uint_t)CRYPTO_DECRYPT_DIGEST_UPDATE,	"CRYPTO_DECRYPT_DIGEST_UPDATE",
846 	    NULL },
847 	{ (uint_t)CRYPTO_SIGN_ENCRYPT_UPDATE,	"CRYPTO_SIGN_ENCRYPT_UPDATE",
848 	    NULL },
849 	{ (uint_t)CRYPTO_DECRYPT_VERIFY_UPDATE,	"CRYPTO_DECRYPT_VERIFY_UPDATE",
850 	    NULL },
851 	{ (uint_t)CRYPTO_SEED_RANDOM,	"CRYPTO_SEED_RANDOM",	NULL },
852 	{ (uint_t)CRYPTO_GENERATE_RANDOM,	"CRYPTO_GENERATE_RANDOM",
853 	    NULL },
854 	{ (uint_t)CRYPTO_OBJECT_CREATE,	"CRYPTO_OBJECT_CREATE",	NULL },
855 	{ (uint_t)CRYPTO_OBJECT_COPY,	"CRYPTO_OBJECT_COPY",	NULL },
856 	{ (uint_t)CRYPTO_OBJECT_DESTROY,	"CRYPTO_OBJECT_DESTROY",
857 	    NULL },
858 	{ (uint_t)CRYPTO_OBJECT_GET_ATTRIBUTE_VALUE,
859 	    "CRYPTO_OBJECT_GET_ATTRIBUTE_VALUE",	NULL },
860 	{ (uint_t)CRYPTO_OBJECT_GET_SIZE, "CRYPTO_OBJECT_GET_SIZE",	NULL },
861 	{ (uint_t)CRYPTO_OBJECT_SET_ATTRIBUTE_VALUE,
862 	    "CRYPTO_OBJECT_SET_ATTRIBUTE_VALUE",	NULL },
863 	{ (uint_t)CRYPTO_OBJECT_FIND_INIT,	"CRYPTO_OBJECT_FIND_INIT",
864 	    NULL },
865 	{ (uint_t)CRYPTO_OBJECT_FIND_UPDATE,	"CRYPTO_OBJECT_FIND_UPDATE",
866 	    NULL },
867 	{ (uint_t)CRYPTO_OBJECT_FIND_FINAL,	"CRYPTO_OBJECT_FIND_FINAL",
868 	    NULL },
869 	{ (uint_t)CRYPTO_GENERATE_KEY,	"CRYPTO_GENERATE_KEY",	NULL },
870 	{ (uint_t)CRYPTO_GENERATE_KEY_PAIR,	"CRYPTO_GENERATE_KEY_PAIR",
871 	    NULL },
872 	{ (uint_t)CRYPTO_WRAP_KEY,	"CRYPTO_WRAP_KEY",	NULL },
873 	{ (uint_t)CRYPTO_UNWRAP_KEY,	"CRYPTO_UNWRAP_KEY",	NULL },
874 	{ (uint_t)CRYPTO_DERIVE_KEY,	"CRYPTO_DERIVE_KEY",	NULL },
875 	{ (uint_t)CRYPTO_GET_PROVIDER_LIST,	"CRYPTO_GET_PROVIDER_LIST",
876 	    NULL },
877 	{ (uint_t)CRYPTO_GET_PROVIDER_INFO,	"CRYPTO_GET_PROVIDER_INFO",
878 	    NULL },
879 	{ (uint_t)CRYPTO_GET_PROVIDER_MECHANISMS,
880 	    "CRYPTO_GET_PROVIDER_MECHANISMS",	NULL },
881 	{ (uint_t)CRYPTO_GET_PROVIDER_MECHANISM_INFO,
882 	    "CRYPTO_GET_PROVIDER_MECHANISM_INFO",	NULL },
883 	{ (uint_t)CRYPTO_INIT_TOKEN,	"CRYPTO_INIT_TOKEN",	NULL },
884 	{ (uint_t)CRYPTO_INIT_PIN,	"CRYPTO_INIT_PIN",	NULL },
885 	{ (uint_t)CRYPTO_SET_PIN,	"CRYPTO_SET_PIN",	NULL },
886 	{ (uint_t)CRYPTO_NOSTORE_GENERATE_KEY,
887 	    "CRYPTO_NOSTORE_GENERATE_KEY",	NULL },
888 	{ (uint_t)CRYPTO_NOSTORE_GENERATE_KEY_PAIR,
889 	    "CRYPTO_NOSTORE_GENERATE_KEY_PAIR",	NULL },
890 	{ (uint_t)CRYPTO_NOSTORE_DERIVE_KEY,
891 	    "CRYPTO_NOSTORE_DERIVE_KEY",	NULL },
892 
893 	/* kbio ioctls */
894 	{ (uint_t)KIOCTRANS,		"KIOCTRANS",	NULL },
895 	{ (uint_t)KIOCGTRANS,		"KIOCGTRANS",	NULL },
896 	{ (uint_t)KIOCTRANSABLE,	"KIOCTRANSABLE",	NULL },
897 	{ (uint_t)KIOCGTRANSABLE,	"KIOCGTRANSABLE",	NULL },
898 	{ (uint_t)KIOCSETKEY,		"KIOCSETKEY",	NULL },
899 	{ (uint_t)KIOCGETKEY,		"KIOCGETKEY",	NULL },
900 	{ (uint_t)KIOCCMD,		"KIOCCMD",	NULL },
901 	{ (uint_t)KIOCTYPE,		"KIOCTYPE",	NULL },
902 	{ (uint_t)KIOCSDIRECT,		"KIOCSDIRECT",	NULL },
903 	{ (uint_t)KIOCGDIRECT,		"KIOCGDIRECT",	NULL },
904 	{ (uint_t)KIOCSKEY,		"KIOCSKEY",	NULL },
905 	{ (uint_t)KIOCGKEY,		"KIOCGKEY",	NULL },
906 	{ (uint_t)KIOCSLED,		"KIOCSLED",	NULL },
907 	{ (uint_t)KIOCGLED,		"KIOCGLED",	NULL },
908 	{ (uint_t)KIOCSCOMPAT,		"KIOCSCOMPAT",	NULL },
909 	{ (uint_t)KIOCGCOMPAT,		"KIOCGCOMPAT",	NULL },
910 	{ (uint_t)KIOCSLAYOUT,		"KIOCSLAYOUT",	NULL },
911 	{ (uint_t)KIOCLAYOUT,		"KIOCLAYOUT",	NULL },
912 	{ (uint_t)KIOCSKABORTEN,	"KIOCSKABORTEN",	NULL },
913 	{ (uint_t)KIOCGRPTDELAY,	"KIOCGRPTDELAY",	NULL },
914 	{ (uint_t)KIOCSRPTDELAY,	"KIOCSRPTDELAY",	NULL },
915 	{ (uint_t)KIOCGRPTRATE,		"KIOCGRPTRATE",	NULL },
916 	{ (uint_t)KIOCSRPTRATE,		"KIOCSRPTRATE",	NULL },
917 	{ (uint_t)KIOCSETFREQ,		"KIOCSETFREQ",	NULL },
918 	{ (uint_t)KIOCMKTONE,		"KIOCMKTONE",	NULL },
919 
920 	/* ptm/pts driver I_STR ioctls */
921 	{ (uint_t)ISPTM,		"ISPTM",		NULL},
922 	{ (uint_t)UNLKPT,		"UNLKPT",		NULL},
923 	{ (uint_t)PTSSTTY,		"PTSSTTY",		NULL},
924 	{ (uint_t)ZONEPT,		"ZONEPT",		NULL},
925 	{ (uint_t)OWNERPT,		"OWNERPT",		NULL},
926 
927 	/* aggr link aggregation pseudo driver ioctls */
928 	{ (uint_t)LAIOC_CREATE,		"LAIOC_CREATE",		"laioc_create"},
929 	{ (uint_t)LAIOC_DELETE,		"LAIOC_DELETE",		"laioc_delete"},
930 	{ (uint_t)LAIOC_INFO,		"LAIOC_INFO",		"laioc_info"},
931 	{ (uint_t)LAIOC_ADD,		"LAIOC_ADD",
932 	    "laioc_add_rem"},
933 	{ (uint_t)LAIOC_REMOVE,		"LAIOC_REMOVE",
934 	    "laioc_add_rem"},
935 	{ (uint_t)LAIOC_MODIFY,		"LAIOC_MODIFY",		"laioc_modify"},
936 
937 	/* dld data-link ioctls */
938 	{ (uint_t)DLDIOC_ATTR,		"DLDIOC_ATTR",		"dld_ioc_attr"},
939 	{ (uint_t)DLDIOC_PHYS_ATTR,	"DLDIOC_PHYS_ATTR",
940 		"dld_ioc_phys_attr"},
941 	{ (uint_t)DLDIOC_DOORSERVER,	"DLDIOC_DOORSERVER", "dld_ioc_door"},
942 	{ (uint_t)DLDIOC_RENAME,	"DLDIOC_RENAME", "dld_ioc_rename"},
943 	{ (uint_t)DLDIOC_SECOBJ_GET,		"DLDIOC_SECOBJ_GET",
944 		"dld_ioc_secobj_get"},
945 	{ (uint_t)DLDIOC_SECOBJ_SET,		"DLDIOC_SECOBJ_SET",
946 		"dld_ioc_secobj_set"},
947 	{ (uint_t)DLDIOC_SECOBJ_UNSET,		"DLDIOC_SECOBJ_UNSET",
948 		"dld_ioc_secobj_unset"},
949 	{ (uint_t)DLDIOC_MACADDRGET,		"DLDIOC_MACADDRGET",
950 		"dld_ioc_macaddrget"},
951 	{ (uint_t)DLDIOC_SETMACPROP,		"DLDIOC_SETMACPROP",
952 		"dld_ioc_macprop_s"},
953 	{ (uint_t)DLDIOC_GETMACPROP,		"DLDIOC_GETMACPROP",
954 		"dld_ioc_macprop_s"},
955 	{ (uint_t)DLDIOC_ADDFLOW,		"DLDIOC_ADDFLOW",
956 		"dld_ioc_addflow"},
957 	{ (uint_t)DLDIOC_REMOVEFLOW,		"DLDIOC_REMOVEFLOW",
958 		"dld_ioc_removeflow"},
959 	{ (uint_t)DLDIOC_MODIFYFLOW,		"DLDIOC_MODIFYFLOW",
960 		"dld_ioc_modifyflow"},
961 	{ (uint_t)DLDIOC_WALKFLOW,		"DLDIOC_WALKFLOW",
962 		"dld_ioc_walkflow"},
963 	{ (uint_t)DLDIOC_USAGELOG,		"DLDIOC_USAGELOG",
964 		"dld_ioc_usagelog"},
965 
966 	/* vnic ioctls */
967 	{ (uint_t)VNIC_IOC_CREATE,		"VNIC_IOC_CREATE",
968 		"vnic_ioc_create"},
969 	{ (uint_t)VNIC_IOC_DELETE,		"VNIC_IOC_DELETE",
970 		"vnic_ioc_delete"},
971 	{ (uint_t)VNIC_IOC_INFO,		"VNIC_IOC_INFO",
972 		"vnic_ioc_info"},
973 
974 	/* ZFS ioctls */
975 	{ (uint_t)ZFS_IOC_POOL_CREATE,		"ZFS_IOC_POOL_CREATE",
976 		"zfs_cmd_t" },
977 	{ (uint_t)ZFS_IOC_POOL_DESTROY,		"ZFS_IOC_POOL_DESTROY",
978 		"zfs_cmd_t" },
979 	{ (uint_t)ZFS_IOC_POOL_IMPORT,		"ZFS_IOC_POOL_IMPORT",
980 		"zfs_cmd_t" },
981 	{ (uint_t)ZFS_IOC_POOL_EXPORT,		"ZFS_IOC_POOL_EXPORT",
982 		"zfs_cmd_t" },
983 	{ (uint_t)ZFS_IOC_POOL_CONFIGS,		"ZFS_IOC_POOL_CONFIGS",
984 		"zfs_cmd_t" },
985 	{ (uint_t)ZFS_IOC_POOL_STATS,		"ZFS_IOC_POOL_STATS",
986 		"zfs_cmd_t" },
987 	{ (uint_t)ZFS_IOC_POOL_TRYIMPORT,	"ZFS_IOC_POOL_TRYIMPORT",
988 		"zfs_cmd_t" },
989 	{ (uint_t)ZFS_IOC_POOL_SCRUB,		"ZFS_IOC_POOL_SCRUB",
990 		"zfs_cmd_t" },
991 	{ (uint_t)ZFS_IOC_POOL_FREEZE,		"ZFS_IOC_POOL_FREEZE",
992 		"zfs_cmd_t" },
993 	{ (uint_t)ZFS_IOC_POOL_UPGRADE,		"ZFS_IOC_POOL_UPGRADE",
994 		"zfs_cmd_t" },
995 	{ (uint_t)ZFS_IOC_POOL_GET_HISTORY,	"ZFS_IOC_POOL_GET_HISTORY",
996 		"zfs_cmd_t" },
997 	{ (uint_t)ZFS_IOC_VDEV_ADD,		"ZFS_IOC_VDEV_ADD",
998 		"zfs_cmd_t" },
999 	{ (uint_t)ZFS_IOC_VDEV_REMOVE,		"ZFS_IOC_VDEV_REMOVE",
1000 		"zfs_cmd_t" },
1001 	{ (uint_t)ZFS_IOC_VDEV_SET_STATE,	"ZFS_IOC_VDEV_SET_STATE",
1002 		"zfs_cmd_t" },
1003 	{ (uint_t)ZFS_IOC_VDEV_ATTACH,		"ZFS_IOC_VDEV_ATTACH",
1004 		"zfs_cmd_t" },
1005 	{ (uint_t)ZFS_IOC_VDEV_DETACH,		"ZFS_IOC_VDEV_DETACH",
1006 		"zfs_cmd_t" },
1007 	{ (uint_t)ZFS_IOC_VDEV_SETPATH,		"ZFS_IOC_VDEV_SETPATH",
1008 		"zfs_cmd_t" },
1009 	{ (uint_t)ZFS_IOC_OBJSET_STATS,		"ZFS_IOC_OBJSET_STATS",
1010 		"zfs_cmd_t" },
1011 	{ (uint_t)ZFS_IOC_OBJSET_ZPLPROPS,	"ZFS_IOC_OBJSET_ZPLPROPS",
1012 		"zfs_cmd_t" },
1013 	{ (uint_t)ZFS_IOC_DATASET_LIST_NEXT,	"ZFS_IOC_DATASET_LIST_NEXT",
1014 		"zfs_cmd_t" },
1015 	{ (uint_t)ZFS_IOC_SNAPSHOT_LIST_NEXT,	"ZFS_IOC_SNAPSHOT_LIST_NEXT",
1016 		"zfs_cmd_t" },
1017 	{ (uint_t)ZFS_IOC_SET_PROP,		"ZFS_IOC_SET_PROP",
1018 		"zfs_cmd_t" },
1019 	{ (uint_t)ZFS_IOC_CREATE_MINOR,		"ZFS_IOC_CREATE_MINOR",
1020 		"zfs_cmd_t" },
1021 	{ (uint_t)ZFS_IOC_REMOVE_MINOR,		"ZFS_IOC_REMOVE_MINOR",
1022 		"zfs_cmd_t" },
1023 	{ (uint_t)ZFS_IOC_CREATE,		"ZFS_IOC_CREATE",
1024 		"zfs_cmd_t" },
1025 	{ (uint_t)ZFS_IOC_DESTROY,		"ZFS_IOC_DESTROY",
1026 		"zfs_cmd_t" },
1027 	{ (uint_t)ZFS_IOC_ROLLBACK,		"ZFS_IOC_ROLLBACK",
1028 		"zfs_cmd_t" },
1029 	{ (uint_t)ZFS_IOC_RENAME,		"ZFS_IOC_RENAME",
1030 		"zfs_cmd_t" },
1031 	{ (uint_t)ZFS_IOC_RECV,			"ZFS_IOC_RECV",
1032 		"zfs_cmd_t" },
1033 	{ (uint_t)ZFS_IOC_SEND,			"ZFS_IOC_SEND",
1034 		"zfs_cmd_t" },
1035 	{ (uint_t)ZFS_IOC_INJECT_FAULT,		"ZFS_IOC_INJECT_FAULT",
1036 		"zfs_cmd_t" },
1037 	{ (uint_t)ZFS_IOC_CLEAR_FAULT,		"ZFS_IOC_CLEAR_FAULT",
1038 		"zfs_cmd_t" },
1039 	{ (uint_t)ZFS_IOC_INJECT_LIST_NEXT,	"ZFS_IOC_INJECT_LIST_NEXT",
1040 		"zfs_cmd_t" },
1041 	{ (uint_t)ZFS_IOC_ERROR_LOG,		"ZFS_IOC_ERROR_LOG",
1042 		"zfs_cmd_t" },
1043 	{ (uint_t)ZFS_IOC_CLEAR,		"ZFS_IOC_CLEAR",
1044 		"zfs_cmd_t" },
1045 	{ (uint_t)ZFS_IOC_PROMOTE,		"ZFS_IOC_PROMOTE",
1046 		"zfs_cmd_t" },
1047 	{ (uint_t)ZFS_IOC_DESTROY_SNAPS,	"ZFS_IOC_DESTROY_SNAPS",
1048 		"zfs_cmd_t" },
1049 	{ (uint_t)ZFS_IOC_SNAPSHOT,		"ZFS_IOC_SNAPSHOT",
1050 		"zfs_cmd_t" },
1051 	{ (uint_t)ZFS_IOC_DSOBJ_TO_DSNAME,	"ZFS_IOC_DSOBJ_TO_DSNAME",
1052 		"zfs_cmd_t" },
1053 	{ (uint_t)ZFS_IOC_OBJ_TO_PATH,		"ZFS_IOC_OBJ_TO_PATH",
1054 		"zfs_cmd_t" },
1055 	{ (uint_t)ZFS_IOC_POOL_SET_PROPS,	"ZFS_IOC_POOL_SET_PROPS",
1056 		"zfs_cmd_t" },
1057 	{ (uint_t)ZFS_IOC_POOL_GET_PROPS,	"ZFS_IOC_POOL_GET_PROPS",
1058 		"zfs_cmd_t" },
1059 	{ (uint_t)ZFS_IOC_SET_FSACL,		"ZFS_IOC_SET_FSACL",
1060 		"zfs_cmd_t" },
1061 	{ (uint_t)ZFS_IOC_GET_FSACL,		"ZFS_IOC_GET_FSACL",
1062 		"zfs_cmd_t" },
1063 	{ (uint_t)ZFS_IOC_ISCSI_PERM_CHECK,	"ZFS_IOC_ISCSI_PERM_CHECK",
1064 		"zfs_cmd_t" },
1065 	{ (uint_t)ZFS_IOC_SHARE,		"ZFS_IOC_SHARE",
1066 		"zfs_cmd_t" },
1067 	{ (uint_t)ZFS_IOC_INHERIT_PROP,		"ZFS_IOC_INHERIT_PROP",
1068 		"zfs_cmd_t" },
1069 
1070 	/* kssl ioctls */
1071 	{ (uint_t)KSSL_ADD_ENTRY,		"KSSL_ADD_ENTRY",
1072 		"kssl_params_t"},
1073 	{ (uint_t)KSSL_DELETE_ENTRY,		"KSSL_DELETE_ENTRY",
1074 		"sockaddr_in"},
1075 
1076 	/* dkio ioctls - (0x04 << 8) */
1077 	{ (uint_t)DKIOCGGEOM,		"DKIOCGGEOM",
1078 		"struct dk_geom"},
1079 	{ (uint_t)DKIOCSGEOM,		"DKIOCSGEOM",
1080 		"struct dk_geom"},
1081 	{ (uint_t)DKIOCINFO,		"DKIOCINFO",
1082 		"struct dk_info"},
1083 	{ (uint_t)DKIOCGVTOC,		"DKIOCGVTOC",
1084 		"struct vtoc"},
1085 	{ (uint_t)DKIOCSVTOC,		"DKIOCSVTOC",
1086 		"struct vtoc"},
1087 	{ (uint_t)DKIOCADDBAD,		"DKIOCADDBAD",
1088 		NULL},
1089 	{ (uint_t)DKIOCG_PHYGEOM,	"DKIOCG_PHYGEOM",
1090 		"struct dk_geom"},
1091 	{ (uint_t)DKIOCG_VIRTGEOM,	"DKIOCG_VIRTGEOM",
1092 		"struct dk_geom"},
1093 	{ (uint_t)DKIOCGMEDIAINFO,	"DKIOCGMEDIAINFO",
1094 		"struct dk_minfo"},
1095 
1096 	/* dumpadm ioctls - (0xdd << 8) */
1097 	{ (uint_t)DIOCGETDEV,	"DIOCGETDEV",
1098 		"char *"},
1099 
1100 	/* mntio ioctls - ('m' << 8) */
1101 	{ (uint_t)MNTIOC_GETMNTENT,	"MNTIOC_GETMNTENT",
1102 		"struct extmnttab"},
1103 
1104 	/* zcons ioctls */
1105 	{ (uint_t)ZC_HOLDSLAVE,		"ZC_HOLDSLAVE",		NULL },
1106 	{ (uint_t)ZC_RELEASESLAVE,	"ZC_RELEASESLAVE",	NULL },
1107 
1108 	{ (uint_t)0, NULL, NULL	}
1109 };
1110 
1111 void
1112 ioctl_ioccom(char *buf, size_t size, uint_t code, int nbytes, int x, int y)
1113 {
1114 	const char *inoutstr;
1115 
1116 	if (code & IOC_VOID)
1117 		inoutstr = "";
1118 	else if ((code & IOC_INOUT) == IOC_INOUT)
1119 		inoutstr = "WR";
1120 	else
1121 		inoutstr = code & IOC_IN ? "W" : "R";
1122 
1123 	if (isascii(x) && isprint(x))
1124 		(void) snprintf(buf, size, "_IO%sN('%c', %d, %d)", inoutstr,
1125 		    x, y, nbytes);
1126 	else
1127 		(void) snprintf(buf, size, "_IO%sN(0x%x, %d, %d)", inoutstr,
1128 		    x, y, nbytes);
1129 }
1130 
1131 
1132 const char *
1133 ioctlname(private_t *pri, uint_t code)
1134 {
1135 	const struct ioc *ip;
1136 	const char *str = NULL;
1137 
1138 	for (ip = &ioc[0]; ip->name; ip++) {
1139 		if (code == ip->code) {
1140 			str = ip->name;
1141 			break;
1142 		}
1143 	}
1144 
1145 	/*
1146 	 * Developers hide ascii ioctl names in the ioctl subcode; for example
1147 	 * 0x445210 should be printed 'D'<<16|'R'<<8|10.  We allow for all
1148 	 * three high order bytes (called hi, mid and lo) to contain ascii
1149 	 * characters.
1150 	 */
1151 	if (str == NULL) {
1152 		int c_hi = code >> 24;
1153 		int c_mid = (code >> 16) & 0xff;
1154 		int c_mid_nm = (code >> 16);
1155 		int c_lo = (code >> 8) & 0xff;
1156 		int c_lo_nm = code >> 8;
1157 
1158 		if (isascii(c_lo) && isprint(c_lo) &&
1159 		    isascii(c_mid) && isprint(c_mid) &&
1160 		    isascii(c_hi) && isprint(c_hi))
1161 			(void) sprintf(pri->code_buf,
1162 			    "(('%c'<<24)|('%c'<<16)|('%c'<<8)|%d)",
1163 			    c_hi, c_mid, c_lo, code & 0xff);
1164 		else if (isascii(c_lo) && isprint(c_lo) &&
1165 		    isascii(c_mid_nm) && isprint(c_mid_nm))
1166 			(void) sprintf(pri->code_buf,
1167 			    "(('%c'<<16)|('%c'<<8)|%d)", c_mid, c_lo,
1168 			    code & 0xff);
1169 		else if (isascii(c_lo_nm) && isprint(c_lo_nm))
1170 			(void) sprintf(pri->code_buf, "(('%c'<<8)|%d)",
1171 			    c_lo_nm, code & 0xff);
1172 		else if (code & (IOC_VOID|IOC_INOUT))
1173 			ioctl_ioccom(pri->code_buf, sizeof (pri->code_buf),
1174 			    code, c_mid, c_lo, code & 0xff);
1175 		else
1176 			(void) sprintf(pri->code_buf, "0x%.4X", code);
1177 		str = (const char *)pri->code_buf;
1178 	}
1179 
1180 	return (str);
1181 }
1182 
1183 
1184 const char *
1185 ioctldatastruct(uint_t code)
1186 {
1187 	const struct ioc *ip;
1188 	const char *str = NULL;
1189 
1190 	for (ip = &ioc[0]; ip->name != NULL; ip++) {
1191 		if (code == ip->code) {
1192 			str = ip->datastruct;
1193 			break;
1194 		}
1195 	}
1196 	return (str);
1197 }
1198 
1199 
1200 const char *
1201 fcntlname(int code)
1202 {
1203 	const char *str = NULL;
1204 
1205 	if (code >= FCNTLMIN && code <= FCNTLMAX)
1206 		str = FCNTLname[code-FCNTLMIN];
1207 	return (str);
1208 }
1209 
1210 const char *
1211 sfsname(int code)
1212 {
1213 	const char *str = NULL;
1214 
1215 	if (code >= SYSFSMIN && code <= SYSFSMAX)
1216 		str = SYSFSname[code-SYSFSMIN];
1217 	return (str);
1218 }
1219 
1220 const char *
1221 plockname(int code)
1222 {
1223 	const char *str = NULL;
1224 
1225 	if (code >= PLOCKMIN && code <= PLOCKMAX)
1226 		str = PLOCKname[code-PLOCKMIN];
1227 	return (str);
1228 }
1229 
1230 /* ARGSUSED */
1231 const char *
1232 si86name(int code)
1233 {
1234 	const char *str = NULL;
1235 
1236 #if defined(__i386) || defined(__amd64)
1237 	switch (code) {
1238 	case SI86SWPI:		str = "SI86SWPI";	break;
1239 	case SI86SYM:		str = "SI86SYM";	break;
1240 	case SI86CONF:		str = "SI86CONF";	break;
1241 	case SI86BOOT:		str = "SI86BOOT";	break;
1242 	case SI86AUTO:		str = "SI86AUTO";	break;
1243 	case SI86EDT:		str = "SI86EDT";	break;
1244 	case SI86SWAP:		str = "SI86SWAP";	break;
1245 	case SI86FPHW:		str = "SI86FPHW";	break;
1246 	case SI86FPSTART:	str = "SI86FPSTART";	break;
1247 	case GRNON:		str = "GRNON";		break;
1248 	case GRNFLASH:		str = "GRNFLASH";	break;
1249 	case STIME:		str = "STIME";		break;
1250 	case SETNAME:		str = "SETNAME";	break;
1251 	case RNVR:		str = "RNVR";		break;
1252 	case WNVR:		str = "WNVR";		break;
1253 	case RTODC:		str = "RTODC";		break;
1254 	case CHKSER:		str = "CHKSER";		break;
1255 	case SI86NVPRT:		str = "SI86NVPRT";	break;
1256 	case SANUPD:		str = "SANUPD";		break;
1257 	case SI86KSTR:		str = "SI86KSTR";	break;
1258 	case SI86MEM:		str = "SI86MEM";	break;
1259 	case SI86TODEMON:	str = "SI86TODEMON";	break;
1260 	case SI86CCDEMON:	str = "SI86CCDEMON";	break;
1261 	case SI86CACHE:		str = "SI86CACHE";	break;
1262 	case SI86DELMEM:	str = "SI86DELMEM";	break;
1263 	case SI86ADDMEM:	str = "SI86ADDMEM";	break;
1264 /* 71 through 74 reserved for VPIX */
1265 	case SI86V86: 		str = "SI86V86";	break;
1266 	case SI86SLTIME:	str = "SI86SLTIME";	break;
1267 	case SI86DSCR:		str = "SI86DSCR";	break;
1268 	case RDUBLK:		str = "RDUBLK";		break;
1269 /* NFA entry point */
1270 	case SI86NFA:		str = "SI86NFA";	break;
1271 	case SI86VM86:		str = "SI86VM86";	break;
1272 	case SI86VMENABLE:	str = "SI86VMENABLE";	break;
1273 	case SI86LIMUSER:	str = "SI86LIMUSER";	break;
1274 	case SI86RDID: 		str = "SI86RDID";	break;
1275 	case SI86RDBOOT:	str = "SI86RDBOOT";	break;
1276 /* Merged Product defines */
1277 	case SI86SHFIL:		str = "SI86SHFIL";	break;
1278 	case SI86PCHRGN:	str = "SI86PCHRGN";	break;
1279 	case SI86BADVISE:	str = "SI86BADVISE";	break;
1280 	case SI86SHRGN:		str = "SI86SHRGN";	break;
1281 	case SI86CHIDT:		str = "SI86CHIDT";	break;
1282 	case SI86EMULRDA: 	str = "SI86EMULRDA";	break;
1283 /* RTC commands */
1284 	case WTODC:		str = "WTODC";		break;
1285 	case SGMTL:		str = "SGMTL";		break;
1286 	case GGMTL:		str = "GGMTL";		break;
1287 	case RTCSYNC:		str = "RTCSYNC";	break;
1288 	}
1289 #endif /* __i386 */
1290 
1291 	return (str);
1292 }
1293 
1294 const char *
1295 utscode(int code)
1296 {
1297 	const char *str = NULL;
1298 
1299 	switch (code) {
1300 	case UTS_UNAME:		str = "UNAME";	break;
1301 	case UTS_USTAT:		str = "USTAT";	break;
1302 	case UTS_FUSERS:	str = "FUSERS";	break;
1303 	}
1304 
1305 	return (str);
1306 }
1307 
1308 const char *
1309 rctlsyscode(int code)
1310 {
1311 	const char *str = NULL;
1312 	switch (code) {
1313 	case 0:		str = "GETRCTL";	break;
1314 	case 1:		str = "SETRCTL";	break;
1315 	case 2:		str = "RCTLSYS_LST";	break;
1316 	case 3:		str = "RCTLSYS_CTL";	break;
1317 	case 4:		str = "RCTLSYS_SETPROJ";	break;
1318 	default:	str = "UNKNOWN";	break;
1319 	}
1320 	return (str);
1321 }
1322 
1323 const char *
1324 rctl_local_action(private_t *pri, uint_t val)
1325 {
1326 	uint_t action = val & (~RCTL_LOCAL_ACTION_MASK);
1327 
1328 	char *s = pri->code_buf;
1329 
1330 	*s = '\0';
1331 
1332 	if (action & RCTL_LOCAL_NOACTION) {
1333 		action ^= RCTL_LOCAL_NOACTION;
1334 		(void) strlcat(s, "|RCTL_LOCAL_NOACTION",
1335 		    sizeof (pri->code_buf));
1336 	}
1337 	if (action & RCTL_LOCAL_SIGNAL) {
1338 		action ^= RCTL_LOCAL_SIGNAL;
1339 		(void) strlcat(s, "|RCTL_LOCAL_SIGNAL",
1340 		    sizeof (pri->code_buf));
1341 	}
1342 	if (action & RCTL_LOCAL_DENY) {
1343 		action ^= RCTL_LOCAL_DENY;
1344 		(void) strlcat(s, "|RCTL_LOCAL_DENY",
1345 		    sizeof (pri->code_buf));
1346 	}
1347 
1348 	if ((action & (~RCTL_LOCAL_ACTION_MASK)) != 0)
1349 		return (NULL);
1350 	else if (*s != '\0')
1351 		return (s+1);
1352 	else
1353 		return (NULL);
1354 }
1355 
1356 
1357 const char *
1358 rctl_local_flags(private_t *pri, uint_t val)
1359 {
1360 	uint_t pval = val & RCTL_LOCAL_ACTION_MASK;
1361 	char *s = pri->code_buf;
1362 
1363 	*s = '\0';
1364 
1365 	if (pval & RCTL_LOCAL_MAXIMAL) {
1366 		pval ^= RCTL_LOCAL_MAXIMAL;
1367 		(void) strlcat(s, "|RCTL_LOCAL_MAXIMAL",
1368 		    sizeof (pri->code_buf));
1369 	}
1370 
1371 	if ((pval & RCTL_LOCAL_ACTION_MASK) != 0)
1372 		return (NULL);
1373 	else if (*s != '\0')
1374 		return (s+1);
1375 	else
1376 		return (NULL);
1377 }
1378 
1379 
1380 const char *
1381 sconfname(int code)
1382 {
1383 	const char *str = NULL;
1384 
1385 	if (code >= SCONFMIN && code <= SCONFMAX)
1386 		str = SCONFname[code-SCONFMIN];
1387 	return (str);
1388 }
1389 
1390 const char *
1391 pathconfname(int code)
1392 {
1393 	const char *str = NULL;
1394 
1395 	if (code >= PATHCONFMIN && code <= PATHCONFMAX)
1396 		str = PATHCONFname[code-PATHCONFMIN];
1397 	return (str);
1398 }
1399 
1400 const char *
1401 sigarg(private_t *pri, int arg)
1402 {
1403 	char *str = NULL;
1404 	int sig = (arg & SIGNO_MASK);
1405 
1406 	str = pri->code_buf;
1407 	arg &= ~SIGNO_MASK;
1408 	if (arg & ~(SIGDEFER|SIGHOLD|SIGRELSE|SIGIGNORE|SIGPAUSE))
1409 		(void) snprintf(pri->code_buf, sizeof (pri->code_buf),
1410 		    "%s|0x%X", signame(pri, sig), arg);
1411 	else {
1412 		(void) strcpy(str, signame(pri, sig));
1413 		if (arg & SIGDEFER)
1414 			(void) strcat(str, "|SIGDEFER");
1415 		if (arg & SIGHOLD)
1416 			(void) strcat(str, "|SIGHOLD");
1417 		if (arg & SIGRELSE)
1418 			(void) strcat(str, "|SIGRELSE");
1419 		if (arg & SIGIGNORE)
1420 			(void) strcat(str, "|SIGIGNORE");
1421 		if (arg & SIGPAUSE)
1422 			(void) strcat(str, "|SIGPAUSE");
1423 	}
1424 
1425 	return ((const char *)str);
1426 }
1427 
1428 #define	ALL_O_FLAGS \
1429 	(O_NDELAY|O_APPEND|O_SYNC|O_DSYNC|O_NONBLOCK|O_CREAT|O_TRUNC\
1430 	|O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS)
1431 
1432 const char *
1433 openarg(private_t *pri, int arg)
1434 {
1435 	char *str = pri->code_buf;
1436 
1437 	switch (arg & ~ALL_O_FLAGS) {
1438 	default:
1439 		return ((char *)NULL);
1440 	case O_RDONLY:
1441 		(void) strcpy(str, "O_RDONLY");
1442 		break;
1443 	case O_WRONLY:
1444 		(void) strcpy(str, "O_WRONLY");
1445 		break;
1446 	case O_RDWR:
1447 		(void) strcpy(str, "O_RDWR");
1448 		break;
1449 	}
1450 
1451 	if (arg & O_NDELAY)
1452 		(void) strlcat(str, "|O_NDELAY", sizeof (pri->code_buf));
1453 	if (arg & O_APPEND)
1454 		(void) strlcat(str, "|O_APPEND", sizeof (pri->code_buf));
1455 	if (arg & O_SYNC)
1456 		(void) strlcat(str, "|O_SYNC", sizeof (pri->code_buf));
1457 	if (arg & O_DSYNC)
1458 		(void) strlcat(str, "|O_DSYNC", sizeof (pri->code_buf));
1459 	if (arg & O_NONBLOCK)
1460 		(void) strlcat(str, "|O_NONBLOCK", sizeof (pri->code_buf));
1461 	if (arg & O_CREAT)
1462 		(void) strlcat(str, "|O_CREAT", sizeof (pri->code_buf));
1463 	if (arg & O_TRUNC)
1464 		(void) strlcat(str, "|O_TRUNC", sizeof (pri->code_buf));
1465 	if (arg & O_EXCL)
1466 		(void) strlcat(str, "|O_EXCL", sizeof (pri->code_buf));
1467 	if (arg & O_NOCTTY)
1468 		(void) strlcat(str, "|O_NOCTTY", sizeof (pri->code_buf));
1469 	if (arg & O_LARGEFILE)
1470 		(void) strlcat(str, "|O_LARGEFILE", sizeof (pri->code_buf));
1471 	if (arg & O_RSYNC)
1472 		(void) strlcat(str, "|O_RSYNC", sizeof (pri->code_buf));
1473 	if (arg & O_XATTR)
1474 		(void) strlcat(str, "|O_XATTR", sizeof (pri->code_buf));
1475 	if (arg & O_NOFOLLOW)
1476 		(void) strlcat(str, "|O_NOFOLLOW", sizeof (pri->code_buf));
1477 	if (arg & O_NOLINKS)
1478 		(void) strlcat(str, "|O_NOLINKS", sizeof (pri->code_buf));
1479 
1480 	return ((const char *)str);
1481 }
1482 
1483 const char *
1484 whencearg(int arg)
1485 {
1486 	const char *str = NULL;
1487 
1488 	switch (arg) {
1489 	case SEEK_SET:	str = "SEEK_SET";	break;
1490 	case SEEK_CUR:	str = "SEEK_CUR";	break;
1491 	case SEEK_END:	str = "SEEK_END";	break;
1492 	case SEEK_DATA:	str = "SEEK_DATA";	break;
1493 	case SEEK_HOLE:	str = "SEEK_HOLE";	break;
1494 	}
1495 
1496 	return (str);
1497 }
1498 
1499 #define	IPC_FLAGS	(IPC_ALLOC|IPC_CREAT|IPC_EXCL|IPC_NOWAIT)
1500 
1501 char *
1502 ipcflags(private_t *pri, int arg)
1503 {
1504 	char *str = pri->code_buf;
1505 
1506 	if (arg & 0777)
1507 		(void) sprintf(str, "0%.3o", arg&0777);
1508 	else
1509 		*str = '\0';
1510 
1511 	if (arg & IPC_ALLOC)
1512 		(void) strcat(str, "|IPC_ALLOC");
1513 	if (arg & IPC_CREAT)
1514 		(void) strcat(str, "|IPC_CREAT");
1515 	if (arg & IPC_EXCL)
1516 		(void) strcat(str, "|IPC_EXCL");
1517 	if (arg & IPC_NOWAIT)
1518 		(void) strcat(str, "|IPC_NOWAIT");
1519 
1520 	return (str);
1521 }
1522 
1523 const char *
1524 msgflags(private_t *pri, int arg)
1525 {
1526 	char *str;
1527 
1528 	if (arg == 0 || (arg & ~(IPC_FLAGS|MSG_NOERROR|0777)) != 0)
1529 		return ((char *)NULL);
1530 
1531 	str = ipcflags(pri, arg);
1532 
1533 	if (arg & MSG_NOERROR)
1534 		(void) strcat(str, "|MSG_NOERROR");
1535 
1536 	if (*str == '|')
1537 		str++;
1538 	return ((const char *)str);
1539 }
1540 
1541 const char *
1542 semflags(private_t *pri, int arg)
1543 {
1544 	char *str;
1545 
1546 	if (arg == 0 || (arg & ~(IPC_FLAGS|SEM_UNDO|0777)) != 0)
1547 		return ((char *)NULL);
1548 
1549 	str = ipcflags(pri, arg);
1550 
1551 	if (arg & SEM_UNDO)
1552 		(void) strcat(str, "|SEM_UNDO");
1553 
1554 	if (*str == '|')
1555 		str++;
1556 	return ((const char *)str);
1557 }
1558 
1559 const char *
1560 shmflags(private_t *pri, int arg)
1561 {
1562 	char *str;
1563 
1564 	if (arg == 0 || (arg & ~(IPC_FLAGS|SHM_RDONLY|SHM_RND|0777)) != 0)
1565 		return ((char *)NULL);
1566 
1567 	str = ipcflags(pri, arg);
1568 
1569 	if (arg & SHM_RDONLY)
1570 		(void) strcat(str, "|SHM_RDONLY");
1571 	if (arg & SHM_RND)
1572 		(void) strcat(str, "|SHM_RND");
1573 
1574 	if (*str == '|')
1575 		str++;
1576 	return ((const char *)str);
1577 }
1578 
1579 #define	MSGCMDMIN	0
1580 #define	MSGCMDMAX	IPC_STAT64
1581 const char *const MSGCMDname[MSGCMDMAX+1] = {
1582 	NULL, NULL, NULL, NULL, NULL,
1583 	NULL, NULL, NULL, NULL, NULL,
1584 	"IPC_RMID",	/* 10 */
1585 	"IPC_SET",	/* 11 */
1586 	"IPC_STAT",	/* 12 */
1587 	"IPC_SET64",	/* 13 */
1588 	"IPC_STAT64",	/* 14 */
1589 };
1590 
1591 #define	SEMCMDMIN	0
1592 #define	SEMCMDMAX	IPC_STAT64
1593 const char *const SEMCMDname[SEMCMDMAX+1] = {
1594 	NULL,		/* 0 */
1595 	NULL,		/* 1 */
1596 	NULL,		/* 2 */
1597 	"GETNCNT",	/* 3 */
1598 	"GETPID",	/* 4 */
1599 	"GETVAL",	/* 5 */
1600 	"GETALL",	/* 6 */
1601 	"GETZCNT",	/* 7 */
1602 	"SETVAL",	/* 8 */
1603 	"SETALL",	/* 9 */
1604 	"IPC_RMID",	/* 10 */
1605 	"IPC_SET",	/* 11 */
1606 	"IPC_STAT",	/* 12 */
1607 	"IPC_SET64",	/* 13 */
1608 	"IPC_STAT64",	/* 14 */
1609 };
1610 
1611 #define	SHMCMDMIN	0
1612 #define	SHMCMDMAX	IPC_STAT64
1613 const char *const SHMCMDname[SHMCMDMAX+1] = {
1614 	NULL,		/* 0 */
1615 	NULL,		/* 1 */
1616 	NULL,		/* 2 */
1617 	"SHM_LOCK",	/* 3 */
1618 	"SHM_UNLOCK",	/* 4 */
1619 	NULL, NULL, NULL, NULL, NULL,			/* 5 NULLs */
1620 	"IPC_RMID",	/* 10 */
1621 	"IPC_SET",	/* 11 */
1622 	"IPC_STAT",	/* 12 */
1623 	"IPC_SET64",	/* 13 */
1624 	"IPC_STAT64",	/* 14 */
1625 };
1626 
1627 const char *
1628 msgcmd(int arg)
1629 {
1630 	const char *str = NULL;
1631 
1632 	if (arg >= MSGCMDMIN && arg <= MSGCMDMAX)
1633 		str = MSGCMDname[arg-MSGCMDMIN];
1634 	return (str);
1635 }
1636 
1637 const char *
1638 semcmd(int arg)
1639 {
1640 	const char *str = NULL;
1641 
1642 	if (arg >= SEMCMDMIN && arg <= SEMCMDMAX)
1643 		str = SEMCMDname[arg-SEMCMDMIN];
1644 	return (str);
1645 }
1646 
1647 const char *
1648 shmcmd(int arg)
1649 {
1650 	const char *str = NULL;
1651 
1652 	if (arg >= SHMCMDMIN && arg <= SHMCMDMAX)
1653 		str = SHMCMDname[arg-SHMCMDMIN];
1654 	return (str);
1655 }
1656 
1657 const char *
1658 strrdopt(int arg)	/* streams read option (I_SRDOPT I_GRDOPT) */
1659 {
1660 	const char *str = NULL;
1661 
1662 	switch (arg) {
1663 	case RNORM:	str = "RNORM";		break;
1664 	case RMSGD:	str = "RMSGD";		break;
1665 	case RMSGN:	str = "RMSGN";		break;
1666 	}
1667 
1668 	return (str);
1669 }
1670 
1671 /* bit map of streams events (I_SETSIG & I_GETSIG) */
1672 const char *
1673 strevents(private_t *pri, int arg)
1674 {
1675 	char *str = pri->code_buf;
1676 
1677 	if (arg & ~(S_INPUT|S_HIPRI|S_OUTPUT|S_MSG|S_ERROR|S_HANGUP))
1678 		return ((char *)NULL);
1679 
1680 	*str = '\0';
1681 	if (arg & S_INPUT)
1682 		(void) strcat(str, "|S_INPUT");
1683 	if (arg & S_HIPRI)
1684 		(void) strcat(str, "|S_HIPRI");
1685 	if (arg & S_OUTPUT)
1686 		(void) strcat(str, "|S_OUTPUT");
1687 	if (arg & S_MSG)
1688 		(void) strcat(str, "|S_MSG");
1689 	if (arg & S_ERROR)
1690 		(void) strcat(str, "|S_ERROR");
1691 	if (arg & S_HANGUP)
1692 		(void) strcat(str, "|S_HANGUP");
1693 
1694 	return ((const char *)(str+1));
1695 }
1696 
1697 const char *
1698 tiocflush(private_t *pri, int arg)	/* bit map passsed by TIOCFLUSH */
1699 {
1700 	char *str = pri->code_buf;
1701 
1702 	if (arg & ~(FREAD|FWRITE))
1703 		return ((char *)NULL);
1704 
1705 	*str = '\0';
1706 	if (arg & FREAD)
1707 		(void) strcat(str, "|FREAD");
1708 	if (arg & FWRITE)
1709 		(void) strcat(str, "|FWRITE");
1710 
1711 	return ((const char *)(str+1));
1712 }
1713 
1714 const char *
1715 strflush(int arg)	/* streams flush option (I_FLUSH) */
1716 {
1717 	const char *str = NULL;
1718 
1719 	switch (arg) {
1720 	case FLUSHR:	str = "FLUSHR";		break;
1721 	case FLUSHW:	str = "FLUSHW";		break;
1722 	case FLUSHRW:	str = "FLUSHRW";	break;
1723 	}
1724 
1725 	return (str);
1726 }
1727 
1728 #define	ALL_MOUNT_FLAGS	(MS_RDONLY|MS_FSS|MS_DATA|MS_NOSUID|MS_REMOUNT| \
1729 	MS_NOTRUNC|MS_OVERLAY|MS_OPTIONSTR|MS_GLOBAL|MS_FORCE|MS_NOMNTTAB)
1730 
1731 const char *
1732 mountflags(private_t *pri, int arg)	/* bit map of mount syscall flags */
1733 {
1734 	char *str = pri->code_buf;
1735 	size_t used = 0;
1736 
1737 	if (arg & ~ALL_MOUNT_FLAGS)
1738 		return ((char *)NULL);
1739 
1740 	*str = '\0';
1741 	if (arg & MS_RDONLY)
1742 		used = strlcat(str, "|MS_RDONLY", sizeof (pri->code_buf));
1743 	if (arg & MS_FSS)
1744 		used = strlcat(str, "|MS_FSS", sizeof (pri->code_buf));
1745 	if (arg & MS_DATA)
1746 		used = strlcat(str, "|MS_DATA", sizeof (pri->code_buf));
1747 	if (arg & MS_NOSUID)
1748 		used = strlcat(str, "|MS_NOSUID", sizeof (pri->code_buf));
1749 	if (arg & MS_REMOUNT)
1750 		used = strlcat(str, "|MS_REMOUNT", sizeof (pri->code_buf));
1751 	if (arg & MS_NOTRUNC)
1752 		used = strlcat(str, "|MS_NOTRUNC", sizeof (pri->code_buf));
1753 	if (arg & MS_OVERLAY)
1754 		used = strlcat(str, "|MS_OVERLAY", sizeof (pri->code_buf));
1755 	if (arg & MS_OPTIONSTR)
1756 		used = strlcat(str, "|MS_OPTIONSTR", sizeof (pri->code_buf));
1757 	if (arg & MS_GLOBAL)
1758 		used = strlcat(str, "|MS_GLOBAL", sizeof (pri->code_buf));
1759 	if (arg & MS_FORCE)
1760 		used = strlcat(str, "|MS_FORCE", sizeof (pri->code_buf));
1761 	if (arg & MS_NOMNTTAB)
1762 		used = strlcat(str, "|MS_NOMNTTAB", sizeof (pri->code_buf));
1763 
1764 	if (used == 0 || used >= sizeof (pri->code_buf))
1765 		return ((char *)NULL);			/* use prt_hex() */
1766 
1767 	return ((const char *)(str+1));
1768 }
1769 
1770 const char *
1771 svfsflags(private_t *pri, ulong_t arg)	/* bit map of statvfs syscall flags */
1772 {
1773 	char *str = pri->code_buf;
1774 
1775 	if (arg & ~(ST_RDONLY|ST_NOSUID|ST_NOTRUNC)) {
1776 		(void) sprintf(str, "0x%lx", arg);
1777 		return (str);
1778 	}
1779 	*str = '\0';
1780 	if (arg & ST_RDONLY)
1781 		(void) strcat(str, "|ST_RDONLY");
1782 	if (arg & ST_NOSUID)
1783 		(void) strcat(str, "|ST_NOSUID");
1784 	if (arg & ST_NOTRUNC)
1785 		(void) strcat(str, "|ST_NOTRUNC");
1786 	if (*str == '\0')
1787 		(void) strcat(str, "|0");
1788 	return ((const char *)(str+1));
1789 }
1790 
1791 const char *
1792 fuiname(int arg)	/* fusers() input argument */
1793 {
1794 	const char *str = NULL;
1795 
1796 	switch (arg) {
1797 	case F_FILE_ONLY:	str = "F_FILE_ONLY";		break;
1798 	case F_CONTAINED:	str = "F_CONTAINED";		break;
1799 	}
1800 
1801 	return (str);
1802 }
1803 
1804 const char *
1805 fuflags(private_t *pri, int arg)	/* fusers() output flags */
1806 {
1807 	char *str = pri->code_buf;
1808 
1809 	if (arg & ~(F_CDIR|F_RDIR|F_TEXT|F_MAP|F_OPEN|F_TRACE|F_TTY)) {
1810 		(void) sprintf(str, "0x%x", arg);
1811 		return (str);
1812 	}
1813 	*str = '\0';
1814 	if (arg & F_CDIR)
1815 		(void) strcat(str, "|F_CDIR");
1816 	if (arg & F_RDIR)
1817 		(void) strcat(str, "|F_RDIR");
1818 	if (arg & F_TEXT)
1819 		(void) strcat(str, "|F_TEXT");
1820 	if (arg & F_MAP)
1821 		(void) strcat(str, "|F_MAP");
1822 	if (arg & F_OPEN)
1823 		(void) strcat(str, "|F_OPEN");
1824 	if (arg & F_TRACE)
1825 		(void) strcat(str, "|F_TRACE");
1826 	if (arg & F_TTY)
1827 		(void) strcat(str, "|F_TTY");
1828 	if (*str == '\0')
1829 		(void) strcat(str, "|0");
1830 	return ((const char *)(str+1));
1831 }
1832 
1833 
1834 const char *
1835 ipprotos(int arg)	/* IP protocols cf. netinet/in.h */
1836 {
1837 	switch (arg) {
1838 	case IPPROTO_IP:	return ("IPPROTO_IP");
1839 	case IPPROTO_ICMP:	return ("IPPROTO_ICMP");
1840 	case IPPROTO_IGMP:	return ("IPPROTO_IGMP");
1841 	case IPPROTO_GGP:	return ("IPPROTO_GGP");
1842 	case IPPROTO_ENCAP:	return ("IPPROTO_ENCAP");
1843 	case IPPROTO_TCP:	return ("IPPROTO_TCP");
1844 	case IPPROTO_EGP:	return ("IPPROTO_EGP");
1845 	case IPPROTO_PUP:	return ("IPPROTO_PUP");
1846 	case IPPROTO_UDP:	return ("IPPROTO_UDP");
1847 	case IPPROTO_IDP:	return ("IPPROTO_IDP");
1848 	case IPPROTO_IPV6:	return ("IPPROTO_IPV6");
1849 	case IPPROTO_ROUTING:	return ("IPPROTO_ROUTING");
1850 	case IPPROTO_FRAGMENT:	return ("IPPROTO_FRAGMENT");
1851 	case IPPROTO_RSVP:	return ("IPPROTO_RSVP");
1852 	case IPPROTO_ESP:	return ("IPPROTO_ESP");
1853 	case IPPROTO_AH:	return ("IPPROTO_AH");
1854 	case IPPROTO_ICMPV6:	return ("IPPROTO_ICMPV6");
1855 	case IPPROTO_NONE:	return ("IPPROTO_NONE");
1856 	case IPPROTO_DSTOPTS:	return ("IPPROTO_DSTOPTS");
1857 	case IPPROTO_HELLO:	return ("IPPROTO_HELLO");
1858 	case IPPROTO_ND:	return ("IPPROTO_ND");
1859 	case IPPROTO_EON:	return ("IPPROTO_EON");
1860 	case IPPROTO_PIM:	return ("IPPROTO_PIM");
1861 	case IPPROTO_SCTP:	return ("IPPROTO_SCTP");
1862 	case IPPROTO_RAW:	return ("IPPROTO_RAW");
1863 	default:		return (NULL);
1864 	}
1865 }
1866