xref: /titanic_52/usr/src/cmd/truss/print.c (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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 MODCLEANUP:	s = "MODCLEANUP"; break;
1097 		case MODLOADMINORPERM:	s = "MODLOADMINORPERM"; break;
1098 		case MODADDMINORPERM:	s = "MODADDMINORPERM"; break;
1099 		case MODREMMINORPERM:	s = "MODREMMINORPERM"; break;
1100 		case MODREMDRVCLEANUP:	s = "MODREMDRVCLEANUP"; break;
1101 		}
1102 	}
1103 
1104 	if (s == NULL)
1105 		prt_dec(pri, 0, val);
1106 	else
1107 		outstring(pri, s);
1108 }
1109 
1110 void
1111 prt_acl(private_t *pri, int raw, long val)	/* print acl() code */
1112 {
1113 	const char *s = NULL;
1114 
1115 	if (!raw) {
1116 		switch (val) {
1117 		case GETACL:		s = "GETACL";		break;
1118 		case SETACL:		s = "SETACL";		break;
1119 		case GETACLCNT:		s = "GETACLCNT";	break;
1120 		case ACE_GETACL:	s = "ACE_GETACL";	break;
1121 		case ACE_SETACL:	s = "ACE_SETACL";	break;
1122 		case ACE_GETACLCNT:	s = "ACE_GETACLCNT";	break;
1123 		}
1124 	}
1125 
1126 	if (s == NULL)
1127 		prt_dec(pri, 0, val);
1128 	else
1129 		outstring(pri, s);
1130 }
1131 
1132 void
1133 prt_aio(private_t *pri, int raw, long val)	/* print kaio() code */
1134 {
1135 	const char *s = NULL;
1136 	char buf[32];
1137 
1138 	if (!raw) {
1139 		switch (val & ~AIO_POLL_BIT) {
1140 		case AIOREAD:		s = "AIOREAD";		break;
1141 		case AIOWRITE:		s = "AIOWRITE";		break;
1142 		case AIOWAIT:		s = "AIOWAIT";		break;
1143 		case AIOCANCEL:		s = "AIOCANCEL";	break;
1144 		case AIONOTIFY:		s = "AIONOTIFY";	break;
1145 		case AIOINIT:		s = "AIOINIT";		break;
1146 		case AIOSTART:		s = "AIOSTART";		break;
1147 		case AIOLIO:		s = "AIOLIO";		break;
1148 		case AIOSUSPEND:	s = "AIOSUSPEND";	break;
1149 		case AIOERROR:		s = "AIOERROR";		break;
1150 		case AIOLIOWAIT:	s = "AIOLIOWAIT";	break;
1151 		case AIOAREAD:		s = "AIOAREAD";		break;
1152 		case AIOAWRITE:		s = "AIOAWRITE";	break;
1153 		/*
1154 		 * We have to hardcode the values for the 64-bit versions of
1155 		 * these calls, because <sys/aio.h> defines them to be identical
1156 		 * when compiled 64-bit.  If our target is 32-bit, we still need
1157 		 * to decode them correctly.
1158 		 */
1159 		case 13:		s = "AIOLIO64";		break;
1160 		case 14:		s = "AIOSUSPEND64";	break;
1161 		case 15:		s = "AUIOERROR64";	break;
1162 		case 16:		s = "AIOLIOWAIT64";	break;
1163 		case 17:		s = "AIOAREAD64";	break;
1164 		case 18:		s = "AIOAWRITE64";	break;
1165 		case 19:		s = "AIOCANCEL64";	break;
1166 
1167 		/*
1168 		 * AIOFSYNC doesn't correspond to a syscall.
1169 		 */
1170 		case AIOWAITN:		s = "AIOWAITN";		break;
1171 		}
1172 		if (s != NULL && (val & AIO_POLL_BIT)) {
1173 			(void) strlcpy(buf, s, sizeof (buf));
1174 			(void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf));
1175 			s = (const char *)buf;
1176 		}
1177 	}
1178 
1179 	if (s == NULL)
1180 		prt_dec(pri, 0, val);
1181 	else
1182 		outstring(pri, s);
1183 }
1184 
1185 void
1186 prt_aud(private_t *pri, int raw, long val)	/* print auditsys() code */
1187 {
1188 	const char *s = NULL;
1189 
1190 	if (!raw) {
1191 		switch (val) {
1192 		case BSM_GETAUID:	s = "BSM_GETAUID";	break;
1193 		case BSM_SETAUID:	s = "BSM_SETAUID";	break;
1194 		case BSM_GETAUDIT:	s = "BSM_GETAUDIT";	break;
1195 		case BSM_SETAUDIT:	s = "BSM_SETAUDIT";	break;
1196 		case BSM_GETUSERAUDIT:	s = "BSM_GETUSERAUDIT";	break;
1197 		case BSM_SETUSERAUDIT:	s = "BSM_SETUSERAUDIT";	break;
1198 		case BSM_AUDIT:		s = "BSM_AUDIT";	break;
1199 		case BSM_AUDITUSER:	s = "BSM_AUDITUSER";	break;
1200 		case BSM_AUDITSVC:	s = "BSM_AUDITSVC";	break;
1201 		case BSM_AUDITON:	s = "BSM_AUDITON";	break;
1202 		case BSM_AUDITCTL:	s = "BSM_AUDITCTL";	break;
1203 		case BSM_GETKERNSTATE:	s = "BSM_GETKERNSTATE";	break;
1204 		case BSM_SETKERNSTATE:	s = "BSM_SETKERNSTATE";	break;
1205 		case BSM_GETPORTAUDIT:	s = "BSM_GETPORTAUDIT";	break;
1206 		case BSM_REVOKE:	s = "BSM_REVOKE";	break;
1207 		case BSM_AUDITSTAT:	s = "BSM_AUDITSTAT";	break;
1208 		case BSM_GETAUDIT_ADDR:	s = "BSM_GETAUDIT_ADDR"; break;
1209 		case BSM_SETAUDIT_ADDR:	s = "BSM_SETAUDIT_ADDR"; break;
1210 		}
1211 	}
1212 
1213 	if (s == NULL)
1214 		prt_dec(pri, 0, val);
1215 	else
1216 		outstring(pri, s);
1217 }
1218 
1219 void
1220 prt_cor(private_t *pri, int raw, long val)	/* print corectl() subcode */
1221 {
1222 	const char *s = NULL;
1223 
1224 	if (!raw) {
1225 		switch (val) {
1226 		case CC_SET_OPTIONS:
1227 			s = "CC_SET_OPTIONS";		break;
1228 		case CC_GET_OPTIONS:
1229 			s = "CC_GET_OPTIONS";		break;
1230 		case CC_SET_GLOBAL_PATH:
1231 			s = "CC_SET_GLOBAL_PATH";	break;
1232 		case CC_GET_GLOBAL_PATH:
1233 			s = "CC_GET_GLOBAL_PATH";	break;
1234 		case CC_SET_PROCESS_PATH:
1235 			s = "CC_SET_PROCESS_PATH";	break;
1236 		case CC_GET_PROCESS_PATH:
1237 			s = "CC_GET_PROCESS_PATH";	break;
1238 		case CC_SET_GLOBAL_CONTENT:
1239 			s = "CC_SET_GLOBAL_CONTENT";	break;
1240 		case CC_GET_GLOBAL_CONTENT:
1241 			s = "CC_GET_GLOBAL_CONTENT";	break;
1242 		case CC_SET_PROCESS_CONTENT:
1243 			s = "CC_SET_PROCESS_CONTENT";	break;
1244 		case CC_GET_PROCESS_CONTENT:
1245 			s = "CC_GET_PROCESS_CONTENT";	break;
1246 		case CC_SET_DEFAULT_PATH:
1247 			s = "CC_SET_DEFAULT_PATH";	break;
1248 		case CC_GET_DEFAULT_PATH:
1249 			s = "CC_GET_DEFAULT_PATH";	break;
1250 		case CC_SET_DEFAULT_CONTENT:
1251 			s = "CC_SET_DEFAULT_CONTENT";	break;
1252 		case CC_GET_DEFAULT_CONTENT:
1253 			s = "CC_GET_DEFAULT_CONTENT";	break;
1254 		}
1255 	}
1256 
1257 	if (s == NULL)
1258 		prt_dec(pri, 0, val);
1259 	else
1260 		outstring(pri, s);
1261 }
1262 
1263 void
1264 prt_cco(private_t *pri, int raw, long val)	/* print corectl() options */
1265 {
1266 	char *s;
1267 
1268 	if (val == 0)
1269 		prt_dec(pri, 0, val);
1270 	else if (raw || (val & ~CC_OPTIONS))
1271 		prt_hhx(pri, 0, val);
1272 	else {
1273 #define	CBSIZE	sizeof (pri->code_buf)
1274 		s = pri->code_buf;
1275 		*s = '\0';
1276 		if (val & CC_GLOBAL_PATH)
1277 			(void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE);
1278 		if (val & CC_PROCESS_PATH)
1279 			(void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE);
1280 		if (val & CC_GLOBAL_SETID)
1281 			(void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE);
1282 		if (val & CC_PROCESS_SETID)
1283 			(void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE);
1284 		if (val & CC_GLOBAL_LOG)
1285 			(void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE);
1286 		if (*s == '\0')
1287 			prt_hhx(pri, 0, val);
1288 		else
1289 			outstring(pri, ++s);
1290 #undef CBSIZE
1291 	}
1292 }
1293 
1294 void
1295 prt_ccc(private_t *pri, int raw, long val)	/* print corectl() content */
1296 {
1297 	core_content_t ccc;
1298 
1299 	if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1300 		prt_hex(pri, 0, val);
1301 	else if (!raw && proc_content2str(ccc, pri->code_buf,
1302 	    sizeof (pri->code_buf)) >= 0)
1303 		outstring(pri, pri->code_buf);
1304 	else
1305 		prt_hhx(pri, 0, (long)ccc);
1306 }
1307 
1308 void
1309 prt_rcc(private_t *pri, int raw, long val)	/* print corectl() ret. cont. */
1310 {
1311 	core_content_t ccc;
1312 
1313 	if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
1314 		prt_hex(pri, 0, val);
1315 	else if (!raw && proc_content2str(ccc, pri->code_buf,
1316 	    sizeof (pri->code_buf)) >= 0)
1317 		outstring(pri, pri->code_buf);
1318 	else
1319 		prt_hhx(pri, 0, (long)ccc);
1320 }
1321 
1322 void
1323 prt_cpc(private_t *pri, int raw, long val)	/* print cpc() subcode */
1324 {
1325 	const char *s = NULL;
1326 
1327 	if (!raw) {
1328 		switch (val) {
1329 		case CPC_BIND:		s = "CPC_BIND";		break;
1330 		case CPC_SAMPLE:	s = "CPC_SAMPLE";	break;
1331 		case CPC_INVALIDATE:	s = "CPC_INVALIDATE";	break;
1332 		case CPC_RELE:		s = "CPC_RELE";		break;
1333 		case CPC_EVLIST_SIZE:	s = "CPC_EVLIST_SIZE";	break;
1334 		case CPC_LIST_EVENTS:	s = "CPC_LIST_EVENTS";	break;
1335 		case CPC_ATTRLIST_SIZE:	s = "CPC_ATTRLIST_SIZE"; break;
1336 		case CPC_LIST_ATTRS:	s = "CPC_LIST_ATTRS";	break;
1337 		case CPC_IMPL_NAME:	s = "CPC_IMPL_NAME";	break;
1338 		case CPC_CPUREF:	s = "CPC_CPUREF";	break;
1339 		case CPC_USR_EVENTS:	s = "CPC_USR_EVENTS";	break;
1340 		case CPC_SYS_EVENTS:	s = "CPC_SYS_EVENTS";	break;
1341 		case CPC_NPIC:		s = "CPC_NPIC";		break;
1342 		case CPC_CAPS:		s = "CPC_CAPS";		break;
1343 		case CPC_ENABLE:	s = "CPC_ENABLE";	break;
1344 		case CPC_DISABLE:	s = "CPC_DISABLE";	break;
1345 		}
1346 	}
1347 
1348 	if (s == NULL)
1349 		prt_dec(pri, 0, val);
1350 	else
1351 		outstring(pri, s);
1352 }
1353 
1354 void
1355 outstring(private_t *pri, const char *s)
1356 {
1357 	int len = strlen(s);
1358 
1359 	GROW(len);
1360 	(void) strcpy(pri->sys_string + pri->sys_leng, s);
1361 	pri->sys_leng += len;
1362 }
1363 
1364 void
1365 grow(private_t *pri, int nbyte)	/* reallocate format buffer if necessary */
1366 {
1367 	while (pri->sys_leng + nbyte >= pri->sys_ssize)
1368 		pri->sys_string = my_realloc(pri->sys_string,
1369 			pri->sys_ssize *= 2, "format buffer");
1370 }
1371 
1372 void
1373 prt_clc(private_t *pri, int raw, long val)
1374 {
1375 	const char *s = NULL;
1376 
1377 	if (!raw) {
1378 		switch (val) {
1379 		case CL_INITIALIZE:	s = "CL_INITIALIZE";	break;
1380 		case CL_CONFIG:		s = "CL_CONFIG";	break;
1381 		}
1382 	}
1383 
1384 	if (s == NULL)
1385 		prt_dec(pri, 0, val);
1386 	else
1387 		outstring(pri, s);
1388 }
1389 
1390 void
1391 prt_clf(private_t *pri, int raw, long val)
1392 {
1393 	const char *s = NULL;
1394 
1395 	if (!raw) {
1396 		switch (pri->sys_args[0]) {
1397 		case CL_CONFIG:
1398 			switch (pri->sys_args[1]) {
1399 			case CL_NODEID:
1400 				s = "CL_NODEID";		break;
1401 			case CL_HIGHEST_NODEID:
1402 				s = "CL_HIGHEST_NODEID";	break;
1403 			}
1404 			break;
1405 		case CL_INITIALIZE:
1406 			switch (pri->sys_args[1]) {
1407 			case CL_GET_BOOTFLAG:
1408 				s = "CL_GET_BOOTFLAG";		break;
1409 			}
1410 			break;
1411 		}
1412 	}
1413 
1414 	if (s == NULL)
1415 		prt_dec(pri, 0, val);
1416 	else
1417 		outstring(pri, s);
1418 }
1419 
1420 void
1421 prt_sqc(private_t *pri, int raw, long val)	/* print sigqueue() si_code */
1422 {
1423 	const char *s = NULL;
1424 
1425 	if (!raw) {
1426 		switch ((int)val) {
1427 		case SI_QUEUE:		s = "SI_QUEUE";		break;
1428 		case SI_TIMER:		s = "SI_TIMER";		break;
1429 		case SI_ASYNCIO:	s = "SI_ASYNCIO";	break;
1430 		case SI_MESGQ:		s = "SI_MESGQ";		break;
1431 		}
1432 	}
1433 
1434 	if (s == NULL)
1435 		prt_dec(pri, 0, val);
1436 	else
1437 		outstring(pri, s);
1438 }
1439 
1440 /*
1441  * print priocntlsys() (key, value) pair key.
1442  */
1443 void
1444 print_pck(private_t *pri, int raw, long val)
1445 {
1446 	const char	*s = NULL;
1447 	char		clname[PC_CLNMSZ];
1448 
1449 	if ((pri->sys_args[2] != PC_GETXPARMS &&
1450 	    pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) {
1451 		prt_dec(pri, 0, val);
1452 		return;
1453 	}
1454 
1455 	if (pri->sys_args[3] == NULL) {
1456 		if (val == PC_KY_CLNAME) {
1457 			s = "PC_KY_CLNAME";
1458 			outstring(pri, s);
1459 		} else
1460 			prt_dec(pri, 0, val);
1461 		return;
1462 	}
1463 
1464 	if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) {
1465 		prt_dec(pri, 0, val);
1466 		return;
1467 	}
1468 
1469 	if (strcmp(clname, "TS") == 0) {
1470 		switch (val) {
1471 		case TS_KY_UPRILIM: 	s = "TS_KY_UPRILIM";	break;
1472 		case TS_KY_UPRI:	s = "TS_KY_UPRI";	break;
1473 		default:					break;
1474 		}
1475 	} else if (strcmp(clname, "IA") == 0) {
1476 		switch (val) {
1477 		case IA_KY_UPRILIM: 	s = "IA_KY_UPRILIM";	break;
1478 		case IA_KY_UPRI:	s = "IA_KY_UPRI";	break;
1479 		case IA_KY_MODE:	s = "IA_KY_MODE";	break;
1480 		default:					break;
1481 		}
1482 	} else if (strcmp(clname, "RT") == 0) {
1483 		switch (val) {
1484 		case RT_KY_PRI: 	s = "RT_KY_PRI";	break;
1485 		case RT_KY_TQSECS:	s = "RT_KY_TQSECS";	break;
1486 		case RT_KY_TQNSECS:	s = "RT_KY_TQNSECS";	break;
1487 		case RT_KY_TQSIG:	s = "RT_KY_TQSIG";	break;
1488 		default:					break;
1489 		}
1490 	} else if (strcmp(clname, "FSS") == 0) {
1491 		switch (val) {
1492 		case FSS_KY_UPRILIM: 	s = "FSS_KY_UPRILIM";	break;
1493 		case FSS_KY_UPRI:	s = "FSS_KY_UPRI";	break;
1494 		default:					break;
1495 		}
1496 	} else if (strcmp(clname, "FX") == 0) {
1497 		switch (val) {
1498 		case FX_KY_UPRILIM: 	s = "FX_KY_UPRILIM";	break;
1499 		case FX_KY_UPRI:	s = "FX_KY_UPRI";	break;
1500 		case FX_KY_TQSECS:	s = "FX_KY_TQSECS";	break;
1501 		case FX_KY_TQNSECS:	s = "FX_KY_TQNSECS";	break;
1502 		default:					break;
1503 		}
1504 	}
1505 
1506 	if (s == NULL)
1507 		prt_dec(pri, 0, val);
1508 	else
1509 		outstring(pri, s);
1510 }
1511 
1512 /*
1513  * print priocntlsys() fourth argument.
1514  */
1515 /*ARGSUSED*/
1516 void
1517 prt_pc4(private_t *pri, int raw, long val)
1518 {
1519 	/* look at pricntlsys function */
1520 	if ((pri->sys_args[2] != PC_GETXPARMS &&
1521 	    pri->sys_args[2] != PC_SETXPARMS))
1522 		prt_hex(pri, 0, val);
1523 	else if (val)
1524 		prt_stg(pri, 0, val);
1525 	else
1526 		prt_dec(pri, 0, val);
1527 }
1528 
1529 /*
1530  * print priocntlsys() (key, value) pairs (5th argument).
1531  */
1532 /*ARGSUSED*/
1533 void
1534 prt_pc5(private_t *pri, int raw, long val)
1535 {
1536 	pc_vaparms_t	prms;
1537 	pc_vaparm_t	*vpp = &prms.pc_parms[0];
1538 	uint_t		cnt;
1539 
1540 
1541 	/* look at pricntlsys function */
1542 	if ((pri->sys_args[2] != PC_GETXPARMS &&
1543 	    pri->sys_args[2] != PC_SETXPARMS) || val == 0) {
1544 		prt_dec(pri, 0, 0);
1545 		return;
1546 	}
1547 
1548 	if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) {
1549 		prt_hex(pri, 0, val);
1550 		return;
1551 	}
1552 
1553 	if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT)
1554 		return;
1555 
1556 	for (; cnt--; vpp++) {
1557 		print_pck(pri, 0, vpp->pc_key);
1558 		outstring(pri, ", ");
1559 		prt_hex(pri, 0, (long)vpp->pc_parm);
1560 		outstring(pri, ", ");
1561 	}
1562 
1563 	prt_dec(pri, 0, PC_KY_NULL);
1564 }
1565 
1566 /*
1567  * Print processor set id, including logical expansion of "special" ids.
1568  */
1569 void
1570 prt_pst(private_t *pri, int raw, long val)
1571 {
1572 	const char *s = NULL;
1573 
1574 	if (!raw) {
1575 		switch ((psetid_t)val) {
1576 		case PS_NONE:		s = "PS_NONE";		break;
1577 		case PS_QUERY:		s = "PS_QUERY";		break;
1578 		case PS_MYID:		s = "PS_MYID";		break;
1579 		}
1580 	}
1581 
1582 	if (s == NULL)
1583 		prt_dec(pri, 0, val);
1584 	else
1585 		outstring(pri, s);
1586 }
1587 
1588 /*
1589  * Print meminfo() argument.
1590  */
1591 /*ARGSUSED*/
1592 void
1593 prt_mif(private_t *pri, int raw, long val)
1594 {
1595 	struct meminfo	minfo;
1596 
1597 #ifdef _LP64
1598 	if (data_model == PR_MODEL_ILP32) {
1599 		struct meminfo32 minfo32;
1600 
1601 		if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) !=
1602 			sizeof (struct meminfo32)) {
1603 			prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
1604 			outstring(pri, ", ");
1605 			prt_hex(pri, 0, val);
1606 			return;
1607 		}
1608 		/*
1609 		 * arrange the arguments in the order that user calls with
1610 		 */
1611 		prt_hex(pri, 0, minfo32.mi_inaddr);
1612 		outstring(pri, ", ");
1613 		prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
1614 		outstring(pri, ", ");
1615 		prt_hex(pri, 0, minfo32.mi_info_req);
1616 		outstring(pri, ", ");
1617 		prt_dec(pri, 0, minfo32.mi_info_count);
1618 		outstring(pri, ", ");
1619 		prt_hex(pri, 0, minfo32.mi_outdata);
1620 		outstring(pri, ", ");
1621 		prt_hex(pri, 0, minfo32.mi_validity);
1622 		return;
1623 	}
1624 #endif
1625 	if (Pread(Proc, &minfo, sizeof (struct meminfo), val) !=
1626 		sizeof (struct meminfo)) {
1627 		prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
1628 		outstring(pri, ", ");
1629 		prt_hex(pri, 0, val);
1630 		return;
1631 	}
1632 	/*
1633 	 * arrange the arguments in the order that user calls with
1634 	 */
1635 	prt_hex(pri, 0, (long)minfo.mi_inaddr);
1636 	outstring(pri, ", ");
1637 	prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
1638 	outstring(pri, ", ");
1639 	prt_hex(pri, 0, (long)minfo.mi_info_req);
1640 	outstring(pri, ", ");
1641 	prt_dec(pri, 0, minfo.mi_info_count);
1642 	outstring(pri, ", ");
1643 	prt_hex(pri, 0, (long)minfo.mi_outdata);
1644 	outstring(pri, ", ");
1645 	prt_hex(pri, 0, (long)minfo.mi_validity);
1646 }
1647 
1648 
1649 /*
1650  * Print so_socket() 1st argument.
1651  */
1652 /*ARGSUSED*/
1653 void
1654 prt_pfm(private_t *pri, int raw, long val)
1655 {
1656 	/* Protocol Families have same names as Address Families */
1657 	if ((ulong_t)val < MAX_AFCODES) {
1658 		outstring(pri, "PF_");
1659 		outstring(pri, afcodes[val]);
1660 	} else {
1661 		prt_dec(pri, 0, val);
1662 	}
1663 }
1664 
1665 
1666 /*
1667  * Print so_socket() 2nd argument.
1668  */
1669 /*ARGSUSED*/
1670 void
1671 prt_skt(private_t *pri, int raw, long val)
1672 {
1673 	const char *s;
1674 
1675 	if ((ulong_t)val <= MAX_SOCKTYPES && (s = socktype_codes[val]) != NULL)
1676 		outstring(pri, s);
1677 	else
1678 		prt_dec(pri, 0, val);
1679 }
1680 
1681 
1682 /*
1683  * Print so_socket() 3rd argument.
1684  */
1685 /*ARGSUSED*/
1686 void
1687 prt_skp(private_t *pri, int raw, long val)
1688 {
1689 	const char *s;
1690 
1691 	/* cheating -- look at the protocol-family */
1692 	switch (pri->sys_args[0]) {
1693 	case PF_INET6:
1694 	case PF_INET:
1695 	case PF_NCA:	if ((s = ipprotos((int)val)) != NULL) {
1696 				outstring(pri, s);
1697 				break;
1698 			}
1699 			/* FALLTHROUGH */
1700 	default:	prt_dec(pri, 0, val);
1701 			break;
1702 	}
1703 }
1704 
1705 
1706 /*
1707  * Print so_socket() 5th argument.
1708  */
1709 /*ARGSUSED*/
1710 void
1711 prt_skv(private_t *pri, int raw, long val)
1712 {
1713 	switch (val) {
1714 	case SOV_STREAM:	outstring(pri, "SOV_STREAM");	break;
1715 	case SOV_DEFAULT:	outstring(pri, "SOV_DEFAULT");	break;
1716 	case SOV_SOCKSTREAM:	outstring(pri, "SOV_SOCKSTREAM");	break;
1717 	case SOV_SOCKBSD:	outstring(pri, "SOV_SOCKBSD");	break;
1718 	case SOV_XPG4_2:	outstring(pri, "SOV_XPG4_2");	break;
1719 	default:		prt_dec(pri, 0, val);		break;
1720 	}
1721 }
1722 
1723 
1724 /*
1725  * Print setsockopt()/getsockopt() 2nd argument.
1726  */
1727 /*ARGSUSED*/
1728 void
1729 prt_sol(private_t *pri, int raw, long val)
1730 {
1731 	if (val == SOL_SOCKET) {
1732 		outstring(pri, "SOL_SOCKET");
1733 	} else {
1734 		const struct protoent *p;
1735 		struct protoent res;
1736 		char buf[NSS_BUFLEN_PROTOCOLS];
1737 
1738 		if ((p = getprotobynumber_r(val, &res,
1739 		    (char *)buf, sizeof (buf))) != NULL)
1740 			outstring(pri, p->p_name);
1741 		else
1742 			prt_dec(pri, 0, val);
1743 	}
1744 }
1745 
1746 
1747 const char *
1748 sol_optname(private_t *pri, long val)
1749 {
1750 #define	CBSIZE	sizeof (pri->code_buf)
1751 	if (val >= SO_SNDBUF) {
1752 		switch (val) {
1753 		case SO_SNDBUF:		return ("SO_SNDBUF");
1754 		case SO_RCVBUF:		return ("SO_RCVBUF");
1755 		case SO_SNDLOWAT:	return ("SO_SNDLOWAT");
1756 		case SO_RCVLOWAT:	return ("SO_RCVLOWAT");
1757 		case SO_SNDTIMEO:	return ("SO_SNDTIMEO");
1758 		case SO_RCVTIMEO:	return ("SO_RCVTIMEO");
1759 		case SO_ERROR:		return ("SO_ERROR");
1760 		case SO_TYPE:		return ("SO_TYPE");
1761 		case SO_PROTOTYPE:	return ("SO_PROTOTYPE");
1762 
1763 		default:		(void) snprintf(pri->code_buf, CBSIZE,
1764 						    "0x%lx", val);
1765 					return (pri->code_buf);
1766 		}
1767 	} else {
1768 		char *s = pri->code_buf;
1769 		size_t used = 1;
1770 		long val2;
1771 
1772 		*s = '\0';
1773 		val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE|
1774 		    SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER|
1775 		    SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED);
1776 		if (val2)
1777 			used = snprintf(s, CBSIZE, "|0x%lx", val2);
1778 		if (val & SO_DEBUG)
1779 			used = strlcat(s, "|SO_DEBUG", CBSIZE);
1780 		if (val & SO_ACCEPTCONN)
1781 			used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE);
1782 		if (val & SO_REUSEADDR)
1783 			used = strlcat(s, "|SO_REUSEADDR", CBSIZE);
1784 		if (val & SO_KEEPALIVE)
1785 			used = strlcat(s, "|SO_KEEPALIVE", CBSIZE);
1786 		if (val & SO_DONTROUTE)
1787 			used = strlcat(s, "|SO_DONTROUTE", CBSIZE);
1788 		if (val & SO_BROADCAST)
1789 			used = strlcat(s, "|SO_BROADCAST", CBSIZE);
1790 		if (val & SO_USELOOPBACK)
1791 			used = strlcat(s, "|SO_USELOOPBACK", CBSIZE);
1792 		if (val & SO_LINGER)
1793 			used = strlcat(s, "|SO_LINGER", CBSIZE);
1794 		if (val & SO_OOBINLINE)
1795 			used = strlcat(s, "|SO_OOBINLINE", CBSIZE);
1796 		if (val & SO_DGRAM_ERRIND)
1797 			used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE);
1798 		if (val & SO_RECVUCRED)
1799 			used = strlcat(s, "|SO_RECVUCRED", CBSIZE);
1800 		if (used >= CBSIZE || val == 0)
1801 			(void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
1802 		return ((const char *)(s + 1));
1803 	}
1804 #undef CBSIZE
1805 }
1806 
1807 
1808 const char *
1809 tcp_optname(private_t *pri, long val)
1810 {
1811 	switch (val) {
1812 	case TCP_NODELAY:		return ("TCP_NODELAY");
1813 	case TCP_MAXSEG:		return ("TCP_MAXSEG");
1814 	case TCP_KEEPALIVE:		return ("TCP_KEEPALIVE");
1815 	case TCP_NOTIFY_THRESHOLD:	return ("TCP_NOTIFY_THRESHOLD");
1816 	case TCP_ABORT_THRESHOLD:	return ("TCP_ABORT_THRESHOLD");
1817 	case TCP_CONN_NOTIFY_THRESHOLD:	return ("TCP_CONN_NOTIFY_THRESHOLD");
1818 	case TCP_CONN_ABORT_THRESHOLD:	return ("TCP_CONN_ABORT_THRESHOLD");
1819 	case TCP_RECVDSTADDR:		return ("TCP_RECVDSTADDR");
1820 	case TCP_ANONPRIVBIND:		return ("TCP_ANONPRIVBIND");
1821 	case TCP_EXCLBIND:		return ("TCP_EXCLBIND");
1822 	case TCP_INIT_CWND:		return ("TCP_INIT_CWND");
1823 	case TCP_KEEPALIVE_THRESHOLD:	return ("TCP_KEEPALIVE_THRESHOLD");
1824 	case TCP_KEEPALIVE_ABORT_THRESHOLD:
1825 		return ("TCP_KEEPALIVE_ABORT_THRESHOLD");
1826 	case TCP_CORK:			return ("TCP_CORK");
1827 
1828 	default:			(void) snprintf(pri->code_buf,
1829 					    sizeof (pri->code_buf),
1830 					    "0x%lx", val);
1831 					return (pri->code_buf);
1832 	}
1833 }
1834 
1835 
1836 const char *
1837 sctp_optname(private_t *pri, long val)
1838 {
1839 	switch (val) {
1840 	case SCTP_RTOINFO:		return ("SCTP_RTOINFO");
1841 	case SCTP_ASSOCINFO:		return ("SCTP_ASSOCINFO");
1842 	case SCTP_INITMSG:		return ("SCTP_INITMSG");
1843 	case SCTP_NODELAY:		return ("SCTP_NODELAY");
1844 	case SCTP_AUTOCLOSE:		return ("SCTP_AUTOCLOSE");
1845 	case SCTP_SET_PEER_PRIMARY_ADDR:
1846 		return ("SCTP_SET_PEER_PRIMARY_ADDR");
1847 	case SCTP_PRIMARY_ADDR:		return ("SCTP_PRIMARY_ADDR");
1848 	case SCTP_ADAPTION_LAYER:	return ("SCTP_ADAPTION_LAYER");
1849 	case SCTP_DISABLE_FRAGMENTS:	return ("SCTP_DISABLE_FRAGMENTS");
1850 	case SCTP_PEER_ADDR_PARAMS:	return ("SCTP_PEER_ADDR_PARAMS");
1851 	case SCTP_DEFAULT_SEND_PARAM:	return ("SCTP_DEFAULT_SEND_PARAM");
1852 	case SCTP_EVENTS:		return ("SCTP_EVENTS");
1853 	case SCTP_I_WANT_MAPPED_V4_ADDR:
1854 		return ("SCTP_I_WANT_MAPPED_V4_ADDR");
1855 	case SCTP_MAXSEG:		return ("SCTP_MAXSEG");
1856 	case SCTP_STATUS:		return ("SCTP_STATUS");
1857 	case SCTP_GET_PEER_ADDR_INFO:	return ("SCTP_GET_PEER_ADDR_INFO");
1858 
1859 	case SCTP_ADD_ADDR:		return ("SCTP_ADD_ADDR");
1860 	case SCTP_REM_ADDR:		return ("SCTP_REM_ADDR");
1861 
1862 	default:			(void) snprintf(pri->code_buf,
1863 					    sizeof (pri->code_buf),
1864 					    "0x%lx", val);
1865 					return (pri->code_buf);
1866 	}
1867 }
1868 
1869 
1870 const char *
1871 udp_optname(private_t *pri, long val)
1872 {
1873 	switch (val) {
1874 	case UDP_CHECKSUM:		return ("UDP_CHECKSUM");
1875 	case UDP_ANONPRIVBIND:		return ("UDP_ANONPRIVBIND");
1876 	case UDP_EXCLBIND:		return ("UDP_EXCLBIND");
1877 	case UDP_RCVHDR:		return ("UDP_RCVHDR");
1878 
1879 	default:			(void) snprintf(pri->code_buf,
1880 					    sizeof (pri->code_buf), "0x%lx",
1881 					    val);
1882 					return (pri->code_buf);
1883 	}
1884 }
1885 
1886 
1887 /*
1888  * Print setsockopt()/getsockopt() 3rd argument.
1889  */
1890 /*ARGSUSED*/
1891 void
1892 prt_son(private_t *pri, int raw, long val)
1893 {
1894 	/* cheating -- look at the level */
1895 	switch (pri->sys_args[1]) {
1896 	case SOL_SOCKET:	outstring(pri, sol_optname(pri, val));
1897 				break;
1898 	case IPPROTO_TCP:	outstring(pri, tcp_optname(pri, val));
1899 				break;
1900 	case IPPROTO_UDP:	outstring(pri, udp_optname(pri, val));
1901 				break;
1902 	case IPPROTO_SCTP:	outstring(pri, sctp_optname(pri, val));
1903 				break;
1904 	default:		prt_dec(pri, 0, val);
1905 				break;
1906 	}
1907 }
1908 
1909 
1910 /*
1911  * Print utrap type
1912  */
1913 /*ARGSUSED*/
1914 void
1915 prt_utt(private_t *pri, int raw, long val)
1916 {
1917 	const char *s = NULL;
1918 
1919 #ifdef __sparc
1920 	if (!raw) {
1921 		switch (val) {
1922 		case UT_INSTRUCTION_DISABLED:
1923 			s = "UT_INSTRUCTION_DISABLED"; break;
1924 		case UT_INSTRUCTION_ERROR:
1925 			s = "UT_INSTRUCTION_ERROR"; break;
1926 		case UT_INSTRUCTION_PROTECTION:
1927 			s = "UT_INSTRUCTION_PROTECTION"; break;
1928 		case UT_ILLTRAP_INSTRUCTION:
1929 			s = "UT_ILLTRAP_INSTRUCTION"; break;
1930 		case UT_ILLEGAL_INSTRUCTION:
1931 			s = "UT_ILLEGAL_INSTRUCTION"; break;
1932 		case UT_PRIVILEGED_OPCODE:
1933 			s = "UT_PRIVILEGED_OPCODE"; break;
1934 		case UT_FP_DISABLED:
1935 			s = "UT_FP_DISABLED"; break;
1936 		case UT_FP_EXCEPTION_IEEE_754:
1937 			s = "UT_FP_EXCEPTION_IEEE_754"; break;
1938 		case UT_FP_EXCEPTION_OTHER:
1939 			s = "UT_FP_EXCEPTION_OTHER"; break;
1940 		case UT_TAG_OVERFLOW:
1941 			s = "UT_TAG_OVERFLOW"; break;
1942 		case UT_DIVISION_BY_ZERO:
1943 			s = "UT_DIVISION_BY_ZERO"; break;
1944 		case UT_DATA_EXCEPTION:
1945 			s = "UT_DATA_EXCEPTION"; break;
1946 		case UT_DATA_ERROR:
1947 			s = "UT_DATA_ERROR"; break;
1948 		case UT_DATA_PROTECTION:
1949 			s = "UT_DATA_PROTECTION"; break;
1950 		case UT_MEM_ADDRESS_NOT_ALIGNED:
1951 			s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break;
1952 		case UT_PRIVILEGED_ACTION:
1953 			s = "UT_PRIVILEGED_ACTION"; break;
1954 		case UT_ASYNC_DATA_ERROR:
1955 			s = "UT_ASYNC_DATA_ERROR"; break;
1956 		case UT_TRAP_INSTRUCTION_16:
1957 			s = "UT_TRAP_INSTRUCTION_16"; break;
1958 		case UT_TRAP_INSTRUCTION_17:
1959 			s = "UT_TRAP_INSTRUCTION_17"; break;
1960 		case UT_TRAP_INSTRUCTION_18:
1961 			s = "UT_TRAP_INSTRUCTION_18"; break;
1962 		case UT_TRAP_INSTRUCTION_19:
1963 			s = "UT_TRAP_INSTRUCTION_19"; break;
1964 		case UT_TRAP_INSTRUCTION_20:
1965 			s = "UT_TRAP_INSTRUCTION_20"; break;
1966 		case UT_TRAP_INSTRUCTION_21:
1967 			s = "UT_TRAP_INSTRUCTION_21"; break;
1968 		case UT_TRAP_INSTRUCTION_22:
1969 			s = "UT_TRAP_INSTRUCTION_22"; break;
1970 		case UT_TRAP_INSTRUCTION_23:
1971 			s = "UT_TRAP_INSTRUCTION_23"; break;
1972 		case UT_TRAP_INSTRUCTION_24:
1973 			s = "UT_TRAP_INSTRUCTION_24"; break;
1974 		case UT_TRAP_INSTRUCTION_25:
1975 			s = "UT_TRAP_INSTRUCTION_25"; break;
1976 		case UT_TRAP_INSTRUCTION_26:
1977 			s = "UT_TRAP_INSTRUCTION_26"; break;
1978 		case UT_TRAP_INSTRUCTION_27:
1979 			s = "UT_TRAP_INSTRUCTION_27"; break;
1980 		case UT_TRAP_INSTRUCTION_28:
1981 			s = "UT_TRAP_INSTRUCTION_28"; break;
1982 		case UT_TRAP_INSTRUCTION_29:
1983 			s = "UT_TRAP_INSTRUCTION_29"; break;
1984 		case UT_TRAP_INSTRUCTION_30:
1985 			s = "UT_TRAP_INSTRUCTION_30"; break;
1986 		case UT_TRAP_INSTRUCTION_31:
1987 			s = "UT_TRAP_INSTRUCTION_31"; break;
1988 		}
1989 	}
1990 #endif /* __sparc */
1991 
1992 	if (s == NULL)
1993 		prt_dec(pri, 0, val);
1994 	else
1995 		outstring(pri, s);
1996 }
1997 
1998 
1999 /*
2000  * Print utrap handler
2001  */
2002 void
2003 prt_uth(private_t *pri, int raw, long val)
2004 {
2005 	const char *s = NULL;
2006 
2007 	if (!raw) {
2008 		switch (val) {
2009 		case (long)UTH_NOCHANGE:	s = "UTH_NOCHANGE"; break;
2010 		}
2011 	}
2012 
2013 	if (s == NULL)
2014 		prt_hex(pri, 0, val);
2015 	else
2016 		outstring(pri, s);
2017 }
2018 
2019 const char *
2020 access_flags(private_t *pri, long arg)
2021 {
2022 #define	E_OK 010
2023 	char *str = pri->code_buf;
2024 
2025 	if (arg & ~(R_OK|W_OK|X_OK|E_OK))
2026 		return (NULL);
2027 
2028 	/* NB: F_OK == 0 */
2029 	if (arg == F_OK)
2030 		return ("F_OK");
2031 	if (arg == E_OK)
2032 		return ("F_OK|E_OK");
2033 
2034 	*str = '\0';
2035 	if (arg & R_OK)
2036 		(void) strlcat(str, "|R_OK", sizeof (pri->code_buf));
2037 	if (arg & W_OK)
2038 		(void) strlcat(str, "|W_OK", sizeof (pri->code_buf));
2039 	if (arg & X_OK)
2040 		(void) strlcat(str, "|X_OK", sizeof (pri->code_buf));
2041 	if (arg & E_OK)
2042 		(void) strlcat(str, "|E_OK", sizeof (pri->code_buf));
2043 	return ((const char *)(str + 1));
2044 #undef E_OK
2045 }
2046 
2047 /*
2048  * Print access() flags.
2049  */
2050 void
2051 prt_acc(private_t *pri, int raw, long val)
2052 {
2053 	const char *s = raw? NULL : access_flags(pri, val);
2054 
2055 	if (s == NULL)
2056 		prt_dex(pri, 0, val);
2057 	else
2058 		outstring(pri, s);
2059 }
2060 
2061 /*
2062  * Print shutdown() "how" (2nd) argument
2063  */
2064 void
2065 prt_sht(private_t *pri, int raw, long val)
2066 {
2067 	if (raw) {
2068 		prt_dex(pri, 0, val);
2069 		return;
2070 	}
2071 	switch (val) {
2072 	case SHUT_RD:	outstring(pri, "SHUT_RD");	break;
2073 	case SHUT_WR:	outstring(pri, "SHUT_WR");	break;
2074 	case SHUT_RDWR:	outstring(pri, "SHUT_RDWR");	break;
2075 	default:	prt_dec(pri, 0, val);		break;
2076 	}
2077 }
2078 
2079 /*
2080  * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg)
2081  */
2082 static struct fcntl_flags {
2083 	long		val;
2084 	const char	*name;
2085 } fcntl_flags[] = {
2086 #define	FC_FL(flag)	{ (long)flag, "|" # flag }
2087 #ifdef C2_AUDIT
2088 	FC_FL(FREVOKED),
2089 #endif
2090 	FC_FL(FREAD),
2091 	FC_FL(FWRITE),
2092 	FC_FL(FNDELAY),
2093 	FC_FL(FAPPEND),
2094 	FC_FL(FSYNC),
2095 	FC_FL(FDSYNC),
2096 	FC_FL(FRSYNC),
2097 	FC_FL(FOFFMAX),
2098 	FC_FL(FNONBLOCK),
2099 	FC_FL(FCREAT),
2100 	FC_FL(FTRUNC),
2101 	FC_FL(FEXCL),
2102 	FC_FL(FNOCTTY),
2103 	FC_FL(FXATTR),
2104 	FC_FL(FASYNC),
2105 	FC_FL(FNODSYNC)
2106 #undef FC_FL
2107 };
2108 
2109 void
2110 prt_ffg(private_t *pri, int raw, long val)
2111 {
2112 #define	CBSIZE	sizeof (pri->code_buf)
2113 	char *s = pri->code_buf;
2114 	size_t used = 1;
2115 	struct fcntl_flags *fp;
2116 
2117 	if (raw) {
2118 		(void) snprintf(s, CBSIZE, "0x%lx", val);
2119 		outstring(pri, s);
2120 		return;
2121 	}
2122 	if (val == 0) {
2123 		outstring(pri, "(no flags)");
2124 		return;
2125 	}
2126 
2127 	*s = '\0';
2128 	for (fp = fcntl_flags;
2129 	    fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) {
2130 		if (val & fp->val) {
2131 			used = strlcat(s, fp->name, CBSIZE);
2132 			val &= ~fp->val;
2133 		}
2134 	}
2135 
2136 	if (val != 0 && used <= CBSIZE)
2137 		used += snprintf(s + used, CBSIZE - used, "|0x%lx", val);
2138 
2139 	if (used >= CBSIZE)
2140 		(void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
2141 	outstring(pri, s + 1);
2142 #undef CBSIZE
2143 }
2144 
2145 void
2146 prt_prs(private_t *pri, int raw, long val)
2147 {
2148 	static size_t setsize;
2149 	priv_set_t *set = priv_allocset();
2150 
2151 	if (setsize == 0) {
2152 		const priv_impl_info_t *info = getprivimplinfo();
2153 		if (info != NULL)
2154 			setsize = info->priv_setsize * sizeof (priv_chunk_t);
2155 	}
2156 
2157 	if (setsize != 0 && !raw && set != NULL &&
2158 	    Pread(Proc, set, setsize, val) == setsize) {
2159 		int i;
2160 
2161 		outstring(pri, "{");
2162 		for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) {
2163 			char buf[9];	/* 8 hex digits + '\0' */
2164 			(void) snprintf(buf, sizeof (buf), "%08x",
2165 			    ((priv_chunk_t *)set)[i]);
2166 			outstring(pri, buf);
2167 		}
2168 
2169 		outstring(pri, "}");
2170 	} else {
2171 		prt_hex(pri, 0, val);
2172 	}
2173 
2174 	if (set != NULL)
2175 		priv_freeset(set);
2176 }
2177 
2178 /*
2179  * Print privilege set operation.
2180  */
2181 void
2182 prt_pro(private_t *pri, int raw, long val)
2183 {
2184 	const char *s = NULL;
2185 
2186 	if (!raw) {
2187 		switch ((priv_op_t)val) {
2188 		case PRIV_ON:		s = "PRIV_ON";		break;
2189 		case PRIV_OFF:		s = "PRIV_OFF";		break;
2190 		case PRIV_SET:		s = "PRIV_SET";		break;
2191 		}
2192 	}
2193 
2194 	if (s == NULL)
2195 		prt_dec(pri, 0, val);
2196 	else
2197 		outstring(pri, s);
2198 }
2199 
2200 /*
2201  * Print privilege set name
2202  */
2203 void
2204 prt_prn(private_t *pri, int raw, long val)
2205 {
2206 	const char *s = NULL;
2207 
2208 	if (!raw)
2209 		s = priv_getsetbynum((int)val);
2210 
2211 	if (s == NULL)
2212 		prt_dec(pri, 0, val);
2213 	else {
2214 		char *dup = strdup(s);
2215 		char *q;
2216 
2217 		/* Do the best we can in this case */
2218 		if (dup == NULL) {
2219 			outstring(pri, s);
2220 			return;
2221 		}
2222 
2223 		outstring(pri, "PRIV_");
2224 
2225 		q = dup;
2226 
2227 		while (*q != '\0') {
2228 			*q = toupper(*q);
2229 			q++;
2230 		}
2231 		outstring(pri, dup);
2232 		free(dup);
2233 	}
2234 }
2235 
2236 /*
2237  * Print process flag names.
2238  */
2239 void
2240 prt_pfl(private_t *pri, int raw, long val)
2241 {
2242 	const char *s = NULL;
2243 
2244 	if (!raw) {
2245 		switch ((int)val) {
2246 		case PRIV_DEBUG:	s = "PRIV_DEBUG";	break;
2247 		case PRIV_AWARE:	s = "PRIV_AWARE";	break;
2248 		}
2249 	}
2250 
2251 	if (s == NULL)
2252 		prt_dec(pri, 0, val);
2253 	else
2254 		outstring(pri, s);
2255 }
2256 
2257 /*
2258  * Print lgrp_affinity_{get,set}() arguments.
2259  */
2260 /*ARGSUSED*/
2261 void
2262 prt_laf(private_t *pri, int raw, long val)
2263 {
2264 	lgrp_affinity_args_t	laff;
2265 
2266 	if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) !=
2267 		sizeof (lgrp_affinity_args_t)) {
2268 		prt_hex(pri, 0, val);
2269 		return;
2270 	}
2271 	/*
2272 	 * arrange the arguments in the order that user calls with
2273 	 */
2274 	prt_dec(pri, 0, laff.idtype);
2275 	outstring(pri, ", ");
2276 	prt_dec(pri, 0, laff.id);
2277 	outstring(pri, ", ");
2278 	prt_dec(pri, 0, laff.lgrp);
2279 	outstring(pri, ", ");
2280 	if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET)
2281 		prt_dec(pri, 0, laff.aff);
2282 }
2283 
2284 /*
2285  * Print a key_t as IPC_PRIVATE if it is 0.
2286  */
2287 void
2288 prt_key(private_t *pri, int raw, long val)
2289 {
2290 	if (!raw && val == 0)
2291 		outstring(pri, "IPC_PRIVATE");
2292 	else
2293 		prt_dec(pri, 0, val);
2294 }
2295 
2296 
2297 /*
2298  * Print zone_getattr() attribute types.
2299  */
2300 void
2301 prt_zga(private_t *pri, int raw, long val)
2302 {
2303 	const char *s = NULL;
2304 
2305 	if (!raw) {
2306 		switch ((int)val) {
2307 		case ZONE_ATTR_NAME:	s = "ZONE_ATTR_NAME";	break;
2308 		case ZONE_ATTR_ROOT:	s = "ZONE_ATTR_ROOT";	break;
2309 		case ZONE_ATTR_STATUS:	s = "ZONE_ATTR_STATUS";	break;
2310 		case ZONE_ATTR_PRIVSET:	s = "ZONE_ATTR_PRIVSET"; break;
2311 		case ZONE_ATTR_UNIQID:	s = "ZONE_ATTR_UNIQID"; break;
2312 		case ZONE_ATTR_POOLID:	s = "ZONE_ATTR_POOLID"; break;
2313 		case ZONE_ATTR_INITPID:	s = "ZONE_ATTR_INITPID"; break;
2314 		}
2315 	}
2316 
2317 	if (s == NULL)
2318 		prt_dec(pri, 0, val);
2319 	else
2320 		outstring(pri, s);
2321 }
2322 
2323 /*
2324  * Print a file descriptor as AT_FDCWD if necessary
2325  */
2326 void
2327 prt_atc(private_t *pri, int raw, long val)
2328 {
2329 	if (!raw && val == AT_FDCWD)
2330 		outstring(pri, "AT_FDCWD");
2331 	else
2332 		prt_dec(pri, 0, val);
2333 }
2334 
2335 /*
2336  * Print LIO_XX flags
2337  */
2338 void
2339 prt_lio(private_t *pri, int raw, long val)
2340 {
2341 	if (raw)
2342 		prt_dec(pri, 0, val);
2343 	else if (val == LIO_WAIT)
2344 		outstring(pri, "LIO_WAIT");
2345 	else if (val == LIO_NOWAIT)
2346 		outstring(pri, "LIO_NOWAIT");
2347 	else
2348 		prt_dec(pri, 0, val);
2349 }
2350 
2351 const char *
2352 door_flags(private_t *pri, long val)
2353 {
2354 	door_attr_t attr = (door_attr_t)val;
2355 	char *str = pri->code_buf;
2356 
2357 	*str = '\0';
2358 #define	PROCESS_FLAG(flg)						\
2359 	if (attr & flg) {						\
2360 		(void) strlcat(str, "|" #flg, sizeof (pri->code_buf));	\
2361 		attr &= ~flg;						\
2362 	}
2363 
2364 	PROCESS_FLAG(DOOR_UNREF);
2365 	PROCESS_FLAG(DOOR_UNREF_MULTI);
2366 	PROCESS_FLAG(DOOR_PRIVATE);
2367 	PROCESS_FLAG(DOOR_REFUSE_DESC);
2368 	PROCESS_FLAG(DOOR_NO_CANCEL);
2369 	PROCESS_FLAG(DOOR_LOCAL);
2370 	PROCESS_FLAG(DOOR_REVOKED);
2371 	PROCESS_FLAG(DOOR_IS_UNREF);
2372 #undef PROCESS_FLAG
2373 
2374 	if (attr != 0 || *str == '\0') {
2375 		size_t len = strlen(str);
2376 		(void) snprintf(str + len, sizeof (pri->code_buf) - len,
2377 		    "|0x%X", attr);
2378 	}
2379 
2380 	return (str + 1);
2381 }
2382 
2383 /*
2384  * Print door_create() flags
2385  */
2386 void
2387 prt_dfl(private_t *pri, int raw, long val)
2388 {
2389 	if (raw)
2390 		prt_hex(pri, 0, val);
2391 	else
2392 		outstring(pri, door_flags(pri, val));
2393 }
2394 
2395 /*
2396  * Print door_*param() param argument
2397  */
2398 void
2399 prt_dpm(private_t *pri, int raw, long val)
2400 {
2401 	if (raw)
2402 		prt_hex(pri, 0, val);
2403 	else if (val == DOOR_PARAM_DESC_MAX)
2404 		outstring(pri, "DOOR_PARAM_DESC_MAX");
2405 	else if (val == DOOR_PARAM_DATA_MIN)
2406 		outstring(pri, "DOOR_PARAM_DATA_MIN");
2407 	else if (val == DOOR_PARAM_DATA_MAX)
2408 		outstring(pri, "DOOR_PARAM_DATA_MAX");
2409 	else
2410 		prt_hex(pri, 0, val);
2411 }
2412 
2413 /*
2414  * Array of pointers to print functions, one for each format.
2415  */
2416 void (* const Print[])() = {
2417 	prt_nov,	/* NOV -- no value */
2418 	prt_dec,	/* DEC -- print value in decimal */
2419 	prt_oct,	/* OCT -- print value in octal */
2420 	prt_hex,	/* HEX -- print value in hexadecimal */
2421 	prt_dex,	/* DEX -- print value in hexadecimal if big enough */
2422 	prt_stg,	/* STG -- print value as string */
2423 	prt_ioc,	/* IOC -- print ioctl code */
2424 	prt_fcn,	/* FCN -- print fcntl code */
2425 	prt_s86,	/* S86 -- print sysi86 code */
2426 	prt_uts,	/* UTS -- print utssys code */
2427 	prt_opn,	/* OPN -- print open code */
2428 	prt_sig,	/* SIG -- print signal name plus flags */
2429 	prt_act,	/* ACT -- print signal action value */
2430 	prt_msc,	/* MSC -- print msgsys command */
2431 	prt_msf,	/* MSF -- print msgsys flags */
2432 	prt_smc,	/* SMC -- print semsys command */
2433 	prt_sef,	/* SEF -- print semsys flags */
2434 	prt_shc,	/* SHC -- print shmsys command */
2435 	prt_shf,	/* SHF -- print shmsys flags */
2436 	prt_plk,	/* PLK -- print plock code */
2437 	prt_sfs,	/* SFS -- print sysfs code */
2438 	prt_rst,	/* RST -- print string returned by syscall */
2439 	prt_smf,	/* SMF -- print streams message flags */
2440 	prt_ioa,	/* IOA -- print ioctl argument */
2441 	prt_six,	/* SIX -- print signal, masked with SIGNO_MASK */
2442 	prt_mtf,	/* MTF -- print mount flags */
2443 	prt_mft,	/* MFT -- print mount file system type */
2444 	prt_iob,	/* IOB -- print contents of I/O buffer */
2445 	prt_hhx,	/* HHX -- print value in hexadecimal (half size) */
2446 	prt_wop,	/* WOP -- print waitsys() options */
2447 	prt_spm,	/* SPM -- print sigprocmask argument */
2448 	prt_rlk,	/* RLK -- print readlink buffer */
2449 	prt_mpr,	/* MPR -- print mmap()/mprotect() flags */
2450 	prt_mty,	/* MTY -- print mmap() mapping type flags */
2451 	prt_mcf,	/* MCF -- print memcntl() function */
2452 	prt_mc4,	/* MC4 -- print memcntl() (fourth) argument */
2453 	prt_mc5,	/* MC5 -- print memcntl() (fifth) argument */
2454 	prt_mad,	/* MAD -- print madvise() argument */
2455 	prt_ulm,	/* ULM -- print ulimit() argument */
2456 	prt_rlm,	/* RLM -- print get/setrlimit() argument */
2457 	prt_cnf,	/* CNF -- print sysconfig() argument */
2458 	prt_inf,	/* INF -- print sysinfo() argument */
2459 	prt_ptc,	/* PTC -- print pathconf/fpathconf() argument */
2460 	prt_fui,	/* FUI -- print fusers() input argument */
2461 	prt_idt,	/* IDT -- print idtype_t, waitid() argument */
2462 	prt_lwf,	/* LWF -- print lwp_create() flags */
2463 	prt_itm,	/* ITM -- print [get|set]itimer() arg */
2464 	prt_llo,	/* LLO -- print long long offset arg */
2465 	prt_mod,	/* MOD -- print modctl() subcode */
2466 	prt_whn,	/* WHN -- print lseek() whence arguiment */
2467 	prt_acl,	/* ACL -- print acl() code */
2468 	prt_aio,	/* AIO -- print kaio() code */
2469 	prt_aud,	/* AUD -- print auditsys() code */
2470 	prt_uns,	/* DEC -- print value in unsigned decimal */
2471 	prt_clc,	/* CLC -- print cladm command argument */
2472 	prt_clf,	/* CLF -- print cladm flag argument */
2473 	prt_cor,	/* COR -- print corectl() subcode */
2474 	prt_cco,	/* CCO -- print corectl() options */
2475 	prt_ccc,	/* CCC -- print corectl() content */
2476 	prt_rcc,	/* RCC -- print corectl() returned content */
2477 	prt_cpc,	/* CPC -- print cpc() subcode */
2478 	prt_sqc,	/* SQC -- print sigqueue() si_code argument */
2479 	prt_pc4,	/* PC4 -- print priocntlsys() (fourth) argument */
2480 	prt_pc5,	/* PC5 -- print priocntlsys() (key, value) pairs */
2481 	prt_pst,	/* PST -- print processor set id */
2482 	prt_mif,	/* MIF -- print meminfo() arguments */
2483 	prt_pfm,	/* PFM -- print so_socket() proto-family (1st) arg */
2484 	prt_skt,	/* SKT -- print so_socket() socket-type (2nd) arg */
2485 	prt_skp,	/* SKP -- print so_socket() protocol (3rd) arg */
2486 	prt_skv,	/* SKV -- print socket version arg */
2487 	prt_sol,	/* SOL -- print [sg]etsockopt() level (2nd) arg */
2488 	prt_son,	/* SON -- print [sg]etsockopt() opt-name (3rd) arg */
2489 	prt_utt,	/* UTT -- print utrap type */
2490 	prt_uth,	/* UTH -- print utrap handler */
2491 	prt_acc,	/* ACC -- print access() flags */
2492 	prt_sht,	/* SHT -- print shutdown() how (2nd) argument */
2493 	prt_ffg,	/* FFG -- print fcntl() flags (3rd) argument */
2494 	prt_prs,	/* PRS -- print privilege set */
2495 	prt_pro,	/* PRO -- print privilege set operation */
2496 	prt_prn,	/* PRN -- print privilege set name */
2497 	prt_pfl,	/* PFL -- print privilege/process flag name */
2498 	prt_laf,	/* LAF -- print lgrp_affinity arguments */
2499 	prt_key,	/* KEY -- print key_t 0 as IPC_PRIVATE */
2500 	prt_zga,	/* ZGA -- print zone_getattr attribute types */
2501 	prt_atc,	/* ATC -- print AT_FDCWD or file descriptor */
2502 	prt_lio,	/* LIO -- print LIO_XX flags */
2503 	prt_dfl,	/* DFL -- print door_create() flags */
2504 	prt_dpm,	/* DPM -- print DOOR_PARAM_XX flags */
2505 	prt_dec,	/* HID -- hidden argument, make this the last one */
2506 };
2507