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