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