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