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