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 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #define _SYSCALL32 /* make 32-bit compat headers visible */ 33 34 #include <stdio.h> 35 #include <stdlib.h> 36 #include <unistd.h> 37 #include <string.h> 38 #include <signal.h> 39 #include <termio.h> 40 #include <stddef.h> 41 #include <limits.h> 42 #include <ctype.h> 43 #include <sys/types.h> 44 #include <sys/mman.h> 45 #include <sys/resource.h> 46 #include <sys/ulimit.h> 47 #include <sys/utsname.h> 48 #include <sys/kstat.h> 49 #include <sys/modctl.h> 50 #include <sys/acl.h> 51 #include <stropts.h> 52 #include <sys/isa_defs.h> 53 #include <sys/systeminfo.h> 54 #include <sys/cladm.h> 55 #include <sys/lwp.h> 56 #include <bsm/audit.h> 57 #include <libproc.h> 58 #include <priv.h> 59 #include <sys/aio.h> 60 #include <sys/aiocb.h> 61 #include <sys/corectl.h> 62 #include <sys/cpc_impl.h> 63 #include <sys/priocntl.h> 64 #include <sys/tspriocntl.h> 65 #include <sys/iapriocntl.h> 66 #include <sys/rtpriocntl.h> 67 #include <sys/fsspriocntl.h> 68 #include <sys/fxpriocntl.h> 69 #include <netdb.h> 70 #include <nss_dbdefs.h> 71 #include <sys/socketvar.h> 72 #include <netinet/in.h> 73 #include <netinet/tcp.h> 74 #include <netinet/udp.h> 75 #include <netinet/sctp.h> 76 #include <sys/utrap.h> 77 #include <sys/lgrp_user.h> 78 #include <sys/door.h> 79 #include <sys/tsol/tndb.h> 80 #include <sys/rctl.h> 81 #include <sys/rctl_impl.h> 82 #include <sys/fork.h> 83 #include <sys/task.h> 84 #include "ramdata.h" 85 #include "print.h" 86 #include "proto.h" 87 #include "systable.h" 88 89 void grow(private_t *, int nbyte); 90 91 #define GROW(nb) if (pri->sys_leng + (nb) >= pri->sys_ssize) grow(pri, (nb)) 92 93 94 /*ARGSUSED*/ 95 void 96 prt_nov(private_t *pri, int raw, long val) /* print nothing */ 97 { 98 } 99 100 /*ARGSUSED*/ 101 void 102 prt_dec(private_t *pri, int raw, long val) /* print as decimal */ 103 { 104 GROW(24); 105 if (data_model == PR_MODEL_ILP32) 106 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 107 "%d", (int)val); 108 else 109 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 110 "%ld", val); 111 } 112 113 /*ARGSUSED*/ 114 void 115 prt_uns(private_t *pri, int raw, long val) /* print as unsigned decimal */ 116 { 117 GROW(24); 118 if (data_model == PR_MODEL_ILP32) 119 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 120 "%u", (int)val); 121 else 122 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 123 "%lu", val); 124 } 125 126 /* print as unsigned decimal, except for -1 */ 127 void 128 prt_un1(private_t *pri, int raw, long val) 129 { 130 if ((int)val == -1) 131 prt_dec(pri, raw, val); 132 else 133 prt_uns(pri, raw, val); 134 } 135 136 /*ARGSUSED*/ 137 void 138 prt_oct(private_t *pri, int raw, long val) /* print as octal */ 139 { 140 GROW(24); 141 if (data_model == PR_MODEL_ILP32) 142 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 143 "%#o", (int)val); 144 else 145 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 146 "%#lo", val); 147 } 148 149 /*ARGSUSED*/ 150 void 151 prt_hex(private_t *pri, int raw, long val) /* print as hexadecimal */ 152 { 153 GROW(20); 154 if (data_model == PR_MODEL_ILP32) 155 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 156 "0x%.8X", (int)val); 157 else 158 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 159 "0x%.8lX", val); 160 } 161 162 /* print as hexadecimal (half size) */ 163 /*ARGSUSED*/ 164 void 165 prt_hhx(private_t *pri, int raw, long val) 166 { 167 GROW(20); 168 if (data_model == PR_MODEL_ILP32) 169 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 170 "0x%.4X", (int)val); 171 else 172 pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng, 173 "0x%.4lX", val); 174 } 175 176 /* print as decimal if small, else hexadecimal */ 177 /*ARGSUSED*/ 178 void 179 prt_dex(private_t *pri, int raw, long val) 180 { 181 if (val & 0xff000000) 182 prt_hex(pri, 0, val); 183 else 184 prt_dec(pri, 0, val); 185 } 186 187 /* print long long offset */ 188 /*ARGSUSED*/ 189 void 190 prt_llo(private_t *pri, int raw, long val1, long val2) 191 { 192 int hival; 193 int loval; 194 195 #ifdef _LONG_LONG_LTOH 196 hival = (int)val2; 197 loval = (int)val1; 198 #else 199 hival = (int)val1; 200 loval = (int)val2; 201 #endif 202 203 if (hival == 0) { 204 prt_dex(pri, 0, loval); 205 } else { 206 GROW(18); 207 pri->sys_leng += 208 sprintf(pri->sys_string + pri->sys_leng, "0x%.8X%.8X", 209 hival, loval); 210 } 211 } 212 213 void 214 escape_string(private_t *pri, const char *s) 215 { 216 /* 217 * We want to avoid outputting unprintable characters that may 218 * destroy the user's terminal. So we do one pass to find any 219 * unprintable characters, size the array appropriately, and 220 * then walk each character by hand. Those that are unprintable 221 * are replaced by a hex escape (\xNN). We also escape quotes for 222 * completeness. 223 */ 224 int i, unprintable, quotes; 225 size_t len = strlen(s); 226 for (i = 0, unprintable = 0, quotes = 0; i < len; i++) { 227 if (!isprint(s[i])) 228 unprintable++; 229 if (s[i] == '"') 230 quotes++; 231 } 232 233 GROW(len + 3 * unprintable + quotes + 2); 234 235 pri->sys_string[pri->sys_leng++] = '"'; 236 for (i = 0; i < len; i++) { 237 if (s[i] == '"') 238 pri->sys_string[pri->sys_leng++] = '\\'; 239 240 if (isprint(s[i])) { 241 pri->sys_string[pri->sys_leng++] = s[i]; 242 } else { 243 pri->sys_leng += sprintf(pri->sys_string + 244 pri->sys_leng, "\\x%02x", (uint8_t)s[i]); 245 } 246 } 247 pri->sys_string[pri->sys_leng++] = '"'; 248 } 249 250 void 251 prt_stg(private_t *pri, int raw, long val) /* print as string */ 252 { 253 char *s = raw? NULL : fetchstring(pri, (long)val, PATH_MAX); 254 255 if (s == NULL) 256 prt_hex(pri, 0, val); 257 else 258 escape_string(pri, s); 259 } 260 261 /* print as string returned from syscall */ 262 void 263 prt_rst(private_t *pri, int raw, long val) 264 { 265 char *s = (raw || pri->Errno)? NULL : 266 fetchstring(pri, (long)val, PATH_MAX); 267 268 if (s == NULL) 269 prt_hex(pri, 0, val); 270 else { 271 GROW((int)strlen(s) + 2); 272 pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng, 273 pri->sys_ssize - pri->sys_leng, "\"%s\"", s); 274 } 275 } 276 277 /* print contents of readlink() buffer */ 278 void 279 prt_rlk(private_t *pri, int raw, long val) 280 { 281 char *s = (raw || pri->Errno || pri->Rval1 <= 0)? NULL : 282 fetchstring(pri, (long)val, 283 (pri->Rval1 > PATH_MAX)? PATH_MAX : (int)pri->Rval1); 284 285 if (s == NULL) 286 prt_hex(pri, 0, val); 287 else { 288 GROW((int)strlen(s) + 2); 289 pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng, 290 pri->sys_ssize - pri->sys_leng, "\"%s\"", s); 291 } 292 } 293 294 void 295 prt_ioc(private_t *pri, int raw, long val) /* print ioctl code */ 296 { 297 const char *s = raw? NULL : ioctlname(pri, (int)val); 298 299 if (s == NULL) 300 prt_hex(pri, 0, val); 301 else 302 outstring(pri, s); 303 } 304 305 void 306 prt_ioa(private_t *pri, int raw, long val) /* print ioctl argument */ 307 { 308 const char *s; 309 310 /* cheating -- look at the ioctl() code */ 311 switch (pri->sys_args[1]) { 312 313 /* kstat ioctl()s */ 314 case KSTAT_IOC_READ: 315 case KSTAT_IOC_WRITE: 316 #ifdef _LP64 317 if (data_model == PR_MODEL_ILP32) 318 prt_stg(pri, raw, 319 val + offsetof(kstat32_t, ks_name[0])); 320 else 321 #endif 322 prt_stg(pri, raw, 323 val + offsetof(kstat_t, ks_name[0])); 324 break; 325 326 /* streams ioctl()s */ 327 case I_LOOK: 328 prt_rst(pri, raw, val); 329 break; 330 case I_PUSH: 331 case I_FIND: 332 prt_stg(pri, raw, val); 333 break; 334 case I_LINK: 335 case I_UNLINK: 336 case I_SENDFD: 337 prt_dec(pri, 0, val); 338 break; 339 case I_SRDOPT: 340 if (raw || (s = strrdopt(val)) == NULL) 341 prt_dec(pri, 0, val); 342 else 343 outstring(pri, s); 344 break; 345 case I_SETSIG: 346 if (raw || (s = strevents(pri, val)) == NULL) 347 prt_hex(pri, 0, val); 348 else 349 outstring(pri, s); 350 break; 351 case I_FLUSH: 352 if (raw || (s = strflush(val)) == NULL) 353 prt_dec(pri, 0, val); 354 else 355 outstring(pri, s); 356 break; 357 358 /* tty ioctl()s */ 359 case TCSBRK: 360 case TCXONC: 361 case TCFLSH: 362 case TCDSET: 363 prt_dec(pri, 0, val); 364 break; 365 366 default: 367 prt_hex(pri, 0, val); 368 break; 369 } 370 } 371 372 void 373 prt_fcn(private_t *pri, int raw, long val) /* print fcntl code */ 374 { 375 const char *s = raw? NULL : fcntlname(val); 376 377 if (s == NULL) 378 prt_dec(pri, 0, val); 379 else 380 outstring(pri, s); 381 } 382 383 void 384 prt_s86(private_t *pri, int raw, long val) /* print sysi86 code */ 385 { 386 387 const char *s = raw? NULL : si86name(val); 388 389 if (s == NULL) 390 prt_dec(pri, 0, val); 391 else 392 outstring(pri, s); 393 } 394 395 void 396 prt_uts(private_t *pri, int raw, long val) /* print utssys code */ 397 { 398 const char *s = raw? NULL : utscode(val); 399 400 if (s == NULL) 401 prt_dec(pri, 0, val); 402 else 403 outstring(pri, s); 404 } 405 406 void 407 prt_msc(private_t *pri, int raw, long val) /* print msgsys command */ 408 { 409 const char *s = raw? NULL : msgcmd(val); 410 411 if (s == NULL) 412 prt_dec(pri, 0, val); 413 else 414 outstring(pri, s); 415 } 416 417 void 418 prt_msf(private_t *pri, int raw, long val) /* print msgsys flags */ 419 { 420 const char *s = raw? NULL : msgflags(pri, (int)val); 421 422 if (s == NULL) 423 prt_oct(pri, 0, val); 424 else 425 outstring(pri, s); 426 } 427 428 void 429 prt_smc(private_t *pri, int raw, long val) /* print semsys command */ 430 { 431 const char *s = raw? NULL : semcmd(val); 432 433 if (s == NULL) 434 prt_dec(pri, 0, val); 435 else 436 outstring(pri, s); 437 } 438 439 void 440 prt_sef(private_t *pri, int raw, long val) /* print semsys flags */ 441 { 442 const char *s = raw? NULL : semflags(pri, (int)val); 443 444 if (s == NULL) 445 prt_oct(pri, 0, val); 446 else 447 outstring(pri, s); 448 } 449 450 void 451 prt_shc(private_t *pri, int raw, long val) /* print shmsys command */ 452 { 453 const char *s = raw? NULL : shmcmd(val); 454 455 if (s == NULL) 456 prt_dec(pri, 0, val); 457 else 458 outstring(pri, s); 459 } 460 461 void 462 prt_shf(private_t *pri, int raw, long val) /* print shmsys flags */ 463 { 464 const char *s = raw? NULL : shmflags(pri, (int)val); 465 466 if (s == NULL) 467 prt_oct(pri, 0, val); 468 else 469 outstring(pri, s); 470 } 471 472 void 473 prt_sfs(private_t *pri, int raw, long val) /* print sysfs code */ 474 { 475 const char *s = raw? NULL : sfsname(val); 476 477 if (s == NULL) 478 prt_dec(pri, 0, val); 479 else 480 outstring(pri, s); 481 } 482 483 void 484 prt_opn(private_t *pri, int raw, long val) /* print open code */ 485 { 486 const char *s = raw? NULL : openarg(pri, val); 487 488 if (s == NULL) 489 prt_oct(pri, 0, val); 490 else 491 outstring(pri, s); 492 } 493 494 void 495 prt_sig(private_t *pri, int raw, long val) /* print signal name plus flags */ 496 { 497 const char *s = raw? NULL : sigarg(pri, (int)val); 498 499 if (s == NULL) 500 prt_hex(pri, 0, val); 501 else 502 outstring(pri, s); 503 } 504 505 /* print signal name, masked with SIGNO_MASK */ 506 void 507 prt_six(private_t *pri, int raw, long val) 508 { 509 const char *s = raw? NULL : sigarg(pri, (int)val & SIGNO_MASK); 510 511 if (s == NULL) 512 prt_hex(pri, 0, val); 513 else 514 outstring(pri, s); 515 } 516 517 void 518 prt_act(private_t *pri, int raw, long val) /* print signal action value */ 519 { 520 const char *s; 521 522 if (raw) 523 s = NULL; 524 else if (val == (int)SIG_DFL) 525 s = "SIG_DFL"; 526 else if (val == (int)SIG_IGN) 527 s = "SIG_IGN"; 528 else if (val == (int)SIG_HOLD) 529 s = "SIG_HOLD"; 530 else 531 s = NULL; 532 533 if (s == NULL) 534 prt_hex(pri, 0, val); 535 else 536 outstring(pri, s); 537 } 538 539 void 540 prt_smf(private_t *pri, int raw, long val) /* print streams message flags */ 541 { 542 switch (val) { 543 case 0: 544 prt_dec(pri, 0, val); 545 break; 546 case RS_HIPRI: 547 if (raw) 548 prt_hhx(pri, 0, val); 549 else 550 outstring(pri, "RS_HIPRI"); 551 break; 552 default: 553 prt_hhx(pri, 0, val); 554 break; 555 } 556 } 557 558 void 559 prt_plk(private_t *pri, int raw, long val) /* print plock code */ 560 { 561 const char *s = raw? NULL : plockname(val); 562 563 if (s == NULL) 564 prt_dec(pri, 0, val); 565 else 566 outstring(pri, s); 567 } 568 569 void 570 prt_mtf(private_t *pri, int raw, long val) /* print mount flags */ 571 { 572 const char *s = raw? NULL : mountflags(pri, val); 573 574 if (s == NULL) 575 prt_hex(pri, 0, val); 576 else 577 outstring(pri, s); 578 } 579 580 void 581 prt_mft(private_t *pri, int raw, long val) /* print mount file system type */ 582 { 583 if (val >= 0 && val < 256) 584 prt_dec(pri, 0, val); 585 else if (raw) 586 prt_hex(pri, 0, val); 587 else 588 prt_stg(pri, raw, val); 589 } 590 591 #define ISREAD(code) \ 592 ((code) == SYS_read || (code) == SYS_pread || (code) == SYS_pread64 || \ 593 (code) == SYS_recv || (code) == SYS_recvfrom) 594 #define ISWRITE(code) \ 595 ((code) == SYS_write || (code) == SYS_pwrite || \ 596 (code) == SYS_pwrite64 || (code) == SYS_send || (code) == SYS_sendto) 597 598 /* print contents of read() or write() I/O buffer */ 599 void 600 prt_iob(private_t *pri, int raw, long val) 601 { 602 const lwpstatus_t *Lsp = pri->lwpstat; 603 int syscall = Lsp->pr_what; 604 int fdp1 = pri->sys_args[0] + 1; 605 ssize_t nbyte = ISWRITE(syscall)? pri->sys_args[2] : 606 (pri->Errno? 0 : pri->Rval1); 607 int elsewhere = FALSE; /* TRUE iff dumped elsewhere */ 608 char buffer[IOBSIZE]; 609 610 pri->iob_buf[0] = '\0'; 611 612 if (Lsp->pr_why == PR_SYSEXIT && nbyte > IOBSIZE) { 613 if (ISREAD(syscall)) 614 elsewhere = prismember(&readfd, fdp1); 615 else 616 elsewhere = prismember(&writefd, fdp1); 617 } 618 619 if (nbyte <= 0 || elsewhere) 620 prt_hex(pri, 0, val); 621 else { 622 int nb = nbyte > IOBSIZE? IOBSIZE : (int)nbyte; 623 624 if (Pread(Proc, buffer, (size_t)nb, (long)val) != nb) 625 prt_hex(pri, 0, val); 626 else { 627 pri->iob_buf[0] = '"'; 628 showbytes(buffer, nb, pri->iob_buf + 1); 629 (void) strlcat(pri->iob_buf, 630 (nb == nbyte)? 631 (const char *)"\"" : (const char *)"\"..", 632 sizeof (pri->iob_buf)); 633 if (raw) 634 prt_hex(pri, 0, val); 635 else 636 outstring(pri, pri->iob_buf); 637 } 638 } 639 } 640 #undef ISREAD 641 #undef ISWRITE 642 643 void 644 prt_idt(private_t *pri, int raw, long val) /* print idtype_t, waitid() arg */ 645 { 646 const char *s = raw? NULL : idtype_enum(pri, val); 647 648 if (s == NULL) 649 prt_dec(pri, 0, val); 650 else 651 outstring(pri, s); 652 } 653 654 void 655 prt_wop(private_t *pri, int raw, long val) /* print waitid() options */ 656 { 657 const char *s = raw? NULL : woptions(pri, (int)val); 658 659 if (s == NULL) 660 prt_oct(pri, 0, val); 661 else 662 outstring(pri, s); 663 } 664 665 void 666 prt_whn(private_t *pri, int raw, long val) /* print lseek() whence argument */ 667 { 668 const char *s = raw? NULL : whencearg(val); 669 670 if (s == NULL) 671 prt_dec(pri, 0, val); 672 else 673 outstring(pri, s); 674 } 675 676 /*ARGSUSED*/ 677 void 678 prt_spm(private_t *pri, int raw, long val) /* print sigprocmask argument */ 679 { 680 const char *s = NULL; 681 682 if (!raw) { 683 switch (val) { 684 case SIG_BLOCK: s = "SIG_BLOCK"; break; 685 case SIG_UNBLOCK: s = "SIG_UNBLOCK"; break; 686 case SIG_SETMASK: s = "SIG_SETMASK"; break; 687 } 688 } 689 690 if (s == NULL) 691 prt_dec(pri, 0, val); 692 else 693 outstring(pri, s); 694 } 695 696 const char * 697 mmap_protect(private_t *pri, long arg) 698 { 699 char *str = pri->code_buf; 700 701 if (arg & ~(PROT_READ|PROT_WRITE|PROT_EXEC)) 702 return ((char *)NULL); 703 704 if (arg == PROT_NONE) 705 return ("PROT_NONE"); 706 707 *str = '\0'; 708 if (arg & PROT_READ) 709 (void) strlcat(str, "|PROT_READ", sizeof (pri->code_buf)); 710 if (arg & PROT_WRITE) 711 (void) strlcat(str, "|PROT_WRITE", sizeof (pri->code_buf)); 712 if (arg & PROT_EXEC) 713 (void) strlcat(str, "|PROT_EXEC", sizeof (pri->code_buf)); 714 return ((const char *)(str + 1)); 715 } 716 717 const char * 718 mmap_type(private_t *pri, long arg) 719 { 720 char *str = pri->code_buf; 721 size_t used; 722 723 #define CBSIZE sizeof (pri->code_buf) 724 switch (arg & MAP_TYPE) { 725 case MAP_SHARED: 726 used = strlcpy(str, "MAP_SHARED", CBSIZE); 727 break; 728 case MAP_PRIVATE: 729 used = strlcpy(str, "MAP_PRIVATE", CBSIZE); 730 break; 731 default: 732 used = snprintf(str, CBSIZE, "%ld", arg&MAP_TYPE); 733 break; 734 } 735 736 arg &= ~(_MAP_NEW|MAP_TYPE); 737 738 if (arg & ~(MAP_FIXED|MAP_RENAME|MAP_NORESERVE|MAP_ANON|MAP_ALIGN| 739 MAP_TEXT|MAP_INITDATA)) 740 (void) snprintf(str + used, sizeof (pri->code_buf) - used, 741 "|0x%lX", arg); 742 else { 743 if (arg & MAP_FIXED) 744 (void) strlcat(str, "|MAP_FIXED", CBSIZE); 745 if (arg & MAP_RENAME) 746 (void) strlcat(str, "|MAP_RENAME", CBSIZE); 747 if (arg & MAP_NORESERVE) 748 (void) strlcat(str, "|MAP_NORESERVE", CBSIZE); 749 if (arg & MAP_ANON) 750 (void) strlcat(str, "|MAP_ANON", CBSIZE); 751 if (arg & MAP_ALIGN) 752 (void) strlcat(str, "|MAP_ALIGN", CBSIZE); 753 if (arg & MAP_TEXT) 754 (void) strlcat(str, "|MAP_TEXT", CBSIZE); 755 if (arg & MAP_INITDATA) 756 (void) strlcat(str, "|MAP_INITDATA", CBSIZE); 757 } 758 759 return ((const char *)str); 760 #undef CBSIZE 761 } 762 763 void 764 prt_mpr(private_t *pri, int raw, long val) /* print mmap()/mprotect() flags */ 765 { 766 const char *s = raw? NULL : mmap_protect(pri, val); 767 768 if (s == NULL) 769 prt_hhx(pri, 0, val); 770 else 771 outstring(pri, s); 772 } 773 774 void 775 prt_mty(private_t *pri, int raw, long val) /* print mmap() mapping type flags */ 776 { 777 const char *s = raw? NULL : mmap_type(pri, val); 778 779 if (s == NULL) 780 prt_hhx(pri, 0, val); 781 else 782 outstring(pri, s); 783 } 784 785 /*ARGSUSED*/ 786 void 787 prt_mcf(private_t *pri, int raw, long val) /* print memcntl() function */ 788 { 789 const char *s = NULL; 790 791 if (!raw) { 792 switch (val) { 793 case MC_SYNC: s = "MC_SYNC"; break; 794 case MC_LOCK: s = "MC_LOCK"; break; 795 case MC_UNLOCK: s = "MC_UNLOCK"; break; 796 case MC_ADVISE: s = "MC_ADVISE"; break; 797 case MC_LOCKAS: s = "MC_LOCKAS"; break; 798 case MC_UNLOCKAS: s = "MC_UNLOCKAS"; break; 799 case MC_HAT_ADVISE: s = "MC_HAT_ADVISE"; break; 800 } 801 } 802 803 if (s == NULL) 804 prt_dec(pri, 0, val); 805 else 806 outstring(pri, s); 807 } 808 809 void 810 prt_mad(private_t *pri, int raw, long val) /* print madvise() argument */ 811 { 812 const char *s = NULL; 813 814 if (!raw) { 815 switch (val) { 816 case MADV_NORMAL: s = "MADV_NORMAL"; break; 817 case MADV_RANDOM: s = "MADV_RANDOM"; break; 818 case MADV_SEQUENTIAL: s = "MADV_SEQUENTIAL"; break; 819 case MADV_WILLNEED: s = "MADV_WILLNEED"; break; 820 case MADV_DONTNEED: s = "MADV_DONTNEED"; break; 821 case MADV_FREE: s = "MADV_FREE"; break; 822 case MADV_ACCESS_DEFAULT: s = "MADV_ACCESS_DEFAULT"; break; 823 case MADV_ACCESS_LWP: s = "MADV_ACCESS_LWP"; break; 824 case MADV_ACCESS_MANY: s = "MADV_ACCESS_MANY"; break; 825 } 826 } 827 828 if (s == NULL) 829 prt_dec(pri, 0, val); 830 else 831 outstring(pri, s); 832 } 833 834 void 835 prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */ 836 { 837 if (val == 0) 838 prt_dec(pri, 0, val); 839 else if (raw) 840 prt_hhx(pri, 0, val); 841 else { 842 char *s = NULL; 843 844 #define CBSIZE sizeof (pri->code_buf) 845 /* cheating -- look at memcntl func */ 846 switch (pri->sys_args[2]) { 847 case MC_ADVISE: 848 prt_mad(pri, 0, val); 849 return; 850 851 case MC_SYNC: 852 if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) { 853 *(s = pri->code_buf) = '\0'; 854 if (val & MS_SYNC) 855 (void) strlcat(s, "|MS_SYNC", CBSIZE); 856 if (val & MS_ASYNC) 857 (void) strlcat(s, "|MS_ASYNC", CBSIZE); 858 if (val & MS_INVALIDATE) 859 (void) strlcat(s, "|MS_INVALIDATE", 860 CBSIZE); 861 } 862 break; 863 864 case MC_LOCKAS: 865 case MC_UNLOCKAS: 866 if ((val & ~(MCL_CURRENT|MCL_FUTURE)) == 0) { 867 *(s = pri->code_buf) = '\0'; 868 if (val & MCL_CURRENT) 869 (void) strlcat(s, "|MCL_CURRENT", 870 CBSIZE); 871 if (val & MCL_FUTURE) 872 (void) strlcat(s, "|MCL_FUTURE", 873 CBSIZE); 874 } 875 break; 876 } 877 #undef CBSIZE 878 879 if (s == NULL || *s == '\0') 880 prt_hhx(pri, 0, val); 881 else 882 outstring(pri, ++s); 883 } 884 } 885 886 void 887 prt_mc5(private_t *pri, int raw, long val) /* print memcntl() (5th) argument */ 888 { 889 char *s; 890 891 #define CBSIZE sizeof (pri->code_buf) 892 if (val == 0) 893 prt_dec(pri, 0, val); 894 else if (raw || (val & ~VALID_ATTR)) 895 prt_hhx(pri, 0, val); 896 else { 897 s = pri->code_buf; 898 *s = '\0'; 899 if (val & SHARED) 900 (void) strlcat(s, "|SHARED", CBSIZE); 901 if (val & PRIVATE) 902 (void) strlcat(s, "|PRIVATE", CBSIZE); 903 if (val & PROT_READ) 904 (void) strlcat(s, "|PROT_READ", CBSIZE); 905 if (val & PROT_WRITE) 906 (void) strlcat(s, "|PROT_WRITE", CBSIZE); 907 if (val & PROT_EXEC) 908 (void) strlcat(s, "|PROT_EXEC", CBSIZE); 909 if (*s == '\0') 910 prt_hhx(pri, 0, val); 911 else 912 outstring(pri, ++s); 913 } 914 #undef CBSIZE 915 } 916 917 void 918 prt_ulm(private_t *pri, int raw, long val) /* print ulimit() argument */ 919 { 920 const char *s = NULL; 921 922 if (!raw) { 923 switch (val) { 924 case UL_GFILLIM: s = "UL_GFILLIM"; break; 925 case UL_SFILLIM: s = "UL_SFILLIM"; break; 926 case UL_GMEMLIM: s = "UL_GMEMLIM"; break; 927 case UL_GDESLIM: s = "UL_GDESLIM"; break; 928 } 929 } 930 931 if (s == NULL) 932 prt_dec(pri, 0, val); 933 else 934 outstring(pri, s); 935 } 936 937 void 938 prt_rlm(private_t *pri, int raw, long val) /* print get/setrlimit() argument */ 939 { 940 const char *s = NULL; 941 942 if (!raw) { 943 switch (val) { 944 case RLIMIT_CPU: s = "RLIMIT_CPU"; break; 945 case RLIMIT_FSIZE: s = "RLIMIT_FSIZE"; break; 946 case RLIMIT_DATA: s = "RLIMIT_DATA"; break; 947 case RLIMIT_STACK: s = "RLIMIT_STACK"; break; 948 case RLIMIT_CORE: s = "RLIMIT_CORE"; break; 949 case RLIMIT_NOFILE: s = "RLIMIT_NOFILE"; break; 950 case RLIMIT_VMEM: s = "RLIMIT_VMEM"; break; 951 } 952 } 953 954 if (s == NULL) 955 prt_dec(pri, 0, val); 956 else 957 outstring(pri, s); 958 } 959 960 void 961 prt_cnf(private_t *pri, int raw, long val) /* print sysconfig code */ 962 { 963 const char *s = raw? NULL : sconfname(val); 964 965 if (s == NULL) 966 prt_dec(pri, 0, val); 967 else 968 outstring(pri, s); 969 } 970 971 void 972 prt_inf(private_t *pri, int raw, long val) /* print sysinfo code */ 973 { 974 const char *s = NULL; 975 976 if (!raw) { 977 switch (val) { 978 case SI_SYSNAME: s = "SI_SYSNAME"; break; 979 case SI_HOSTNAME: s = "SI_HOSTNAME"; break; 980 case SI_RELEASE: s = "SI_RELEASE"; break; 981 case SI_VERSION: s = "SI_VERSION"; break; 982 case SI_MACHINE: s = "SI_MACHINE"; break; 983 case SI_ARCHITECTURE: s = "SI_ARCHITECTURE"; break; 984 case SI_ARCHITECTURE_32:s = "SI_ARCHITECTURE_32"; break; 985 case SI_ARCHITECTURE_64:s = "SI_ARCHITECTURE_64"; break; 986 case SI_ARCHITECTURE_K: s = "SI_ARCHITECTURE_K"; break; 987 case SI_HW_SERIAL: s = "SI_HW_SERIAL"; break; 988 case SI_HW_PROVIDER: s = "SI_HW_PROVIDER"; break; 989 case SI_SRPC_DOMAIN: s = "SI_SRPC_DOMAIN"; break; 990 case SI_SET_HOSTNAME: s = "SI_SET_HOSTNAME"; break; 991 case SI_SET_SRPC_DOMAIN: s = "SI_SET_SRPC_DOMAIN"; break; 992 case SI_PLATFORM: s = "SI_PLATFORM"; break; 993 case SI_ISALIST: s = "SI_ISALIST"; break; 994 case SI_DHCP_CACHE: s = "SI_DHCP_CACHE"; break; 995 } 996 } 997 998 if (s == NULL) 999 prt_dec(pri, 0, val); 1000 else 1001 outstring(pri, s); 1002 } 1003 1004 void 1005 prt_ptc(private_t *pri, int raw, long val) /* print pathconf code */ 1006 { 1007 const char *s = raw? NULL : pathconfname(val); 1008 1009 if (s == NULL) 1010 prt_dec(pri, 0, val); 1011 else 1012 outstring(pri, s); 1013 } 1014 1015 void 1016 prt_fui(private_t *pri, int raw, long val) /* print fusers() input argument */ 1017 { 1018 const char *s = raw? NULL : fuiname(val); 1019 1020 if (s == NULL) 1021 prt_hhx(pri, 0, val); 1022 else 1023 outstring(pri, s); 1024 } 1025 1026 void 1027 prt_lwf(private_t *pri, int raw, long val) /* print lwp_create() flags */ 1028 { 1029 char *s; 1030 1031 if (val == 0) 1032 prt_dec(pri, 0, val); 1033 else if (raw || 1034 (val & ~(LWP_DAEMON|LWP_DETACHED|LWP_SUSPENDED))) 1035 prt_hhx(pri, 0, val); 1036 else { 1037 #define CBSIZE sizeof (pri->code_buf) 1038 s = pri->code_buf; 1039 *s = '\0'; 1040 if (val & LWP_DAEMON) 1041 (void) strlcat(s, "|LWP_DAEMON", CBSIZE); 1042 if (val & LWP_DETACHED) 1043 (void) strlcat(s, "|LWP_DETACHED", CBSIZE); 1044 if (val & LWP_SUSPENDED) 1045 (void) strlcat(s, "|LWP_SUSPENDED", CBSIZE); 1046 outstring(pri, ++s); 1047 #undef CBSIZE 1048 } 1049 } 1050 1051 void 1052 prt_itm(private_t *pri, int raw, long val) /* print [get|set]itimer() arg */ 1053 { 1054 const char *s = NULL; 1055 1056 if (!raw) { 1057 switch (val) { 1058 case ITIMER_REAL: s = "ITIMER_REAL"; break; 1059 case ITIMER_VIRTUAL: s = "ITIMER_VIRTUAL"; break; 1060 case ITIMER_PROF: s = "ITIMER_PROF"; break; 1061 #ifdef ITIMER_REALPROF 1062 case ITIMER_REALPROF: s = "ITIMER_REALPROF"; break; 1063 #endif 1064 } 1065 } 1066 1067 if (s == NULL) 1068 prt_dec(pri, 0, val); 1069 else 1070 outstring(pri, s); 1071 } 1072 1073 void 1074 prt_mod(private_t *pri, int raw, long val) /* print modctl() code */ 1075 { 1076 const char *s = NULL; 1077 1078 if (!raw) { 1079 switch (val) { 1080 case MODLOAD: s = "MODLOAD"; break; 1081 case MODUNLOAD: s = "MODUNLOAD"; break; 1082 case MODINFO: s = "MODINFO"; break; 1083 case MODRESERVED: s = "MODRESERVED"; break; 1084 case MODSETMINIROOT: s = "MODSETMINIROOT"; break; 1085 case MODADDMAJBIND: s = "MODADDMAJBIND"; break; 1086 case MODGETPATH: s = "MODGETPATH"; break; 1087 case MODGETPATHLEN: s = "MODGETPATHLEN"; break; 1088 case MODREADSYSBIND: s = "MODREADSYSBIND"; break; 1089 case MODGETMAJBIND: s = "MODGETMAJBIND"; break; 1090 case MODGETNAME: s = "MODGETNAME"; break; 1091 case MODSIZEOF_DEVID: s = "MODSIZEOF_DEVID"; break; 1092 case MODGETDEVID: s = "MODGETDEVID"; break; 1093 case MODSIZEOF_MINORNAME: s = "MODSIZEOF_MINORNAME"; break; 1094 case MODGETMINORNAME: s = "MODGETMINORNAME"; break; 1095 case MODGETFBNAME: s = "MODGETFBNAME"; break; 1096 case MODEVENTS: s = "MODEVENTS"; break; 1097 case MODREREADDACF: s = "MODREREADDACF"; break; 1098 case MODLOADDRVCONF: s = "MODLOADDRVCONF"; break; 1099 case MODUNLOADDRVCONF: s = "MODUNLOADDRVCONF"; break; 1100 case MODREMMAJBIND: s = "MODREMMAJBIND"; break; 1101 case MODDEVT2INSTANCE: s = "MODDEVT2INSTANCE"; break; 1102 case MODGETDEVFSPATH_LEN: s = "MODGETDEVFSPATH_LEN"; break; 1103 case MODGETDEVFSPATH: s = "MODGETDEVFSPATH"; break; 1104 case MODDEVID2PATHS: s = "MODDEVID2PATHS"; break; 1105 case MODSETDEVPOLICY: s = "MODSETDEVPOLICY"; break; 1106 case MODGETDEVPOLICY: s = "MODGETDEVPOLICY"; break; 1107 case MODALLOCPRIV: s = "MODALLOCPRIV"; break; 1108 case MODGETDEVPOLICYBYNAME: 1109 s = "MODGETDEVPOLICYBYNAME"; break; 1110 case MODLOADMINORPERM: s = "MODLOADMINORPERM"; break; 1111 case MODADDMINORPERM: s = "MODADDMINORPERM"; break; 1112 case MODREMMINORPERM: s = "MODREMMINORPERM"; break; 1113 case MODREMDRVCLEANUP: s = "MODREMDRVCLEANUP"; break; 1114 case MODDEVEXISTS: s = "MODDEVEXISTS"; break; 1115 case MODDEVREADDIR: s = "MODDEVREADDIR"; break; 1116 case MODDEVNAME: s = "MODDEVNAME"; break; 1117 case MODGETDEVFSPATH_MI_LEN: 1118 s = "MODGETDEVFSPATH_MI_LEN"; break; 1119 case MODGETDEVFSPATH_MI: 1120 s = "MODGETDEVFSPATH_MI"; break; 1121 } 1122 } 1123 1124 if (s == NULL) 1125 prt_dec(pri, 0, val); 1126 else 1127 outstring(pri, s); 1128 } 1129 1130 void 1131 prt_acl(private_t *pri, int raw, long val) /* print acl() code */ 1132 { 1133 const char *s = NULL; 1134 1135 if (!raw) { 1136 switch (val) { 1137 case GETACL: s = "GETACL"; break; 1138 case SETACL: s = "SETACL"; break; 1139 case GETACLCNT: s = "GETACLCNT"; break; 1140 case ACE_GETACL: s = "ACE_GETACL"; break; 1141 case ACE_SETACL: s = "ACE_SETACL"; break; 1142 case ACE_GETACLCNT: s = "ACE_GETACLCNT"; break; 1143 } 1144 } 1145 1146 if (s == NULL) 1147 prt_dec(pri, 0, val); 1148 else 1149 outstring(pri, s); 1150 } 1151 1152 void 1153 prt_aio(private_t *pri, int raw, long val) /* print kaio() code */ 1154 { 1155 const char *s = NULL; 1156 char buf[32]; 1157 1158 if (!raw) { 1159 switch (val & ~AIO_POLL_BIT) { 1160 case AIOREAD: s = "AIOREAD"; break; 1161 case AIOWRITE: s = "AIOWRITE"; break; 1162 case AIOWAIT: s = "AIOWAIT"; break; 1163 case AIOCANCEL: s = "AIOCANCEL"; break; 1164 case AIONOTIFY: s = "AIONOTIFY"; break; 1165 case AIOINIT: s = "AIOINIT"; break; 1166 case AIOSTART: s = "AIOSTART"; break; 1167 case AIOLIO: s = "AIOLIO"; break; 1168 case AIOSUSPEND: s = "AIOSUSPEND"; break; 1169 case AIOERROR: s = "AIOERROR"; break; 1170 case AIOLIOWAIT: s = "AIOLIOWAIT"; break; 1171 case AIOAREAD: s = "AIOAREAD"; break; 1172 case AIOAWRITE: s = "AIOAWRITE"; break; 1173 /* 1174 * We have to hardcode the values for the 64-bit versions of 1175 * these calls, because <sys/aio.h> defines them to be identical 1176 * when compiled 64-bit. If our target is 32-bit, we still need 1177 * to decode them correctly. 1178 */ 1179 case 13: s = "AIOLIO64"; break; 1180 case 14: s = "AIOSUSPEND64"; break; 1181 case 15: s = "AUIOERROR64"; break; 1182 case 16: s = "AIOLIOWAIT64"; break; 1183 case 17: s = "AIOAREAD64"; break; 1184 case 18: s = "AIOAWRITE64"; break; 1185 case 19: s = "AIOCANCEL64"; break; 1186 1187 /* 1188 * AIOFSYNC doesn't correspond to a syscall. 1189 */ 1190 case AIOWAITN: s = "AIOWAITN"; break; 1191 } 1192 if (s != NULL && (val & AIO_POLL_BIT)) { 1193 (void) strlcpy(buf, s, sizeof (buf)); 1194 (void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf)); 1195 s = (const char *)buf; 1196 } 1197 } 1198 1199 if (s == NULL) 1200 prt_dec(pri, 0, val); 1201 else 1202 outstring(pri, s); 1203 } 1204 1205 void 1206 prt_aud(private_t *pri, int raw, long val) /* print auditsys() code */ 1207 { 1208 const char *s = NULL; 1209 1210 if (!raw) { 1211 switch (val) { 1212 case BSM_GETAUID: s = "BSM_GETAUID"; break; 1213 case BSM_SETAUID: s = "BSM_SETAUID"; break; 1214 case BSM_GETAUDIT: s = "BSM_GETAUDIT"; break; 1215 case BSM_SETAUDIT: s = "BSM_SETAUDIT"; break; 1216 case BSM_GETUSERAUDIT: s = "BSM_GETUSERAUDIT"; break; 1217 case BSM_SETUSERAUDIT: s = "BSM_SETUSERAUDIT"; break; 1218 case BSM_AUDIT: s = "BSM_AUDIT"; break; 1219 case BSM_AUDITON: s = "BSM_AUDITON"; break; 1220 case BSM_AUDITCTL: s = "BSM_AUDITCTL"; break; 1221 case BSM_GETKERNSTATE: s = "BSM_GETKERNSTATE"; break; 1222 case BSM_SETKERNSTATE: s = "BSM_SETKERNSTATE"; break; 1223 case BSM_GETPORTAUDIT: s = "BSM_GETPORTAUDIT"; break; 1224 case BSM_REVOKE: s = "BSM_REVOKE"; break; 1225 case BSM_AUDITSTAT: s = "BSM_AUDITSTAT"; break; 1226 case BSM_GETAUDIT_ADDR: s = "BSM_GETAUDIT_ADDR"; break; 1227 case BSM_SETAUDIT_ADDR: s = "BSM_SETAUDIT_ADDR"; break; 1228 } 1229 } 1230 1231 if (s == NULL) 1232 prt_dec(pri, 0, val); 1233 else 1234 outstring(pri, s); 1235 } 1236 1237 void 1238 prt_cor(private_t *pri, int raw, long val) /* print corectl() subcode */ 1239 { 1240 const char *s = NULL; 1241 1242 if (!raw) { 1243 switch (val) { 1244 case CC_SET_OPTIONS: 1245 s = "CC_SET_OPTIONS"; break; 1246 case CC_GET_OPTIONS: 1247 s = "CC_GET_OPTIONS"; break; 1248 case CC_SET_GLOBAL_PATH: 1249 s = "CC_SET_GLOBAL_PATH"; break; 1250 case CC_GET_GLOBAL_PATH: 1251 s = "CC_GET_GLOBAL_PATH"; break; 1252 case CC_SET_PROCESS_PATH: 1253 s = "CC_SET_PROCESS_PATH"; break; 1254 case CC_GET_PROCESS_PATH: 1255 s = "CC_GET_PROCESS_PATH"; break; 1256 case CC_SET_GLOBAL_CONTENT: 1257 s = "CC_SET_GLOBAL_CONTENT"; break; 1258 case CC_GET_GLOBAL_CONTENT: 1259 s = "CC_GET_GLOBAL_CONTENT"; break; 1260 case CC_SET_PROCESS_CONTENT: 1261 s = "CC_SET_PROCESS_CONTENT"; break; 1262 case CC_GET_PROCESS_CONTENT: 1263 s = "CC_GET_PROCESS_CONTENT"; break; 1264 case CC_SET_DEFAULT_PATH: 1265 s = "CC_SET_DEFAULT_PATH"; break; 1266 case CC_GET_DEFAULT_PATH: 1267 s = "CC_GET_DEFAULT_PATH"; break; 1268 case CC_SET_DEFAULT_CONTENT: 1269 s = "CC_SET_DEFAULT_CONTENT"; break; 1270 case CC_GET_DEFAULT_CONTENT: 1271 s = "CC_GET_DEFAULT_CONTENT"; break; 1272 } 1273 } 1274 1275 if (s == NULL) 1276 prt_dec(pri, 0, val); 1277 else 1278 outstring(pri, s); 1279 } 1280 1281 void 1282 prt_cco(private_t *pri, int raw, long val) /* print corectl() options */ 1283 { 1284 char *s; 1285 1286 if (val == 0) 1287 prt_dec(pri, 0, val); 1288 else if (raw || (val & ~CC_OPTIONS)) 1289 prt_hhx(pri, 0, val); 1290 else { 1291 #define CBSIZE sizeof (pri->code_buf) 1292 s = pri->code_buf; 1293 *s = '\0'; 1294 if (val & CC_GLOBAL_PATH) 1295 (void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE); 1296 if (val & CC_PROCESS_PATH) 1297 (void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE); 1298 if (val & CC_GLOBAL_SETID) 1299 (void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE); 1300 if (val & CC_PROCESS_SETID) 1301 (void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE); 1302 if (val & CC_GLOBAL_LOG) 1303 (void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE); 1304 if (*s == '\0') 1305 prt_hhx(pri, 0, val); 1306 else 1307 outstring(pri, ++s); 1308 #undef CBSIZE 1309 } 1310 } 1311 1312 void 1313 prt_ccc(private_t *pri, int raw, long val) /* print corectl() content */ 1314 { 1315 core_content_t ccc; 1316 1317 if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc)) 1318 prt_hex(pri, 0, val); 1319 else if (!raw && proc_content2str(ccc, pri->code_buf, 1320 sizeof (pri->code_buf)) >= 0) 1321 outstring(pri, pri->code_buf); 1322 else 1323 prt_hhx(pri, 0, (long)ccc); 1324 } 1325 1326 void 1327 prt_rcc(private_t *pri, int raw, long val) /* print corectl() ret. cont. */ 1328 { 1329 core_content_t ccc; 1330 1331 if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc)) 1332 prt_hex(pri, 0, val); 1333 else if (!raw && proc_content2str(ccc, pri->code_buf, 1334 sizeof (pri->code_buf)) >= 0) 1335 outstring(pri, pri->code_buf); 1336 else 1337 prt_hhx(pri, 0, (long)ccc); 1338 } 1339 1340 void 1341 prt_cpc(private_t *pri, int raw, long val) /* print cpc() subcode */ 1342 { 1343 const char *s = NULL; 1344 1345 if (!raw) { 1346 switch (val) { 1347 case CPC_BIND: s = "CPC_BIND"; break; 1348 case CPC_SAMPLE: s = "CPC_SAMPLE"; break; 1349 case CPC_INVALIDATE: s = "CPC_INVALIDATE"; break; 1350 case CPC_RELE: s = "CPC_RELE"; break; 1351 case CPC_EVLIST_SIZE: s = "CPC_EVLIST_SIZE"; break; 1352 case CPC_LIST_EVENTS: s = "CPC_LIST_EVENTS"; break; 1353 case CPC_ATTRLIST_SIZE: s = "CPC_ATTRLIST_SIZE"; break; 1354 case CPC_LIST_ATTRS: s = "CPC_LIST_ATTRS"; break; 1355 case CPC_IMPL_NAME: s = "CPC_IMPL_NAME"; break; 1356 case CPC_CPUREF: s = "CPC_CPUREF"; break; 1357 case CPC_USR_EVENTS: s = "CPC_USR_EVENTS"; break; 1358 case CPC_SYS_EVENTS: s = "CPC_SYS_EVENTS"; break; 1359 case CPC_NPIC: s = "CPC_NPIC"; break; 1360 case CPC_CAPS: s = "CPC_CAPS"; break; 1361 case CPC_ENABLE: s = "CPC_ENABLE"; break; 1362 case CPC_DISABLE: s = "CPC_DISABLE"; break; 1363 } 1364 } 1365 1366 if (s == NULL) 1367 prt_dec(pri, 0, val); 1368 else 1369 outstring(pri, s); 1370 } 1371 1372 void 1373 outstring(private_t *pri, const char *s) 1374 { 1375 int len = strlen(s); 1376 1377 GROW(len); 1378 (void) strcpy(pri->sys_string + pri->sys_leng, s); 1379 pri->sys_leng += len; 1380 } 1381 1382 void 1383 grow(private_t *pri, int nbyte) /* reallocate format buffer if necessary */ 1384 { 1385 while (pri->sys_leng + nbyte >= pri->sys_ssize) 1386 pri->sys_string = my_realloc(pri->sys_string, 1387 pri->sys_ssize *= 2, "format buffer"); 1388 } 1389 1390 void 1391 prt_clc(private_t *pri, int raw, long val) 1392 { 1393 const char *s = NULL; 1394 1395 if (!raw) { 1396 switch (val) { 1397 case CL_INITIALIZE: s = "CL_INITIALIZE"; break; 1398 case CL_CONFIG: s = "CL_CONFIG"; break; 1399 } 1400 } 1401 1402 if (s == NULL) 1403 prt_dec(pri, 0, val); 1404 else 1405 outstring(pri, s); 1406 } 1407 1408 void 1409 prt_clf(private_t *pri, int raw, long val) 1410 { 1411 const char *s = NULL; 1412 1413 if (!raw) { 1414 switch (pri->sys_args[0]) { 1415 case CL_CONFIG: 1416 switch (pri->sys_args[1]) { 1417 case CL_NODEID: 1418 s = "CL_NODEID"; break; 1419 case CL_HIGHEST_NODEID: 1420 s = "CL_HIGHEST_NODEID"; break; 1421 } 1422 break; 1423 case CL_INITIALIZE: 1424 switch (pri->sys_args[1]) { 1425 case CL_GET_BOOTFLAG: 1426 s = "CL_GET_BOOTFLAG"; break; 1427 } 1428 break; 1429 } 1430 } 1431 1432 if (s == NULL) 1433 prt_dec(pri, 0, val); 1434 else 1435 outstring(pri, s); 1436 } 1437 1438 void 1439 prt_sqc(private_t *pri, int raw, long val) /* print sigqueue() si_code */ 1440 { 1441 const char *s = NULL; 1442 1443 if (!raw) { 1444 switch ((int)val) { 1445 case SI_QUEUE: s = "SI_QUEUE"; break; 1446 case SI_TIMER: s = "SI_TIMER"; break; 1447 case SI_ASYNCIO: s = "SI_ASYNCIO"; break; 1448 case SI_MESGQ: s = "SI_MESGQ"; break; 1449 } 1450 } 1451 1452 if (s == NULL) 1453 prt_dec(pri, 0, val); 1454 else 1455 outstring(pri, s); 1456 } 1457 1458 /* 1459 * print priocntlsys() (key, value) pair key. 1460 */ 1461 void 1462 print_pck(private_t *pri, int raw, long val) 1463 { 1464 const char *s = NULL; 1465 char clname[PC_CLNMSZ]; 1466 1467 if ((pri->sys_args[2] != PC_GETXPARMS && 1468 pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) { 1469 prt_dec(pri, 0, val); 1470 return; 1471 } 1472 1473 if (pri->sys_args[3] == NULL) { 1474 if (val == PC_KY_CLNAME) { 1475 s = "PC_KY_CLNAME"; 1476 outstring(pri, s); 1477 } else 1478 prt_dec(pri, 0, val); 1479 return; 1480 } 1481 1482 if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) { 1483 prt_dec(pri, 0, val); 1484 return; 1485 } 1486 1487 if (strcmp(clname, "TS") == 0) { 1488 switch (val) { 1489 case TS_KY_UPRILIM: s = "TS_KY_UPRILIM"; break; 1490 case TS_KY_UPRI: s = "TS_KY_UPRI"; break; 1491 default: break; 1492 } 1493 } else if (strcmp(clname, "IA") == 0) { 1494 switch (val) { 1495 case IA_KY_UPRILIM: s = "IA_KY_UPRILIM"; break; 1496 case IA_KY_UPRI: s = "IA_KY_UPRI"; break; 1497 case IA_KY_MODE: s = "IA_KY_MODE"; break; 1498 default: break; 1499 } 1500 } else if (strcmp(clname, "RT") == 0) { 1501 switch (val) { 1502 case RT_KY_PRI: s = "RT_KY_PRI"; break; 1503 case RT_KY_TQSECS: s = "RT_KY_TQSECS"; break; 1504 case RT_KY_TQNSECS: s = "RT_KY_TQNSECS"; break; 1505 case RT_KY_TQSIG: s = "RT_KY_TQSIG"; break; 1506 default: break; 1507 } 1508 } else if (strcmp(clname, "FSS") == 0) { 1509 switch (val) { 1510 case FSS_KY_UPRILIM: s = "FSS_KY_UPRILIM"; break; 1511 case FSS_KY_UPRI: s = "FSS_KY_UPRI"; break; 1512 default: break; 1513 } 1514 } else if (strcmp(clname, "FX") == 0) { 1515 switch (val) { 1516 case FX_KY_UPRILIM: s = "FX_KY_UPRILIM"; break; 1517 case FX_KY_UPRI: s = "FX_KY_UPRI"; break; 1518 case FX_KY_TQSECS: s = "FX_KY_TQSECS"; break; 1519 case FX_KY_TQNSECS: s = "FX_KY_TQNSECS"; break; 1520 default: break; 1521 } 1522 } 1523 1524 if (s == NULL) 1525 prt_dec(pri, 0, val); 1526 else 1527 outstring(pri, s); 1528 } 1529 1530 /* 1531 * print priocntlsys() fourth argument. 1532 */ 1533 /*ARGSUSED*/ 1534 void 1535 prt_pc4(private_t *pri, int raw, long val) 1536 { 1537 /* look at pricntlsys function */ 1538 if ((pri->sys_args[2] != PC_GETXPARMS && 1539 pri->sys_args[2] != PC_SETXPARMS)) 1540 prt_hex(pri, 0, val); 1541 else if (val) 1542 prt_stg(pri, 0, val); 1543 else 1544 prt_dec(pri, 0, val); 1545 } 1546 1547 /* 1548 * print priocntlsys() (key, value) pairs (5th argument). 1549 */ 1550 /*ARGSUSED*/ 1551 void 1552 prt_pc5(private_t *pri, int raw, long val) 1553 { 1554 pc_vaparms_t prms; 1555 pc_vaparm_t *vpp = &prms.pc_parms[0]; 1556 uint_t cnt; 1557 1558 1559 /* look at pricntlsys function */ 1560 if ((pri->sys_args[2] != PC_GETXPARMS && 1561 pri->sys_args[2] != PC_SETXPARMS) || val == 0) { 1562 prt_dec(pri, 0, 0); 1563 return; 1564 } 1565 1566 if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) { 1567 prt_hex(pri, 0, val); 1568 return; 1569 } 1570 1571 if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT) 1572 return; 1573 1574 for (; cnt--; vpp++) { 1575 print_pck(pri, 0, vpp->pc_key); 1576 outstring(pri, ", "); 1577 prt_hex(pri, 0, (long)vpp->pc_parm); 1578 outstring(pri, ", "); 1579 } 1580 1581 prt_dec(pri, 0, PC_KY_NULL); 1582 } 1583 1584 /* 1585 * Print processor set id, including logical expansion of "special" ids. 1586 */ 1587 void 1588 prt_pst(private_t *pri, int raw, long val) 1589 { 1590 const char *s = NULL; 1591 1592 if (!raw) { 1593 switch ((psetid_t)val) { 1594 case PS_NONE: s = "PS_NONE"; break; 1595 case PS_QUERY: s = "PS_QUERY"; break; 1596 case PS_MYID: s = "PS_MYID"; break; 1597 } 1598 } 1599 1600 if (s == NULL) 1601 prt_dec(pri, 0, val); 1602 else 1603 outstring(pri, s); 1604 } 1605 1606 /* 1607 * Print meminfo() argument. 1608 */ 1609 /*ARGSUSED*/ 1610 void 1611 prt_mif(private_t *pri, int raw, long val) 1612 { 1613 struct meminfo minfo; 1614 1615 #ifdef _LP64 1616 if (data_model == PR_MODEL_ILP32) { 1617 struct meminfo32 minfo32; 1618 1619 if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) != 1620 sizeof (struct meminfo32)) { 1621 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */ 1622 outstring(pri, ", "); 1623 prt_hex(pri, 0, val); 1624 return; 1625 } 1626 /* 1627 * arrange the arguments in the order that user calls with 1628 */ 1629 prt_hex(pri, 0, minfo32.mi_inaddr); 1630 outstring(pri, ", "); 1631 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */ 1632 outstring(pri, ", "); 1633 prt_hex(pri, 0, minfo32.mi_info_req); 1634 outstring(pri, ", "); 1635 prt_dec(pri, 0, minfo32.mi_info_count); 1636 outstring(pri, ", "); 1637 prt_hex(pri, 0, minfo32.mi_outdata); 1638 outstring(pri, ", "); 1639 prt_hex(pri, 0, minfo32.mi_validity); 1640 return; 1641 } 1642 #endif 1643 if (Pread(Proc, &minfo, sizeof (struct meminfo), val) != 1644 sizeof (struct meminfo)) { 1645 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */ 1646 outstring(pri, ", "); 1647 prt_hex(pri, 0, val); 1648 return; 1649 } 1650 /* 1651 * arrange the arguments in the order that user calls with 1652 */ 1653 prt_hex(pri, 0, (long)minfo.mi_inaddr); 1654 outstring(pri, ", "); 1655 prt_dec(pri, 0, pri->sys_args[1]); /* addr_count */ 1656 outstring(pri, ", "); 1657 prt_hex(pri, 0, (long)minfo.mi_info_req); 1658 outstring(pri, ", "); 1659 prt_dec(pri, 0, minfo.mi_info_count); 1660 outstring(pri, ", "); 1661 prt_hex(pri, 0, (long)minfo.mi_outdata); 1662 outstring(pri, ", "); 1663 prt_hex(pri, 0, (long)minfo.mi_validity); 1664 } 1665 1666 1667 /* 1668 * Print so_socket() 1st argument. 1669 */ 1670 /*ARGSUSED*/ 1671 void 1672 prt_pfm(private_t *pri, int raw, long val) 1673 { 1674 /* Protocol Families have same names as Address Families */ 1675 if ((ulong_t)val < MAX_AFCODES) { 1676 outstring(pri, "PF_"); 1677 outstring(pri, afcodes[val]); 1678 } else { 1679 prt_dec(pri, 0, val); 1680 } 1681 } 1682 1683 1684 /* 1685 * Print so_socket() 2nd argument. 1686 */ 1687 /*ARGSUSED*/ 1688 void 1689 prt_skt(private_t *pri, int raw, long val) 1690 { 1691 const char *s; 1692 1693 if ((ulong_t)val <= MAX_SOCKTYPES && (s = socktype_codes[val]) != NULL) 1694 outstring(pri, s); 1695 else 1696 prt_dec(pri, 0, val); 1697 } 1698 1699 1700 /* 1701 * Print so_socket() 3rd argument. 1702 */ 1703 /*ARGSUSED*/ 1704 void 1705 prt_skp(private_t *pri, int raw, long val) 1706 { 1707 const char *s; 1708 1709 /* cheating -- look at the protocol-family */ 1710 switch (pri->sys_args[0]) { 1711 case PF_INET6: 1712 case PF_INET: 1713 case PF_NCA: if ((s = ipprotos((int)val)) != NULL) { 1714 outstring(pri, s); 1715 break; 1716 } 1717 /* FALLTHROUGH */ 1718 default: prt_dec(pri, 0, val); 1719 break; 1720 } 1721 } 1722 1723 1724 /* 1725 * Print so_socket() 5th argument. 1726 */ 1727 /*ARGSUSED*/ 1728 void 1729 prt_skv(private_t *pri, int raw, long val) 1730 { 1731 switch (val) { 1732 case SOV_STREAM: outstring(pri, "SOV_STREAM"); break; 1733 case SOV_DEFAULT: outstring(pri, "SOV_DEFAULT"); break; 1734 case SOV_SOCKSTREAM: outstring(pri, "SOV_SOCKSTREAM"); break; 1735 case SOV_SOCKBSD: outstring(pri, "SOV_SOCKBSD"); break; 1736 case SOV_XPG4_2: outstring(pri, "SOV_XPG4_2"); break; 1737 default: prt_dec(pri, 0, val); break; 1738 } 1739 } 1740 1741 1742 /* 1743 * Print setsockopt()/getsockopt() 2nd argument. 1744 */ 1745 /*ARGSUSED*/ 1746 void 1747 prt_sol(private_t *pri, int raw, long val) 1748 { 1749 if (val == SOL_SOCKET) { 1750 outstring(pri, "SOL_SOCKET"); 1751 } else { 1752 const struct protoent *p; 1753 struct protoent res; 1754 char buf[NSS_BUFLEN_PROTOCOLS]; 1755 1756 if ((p = getprotobynumber_r(val, &res, 1757 (char *)buf, sizeof (buf))) != NULL) 1758 outstring(pri, p->p_name); 1759 else 1760 prt_dec(pri, 0, val); 1761 } 1762 } 1763 1764 1765 const char * 1766 sol_optname(private_t *pri, long val) 1767 { 1768 #define CBSIZE sizeof (pri->code_buf) 1769 if (val >= SO_SNDBUF) { 1770 switch (val) { 1771 case SO_SNDBUF: return ("SO_SNDBUF"); 1772 case SO_RCVBUF: return ("SO_RCVBUF"); 1773 case SO_SNDLOWAT: return ("SO_SNDLOWAT"); 1774 case SO_RCVLOWAT: return ("SO_RCVLOWAT"); 1775 case SO_SNDTIMEO: return ("SO_SNDTIMEO"); 1776 case SO_RCVTIMEO: return ("SO_RCVTIMEO"); 1777 case SO_ERROR: return ("SO_ERROR"); 1778 case SO_TYPE: return ("SO_TYPE"); 1779 case SO_PROTOTYPE: return ("SO_PROTOTYPE"); 1780 case SO_ALLZONES: return ("SO_ALLZONES"); 1781 case SO_EXCLBIND: return ("SO_EXCLBIND"); 1782 case SO_DOMAIN: return ("SO_DOMAIN"); 1783 1784 default: (void) snprintf(pri->code_buf, CBSIZE, 1785 "0x%lx", val); 1786 return (pri->code_buf); 1787 } 1788 } else { 1789 char *s = pri->code_buf; 1790 size_t used = 1; 1791 long val2; 1792 1793 *s = '\0'; 1794 val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE| 1795 SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER| 1796 SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED); 1797 if (val2) 1798 used = snprintf(s, CBSIZE, "|0x%lx", val2); 1799 if (val & SO_DEBUG) 1800 used = strlcat(s, "|SO_DEBUG", CBSIZE); 1801 if (val & SO_ACCEPTCONN) 1802 used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE); 1803 if (val & SO_REUSEADDR) 1804 used = strlcat(s, "|SO_REUSEADDR", CBSIZE); 1805 if (val & SO_KEEPALIVE) 1806 used = strlcat(s, "|SO_KEEPALIVE", CBSIZE); 1807 if (val & SO_DONTROUTE) 1808 used = strlcat(s, "|SO_DONTROUTE", CBSIZE); 1809 if (val & SO_BROADCAST) 1810 used = strlcat(s, "|SO_BROADCAST", CBSIZE); 1811 if (val & SO_USELOOPBACK) 1812 used = strlcat(s, "|SO_USELOOPBACK", CBSIZE); 1813 if (val & SO_LINGER) 1814 used = strlcat(s, "|SO_LINGER", CBSIZE); 1815 if (val & SO_OOBINLINE) 1816 used = strlcat(s, "|SO_OOBINLINE", CBSIZE); 1817 if (val & SO_DGRAM_ERRIND) 1818 used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE); 1819 if (val & SO_RECVUCRED) 1820 used = strlcat(s, "|SO_RECVUCRED", CBSIZE); 1821 if (used >= CBSIZE || val == 0) 1822 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val); 1823 return ((const char *)(s + 1)); 1824 } 1825 #undef CBSIZE 1826 } 1827 1828 1829 const char * 1830 tcp_optname(private_t *pri, long val) 1831 { 1832 switch (val) { 1833 case TCP_NODELAY: return ("TCP_NODELAY"); 1834 case TCP_MAXSEG: return ("TCP_MAXSEG"); 1835 case TCP_KEEPALIVE: return ("TCP_KEEPALIVE"); 1836 case TCP_NOTIFY_THRESHOLD: return ("TCP_NOTIFY_THRESHOLD"); 1837 case TCP_ABORT_THRESHOLD: return ("TCP_ABORT_THRESHOLD"); 1838 case TCP_CONN_NOTIFY_THRESHOLD: return ("TCP_CONN_NOTIFY_THRESHOLD"); 1839 case TCP_CONN_ABORT_THRESHOLD: return ("TCP_CONN_ABORT_THRESHOLD"); 1840 case TCP_RECVDSTADDR: return ("TCP_RECVDSTADDR"); 1841 case TCP_ANONPRIVBIND: return ("TCP_ANONPRIVBIND"); 1842 case TCP_EXCLBIND: return ("TCP_EXCLBIND"); 1843 case TCP_INIT_CWND: return ("TCP_INIT_CWND"); 1844 case TCP_KEEPALIVE_THRESHOLD: return ("TCP_KEEPALIVE_THRESHOLD"); 1845 case TCP_KEEPALIVE_ABORT_THRESHOLD: 1846 return ("TCP_KEEPALIVE_ABORT_THRESHOLD"); 1847 case TCP_CORK: return ("TCP_CORK"); 1848 1849 default: (void) snprintf(pri->code_buf, 1850 sizeof (pri->code_buf), 1851 "0x%lx", val); 1852 return (pri->code_buf); 1853 } 1854 } 1855 1856 1857 const char * 1858 sctp_optname(private_t *pri, long val) 1859 { 1860 switch (val) { 1861 case SCTP_RTOINFO: return ("SCTP_RTOINFO"); 1862 case SCTP_ASSOCINFO: return ("SCTP_ASSOCINFO"); 1863 case SCTP_INITMSG: return ("SCTP_INITMSG"); 1864 case SCTP_NODELAY: return ("SCTP_NODELAY"); 1865 case SCTP_AUTOCLOSE: return ("SCTP_AUTOCLOSE"); 1866 case SCTP_SET_PEER_PRIMARY_ADDR: 1867 return ("SCTP_SET_PEER_PRIMARY_ADDR"); 1868 case SCTP_PRIMARY_ADDR: return ("SCTP_PRIMARY_ADDR"); 1869 case SCTP_ADAPTATION_LAYER: return ("SCTP_ADAPTATION_LAYER"); 1870 case SCTP_DISABLE_FRAGMENTS: return ("SCTP_DISABLE_FRAGMENTS"); 1871 case SCTP_PEER_ADDR_PARAMS: return ("SCTP_PEER_ADDR_PARAMS"); 1872 case SCTP_DEFAULT_SEND_PARAM: return ("SCTP_DEFAULT_SEND_PARAM"); 1873 case SCTP_EVENTS: return ("SCTP_EVENTS"); 1874 case SCTP_I_WANT_MAPPED_V4_ADDR: 1875 return ("SCTP_I_WANT_MAPPED_V4_ADDR"); 1876 case SCTP_MAXSEG: return ("SCTP_MAXSEG"); 1877 case SCTP_STATUS: return ("SCTP_STATUS"); 1878 case SCTP_GET_PEER_ADDR_INFO: return ("SCTP_GET_PEER_ADDR_INFO"); 1879 1880 case SCTP_ADD_ADDR: return ("SCTP_ADD_ADDR"); 1881 case SCTP_REM_ADDR: return ("SCTP_REM_ADDR"); 1882 1883 default: (void) snprintf(pri->code_buf, 1884 sizeof (pri->code_buf), 1885 "0x%lx", val); 1886 return (pri->code_buf); 1887 } 1888 } 1889 1890 1891 const char * 1892 udp_optname(private_t *pri, long val) 1893 { 1894 switch (val) { 1895 case UDP_CHECKSUM: return ("UDP_CHECKSUM"); 1896 case UDP_ANONPRIVBIND: return ("UDP_ANONPRIVBIND"); 1897 case UDP_EXCLBIND: return ("UDP_EXCLBIND"); 1898 case UDP_RCVHDR: return ("UDP_RCVHDR"); 1899 case UDP_NAT_T_ENDPOINT: return ("UDP_NAT_T_ENDPOINT"); 1900 1901 default: (void) snprintf(pri->code_buf, 1902 sizeof (pri->code_buf), "0x%lx", 1903 val); 1904 return (pri->code_buf); 1905 } 1906 } 1907 1908 1909 /* 1910 * Print setsockopt()/getsockopt() 3rd argument. 1911 */ 1912 /*ARGSUSED*/ 1913 void 1914 prt_son(private_t *pri, int raw, long val) 1915 { 1916 /* cheating -- look at the level */ 1917 switch (pri->sys_args[1]) { 1918 case SOL_SOCKET: outstring(pri, sol_optname(pri, val)); 1919 break; 1920 case IPPROTO_TCP: outstring(pri, tcp_optname(pri, val)); 1921 break; 1922 case IPPROTO_UDP: outstring(pri, udp_optname(pri, val)); 1923 break; 1924 case IPPROTO_SCTP: outstring(pri, sctp_optname(pri, val)); 1925 break; 1926 default: prt_dec(pri, 0, val); 1927 break; 1928 } 1929 } 1930 1931 1932 /* 1933 * Print utrap type 1934 */ 1935 /*ARGSUSED*/ 1936 void 1937 prt_utt(private_t *pri, int raw, long val) 1938 { 1939 const char *s = NULL; 1940 1941 #ifdef __sparc 1942 if (!raw) { 1943 switch (val) { 1944 case UT_INSTRUCTION_DISABLED: 1945 s = "UT_INSTRUCTION_DISABLED"; break; 1946 case UT_INSTRUCTION_ERROR: 1947 s = "UT_INSTRUCTION_ERROR"; break; 1948 case UT_INSTRUCTION_PROTECTION: 1949 s = "UT_INSTRUCTION_PROTECTION"; break; 1950 case UT_ILLTRAP_INSTRUCTION: 1951 s = "UT_ILLTRAP_INSTRUCTION"; break; 1952 case UT_ILLEGAL_INSTRUCTION: 1953 s = "UT_ILLEGAL_INSTRUCTION"; break; 1954 case UT_PRIVILEGED_OPCODE: 1955 s = "UT_PRIVILEGED_OPCODE"; break; 1956 case UT_FP_DISABLED: 1957 s = "UT_FP_DISABLED"; break; 1958 case UT_FP_EXCEPTION_IEEE_754: 1959 s = "UT_FP_EXCEPTION_IEEE_754"; break; 1960 case UT_FP_EXCEPTION_OTHER: 1961 s = "UT_FP_EXCEPTION_OTHER"; break; 1962 case UT_TAG_OVERFLOW: 1963 s = "UT_TAG_OVERFLOW"; break; 1964 case UT_DIVISION_BY_ZERO: 1965 s = "UT_DIVISION_BY_ZERO"; break; 1966 case UT_DATA_EXCEPTION: 1967 s = "UT_DATA_EXCEPTION"; break; 1968 case UT_DATA_ERROR: 1969 s = "UT_DATA_ERROR"; break; 1970 case UT_DATA_PROTECTION: 1971 s = "UT_DATA_PROTECTION"; break; 1972 case UT_MEM_ADDRESS_NOT_ALIGNED: 1973 s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break; 1974 case UT_PRIVILEGED_ACTION: 1975 s = "UT_PRIVILEGED_ACTION"; break; 1976 case UT_ASYNC_DATA_ERROR: 1977 s = "UT_ASYNC_DATA_ERROR"; break; 1978 case UT_TRAP_INSTRUCTION_16: 1979 s = "UT_TRAP_INSTRUCTION_16"; break; 1980 case UT_TRAP_INSTRUCTION_17: 1981 s = "UT_TRAP_INSTRUCTION_17"; break; 1982 case UT_TRAP_INSTRUCTION_18: 1983 s = "UT_TRAP_INSTRUCTION_18"; break; 1984 case UT_TRAP_INSTRUCTION_19: 1985 s = "UT_TRAP_INSTRUCTION_19"; break; 1986 case UT_TRAP_INSTRUCTION_20: 1987 s = "UT_TRAP_INSTRUCTION_20"; break; 1988 case UT_TRAP_INSTRUCTION_21: 1989 s = "UT_TRAP_INSTRUCTION_21"; break; 1990 case UT_TRAP_INSTRUCTION_22: 1991 s = "UT_TRAP_INSTRUCTION_22"; break; 1992 case UT_TRAP_INSTRUCTION_23: 1993 s = "UT_TRAP_INSTRUCTION_23"; break; 1994 case UT_TRAP_INSTRUCTION_24: 1995 s = "UT_TRAP_INSTRUCTION_24"; break; 1996 case UT_TRAP_INSTRUCTION_25: 1997 s = "UT_TRAP_INSTRUCTION_25"; break; 1998 case UT_TRAP_INSTRUCTION_26: 1999 s = "UT_TRAP_INSTRUCTION_26"; break; 2000 case UT_TRAP_INSTRUCTION_27: 2001 s = "UT_TRAP_INSTRUCTION_27"; break; 2002 case UT_TRAP_INSTRUCTION_28: 2003 s = "UT_TRAP_INSTRUCTION_28"; break; 2004 case UT_TRAP_INSTRUCTION_29: 2005 s = "UT_TRAP_INSTRUCTION_29"; break; 2006 case UT_TRAP_INSTRUCTION_30: 2007 s = "UT_TRAP_INSTRUCTION_30"; break; 2008 case UT_TRAP_INSTRUCTION_31: 2009 s = "UT_TRAP_INSTRUCTION_31"; break; 2010 } 2011 } 2012 #endif /* __sparc */ 2013 2014 if (s == NULL) 2015 prt_dec(pri, 0, val); 2016 else 2017 outstring(pri, s); 2018 } 2019 2020 2021 /* 2022 * Print utrap handler 2023 */ 2024 void 2025 prt_uth(private_t *pri, int raw, long val) 2026 { 2027 const char *s = NULL; 2028 2029 if (!raw) { 2030 switch (val) { 2031 case (long)UTH_NOCHANGE: s = "UTH_NOCHANGE"; break; 2032 } 2033 } 2034 2035 if (s == NULL) 2036 prt_hex(pri, 0, val); 2037 else 2038 outstring(pri, s); 2039 } 2040 2041 const char * 2042 access_flags(private_t *pri, long arg) 2043 { 2044 #define E_OK 010 2045 char *str = pri->code_buf; 2046 2047 if (arg & ~(R_OK|W_OK|X_OK|E_OK)) 2048 return (NULL); 2049 2050 /* NB: F_OK == 0 */ 2051 if (arg == F_OK) 2052 return ("F_OK"); 2053 if (arg == E_OK) 2054 return ("F_OK|E_OK"); 2055 2056 *str = '\0'; 2057 if (arg & R_OK) 2058 (void) strlcat(str, "|R_OK", sizeof (pri->code_buf)); 2059 if (arg & W_OK) 2060 (void) strlcat(str, "|W_OK", sizeof (pri->code_buf)); 2061 if (arg & X_OK) 2062 (void) strlcat(str, "|X_OK", sizeof (pri->code_buf)); 2063 if (arg & E_OK) 2064 (void) strlcat(str, "|E_OK", sizeof (pri->code_buf)); 2065 return ((const char *)(str + 1)); 2066 #undef E_OK 2067 } 2068 2069 /* 2070 * Print access() flags. 2071 */ 2072 void 2073 prt_acc(private_t *pri, int raw, long val) 2074 { 2075 const char *s = raw? NULL : access_flags(pri, val); 2076 2077 if (s == NULL) 2078 prt_dex(pri, 0, val); 2079 else 2080 outstring(pri, s); 2081 } 2082 2083 /* 2084 * Print shutdown() "how" (2nd) argument 2085 */ 2086 void 2087 prt_sht(private_t *pri, int raw, long val) 2088 { 2089 if (raw) { 2090 prt_dex(pri, 0, val); 2091 return; 2092 } 2093 switch (val) { 2094 case SHUT_RD: outstring(pri, "SHUT_RD"); break; 2095 case SHUT_WR: outstring(pri, "SHUT_WR"); break; 2096 case SHUT_RDWR: outstring(pri, "SHUT_RDWR"); break; 2097 default: prt_dec(pri, 0, val); break; 2098 } 2099 } 2100 2101 /* 2102 * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg) 2103 */ 2104 static struct fcntl_flags { 2105 long val; 2106 const char *name; 2107 } fcntl_flags[] = { 2108 #define FC_FL(flag) { (long)flag, "|" # flag } 2109 FC_FL(FREVOKED), 2110 FC_FL(FREAD), 2111 FC_FL(FWRITE), 2112 FC_FL(FNDELAY), 2113 FC_FL(FAPPEND), 2114 FC_FL(FSYNC), 2115 FC_FL(FDSYNC), 2116 FC_FL(FRSYNC), 2117 FC_FL(FOFFMAX), 2118 FC_FL(FNONBLOCK), 2119 FC_FL(FCREAT), 2120 FC_FL(FTRUNC), 2121 FC_FL(FEXCL), 2122 FC_FL(FNOCTTY), 2123 FC_FL(FXATTR), 2124 FC_FL(FASYNC), 2125 FC_FL(FNODSYNC) 2126 #undef FC_FL 2127 }; 2128 2129 void 2130 prt_ffg(private_t *pri, int raw, long val) 2131 { 2132 #define CBSIZE sizeof (pri->code_buf) 2133 char *s = pri->code_buf; 2134 size_t used = 1; 2135 struct fcntl_flags *fp; 2136 2137 if (raw) { 2138 (void) snprintf(s, CBSIZE, "0x%lx", val); 2139 outstring(pri, s); 2140 return; 2141 } 2142 if (val == 0) { 2143 outstring(pri, "(no flags)"); 2144 return; 2145 } 2146 2147 *s = '\0'; 2148 for (fp = fcntl_flags; 2149 fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) { 2150 if (val & fp->val) { 2151 used = strlcat(s, fp->name, CBSIZE); 2152 val &= ~fp->val; 2153 } 2154 } 2155 2156 if (val != 0 && used <= CBSIZE) 2157 used += snprintf(s + used, CBSIZE - used, "|0x%lx", val); 2158 2159 if (used >= CBSIZE) 2160 (void) snprintf(s + 1, CBSIZE-1, "0x%lx", val); 2161 outstring(pri, s + 1); 2162 #undef CBSIZE 2163 } 2164 2165 void 2166 prt_prs(private_t *pri, int raw, long val) 2167 { 2168 static size_t setsize; 2169 priv_set_t *set = priv_allocset(); 2170 2171 if (setsize == 0) { 2172 const priv_impl_info_t *info = getprivimplinfo(); 2173 if (info != NULL) 2174 setsize = info->priv_setsize * sizeof (priv_chunk_t); 2175 } 2176 2177 if (setsize != 0 && !raw && set != NULL && 2178 Pread(Proc, set, setsize, val) == setsize) { 2179 int i; 2180 2181 outstring(pri, "{"); 2182 for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) { 2183 char buf[9]; /* 8 hex digits + '\0' */ 2184 (void) snprintf(buf, sizeof (buf), "%08x", 2185 ((priv_chunk_t *)set)[i]); 2186 outstring(pri, buf); 2187 } 2188 2189 outstring(pri, "}"); 2190 } else { 2191 prt_hex(pri, 0, val); 2192 } 2193 2194 if (set != NULL) 2195 priv_freeset(set); 2196 } 2197 2198 /* 2199 * Print privilege set operation. 2200 */ 2201 void 2202 prt_pro(private_t *pri, int raw, long val) 2203 { 2204 const char *s = NULL; 2205 2206 if (!raw) { 2207 switch ((priv_op_t)val) { 2208 case PRIV_ON: s = "PRIV_ON"; break; 2209 case PRIV_OFF: s = "PRIV_OFF"; break; 2210 case PRIV_SET: s = "PRIV_SET"; break; 2211 } 2212 } 2213 2214 if (s == NULL) 2215 prt_dec(pri, 0, val); 2216 else 2217 outstring(pri, s); 2218 } 2219 2220 /* 2221 * Print privilege set name 2222 */ 2223 void 2224 prt_prn(private_t *pri, int raw, long val) 2225 { 2226 const char *s = NULL; 2227 2228 if (!raw) 2229 s = priv_getsetbynum((int)val); 2230 2231 if (s == NULL) 2232 prt_dec(pri, 0, val); 2233 else { 2234 char *dup = strdup(s); 2235 char *q; 2236 2237 /* Do the best we can in this case */ 2238 if (dup == NULL) { 2239 outstring(pri, s); 2240 return; 2241 } 2242 2243 outstring(pri, "PRIV_"); 2244 2245 q = dup; 2246 2247 while (*q != '\0') { 2248 *q = toupper(*q); 2249 q++; 2250 } 2251 outstring(pri, dup); 2252 free(dup); 2253 } 2254 } 2255 2256 /* 2257 * Print process flag names. 2258 */ 2259 void 2260 prt_pfl(private_t *pri, int raw, long val) 2261 { 2262 const char *s = NULL; 2263 2264 if (!raw) { 2265 switch ((int)val) { 2266 case PRIV_DEBUG: s = "PRIV_DEBUG"; break; 2267 case PRIV_AWARE: s = "PRIV_AWARE"; break; 2268 } 2269 } 2270 2271 if (s == NULL) 2272 prt_dec(pri, 0, val); 2273 else 2274 outstring(pri, s); 2275 } 2276 2277 /* 2278 * Print lgrp_affinity_{get,set}() arguments. 2279 */ 2280 /*ARGSUSED*/ 2281 void 2282 prt_laf(private_t *pri, int raw, long val) 2283 { 2284 lgrp_affinity_args_t laff; 2285 2286 if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) != 2287 sizeof (lgrp_affinity_args_t)) { 2288 prt_hex(pri, 0, val); 2289 return; 2290 } 2291 /* 2292 * arrange the arguments in the order that user calls with 2293 */ 2294 prt_dec(pri, 0, laff.idtype); 2295 outstring(pri, ", "); 2296 prt_dec(pri, 0, laff.id); 2297 outstring(pri, ", "); 2298 prt_dec(pri, 0, laff.lgrp); 2299 outstring(pri, ", "); 2300 if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET) 2301 prt_dec(pri, 0, laff.aff); 2302 } 2303 2304 /* 2305 * Print a key_t as IPC_PRIVATE if it is 0. 2306 */ 2307 void 2308 prt_key(private_t *pri, int raw, long val) 2309 { 2310 if (!raw && val == 0) 2311 outstring(pri, "IPC_PRIVATE"); 2312 else 2313 prt_dec(pri, 0, val); 2314 } 2315 2316 2317 /* 2318 * Print zone_getattr() attribute types. 2319 */ 2320 void 2321 prt_zga(private_t *pri, int raw, long val) 2322 { 2323 const char *s = NULL; 2324 2325 if (!raw) { 2326 switch ((int)val) { 2327 case ZONE_ATTR_NAME: s = "ZONE_ATTR_NAME"; break; 2328 case ZONE_ATTR_ROOT: s = "ZONE_ATTR_ROOT"; break; 2329 case ZONE_ATTR_STATUS: s = "ZONE_ATTR_STATUS"; break; 2330 case ZONE_ATTR_PRIVSET: s = "ZONE_ATTR_PRIVSET"; break; 2331 case ZONE_ATTR_UNIQID: s = "ZONE_ATTR_UNIQID"; break; 2332 case ZONE_ATTR_POOLID: s = "ZONE_ATTR_POOLID"; break; 2333 case ZONE_ATTR_INITPID: s = "ZONE_ATTR_INITPID"; break; 2334 case ZONE_ATTR_SLBL: s = "ZONE_ATTR_SLBL"; break; 2335 case ZONE_ATTR_INITNAME: s = "ZONE_ATTR_INITNAME"; break; 2336 case ZONE_ATTR_BOOTARGS: s = "ZONE_ATTR_BOOTARGS"; break; 2337 case ZONE_ATTR_BRAND: s = "ZONE_ATTR_BRAND"; break; 2338 case ZONE_ATTR_FLAGS: s = "ZONE_ATTR_FLAGS"; break; 2339 case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break; 2340 } 2341 } 2342 2343 if (s == NULL) 2344 prt_dec(pri, 0, val); 2345 else 2346 outstring(pri, s); 2347 } 2348 2349 /* 2350 * Print a file descriptor as AT_FDCWD if necessary 2351 */ 2352 void 2353 prt_atc(private_t *pri, int raw, long val) 2354 { 2355 if (!raw && val == AT_FDCWD) 2356 outstring(pri, "AT_FDCWD"); 2357 else 2358 prt_dec(pri, 0, val); 2359 } 2360 2361 /* 2362 * Print Trusted Networking database operation codes (labelsys; tn*) 2363 */ 2364 static void 2365 prt_tnd(private_t *pri, int raw, long val) 2366 { 2367 const char *s = NULL; 2368 2369 if (!raw) { 2370 switch ((tsol_dbops_t)val) { 2371 case TNDB_NOOP: s = "TNDB_NOOP"; break; 2372 case TNDB_LOAD: s = "TNDB_LOAD"; break; 2373 case TNDB_DELETE: s = "TNDB_DELETE"; break; 2374 case TNDB_FLUSH: s = "TNDB_FLUSH"; break; 2375 case TNDB_GET: s = "TNDB_GET"; break; 2376 } 2377 } 2378 2379 if (s == NULL) 2380 prt_dec(pri, 0, val); 2381 else 2382 outstring(pri, s); 2383 } 2384 2385 /* 2386 * Print LIO_XX flags 2387 */ 2388 void 2389 prt_lio(private_t *pri, int raw, long val) 2390 { 2391 if (raw) 2392 prt_dec(pri, 0, val); 2393 else if (val == LIO_WAIT) 2394 outstring(pri, "LIO_WAIT"); 2395 else if (val == LIO_NOWAIT) 2396 outstring(pri, "LIO_NOWAIT"); 2397 else 2398 prt_dec(pri, 0, val); 2399 } 2400 2401 const char * 2402 door_flags(private_t *pri, long val) 2403 { 2404 door_attr_t attr = (door_attr_t)val; 2405 char *str = pri->code_buf; 2406 2407 *str = '\0'; 2408 #define PROCESS_FLAG(flg) \ 2409 if (attr & flg) { \ 2410 (void) strlcat(str, "|" #flg, sizeof (pri->code_buf)); \ 2411 attr &= ~flg; \ 2412 } 2413 2414 PROCESS_FLAG(DOOR_UNREF); 2415 PROCESS_FLAG(DOOR_UNREF_MULTI); 2416 PROCESS_FLAG(DOOR_PRIVATE); 2417 PROCESS_FLAG(DOOR_REFUSE_DESC); 2418 PROCESS_FLAG(DOOR_NO_CANCEL); 2419 PROCESS_FLAG(DOOR_LOCAL); 2420 PROCESS_FLAG(DOOR_REVOKED); 2421 PROCESS_FLAG(DOOR_IS_UNREF); 2422 #undef PROCESS_FLAG 2423 2424 if (attr != 0 || *str == '\0') { 2425 size_t len = strlen(str); 2426 (void) snprintf(str + len, sizeof (pri->code_buf) - len, 2427 "|0x%X", attr); 2428 } 2429 2430 return (str + 1); 2431 } 2432 2433 /* 2434 * Print door_create() flags 2435 */ 2436 void 2437 prt_dfl(private_t *pri, int raw, long val) 2438 { 2439 if (raw) 2440 prt_hex(pri, 0, val); 2441 else 2442 outstring(pri, door_flags(pri, val)); 2443 } 2444 2445 /* 2446 * Print door_*param() param argument 2447 */ 2448 void 2449 prt_dpm(private_t *pri, int raw, long val) 2450 { 2451 if (raw) 2452 prt_hex(pri, 0, val); 2453 else if (val == DOOR_PARAM_DESC_MAX) 2454 outstring(pri, "DOOR_PARAM_DESC_MAX"); 2455 else if (val == DOOR_PARAM_DATA_MIN) 2456 outstring(pri, "DOOR_PARAM_DATA_MIN"); 2457 else if (val == DOOR_PARAM_DATA_MAX) 2458 outstring(pri, "DOOR_PARAM_DATA_MAX"); 2459 else 2460 prt_hex(pri, 0, val); 2461 } 2462 2463 /* 2464 * Print rctlsys subcodes 2465 */ 2466 void 2467 prt_rsc(private_t *pri, int raw, long val) /* print utssys code */ 2468 { 2469 const char *s = raw? NULL : rctlsyscode(val); 2470 2471 if (s == NULL) 2472 prt_dec(pri, 0, val); 2473 else 2474 outstring(pri, s); 2475 } 2476 2477 /* 2478 * Print getrctl flags 2479 */ 2480 void 2481 prt_rgf(private_t *pri, int raw, long val) 2482 { 2483 long action = val & (~RCTLSYS_ACTION_MASK); 2484 2485 if (raw) 2486 prt_hex(pri, 0, val); 2487 else if (action == RCTL_FIRST) 2488 outstring(pri, "RCTL_FIRST"); 2489 else if (action == RCTL_NEXT) 2490 outstring(pri, "RCTL_NEXT"); 2491 else if (action == RCTL_USAGE) 2492 outstring(pri, "RCTL_USAGE"); 2493 else 2494 prt_hex(pri, 0, val); 2495 } 2496 2497 /* 2498 * Print setrctl flags 2499 */ 2500 void 2501 prt_rsf(private_t *pri, int raw, long val) 2502 { 2503 long action = val & (~RCTLSYS_ACTION_MASK); 2504 long pval = val & RCTL_LOCAL_ACTION_MASK; 2505 char *s = pri->code_buf; 2506 2507 if (raw) { 2508 prt_hex(pri, 0, val); 2509 return; 2510 } else if (action == RCTL_INSERT) 2511 (void) strcpy(s, "RCTL_INSERT"); 2512 else if (action == RCTL_DELETE) 2513 (void) strcpy(s, "RCTL_DELETE"); 2514 else if (action == RCTL_REPLACE) 2515 (void) strcpy(s, "RCTL_REPLACE"); 2516 else { 2517 prt_hex(pri, 0, val); 2518 return; 2519 } 2520 2521 if (pval & RCTL_USE_RECIPIENT_PID) { 2522 pval ^= RCTL_USE_RECIPIENT_PID; 2523 (void) strlcat(s, "|RCTL_USE_RECIPIENT_PID", 2524 sizeof (pri->code_buf)); 2525 } 2526 2527 if ((pval & RCTLSYS_ACTION_MASK) != 0) 2528 prt_hex(pri, 0, val); 2529 else if (*s != '\0') 2530 outstring(pri, s); 2531 else 2532 prt_hex(pri, 0, val); 2533 } 2534 2535 /* 2536 * Print rctlctl flags 2537 */ 2538 void 2539 prt_rcf(private_t *pri, int raw, long val) 2540 { 2541 long action = val & (~RCTLSYS_ACTION_MASK); 2542 2543 if (raw) 2544 prt_hex(pri, 0, val); 2545 else if (action == RCTLCTL_GET) 2546 outstring(pri, "RCTLCTL_GET"); 2547 else if (action == RCTLCTL_SET) 2548 outstring(pri, "RCTLCTL_SET"); 2549 else 2550 prt_hex(pri, 0, val); 2551 } 2552 2553 /* 2554 * Print setprojrctl flags 2555 */ 2556 void 2557 prt_spf(private_t *pri, int raw, long val) 2558 { 2559 long action = val & TASK_PROJ_MASK; 2560 2561 if (!raw && (action == TASK_PROJ_PURGE)) 2562 outstring(pri, "TASK_PROJ_PURGE"); 2563 else 2564 prt_hex(pri, 0, val); 2565 } 2566 2567 /* 2568 * Print forkx() flags 2569 */ 2570 void 2571 prt_fxf(private_t *pri, int raw, long val) 2572 { 2573 char *str; 2574 2575 if (val == 0) 2576 outstring(pri, "0"); 2577 else if (raw || (val & ~(FORK_NOSIGCHLD | FORK_WAITPID))) 2578 prt_hhx(pri, 0, val); 2579 else { 2580 str = pri->code_buf; 2581 *str = '\0'; 2582 if (val & FORK_NOSIGCHLD) 2583 (void) strlcat(str, "|FORK_NOSIGCHLD", 2584 sizeof (pri->code_buf)); 2585 if (val & FORK_WAITPID) 2586 (void) strlcat(str, "|FORK_WAITPID", 2587 sizeof (pri->code_buf)); 2588 outstring(pri, str + 1); 2589 } 2590 } 2591 2592 /* 2593 * Array of pointers to print functions, one for each format. 2594 */ 2595 void (* const Print[])() = { 2596 prt_nov, /* NOV -- no value */ 2597 prt_dec, /* DEC -- print value in decimal */ 2598 prt_oct, /* OCT -- print value in octal */ 2599 prt_hex, /* HEX -- print value in hexadecimal */ 2600 prt_dex, /* DEX -- print value in hexadecimal if big enough */ 2601 prt_stg, /* STG -- print value as string */ 2602 prt_ioc, /* IOC -- print ioctl code */ 2603 prt_fcn, /* FCN -- print fcntl code */ 2604 prt_s86, /* S86 -- print sysi86 code */ 2605 prt_uts, /* UTS -- print utssys code */ 2606 prt_opn, /* OPN -- print open code */ 2607 prt_sig, /* SIG -- print signal name plus flags */ 2608 prt_act, /* ACT -- print signal action value */ 2609 prt_msc, /* MSC -- print msgsys command */ 2610 prt_msf, /* MSF -- print msgsys flags */ 2611 prt_smc, /* SMC -- print semsys command */ 2612 prt_sef, /* SEF -- print semsys flags */ 2613 prt_shc, /* SHC -- print shmsys command */ 2614 prt_shf, /* SHF -- print shmsys flags */ 2615 prt_plk, /* PLK -- print plock code */ 2616 prt_sfs, /* SFS -- print sysfs code */ 2617 prt_rst, /* RST -- print string returned by syscall */ 2618 prt_smf, /* SMF -- print streams message flags */ 2619 prt_ioa, /* IOA -- print ioctl argument */ 2620 prt_six, /* SIX -- print signal, masked with SIGNO_MASK */ 2621 prt_mtf, /* MTF -- print mount flags */ 2622 prt_mft, /* MFT -- print mount file system type */ 2623 prt_iob, /* IOB -- print contents of I/O buffer */ 2624 prt_hhx, /* HHX -- print value in hexadecimal (half size) */ 2625 prt_wop, /* WOP -- print waitsys() options */ 2626 prt_spm, /* SPM -- print sigprocmask argument */ 2627 prt_rlk, /* RLK -- print readlink buffer */ 2628 prt_mpr, /* MPR -- print mmap()/mprotect() flags */ 2629 prt_mty, /* MTY -- print mmap() mapping type flags */ 2630 prt_mcf, /* MCF -- print memcntl() function */ 2631 prt_mc4, /* MC4 -- print memcntl() (fourth) argument */ 2632 prt_mc5, /* MC5 -- print memcntl() (fifth) argument */ 2633 prt_mad, /* MAD -- print madvise() argument */ 2634 prt_ulm, /* ULM -- print ulimit() argument */ 2635 prt_rlm, /* RLM -- print get/setrlimit() argument */ 2636 prt_cnf, /* CNF -- print sysconfig() argument */ 2637 prt_inf, /* INF -- print sysinfo() argument */ 2638 prt_ptc, /* PTC -- print pathconf/fpathconf() argument */ 2639 prt_fui, /* FUI -- print fusers() input argument */ 2640 prt_idt, /* IDT -- print idtype_t, waitid() argument */ 2641 prt_lwf, /* LWF -- print lwp_create() flags */ 2642 prt_itm, /* ITM -- print [get|set]itimer() arg */ 2643 prt_llo, /* LLO -- print long long offset arg */ 2644 prt_mod, /* MOD -- print modctl() subcode */ 2645 prt_whn, /* WHN -- print lseek() whence arguiment */ 2646 prt_acl, /* ACL -- print acl() code */ 2647 prt_aio, /* AIO -- print kaio() code */ 2648 prt_aud, /* AUD -- print auditsys() code */ 2649 prt_uns, /* DEC -- print value in unsigned decimal */ 2650 prt_clc, /* CLC -- print cladm command argument */ 2651 prt_clf, /* CLF -- print cladm flag argument */ 2652 prt_cor, /* COR -- print corectl() subcode */ 2653 prt_cco, /* CCO -- print corectl() options */ 2654 prt_ccc, /* CCC -- print corectl() content */ 2655 prt_rcc, /* RCC -- print corectl() returned content */ 2656 prt_cpc, /* CPC -- print cpc() subcode */ 2657 prt_sqc, /* SQC -- print sigqueue() si_code argument */ 2658 prt_pc4, /* PC4 -- print priocntlsys() (fourth) argument */ 2659 prt_pc5, /* PC5 -- print priocntlsys() (key, value) pairs */ 2660 prt_pst, /* PST -- print processor set id */ 2661 prt_mif, /* MIF -- print meminfo() arguments */ 2662 prt_pfm, /* PFM -- print so_socket() proto-family (1st) arg */ 2663 prt_skt, /* SKT -- print so_socket() socket-type (2nd) arg */ 2664 prt_skp, /* SKP -- print so_socket() protocol (3rd) arg */ 2665 prt_skv, /* SKV -- print socket version arg */ 2666 prt_sol, /* SOL -- print [sg]etsockopt() level (2nd) arg */ 2667 prt_son, /* SON -- print [sg]etsockopt() opt-name (3rd) arg */ 2668 prt_utt, /* UTT -- print utrap type */ 2669 prt_uth, /* UTH -- print utrap handler */ 2670 prt_acc, /* ACC -- print access() flags */ 2671 prt_sht, /* SHT -- print shutdown() how (2nd) argument */ 2672 prt_ffg, /* FFG -- print fcntl() flags (3rd) argument */ 2673 prt_prs, /* PRS -- print privilege set */ 2674 prt_pro, /* PRO -- print privilege set operation */ 2675 prt_prn, /* PRN -- print privilege set name */ 2676 prt_pfl, /* PFL -- print privilege/process flag name */ 2677 prt_laf, /* LAF -- print lgrp_affinity arguments */ 2678 prt_key, /* KEY -- print key_t 0 as IPC_PRIVATE */ 2679 prt_zga, /* ZGA -- print zone_getattr attribute types */ 2680 prt_atc, /* ATC -- print AT_FDCWD or file descriptor */ 2681 prt_lio, /* LIO -- print LIO_XX flags */ 2682 prt_dfl, /* DFL -- print door_create() flags */ 2683 prt_dpm, /* DPM -- print DOOR_PARAM_XX flags */ 2684 prt_tnd, /* TND -- print trusted network data base opcode */ 2685 prt_rsc, /* RSC -- print rctlsys() subcodes */ 2686 prt_rgf, /* RGF -- print getrctl() flags */ 2687 prt_rsf, /* RSF -- print setrctl() flags */ 2688 prt_rcf, /* RCF -- print rctlsys_ctl() flags */ 2689 prt_fxf, /* FXF -- print forkx() flags */ 2690 prt_spf, /* SPF -- print rctlsys_projset() flags */ 2691 prt_un1, /* UN1 -- as prt_uns except for -1 */ 2692 prt_dec, /* HID -- hidden argument, make this the last one */ 2693 }; 2694