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