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