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