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