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