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