xref: /onnv-gate/usr/src/cmd/truss/codes.c (revision 269)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
230Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
280Sstevel@tonic-gate /*	  All Rights Reserved  	*/
290Sstevel@tonic-gate 
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <stdio.h>
340Sstevel@tonic-gate #include <stdlib.h>
350Sstevel@tonic-gate #include <unistd.h>
360Sstevel@tonic-gate #include <sys/types.h>
370Sstevel@tonic-gate #include <libproc.h>
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #include <ctype.h>
400Sstevel@tonic-gate #include <string.h>
410Sstevel@tonic-gate #include <sys/dlpi.h>
420Sstevel@tonic-gate #include <sys/ipc.h>
430Sstevel@tonic-gate #include <sys/ipc_impl.h>
440Sstevel@tonic-gate #include <sys/msg.h>
450Sstevel@tonic-gate #include <sys/sem.h>
460Sstevel@tonic-gate #include <sys/shm.h>
470Sstevel@tonic-gate #include <sys/fstyp.h>
480Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
490Sstevel@tonic-gate #include <sys/sysi86.h>
500Sstevel@tonic-gate #endif /* __i386 */
510Sstevel@tonic-gate #include <sys/unistd.h>
520Sstevel@tonic-gate #include <sys/file.h>
530Sstevel@tonic-gate #include <sys/tiuser.h>
540Sstevel@tonic-gate #include <sys/timod.h>
550Sstevel@tonic-gate #include <sys/stream.h>
560Sstevel@tonic-gate #include <sys/stropts.h>
570Sstevel@tonic-gate #include <sys/termios.h>
580Sstevel@tonic-gate #include <sys/termiox.h>
590Sstevel@tonic-gate #include <sys/jioctl.h>
600Sstevel@tonic-gate #include <sys/filio.h>
610Sstevel@tonic-gate #include <fcntl.h>
620Sstevel@tonic-gate #include <sys/termio.h>
630Sstevel@tonic-gate #include <sys/stermio.h>
640Sstevel@tonic-gate #include <sys/ttold.h>
650Sstevel@tonic-gate #include <sys/lock.h>
660Sstevel@tonic-gate #include <sys/mount.h>
670Sstevel@tonic-gate #include <sys/utssys.h>
680Sstevel@tonic-gate #include <sys/sysconfig.h>
690Sstevel@tonic-gate #include <sys/statvfs.h>
700Sstevel@tonic-gate #include <sys/kstat.h>
710Sstevel@tonic-gate #include <sys/audio.h>
720Sstevel@tonic-gate #include <sys/mixer.h>
730Sstevel@tonic-gate #include <sys/vol.h>
740Sstevel@tonic-gate #include <sys/cpc_impl.h>
750Sstevel@tonic-gate #include <sys/devpoll.h>
760Sstevel@tonic-gate #include <sys/strredir.h>
770Sstevel@tonic-gate #include <sys/sockio.h>
780Sstevel@tonic-gate #include <netinet/ip_mroute.h>
790Sstevel@tonic-gate #include <net/if.h>
800Sstevel@tonic-gate #include <net/if_arp.h>
810Sstevel@tonic-gate #include <sys/ptyvar.h>
820Sstevel@tonic-gate #include <sys/des.h>
830Sstevel@tonic-gate #include <sys/prnio.h>
840Sstevel@tonic-gate #include <sys/dtrace.h>
850Sstevel@tonic-gate #include <sys/crypto/ioctladmin.h>
860Sstevel@tonic-gate #include <sys/crypto/ioctl.h>
870Sstevel@tonic-gate #include <sys/kbio.h>
880Sstevel@tonic-gate #include <sys/ptms.h>
890Sstevel@tonic-gate #include <sys/aggr.h>
900Sstevel@tonic-gate #include <sys/dld.h>
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #include "ramdata.h"
930Sstevel@tonic-gate #include "proto.h"
940Sstevel@tonic-gate 
950Sstevel@tonic-gate #define	FCNTLMIN	F_DUPFD
960Sstevel@tonic-gate #define	FCNTLMAX	44		/* F_SETLK64_NBMAND */
970Sstevel@tonic-gate const char *const FCNTLname[] = {
980Sstevel@tonic-gate 	"F_DUPFD",
990Sstevel@tonic-gate 	"F_GETFD",
1000Sstevel@tonic-gate 	"F_SETFD",
1010Sstevel@tonic-gate 	"F_GETFL",
1020Sstevel@tonic-gate 	"F_SETFL",
1030Sstevel@tonic-gate 	"F_O_GETLK",
1040Sstevel@tonic-gate 	"F_SETLK",
1050Sstevel@tonic-gate 	"F_SETLKW",
1060Sstevel@tonic-gate 	"F_CHKFL",
1070Sstevel@tonic-gate 	"F_DUP2FD",
1080Sstevel@tonic-gate 	"F_ALLOCSP",
1090Sstevel@tonic-gate 	"F_FREESP",
1100Sstevel@tonic-gate 	NULL,		/* 12 */
1110Sstevel@tonic-gate 	NULL,		/* 13 */
1120Sstevel@tonic-gate 	"F_GETLK",
1130Sstevel@tonic-gate 	NULL,		/* 15 */
1140Sstevel@tonic-gate 	NULL,		/* 16 */
1150Sstevel@tonic-gate 	NULL,		/* 17 */
1160Sstevel@tonic-gate 	NULL,		/* 18 */
1170Sstevel@tonic-gate 	NULL,		/* 19 */
1180Sstevel@tonic-gate 	NULL,		/* 20 */
1190Sstevel@tonic-gate 	NULL,		/* 21 */
1200Sstevel@tonic-gate 	NULL,		/* 22 */
1210Sstevel@tonic-gate 	"F_GETOWN",
1220Sstevel@tonic-gate 	"F_SETOWN",
1230Sstevel@tonic-gate 	"F_REVOKE",
1240Sstevel@tonic-gate 	"F_HASREMOTELOCKS",
1250Sstevel@tonic-gate 	"F_FREESP64",
1260Sstevel@tonic-gate 	NULL,		/* 28 */
1270Sstevel@tonic-gate 	NULL,		/* 29 */
1280Sstevel@tonic-gate 	NULL,		/* 30 */
1290Sstevel@tonic-gate 	NULL,		/* 31 */
1300Sstevel@tonic-gate 	NULL,		/* 32 */
1310Sstevel@tonic-gate 	"F_GETLK64",
1320Sstevel@tonic-gate 	"F_SETLK64",
1330Sstevel@tonic-gate 	"F_SETLKW64",
1340Sstevel@tonic-gate 	NULL,		/* 36 */
1350Sstevel@tonic-gate 	NULL,		/* 37 */
1360Sstevel@tonic-gate 	NULL,		/* 38 */
1370Sstevel@tonic-gate 	NULL,		/* 39 */
1380Sstevel@tonic-gate 	"F_SHARE",
1390Sstevel@tonic-gate 	"F_UNSHARE",
1400Sstevel@tonic-gate 	"F_SETLK_NBMAND",
1410Sstevel@tonic-gate 	"F_SHARE_NBMAND",
1420Sstevel@tonic-gate 	"F_SETLK64_NBMAND"
1430Sstevel@tonic-gate };
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate #define	SYSFSMIN	GETFSIND
1460Sstevel@tonic-gate #define	SYSFSMAX	GETNFSTYP
1470Sstevel@tonic-gate const char *const SYSFSname[] = {
1480Sstevel@tonic-gate 	"GETFSIND",
1490Sstevel@tonic-gate 	"GETFSTYP",
1500Sstevel@tonic-gate 	"GETNFSTYP"
1510Sstevel@tonic-gate };
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate #define	PLOCKMIN	UNLOCK
1540Sstevel@tonic-gate #define	PLOCKMAX	DATLOCK
1550Sstevel@tonic-gate const char *const PLOCKname[] = {
1560Sstevel@tonic-gate 	"UNLOCK",
1570Sstevel@tonic-gate 	"PROCLOCK",
1580Sstevel@tonic-gate 	"TXTLOCK",
1590Sstevel@tonic-gate 	NULL,
1600Sstevel@tonic-gate 	"DATLOCK"
1610Sstevel@tonic-gate };
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate #define	SCONFMIN	_CONFIG_NGROUPS
1640Sstevel@tonic-gate #define	SCONFMAX	_CONFIG_CPUID_MAX
1650Sstevel@tonic-gate const char *const SCONFname[] = {
1660Sstevel@tonic-gate 	"_CONFIG_NGROUPS",		/*  2 */
1670Sstevel@tonic-gate 	"_CONFIG_CHILD_MAX",		/*  3 */
1680Sstevel@tonic-gate 	"_CONFIG_OPEN_FILES",		/*  4 */
1690Sstevel@tonic-gate 	"_CONFIG_POSIX_VER",		/*  5 */
1700Sstevel@tonic-gate 	"_CONFIG_PAGESIZE",		/*  6 */
1710Sstevel@tonic-gate 	"_CONFIG_CLK_TCK",		/*  7 */
1720Sstevel@tonic-gate 	"_CONFIG_XOPEN_VER",		/*  8 */
1730Sstevel@tonic-gate 	"_CONFIG_HRESCLK_TCK",		/*  9 */
1740Sstevel@tonic-gate 	"_CONFIG_PROF_TCK",		/* 10 */
1750Sstevel@tonic-gate 	"_CONFIG_NPROC_CONF",		/* 11 */
1760Sstevel@tonic-gate 	"_CONFIG_NPROC_ONLN",		/* 12 */
1770Sstevel@tonic-gate 	"_CONFIG_AIO_LISTIO_MAX",	/* 13 */
1780Sstevel@tonic-gate 	"_CONFIG_AIO_MAX",		/* 14 */
1790Sstevel@tonic-gate 	"_CONFIG_AIO_PRIO_DELTA_MAX",	/* 15 */
1800Sstevel@tonic-gate 	"_CONFIG_DELAYTIMER_MAX",	/* 16 */
1810Sstevel@tonic-gate 	"_CONFIG_MQ_OPEN_MAX",		/* 17 */
1820Sstevel@tonic-gate 	"_CONFIG_MQ_PRIO_MAX",		/* 18 */
1830Sstevel@tonic-gate 	"_CONFIG_RTSIG_MAX",		/* 19 */
1840Sstevel@tonic-gate 	"_CONFIG_SEM_NSEMS_MAX",	/* 20 */
1850Sstevel@tonic-gate 	"_CONFIG_SEM_VALUE_MAX",	/* 21 */
1860Sstevel@tonic-gate 	"_CONFIG_SIGQUEUE_MAX",		/* 22 */
1870Sstevel@tonic-gate 	"_CONFIG_SIGRT_MIN",		/* 23 */
1880Sstevel@tonic-gate 	"_CONFIG_SIGRT_MAX",		/* 24 */
1890Sstevel@tonic-gate 	"_CONFIG_TIMER_MAX",		/* 25 */
1900Sstevel@tonic-gate 	"_CONFIG_PHYS_PAGES",		/* 26 */
1910Sstevel@tonic-gate 	"_CONFIG_AVPHYS_PAGES",		/* 27 */
1920Sstevel@tonic-gate 	"_CONFIG_COHERENCY",		/* 28 */
1930Sstevel@tonic-gate 	"_CONFIG_SPLIT_CACHE",		/* 29 */
1940Sstevel@tonic-gate 	"_CONFIG_ICACHESZ",		/* 30 */
1950Sstevel@tonic-gate 	"_CONFIG_DCACHESZ",		/* 31 */
1960Sstevel@tonic-gate 	"_CONFIG_ICACHELINESZ",		/* 32 */
1970Sstevel@tonic-gate 	"_CONFIG_DCACHELINESZ",		/* 33 */
1980Sstevel@tonic-gate 	"_CONFIG_ICACHEBLKSZ",		/* 34 */
1990Sstevel@tonic-gate 	"_CONFIG_DCACHEBLKSZ",		/* 35 */
2000Sstevel@tonic-gate 	"_CONFIG_DCACHETBLKSZ",		/* 36 */
2010Sstevel@tonic-gate 	"_CONFIG_ICACHE_ASSOC",		/* 37 */
2020Sstevel@tonic-gate 	"_CONFIG_DCACHE_ASSOC",		/* 38 */
2030Sstevel@tonic-gate 	NULL,				/* 39 */
2040Sstevel@tonic-gate 	NULL,				/* 40 */
2050Sstevel@tonic-gate 	NULL,				/* 41 */
2060Sstevel@tonic-gate 	"_CONFIG_MAXPID",		/* 42 */
2070Sstevel@tonic-gate 	"_CONFIG_STACK_PROT",		/* 43 */
2080Sstevel@tonic-gate 	"_CONFIG_NPROC_MAX",		/* 44 */
2090Sstevel@tonic-gate 	"_CONFIG_CPUID_MAX"		/* 45 */
2100Sstevel@tonic-gate };
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate #define	PATHCONFMIN	_PC_LINK_MAX
2130Sstevel@tonic-gate #define	PATHCONFMAX	_PC_CHOWN_RESTRICTED
2140Sstevel@tonic-gate const char *const PATHCONFname[] = {
2150Sstevel@tonic-gate 	"_PC_LINK_MAX",
2160Sstevel@tonic-gate 	"_PC_MAX_CANON",
2170Sstevel@tonic-gate 	"_PC_MAX_INPUT",
2180Sstevel@tonic-gate 	"_PC_NAME_MAX",
2190Sstevel@tonic-gate 	"_PC_PATH_MAX",
2200Sstevel@tonic-gate 	"_PC_PIPE_BUF",
2210Sstevel@tonic-gate 	"_PC_NO_TRUNC",
2220Sstevel@tonic-gate 	"_PC_VDISABLE",
2230Sstevel@tonic-gate 	"_PC_CHOWN_RESTRICTED"
2240Sstevel@tonic-gate };
2250Sstevel@tonic-gate 
2260Sstevel@tonic-gate const struct ioc {
2270Sstevel@tonic-gate 	uint_t	code;
2280Sstevel@tonic-gate 	const char *name;
2290Sstevel@tonic-gate 	const char *datastruct;
2300Sstevel@tonic-gate } ioc[] = {
2310Sstevel@tonic-gate 	{ (uint_t)TCGETA,	"TCGETA",	NULL },
2320Sstevel@tonic-gate 	{ (uint_t)TCSETA,	"TCSETA",	NULL },
2330Sstevel@tonic-gate 	{ (uint_t)TCSETAW,	"TCSETAW",	NULL },
2340Sstevel@tonic-gate 	{ (uint_t)TCSETAF,	"TCSETAF",	NULL },
2350Sstevel@tonic-gate 	{ (uint_t)TCFLSH,	"TCFLSH",	NULL },
2360Sstevel@tonic-gate 	{ (uint_t)TIOCKBON,	"TIOCKBON",	NULL },
2370Sstevel@tonic-gate 	{ (uint_t)TIOCKBOF,	"TIOCKBOF",	NULL },
2380Sstevel@tonic-gate 	{ (uint_t)KBENABLED,	"KBENABLED",	NULL },
2390Sstevel@tonic-gate 	{ (uint_t)TCGETS,	"TCGETS",	NULL },
2400Sstevel@tonic-gate 	{ (uint_t)TCSETS,	"TCSETS",	NULL },
2410Sstevel@tonic-gate 	{ (uint_t)TCSETSW,	"TCSETSW",	NULL },
2420Sstevel@tonic-gate 	{ (uint_t)TCSETSF,	"TCSETSF",	NULL },
2430Sstevel@tonic-gate 	{ (uint_t)TCXONC,	"TCXONC",	NULL },
2440Sstevel@tonic-gate 	{ (uint_t)TCSBRK,	"TCSBRK",	NULL },
2450Sstevel@tonic-gate 	{ (uint_t)TCDSET,	"TCDSET",	NULL },
2460Sstevel@tonic-gate 	{ (uint_t)RTS_TOG,	"RTS_TOG",	NULL },
2470Sstevel@tonic-gate 	{ (uint_t)TIOCSWINSZ,	"TIOCSWINSZ",	NULL },
2480Sstevel@tonic-gate 	{ (uint_t)TIOCGWINSZ,	"TIOCGWINSZ",	NULL },
2490Sstevel@tonic-gate 	{ (uint_t)TIOCGETD,	"TIOCGETD",	NULL },
2500Sstevel@tonic-gate 	{ (uint_t)TIOCSETD,	"TIOCSETD",	NULL },
2510Sstevel@tonic-gate 	{ (uint_t)TIOCHPCL,	"TIOCHPCL",	NULL },
2520Sstevel@tonic-gate 	{ (uint_t)TIOCGETP,	"TIOCGETP",	NULL },
2530Sstevel@tonic-gate 	{ (uint_t)TIOCSETP,	"TIOCSETP",	NULL },
2540Sstevel@tonic-gate 	{ (uint_t)TIOCSETN,	"TIOCSETN",	NULL },
2550Sstevel@tonic-gate 	{ (uint_t)TIOCEXCL,	"TIOCEXCL",	NULL },
2560Sstevel@tonic-gate 	{ (uint_t)TIOCNXCL,	"TIOCNXCL",	NULL },
2570Sstevel@tonic-gate 	{ (uint_t)TIOCFLUSH,	"TIOCFLUSH",	NULL },
2580Sstevel@tonic-gate 	{ (uint_t)TIOCSETC,	"TIOCSETC",	NULL },
2590Sstevel@tonic-gate 	{ (uint_t)TIOCGETC,	"TIOCGETC",	NULL },
2600Sstevel@tonic-gate 	{ (uint_t)TIOCGPGRP,	"TIOCGPGRP",	NULL },
2610Sstevel@tonic-gate 	{ (uint_t)TIOCSPGRP,	"TIOCSPGRP",	NULL },
2620Sstevel@tonic-gate 	{ (uint_t)TIOCGSID,	"TIOCGSID",	NULL },
2630Sstevel@tonic-gate 	{ (uint_t)TIOCSTI,	"TIOCSTI",	NULL },
2640Sstevel@tonic-gate 	{ (uint_t)TIOCMSET,	"TIOCMSET",	NULL },
2650Sstevel@tonic-gate 	{ (uint_t)TIOCMBIS,	"TIOCMBIS",	NULL },
2660Sstevel@tonic-gate 	{ (uint_t)TIOCMBIC,	"TIOCMBIC",	NULL },
2670Sstevel@tonic-gate 	{ (uint_t)TIOCMGET,	"TIOCMGET",	NULL },
2680Sstevel@tonic-gate 	{ (uint_t)TIOCREMOTE,	"TIOCREMOTE",	NULL },
2690Sstevel@tonic-gate 	{ (uint_t)TIOCSIGNAL,	"TIOCSIGNAL",	NULL },
2700Sstevel@tonic-gate 	{ (uint_t)TIOCSTART,	"TIOCSTART",	NULL },
2710Sstevel@tonic-gate 	{ (uint_t)TIOCSTOP,	"TIOCSTOP",	NULL },
2720Sstevel@tonic-gate 	{ (uint_t)TIOCNOTTY,	"TIOCNOTTY",	NULL },
2730Sstevel@tonic-gate 	{ (uint_t)TIOCOUTQ,	"TIOCOUTQ",	NULL },
2740Sstevel@tonic-gate 	{ (uint_t)TIOCGLTC,	"TIOCGLTC",	NULL },
2750Sstevel@tonic-gate 	{ (uint_t)TIOCSLTC,	"TIOCSLTC",	NULL },
2760Sstevel@tonic-gate 	{ (uint_t)TIOCCDTR,	"TIOCCDTR",	NULL },
2770Sstevel@tonic-gate 	{ (uint_t)TIOCSDTR,	"TIOCSDTR",	NULL },
2780Sstevel@tonic-gate 	{ (uint_t)TIOCCBRK,	"TIOCCBRK",	NULL },
2790Sstevel@tonic-gate 	{ (uint_t)TIOCSBRK,	"TIOCSBRK",	NULL },
2800Sstevel@tonic-gate 	{ (uint_t)TIOCLGET,	"TIOCLGET",	NULL },
2810Sstevel@tonic-gate 	{ (uint_t)TIOCLSET,	"TIOCLSET",	NULL },
2820Sstevel@tonic-gate 	{ (uint_t)TIOCLBIC,	"TIOCLBIC",	NULL },
2830Sstevel@tonic-gate 	{ (uint_t)TIOCLBIS,	"TIOCLBIS",	NULL },
2840Sstevel@tonic-gate 
2850Sstevel@tonic-gate 	{ (uint_t)TIOCPKT,	"TIOCPKT",	NULL },	/* ptyvar.h */
2860Sstevel@tonic-gate 	{ (uint_t)TIOCUCNTL,	"TIOCUCNTL",	NULL },
2870Sstevel@tonic-gate 	{ (uint_t)TIOCTCNTL,	"TIOCTCNTL",	NULL },
2880Sstevel@tonic-gate 	{ (uint_t)TIOCISPACE,	"TIOCISPACE",	NULL },
2890Sstevel@tonic-gate 	{ (uint_t)TIOCISIZE,	"TIOCISIZE",	NULL },
2900Sstevel@tonic-gate 	{ (uint_t)TIOCSSIZE,	"TIOCSSIZE",	"ttysize" },
2910Sstevel@tonic-gate 	{ (uint_t)TIOCGSIZE,	"TIOCGSIZE",	"ttysize" },
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate 	/*
2940Sstevel@tonic-gate 	 * DLIOCRAW has the same ioctl number as LDCLOSE.  Since the LDIOC
2950Sstevel@tonic-gate 	 * ioctls (for xenix compatibility) are far less likely to be used, we
2960Sstevel@tonic-gate 	 * give preference to DLIOCRAW, which is the only userland ioctl in the
2970Sstevel@tonic-gate 	 * DLIOC family.
2980Sstevel@tonic-gate 	 */
2990Sstevel@tonic-gate 	{ (uint_t)DLIOCRAW,	"DLIOCRAW",	NULL },
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate 	{ (uint_t)LDOPEN,	"LDOPEN",	NULL },
3020Sstevel@tonic-gate 	{ (uint_t)LDCLOSE,	"LDCLOSE",	NULL },
3030Sstevel@tonic-gate 	{ (uint_t)LDCHG,	"LDCHG",	NULL },
3040Sstevel@tonic-gate 	{ (uint_t)LDGETT,	"LDGETT",	NULL },
3050Sstevel@tonic-gate 	{ (uint_t)LDSETT,	"LDSETT",	NULL },
3060Sstevel@tonic-gate 	{ (uint_t)LDSMAP,	"LDSMAP",	NULL },
3070Sstevel@tonic-gate 	{ (uint_t)LDGMAP,	"LDGMAP",	NULL },
3080Sstevel@tonic-gate 	{ (uint_t)LDNMAP,	"LDNMAP",	NULL },
3090Sstevel@tonic-gate 	{ (uint_t)TCGETX,	"TCGETX",	NULL },
3100Sstevel@tonic-gate 	{ (uint_t)TCSETX,	"TCSETX",	NULL },
3110Sstevel@tonic-gate 	{ (uint_t)TCSETXW,	"TCSETXW",	NULL },
3120Sstevel@tonic-gate 	{ (uint_t)TCSETXF,	"TCSETXF",	NULL },
3130Sstevel@tonic-gate 	{ (uint_t)FIORDCHK,	"FIORDCHK",	NULL },
3140Sstevel@tonic-gate 	{ (uint_t)FIOCLEX,	"FIOCLEX",	NULL },
3150Sstevel@tonic-gate 	{ (uint_t)FIONCLEX,	"FIONCLEX",	NULL },
3160Sstevel@tonic-gate 	{ (uint_t)FIONREAD,	"FIONREAD",	NULL },
3170Sstevel@tonic-gate 	{ (uint_t)FIONBIO,	"FIONBIO",	NULL },
3180Sstevel@tonic-gate 	{ (uint_t)FIOASYNC,	"FIOASYNC",	NULL },
3190Sstevel@tonic-gate 	{ (uint_t)FIOSETOWN,	"FIOSETOWN",	NULL },
3200Sstevel@tonic-gate 	{ (uint_t)FIOGETOWN,	"FIOGETOWN",	NULL },
3210Sstevel@tonic-gate #ifdef DIOCGETP
3220Sstevel@tonic-gate 	{ (uint_t)DIOCGETP,	"DIOCGETP",	NULL },
3230Sstevel@tonic-gate 	{ (uint_t)DIOCSETP,	"DIOCSETP",	NULL },
3240Sstevel@tonic-gate #endif
3250Sstevel@tonic-gate #ifdef DIOCGETC
3260Sstevel@tonic-gate 	{ (uint_t)DIOCGETC,	"DIOCGETC",	NULL },
3270Sstevel@tonic-gate 	{ (uint_t)DIOCGETB,	"DIOCGETB",	NULL },
3280Sstevel@tonic-gate 	{ (uint_t)DIOCSETE,	"DIOCSETE",	NULL },
3290Sstevel@tonic-gate #endif
3300Sstevel@tonic-gate #ifdef IFFORMAT
3310Sstevel@tonic-gate 	{ (uint_t)IFFORMAT,	"IFFORMAT",	NULL },
3320Sstevel@tonic-gate 	{ (uint_t)IFBCHECK,	"IFBCHECK",	NULL },
3330Sstevel@tonic-gate 	{ (uint_t)IFCONFIRM,	"IFCONFIRM",	NULL },
3340Sstevel@tonic-gate #endif
3350Sstevel@tonic-gate #ifdef LIOCGETP
3360Sstevel@tonic-gate 	{ (uint_t)LIOCGETP,	"LIOCGETP",	NULL },
3370Sstevel@tonic-gate 	{ (uint_t)LIOCSETP,	"LIOCSETP",	NULL },
3380Sstevel@tonic-gate 	{ (uint_t)LIOCGETS,	"LIOCGETS",	NULL },
3390Sstevel@tonic-gate 	{ (uint_t)LIOCSETS,	"LIOCSETS",	NULL },
3400Sstevel@tonic-gate #endif
3410Sstevel@tonic-gate #ifdef JBOOT
3420Sstevel@tonic-gate 	{ (uint_t)JBOOT,	"JBOOT",	NULL },
3430Sstevel@tonic-gate 	{ (uint_t)JTERM,	"JTERM",	NULL },
3440Sstevel@tonic-gate 	{ (uint_t)JMPX,		"JMPX",	NULL },
3450Sstevel@tonic-gate #ifdef JTIMO
3460Sstevel@tonic-gate 	{ (uint_t)JTIMO,	"JTIMO",	NULL },
3470Sstevel@tonic-gate #endif
3480Sstevel@tonic-gate 	{ (uint_t)JWINSIZE,	"JWINSIZE",	NULL },
3490Sstevel@tonic-gate 	{ (uint_t)JTIMOM,	"JTIMOM",	NULL },
3500Sstevel@tonic-gate 	{ (uint_t)JZOMBOOT,	"JZOMBOOT",	NULL },
3510Sstevel@tonic-gate 	{ (uint_t)JAGENT,	"JAGENT",	NULL },
3520Sstevel@tonic-gate 	{ (uint_t)JTRUN,	"JTRUN",	NULL },
3530Sstevel@tonic-gate 	{ (uint_t)JXTPROTO,	"JXTPROTO",	NULL },
3540Sstevel@tonic-gate #endif
3550Sstevel@tonic-gate 	{ (uint_t)KSTAT_IOC_CHAIN_ID,	"KSTAT_IOC_CHAIN_ID",	NULL },
3560Sstevel@tonic-gate 	{ (uint_t)KSTAT_IOC_READ,	"KSTAT_IOC_READ",	NULL },
3570Sstevel@tonic-gate 	{ (uint_t)KSTAT_IOC_WRITE,	"KSTAT_IOC_WRITE",	NULL },
3580Sstevel@tonic-gate 	{ (uint_t)STGET,	"STGET",	NULL },
3590Sstevel@tonic-gate 	{ (uint_t)STSET,	"STSET",	NULL },
3600Sstevel@tonic-gate 	{ (uint_t)STTHROW,	"STTHROW",	NULL },
3610Sstevel@tonic-gate 	{ (uint_t)STWLINE,	"STWLINE",	NULL },
3620Sstevel@tonic-gate 	{ (uint_t)STTSV,	"STTSV",	NULL },
3630Sstevel@tonic-gate 	{ (uint_t)I_NREAD,	"I_NREAD",	NULL },
3640Sstevel@tonic-gate 	{ (uint_t)I_PUSH,	"I_PUSH",	NULL },
3650Sstevel@tonic-gate 	{ (uint_t)I_POP,	"I_POP",	NULL },
3660Sstevel@tonic-gate 	{ (uint_t)I_LOOK,	"I_LOOK",	NULL },
3670Sstevel@tonic-gate 	{ (uint_t)I_FLUSH,	"I_FLUSH",	NULL },
3680Sstevel@tonic-gate 	{ (uint_t)I_SRDOPT,	"I_SRDOPT",	NULL },
3690Sstevel@tonic-gate 	{ (uint_t)I_GRDOPT,	"I_GRDOPT",	NULL },
3700Sstevel@tonic-gate 	{ (uint_t)I_STR,	"I_STR",	NULL },
3710Sstevel@tonic-gate 	{ (uint_t)I_SETSIG,	"I_SETSIG",	NULL },
3720Sstevel@tonic-gate 	{ (uint_t)I_GETSIG,	"I_GETSIG",	NULL },
3730Sstevel@tonic-gate 	{ (uint_t)I_FIND,	"I_FIND",	NULL },
3740Sstevel@tonic-gate 	{ (uint_t)I_LINK,	"I_LINK",	NULL },
3750Sstevel@tonic-gate 	{ (uint_t)I_UNLINK,	"I_UNLINK",	NULL },
3760Sstevel@tonic-gate 	{ (uint_t)I_PEEK,	"I_PEEK",	NULL },
3770Sstevel@tonic-gate 	{ (uint_t)I_FDINSERT,	"I_FDINSERT",	NULL },
3780Sstevel@tonic-gate 	{ (uint_t)I_SENDFD,	"I_SENDFD",	NULL },
3790Sstevel@tonic-gate 	{ (uint_t)I_RECVFD,	"I_RECVFD",	NULL },
3800Sstevel@tonic-gate 	{ (uint_t)I_SWROPT,	"I_SWROPT",	NULL },
3810Sstevel@tonic-gate 	{ (uint_t)I_GWROPT,	"I_GWROPT",	NULL },
3820Sstevel@tonic-gate 	{ (uint_t)I_LIST,	"I_LIST",	NULL },
3830Sstevel@tonic-gate 	{ (uint_t)I_PLINK,	"I_PLINK",	NULL },
3840Sstevel@tonic-gate 	{ (uint_t)I_PUNLINK,	"I_PUNLINK",	NULL },
3850Sstevel@tonic-gate 	{ (uint_t)I_FLUSHBAND,	"I_FLUSHBAND",	NULL },
3860Sstevel@tonic-gate 	{ (uint_t)I_CKBAND,	"I_CKBAND",	NULL },
3870Sstevel@tonic-gate 	{ (uint_t)I_GETBAND,	"I_GETBAND",	NULL },
3880Sstevel@tonic-gate 	{ (uint_t)I_ATMARK,	"I_ATMARK",	NULL },
3890Sstevel@tonic-gate 	{ (uint_t)I_SETCLTIME,	"I_SETCLTIME",	NULL },
3900Sstevel@tonic-gate 	{ (uint_t)I_GETCLTIME,	"I_GETCLTIME",	NULL },
3910Sstevel@tonic-gate 	{ (uint_t)I_CANPUT,	"I_CANPUT",	NULL },
3920Sstevel@tonic-gate #ifdef I_ANCHOR
3930Sstevel@tonic-gate 	{ (uint_t)I_ANCHOR,	"I_ANCHOR",	NULL },
3940Sstevel@tonic-gate #endif
3950Sstevel@tonic-gate #ifdef TI_GETINFO
3960Sstevel@tonic-gate 	{ (uint_t)TI_GETINFO,	"TI_GETINFO",	NULL },
3970Sstevel@tonic-gate 	{ (uint_t)TI_OPTMGMT,	"TI_OPTMGMT",	NULL },
3980Sstevel@tonic-gate 	{ (uint_t)TI_BIND,	"TI_BIND",	NULL },
3990Sstevel@tonic-gate 	{ (uint_t)TI_UNBIND,	"TI_UNBIND",	NULL },
4000Sstevel@tonic-gate #endif
4010Sstevel@tonic-gate #ifdef	TI_CAPABILITY
4020Sstevel@tonic-gate 	{ (uint_t)TI_CAPABILITY,	"TI_CAPABILITY",	NULL },
4030Sstevel@tonic-gate #endif
4040Sstevel@tonic-gate #ifdef TI_GETMYNAME
4050Sstevel@tonic-gate 	{ (uint_t)TI_GETMYNAME,		"TI_GETMYNAME",		NULL },
4060Sstevel@tonic-gate 	{ (uint_t)TI_GETPEERNAME,	"TI_GETPEERNAME",	NULL },
4070Sstevel@tonic-gate 	{ (uint_t)TI_SETMYNAME,		"TI_SETMYNAME",		NULL },
4080Sstevel@tonic-gate 	{ (uint_t)TI_SETPEERNAME,	"TI_SETPEERNAME",	NULL },
4090Sstevel@tonic-gate #endif
4100Sstevel@tonic-gate #ifdef V_PREAD
4110Sstevel@tonic-gate 	{ (uint_t)V_PREAD,	"V_PREAD",	NULL },
4120Sstevel@tonic-gate 	{ (uint_t)V_PWRITE,	"V_PWRITE",	NULL },
4130Sstevel@tonic-gate 	{ (uint_t)V_PDREAD,	"V_PDREAD",	NULL },
4140Sstevel@tonic-gate 	{ (uint_t)V_PDWRITE,	"V_PDWRITE",	NULL },
4150Sstevel@tonic-gate #if !defined(__i386) && !defined(__amd64)
4160Sstevel@tonic-gate 	{ (uint_t)V_GETSSZ,	"V_GETSSZ",	NULL },
4170Sstevel@tonic-gate #endif /* !__i386 */
4180Sstevel@tonic-gate #endif
4190Sstevel@tonic-gate 	/* audio */
4200Sstevel@tonic-gate 	{ (uint_t)AUDIO_GETINFO,	"AUDIO_GETINFO",	NULL },
4210Sstevel@tonic-gate 	{ (uint_t)AUDIO_SETINFO,	"AUDIO_SETINFO",	NULL },
4220Sstevel@tonic-gate 	{ (uint_t)AUDIO_DRAIN,		"AUDIO_DRAIN",		NULL },
4230Sstevel@tonic-gate 	{ (uint_t)AUDIO_GETDEV,		"AUDIO_GETDEV",		NULL },
4240Sstevel@tonic-gate 	{ (uint_t)AUDIO_DIAG_LOOPBACK,	"AUDIO_DIAG_LOOPBACK",	NULL },
4250Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_CH_NUMBER,	"AUDIO_GET_CH_NUMBER",	NULL },
4260Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_CH_TYPE,	"AUDIO_GET_CH_TYPE",	NULL },
4270Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_NUM_CHS,	"AUDIO_GET_NUM_CHS",	NULL },
4280Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_AD_DEV,	"AUDIO_GET_AD_DEV",	NULL },
4290Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_APM_DEV,	"AUDIO_GET_APM_DEV",	NULL },
4300Sstevel@tonic-gate 	{ (uint_t)AUDIO_GET_AS_DEV,	"AUDIO_GET_AS_DEV",	NULL },
4310Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXER_MULTIPLE_OPEN,	"AUDIO_MIXER_MULTIPLE_OPEN",
4320Sstevel@tonic-gate 	    NULL },
4330Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXER_SINGLE_OPEN,	"AUDIO_MIXER_SINGLE_OPEN",
4340Sstevel@tonic-gate 	    NULL },
4350Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXER_GET_SAMPLE_RATES,	"AUDIO_MIXER_GET_SAMPLE_RATES",
4360Sstevel@tonic-gate 	    NULL },
4370Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_GETINFO,	"AUDIO_MIXERCTL_GETINFO",
4380Sstevel@tonic-gate 	    NULL },
4390Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_SETINFO,	"AUDIO_MIXERCTL_SETINFO",
4400Sstevel@tonic-gate 	    NULL },
4410Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_GET_CHINFO,	"AUDIO_MIXERCTL_GET_CHINFO",
4420Sstevel@tonic-gate 	    NULL },
4430Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_SET_CHINFO,	"AUDIO_MIXERCTL_SET_CHINFO",
4440Sstevel@tonic-gate 	    NULL },
4450Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_GET_MODE,	"AUDIO_MIXERCTL_GET_MODE",
4460Sstevel@tonic-gate 	    NULL },
4470Sstevel@tonic-gate 	{ (uint_t)AUDIO_MIXERCTL_SET_MODE,	"AUDIO_MIXERCTL_SET_MODE",
4480Sstevel@tonic-gate 	    NULL },
4490Sstevel@tonic-gate 	/* volume management (control ioctls) */
4500Sstevel@tonic-gate 	{ (uint_t)VOLIOCMAP,	"VOLIOCMAP",	NULL },
4510Sstevel@tonic-gate 	{ (uint_t)VOLIOCUNMAP,	"VOLIOCUNMAP",	NULL },
4520Sstevel@tonic-gate 	{ (uint_t)VOLIOCEVENT,	"VOLIOCEVENT",	NULL },
4530Sstevel@tonic-gate 	{ (uint_t)VOLIOCEJECT,	"VOLIOCEJECT",	NULL },
4540Sstevel@tonic-gate 	{ (uint_t)VOLIOCDGATTR,	"VOLIOCDGATTR",	NULL },
4550Sstevel@tonic-gate 	{ (uint_t)VOLIOCDSATTR,	"VOLIOCDSATTR",	NULL },
4560Sstevel@tonic-gate 	{ (uint_t)VOLIOCDCHECK,	"VOLIOCDCHECK",	NULL },
4570Sstevel@tonic-gate 	{ (uint_t)VOLIOCDINUSE,	"VOLIOCDINUSE",	NULL},
4580Sstevel@tonic-gate 	{ (uint_t)VOLIOCDAEMON,	"VOLIOCDAEMON",	NULL },
4590Sstevel@tonic-gate 	{ (uint_t)VOLIOCFLAGS,	"VOLIOCFLAGS",	NULL },
4600Sstevel@tonic-gate 	{ (uint_t)VOLIOCDROOT,	"VOLIOCDROOT",	NULL },
4610Sstevel@tonic-gate 	{ (uint_t)VOLIOCDSYMNAME, "VOLIOCDSYMNAME",	NULL },
4620Sstevel@tonic-gate 	{ (uint_t)VOLIOCDSYMDEV, "VOLIOCDSYMDEV",	NULL },
4630Sstevel@tonic-gate 	/* volume management (user ioctls) */
4640Sstevel@tonic-gate 	{ (uint_t)VOLIOCINUSE,	"VOLIOCINUSE",	NULL },
4650Sstevel@tonic-gate 	{ (uint_t)VOLIOCCHECK,	"VOLIOCCHECK",	NULL },
4660Sstevel@tonic-gate 	{ (uint_t)VOLIOCCANCEL,	"VOLIOCCANCEL",	NULL },
4670Sstevel@tonic-gate 	{ (uint_t)VOLIOCINFO,	"VOLIOCINFO",	NULL },
4680Sstevel@tonic-gate 	{ (uint_t)VOLIOCSATTR,	"VOLIOCSATTR",	NULL },
4690Sstevel@tonic-gate 	{ (uint_t)VOLIOCGATTR,	"VOLIOCGATTR",	NULL },
4700Sstevel@tonic-gate 	{ (uint_t)VOLIOCROOT,	"VOLIOCROOT",	NULL },
4710Sstevel@tonic-gate 	{ (uint_t)VOLIOCSYMNAME, "VOLIOCSYMNAME",	NULL },
4720Sstevel@tonic-gate 	{ (uint_t)VOLIOCSYMDEV,	"VOLIOCSYMDEV",	NULL },
4730Sstevel@tonic-gate 	/* STREAMS redirection ioctls */
4740Sstevel@tonic-gate 	{ (uint_t)SRIOCSREDIR,		"SRIOCSREDIR",	NULL },
4750Sstevel@tonic-gate 	{ (uint_t)SRIOCISREDIR,		"SRIOCISREDIR",	NULL },
4760Sstevel@tonic-gate 	{ (uint_t)CPCIO_BIND,		"CPCIO_BIND",		NULL },
4770Sstevel@tonic-gate 	{ (uint_t)CPCIO_SAMPLE,		"CPCIO_SAMPLE",		NULL },
4780Sstevel@tonic-gate 	{ (uint_t)CPCIO_RELE,		"CPCIO_RELE",		NULL },
4790Sstevel@tonic-gate 	/* /dev/poll ioctl() control codes */
4800Sstevel@tonic-gate 	{ (uint_t)DP_POLL,	"DP_POLL",	NULL },
4810Sstevel@tonic-gate 	{ (uint_t)DP_ISPOLLED,	"DP_ISPOLLED",	NULL },
4820Sstevel@tonic-gate 	/* the old /proc ioctl() control codes */
4830Sstevel@tonic-gate #define	PIOC	('q'<<8)
4840Sstevel@tonic-gate 	{ (uint_t)(PIOC|1),	"PIOCSTATUS",	NULL },
4850Sstevel@tonic-gate 	{ (uint_t)(PIOC|2),	"PIOCSTOP",	NULL },
4860Sstevel@tonic-gate 	{ (uint_t)(PIOC|3),	"PIOCWSTOP",	NULL },
4870Sstevel@tonic-gate 	{ (uint_t)(PIOC|4),	"PIOCRUN",	NULL },
4880Sstevel@tonic-gate 	{ (uint_t)(PIOC|5),	"PIOCGTRACE",	NULL },
4890Sstevel@tonic-gate 	{ (uint_t)(PIOC|6),	"PIOCSTRACE",	NULL },
4900Sstevel@tonic-gate 	{ (uint_t)(PIOC|7),	"PIOCSSIG",	NULL },
4910Sstevel@tonic-gate 	{ (uint_t)(PIOC|8),	"PIOCKILL",	NULL },
4920Sstevel@tonic-gate 	{ (uint_t)(PIOC|9),	"PIOCUNKILL",	NULL },
4930Sstevel@tonic-gate 	{ (uint_t)(PIOC|10),	"PIOCGHOLD",	NULL },
4940Sstevel@tonic-gate 	{ (uint_t)(PIOC|11),	"PIOCSHOLD",	NULL },
4950Sstevel@tonic-gate 	{ (uint_t)(PIOC|12),	"PIOCMAXSIG",	NULL },
4960Sstevel@tonic-gate 	{ (uint_t)(PIOC|13),	"PIOCACTION",	NULL },
4970Sstevel@tonic-gate 	{ (uint_t)(PIOC|14),	"PIOCGFAULT",	NULL },
4980Sstevel@tonic-gate 	{ (uint_t)(PIOC|15),	"PIOCSFAULT",	NULL },
4990Sstevel@tonic-gate 	{ (uint_t)(PIOC|16),	"PIOCCFAULT",	NULL },
5000Sstevel@tonic-gate 	{ (uint_t)(PIOC|17),	"PIOCGENTRY",	NULL },
5010Sstevel@tonic-gate 	{ (uint_t)(PIOC|18),	"PIOCSENTRY",	NULL },
5020Sstevel@tonic-gate 	{ (uint_t)(PIOC|19),	"PIOCGEXIT",	NULL },
5030Sstevel@tonic-gate 	{ (uint_t)(PIOC|20),	"PIOCSEXIT",	NULL },
5040Sstevel@tonic-gate 	{ (uint_t)(PIOC|21),	"PIOCSFORK",	NULL },
5050Sstevel@tonic-gate 	{ (uint_t)(PIOC|22),	"PIOCRFORK",	NULL },
5060Sstevel@tonic-gate 	{ (uint_t)(PIOC|23),	"PIOCSRLC",	NULL },
5070Sstevel@tonic-gate 	{ (uint_t)(PIOC|24),	"PIOCRRLC",	NULL },
5080Sstevel@tonic-gate 	{ (uint_t)(PIOC|25),	"PIOCGREG",	NULL },
5090Sstevel@tonic-gate 	{ (uint_t)(PIOC|26),	"PIOCSREG",	NULL },
5100Sstevel@tonic-gate 	{ (uint_t)(PIOC|27),	"PIOCGFPREG",	NULL },
5110Sstevel@tonic-gate 	{ (uint_t)(PIOC|28),	"PIOCSFPREG",	NULL },
5120Sstevel@tonic-gate 	{ (uint_t)(PIOC|29),	"PIOCNICE",	NULL },
5130Sstevel@tonic-gate 	{ (uint_t)(PIOC|30),	"PIOCPSINFO",	NULL },
5140Sstevel@tonic-gate 	{ (uint_t)(PIOC|31),	"PIOCNMAP",	NULL },
5150Sstevel@tonic-gate 	{ (uint_t)(PIOC|32),	"PIOCMAP",	NULL },
5160Sstevel@tonic-gate 	{ (uint_t)(PIOC|33),	"PIOCOPENM",	NULL },
5170Sstevel@tonic-gate 	{ (uint_t)(PIOC|34),	"PIOCCRED",	NULL },
5180Sstevel@tonic-gate 	{ (uint_t)(PIOC|35),	"PIOCGROUPS",	NULL },
5190Sstevel@tonic-gate 	{ (uint_t)(PIOC|36),	"PIOCGETPR",	NULL },
5200Sstevel@tonic-gate 	{ (uint_t)(PIOC|37),	"PIOCGETU",	NULL },
5210Sstevel@tonic-gate 	{ (uint_t)(PIOC|38),	"PIOCSET",	NULL },
5220Sstevel@tonic-gate 	{ (uint_t)(PIOC|39),	"PIOCRESET",	NULL },
5230Sstevel@tonic-gate 	{ (uint_t)(PIOC|43),	"PIOCUSAGE",	NULL },
5240Sstevel@tonic-gate 	{ (uint_t)(PIOC|44),	"PIOCOPENPD",	NULL },
5250Sstevel@tonic-gate 	{ (uint_t)(PIOC|45),	"PIOCLWPIDS",	NULL },
5260Sstevel@tonic-gate 	{ (uint_t)(PIOC|46),	"PIOCOPENLWP",	NULL },
5270Sstevel@tonic-gate 	{ (uint_t)(PIOC|47),	"PIOCLSTATUS",	NULL },
5280Sstevel@tonic-gate 	{ (uint_t)(PIOC|48),	"PIOCLUSAGE",	NULL },
5290Sstevel@tonic-gate 	{ (uint_t)(PIOC|49),	"PIOCNAUXV",	NULL },
5300Sstevel@tonic-gate 	{ (uint_t)(PIOC|50),	"PIOCAUXV",	NULL },
5310Sstevel@tonic-gate 	{ (uint_t)(PIOC|51),	"PIOCGXREGSIZE",	NULL },
5320Sstevel@tonic-gate 	{ (uint_t)(PIOC|52),	"PIOCGXREG",	NULL },
5330Sstevel@tonic-gate 	{ (uint_t)(PIOC|53),	"PIOCSXREG",	NULL },
5340Sstevel@tonic-gate 	{ (uint_t)(PIOC|101),	"PIOCGWIN",	NULL },
5350Sstevel@tonic-gate 	{ (uint_t)(PIOC|103),	"PIOCNLDT",	NULL },
5360Sstevel@tonic-gate 	{ (uint_t)(PIOC|104),	"PIOCLDT",	NULL },
5370Sstevel@tonic-gate 
5380Sstevel@tonic-gate 	/* ioctl's applicable on sockets */
5390Sstevel@tonic-gate 	{ (uint_t)SIOCSHIWAT,	"SIOCSHIWAT",	NULL },
5400Sstevel@tonic-gate 	{ (uint_t)SIOCGHIWAT,	"SIOCGHIWAT",	NULL },
5410Sstevel@tonic-gate 	{ (uint_t)SIOCSLOWAT,	"SIOCSLOWAT",	NULL },
5420Sstevel@tonic-gate 	{ (uint_t)SIOCGLOWAT,	"SIOCGLOWAT",	NULL },
5430Sstevel@tonic-gate 	{ (uint_t)SIOCATMARK,	"SIOCATMARK",	NULL },
5440Sstevel@tonic-gate 	{ (uint_t)SIOCSPGRP,	"SIOCSPGRP",	NULL },
5450Sstevel@tonic-gate 	{ (uint_t)SIOCGPGRP,	"SIOCGPGRP",	NULL },
5460Sstevel@tonic-gate 	{ (uint_t)SIOCADDRT,	"SIOCADDRT",	"rtentry" },
5470Sstevel@tonic-gate 	{ (uint_t)SIOCDELRT,	"SIOCDELRT",	"rtentry" },
5480Sstevel@tonic-gate 	{ (uint_t)SIOCGETVIFCNT,	"SIOCGETVIFCNT", "sioc_vif_req" },
5490Sstevel@tonic-gate 	{ (uint_t)SIOCGETSGCNT,	"SIOCGETSGCNT",	"sioc_sg_req" },
5500Sstevel@tonic-gate 	{ (uint_t)SIOCGETLSGCNT,	"SIOCGETLSGCNT", "sioc_lsg_req" },
5510Sstevel@tonic-gate 	{ (uint_t)SIOCSIFADDR,	"SIOCSIFADDR",	"ifreq" },
5520Sstevel@tonic-gate 	{ (uint_t)SIOCGIFADDR,	"SIOCGIFADDR",	"ifreq" },
5530Sstevel@tonic-gate 	{ (uint_t)SIOCSIFDSTADDR,	"SIOCSIFDSTADDR", "ifreq" },
5540Sstevel@tonic-gate 	{ (uint_t)SIOCGIFDSTADDR,	"SIOCGIFDSTADDR", "ifreq" },
5550Sstevel@tonic-gate 	{ (uint_t)SIOCSIFFLAGS,	"SIOCSIFFLAGS",	"ifreq" },
5560Sstevel@tonic-gate 	{ (uint_t)SIOCGIFFLAGS,	"SIOCGIFFLAGS",	"ifreq" },
5570Sstevel@tonic-gate 	{ (uint_t)SIOCSIFMEM,	"SIOCSIFMEM",	"ifreq" },
5580Sstevel@tonic-gate 	{ (uint_t)SIOCGIFMEM,	"SIOCGIFMEM",	"ifreq" },
5590Sstevel@tonic-gate 	{ (uint_t)SIOCGIFCONF,	"SIOCGIFCONF",	"ifconf" },
5600Sstevel@tonic-gate 	{ (uint_t)SIOCSIFMTU,	"SIOCSIFMTU",	"ifreq" },
5610Sstevel@tonic-gate 	{ (uint_t)SIOCGIFMTU,	"SIOCGIFMTU",	"ifreq" },
5620Sstevel@tonic-gate 	{ (uint_t)SIOCGIFBRDADDR,	"SIOCGIFBRDADDR",	"ifreq" },
5630Sstevel@tonic-gate 	{ (uint_t)SIOCSIFBRDADDR,	"SIOCSIFBRDADDR",	"ifreq" },
5640Sstevel@tonic-gate 	{ (uint_t)SIOCGIFNETMASK,	"SIOCGIFNETMASK",	"ifreq" },
5650Sstevel@tonic-gate 	{ (uint_t)SIOCSIFNETMASK,	"SIOCSIFNETMASK",	"ifreq" },
5660Sstevel@tonic-gate 	{ (uint_t)SIOCGIFMETRIC,	"SIOCGIFMETRIC",	"ifreq" },
5670Sstevel@tonic-gate 	{ (uint_t)SIOCSIFMETRIC,	"SIOCSIFMETRIC",	"ifreq" },
5680Sstevel@tonic-gate 	{ (uint_t)SIOCSARP,	"SIOCSARP",	"arpreq" },
5690Sstevel@tonic-gate 	{ (uint_t)SIOCGARP,	"SIOCGARP",	"arpreq" },
5700Sstevel@tonic-gate 	{ (uint_t)SIOCDARP,	"SIOCDARP",	"arpreq" },
5710Sstevel@tonic-gate 	{ (uint_t)SIOCUPPER,	"SIOCUPPER",	"ifreq" },
5720Sstevel@tonic-gate 	{ (uint_t)SIOCLOWER,	"SIOCLOWER",	"ifreq" },
5730Sstevel@tonic-gate 	{ (uint_t)SIOCSETSYNC,	"SIOCSETSYNC",	"ifreq" },
5740Sstevel@tonic-gate 	{ (uint_t)SIOCGETSYNC,	"SIOCGETSYNC",	"ifreq" },
5750Sstevel@tonic-gate 	{ (uint_t)SIOCSSDSTATS,	"SIOCSSDSTATS",	"ifreq" },
5760Sstevel@tonic-gate 	{ (uint_t)SIOCSSESTATS,	"SIOCSSESTATS",	"ifreq" },
5770Sstevel@tonic-gate 	{ (uint_t)SIOCSPROMISC,	"SIOCSPROMISC",	NULL },
5780Sstevel@tonic-gate 	{ (uint_t)SIOCADDMULTI,	"SIOCADDMULTI",	"ifreq" },
5790Sstevel@tonic-gate 	{ (uint_t)SIOCDELMULTI,	"SIOCDELMULTI",	"ifreq" },
5800Sstevel@tonic-gate 	{ (uint_t)SIOCGETNAME,	"SIOCGETNAME",	"sockaddr" },
5810Sstevel@tonic-gate 	{ (uint_t)SIOCGETPEER,	"SIOCGETPEER",	"sockaddr" },
5820Sstevel@tonic-gate 	{ (uint_t)IF_UNITSEL,	"IF_UNITSEL",	NULL },
5830Sstevel@tonic-gate 	{ (uint_t)SIOCXPROTO,	"SIOCXPROTO",	NULL },
5840Sstevel@tonic-gate 	{ (uint_t)SIOCIFDETACH,	"SIOCIFDETACH",	"ifreq" },
5850Sstevel@tonic-gate 	{ (uint_t)SIOCGENPSTATS,	"SIOCGENPSTATS",	"ifreq" },
5860Sstevel@tonic-gate 	{ (uint_t)SIOCX25XMT,	"SIOCX25XMT",	"ifreq" },
5870Sstevel@tonic-gate 	{ (uint_t)SIOCX25RCV,	"SIOCX25RCV",	"ifreq" },
5880Sstevel@tonic-gate 	{ (uint_t)SIOCX25TBL,	"SIOCX25TBL",	"ifreq" },
5890Sstevel@tonic-gate 	{ (uint_t)SIOCSLGETREQ,	"SIOCSLGETREQ",	"ifreq" },
5900Sstevel@tonic-gate 	{ (uint_t)SIOCSLSTAT,	"SIOCSLSTAT",	"ifreq" },
5910Sstevel@tonic-gate 	{ (uint_t)SIOCSIFNAME,	"SIOCSIFNAME",	"ifreq" },
5920Sstevel@tonic-gate 	{ (uint_t)SIOCGENADDR,	"SIOCGENADDR",	"ifreq" },
5930Sstevel@tonic-gate 	{ (uint_t)SIOCGIFNUM,	"SIOCGIFNUM",	NULL },
5940Sstevel@tonic-gate 	{ (uint_t)SIOCGIFMUXID,	"SIOCGIFMUXID",	"ifreq" },
5950Sstevel@tonic-gate 	{ (uint_t)SIOCSIFMUXID,	"SIOCSIFMUXID",	"ifreq" },
5960Sstevel@tonic-gate 	{ (uint_t)SIOCGIFINDEX,	"SIOCGIFINDEX",	"ifreq" },
5970Sstevel@tonic-gate 	{ (uint_t)SIOCSIFINDEX,	"SIOCSIFINDEX",	"ifreq" },
5980Sstevel@tonic-gate 	{ (uint_t)SIOCLIFREMOVEIF,	"SIOCLIFREMOVEIF",	"lifreq" },
5990Sstevel@tonic-gate 	{ (uint_t)SIOCLIFADDIF,		"SIOCLIFADDIF",		"lifreq" },
6000Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFADDR,		"SIOCSLIFADDR",		"lifreq" },
6010Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFADDR,		"SIOCGLIFADDR",		"lifreq" },
6020Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFDSTADDR,	"SIOCSLIFDSTADDR",	"lifreq" },
6030Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFDSTADDR,	"SIOCGLIFDSTADDR",	"lifreq" },
6040Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFFLAGS,	"SIOCSLIFFLAGS",	"lifreq" },
6050Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFFLAGS,	"SIOCGLIFFLAGS",	"lifreq" },
6060Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFCONF,		"SIOCGLIFCONF",		"lifconf" },
6070Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFMTU,		"SIOCSLIFMTU",		"lifreq" },
6080Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFMTU,		"SIOCGLIFMTU",		"lifreq" },
6090Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFBRDADDR,	"SIOCGLIFBRDADDR",	"lifreq" },
6100Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFBRDADDR,	"SIOCSLIFBRDADDR",	"lifreq" },
6110Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFNETMASK,	"SIOCGLIFNETMASK",	"lifreq" },
6120Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFNETMASK,	"SIOCSLIFNETMASK",	"lifreq" },
6130Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFMETRIC,	"SIOCGLIFMETRIC",	"lifreq" },
6140Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFMETRIC,	"SIOCSLIFMETRIC",	"lifreq" },
6150Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFNAME,		"SIOCSLIFNAME",		"lifreq" },
6160Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFNUM,		"SIOCGLIFNUM",		"lifnum" },
6170Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFMUXID,	"SIOCGLIFMUXID",	"lifreq" },
6180Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFMUXID,	"SIOCSLIFMUXID",	"lifreq" },
6190Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFINDEX,	"SIOCGLIFINDEX",	"lifreq" },
6200Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFINDEX,	"SIOCSLIFINDEX",	"lifreq" },
6210Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFTOKEN,	"SIOCSLIFTOKEN",	"lifreq" },
6220Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFTOKEN,	"SIOCGLIFTOKEN",	"lifreq" },
6230Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFSUBNET,	"SIOCSLIFSUBNET",	"lifreq" },
6240Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFSUBNET,	"SIOCGLIFSUBNET",	"lifreq" },
6250Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFLNKINFO,	"SIOCSLIFLNKINFO",	"lifreq" },
6260Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFLNKINFO,	"SIOCGLIFLNKINFO",	"lifreq" },
6270Sstevel@tonic-gate 	{ (uint_t)SIOCLIFDELND,		"SIOCLIFDELND",		"lifreq" },
6280Sstevel@tonic-gate 	{ (uint_t)SIOCLIFGETND,		"SIOCLIFGETND",		"lifreq" },
6290Sstevel@tonic-gate 	{ (uint_t)SIOCLIFSETND,		"SIOCLIFSETND",		"lifreq" },
6300Sstevel@tonic-gate 	{ (uint_t)SIOCTMYADDR,		"SIOCTMYADDR",	"sioc_addrreq" },
6310Sstevel@tonic-gate 	{ (uint_t)SIOCTONLINK,		"SIOCTONLINK",	"sioc_addrreq" },
6320Sstevel@tonic-gate 	{ (uint_t)SIOCTMYSITE,		"SIOCTMYSITE",	"sioc_addrreq" },
6330Sstevel@tonic-gate 	{ (uint_t)SIOCGTUNPARAM,	"SIOCGTUNPARAM",	"iftun_req" },
6340Sstevel@tonic-gate 	{ (uint_t)SIOCSTUNPARAM,	"SIOCSTUNPARAM",	"iftun_req" },
6350Sstevel@tonic-gate 	{ (uint_t)SIOCFIPSECONFIG,	"SIOCFIPSECONFIG",	NULL },
6360Sstevel@tonic-gate 	{ (uint_t)SIOCSIPSECONFIG,	"SIOCSIPSECONFIG",	NULL },
6370Sstevel@tonic-gate 	{ (uint_t)SIOCDIPSECONFIG,	"SIOCDIPSECONFIG",	NULL },
6380Sstevel@tonic-gate 	{ (uint_t)SIOCLIPSECONFIG,	"SIOCLIPSECONFIG",	NULL },
6390Sstevel@tonic-gate 	{ (uint_t)SIOCLIFFAILOVER,	"SIOCLIFFAILOVER",	"lifreq" },
6400Sstevel@tonic-gate 	{ (uint_t)SIOCLIFFAILBACK,	"SIOCLIFFAILBACK",	"lifreq" },
6410Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFGROUPNAME,	"SIOCSLIFGROUPNAME",	"lifreq" },
6420Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFGROUPNAME,	"SIOCGLIFGROUPNAME",	"lifreq" },
6430Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFOINDEX,	"SIOCGLIFOINDEX",	"lifreq" },
6440Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFOINDEX,	"SIOCSLIFOINDEX",	"lifreq" },
6450Sstevel@tonic-gate 	{ (uint_t)SIOCGDSTINFO,		"SIOCGDSTINFO",		NULL },
6460Sstevel@tonic-gate 	{ (uint_t)SIOCGIP6ADDRPOLICY,	"SIOCGIP6ADDRPOLICY",	NULL },
6470Sstevel@tonic-gate 	{ (uint_t)SIOCSIP6ADDRPOLICY,	"SIOCSIP6ADDRPOLICY", 	NULL },
6480Sstevel@tonic-gate 	{ (uint_t)SIOCSXARP,		"SIOCSXARP",		"xarpreq" },
6490Sstevel@tonic-gate 	{ (uint_t)SIOCGXARP,		"SIOCGXARP",		"xarpreq" },
6500Sstevel@tonic-gate 	{ (uint_t)SIOCDXARP,		"SIOCDXARP",		"xarpreq" },
6510Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFZONE,		"SIOCGLIFZONE",		"lifreq" },
6520Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFZONE,		"SIOCSLIFZONE",		"lifreq" },
6530Sstevel@tonic-gate 	{ (uint_t)SIOCSCTPSOPT,		"SIOCSCTPSOPT",		NULL },
6540Sstevel@tonic-gate 	{ (uint_t)SIOCSCTPGOPT,		"SIOCSCTPGOPT",		NULL },
6550Sstevel@tonic-gate 	{ (uint_t)SIOCSCTPPEELOFF,	"SIOPCSCTPPEELOFF",	"int" },
6560Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFUSESRC,	"SIOCGLIFUSESRC",	"lifreq" },
6570Sstevel@tonic-gate 	{ (uint_t)SIOCSLIFUSESRC,	"SIOCSLIFUSESRC",	"lifreq" },
6580Sstevel@tonic-gate 	{ (uint_t)SIOCGLIFSRCOF,	"SIOCGLIFSRCOF",	"lifsrcof" },
6590Sstevel@tonic-gate 	{ (uint_t)SIOCGMSFILTER,	"SIOCGMSFILTER",    "group_filter" },
6600Sstevel@tonic-gate 	{ (uint_t)SIOCSMSFILTER,	"SIOCSMSFILTER",    "group_filter" },
6610Sstevel@tonic-gate 	{ (uint_t)SIOCGIPMSFILTER,	"SIOCGIPMSFILTER",  "ip_msfilter" },
6620Sstevel@tonic-gate 	{ (uint_t)SIOCSIPMSFILTER,	"SIOCSIPMSFILTER",  "ip_msfilter" },
6630Sstevel@tonic-gate 
6640Sstevel@tonic-gate 	/* DES encryption */
6650Sstevel@tonic-gate 	{ (uint_t)DESIOCBLOCK,	"DESIOCBLOCK", 	"desparams" },
6660Sstevel@tonic-gate 	{ (uint_t)DESIOCQUICK,	"DESIOCQUICK", 	"desparams" },
6670Sstevel@tonic-gate 
6680Sstevel@tonic-gate 	/* Printing system */
6690Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_IFCAP,	"PRNIOC_GET_IFCAP", 	NULL },
6700Sstevel@tonic-gate 	{ (uint_t)PRNIOC_SET_IFCAP,	"PRNIOC_SET_IFCAP", 	NULL },
6710Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_IFINFO,	"PRNIOC_GET_IFINFO",
6720Sstevel@tonic-gate 	    "prn_interface_info" },
6730Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_STATUS,	"PRNIOC_GET_STATUS", 	NULL },
6740Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_1284_DEVID,	"PRNIOC_GET_1284_DEVID",
6750Sstevel@tonic-gate 	    "prn_1284_device_id" },
6760Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_1284_STATUS,
6770Sstevel@tonic-gate 	    "PRNIOC_GET_IFCANIOC_GET_1284_STATUS", NULL },
6780Sstevel@tonic-gate 	{ (uint_t)PRNIOC_GET_TIMEOUTS,	"PRNIOC_GET_TIMEOUTS",
6790Sstevel@tonic-gate 	    "prn_timeouts" },
6800Sstevel@tonic-gate 	{ (uint_t)PRNIOC_SET_TIMEOUTS,	"PRNIOC_SET_TIMEOUTS",
6810Sstevel@tonic-gate 	    "prn_timeouts" },
6820Sstevel@tonic-gate 	{ (uint_t)PRNIOC_RESET,	"PRNIOC_RESET", 	NULL },
6830Sstevel@tonic-gate 
6840Sstevel@tonic-gate 	/* DTrace */
6850Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_PROVIDER,	"DTRACEIOC_PROVIDER",	NULL },
6860Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_PROBES,	"DTRACEIOC_PROBES",	NULL },
6870Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_BUFSNAP,	"DTRACEIOC_BUFSNAP",	NULL },
6880Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_PROBEMATCH,	"DTRACEIOC_PROBEMATCH",	NULL },
6890Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_ENABLE,	"DTRACEIOC_ENABLE",	NULL },
6900Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_AGGSNAP,	"DTRACEIOC_AGGSNAP",	NULL },
6910Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_EPROBE,	"DTRACEIOC_EPROBE",	NULL },
6920Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_PROBEARG,   "DTRACEIOC_PROBEARG",   NULL },
6930Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_CONF,	"DTRACEIOC_CONF",	NULL },
6940Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_STATUS,	"DTRACEIOC_STATUS",	NULL },
6950Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_GO,		"DTRACEIOC_GO",		NULL },
6960Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_STOP,	"DTRACEIOC_STOP",	NULL },
6970Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_AGGDESC,	"DTRACEIOC_AGGDESC",	NULL },
6980Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_FORMAT,	"DTRACEIOC_FORMAT",	NULL },
6990Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_DOFGET,	"DTRACEIOC_DOFGET",	NULL },
7000Sstevel@tonic-gate 	{ (uint_t)DTRACEIOC_REPLICATE,	"DTRACEIOC_REPLICATE",	NULL },
7010Sstevel@tonic-gate 
7020Sstevel@tonic-gate 	{ (uint_t)DTRACEHIOC_ADD,	"DTRACEHIOC_ADD",	NULL },
7030Sstevel@tonic-gate 	{ (uint_t)DTRACEHIOC_REMOVE,	"DTRACEHIOC_REMOVE",	NULL },
7040Sstevel@tonic-gate 	{ (uint_t)DTRACEHIOC_ADDDOF,	"DTRACEHIOC_ADDDOF",	NULL },
7050Sstevel@tonic-gate 
7060Sstevel@tonic-gate 	/* /dev/cryptoadm ioctl() control codes */
7070Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_VERSION,	"CRYPTO_GET_VERSION",	NULL },
7080Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_DEV_LIST,	"CRYPTO_GET_DEV_LIST",	NULL },
7090Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_SOFT_LIST,	"CRYPTO_GET_SOFT_LIST",	NULL },
7100Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_DEV_INFO,	"CRYPTO_GET_DEV_INFO",	NULL },
7110Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_SOFT_INFO,	"CRYPTO_GET_SOFT_INFO",	NULL },
7120Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOAD_DEV_DISABLED,	"CRYPTO_LOAD_DEV_DISABLED",
7130Sstevel@tonic-gate 	    NULL },
7140Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOAD_SOFT_DISABLED,	"CRYPTO_LOAD_SOFT_DISABLED",
7150Sstevel@tonic-gate 	    NULL },
7160Sstevel@tonic-gate 	{ (uint_t)CRYPTO_UNLOAD_SOFT_MODULE,	"CRYPTO_UNLOAD_SOFT_MODULE",
7170Sstevel@tonic-gate 	    NULL },
7180Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOAD_SOFT_CONFIG,	"CRYPTO_LOAD_SOFT_CONFIG",
7190Sstevel@tonic-gate 	    NULL },
7200Sstevel@tonic-gate 	{ (uint_t)CRYPTO_POOL_CREATE,	"CRYPTO_POOL_CREATE",	NULL },
7210Sstevel@tonic-gate 	{ (uint_t)CRYPTO_POOL_WAIT,	"CRYPTO_POOL_WAIT",	NULL },
7220Sstevel@tonic-gate 	{ (uint_t)CRYPTO_POOL_RUN,	"CRYPTO_POOL_RUN",	NULL },
7230Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOAD_DOOR,	"CRYPTO_LOAD_DOOR",	NULL },
7240Sstevel@tonic-gate 
7250Sstevel@tonic-gate 	/* /dev/crypto ioctl() control codes */
7260Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_FUNCTION_LIST,	"CRYPTO_GET_FUNCTION_LIST",
7270Sstevel@tonic-gate 	    NULL },
7280Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_MECHANISM_NUMBER,	"CRYPTO_GET_MECHANISM_NUMBER",
7290Sstevel@tonic-gate 	    NULL },
7300Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OPEN_SESSION,	"CRYPTO_OPEN_SESSION",	NULL },
7310Sstevel@tonic-gate 	{ (uint_t)CRYPTO_CLOSE_SESSION,	"CRYPTO_CLOSE_SESSION",	NULL },
7320Sstevel@tonic-gate 	{ (uint_t)CRYPTO_CLOSE_ALL_SESSIONS,	"CRYPTO_CLOSE_ALL_SESSIONS",
7330Sstevel@tonic-gate 	    NULL },
7340Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOGIN,		"CRYPTO_LOGIN",		NULL },
7350Sstevel@tonic-gate 	{ (uint_t)CRYPTO_LOGOUT,	"CRYPTO_LOGOUT",	NULL },
7360Sstevel@tonic-gate 	{ (uint_t)CRYPTO_ENCRYPT,	"CRYPTO_ENCRYPT",	NULL },
7370Sstevel@tonic-gate 	{ (uint_t)CRYPTO_ENCRYPT_INIT,	"CRYPTO_ENCRYPT_INIT",	NULL },
7380Sstevel@tonic-gate 	{ (uint_t)CRYPTO_ENCRYPT_UPDATE,	"CRYPTO_ENCRYPT_UPDATE",
7390Sstevel@tonic-gate 	    NULL },
7400Sstevel@tonic-gate 	{ (uint_t)CRYPTO_ENCRYPT_FINAL,	"CRYPTO_ENCRYPT_FINAL",	NULL },
7410Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT,	"CRYPTO_DECRYPT",	NULL },
7420Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT_INIT,	"CRYPTO_DECRYPT_INIT",	NULL },
7430Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT_UPDATE,	"CRYPTO_DECRYPT_UPDATE",
7440Sstevel@tonic-gate 	    NULL },
7450Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT_FINAL,	"CRYPTO_DECRYPT_FINAL",	NULL },
7460Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST,	"CRYPTO_DIGEST",	NULL },
7470Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST_INIT,	"CRYPTO_DIGEST_INIT",	NULL },
7480Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST_UPDATE,	"CRYPTO_DIGEST_UPDATE",	NULL },
7490Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST_KEY,	"CRYPTO_DIGEST_KEY",	NULL },
7500Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST_FINAL,	"CRYPTO_DIGEST_FINAL",	NULL },
7510Sstevel@tonic-gate 	{ (uint_t)CRYPTO_MAC,		"CRYPTO_MAC",		NULL },
7520Sstevel@tonic-gate 	{ (uint_t)CRYPTO_MAC_INIT,	"CRYPTO_MAC_INIT",	NULL },
7530Sstevel@tonic-gate 	{ (uint_t)CRYPTO_MAC_UPDATE,	"CRYPTO_MAC_UPDATE",	NULL },
7540Sstevel@tonic-gate 	{ (uint_t)CRYPTO_MAC_FINAL,	"CRYPTO_MAC_FINAL",	NULL },
7550Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN,		"CRYPTO_SIGN",		NULL },
7560Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_INIT,	"CRYPTO_SIGN_INIT",	NULL },
7570Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_UPDATE,	"CRYPTO_SIGN_UPDATE",	NULL },
7580Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_FINAL,	"CRYPTO_SIGN_FINAL",	NULL },
7590Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_RECOVER_INIT,	"CRYPTO_SIGN_RECOVER_INIT",
7600Sstevel@tonic-gate 	    NULL },
7610Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_RECOVER,	"CRYPTO_SIGN_RECOVER",	NULL },
7620Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY,	"CRYPTO_VERIFY",	NULL },
7630Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY_INIT,	"CRYPTO_VERIFY_INIT",	NULL },
7640Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY_UPDATE,	"CRYPTO_VERIFY_UPDATE",	NULL },
7650Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY_FINAL,	"CRYPTO_VERIFY_FINAL",	NULL },
7660Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY_RECOVER_INIT,	"CRYPTO_VERIFY_RECOVER_INIT",
7670Sstevel@tonic-gate 	    NULL },
7680Sstevel@tonic-gate 	{ (uint_t)CRYPTO_VERIFY_RECOVER,	"CRYPTO_VERIFY_RECOVER",
7690Sstevel@tonic-gate 	    NULL },
7700Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DIGEST_ENCRYPT_UPDATE,	"CRYPTO_DIGEST_ENCRYPT_UPDATE",
7710Sstevel@tonic-gate 	    NULL },
7720Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT_DIGEST_UPDATE,	"CRYPTO_DECRYPT_DIGEST_UPDATE",
7730Sstevel@tonic-gate 	    NULL },
7740Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SIGN_ENCRYPT_UPDATE,	"CRYPTO_SIGN_ENCRYPT_UPDATE",
7750Sstevel@tonic-gate 	    NULL },
7760Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DECRYPT_VERIFY_UPDATE,	"CRYPTO_DECRYPT_VERIFY_UPDATE",
7770Sstevel@tonic-gate 	    NULL },
7780Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SEED_RANDOM,	"CRYPTO_SEED_RANDOM",	NULL },
7790Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GENERATE_RANDOM,	"CRYPTO_GENERATE_RANDOM",
7800Sstevel@tonic-gate 	    NULL },
7810Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_CREATE,	"CRYPTO_OBJECT_CREATE",	NULL },
7820Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_COPY,	"CRYPTO_OBJECT_COPY",	NULL },
7830Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_DESTROY,	"CRYPTO_OBJECT_DESTROY",
7840Sstevel@tonic-gate 	    NULL },
7850Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_GET_ATTRIBUTE_VALUE,
7860Sstevel@tonic-gate 	    "CRYPTO_OBJECT_GET_ATTRIBUTE_VALUE",	NULL },
7870Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_GET_SIZE, "CRYPTO_OBJECT_GET_SIZE",	NULL },
7880Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_SET_ATTRIBUTE_VALUE,
7890Sstevel@tonic-gate 	    "CRYPTO_OBJECT_SET_ATTRIBUTE_VALUE",	NULL },
7900Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_FIND_INIT,	"CRYPTO_OBJECT_FIND_INIT",
7910Sstevel@tonic-gate 	    NULL },
7920Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_FIND_UPDATE,	"CRYPTO_OBJECT_FIND_UPDATE",
7930Sstevel@tonic-gate 	    NULL },
7940Sstevel@tonic-gate 	{ (uint_t)CRYPTO_OBJECT_FIND_FINAL,	"CRYPTO_OBJECT_FIND_FINAL",
7950Sstevel@tonic-gate 	    NULL },
7960Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GENERATE_KEY,	"CRYPTO_GENERATE_KEY",	NULL },
7970Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GENERATE_KEY_PAIR,	"CRYPTO_GENERATE_KEY_PAIR",
7980Sstevel@tonic-gate 	    NULL },
7990Sstevel@tonic-gate 	{ (uint_t)CRYPTO_WRAP_KEY,	"CRYPTO_WRAP_KEY",	NULL },
8000Sstevel@tonic-gate 	{ (uint_t)CRYPTO_UNWRAP_KEY,	"CRYPTO_UNWRAP_KEY",	NULL },
8010Sstevel@tonic-gate 	{ (uint_t)CRYPTO_DERIVE_KEY,	"CRYPTO_DERIVE_KEY",	NULL },
8020Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_PROVIDER_LIST,	"CRYPTO_GET_PROVIDER_LIST",
8030Sstevel@tonic-gate 	    NULL },
8040Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_PROVIDER_INFO,	"CRYPTO_GET_PROVIDER_INFO",
8050Sstevel@tonic-gate 	    NULL },
8060Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_PROVIDER_MECHANISMS,
8070Sstevel@tonic-gate 	    "CRYPTO_GET_PROVIDER_MECHANISMS",	NULL },
8080Sstevel@tonic-gate 	{ (uint_t)CRYPTO_GET_PROVIDER_MECHANISM_INFO,
8090Sstevel@tonic-gate 	    "CRYPTO_GET_PROVIDER_MECHANISM_INFO",	NULL },
8100Sstevel@tonic-gate 	{ (uint_t)CRYPTO_INIT_TOKEN,	"CRYPTO_INIT_TOKEN",	NULL },
8110Sstevel@tonic-gate 	{ (uint_t)CRYPTO_INIT_PIN,	"CRYPTO_INIT_PIN",	NULL },
8120Sstevel@tonic-gate 	{ (uint_t)CRYPTO_SET_PIN,	"CRYPTO_SET_PIN",	NULL },
8130Sstevel@tonic-gate 
8140Sstevel@tonic-gate 	/* kbio ioctls */
8150Sstevel@tonic-gate 	{ (uint_t)KIOCTRANS,		"KIOCTRANS",	NULL },
8160Sstevel@tonic-gate 	{ (uint_t)KIOCGTRANS,		"KIOCGTRANS",	NULL },
8170Sstevel@tonic-gate 	{ (uint_t)KIOCTRANSABLE,	"KIOCTRANSABLE",	NULL },
8180Sstevel@tonic-gate 	{ (uint_t)KIOCGTRANSABLE,	"KIOCGTRANSABLE",	NULL },
8190Sstevel@tonic-gate 	{ (uint_t)KIOCSETKEY,		"KIOCSETKEY",	NULL },
8200Sstevel@tonic-gate 	{ (uint_t)KIOCGETKEY,		"KIOCGETKEY",	NULL },
8210Sstevel@tonic-gate 	{ (uint_t)KIOCCMD,		"KIOCCMD",	NULL },
8220Sstevel@tonic-gate 	{ (uint_t)KIOCTYPE,		"KIOCTYPE",	NULL },
8230Sstevel@tonic-gate 	{ (uint_t)KIOCSDIRECT,		"KIOCSDIRECT",	NULL },
8240Sstevel@tonic-gate 	{ (uint_t)KIOCGDIRECT,		"KIOCGDIRECT",	NULL },
8250Sstevel@tonic-gate 	{ (uint_t)KIOCSKEY,		"KIOCSKEY",	NULL },
8260Sstevel@tonic-gate 	{ (uint_t)KIOCGKEY,		"KIOCGKEY",	NULL },
8270Sstevel@tonic-gate 	{ (uint_t)KIOCSLED,		"KIOCSLED",	NULL },
8280Sstevel@tonic-gate 	{ (uint_t)KIOCGLED,		"KIOCGLED",	NULL },
8290Sstevel@tonic-gate 	{ (uint_t)KIOCSCOMPAT,		"KIOCSCOMPAT",	NULL },
8300Sstevel@tonic-gate 	{ (uint_t)KIOCGCOMPAT,		"KIOCGCOMPAT",	NULL },
8310Sstevel@tonic-gate 	{ (uint_t)KIOCSLAYOUT,		"KIOCSLAYOUT",	NULL },
8320Sstevel@tonic-gate 	{ (uint_t)KIOCLAYOUT,		"KIOCLAYOUT",	NULL },
8330Sstevel@tonic-gate 	{ (uint_t)KIOCSKABORTEN,	"KIOCSKABORTEN",	NULL },
8340Sstevel@tonic-gate 	{ (uint_t)KIOCGRPTDELAY,	"KIOCGRPTDELAY",	NULL },
8350Sstevel@tonic-gate 	{ (uint_t)KIOCSRPTDELAY,	"KIOCSRPTDELAY",	NULL },
8360Sstevel@tonic-gate 	{ (uint_t)KIOCGRPTRATE,		"KIOCGRPTRATE",	NULL },
8370Sstevel@tonic-gate 	{ (uint_t)KIOCSRPTRATE,		"KIOCSRPTRATE",	NULL },
8380Sstevel@tonic-gate 
8390Sstevel@tonic-gate 	/* ptm/pts driver I_STR ioctls */
8400Sstevel@tonic-gate 	{ (uint_t)ISPTM,		"ISPTM",		NULL},
8410Sstevel@tonic-gate 	{ (uint_t)UNLKPT,		"UNLKPT",		NULL},
8420Sstevel@tonic-gate 	{ (uint_t)PTSSTTY,		"PTSSTTY",		NULL},
8430Sstevel@tonic-gate 	{ (uint_t)ZONEPT,		"ZONEPT",		NULL},
8440Sstevel@tonic-gate 
8450Sstevel@tonic-gate 	/* aggr link aggregation pseudo driver ioctls */
8460Sstevel@tonic-gate 	{ (uint_t)LAIOC_CREATE,		"LAIOC_CREATE",		"laioc_create"},
8470Sstevel@tonic-gate 	{ (uint_t)LAIOC_DELETE,		"LAIOC_DELETE",		"laioc_delete"},
8480Sstevel@tonic-gate 	{ (uint_t)LAIOC_INFO,		"LAIOC_INFO",		"laioc_info"},
8490Sstevel@tonic-gate 	{ (uint_t)LAIOC_ADD,		"LAIOC_ADD",
8500Sstevel@tonic-gate 	    "laioc_add_rem"},
8510Sstevel@tonic-gate 	{ (uint_t)LAIOC_REMOVE,		"LAIOC_REMOVE",
8520Sstevel@tonic-gate 	    "laioc_add_rem"},
8530Sstevel@tonic-gate 	{ (uint_t)LAIOC_MODIFY,		"LAIOC_MODIFY",		"laioc_modify"},
8540Sstevel@tonic-gate 
855*269Sericheng 	/* dld data-link ioctls */
8560Sstevel@tonic-gate 	{ (uint_t)DLDIOCATTR,		"DLDIOCATTR",		"dld_ioc_attr"},
857*269Sericheng 	{ (uint_t)DLDIOCVLAN,		"DLDIOCVLAN",		"dld_ioc_vlan"},
8580Sstevel@tonic-gate 	{ (uint_t)0, NULL, NULL	}
8590Sstevel@tonic-gate };
8600Sstevel@tonic-gate 
8610Sstevel@tonic-gate 
8620Sstevel@tonic-gate void
8630Sstevel@tonic-gate ioctl_ioccom(char *buf, size_t size, uint_t code, int nbytes, int x, int y)
8640Sstevel@tonic-gate {
8650Sstevel@tonic-gate 	const char *inoutstr;
8660Sstevel@tonic-gate 
8670Sstevel@tonic-gate 	if (code & IOC_VOID)
8680Sstevel@tonic-gate 		inoutstr = "";
8690Sstevel@tonic-gate 	else if ((code & IOC_INOUT) == IOC_INOUT)
8700Sstevel@tonic-gate 		inoutstr = "WR";
8710Sstevel@tonic-gate 	else
8720Sstevel@tonic-gate 		inoutstr = code & IOC_IN ? "W" : "R";
8730Sstevel@tonic-gate 
8740Sstevel@tonic-gate 	if (isascii(x) && isprint(x))
8750Sstevel@tonic-gate 		(void) snprintf(buf, size, "_IO%sN('%c', %d, %d)", inoutstr,
8760Sstevel@tonic-gate 		    x, y, nbytes);
8770Sstevel@tonic-gate 	else
8780Sstevel@tonic-gate 		(void) snprintf(buf, size, "_IO%sN(0x%x, %d, %d)", inoutstr,
8790Sstevel@tonic-gate 		    x, y, nbytes);
8800Sstevel@tonic-gate }
8810Sstevel@tonic-gate 
8820Sstevel@tonic-gate 
8830Sstevel@tonic-gate const char *
8840Sstevel@tonic-gate ioctlname(private_t *pri, uint_t code)
8850Sstevel@tonic-gate {
8860Sstevel@tonic-gate 	const struct ioc *ip;
8870Sstevel@tonic-gate 	const char *str = NULL;
8880Sstevel@tonic-gate 
8890Sstevel@tonic-gate 	for (ip = &ioc[0]; ip->name; ip++) {
8900Sstevel@tonic-gate 		if (code == ip->code) {
8910Sstevel@tonic-gate 			str = ip->name;
8920Sstevel@tonic-gate 			break;
8930Sstevel@tonic-gate 		}
8940Sstevel@tonic-gate 	}
8950Sstevel@tonic-gate 
8960Sstevel@tonic-gate 	/*
8970Sstevel@tonic-gate 	 * Developers hide ascii ioctl names in the ioctl subcode; for example
8980Sstevel@tonic-gate 	 * 0x445210 should be printed 'D'<<16|'R'<<8|10.  We allow for all
8990Sstevel@tonic-gate 	 * three high order bytes (called hi, mid and lo) to contain ascii
9000Sstevel@tonic-gate 	 * characters.
9010Sstevel@tonic-gate 	 */
9020Sstevel@tonic-gate 	if (str == NULL) {
9030Sstevel@tonic-gate 		int c_hi = code >> 24;
9040Sstevel@tonic-gate 		int c_mid = (code >> 16) & 0xff;
9050Sstevel@tonic-gate 		int c_mid_nm = (code >> 16);
9060Sstevel@tonic-gate 		int c_lo = (code >> 8) & 0xff;
9070Sstevel@tonic-gate 		int c_lo_nm = code >> 8;
9080Sstevel@tonic-gate 
9090Sstevel@tonic-gate 		if (isascii(c_lo) && isprint(c_lo) &&
9100Sstevel@tonic-gate 		    isascii(c_mid) && isprint(c_mid) &&
9110Sstevel@tonic-gate 		    isascii(c_hi) && isprint(c_hi))
9120Sstevel@tonic-gate 			(void) sprintf(pri->code_buf,
9130Sstevel@tonic-gate 			    "(('%c'<<24)|('%c'<<16)|('%c'<<8)|%d)",
9140Sstevel@tonic-gate 			    c_hi, c_mid, c_lo, code & 0xff);
9150Sstevel@tonic-gate 		else if (isascii(c_lo) && isprint(c_lo) &&
9160Sstevel@tonic-gate 		    isascii(c_mid_nm) && isprint(c_mid_nm))
9170Sstevel@tonic-gate 			(void) sprintf(pri->code_buf,
9180Sstevel@tonic-gate 			    "(('%c'<<16)|('%c'<<8)|%d)", c_mid, c_lo,
9190Sstevel@tonic-gate 			    code & 0xff);
9200Sstevel@tonic-gate 		else if (isascii(c_lo_nm) && isprint(c_lo_nm))
9210Sstevel@tonic-gate 			(void) sprintf(pri->code_buf, "(('%c'<<8)|%d)",
9220Sstevel@tonic-gate 				c_lo_nm, code & 0xff);
9230Sstevel@tonic-gate 		else if (code & (IOC_VOID|IOC_INOUT))
9240Sstevel@tonic-gate 			ioctl_ioccom(pri->code_buf, sizeof (pri->code_buf),
9250Sstevel@tonic-gate 			    code, c_mid, c_lo, code & 0xff);
9260Sstevel@tonic-gate 		else
9270Sstevel@tonic-gate 			(void) sprintf(pri->code_buf, "0x%.4X", code);
9280Sstevel@tonic-gate 		str = (const char *)pri->code_buf;
9290Sstevel@tonic-gate 	}
9300Sstevel@tonic-gate 
9310Sstevel@tonic-gate 	return (str);
9320Sstevel@tonic-gate }
9330Sstevel@tonic-gate 
9340Sstevel@tonic-gate 
9350Sstevel@tonic-gate const char *
9360Sstevel@tonic-gate ioctldatastruct(uint_t code)
9370Sstevel@tonic-gate {
9380Sstevel@tonic-gate 	const struct ioc *ip;
9390Sstevel@tonic-gate 	const char *str = NULL;
9400Sstevel@tonic-gate 
9410Sstevel@tonic-gate 	for (ip = &ioc[0]; ip->name != NULL; ip++) {
9420Sstevel@tonic-gate 		if (code == ip->code) {
9430Sstevel@tonic-gate 			str = ip->datastruct;
9440Sstevel@tonic-gate 			break;
9450Sstevel@tonic-gate 		}
9460Sstevel@tonic-gate 	}
9470Sstevel@tonic-gate 	return (str);
9480Sstevel@tonic-gate }
9490Sstevel@tonic-gate 
9500Sstevel@tonic-gate 
9510Sstevel@tonic-gate const char *
9520Sstevel@tonic-gate fcntlname(int code)
9530Sstevel@tonic-gate {
9540Sstevel@tonic-gate 	const char *str = NULL;
9550Sstevel@tonic-gate 
9560Sstevel@tonic-gate 	if (code >= FCNTLMIN && code <= FCNTLMAX)
9570Sstevel@tonic-gate 		str = FCNTLname[code-FCNTLMIN];
9580Sstevel@tonic-gate 	return (str);
9590Sstevel@tonic-gate }
9600Sstevel@tonic-gate 
9610Sstevel@tonic-gate const char *
9620Sstevel@tonic-gate sfsname(int code)
9630Sstevel@tonic-gate {
9640Sstevel@tonic-gate 	const char *str = NULL;
9650Sstevel@tonic-gate 
9660Sstevel@tonic-gate 	if (code >= SYSFSMIN && code <= SYSFSMAX)
9670Sstevel@tonic-gate 		str = SYSFSname[code-SYSFSMIN];
9680Sstevel@tonic-gate 	return (str);
9690Sstevel@tonic-gate }
9700Sstevel@tonic-gate 
9710Sstevel@tonic-gate const char *
9720Sstevel@tonic-gate plockname(int code)
9730Sstevel@tonic-gate {
9740Sstevel@tonic-gate 	const char *str = NULL;
9750Sstevel@tonic-gate 
9760Sstevel@tonic-gate 	if (code >= PLOCKMIN && code <= PLOCKMAX)
9770Sstevel@tonic-gate 		str = PLOCKname[code-PLOCKMIN];
9780Sstevel@tonic-gate 	return (str);
9790Sstevel@tonic-gate }
9800Sstevel@tonic-gate 
9810Sstevel@tonic-gate /* ARGSUSED */
9820Sstevel@tonic-gate const char *
9830Sstevel@tonic-gate si86name(int code)
9840Sstevel@tonic-gate {
9850Sstevel@tonic-gate 	const char *str = NULL;
9860Sstevel@tonic-gate 
9870Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
9880Sstevel@tonic-gate 	switch (code) {
9890Sstevel@tonic-gate 	case SI86SWPI:		str = "SI86SWPI";	break;
9900Sstevel@tonic-gate 	case SI86SYM:		str = "SI86SYM";	break;
9910Sstevel@tonic-gate 	case SI86CONF:		str = "SI86CONF";	break;
9920Sstevel@tonic-gate 	case SI86BOOT:		str = "SI86BOOT";	break;
9930Sstevel@tonic-gate 	case SI86AUTO:		str = "SI86AUTO";	break;
9940Sstevel@tonic-gate 	case SI86EDT:		str = "SI86EDT";	break;
9950Sstevel@tonic-gate 	case SI86SWAP:		str = "SI86SWAP";	break;
9960Sstevel@tonic-gate 	case SI86FPHW:		str = "SI86FPHW";	break;
9970Sstevel@tonic-gate 	case SI86FPSTART:	str = "SI86FPSTART";	break;
9980Sstevel@tonic-gate 	case GRNON:		str = "GRNON";		break;
9990Sstevel@tonic-gate 	case GRNFLASH:		str = "GRNFLASH";	break;
10000Sstevel@tonic-gate 	case STIME:		str = "STIME";		break;
10010Sstevel@tonic-gate 	case SETNAME:		str = "SETNAME";	break;
10020Sstevel@tonic-gate 	case RNVR:		str = "RNVR";		break;
10030Sstevel@tonic-gate 	case WNVR:		str = "WNVR";		break;
10040Sstevel@tonic-gate 	case RTODC:		str = "RTODC";		break;
10050Sstevel@tonic-gate 	case CHKSER:		str = "CHKSER";		break;
10060Sstevel@tonic-gate 	case SI86NVPRT:		str = "SI86NVPRT";	break;
10070Sstevel@tonic-gate 	case SANUPD:		str = "SANUPD";		break;
10080Sstevel@tonic-gate 	case SI86KSTR:		str = "SI86KSTR";	break;
10090Sstevel@tonic-gate 	case SI86MEM:		str = "SI86MEM";	break;
10100Sstevel@tonic-gate 	case SI86TODEMON:	str = "SI86TODEMON";	break;
10110Sstevel@tonic-gate 	case SI86CCDEMON:	str = "SI86CCDEMON";	break;
10120Sstevel@tonic-gate 	case SI86CACHE:		str = "SI86CACHE";	break;
10130Sstevel@tonic-gate 	case SI86DELMEM:	str = "SI86DELMEM";	break;
10140Sstevel@tonic-gate 	case SI86ADDMEM:	str = "SI86ADDMEM";	break;
10150Sstevel@tonic-gate /* 71 through 74 reserved for VPIX */
10160Sstevel@tonic-gate 	case SI86V86: 		str = "SI86V86";	break;
10170Sstevel@tonic-gate 	case SI86SLTIME:	str = "SI86SLTIME";	break;
10180Sstevel@tonic-gate 	case SI86DSCR:		str = "SI86DSCR";	break;
10190Sstevel@tonic-gate 	case RDUBLK:		str = "RDUBLK";		break;
10200Sstevel@tonic-gate /* NFA entry point */
10210Sstevel@tonic-gate 	case SI86NFA:		str = "SI86NFA";	break;
10220Sstevel@tonic-gate 	case SI86VM86:		str = "SI86VM86";	break;
10230Sstevel@tonic-gate 	case SI86VMENABLE:	str = "SI86VMENABLE";	break;
10240Sstevel@tonic-gate 	case SI86LIMUSER:	str = "SI86LIMUSER";	break;
10250Sstevel@tonic-gate 	case SI86RDID: 		str = "SI86RDID";	break;
10260Sstevel@tonic-gate 	case SI86RDBOOT:	str = "SI86RDBOOT";	break;
10270Sstevel@tonic-gate /* Merged Product defines */
10280Sstevel@tonic-gate 	case SI86SHFIL:		str = "SI86SHFIL";	break;
10290Sstevel@tonic-gate 	case SI86PCHRGN:	str = "SI86PCHRGN";	break;
10300Sstevel@tonic-gate 	case SI86BADVISE:	str = "SI86BADVISE";	break;
10310Sstevel@tonic-gate 	case SI86SHRGN:		str = "SI86SHRGN";	break;
10320Sstevel@tonic-gate 	case SI86CHIDT:		str = "SI86CHIDT";	break;
10330Sstevel@tonic-gate 	case SI86EMULRDA: 	str = "SI86EMULRDA";	break;
10340Sstevel@tonic-gate 	}
10350Sstevel@tonic-gate #endif /* __i386 */
10360Sstevel@tonic-gate 
10370Sstevel@tonic-gate 	return (str);
10380Sstevel@tonic-gate }
10390Sstevel@tonic-gate 
10400Sstevel@tonic-gate const char *
10410Sstevel@tonic-gate utscode(int code)
10420Sstevel@tonic-gate {
10430Sstevel@tonic-gate 	const char *str = NULL;
10440Sstevel@tonic-gate 
10450Sstevel@tonic-gate 	switch (code) {
10460Sstevel@tonic-gate 	case UTS_UNAME:		str = "UNAME";	break;
10470Sstevel@tonic-gate 	case UTS_USTAT:		str = "USTAT";	break;
10480Sstevel@tonic-gate 	case UTS_FUSERS:	str = "FUSERS";	break;
10490Sstevel@tonic-gate 	}
10500Sstevel@tonic-gate 
10510Sstevel@tonic-gate 	return (str);
10520Sstevel@tonic-gate }
10530Sstevel@tonic-gate 
10540Sstevel@tonic-gate const char *
10550Sstevel@tonic-gate sconfname(int code)
10560Sstevel@tonic-gate {
10570Sstevel@tonic-gate 	const char *str = NULL;
10580Sstevel@tonic-gate 
10590Sstevel@tonic-gate 	if (code >= SCONFMIN && code <= SCONFMAX)
10600Sstevel@tonic-gate 		str = SCONFname[code-SCONFMIN];
10610Sstevel@tonic-gate 	return (str);
10620Sstevel@tonic-gate }
10630Sstevel@tonic-gate 
10640Sstevel@tonic-gate const char *
10650Sstevel@tonic-gate pathconfname(int code)
10660Sstevel@tonic-gate {
10670Sstevel@tonic-gate 	const char *str = NULL;
10680Sstevel@tonic-gate 
10690Sstevel@tonic-gate 	if (code >= PATHCONFMIN && code <= PATHCONFMAX)
10700Sstevel@tonic-gate 		str = PATHCONFname[code-PATHCONFMIN];
10710Sstevel@tonic-gate 	return (str);
10720Sstevel@tonic-gate }
10730Sstevel@tonic-gate 
10740Sstevel@tonic-gate const char *
10750Sstevel@tonic-gate sigarg(private_t *pri, int arg)
10760Sstevel@tonic-gate {
10770Sstevel@tonic-gate 	char *str = NULL;
10780Sstevel@tonic-gate 	int sig = (arg & SIGNO_MASK);
10790Sstevel@tonic-gate 
10800Sstevel@tonic-gate 	str = pri->code_buf;
10810Sstevel@tonic-gate 	arg &= ~SIGNO_MASK;
10820Sstevel@tonic-gate 	if (arg & ~(SIGDEFER|SIGHOLD|SIGRELSE|SIGIGNORE|SIGPAUSE))
10830Sstevel@tonic-gate 		(void) snprintf(pri->code_buf, sizeof (pri->code_buf),
10840Sstevel@tonic-gate 		    "%s|0x%X", signame(pri, sig), arg);
10850Sstevel@tonic-gate 	else {
10860Sstevel@tonic-gate 		(void) strcpy(str, signame(pri, sig));
10870Sstevel@tonic-gate 		if (arg & SIGDEFER)
10880Sstevel@tonic-gate 			(void) strcat(str, "|SIGDEFER");
10890Sstevel@tonic-gate 		if (arg & SIGHOLD)
10900Sstevel@tonic-gate 			(void) strcat(str, "|SIGHOLD");
10910Sstevel@tonic-gate 		if (arg & SIGRELSE)
10920Sstevel@tonic-gate 			(void) strcat(str, "|SIGRELSE");
10930Sstevel@tonic-gate 		if (arg & SIGIGNORE)
10940Sstevel@tonic-gate 			(void) strcat(str, "|SIGIGNORE");
10950Sstevel@tonic-gate 		if (arg & SIGPAUSE)
10960Sstevel@tonic-gate 			(void) strcat(str, "|SIGPAUSE");
10970Sstevel@tonic-gate 	}
10980Sstevel@tonic-gate 
10990Sstevel@tonic-gate 	return ((const char *)str);
11000Sstevel@tonic-gate }
11010Sstevel@tonic-gate 
11020Sstevel@tonic-gate #define	ALL_O_FLAGS \
11030Sstevel@tonic-gate 	(O_NDELAY|O_APPEND|O_SYNC|O_DSYNC|O_NONBLOCK|O_CREAT|O_TRUNC\
11040Sstevel@tonic-gate 	|O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS)
11050Sstevel@tonic-gate 
11060Sstevel@tonic-gate const char *
11070Sstevel@tonic-gate openarg(private_t *pri, int arg)
11080Sstevel@tonic-gate {
11090Sstevel@tonic-gate 	char *str = pri->code_buf;
11100Sstevel@tonic-gate 
11110Sstevel@tonic-gate 	switch (arg & ~ALL_O_FLAGS) {
11120Sstevel@tonic-gate 	default:
11130Sstevel@tonic-gate 		return ((char *)NULL);
11140Sstevel@tonic-gate 	case O_RDONLY:
11150Sstevel@tonic-gate 		(void) strcpy(str, "O_RDONLY");
11160Sstevel@tonic-gate 		break;
11170Sstevel@tonic-gate 	case O_WRONLY:
11180Sstevel@tonic-gate 		(void) strcpy(str, "O_WRONLY");
11190Sstevel@tonic-gate 		break;
11200Sstevel@tonic-gate 	case O_RDWR:
11210Sstevel@tonic-gate 		(void) strcpy(str, "O_RDWR");
11220Sstevel@tonic-gate 		break;
11230Sstevel@tonic-gate 	}
11240Sstevel@tonic-gate 
11250Sstevel@tonic-gate 	if (arg & O_NDELAY)
11260Sstevel@tonic-gate 		(void) strlcat(str, "|O_NDELAY", sizeof (pri->code_buf));
11270Sstevel@tonic-gate 	if (arg & O_APPEND)
11280Sstevel@tonic-gate 		(void) strlcat(str, "|O_APPEND", sizeof (pri->code_buf));
11290Sstevel@tonic-gate 	if (arg & O_SYNC)
11300Sstevel@tonic-gate 		(void) strlcat(str, "|O_SYNC", sizeof (pri->code_buf));
11310Sstevel@tonic-gate 	if (arg & O_DSYNC)
11320Sstevel@tonic-gate 		(void) strlcat(str, "|O_DSYNC", sizeof (pri->code_buf));
11330Sstevel@tonic-gate 	if (arg & O_NONBLOCK)
11340Sstevel@tonic-gate 		(void) strlcat(str, "|O_NONBLOCK", sizeof (pri->code_buf));
11350Sstevel@tonic-gate 	if (arg & O_CREAT)
11360Sstevel@tonic-gate 		(void) strlcat(str, "|O_CREAT", sizeof (pri->code_buf));
11370Sstevel@tonic-gate 	if (arg & O_TRUNC)
11380Sstevel@tonic-gate 		(void) strlcat(str, "|O_TRUNC", sizeof (pri->code_buf));
11390Sstevel@tonic-gate 	if (arg & O_EXCL)
11400Sstevel@tonic-gate 		(void) strlcat(str, "|O_EXCL", sizeof (pri->code_buf));
11410Sstevel@tonic-gate 	if (arg & O_NOCTTY)
11420Sstevel@tonic-gate 		(void) strlcat(str, "|O_NOCTTY", sizeof (pri->code_buf));
11430Sstevel@tonic-gate 	if (arg & O_LARGEFILE)
11440Sstevel@tonic-gate 		(void) strlcat(str, "|O_LARGEFILE", sizeof (pri->code_buf));
11450Sstevel@tonic-gate 	if (arg & O_RSYNC)
11460Sstevel@tonic-gate 		(void) strlcat(str, "|O_RSYNC", sizeof (pri->code_buf));
11470Sstevel@tonic-gate 	if (arg & O_XATTR)
11480Sstevel@tonic-gate 		(void) strlcat(str, "|O_XATTR", sizeof (pri->code_buf));
11490Sstevel@tonic-gate 	if (arg & O_NOFOLLOW)
11500Sstevel@tonic-gate 		(void) strlcat(str, "|O_NOFOLLOW", sizeof (pri->code_buf));
11510Sstevel@tonic-gate 	if (arg & O_NOLINKS)
11520Sstevel@tonic-gate 		(void) strlcat(str, "|O_NOLINKS", sizeof (pri->code_buf));
11530Sstevel@tonic-gate 
11540Sstevel@tonic-gate 	return ((const char *)str);
11550Sstevel@tonic-gate }
11560Sstevel@tonic-gate 
11570Sstevel@tonic-gate const char *
11580Sstevel@tonic-gate whencearg(int arg)
11590Sstevel@tonic-gate {
11600Sstevel@tonic-gate 	const char *str = NULL;
11610Sstevel@tonic-gate 
11620Sstevel@tonic-gate 	switch (arg) {
11630Sstevel@tonic-gate 	case SEEK_SET:	str = "SEEK_SET";	break;
11640Sstevel@tonic-gate 	case SEEK_CUR:	str = "SEEK_CUR";	break;
11650Sstevel@tonic-gate 	case SEEK_END:	str = "SEEK_END";	break;
11660Sstevel@tonic-gate 	case SEEK_DATA:	str = "SEEK_DATA";	break;
11670Sstevel@tonic-gate 	case SEEK_HOLE:	str = "SEEK_HOLE";	break;
11680Sstevel@tonic-gate 	}
11690Sstevel@tonic-gate 
11700Sstevel@tonic-gate 	return (str);
11710Sstevel@tonic-gate }
11720Sstevel@tonic-gate 
11730Sstevel@tonic-gate #define	IPC_FLAGS	(IPC_ALLOC|IPC_CREAT|IPC_EXCL|IPC_NOWAIT)
11740Sstevel@tonic-gate 
11750Sstevel@tonic-gate char *
11760Sstevel@tonic-gate ipcflags(private_t *pri, int arg)
11770Sstevel@tonic-gate {
11780Sstevel@tonic-gate 	char *str = pri->code_buf;
11790Sstevel@tonic-gate 
11800Sstevel@tonic-gate 	if (arg & 0777)
11810Sstevel@tonic-gate 		(void) sprintf(str, "0%.3o", arg&0777);
11820Sstevel@tonic-gate 	else
11830Sstevel@tonic-gate 		*str = '\0';
11840Sstevel@tonic-gate 
11850Sstevel@tonic-gate 	if (arg & IPC_ALLOC)
11860Sstevel@tonic-gate 		(void) strcat(str, "|IPC_ALLOC");
11870Sstevel@tonic-gate 	if (arg & IPC_CREAT)
11880Sstevel@tonic-gate 		(void) strcat(str, "|IPC_CREAT");
11890Sstevel@tonic-gate 	if (arg & IPC_EXCL)
11900Sstevel@tonic-gate 		(void) strcat(str, "|IPC_EXCL");
11910Sstevel@tonic-gate 	if (arg & IPC_NOWAIT)
11920Sstevel@tonic-gate 		(void) strcat(str, "|IPC_NOWAIT");
11930Sstevel@tonic-gate 
11940Sstevel@tonic-gate 	return (str);
11950Sstevel@tonic-gate }
11960Sstevel@tonic-gate 
11970Sstevel@tonic-gate const char *
11980Sstevel@tonic-gate msgflags(private_t *pri, int arg)
11990Sstevel@tonic-gate {
12000Sstevel@tonic-gate 	char *str;
12010Sstevel@tonic-gate 
12020Sstevel@tonic-gate 	if (arg == 0 || (arg & ~(IPC_FLAGS|MSG_NOERROR|0777)) != 0)
12030Sstevel@tonic-gate 		return ((char *)NULL);
12040Sstevel@tonic-gate 
12050Sstevel@tonic-gate 	str = ipcflags(pri, arg);
12060Sstevel@tonic-gate 
12070Sstevel@tonic-gate 	if (arg & MSG_NOERROR)
12080Sstevel@tonic-gate 		(void) strcat(str, "|MSG_NOERROR");
12090Sstevel@tonic-gate 
12100Sstevel@tonic-gate 	if (*str == '|')
12110Sstevel@tonic-gate 		str++;
12120Sstevel@tonic-gate 	return ((const char *)str);
12130Sstevel@tonic-gate }
12140Sstevel@tonic-gate 
12150Sstevel@tonic-gate const char *
12160Sstevel@tonic-gate semflags(private_t *pri, int arg)
12170Sstevel@tonic-gate {
12180Sstevel@tonic-gate 	char *str;
12190Sstevel@tonic-gate 
12200Sstevel@tonic-gate 	if (arg == 0 || (arg & ~(IPC_FLAGS|SEM_UNDO|0777)) != 0)
12210Sstevel@tonic-gate 		return ((char *)NULL);
12220Sstevel@tonic-gate 
12230Sstevel@tonic-gate 	str = ipcflags(pri, arg);
12240Sstevel@tonic-gate 
12250Sstevel@tonic-gate 	if (arg & SEM_UNDO)
12260Sstevel@tonic-gate 		(void) strcat(str, "|SEM_UNDO");
12270Sstevel@tonic-gate 
12280Sstevel@tonic-gate 	if (*str == '|')
12290Sstevel@tonic-gate 		str++;
12300Sstevel@tonic-gate 	return ((const char *)str);
12310Sstevel@tonic-gate }
12320Sstevel@tonic-gate 
12330Sstevel@tonic-gate const char *
12340Sstevel@tonic-gate shmflags(private_t *pri, int arg)
12350Sstevel@tonic-gate {
12360Sstevel@tonic-gate 	char *str;
12370Sstevel@tonic-gate 
12380Sstevel@tonic-gate 	if (arg == 0 || (arg & ~(IPC_FLAGS|SHM_RDONLY|SHM_RND|0777)) != 0)
12390Sstevel@tonic-gate 		return ((char *)NULL);
12400Sstevel@tonic-gate 
12410Sstevel@tonic-gate 	str = ipcflags(pri, arg);
12420Sstevel@tonic-gate 
12430Sstevel@tonic-gate 	if (arg & SHM_RDONLY)
12440Sstevel@tonic-gate 		(void) strcat(str, "|SHM_RDONLY");
12450Sstevel@tonic-gate 	if (arg & SHM_RND)
12460Sstevel@tonic-gate 		(void) strcat(str, "|SHM_RND");
12470Sstevel@tonic-gate 
12480Sstevel@tonic-gate 	if (*str == '|')
12490Sstevel@tonic-gate 		str++;
12500Sstevel@tonic-gate 	return ((const char *)str);
12510Sstevel@tonic-gate }
12520Sstevel@tonic-gate 
12530Sstevel@tonic-gate #define	MSGCMDMIN	0
12540Sstevel@tonic-gate #define	MSGCMDMAX	IPC_STAT64
12550Sstevel@tonic-gate const char *const MSGCMDname[MSGCMDMAX+1] = {
12560Sstevel@tonic-gate 	NULL, NULL, NULL, NULL, NULL,
12570Sstevel@tonic-gate 	NULL, NULL, NULL, NULL, NULL,
12580Sstevel@tonic-gate 	"IPC_RMID",	/* 10 */
12590Sstevel@tonic-gate 	"IPC_SET",	/* 11 */
12600Sstevel@tonic-gate 	"IPC_STAT",	/* 12 */
12610Sstevel@tonic-gate 	"IPC_SET64",	/* 13 */
12620Sstevel@tonic-gate 	"IPC_STAT64",	/* 14 */
12630Sstevel@tonic-gate };
12640Sstevel@tonic-gate 
12650Sstevel@tonic-gate #define	SEMCMDMIN	0
12660Sstevel@tonic-gate #define	SEMCMDMAX	IPC_STAT64
12670Sstevel@tonic-gate const char *const SEMCMDname[SEMCMDMAX+1] = {
12680Sstevel@tonic-gate 	NULL,		/* 0 */
12690Sstevel@tonic-gate 	NULL,		/* 1 */
12700Sstevel@tonic-gate 	NULL,		/* 2 */
12710Sstevel@tonic-gate 	"GETNCNT",	/* 3 */
12720Sstevel@tonic-gate 	"GETPID",	/* 4 */
12730Sstevel@tonic-gate 	"GETVAL",	/* 5 */
12740Sstevel@tonic-gate 	"GETALL",	/* 6 */
12750Sstevel@tonic-gate 	"GETZCNT",	/* 7 */
12760Sstevel@tonic-gate 	"SETVAL",	/* 8 */
12770Sstevel@tonic-gate 	"SETALL",	/* 9 */
12780Sstevel@tonic-gate 	"IPC_RMID",	/* 10 */
12790Sstevel@tonic-gate 	"IPC_SET",	/* 11 */
12800Sstevel@tonic-gate 	"IPC_STAT",	/* 12 */
12810Sstevel@tonic-gate 	"IPC_SET64",	/* 13 */
12820Sstevel@tonic-gate 	"IPC_STAT64",	/* 14 */
12830Sstevel@tonic-gate };
12840Sstevel@tonic-gate 
12850Sstevel@tonic-gate #define	SHMCMDMIN	0
12860Sstevel@tonic-gate #define	SHMCMDMAX	IPC_STAT64
12870Sstevel@tonic-gate const char *const SHMCMDname[SHMCMDMAX+1] = {
12880Sstevel@tonic-gate 	NULL,		/* 0 */
12890Sstevel@tonic-gate 	NULL,		/* 1 */
12900Sstevel@tonic-gate 	NULL,		/* 2 */
12910Sstevel@tonic-gate 	"SHM_LOCK",	/* 3 */
12920Sstevel@tonic-gate 	"SHM_UNLOCK",	/* 4 */
12930Sstevel@tonic-gate 	NULL, NULL, NULL, NULL, NULL,			/* 5 NULLs */
12940Sstevel@tonic-gate 	"IPC_RMID",	/* 10 */
12950Sstevel@tonic-gate 	"IPC_SET",	/* 11 */
12960Sstevel@tonic-gate 	"IPC_STAT",	/* 12 */
12970Sstevel@tonic-gate 	"IPC_SET64",	/* 13 */
12980Sstevel@tonic-gate 	"IPC_STAT64",	/* 14 */
12990Sstevel@tonic-gate };
13000Sstevel@tonic-gate 
13010Sstevel@tonic-gate const char *
13020Sstevel@tonic-gate msgcmd(int arg)
13030Sstevel@tonic-gate {
13040Sstevel@tonic-gate 	const char *str = NULL;
13050Sstevel@tonic-gate 
13060Sstevel@tonic-gate 	if (arg >= MSGCMDMIN && arg <= MSGCMDMAX)
13070Sstevel@tonic-gate 		str = MSGCMDname[arg-MSGCMDMIN];
13080Sstevel@tonic-gate 	return (str);
13090Sstevel@tonic-gate }
13100Sstevel@tonic-gate 
13110Sstevel@tonic-gate const char *
13120Sstevel@tonic-gate semcmd(int arg)
13130Sstevel@tonic-gate {
13140Sstevel@tonic-gate 	const char *str = NULL;
13150Sstevel@tonic-gate 
13160Sstevel@tonic-gate 	if (arg >= SEMCMDMIN && arg <= SEMCMDMAX)
13170Sstevel@tonic-gate 		str = SEMCMDname[arg-SEMCMDMIN];
13180Sstevel@tonic-gate 	return (str);
13190Sstevel@tonic-gate }
13200Sstevel@tonic-gate 
13210Sstevel@tonic-gate const char *
13220Sstevel@tonic-gate shmcmd(int arg)
13230Sstevel@tonic-gate {
13240Sstevel@tonic-gate 	const char *str = NULL;
13250Sstevel@tonic-gate 
13260Sstevel@tonic-gate 	if (arg >= SHMCMDMIN && arg <= SHMCMDMAX)
13270Sstevel@tonic-gate 		str = SHMCMDname[arg-SHMCMDMIN];
13280Sstevel@tonic-gate 	return (str);
13290Sstevel@tonic-gate }
13300Sstevel@tonic-gate 
13310Sstevel@tonic-gate const char *
13320Sstevel@tonic-gate strrdopt(int arg)	/* streams read option (I_SRDOPT I_GRDOPT) */
13330Sstevel@tonic-gate {
13340Sstevel@tonic-gate 	const char *str = NULL;
13350Sstevel@tonic-gate 
13360Sstevel@tonic-gate 	switch (arg) {
13370Sstevel@tonic-gate 	case RNORM:	str = "RNORM";		break;
13380Sstevel@tonic-gate 	case RMSGD:	str = "RMSGD";		break;
13390Sstevel@tonic-gate 	case RMSGN:	str = "RMSGN";		break;
13400Sstevel@tonic-gate 	}
13410Sstevel@tonic-gate 
13420Sstevel@tonic-gate 	return (str);
13430Sstevel@tonic-gate }
13440Sstevel@tonic-gate 
13450Sstevel@tonic-gate /* bit map of streams events (I_SETSIG & I_GETSIG) */
13460Sstevel@tonic-gate const char *
13470Sstevel@tonic-gate strevents(private_t *pri, int arg)
13480Sstevel@tonic-gate {
13490Sstevel@tonic-gate 	char *str = pri->code_buf;
13500Sstevel@tonic-gate 
13510Sstevel@tonic-gate 	if (arg & ~(S_INPUT|S_HIPRI|S_OUTPUT|S_MSG|S_ERROR|S_HANGUP))
13520Sstevel@tonic-gate 		return ((char *)NULL);
13530Sstevel@tonic-gate 
13540Sstevel@tonic-gate 	*str = '\0';
13550Sstevel@tonic-gate 	if (arg & S_INPUT)
13560Sstevel@tonic-gate 		(void) strcat(str, "|S_INPUT");
13570Sstevel@tonic-gate 	if (arg & S_HIPRI)
13580Sstevel@tonic-gate 		(void) strcat(str, "|S_HIPRI");
13590Sstevel@tonic-gate 	if (arg & S_OUTPUT)
13600Sstevel@tonic-gate 		(void) strcat(str, "|S_OUTPUT");
13610Sstevel@tonic-gate 	if (arg & S_MSG)
13620Sstevel@tonic-gate 		(void) strcat(str, "|S_MSG");
13630Sstevel@tonic-gate 	if (arg & S_ERROR)
13640Sstevel@tonic-gate 		(void) strcat(str, "|S_ERROR");
13650Sstevel@tonic-gate 	if (arg & S_HANGUP)
13660Sstevel@tonic-gate 		(void) strcat(str, "|S_HANGUP");
13670Sstevel@tonic-gate 
13680Sstevel@tonic-gate 	return ((const char *)(str+1));
13690Sstevel@tonic-gate }
13700Sstevel@tonic-gate 
13710Sstevel@tonic-gate const char *
13720Sstevel@tonic-gate tiocflush(private_t *pri, int arg)	/* bit map passsed by TIOCFLUSH */
13730Sstevel@tonic-gate {
13740Sstevel@tonic-gate 	char *str = pri->code_buf;
13750Sstevel@tonic-gate 
13760Sstevel@tonic-gate 	if (arg & ~(FREAD|FWRITE))
13770Sstevel@tonic-gate 		return ((char *)NULL);
13780Sstevel@tonic-gate 
13790Sstevel@tonic-gate 	*str = '\0';
13800Sstevel@tonic-gate 	if (arg & FREAD)
13810Sstevel@tonic-gate 		(void) strcat(str, "|FREAD");
13820Sstevel@tonic-gate 	if (arg & FWRITE)
13830Sstevel@tonic-gate 		(void) strcat(str, "|FWRITE");
13840Sstevel@tonic-gate 
13850Sstevel@tonic-gate 	return ((const char *)(str+1));
13860Sstevel@tonic-gate }
13870Sstevel@tonic-gate 
13880Sstevel@tonic-gate const char *
13890Sstevel@tonic-gate strflush(int arg)	/* streams flush option (I_FLUSH) */
13900Sstevel@tonic-gate {
13910Sstevel@tonic-gate 	const char *str = NULL;
13920Sstevel@tonic-gate 
13930Sstevel@tonic-gate 	switch (arg) {
13940Sstevel@tonic-gate 	case FLUSHR:	str = "FLUSHR";		break;
13950Sstevel@tonic-gate 	case FLUSHW:	str = "FLUSHW";		break;
13960Sstevel@tonic-gate 	case FLUSHRW:	str = "FLUSHRW";	break;
13970Sstevel@tonic-gate 	}
13980Sstevel@tonic-gate 
13990Sstevel@tonic-gate 	return (str);
14000Sstevel@tonic-gate }
14010Sstevel@tonic-gate 
14020Sstevel@tonic-gate #define	ALL_MOUNT_FLAGS	(MS_RDONLY|MS_FSS|MS_DATA|MS_NOSUID|MS_REMOUNT| \
14030Sstevel@tonic-gate 	MS_NOTRUNC|MS_OVERLAY|MS_OPTIONSTR|MS_GLOBAL|MS_FORCE|MS_NOMNTTAB)
14040Sstevel@tonic-gate 
14050Sstevel@tonic-gate const char *
14060Sstevel@tonic-gate mountflags(private_t *pri, int arg)	/* bit map of mount syscall flags */
14070Sstevel@tonic-gate {
14080Sstevel@tonic-gate 	char *str = pri->code_buf;
14090Sstevel@tonic-gate 	size_t used = 0;
14100Sstevel@tonic-gate 
14110Sstevel@tonic-gate 	if (arg & ~ALL_MOUNT_FLAGS)
14120Sstevel@tonic-gate 		return ((char *)NULL);
14130Sstevel@tonic-gate 
14140Sstevel@tonic-gate 	*str = '\0';
14150Sstevel@tonic-gate 	if (arg & MS_RDONLY)
14160Sstevel@tonic-gate 		used = strlcat(str, "|MS_RDONLY", sizeof (pri->code_buf));
14170Sstevel@tonic-gate 	if (arg & MS_FSS)
14180Sstevel@tonic-gate 		used = strlcat(str, "|MS_FSS", sizeof (pri->code_buf));
14190Sstevel@tonic-gate 	if (arg & MS_DATA)
14200Sstevel@tonic-gate 		used = strlcat(str, "|MS_DATA", sizeof (pri->code_buf));
14210Sstevel@tonic-gate 	if (arg & MS_NOSUID)
14220Sstevel@tonic-gate 		used = strlcat(str, "|MS_NOSUID", sizeof (pri->code_buf));
14230Sstevel@tonic-gate 	if (arg & MS_REMOUNT)
14240Sstevel@tonic-gate 		used = strlcat(str, "|MS_REMOUNT", sizeof (pri->code_buf));
14250Sstevel@tonic-gate 	if (arg & MS_NOTRUNC)
14260Sstevel@tonic-gate 		used = strlcat(str, "|MS_NOTRUNC", sizeof (pri->code_buf));
14270Sstevel@tonic-gate 	if (arg & MS_OVERLAY)
14280Sstevel@tonic-gate 		used = strlcat(str, "|MS_OVERLAY", sizeof (pri->code_buf));
14290Sstevel@tonic-gate 	if (arg & MS_OPTIONSTR)
14300Sstevel@tonic-gate 		used = strlcat(str, "|MS_OPTIONSTR", sizeof (pri->code_buf));
14310Sstevel@tonic-gate 	if (arg & MS_GLOBAL)
14320Sstevel@tonic-gate 		used = strlcat(str, "|MS_GLOBAL", sizeof (pri->code_buf));
14330Sstevel@tonic-gate 	if (arg & MS_FORCE)
14340Sstevel@tonic-gate 		used = strlcat(str, "|MS_FORCE", sizeof (pri->code_buf));
14350Sstevel@tonic-gate 	if (arg & MS_NOMNTTAB)
14360Sstevel@tonic-gate 		used = strlcat(str, "|MS_NOMNTTAB", sizeof (pri->code_buf));
14370Sstevel@tonic-gate 
14380Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
14390Sstevel@tonic-gate 		return ((char *)NULL);			/* use prt_hex() */
14400Sstevel@tonic-gate 
14410Sstevel@tonic-gate 	return ((const char *)(str+1));
14420Sstevel@tonic-gate }
14430Sstevel@tonic-gate 
14440Sstevel@tonic-gate const char *
14450Sstevel@tonic-gate svfsflags(private_t *pri, ulong_t arg)	/* bit map of statvfs syscall flags */
14460Sstevel@tonic-gate {
14470Sstevel@tonic-gate 	char *str = pri->code_buf;
14480Sstevel@tonic-gate 
14490Sstevel@tonic-gate 	if (arg & ~(ST_RDONLY|ST_NOSUID|ST_NOTRUNC)) {
14500Sstevel@tonic-gate 		(void) sprintf(str, "0x%lx", arg);
14510Sstevel@tonic-gate 		return (str);
14520Sstevel@tonic-gate 	}
14530Sstevel@tonic-gate 	*str = '\0';
14540Sstevel@tonic-gate 	if (arg & ST_RDONLY)
14550Sstevel@tonic-gate 		(void) strcat(str, "|ST_RDONLY");
14560Sstevel@tonic-gate 	if (arg & ST_NOSUID)
14570Sstevel@tonic-gate 		(void) strcat(str, "|ST_NOSUID");
14580Sstevel@tonic-gate 	if (arg & ST_NOTRUNC)
14590Sstevel@tonic-gate 		(void) strcat(str, "|ST_NOTRUNC");
14600Sstevel@tonic-gate 	if (*str == '\0')
14610Sstevel@tonic-gate 		(void) strcat(str, "|0");
14620Sstevel@tonic-gate 	return ((const char *)(str+1));
14630Sstevel@tonic-gate }
14640Sstevel@tonic-gate 
14650Sstevel@tonic-gate const char *
14660Sstevel@tonic-gate fuiname(int arg)	/* fusers() input argument */
14670Sstevel@tonic-gate {
14680Sstevel@tonic-gate 	const char *str = NULL;
14690Sstevel@tonic-gate 
14700Sstevel@tonic-gate 	switch (arg) {
14710Sstevel@tonic-gate 	case F_FILE_ONLY:	str = "F_FILE_ONLY";		break;
14720Sstevel@tonic-gate 	case F_CONTAINED:	str = "F_CONTAINED";		break;
14730Sstevel@tonic-gate 	}
14740Sstevel@tonic-gate 
14750Sstevel@tonic-gate 	return (str);
14760Sstevel@tonic-gate }
14770Sstevel@tonic-gate 
14780Sstevel@tonic-gate const char *
14790Sstevel@tonic-gate fuflags(private_t *pri, int arg)	/* fusers() output flags */
14800Sstevel@tonic-gate {
14810Sstevel@tonic-gate 	char *str = pri->code_buf;
14820Sstevel@tonic-gate 
14830Sstevel@tonic-gate 	if (arg & ~(F_CDIR|F_RDIR|F_TEXT|F_MAP|F_OPEN|F_TRACE|F_TTY)) {
14840Sstevel@tonic-gate 		(void) sprintf(str, "0x%x", arg);
14850Sstevel@tonic-gate 		return (str);
14860Sstevel@tonic-gate 	}
14870Sstevel@tonic-gate 	*str = '\0';
14880Sstevel@tonic-gate 	if (arg & F_CDIR)
14890Sstevel@tonic-gate 		(void) strcat(str, "|F_CDIR");
14900Sstevel@tonic-gate 	if (arg & F_RDIR)
14910Sstevel@tonic-gate 		(void) strcat(str, "|F_RDIR");
14920Sstevel@tonic-gate 	if (arg & F_TEXT)
14930Sstevel@tonic-gate 		(void) strcat(str, "|F_TEXT");
14940Sstevel@tonic-gate 	if (arg & F_MAP)
14950Sstevel@tonic-gate 		(void) strcat(str, "|F_MAP");
14960Sstevel@tonic-gate 	if (arg & F_OPEN)
14970Sstevel@tonic-gate 		(void) strcat(str, "|F_OPEN");
14980Sstevel@tonic-gate 	if (arg & F_TRACE)
14990Sstevel@tonic-gate 		(void) strcat(str, "|F_TRACE");
15000Sstevel@tonic-gate 	if (arg & F_TTY)
15010Sstevel@tonic-gate 		(void) strcat(str, "|F_TTY");
15020Sstevel@tonic-gate 	if (*str == '\0')
15030Sstevel@tonic-gate 		(void) strcat(str, "|0");
15040Sstevel@tonic-gate 	return ((const char *)(str+1));
15050Sstevel@tonic-gate }
15060Sstevel@tonic-gate 
15070Sstevel@tonic-gate 
15080Sstevel@tonic-gate const char *
15090Sstevel@tonic-gate ipprotos(int arg)	/* IP protocols cf. netinet/in.h */
15100Sstevel@tonic-gate {
15110Sstevel@tonic-gate 	switch (arg) {
15120Sstevel@tonic-gate 	case IPPROTO_IP:	return ("IPPROTO_IP");
15130Sstevel@tonic-gate 	case IPPROTO_ICMP:	return ("IPPROTO_ICMP");
15140Sstevel@tonic-gate 	case IPPROTO_IGMP:	return ("IPPROTO_IGMP");
15150Sstevel@tonic-gate 	case IPPROTO_GGP:	return ("IPPROTO_GGP");
15160Sstevel@tonic-gate 	case IPPROTO_ENCAP:	return ("IPPROTO_ENCAP");
15170Sstevel@tonic-gate 	case IPPROTO_TCP:	return ("IPPROTO_TCP");
15180Sstevel@tonic-gate 	case IPPROTO_EGP:	return ("IPPROTO_EGP");
15190Sstevel@tonic-gate 	case IPPROTO_PUP:	return ("IPPROTO_PUP");
15200Sstevel@tonic-gate 	case IPPROTO_UDP:	return ("IPPROTO_UDP");
15210Sstevel@tonic-gate 	case IPPROTO_IDP:	return ("IPPROTO_IDP");
15220Sstevel@tonic-gate 	case IPPROTO_IPV6:	return ("IPPROTO_IPV6");
15230Sstevel@tonic-gate 	case IPPROTO_ROUTING:	return ("IPPROTO_ROUTING");
15240Sstevel@tonic-gate 	case IPPROTO_FRAGMENT:	return ("IPPROTO_FRAGMENT");
15250Sstevel@tonic-gate 	case IPPROTO_RSVP:	return ("IPPROTO_RSVP");
15260Sstevel@tonic-gate 	case IPPROTO_ESP:	return ("IPPROTO_ESP");
15270Sstevel@tonic-gate 	case IPPROTO_AH:	return ("IPPROTO_AH");
15280Sstevel@tonic-gate 	case IPPROTO_ICMPV6:	return ("IPPROTO_ICMPV6");
15290Sstevel@tonic-gate 	case IPPROTO_NONE:	return ("IPPROTO_NONE");
15300Sstevel@tonic-gate 	case IPPROTO_DSTOPTS:	return ("IPPROTO_DSTOPTS");
15310Sstevel@tonic-gate 	case IPPROTO_HELLO:	return ("IPPROTO_HELLO");
15320Sstevel@tonic-gate 	case IPPROTO_ND:	return ("IPPROTO_ND");
15330Sstevel@tonic-gate 	case IPPROTO_EON:	return ("IPPROTO_EON");
15340Sstevel@tonic-gate 	case IPPROTO_PIM:	return ("IPPROTO_PIM");
15350Sstevel@tonic-gate 	case IPPROTO_SCTP:	return ("IPPROTO_SCTP");
15360Sstevel@tonic-gate 	case IPPROTO_RAW:	return ("IPPROTO_RAW");
15370Sstevel@tonic-gate 	default:		return (NULL);
15380Sstevel@tonic-gate 	}
15390Sstevel@tonic-gate }
1540