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