xref: /titanic_50/usr/src/cmd/truss/print.c (revision 5eaceb49d5b95dd7910af115172887f8dbddfb4c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21794f0adbSRoger A. Faulkner 
227c478bd9Sstevel@tonic-gate /*
23134a1f4eSCasper H.S. Dik  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
29187670a0STheo Schlossnagle /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
30187670a0STheo Schlossnagle 
317c478bd9Sstevel@tonic-gate #define	_SYSCALL32	/* make 32-bit compat headers visible */
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <stdio.h>
347c478bd9Sstevel@tonic-gate #include <stdlib.h>
357c478bd9Sstevel@tonic-gate #include <unistd.h>
367c478bd9Sstevel@tonic-gate #include <string.h>
377c478bd9Sstevel@tonic-gate #include <signal.h>
387c478bd9Sstevel@tonic-gate #include <termio.h>
397c478bd9Sstevel@tonic-gate #include <stddef.h>
407c478bd9Sstevel@tonic-gate #include <limits.h>
413b862e9aSRoger A. Faulkner #include <fcntl.h>
427c478bd9Sstevel@tonic-gate #include <ctype.h>
437c478bd9Sstevel@tonic-gate #include <sys/types.h>
447c478bd9Sstevel@tonic-gate #include <sys/mman.h>
457c478bd9Sstevel@tonic-gate #include <sys/resource.h>
467c478bd9Sstevel@tonic-gate #include <sys/ulimit.h>
477c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
487c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
497c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
507c478bd9Sstevel@tonic-gate #include <sys/acl.h>
517c478bd9Sstevel@tonic-gate #include <stropts.h>
527c478bd9Sstevel@tonic-gate #include <sys/isa_defs.h>
537c478bd9Sstevel@tonic-gate #include <sys/systeminfo.h>
547c478bd9Sstevel@tonic-gate #include <sys/cladm.h>
557c478bd9Sstevel@tonic-gate #include <sys/lwp.h>
567c478bd9Sstevel@tonic-gate #include <bsm/audit.h>
577c478bd9Sstevel@tonic-gate #include <libproc.h>
587c478bd9Sstevel@tonic-gate #include <priv.h>
597c478bd9Sstevel@tonic-gate #include <sys/aio.h>
607c478bd9Sstevel@tonic-gate #include <sys/aiocb.h>
617c478bd9Sstevel@tonic-gate #include <sys/corectl.h>
627c478bd9Sstevel@tonic-gate #include <sys/cpc_impl.h>
637c478bd9Sstevel@tonic-gate #include <sys/priocntl.h>
647c478bd9Sstevel@tonic-gate #include <sys/tspriocntl.h>
657c478bd9Sstevel@tonic-gate #include <sys/iapriocntl.h>
667c478bd9Sstevel@tonic-gate #include <sys/rtpriocntl.h>
677c478bd9Sstevel@tonic-gate #include <sys/fsspriocntl.h>
687c478bd9Sstevel@tonic-gate #include <sys/fxpriocntl.h>
697c478bd9Sstevel@tonic-gate #include <netdb.h>
707c478bd9Sstevel@tonic-gate #include <nss_dbdefs.h>
717c478bd9Sstevel@tonic-gate #include <sys/socketvar.h>
727c478bd9Sstevel@tonic-gate #include <netinet/in.h>
737c478bd9Sstevel@tonic-gate #include <netinet/tcp.h>
747c478bd9Sstevel@tonic-gate #include <netinet/udp.h>
757c478bd9Sstevel@tonic-gate #include <netinet/sctp.h>
76e11c3f44Smeem #include <net/route.h>
777c478bd9Sstevel@tonic-gate #include <sys/utrap.h>
787c478bd9Sstevel@tonic-gate #include <sys/lgrp_user.h>
797c478bd9Sstevel@tonic-gate #include <sys/door.h>
8045916cd2Sjpk #include <sys/tsol/tndb.h>
81aa4a4f3bSnf202958 #include <sys/rctl.h>
82aa4a4f3bSnf202958 #include <sys/rctl_impl.h>
83657b1f3dSraf #include <sys/fork.h>
84532877c4Srd117015 #include <sys/task.h>
857c478bd9Sstevel@tonic-gate #include "ramdata.h"
867c478bd9Sstevel@tonic-gate #include "print.h"
877c478bd9Sstevel@tonic-gate #include "proto.h"
887c478bd9Sstevel@tonic-gate #include "systable.h"
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate void grow(private_t *, int nbyte);
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate #define	GROW(nb) if (pri->sys_leng + (nb) >= pri->sys_ssize) grow(pri, (nb))
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*ARGSUSED*/
967c478bd9Sstevel@tonic-gate void
977c478bd9Sstevel@tonic-gate prt_nov(private_t *pri, int raw, long val)	/* print nothing */
987c478bd9Sstevel@tonic-gate {
997c478bd9Sstevel@tonic-gate }
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1027c478bd9Sstevel@tonic-gate void
1037c478bd9Sstevel@tonic-gate prt_dec(private_t *pri, int raw, long val)	/* print as decimal */
1047c478bd9Sstevel@tonic-gate {
1057c478bd9Sstevel@tonic-gate 	GROW(24);
1067c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32)
1077c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1087c478bd9Sstevel@tonic-gate 		    "%d", (int)val);
1097c478bd9Sstevel@tonic-gate 	else
1107c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1117c478bd9Sstevel@tonic-gate 		    "%ld", val);
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1157c478bd9Sstevel@tonic-gate void
1167c478bd9Sstevel@tonic-gate prt_uns(private_t *pri, int raw, long val)	/* print as unsigned decimal */
1177c478bd9Sstevel@tonic-gate {
1187c478bd9Sstevel@tonic-gate 	GROW(24);
1197c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32)
1207c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1217c478bd9Sstevel@tonic-gate 		    "%u", (int)val);
1227c478bd9Sstevel@tonic-gate 	else
1237c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1247c478bd9Sstevel@tonic-gate 		    "%lu", val);
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate 
127f48205beScasper /* print as unsigned decimal, except for -1 */
128f48205beScasper void
129f48205beScasper prt_un1(private_t *pri, int raw, long val)
130f48205beScasper {
131f48205beScasper 	if ((int)val == -1)
132f48205beScasper 		prt_dec(pri, raw, val);
133f48205beScasper 	else
134f48205beScasper 		prt_uns(pri, raw, val);
135f48205beScasper }
136f48205beScasper 
1377c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1387c478bd9Sstevel@tonic-gate void
1397c478bd9Sstevel@tonic-gate prt_oct(private_t *pri, int raw, long val)	/* print as octal */
1407c478bd9Sstevel@tonic-gate {
1417c478bd9Sstevel@tonic-gate 	GROW(24);
1427c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32)
1437c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1447c478bd9Sstevel@tonic-gate 		    "%#o", (int)val);
1457c478bd9Sstevel@tonic-gate 	else
1467c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1477c478bd9Sstevel@tonic-gate 		    "%#lo", val);
1487c478bd9Sstevel@tonic-gate }
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1517c478bd9Sstevel@tonic-gate void
1527c478bd9Sstevel@tonic-gate prt_hex(private_t *pri, int raw, long val)	/* print as hexadecimal */
1537c478bd9Sstevel@tonic-gate {
1547c478bd9Sstevel@tonic-gate 	GROW(20);
1557c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32)
1567c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1577c478bd9Sstevel@tonic-gate 		    "0x%.8X", (int)val);
1587c478bd9Sstevel@tonic-gate 	else
1597c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1607c478bd9Sstevel@tonic-gate 		    "0x%.8lX", val);
1617c478bd9Sstevel@tonic-gate }
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /* print as hexadecimal (half size) */
1647c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1657c478bd9Sstevel@tonic-gate void
1667c478bd9Sstevel@tonic-gate prt_hhx(private_t *pri, int raw, long val)
1677c478bd9Sstevel@tonic-gate {
1687c478bd9Sstevel@tonic-gate 	GROW(20);
1697c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32)
1707c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1717c478bd9Sstevel@tonic-gate 		    "0x%.4X", (int)val);
1727c478bd9Sstevel@tonic-gate 	else
1737c478bd9Sstevel@tonic-gate 		pri->sys_leng += sprintf(pri->sys_string + pri->sys_leng,
1747c478bd9Sstevel@tonic-gate 		    "0x%.4lX", val);
1757c478bd9Sstevel@tonic-gate }
1767c478bd9Sstevel@tonic-gate 
1777c478bd9Sstevel@tonic-gate /* print as decimal if small, else hexadecimal */
1787c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1797c478bd9Sstevel@tonic-gate void
1807c478bd9Sstevel@tonic-gate prt_dex(private_t *pri, int raw, long val)
1817c478bd9Sstevel@tonic-gate {
1827c478bd9Sstevel@tonic-gate 	if (val & 0xff000000)
1837c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
1847c478bd9Sstevel@tonic-gate 	else
1857c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
1867c478bd9Sstevel@tonic-gate }
1877c478bd9Sstevel@tonic-gate 
1887c478bd9Sstevel@tonic-gate /* print long long offset */
1897c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1907c478bd9Sstevel@tonic-gate void
1917c478bd9Sstevel@tonic-gate prt_llo(private_t *pri, int raw, long val1, long val2)
1927c478bd9Sstevel@tonic-gate {
1937c478bd9Sstevel@tonic-gate 	int hival;
1947c478bd9Sstevel@tonic-gate 	int loval;
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate #ifdef	_LONG_LONG_LTOH
1977c478bd9Sstevel@tonic-gate 	hival = (int)val2;
1987c478bd9Sstevel@tonic-gate 	loval = (int)val1;
1997c478bd9Sstevel@tonic-gate #else
2007c478bd9Sstevel@tonic-gate 	hival = (int)val1;
2017c478bd9Sstevel@tonic-gate 	loval = (int)val2;
2027c478bd9Sstevel@tonic-gate #endif
2037c478bd9Sstevel@tonic-gate 
204fac3008cSeschrock 	if (hival == 0) {
2057c478bd9Sstevel@tonic-gate 		prt_dex(pri, 0, loval);
206fac3008cSeschrock 	} else {
2077c478bd9Sstevel@tonic-gate 		GROW(18);
2087c478bd9Sstevel@tonic-gate 		pri->sys_leng +=
2097c478bd9Sstevel@tonic-gate 		    sprintf(pri->sys_string + pri->sys_leng, "0x%.8X%.8X",
2107c478bd9Sstevel@tonic-gate 		    hival, loval);
2117c478bd9Sstevel@tonic-gate 	}
2127c478bd9Sstevel@tonic-gate }
2137c478bd9Sstevel@tonic-gate 
2147c478bd9Sstevel@tonic-gate void
2157c478bd9Sstevel@tonic-gate escape_string(private_t *pri, const char *s)
2167c478bd9Sstevel@tonic-gate {
2177c478bd9Sstevel@tonic-gate 	/*
2187c478bd9Sstevel@tonic-gate 	 * We want to avoid outputting unprintable characters that may
2197c478bd9Sstevel@tonic-gate 	 * destroy the user's terminal.  So we do one pass to find any
2207c478bd9Sstevel@tonic-gate 	 * unprintable characters, size the array appropriately, and
2217c478bd9Sstevel@tonic-gate 	 * then walk each character by hand.  Those that are unprintable
2227c478bd9Sstevel@tonic-gate 	 * are replaced by a hex escape (\xNN).  We also escape quotes for
2237c478bd9Sstevel@tonic-gate 	 * completeness.
2247c478bd9Sstevel@tonic-gate 	 */
2257c478bd9Sstevel@tonic-gate 	int i, unprintable, quotes;
2267c478bd9Sstevel@tonic-gate 	size_t len = strlen(s);
2277c478bd9Sstevel@tonic-gate 	for (i = 0, unprintable = 0, quotes = 0; i < len; i++) {
2287c478bd9Sstevel@tonic-gate 		if (!isprint(s[i]))
2297c478bd9Sstevel@tonic-gate 			unprintable++;
2307c478bd9Sstevel@tonic-gate 		if (s[i] == '"')
2317c478bd9Sstevel@tonic-gate 			quotes++;
2327c478bd9Sstevel@tonic-gate 	}
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate 	GROW(len + 3 * unprintable + quotes + 2);
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate 	pri->sys_string[pri->sys_leng++] = '"';
2377c478bd9Sstevel@tonic-gate 	for (i = 0; i < len; i++) {
2387c478bd9Sstevel@tonic-gate 		if (s[i] == '"')
2397c478bd9Sstevel@tonic-gate 			pri->sys_string[pri->sys_leng++] = '\\';
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate 		if (isprint(s[i])) {
2427c478bd9Sstevel@tonic-gate 			pri->sys_string[pri->sys_leng++] = s[i];
2437c478bd9Sstevel@tonic-gate 		} else {
2447c478bd9Sstevel@tonic-gate 			pri->sys_leng += sprintf(pri->sys_string +
245fac3008cSeschrock 			    pri->sys_leng, "\\x%02x", (uint8_t)s[i]);
2467c478bd9Sstevel@tonic-gate 		}
2477c478bd9Sstevel@tonic-gate 	}
2487c478bd9Sstevel@tonic-gate 	pri->sys_string[pri->sys_leng++] = '"';
2497c478bd9Sstevel@tonic-gate }
2507c478bd9Sstevel@tonic-gate 
2517c478bd9Sstevel@tonic-gate void
2527c478bd9Sstevel@tonic-gate prt_stg(private_t *pri, int raw, long val)	/* print as string */
2537c478bd9Sstevel@tonic-gate {
2547c478bd9Sstevel@tonic-gate 	char *s = raw? NULL : fetchstring(pri, (long)val, PATH_MAX);
2557c478bd9Sstevel@tonic-gate 
2567c478bd9Sstevel@tonic-gate 	if (s == NULL)
2577c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
2587c478bd9Sstevel@tonic-gate 	else
2597c478bd9Sstevel@tonic-gate 		escape_string(pri, s);
2607c478bd9Sstevel@tonic-gate }
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /* print as string returned from syscall */
2637c478bd9Sstevel@tonic-gate void
2647c478bd9Sstevel@tonic-gate prt_rst(private_t *pri, int raw, long val)
2657c478bd9Sstevel@tonic-gate {
2667c478bd9Sstevel@tonic-gate 	char *s = (raw || pri->Errno)? NULL :
2677c478bd9Sstevel@tonic-gate 	    fetchstring(pri, (long)val, PATH_MAX);
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate 	if (s == NULL)
2707c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
2717c478bd9Sstevel@tonic-gate 	else {
2727c478bd9Sstevel@tonic-gate 		GROW((int)strlen(s) + 2);
2737c478bd9Sstevel@tonic-gate 		pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
2747c478bd9Sstevel@tonic-gate 		    pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
2757c478bd9Sstevel@tonic-gate 	}
2767c478bd9Sstevel@tonic-gate }
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate /* print contents of readlink() buffer */
2797c478bd9Sstevel@tonic-gate void
2807c478bd9Sstevel@tonic-gate prt_rlk(private_t *pri, int raw, long val)
2817c478bd9Sstevel@tonic-gate {
2827c478bd9Sstevel@tonic-gate 	char *s = (raw || pri->Errno || pri->Rval1 <= 0)? NULL :
2837c478bd9Sstevel@tonic-gate 	    fetchstring(pri, (long)val,
2847c478bd9Sstevel@tonic-gate 	    (pri->Rval1 > PATH_MAX)? PATH_MAX : (int)pri->Rval1);
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate 	if (s == NULL)
2877c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
2887c478bd9Sstevel@tonic-gate 	else {
2897c478bd9Sstevel@tonic-gate 		GROW((int)strlen(s) + 2);
2907c478bd9Sstevel@tonic-gate 		pri->sys_leng += snprintf(pri->sys_string + pri->sys_leng,
2917c478bd9Sstevel@tonic-gate 		    pri->sys_ssize - pri->sys_leng, "\"%s\"", s);
2927c478bd9Sstevel@tonic-gate 	}
2937c478bd9Sstevel@tonic-gate }
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate void
2967c478bd9Sstevel@tonic-gate prt_ioc(private_t *pri, int raw, long val)	/* print ioctl code */
2977c478bd9Sstevel@tonic-gate {
2987c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : ioctlname(pri, (int)val);
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate 	if (s == NULL)
3017c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
3027c478bd9Sstevel@tonic-gate 	else
3037c478bd9Sstevel@tonic-gate 		outstring(pri, s);
3047c478bd9Sstevel@tonic-gate }
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate void
3077c478bd9Sstevel@tonic-gate prt_ioa(private_t *pri, int raw, long val)	/* print ioctl argument */
3087c478bd9Sstevel@tonic-gate {
3097c478bd9Sstevel@tonic-gate 	const char *s;
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate 	/* cheating -- look at the ioctl() code */
3127c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[1]) {
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate 	/* kstat ioctl()s */
3157c478bd9Sstevel@tonic-gate 	case KSTAT_IOC_READ:
3167c478bd9Sstevel@tonic-gate 	case KSTAT_IOC_WRITE:
3177c478bd9Sstevel@tonic-gate #ifdef _LP64
3187c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_ILP32)
3197c478bd9Sstevel@tonic-gate 			prt_stg(pri, raw,
3207c478bd9Sstevel@tonic-gate 			    val + offsetof(kstat32_t, ks_name[0]));
3217c478bd9Sstevel@tonic-gate 		else
3227c478bd9Sstevel@tonic-gate #endif
3237c478bd9Sstevel@tonic-gate 			prt_stg(pri, raw,
3247c478bd9Sstevel@tonic-gate 			    val + offsetof(kstat_t, ks_name[0]));
3257c478bd9Sstevel@tonic-gate 		break;
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate 	/* streams ioctl()s */
3287c478bd9Sstevel@tonic-gate 	case I_LOOK:
3297c478bd9Sstevel@tonic-gate 		prt_rst(pri, raw, val);
3307c478bd9Sstevel@tonic-gate 		break;
3317c478bd9Sstevel@tonic-gate 	case I_PUSH:
3327c478bd9Sstevel@tonic-gate 	case I_FIND:
3337c478bd9Sstevel@tonic-gate 		prt_stg(pri, raw, val);
3347c478bd9Sstevel@tonic-gate 		break;
3357c478bd9Sstevel@tonic-gate 	case I_LINK:
3367c478bd9Sstevel@tonic-gate 	case I_UNLINK:
3377c478bd9Sstevel@tonic-gate 	case I_SENDFD:
3387c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
3397c478bd9Sstevel@tonic-gate 		break;
3407c478bd9Sstevel@tonic-gate 	case I_SRDOPT:
3417c478bd9Sstevel@tonic-gate 		if (raw || (s = strrdopt(val)) == NULL)
3427c478bd9Sstevel@tonic-gate 			prt_dec(pri, 0, val);
3437c478bd9Sstevel@tonic-gate 		else
3447c478bd9Sstevel@tonic-gate 			outstring(pri, s);
3457c478bd9Sstevel@tonic-gate 		break;
3467c478bd9Sstevel@tonic-gate 	case I_SETSIG:
3477c478bd9Sstevel@tonic-gate 		if (raw || (s = strevents(pri, val)) == NULL)
3487c478bd9Sstevel@tonic-gate 			prt_hex(pri, 0, val);
3497c478bd9Sstevel@tonic-gate 		else
3507c478bd9Sstevel@tonic-gate 			outstring(pri, s);
3517c478bd9Sstevel@tonic-gate 		break;
3527c478bd9Sstevel@tonic-gate 	case I_FLUSH:
3537c478bd9Sstevel@tonic-gate 		if (raw || (s = strflush(val)) == NULL)
3547c478bd9Sstevel@tonic-gate 			prt_dec(pri, 0, val);
3557c478bd9Sstevel@tonic-gate 		else
3567c478bd9Sstevel@tonic-gate 			outstring(pri, s);
3577c478bd9Sstevel@tonic-gate 		break;
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate 	/* tty ioctl()s */
3607c478bd9Sstevel@tonic-gate 	case TCSBRK:
3617c478bd9Sstevel@tonic-gate 	case TCXONC:
3627c478bd9Sstevel@tonic-gate 	case TCFLSH:
3637c478bd9Sstevel@tonic-gate 	case TCDSET:
3647c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
3657c478bd9Sstevel@tonic-gate 		break;
3667c478bd9Sstevel@tonic-gate 
3677c478bd9Sstevel@tonic-gate 	default:
3687c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
3697c478bd9Sstevel@tonic-gate 		break;
3707c478bd9Sstevel@tonic-gate 	}
3717c478bd9Sstevel@tonic-gate }
3727c478bd9Sstevel@tonic-gate 
3737c478bd9Sstevel@tonic-gate void
3745dbfd19aSTheo Schlossnagle prt_pip(private_t *pri, int raw, long val)	/* print pipe code */
3755dbfd19aSTheo Schlossnagle {
3765dbfd19aSTheo Schlossnagle 	const char *s = NULL;
3775dbfd19aSTheo Schlossnagle 
3785dbfd19aSTheo Schlossnagle 	if (!raw) {
3795dbfd19aSTheo Schlossnagle 		switch (val) {
3805dbfd19aSTheo Schlossnagle 		case O_CLOEXEC:
3815dbfd19aSTheo Schlossnagle 			s = "O_CLOEXEC";
3825dbfd19aSTheo Schlossnagle 			break;
3835dbfd19aSTheo Schlossnagle 		case O_NONBLOCK:
3845dbfd19aSTheo Schlossnagle 			s = "O_NONBLOCK";
3855dbfd19aSTheo Schlossnagle 			break;
3865dbfd19aSTheo Schlossnagle 		case O_CLOEXEC|O_NONBLOCK:
3875dbfd19aSTheo Schlossnagle 			s = "O_CLOEXEC|O_NONBLOCK";
3885dbfd19aSTheo Schlossnagle 			break;
3895dbfd19aSTheo Schlossnagle 		}
3905dbfd19aSTheo Schlossnagle 	}
3915dbfd19aSTheo Schlossnagle 
3925dbfd19aSTheo Schlossnagle 	if (s == NULL)
3935dbfd19aSTheo Schlossnagle 		prt_dex(pri, 0, val);
3945dbfd19aSTheo Schlossnagle 	else
3955dbfd19aSTheo Schlossnagle 		outstring(pri, s);
3965dbfd19aSTheo Schlossnagle }
3975dbfd19aSTheo Schlossnagle 
3985dbfd19aSTheo Schlossnagle void
3995dbfd19aSTheo Schlossnagle prt_pfd(private_t *pri, int raw, long val)	/* print pipe code */
4005dbfd19aSTheo Schlossnagle {
4015dbfd19aSTheo Schlossnagle 	int fds[2];
4025dbfd19aSTheo Schlossnagle 	char str[32];
4035dbfd19aSTheo Schlossnagle 
4045dbfd19aSTheo Schlossnagle 	/* the fds only have meaning if the return value is 0 */
4055dbfd19aSTheo Schlossnagle 	if (!raw &&
4065dbfd19aSTheo Schlossnagle 	    pri->Rval1 >= 0 &&
4075dbfd19aSTheo Schlossnagle 	    Pread(Proc, fds, sizeof (fds), (long)val) == sizeof (fds)) {
408*5eaceb49STheo Schlossnagle 		(void) snprintf(str, sizeof (str), "[%d,%d]", fds[0], fds[1]);
4095dbfd19aSTheo Schlossnagle 		outstring(pri, str);
4105dbfd19aSTheo Schlossnagle 	} else {
4115dbfd19aSTheo Schlossnagle 		prt_hex(pri, 0, val);
4125dbfd19aSTheo Schlossnagle 	}
4135dbfd19aSTheo Schlossnagle }
4145dbfd19aSTheo Schlossnagle 
4155dbfd19aSTheo Schlossnagle void
4167c478bd9Sstevel@tonic-gate prt_fcn(private_t *pri, int raw, long val)	/* print fcntl code */
4177c478bd9Sstevel@tonic-gate {
4187c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : fcntlname(val);
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate 	if (s == NULL)
4217c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
4227c478bd9Sstevel@tonic-gate 	else
4237c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4247c478bd9Sstevel@tonic-gate }
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate void
4277c478bd9Sstevel@tonic-gate prt_s86(private_t *pri, int raw, long val)	/* print sysi86 code */
4287c478bd9Sstevel@tonic-gate {
4297c478bd9Sstevel@tonic-gate 
4307c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : si86name(val);
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate 	if (s == NULL)
4337c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
4347c478bd9Sstevel@tonic-gate 	else
4357c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4367c478bd9Sstevel@tonic-gate }
4377c478bd9Sstevel@tonic-gate 
4387c478bd9Sstevel@tonic-gate void
4397c478bd9Sstevel@tonic-gate prt_uts(private_t *pri, int raw, long val)	/* print utssys code */
4407c478bd9Sstevel@tonic-gate {
4417c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : utscode(val);
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate 	if (s == NULL)
4447c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
4457c478bd9Sstevel@tonic-gate 	else
4467c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4477c478bd9Sstevel@tonic-gate }
4487c478bd9Sstevel@tonic-gate 
4497c478bd9Sstevel@tonic-gate void
4507c478bd9Sstevel@tonic-gate prt_msc(private_t *pri, int raw, long val)	/* print msgsys command */
4517c478bd9Sstevel@tonic-gate {
4527c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : msgcmd(val);
4537c478bd9Sstevel@tonic-gate 
4547c478bd9Sstevel@tonic-gate 	if (s == NULL)
4557c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
4567c478bd9Sstevel@tonic-gate 	else
4577c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4587c478bd9Sstevel@tonic-gate }
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate void
4617c478bd9Sstevel@tonic-gate prt_msf(private_t *pri, int raw, long val)	/* print msgsys flags */
4627c478bd9Sstevel@tonic-gate {
4637c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : msgflags(pri, (int)val);
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate 	if (s == NULL)
4667c478bd9Sstevel@tonic-gate 		prt_oct(pri, 0, val);
4677c478bd9Sstevel@tonic-gate 	else
4687c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4697c478bd9Sstevel@tonic-gate }
4707c478bd9Sstevel@tonic-gate 
4717c478bd9Sstevel@tonic-gate void
4727c478bd9Sstevel@tonic-gate prt_smc(private_t *pri, int raw, long val)	/* print semsys command */
4737c478bd9Sstevel@tonic-gate {
4747c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : semcmd(val);
4757c478bd9Sstevel@tonic-gate 
4767c478bd9Sstevel@tonic-gate 	if (s == NULL)
4777c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
4787c478bd9Sstevel@tonic-gate 	else
4797c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4807c478bd9Sstevel@tonic-gate }
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate void
4837c478bd9Sstevel@tonic-gate prt_sef(private_t *pri, int raw, long val)	/* print semsys flags */
4847c478bd9Sstevel@tonic-gate {
4857c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : semflags(pri, (int)val);
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate 	if (s == NULL)
4887c478bd9Sstevel@tonic-gate 		prt_oct(pri, 0, val);
4897c478bd9Sstevel@tonic-gate 	else
4907c478bd9Sstevel@tonic-gate 		outstring(pri, s);
4917c478bd9Sstevel@tonic-gate }
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate void
4947c478bd9Sstevel@tonic-gate prt_shc(private_t *pri, int raw, long val)	/* print shmsys command */
4957c478bd9Sstevel@tonic-gate {
4967c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : shmcmd(val);
4977c478bd9Sstevel@tonic-gate 
4987c478bd9Sstevel@tonic-gate 	if (s == NULL)
4997c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
5007c478bd9Sstevel@tonic-gate 	else
5017c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5027c478bd9Sstevel@tonic-gate }
5037c478bd9Sstevel@tonic-gate 
5047c478bd9Sstevel@tonic-gate void
5057c478bd9Sstevel@tonic-gate prt_shf(private_t *pri, int raw, long val)	/* print shmsys flags */
5067c478bd9Sstevel@tonic-gate {
5077c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : shmflags(pri, (int)val);
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate 	if (s == NULL)
5107c478bd9Sstevel@tonic-gate 		prt_oct(pri, 0, val);
5117c478bd9Sstevel@tonic-gate 	else
5127c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5137c478bd9Sstevel@tonic-gate }
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate void
5167c478bd9Sstevel@tonic-gate prt_sfs(private_t *pri, int raw, long val)	/* print sysfs code */
5177c478bd9Sstevel@tonic-gate {
5187c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : sfsname(val);
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate 	if (s == NULL)
5217c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
5227c478bd9Sstevel@tonic-gate 	else
5237c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5247c478bd9Sstevel@tonic-gate }
5257c478bd9Sstevel@tonic-gate 
5267c478bd9Sstevel@tonic-gate void
5277c478bd9Sstevel@tonic-gate prt_opn(private_t *pri, int raw, long val)	/* print open code */
5287c478bd9Sstevel@tonic-gate {
5297c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : openarg(pri, val);
5307c478bd9Sstevel@tonic-gate 
5317c478bd9Sstevel@tonic-gate 	if (s == NULL)
5327c478bd9Sstevel@tonic-gate 		prt_oct(pri, 0, val);
5337c478bd9Sstevel@tonic-gate 	else
5347c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5357c478bd9Sstevel@tonic-gate }
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate void
5385403172aSRoger A. Faulkner prt_sig(private_t *pri, int raw, long val)	/* print signal name */
5397c478bd9Sstevel@tonic-gate {
5405403172aSRoger A. Faulkner 	const char *s = raw? NULL : signame(pri, (int)val);
5417c478bd9Sstevel@tonic-gate 
5427c478bd9Sstevel@tonic-gate 	if (s == NULL)
5437c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
5447c478bd9Sstevel@tonic-gate 	else
5457c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5467c478bd9Sstevel@tonic-gate }
5477c478bd9Sstevel@tonic-gate 
5487c478bd9Sstevel@tonic-gate void
5497c478bd9Sstevel@tonic-gate prt_smf(private_t *pri, int raw, long val) /* print streams message flags */
5507c478bd9Sstevel@tonic-gate {
5517c478bd9Sstevel@tonic-gate 	switch (val) {
5527c478bd9Sstevel@tonic-gate 	case 0:
5537c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
5547c478bd9Sstevel@tonic-gate 		break;
5557c478bd9Sstevel@tonic-gate 	case RS_HIPRI:
5567c478bd9Sstevel@tonic-gate 		if (raw)
5577c478bd9Sstevel@tonic-gate 			prt_hhx(pri, 0, val);
5587c478bd9Sstevel@tonic-gate 		else
5597c478bd9Sstevel@tonic-gate 			outstring(pri, "RS_HIPRI");
5607c478bd9Sstevel@tonic-gate 		break;
5617c478bd9Sstevel@tonic-gate 	default:
5627c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
5637c478bd9Sstevel@tonic-gate 		break;
5647c478bd9Sstevel@tonic-gate 	}
5657c478bd9Sstevel@tonic-gate }
5667c478bd9Sstevel@tonic-gate 
5677c478bd9Sstevel@tonic-gate void
5687c478bd9Sstevel@tonic-gate prt_mtf(private_t *pri, int raw, long val)	/* print mount flags */
5697c478bd9Sstevel@tonic-gate {
5707c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : mountflags(pri, val);
5717c478bd9Sstevel@tonic-gate 
5727c478bd9Sstevel@tonic-gate 	if (s == NULL)
5737c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
5747c478bd9Sstevel@tonic-gate 	else
5757c478bd9Sstevel@tonic-gate 		outstring(pri, s);
5767c478bd9Sstevel@tonic-gate }
5777c478bd9Sstevel@tonic-gate 
5787c478bd9Sstevel@tonic-gate void
5797c478bd9Sstevel@tonic-gate prt_mft(private_t *pri, int raw, long val) /* print mount file system type */
5807c478bd9Sstevel@tonic-gate {
5817c478bd9Sstevel@tonic-gate 	if (val >= 0 && val < 256)
5827c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
5837c478bd9Sstevel@tonic-gate 	else if (raw)
5847c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
5857c478bd9Sstevel@tonic-gate 	else
5867c478bd9Sstevel@tonic-gate 		prt_stg(pri, raw, val);
5877c478bd9Sstevel@tonic-gate }
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate #define	ISREAD(code) \
5907c478bd9Sstevel@tonic-gate 	((code) == SYS_read || (code) == SYS_pread || (code) == SYS_pread64 || \
5917c478bd9Sstevel@tonic-gate 	(code) == SYS_recv || (code) == SYS_recvfrom)
5927c478bd9Sstevel@tonic-gate #define	ISWRITE(code) \
5937c478bd9Sstevel@tonic-gate 	((code) == SYS_write || (code) == SYS_pwrite || \
5947c478bd9Sstevel@tonic-gate 	(code) == SYS_pwrite64 || (code) == SYS_send || (code) == SYS_sendto)
5957c478bd9Sstevel@tonic-gate 
5967c478bd9Sstevel@tonic-gate /* print contents of read() or write() I/O buffer */
5977c478bd9Sstevel@tonic-gate void
5987c478bd9Sstevel@tonic-gate prt_iob(private_t *pri, int raw, long val)
5997c478bd9Sstevel@tonic-gate {
6007c478bd9Sstevel@tonic-gate 	const lwpstatus_t *Lsp = pri->lwpstat;
6017c478bd9Sstevel@tonic-gate 	int syscall = Lsp->pr_what;
6027c478bd9Sstevel@tonic-gate 	int fdp1 = pri->sys_args[0] + 1;
6037c478bd9Sstevel@tonic-gate 	ssize_t nbyte = ISWRITE(syscall)? pri->sys_args[2] :
6047c478bd9Sstevel@tonic-gate 	    (pri->Errno? 0 : pri->Rval1);
6057c478bd9Sstevel@tonic-gate 	int elsewhere = FALSE;		/* TRUE iff dumped elsewhere */
6067c478bd9Sstevel@tonic-gate 	char buffer[IOBSIZE];
6077c478bd9Sstevel@tonic-gate 
6087c478bd9Sstevel@tonic-gate 	pri->iob_buf[0] = '\0';
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate 	if (Lsp->pr_why == PR_SYSEXIT && nbyte > IOBSIZE) {
6117c478bd9Sstevel@tonic-gate 		if (ISREAD(syscall))
6127c478bd9Sstevel@tonic-gate 			elsewhere = prismember(&readfd, fdp1);
6137c478bd9Sstevel@tonic-gate 		else
6147c478bd9Sstevel@tonic-gate 			elsewhere = prismember(&writefd, fdp1);
6157c478bd9Sstevel@tonic-gate 	}
6167c478bd9Sstevel@tonic-gate 
6177c478bd9Sstevel@tonic-gate 	if (nbyte <= 0 || elsewhere)
6187c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
6197c478bd9Sstevel@tonic-gate 	else {
6207c478bd9Sstevel@tonic-gate 		int nb = nbyte > IOBSIZE? IOBSIZE : (int)nbyte;
6217c478bd9Sstevel@tonic-gate 
6227c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)val) != nb)
6237c478bd9Sstevel@tonic-gate 			prt_hex(pri, 0, val);
6247c478bd9Sstevel@tonic-gate 		else {
6257c478bd9Sstevel@tonic-gate 			pri->iob_buf[0] = '"';
6267c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, pri->iob_buf + 1);
6277c478bd9Sstevel@tonic-gate 			(void) strlcat(pri->iob_buf,
6287c478bd9Sstevel@tonic-gate 			    (nb == nbyte)?
6297c478bd9Sstevel@tonic-gate 			    (const char *)"\"" : (const char *)"\"..",
6307c478bd9Sstevel@tonic-gate 			    sizeof (pri->iob_buf));
6317c478bd9Sstevel@tonic-gate 			if (raw)
6327c478bd9Sstevel@tonic-gate 				prt_hex(pri, 0, val);
6337c478bd9Sstevel@tonic-gate 			else
6347c478bd9Sstevel@tonic-gate 				outstring(pri, pri->iob_buf);
6357c478bd9Sstevel@tonic-gate 		}
6367c478bd9Sstevel@tonic-gate 	}
6377c478bd9Sstevel@tonic-gate }
6387c478bd9Sstevel@tonic-gate #undef	ISREAD
6397c478bd9Sstevel@tonic-gate #undef	ISWRITE
6407c478bd9Sstevel@tonic-gate 
6417c478bd9Sstevel@tonic-gate void
6427c478bd9Sstevel@tonic-gate prt_idt(private_t *pri, int raw, long val) /* print idtype_t, waitid() arg */
6437c478bd9Sstevel@tonic-gate {
6447c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : idtype_enum(pri, val);
6457c478bd9Sstevel@tonic-gate 
6467c478bd9Sstevel@tonic-gate 	if (s == NULL)
6477c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
6487c478bd9Sstevel@tonic-gate 	else
6497c478bd9Sstevel@tonic-gate 		outstring(pri, s);
6507c478bd9Sstevel@tonic-gate }
6517c478bd9Sstevel@tonic-gate 
6527c478bd9Sstevel@tonic-gate void
6537c478bd9Sstevel@tonic-gate prt_wop(private_t *pri, int raw, long val)	/* print waitid() options */
6547c478bd9Sstevel@tonic-gate {
6557c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : woptions(pri, (int)val);
6567c478bd9Sstevel@tonic-gate 
6577c478bd9Sstevel@tonic-gate 	if (s == NULL)
6587c478bd9Sstevel@tonic-gate 		prt_oct(pri, 0, val);
6597c478bd9Sstevel@tonic-gate 	else
6607c478bd9Sstevel@tonic-gate 		outstring(pri, s);
6617c478bd9Sstevel@tonic-gate }
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate void
6647c478bd9Sstevel@tonic-gate prt_whn(private_t *pri, int raw, long val) /* print lseek() whence argument */
6657c478bd9Sstevel@tonic-gate {
6667c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : whencearg(val);
6677c478bd9Sstevel@tonic-gate 
6687c478bd9Sstevel@tonic-gate 	if (s == NULL)
6697c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
6707c478bd9Sstevel@tonic-gate 	else
6717c478bd9Sstevel@tonic-gate 		outstring(pri, s);
6727c478bd9Sstevel@tonic-gate }
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate /*ARGSUSED*/
6757c478bd9Sstevel@tonic-gate void
6767c478bd9Sstevel@tonic-gate prt_spm(private_t *pri, int raw, long val)	/* print sigprocmask argument */
6777c478bd9Sstevel@tonic-gate {
6787c478bd9Sstevel@tonic-gate 	const char *s = NULL;
6797c478bd9Sstevel@tonic-gate 
6807c478bd9Sstevel@tonic-gate 	if (!raw) {
6817c478bd9Sstevel@tonic-gate 		switch (val) {
6827c478bd9Sstevel@tonic-gate 		case SIG_BLOCK:		s = "SIG_BLOCK";	break;
6837c478bd9Sstevel@tonic-gate 		case SIG_UNBLOCK:	s = "SIG_UNBLOCK";	break;
6847c478bd9Sstevel@tonic-gate 		case SIG_SETMASK:	s = "SIG_SETMASK";	break;
6857c478bd9Sstevel@tonic-gate 		}
6867c478bd9Sstevel@tonic-gate 	}
6877c478bd9Sstevel@tonic-gate 
6887c478bd9Sstevel@tonic-gate 	if (s == NULL)
6897c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
6907c478bd9Sstevel@tonic-gate 	else
6917c478bd9Sstevel@tonic-gate 		outstring(pri, s);
6927c478bd9Sstevel@tonic-gate }
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate const char *
6957c478bd9Sstevel@tonic-gate mmap_protect(private_t *pri, long arg)
6967c478bd9Sstevel@tonic-gate {
6977c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
6987c478bd9Sstevel@tonic-gate 
6997c478bd9Sstevel@tonic-gate 	if (arg & ~(PROT_READ|PROT_WRITE|PROT_EXEC))
7007c478bd9Sstevel@tonic-gate 		return ((char *)NULL);
7017c478bd9Sstevel@tonic-gate 
7027c478bd9Sstevel@tonic-gate 	if (arg == PROT_NONE)
7037c478bd9Sstevel@tonic-gate 		return ("PROT_NONE");
7047c478bd9Sstevel@tonic-gate 
7057c478bd9Sstevel@tonic-gate 	*str = '\0';
7067c478bd9Sstevel@tonic-gate 	if (arg & PROT_READ)
7077c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|PROT_READ", sizeof (pri->code_buf));
7087c478bd9Sstevel@tonic-gate 	if (arg & PROT_WRITE)
7097c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|PROT_WRITE", sizeof (pri->code_buf));
7107c478bd9Sstevel@tonic-gate 	if (arg & PROT_EXEC)
7117c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|PROT_EXEC", sizeof (pri->code_buf));
7127c478bd9Sstevel@tonic-gate 	return ((const char *)(str + 1));
7137c478bd9Sstevel@tonic-gate }
7147c478bd9Sstevel@tonic-gate 
7157c478bd9Sstevel@tonic-gate const char *
7167c478bd9Sstevel@tonic-gate mmap_type(private_t *pri, long arg)
7177c478bd9Sstevel@tonic-gate {
7187c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
7197c478bd9Sstevel@tonic-gate 	size_t used;
7207c478bd9Sstevel@tonic-gate 
7217c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
7227c478bd9Sstevel@tonic-gate 	switch (arg & MAP_TYPE) {
7237c478bd9Sstevel@tonic-gate 	case MAP_SHARED:
7247c478bd9Sstevel@tonic-gate 		used = strlcpy(str, "MAP_SHARED", CBSIZE);
7257c478bd9Sstevel@tonic-gate 		break;
7267c478bd9Sstevel@tonic-gate 	case MAP_PRIVATE:
7277c478bd9Sstevel@tonic-gate 		used = strlcpy(str, "MAP_PRIVATE", CBSIZE);
7287c478bd9Sstevel@tonic-gate 		break;
7297c478bd9Sstevel@tonic-gate 	default:
7307c478bd9Sstevel@tonic-gate 		used = snprintf(str, CBSIZE, "%ld", arg&MAP_TYPE);
7317c478bd9Sstevel@tonic-gate 		break;
7327c478bd9Sstevel@tonic-gate 	}
7337c478bd9Sstevel@tonic-gate 
7347c478bd9Sstevel@tonic-gate 	arg &= ~(_MAP_NEW|MAP_TYPE);
7357c478bd9Sstevel@tonic-gate 
7367c478bd9Sstevel@tonic-gate 	if (arg & ~(MAP_FIXED|MAP_RENAME|MAP_NORESERVE|MAP_ANON|MAP_ALIGN|
7377c478bd9Sstevel@tonic-gate 	    MAP_TEXT|MAP_INITDATA))
7387c478bd9Sstevel@tonic-gate 		(void) snprintf(str + used, sizeof (pri->code_buf) - used,
7397c478bd9Sstevel@tonic-gate 		    "|0x%lX", arg);
7407c478bd9Sstevel@tonic-gate 	else {
7417c478bd9Sstevel@tonic-gate 		if (arg & MAP_FIXED)
7427c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_FIXED", CBSIZE);
7437c478bd9Sstevel@tonic-gate 		if (arg & MAP_RENAME)
7447c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_RENAME", CBSIZE);
7457c478bd9Sstevel@tonic-gate 		if (arg & MAP_NORESERVE)
7467c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_NORESERVE", CBSIZE);
7477c478bd9Sstevel@tonic-gate 		if (arg & MAP_ANON)
7487c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_ANON", CBSIZE);
7497c478bd9Sstevel@tonic-gate 		if (arg & MAP_ALIGN)
7507c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_ALIGN", CBSIZE);
7517c478bd9Sstevel@tonic-gate 		if (arg & MAP_TEXT)
7527c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_TEXT", CBSIZE);
7537c478bd9Sstevel@tonic-gate 		if (arg & MAP_INITDATA)
7547c478bd9Sstevel@tonic-gate 			(void) strlcat(str, "|MAP_INITDATA", CBSIZE);
7557c478bd9Sstevel@tonic-gate 	}
7567c478bd9Sstevel@tonic-gate 
7577c478bd9Sstevel@tonic-gate 	return ((const char *)str);
7587c478bd9Sstevel@tonic-gate #undef CBSIZE
7597c478bd9Sstevel@tonic-gate }
7607c478bd9Sstevel@tonic-gate 
7617c478bd9Sstevel@tonic-gate void
7627c478bd9Sstevel@tonic-gate prt_mpr(private_t *pri, int raw, long val) /* print mmap()/mprotect() flags */
7637c478bd9Sstevel@tonic-gate {
7647c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : mmap_protect(pri, val);
7657c478bd9Sstevel@tonic-gate 
7667c478bd9Sstevel@tonic-gate 	if (s == NULL)
7677c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
7687c478bd9Sstevel@tonic-gate 	else
7697c478bd9Sstevel@tonic-gate 		outstring(pri, s);
7707c478bd9Sstevel@tonic-gate }
7717c478bd9Sstevel@tonic-gate 
7727c478bd9Sstevel@tonic-gate void
7737c478bd9Sstevel@tonic-gate prt_mty(private_t *pri, int raw, long val) /* print mmap() mapping type flags */
7747c478bd9Sstevel@tonic-gate {
7757c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : mmap_type(pri, val);
7767c478bd9Sstevel@tonic-gate 
7777c478bd9Sstevel@tonic-gate 	if (s == NULL)
7787c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
7797c478bd9Sstevel@tonic-gate 	else
7807c478bd9Sstevel@tonic-gate 		outstring(pri, s);
7817c478bd9Sstevel@tonic-gate }
7827c478bd9Sstevel@tonic-gate 
783bcddb677SAli Bahrami void
784bcddb677SAli Bahrami prt_mob(private_t *pri, int raw, long val) /* print mmapobj() flags */
785bcddb677SAli Bahrami {
786bcddb677SAli Bahrami 	if (val == 0)
787bcddb677SAli Bahrami 		prt_dec(pri, 0, val);
788bcddb677SAli Bahrami 	else if (raw || (val & ~(MMOBJ_PADDING|MMOBJ_INTERPRET)) != 0)
789bcddb677SAli Bahrami 		prt_hhx(pri, 0, val);
790bcddb677SAli Bahrami 	else {
791bcddb677SAli Bahrami #define	CBSIZE	sizeof (pri->code_buf)
792bcddb677SAli Bahrami 		char *s = pri->code_buf;
793bcddb677SAli Bahrami 
794bcddb677SAli Bahrami 		*s = '\0';
795bcddb677SAli Bahrami 		if (val & MMOBJ_PADDING)
796bcddb677SAli Bahrami 			(void) strlcat(s, "|MMOBJ_PADDING", CBSIZE);
797bcddb677SAli Bahrami 		if (val & MMOBJ_INTERPRET)
798bcddb677SAli Bahrami 			(void) strlcat(s, "|MMOBJ_INTERPRET", CBSIZE);
799bcddb677SAli Bahrami 		outstring(pri, s + 1);
800bcddb677SAli Bahrami #undef CBSIZE
801bcddb677SAli Bahrami 	}
802bcddb677SAli Bahrami }
803bcddb677SAli Bahrami 
8047c478bd9Sstevel@tonic-gate /*ARGSUSED*/
8057c478bd9Sstevel@tonic-gate void
8067c478bd9Sstevel@tonic-gate prt_mcf(private_t *pri, int raw, long val)	/* print memcntl() function */
8077c478bd9Sstevel@tonic-gate {
8087c478bd9Sstevel@tonic-gate 	const char *s = NULL;
8097c478bd9Sstevel@tonic-gate 
8107c478bd9Sstevel@tonic-gate 	if (!raw) {
8117c478bd9Sstevel@tonic-gate 		switch (val) {
8127c478bd9Sstevel@tonic-gate 		case MC_SYNC:		s = "MC_SYNC";		break;
8137c478bd9Sstevel@tonic-gate 		case MC_LOCK:		s = "MC_LOCK";		break;
8147c478bd9Sstevel@tonic-gate 		case MC_UNLOCK:		s = "MC_UNLOCK";	break;
8157c478bd9Sstevel@tonic-gate 		case MC_ADVISE:		s = "MC_ADVISE";	break;
8167c478bd9Sstevel@tonic-gate 		case MC_LOCKAS:		s = "MC_LOCKAS";	break;
8177c478bd9Sstevel@tonic-gate 		case MC_UNLOCKAS:	s = "MC_UNLOCKAS";	break;
8187c478bd9Sstevel@tonic-gate 		case MC_HAT_ADVISE:	s = "MC_HAT_ADVISE";	break;
8197c478bd9Sstevel@tonic-gate 		}
8207c478bd9Sstevel@tonic-gate 	}
8217c478bd9Sstevel@tonic-gate 
8227c478bd9Sstevel@tonic-gate 	if (s == NULL)
8237c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
8247c478bd9Sstevel@tonic-gate 	else
8257c478bd9Sstevel@tonic-gate 		outstring(pri, s);
8267c478bd9Sstevel@tonic-gate }
8277c478bd9Sstevel@tonic-gate 
8287c478bd9Sstevel@tonic-gate void
8297c478bd9Sstevel@tonic-gate prt_mad(private_t *pri, int raw, long val)	/* print madvise() argument */
8307c478bd9Sstevel@tonic-gate {
8317c478bd9Sstevel@tonic-gate 	const char *s = NULL;
8327c478bd9Sstevel@tonic-gate 
8337c478bd9Sstevel@tonic-gate 	if (!raw) {
8347c478bd9Sstevel@tonic-gate 		switch (val) {
8357c478bd9Sstevel@tonic-gate 		case MADV_NORMAL:	s = "MADV_NORMAL";	break;
8367c478bd9Sstevel@tonic-gate 		case MADV_RANDOM:	s = "MADV_RANDOM";	break;
8377c478bd9Sstevel@tonic-gate 		case MADV_SEQUENTIAL:	s = "MADV_SEQUENTIAL";	break;
8387c478bd9Sstevel@tonic-gate 		case MADV_WILLNEED:	s = "MADV_WILLNEED";	break;
8397c478bd9Sstevel@tonic-gate 		case MADV_DONTNEED:	s = "MADV_DONTNEED";	break;
8407c478bd9Sstevel@tonic-gate 		case MADV_FREE:		s = "MADV_FREE";	break;
8417c478bd9Sstevel@tonic-gate 		case MADV_ACCESS_DEFAULT: s = "MADV_ACCESS_DEFAULT";	break;
8427c478bd9Sstevel@tonic-gate 		case MADV_ACCESS_LWP:	s = "MADV_ACCESS_LWP";	break;
8437c478bd9Sstevel@tonic-gate 		case MADV_ACCESS_MANY:	s = "MADV_ACCESS_MANY";	break;
8447c478bd9Sstevel@tonic-gate 		}
8457c478bd9Sstevel@tonic-gate 	}
8467c478bd9Sstevel@tonic-gate 
8477c478bd9Sstevel@tonic-gate 	if (s == NULL)
8487c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
8497c478bd9Sstevel@tonic-gate 	else
8507c478bd9Sstevel@tonic-gate 		outstring(pri, s);
8517c478bd9Sstevel@tonic-gate }
8527c478bd9Sstevel@tonic-gate 
8537c478bd9Sstevel@tonic-gate void
8547c478bd9Sstevel@tonic-gate prt_mc4(private_t *pri, int raw, long val) /* print memcntl() (4th) argument */
8557c478bd9Sstevel@tonic-gate {
8567c478bd9Sstevel@tonic-gate 	if (val == 0)
8577c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
8587c478bd9Sstevel@tonic-gate 	else if (raw)
8597c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
8607c478bd9Sstevel@tonic-gate 	else {
8617c478bd9Sstevel@tonic-gate 		char *s = NULL;
8627c478bd9Sstevel@tonic-gate 
8637c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
8647c478bd9Sstevel@tonic-gate 		/* cheating -- look at memcntl func */
8657c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
8667c478bd9Sstevel@tonic-gate 		case MC_ADVISE:
8677c478bd9Sstevel@tonic-gate 			prt_mad(pri, 0, val);
8687c478bd9Sstevel@tonic-gate 			return;
8697c478bd9Sstevel@tonic-gate 
8707c478bd9Sstevel@tonic-gate 		case MC_SYNC:
8717c478bd9Sstevel@tonic-gate 			if ((val & ~(MS_SYNC|MS_ASYNC|MS_INVALIDATE)) == 0) {
8727c478bd9Sstevel@tonic-gate 				*(s = pri->code_buf) = '\0';
8737c478bd9Sstevel@tonic-gate 				if (val & MS_SYNC)
8747c478bd9Sstevel@tonic-gate 					(void) strlcat(s, "|MS_SYNC", CBSIZE);
8757c478bd9Sstevel@tonic-gate 				if (val & MS_ASYNC)
8767c478bd9Sstevel@tonic-gate 					(void) strlcat(s, "|MS_ASYNC", CBSIZE);
8777c478bd9Sstevel@tonic-gate 				if (val & MS_INVALIDATE)
8787c478bd9Sstevel@tonic-gate 					(void) strlcat(s, "|MS_INVALIDATE",
8797c478bd9Sstevel@tonic-gate 					    CBSIZE);
8807c478bd9Sstevel@tonic-gate 			}
8817c478bd9Sstevel@tonic-gate 			break;
8827c478bd9Sstevel@tonic-gate 
8837c478bd9Sstevel@tonic-gate 		case MC_LOCKAS:
8847c478bd9Sstevel@tonic-gate 		case MC_UNLOCKAS:
8857c478bd9Sstevel@tonic-gate 			if ((val & ~(MCL_CURRENT|MCL_FUTURE)) == 0) {
8867c478bd9Sstevel@tonic-gate 				*(s = pri->code_buf) = '\0';
8877c478bd9Sstevel@tonic-gate 				if (val & MCL_CURRENT)
8887c478bd9Sstevel@tonic-gate 					(void) strlcat(s, "|MCL_CURRENT",
8897c478bd9Sstevel@tonic-gate 					    CBSIZE);
8907c478bd9Sstevel@tonic-gate 				if (val & MCL_FUTURE)
8917c478bd9Sstevel@tonic-gate 					(void) strlcat(s, "|MCL_FUTURE",
8927c478bd9Sstevel@tonic-gate 					    CBSIZE);
8937c478bd9Sstevel@tonic-gate 			}
8947c478bd9Sstevel@tonic-gate 			break;
8957c478bd9Sstevel@tonic-gate 		}
8967c478bd9Sstevel@tonic-gate #undef CBSIZE
8977c478bd9Sstevel@tonic-gate 
8987c478bd9Sstevel@tonic-gate 		if (s == NULL || *s == '\0')
8997c478bd9Sstevel@tonic-gate 			prt_hhx(pri, 0, val);
9007c478bd9Sstevel@tonic-gate 		else
9017c478bd9Sstevel@tonic-gate 			outstring(pri, ++s);
9027c478bd9Sstevel@tonic-gate 	}
9037c478bd9Sstevel@tonic-gate }
9047c478bd9Sstevel@tonic-gate 
9057c478bd9Sstevel@tonic-gate void
9067c478bd9Sstevel@tonic-gate prt_mc5(private_t *pri, int raw, long val) /* print memcntl() (5th) argument */
9077c478bd9Sstevel@tonic-gate {
9087c478bd9Sstevel@tonic-gate 	char *s;
9097c478bd9Sstevel@tonic-gate 
9107c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
9117c478bd9Sstevel@tonic-gate 	if (val == 0)
9127c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
9137c478bd9Sstevel@tonic-gate 	else if (raw || (val & ~VALID_ATTR))
9147c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
9157c478bd9Sstevel@tonic-gate 	else {
9167c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
9177c478bd9Sstevel@tonic-gate 		*s = '\0';
9187c478bd9Sstevel@tonic-gate 		if (val & SHARED)
9197c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|SHARED", CBSIZE);
9207c478bd9Sstevel@tonic-gate 		if (val & PRIVATE)
9217c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|PRIVATE", CBSIZE);
9227c478bd9Sstevel@tonic-gate 		if (val & PROT_READ)
9237c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|PROT_READ", CBSIZE);
9247c478bd9Sstevel@tonic-gate 		if (val & PROT_WRITE)
9257c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|PROT_WRITE", CBSIZE);
9267c478bd9Sstevel@tonic-gate 		if (val & PROT_EXEC)
9277c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|PROT_EXEC", CBSIZE);
9287c478bd9Sstevel@tonic-gate 		if (*s == '\0')
9297c478bd9Sstevel@tonic-gate 			prt_hhx(pri, 0, val);
9307c478bd9Sstevel@tonic-gate 		else
9317c478bd9Sstevel@tonic-gate 			outstring(pri, ++s);
9327c478bd9Sstevel@tonic-gate 	}
9337c478bd9Sstevel@tonic-gate #undef CBSIZE
9347c478bd9Sstevel@tonic-gate }
9357c478bd9Sstevel@tonic-gate 
9367c478bd9Sstevel@tonic-gate void
9377c478bd9Sstevel@tonic-gate prt_ulm(private_t *pri, int raw, long val)	/* print ulimit() argument */
9387c478bd9Sstevel@tonic-gate {
9397c478bd9Sstevel@tonic-gate 	const char *s = NULL;
9407c478bd9Sstevel@tonic-gate 
9417c478bd9Sstevel@tonic-gate 	if (!raw) {
9427c478bd9Sstevel@tonic-gate 		switch (val) {
9437c478bd9Sstevel@tonic-gate 		case UL_GFILLIM:	s = "UL_GFILLIM";	break;
9447c478bd9Sstevel@tonic-gate 		case UL_SFILLIM:	s = "UL_SFILLIM";	break;
9457c478bd9Sstevel@tonic-gate 		case UL_GMEMLIM:	s = "UL_GMEMLIM";	break;
9467c478bd9Sstevel@tonic-gate 		case UL_GDESLIM:	s = "UL_GDESLIM";	break;
9477c478bd9Sstevel@tonic-gate 		}
9487c478bd9Sstevel@tonic-gate 	}
9497c478bd9Sstevel@tonic-gate 
9507c478bd9Sstevel@tonic-gate 	if (s == NULL)
9517c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
9527c478bd9Sstevel@tonic-gate 	else
9537c478bd9Sstevel@tonic-gate 		outstring(pri, s);
9547c478bd9Sstevel@tonic-gate }
9557c478bd9Sstevel@tonic-gate 
9567c478bd9Sstevel@tonic-gate void
9577c478bd9Sstevel@tonic-gate prt_rlm(private_t *pri, int raw, long val) /* print get/setrlimit() argument */
9587c478bd9Sstevel@tonic-gate {
9597c478bd9Sstevel@tonic-gate 	const char *s = NULL;
9607c478bd9Sstevel@tonic-gate 
9617c478bd9Sstevel@tonic-gate 	if (!raw) {
9627c478bd9Sstevel@tonic-gate 		switch (val) {
9637c478bd9Sstevel@tonic-gate 		case RLIMIT_CPU:	s = "RLIMIT_CPU";	break;
9647c478bd9Sstevel@tonic-gate 		case RLIMIT_FSIZE:	s = "RLIMIT_FSIZE";	break;
9657c478bd9Sstevel@tonic-gate 		case RLIMIT_DATA:	s = "RLIMIT_DATA";	break;
9667c478bd9Sstevel@tonic-gate 		case RLIMIT_STACK:	s = "RLIMIT_STACK";	break;
9677c478bd9Sstevel@tonic-gate 		case RLIMIT_CORE:	s = "RLIMIT_CORE";	break;
9687c478bd9Sstevel@tonic-gate 		case RLIMIT_NOFILE:	s = "RLIMIT_NOFILE";	break;
9697c478bd9Sstevel@tonic-gate 		case RLIMIT_VMEM:	s = "RLIMIT_VMEM";	break;
9707c478bd9Sstevel@tonic-gate 		}
9717c478bd9Sstevel@tonic-gate 	}
9727c478bd9Sstevel@tonic-gate 
9737c478bd9Sstevel@tonic-gate 	if (s == NULL)
9747c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
9757c478bd9Sstevel@tonic-gate 	else
9767c478bd9Sstevel@tonic-gate 		outstring(pri, s);
9777c478bd9Sstevel@tonic-gate }
9787c478bd9Sstevel@tonic-gate 
9797c478bd9Sstevel@tonic-gate void
9807c478bd9Sstevel@tonic-gate prt_cnf(private_t *pri, int raw, long val)	/* print sysconfig code */
9817c478bd9Sstevel@tonic-gate {
9827c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : sconfname(val);
9837c478bd9Sstevel@tonic-gate 
9847c478bd9Sstevel@tonic-gate 	if (s == NULL)
9857c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
9867c478bd9Sstevel@tonic-gate 	else
9877c478bd9Sstevel@tonic-gate 		outstring(pri, s);
9887c478bd9Sstevel@tonic-gate }
9897c478bd9Sstevel@tonic-gate 
9907c478bd9Sstevel@tonic-gate void
9917c478bd9Sstevel@tonic-gate prt_inf(private_t *pri, int raw, long val)	/* print sysinfo code */
9927c478bd9Sstevel@tonic-gate {
9937c478bd9Sstevel@tonic-gate 	const char *s = NULL;
9947c478bd9Sstevel@tonic-gate 
9957c478bd9Sstevel@tonic-gate 	if (!raw) {
9967c478bd9Sstevel@tonic-gate 		switch (val) {
9977c478bd9Sstevel@tonic-gate 		case SI_SYSNAME:	s = "SI_SYSNAME";	break;
9987c478bd9Sstevel@tonic-gate 		case SI_HOSTNAME:	s = "SI_HOSTNAME";	break;
9997c478bd9Sstevel@tonic-gate 		case SI_RELEASE:	s = "SI_RELEASE";	break;
10007c478bd9Sstevel@tonic-gate 		case SI_VERSION:	s = "SI_VERSION";	break;
10017c478bd9Sstevel@tonic-gate 		case SI_MACHINE:	s = "SI_MACHINE";	break;
10027c478bd9Sstevel@tonic-gate 		case SI_ARCHITECTURE:	s = "SI_ARCHITECTURE";	break;
10037c478bd9Sstevel@tonic-gate 		case SI_ARCHITECTURE_32:s = "SI_ARCHITECTURE_32"; break;
10047c478bd9Sstevel@tonic-gate 		case SI_ARCHITECTURE_64:s = "SI_ARCHITECTURE_64"; break;
10057c478bd9Sstevel@tonic-gate 		case SI_ARCHITECTURE_K:	s = "SI_ARCHITECTURE_K"; break;
10067c478bd9Sstevel@tonic-gate 		case SI_HW_SERIAL:	s = "SI_HW_SERIAL";	break;
10077c478bd9Sstevel@tonic-gate 		case SI_HW_PROVIDER:	s = "SI_HW_PROVIDER";	break;
10087c478bd9Sstevel@tonic-gate 		case SI_SRPC_DOMAIN:	s = "SI_SRPC_DOMAIN";	break;
10097c478bd9Sstevel@tonic-gate 		case SI_SET_HOSTNAME:	s = "SI_SET_HOSTNAME";	break;
10107c478bd9Sstevel@tonic-gate 		case SI_SET_SRPC_DOMAIN: s = "SI_SET_SRPC_DOMAIN"; break;
10117c478bd9Sstevel@tonic-gate 		case SI_PLATFORM:	s = "SI_PLATFORM";	break;
10127c478bd9Sstevel@tonic-gate 		case SI_ISALIST:	s = "SI_ISALIST";	break;
10137c478bd9Sstevel@tonic-gate 		case SI_DHCP_CACHE:	s = "SI_DHCP_CACHE";	break;
10147c478bd9Sstevel@tonic-gate 		}
10157c478bd9Sstevel@tonic-gate 	}
10167c478bd9Sstevel@tonic-gate 
10177c478bd9Sstevel@tonic-gate 	if (s == NULL)
10187c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
10197c478bd9Sstevel@tonic-gate 	else
10207c478bd9Sstevel@tonic-gate 		outstring(pri, s);
10217c478bd9Sstevel@tonic-gate }
10227c478bd9Sstevel@tonic-gate 
10237c478bd9Sstevel@tonic-gate void
10247c478bd9Sstevel@tonic-gate prt_ptc(private_t *pri, int raw, long val)	/* print pathconf code */
10257c478bd9Sstevel@tonic-gate {
10267c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : pathconfname(val);
10277c478bd9Sstevel@tonic-gate 
10287c478bd9Sstevel@tonic-gate 	if (s == NULL)
10297c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
10307c478bd9Sstevel@tonic-gate 	else
10317c478bd9Sstevel@tonic-gate 		outstring(pri, s);
10327c478bd9Sstevel@tonic-gate }
10337c478bd9Sstevel@tonic-gate 
10347c478bd9Sstevel@tonic-gate void
10357c478bd9Sstevel@tonic-gate prt_fui(private_t *pri, int raw, long val) /* print fusers() input argument */
10367c478bd9Sstevel@tonic-gate {
10377c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : fuiname(val);
10387c478bd9Sstevel@tonic-gate 
10397c478bd9Sstevel@tonic-gate 	if (s == NULL)
10407c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
10417c478bd9Sstevel@tonic-gate 	else
10427c478bd9Sstevel@tonic-gate 		outstring(pri, s);
10437c478bd9Sstevel@tonic-gate }
10447c478bd9Sstevel@tonic-gate 
10457c478bd9Sstevel@tonic-gate void
10467c478bd9Sstevel@tonic-gate prt_lwf(private_t *pri, int raw, long val)	/* print lwp_create() flags */
10477c478bd9Sstevel@tonic-gate {
10487c478bd9Sstevel@tonic-gate 	char *s;
10497c478bd9Sstevel@tonic-gate 
10507c478bd9Sstevel@tonic-gate 	if (val == 0)
10517c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
10527c478bd9Sstevel@tonic-gate 	else if (raw ||
10537c478bd9Sstevel@tonic-gate 	    (val & ~(LWP_DAEMON|LWP_DETACHED|LWP_SUSPENDED)))
10547c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
10557c478bd9Sstevel@tonic-gate 	else {
10567c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
10577c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
10587c478bd9Sstevel@tonic-gate 		*s = '\0';
10597c478bd9Sstevel@tonic-gate 		if (val & LWP_DAEMON)
10607c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|LWP_DAEMON", CBSIZE);
10617c478bd9Sstevel@tonic-gate 		if (val & LWP_DETACHED)
10627c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|LWP_DETACHED", CBSIZE);
10637c478bd9Sstevel@tonic-gate 		if (val & LWP_SUSPENDED)
10647c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|LWP_SUSPENDED", CBSIZE);
10657c478bd9Sstevel@tonic-gate 		outstring(pri, ++s);
10667c478bd9Sstevel@tonic-gate #undef CBSIZE
10677c478bd9Sstevel@tonic-gate 	}
10687c478bd9Sstevel@tonic-gate }
10697c478bd9Sstevel@tonic-gate 
10707c478bd9Sstevel@tonic-gate void
10717c478bd9Sstevel@tonic-gate prt_itm(private_t *pri, int raw, long val) /* print [get|set]itimer() arg */
10727c478bd9Sstevel@tonic-gate {
10737c478bd9Sstevel@tonic-gate 	const char *s = NULL;
10747c478bd9Sstevel@tonic-gate 
10757c478bd9Sstevel@tonic-gate 	if (!raw) {
10767c478bd9Sstevel@tonic-gate 		switch (val) {
10777c478bd9Sstevel@tonic-gate 		case ITIMER_REAL:	s = "ITIMER_REAL";	break;
10787c478bd9Sstevel@tonic-gate 		case ITIMER_VIRTUAL:	s = "ITIMER_VIRTUAL";	break;
10797c478bd9Sstevel@tonic-gate 		case ITIMER_PROF:	s = "ITIMER_PROF";	break;
10807c478bd9Sstevel@tonic-gate #ifdef ITIMER_REALPROF
10817c478bd9Sstevel@tonic-gate 		case ITIMER_REALPROF:	s = "ITIMER_REALPROF";	break;
10827c478bd9Sstevel@tonic-gate #endif
10837c478bd9Sstevel@tonic-gate 		}
10847c478bd9Sstevel@tonic-gate 	}
10857c478bd9Sstevel@tonic-gate 
10867c478bd9Sstevel@tonic-gate 	if (s == NULL)
10877c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
10887c478bd9Sstevel@tonic-gate 	else
10897c478bd9Sstevel@tonic-gate 		outstring(pri, s);
10907c478bd9Sstevel@tonic-gate }
10917c478bd9Sstevel@tonic-gate 
10927c478bd9Sstevel@tonic-gate void
10937c478bd9Sstevel@tonic-gate prt_mod(private_t *pri, int raw, long val)	/* print modctl() code */
10947c478bd9Sstevel@tonic-gate {
10957c478bd9Sstevel@tonic-gate 	const char *s = NULL;
10967c478bd9Sstevel@tonic-gate 
10977c478bd9Sstevel@tonic-gate 	if (!raw) {
10987c478bd9Sstevel@tonic-gate 		switch (val) {
10997c478bd9Sstevel@tonic-gate 		case MODLOAD:		s = "MODLOAD";		break;
11007c478bd9Sstevel@tonic-gate 		case MODUNLOAD:		s = "MODUNLOAD";	break;
11017c478bd9Sstevel@tonic-gate 		case MODINFO:		s = "MODINFO";		break;
11027c478bd9Sstevel@tonic-gate 		case MODRESERVED:	s = "MODRESERVED";	break;
11037c478bd9Sstevel@tonic-gate 		case MODSETMINIROOT:	s = "MODSETMINIROOT";	break;
11047c478bd9Sstevel@tonic-gate 		case MODADDMAJBIND:	s = "MODADDMAJBIND";	break;
11057c478bd9Sstevel@tonic-gate 		case MODGETPATH:	s = "MODGETPATH";	break;
11067c478bd9Sstevel@tonic-gate 		case MODGETPATHLEN:	s = "MODGETPATHLEN";	break;
11077c478bd9Sstevel@tonic-gate 		case MODREADSYSBIND:	s = "MODREADSYSBIND";	break;
11087c478bd9Sstevel@tonic-gate 		case MODGETMAJBIND:	s = "MODGETMAJBIND";	break;
11097c478bd9Sstevel@tonic-gate 		case MODGETNAME:	s = "MODGETNAME";	break;
11107c478bd9Sstevel@tonic-gate 		case MODSIZEOF_DEVID:	s = "MODSIZEOF_DEVID";	break;
11117c478bd9Sstevel@tonic-gate 		case MODGETDEVID:	s = "MODGETDEVID";	break;
11127c478bd9Sstevel@tonic-gate 		case MODSIZEOF_MINORNAME: s = "MODSIZEOF_MINORNAME"; break;
11137c478bd9Sstevel@tonic-gate 		case MODGETMINORNAME:	s = "MODGETMINORNAME";	break;
11147c478bd9Sstevel@tonic-gate 		case MODGETFBNAME:	s = "MODGETFBNAME";	break;
11157c478bd9Sstevel@tonic-gate 		case MODEVENTS:		s = "MODEVENTS";	break;
11167c478bd9Sstevel@tonic-gate 		case MODREREADDACF:	s = "MODREREADDACF";	break;
11177c478bd9Sstevel@tonic-gate 		case MODLOADDRVCONF:	s = "MODLOADDRVCONF";	break;
11187c478bd9Sstevel@tonic-gate 		case MODUNLOADDRVCONF:	s = "MODUNLOADDRVCONF";	break;
11197c478bd9Sstevel@tonic-gate 		case MODREMMAJBIND:	s = "MODREMMAJBIND";	break;
11207c478bd9Sstevel@tonic-gate 		case MODDEVT2INSTANCE:	s = "MODDEVT2INSTANCE";	break;
11217c478bd9Sstevel@tonic-gate 		case MODGETDEVFSPATH_LEN: s = "MODGETDEVFSPATH_LEN"; break;
11227c478bd9Sstevel@tonic-gate 		case MODGETDEVFSPATH:	s = "MODGETDEVFSPATH";	break;
11237c478bd9Sstevel@tonic-gate 		case MODDEVID2PATHS:	s = "MODDEVID2PATHS";	break;
11247c478bd9Sstevel@tonic-gate 		case MODSETDEVPOLICY:	s = "MODSETDEVPOLICY";	break;
11257c478bd9Sstevel@tonic-gate 		case MODGETDEVPOLICY:	s = "MODGETDEVPOLICY";	break;
11267c478bd9Sstevel@tonic-gate 		case MODALLOCPRIV:	s = "MODALLOCPRIV";	break;
11277c478bd9Sstevel@tonic-gate 		case MODGETDEVPOLICYBYNAME:
11287c478bd9Sstevel@tonic-gate 					s = "MODGETDEVPOLICYBYNAME"; break;
11297c478bd9Sstevel@tonic-gate 		case MODLOADMINORPERM:	s = "MODLOADMINORPERM"; break;
11307c478bd9Sstevel@tonic-gate 		case MODADDMINORPERM:	s = "MODADDMINORPERM"; break;
11317c478bd9Sstevel@tonic-gate 		case MODREMMINORPERM:	s = "MODREMMINORPERM"; break;
11327c478bd9Sstevel@tonic-gate 		case MODREMDRVCLEANUP:	s = "MODREMDRVCLEANUP"; break;
1133facf4a8dSllai1 		case MODDEVEXISTS:	s = "MODDEVEXISTS"; break;
1134facf4a8dSllai1 		case MODDEVREADDIR:	s = "MODDEVREADDIR"; break;
1135e37c6c37Scth 		case MODDEVEMPTYDIR:	s = "MODDEVEMPTYDIR"; break;
1136facf4a8dSllai1 		case MODDEVNAME:	s = "MODDEVNAME"; break;
1137a08731ecScth 		case MODGETDEVFSPATH_MI_LEN:
1138a08731ecScth 					s = "MODGETDEVFSPATH_MI_LEN"; break;
1139a08731ecScth 		case MODGETDEVFSPATH_MI:
1140a08731ecScth 					s = "MODGETDEVFSPATH_MI"; break;
11416532b960SJerry Gilliam 		case MODREMDRVALIAS:	s = "MODREMDRVALIAS"; break;
114226947304SEvan Yan 		case MODHPOPS:	s = "MODHPOPS"; break;
11437c478bd9Sstevel@tonic-gate 		}
11447c478bd9Sstevel@tonic-gate 	}
11457c478bd9Sstevel@tonic-gate 
11467c478bd9Sstevel@tonic-gate 	if (s == NULL)
11477c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
11487c478bd9Sstevel@tonic-gate 	else
11497c478bd9Sstevel@tonic-gate 		outstring(pri, s);
11507c478bd9Sstevel@tonic-gate }
11517c478bd9Sstevel@tonic-gate 
11527c478bd9Sstevel@tonic-gate void
11537c478bd9Sstevel@tonic-gate prt_acl(private_t *pri, int raw, long val)	/* print acl() code */
11547c478bd9Sstevel@tonic-gate {
11557c478bd9Sstevel@tonic-gate 	const char *s = NULL;
11567c478bd9Sstevel@tonic-gate 
11577c478bd9Sstevel@tonic-gate 	if (!raw) {
11587c478bd9Sstevel@tonic-gate 		switch (val) {
11597c478bd9Sstevel@tonic-gate 		case GETACL:		s = "GETACL";		break;
11607c478bd9Sstevel@tonic-gate 		case SETACL:		s = "SETACL";		break;
11617c478bd9Sstevel@tonic-gate 		case GETACLCNT:		s = "GETACLCNT";	break;
1162fa9e4066Sahrens 		case ACE_GETACL:	s = "ACE_GETACL";	break;
1163fa9e4066Sahrens 		case ACE_SETACL:	s = "ACE_SETACL";	break;
1164fa9e4066Sahrens 		case ACE_GETACLCNT:	s = "ACE_GETACLCNT";	break;
11657c478bd9Sstevel@tonic-gate 		}
11667c478bd9Sstevel@tonic-gate 	}
11677c478bd9Sstevel@tonic-gate 
11687c478bd9Sstevel@tonic-gate 	if (s == NULL)
11697c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
11707c478bd9Sstevel@tonic-gate 	else
11717c478bd9Sstevel@tonic-gate 		outstring(pri, s);
11727c478bd9Sstevel@tonic-gate }
11737c478bd9Sstevel@tonic-gate 
11747c478bd9Sstevel@tonic-gate void
11757c478bd9Sstevel@tonic-gate prt_aio(private_t *pri, int raw, long val)	/* print kaio() code */
11767c478bd9Sstevel@tonic-gate {
11777c478bd9Sstevel@tonic-gate 	const char *s = NULL;
11787c478bd9Sstevel@tonic-gate 	char buf[32];
11797c478bd9Sstevel@tonic-gate 
11807c478bd9Sstevel@tonic-gate 	if (!raw) {
11817c478bd9Sstevel@tonic-gate 		switch (val & ~AIO_POLL_BIT) {
11827c478bd9Sstevel@tonic-gate 		case AIOREAD:		s = "AIOREAD";		break;
11837c478bd9Sstevel@tonic-gate 		case AIOWRITE:		s = "AIOWRITE";		break;
11847c478bd9Sstevel@tonic-gate 		case AIOWAIT:		s = "AIOWAIT";		break;
11857c478bd9Sstevel@tonic-gate 		case AIOCANCEL:		s = "AIOCANCEL";	break;
11867c478bd9Sstevel@tonic-gate 		case AIONOTIFY:		s = "AIONOTIFY";	break;
11877c478bd9Sstevel@tonic-gate 		case AIOINIT:		s = "AIOINIT";		break;
11887c478bd9Sstevel@tonic-gate 		case AIOSTART:		s = "AIOSTART";		break;
11897c478bd9Sstevel@tonic-gate 		case AIOLIO:		s = "AIOLIO";		break;
11907c478bd9Sstevel@tonic-gate 		case AIOSUSPEND:	s = "AIOSUSPEND";	break;
11917c478bd9Sstevel@tonic-gate 		case AIOERROR:		s = "AIOERROR";		break;
11927c478bd9Sstevel@tonic-gate 		case AIOLIOWAIT:	s = "AIOLIOWAIT";	break;
11937c478bd9Sstevel@tonic-gate 		case AIOAREAD:		s = "AIOAREAD";		break;
11947c478bd9Sstevel@tonic-gate 		case AIOAWRITE:		s = "AIOAWRITE";	break;
11957c478bd9Sstevel@tonic-gate 		/*
11967c478bd9Sstevel@tonic-gate 		 * We have to hardcode the values for the 64-bit versions of
11977c478bd9Sstevel@tonic-gate 		 * these calls, because <sys/aio.h> defines them to be identical
11987c478bd9Sstevel@tonic-gate 		 * when compiled 64-bit.  If our target is 32-bit, we still need
11997c478bd9Sstevel@tonic-gate 		 * to decode them correctly.
12007c478bd9Sstevel@tonic-gate 		 */
12017c478bd9Sstevel@tonic-gate 		case 13:		s = "AIOLIO64";		break;
12027c478bd9Sstevel@tonic-gate 		case 14:		s = "AIOSUSPEND64";	break;
12037c478bd9Sstevel@tonic-gate 		case 15:		s = "AUIOERROR64";	break;
12047c478bd9Sstevel@tonic-gate 		case 16:		s = "AIOLIOWAIT64";	break;
12057c478bd9Sstevel@tonic-gate 		case 17:		s = "AIOAREAD64";	break;
12067c478bd9Sstevel@tonic-gate 		case 18:		s = "AIOAWRITE64";	break;
12077c478bd9Sstevel@tonic-gate 		case 19:		s = "AIOCANCEL64";	break;
12087c478bd9Sstevel@tonic-gate 
12097c478bd9Sstevel@tonic-gate 		/*
12107c478bd9Sstevel@tonic-gate 		 * AIOFSYNC doesn't correspond to a syscall.
12117c478bd9Sstevel@tonic-gate 		 */
12127c478bd9Sstevel@tonic-gate 		case AIOWAITN:		s = "AIOWAITN";		break;
12137c478bd9Sstevel@tonic-gate 		}
12147c478bd9Sstevel@tonic-gate 		if (s != NULL && (val & AIO_POLL_BIT)) {
12157c478bd9Sstevel@tonic-gate 			(void) strlcpy(buf, s, sizeof (buf));
12167c478bd9Sstevel@tonic-gate 			(void) strlcat(buf, "|AIO_POLL_BIT", sizeof (buf));
12177c478bd9Sstevel@tonic-gate 			s = (const char *)buf;
12187c478bd9Sstevel@tonic-gate 		}
12197c478bd9Sstevel@tonic-gate 	}
12207c478bd9Sstevel@tonic-gate 
12217c478bd9Sstevel@tonic-gate 	if (s == NULL)
12227c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
12237c478bd9Sstevel@tonic-gate 	else
12247c478bd9Sstevel@tonic-gate 		outstring(pri, s);
12257c478bd9Sstevel@tonic-gate }
12267c478bd9Sstevel@tonic-gate 
12277c478bd9Sstevel@tonic-gate void
12287c478bd9Sstevel@tonic-gate prt_aud(private_t *pri, int raw, long val)	/* print auditsys() code */
12297c478bd9Sstevel@tonic-gate {
12307c478bd9Sstevel@tonic-gate 	const char *s = NULL;
12317c478bd9Sstevel@tonic-gate 
12327c478bd9Sstevel@tonic-gate 	if (!raw) {
12337c478bd9Sstevel@tonic-gate 		switch (val) {
12347c478bd9Sstevel@tonic-gate 		case BSM_GETAUID:	s = "BSM_GETAUID";	break;
12357c478bd9Sstevel@tonic-gate 		case BSM_SETAUID:	s = "BSM_SETAUID";	break;
12367c478bd9Sstevel@tonic-gate 		case BSM_GETAUDIT:	s = "BSM_GETAUDIT";	break;
12377c478bd9Sstevel@tonic-gate 		case BSM_SETAUDIT:	s = "BSM_SETAUDIT";	break;
12387c478bd9Sstevel@tonic-gate 		case BSM_AUDIT:		s = "BSM_AUDIT";	break;
12397c478bd9Sstevel@tonic-gate 		case BSM_AUDITCTL:	s = "BSM_AUDITCTL";	break;
12407c478bd9Sstevel@tonic-gate 		case BSM_GETAUDIT_ADDR:	s = "BSM_GETAUDIT_ADDR"; break;
12417c478bd9Sstevel@tonic-gate 		case BSM_SETAUDIT_ADDR:	s = "BSM_SETAUDIT_ADDR"; break;
12427c478bd9Sstevel@tonic-gate 		}
12437c478bd9Sstevel@tonic-gate 	}
12447c478bd9Sstevel@tonic-gate 
12457c478bd9Sstevel@tonic-gate 	if (s == NULL)
12467c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
12477c478bd9Sstevel@tonic-gate 	else
12487c478bd9Sstevel@tonic-gate 		outstring(pri, s);
12497c478bd9Sstevel@tonic-gate }
12507c478bd9Sstevel@tonic-gate 
12517c478bd9Sstevel@tonic-gate void
12527c478bd9Sstevel@tonic-gate prt_cor(private_t *pri, int raw, long val)	/* print corectl() subcode */
12537c478bd9Sstevel@tonic-gate {
12547c478bd9Sstevel@tonic-gate 	const char *s = NULL;
12557c478bd9Sstevel@tonic-gate 
12567c478bd9Sstevel@tonic-gate 	if (!raw) {
12577c478bd9Sstevel@tonic-gate 		switch (val) {
12587c478bd9Sstevel@tonic-gate 		case CC_SET_OPTIONS:
12597c478bd9Sstevel@tonic-gate 			s = "CC_SET_OPTIONS";		break;
12607c478bd9Sstevel@tonic-gate 		case CC_GET_OPTIONS:
12617c478bd9Sstevel@tonic-gate 			s = "CC_GET_OPTIONS";		break;
12627c478bd9Sstevel@tonic-gate 		case CC_SET_GLOBAL_PATH:
12637c478bd9Sstevel@tonic-gate 			s = "CC_SET_GLOBAL_PATH";	break;
12647c478bd9Sstevel@tonic-gate 		case CC_GET_GLOBAL_PATH:
12657c478bd9Sstevel@tonic-gate 			s = "CC_GET_GLOBAL_PATH";	break;
12667c478bd9Sstevel@tonic-gate 		case CC_SET_PROCESS_PATH:
12677c478bd9Sstevel@tonic-gate 			s = "CC_SET_PROCESS_PATH";	break;
12687c478bd9Sstevel@tonic-gate 		case CC_GET_PROCESS_PATH:
12697c478bd9Sstevel@tonic-gate 			s = "CC_GET_PROCESS_PATH";	break;
12707c478bd9Sstevel@tonic-gate 		case CC_SET_GLOBAL_CONTENT:
12717c478bd9Sstevel@tonic-gate 			s = "CC_SET_GLOBAL_CONTENT";	break;
12727c478bd9Sstevel@tonic-gate 		case CC_GET_GLOBAL_CONTENT:
12737c478bd9Sstevel@tonic-gate 			s = "CC_GET_GLOBAL_CONTENT";	break;
12747c478bd9Sstevel@tonic-gate 		case CC_SET_PROCESS_CONTENT:
12757c478bd9Sstevel@tonic-gate 			s = "CC_SET_PROCESS_CONTENT";	break;
12767c478bd9Sstevel@tonic-gate 		case CC_GET_PROCESS_CONTENT:
12777c478bd9Sstevel@tonic-gate 			s = "CC_GET_PROCESS_CONTENT";	break;
12787c478bd9Sstevel@tonic-gate 		case CC_SET_DEFAULT_PATH:
12797c478bd9Sstevel@tonic-gate 			s = "CC_SET_DEFAULT_PATH";	break;
12807c478bd9Sstevel@tonic-gate 		case CC_GET_DEFAULT_PATH:
12817c478bd9Sstevel@tonic-gate 			s = "CC_GET_DEFAULT_PATH";	break;
12827c478bd9Sstevel@tonic-gate 		case CC_SET_DEFAULT_CONTENT:
12837c478bd9Sstevel@tonic-gate 			s = "CC_SET_DEFAULT_CONTENT";	break;
12847c478bd9Sstevel@tonic-gate 		case CC_GET_DEFAULT_CONTENT:
12857c478bd9Sstevel@tonic-gate 			s = "CC_GET_DEFAULT_CONTENT";	break;
12867c478bd9Sstevel@tonic-gate 		}
12877c478bd9Sstevel@tonic-gate 	}
12887c478bd9Sstevel@tonic-gate 
12897c478bd9Sstevel@tonic-gate 	if (s == NULL)
12907c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
12917c478bd9Sstevel@tonic-gate 	else
12927c478bd9Sstevel@tonic-gate 		outstring(pri, s);
12937c478bd9Sstevel@tonic-gate }
12947c478bd9Sstevel@tonic-gate 
12957c478bd9Sstevel@tonic-gate void
12967c478bd9Sstevel@tonic-gate prt_cco(private_t *pri, int raw, long val)	/* print corectl() options */
12977c478bd9Sstevel@tonic-gate {
12987c478bd9Sstevel@tonic-gate 	char *s;
12997c478bd9Sstevel@tonic-gate 
13007c478bd9Sstevel@tonic-gate 	if (val == 0)
13017c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
13027c478bd9Sstevel@tonic-gate 	else if (raw || (val & ~CC_OPTIONS))
13037c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, val);
13047c478bd9Sstevel@tonic-gate 	else {
13057c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
13067c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
13077c478bd9Sstevel@tonic-gate 		*s = '\0';
13087c478bd9Sstevel@tonic-gate 		if (val & CC_GLOBAL_PATH)
13097c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|CC_GLOBAL_PATH", CBSIZE);
13107c478bd9Sstevel@tonic-gate 		if (val & CC_PROCESS_PATH)
13117c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|CC_PROCESS_PATH", CBSIZE);
13127c478bd9Sstevel@tonic-gate 		if (val & CC_GLOBAL_SETID)
13137c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|CC_GLOBAL_SETID", CBSIZE);
13147c478bd9Sstevel@tonic-gate 		if (val & CC_PROCESS_SETID)
13157c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|CC_PROCESS_SETID", CBSIZE);
13167c478bd9Sstevel@tonic-gate 		if (val & CC_GLOBAL_LOG)
13177c478bd9Sstevel@tonic-gate 			(void) strlcat(s, "|CC_GLOBAL_LOG", CBSIZE);
13187c478bd9Sstevel@tonic-gate 		if (*s == '\0')
13197c478bd9Sstevel@tonic-gate 			prt_hhx(pri, 0, val);
13207c478bd9Sstevel@tonic-gate 		else
13217c478bd9Sstevel@tonic-gate 			outstring(pri, ++s);
13227c478bd9Sstevel@tonic-gate #undef CBSIZE
13237c478bd9Sstevel@tonic-gate 	}
13247c478bd9Sstevel@tonic-gate }
13257c478bd9Sstevel@tonic-gate 
13267c478bd9Sstevel@tonic-gate void
13277c478bd9Sstevel@tonic-gate prt_ccc(private_t *pri, int raw, long val)	/* print corectl() content */
13287c478bd9Sstevel@tonic-gate {
13297c478bd9Sstevel@tonic-gate 	core_content_t ccc;
13307c478bd9Sstevel@tonic-gate 
13317c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
13327c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
13337c478bd9Sstevel@tonic-gate 	else if (!raw && proc_content2str(ccc, pri->code_buf,
13347c478bd9Sstevel@tonic-gate 	    sizeof (pri->code_buf)) >= 0)
13357c478bd9Sstevel@tonic-gate 		outstring(pri, pri->code_buf);
13367c478bd9Sstevel@tonic-gate 	else
13377c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, (long)ccc);
13387c478bd9Sstevel@tonic-gate }
13397c478bd9Sstevel@tonic-gate 
13407c478bd9Sstevel@tonic-gate void
13417c478bd9Sstevel@tonic-gate prt_rcc(private_t *pri, int raw, long val)	/* print corectl() ret. cont. */
13427c478bd9Sstevel@tonic-gate {
13437c478bd9Sstevel@tonic-gate 	core_content_t ccc;
13447c478bd9Sstevel@tonic-gate 
13457c478bd9Sstevel@tonic-gate 	if (pri->Errno || Pread(Proc, &ccc, sizeof (ccc), val) != sizeof (ccc))
13467c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
13477c478bd9Sstevel@tonic-gate 	else if (!raw && proc_content2str(ccc, pri->code_buf,
13487c478bd9Sstevel@tonic-gate 	    sizeof (pri->code_buf)) >= 0)
13497c478bd9Sstevel@tonic-gate 		outstring(pri, pri->code_buf);
13507c478bd9Sstevel@tonic-gate 	else
13517c478bd9Sstevel@tonic-gate 		prt_hhx(pri, 0, (long)ccc);
13527c478bd9Sstevel@tonic-gate }
13537c478bd9Sstevel@tonic-gate 
13547c478bd9Sstevel@tonic-gate void
13557c478bd9Sstevel@tonic-gate prt_cpc(private_t *pri, int raw, long val)	/* print cpc() subcode */
13567c478bd9Sstevel@tonic-gate {
13577c478bd9Sstevel@tonic-gate 	const char *s = NULL;
13587c478bd9Sstevel@tonic-gate 
13597c478bd9Sstevel@tonic-gate 	if (!raw) {
13607c478bd9Sstevel@tonic-gate 		switch (val) {
13617c478bd9Sstevel@tonic-gate 		case CPC_BIND:		s = "CPC_BIND";		break;
13627c478bd9Sstevel@tonic-gate 		case CPC_SAMPLE:	s = "CPC_SAMPLE";	break;
13637c478bd9Sstevel@tonic-gate 		case CPC_INVALIDATE:	s = "CPC_INVALIDATE";	break;
13647c478bd9Sstevel@tonic-gate 		case CPC_RELE:		s = "CPC_RELE";		break;
13657c478bd9Sstevel@tonic-gate 		case CPC_EVLIST_SIZE:	s = "CPC_EVLIST_SIZE";	break;
13667c478bd9Sstevel@tonic-gate 		case CPC_LIST_EVENTS:	s = "CPC_LIST_EVENTS";	break;
13677c478bd9Sstevel@tonic-gate 		case CPC_ATTRLIST_SIZE:	s = "CPC_ATTRLIST_SIZE"; break;
13687c478bd9Sstevel@tonic-gate 		case CPC_LIST_ATTRS:	s = "CPC_LIST_ATTRS";	break;
13697c478bd9Sstevel@tonic-gate 		case CPC_IMPL_NAME:	s = "CPC_IMPL_NAME";	break;
13707c478bd9Sstevel@tonic-gate 		case CPC_CPUREF:	s = "CPC_CPUREF";	break;
13717c478bd9Sstevel@tonic-gate 		case CPC_USR_EVENTS:	s = "CPC_USR_EVENTS";	break;
13727c478bd9Sstevel@tonic-gate 		case CPC_SYS_EVENTS:	s = "CPC_SYS_EVENTS";	break;
13737c478bd9Sstevel@tonic-gate 		case CPC_NPIC:		s = "CPC_NPIC";		break;
13747c478bd9Sstevel@tonic-gate 		case CPC_CAPS:		s = "CPC_CAPS";		break;
13757c478bd9Sstevel@tonic-gate 		case CPC_ENABLE:	s = "CPC_ENABLE";	break;
13767c478bd9Sstevel@tonic-gate 		case CPC_DISABLE:	s = "CPC_DISABLE";	break;
13777c478bd9Sstevel@tonic-gate 		}
13787c478bd9Sstevel@tonic-gate 	}
13797c478bd9Sstevel@tonic-gate 
13807c478bd9Sstevel@tonic-gate 	if (s == NULL)
13817c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
13827c478bd9Sstevel@tonic-gate 	else
13837c478bd9Sstevel@tonic-gate 		outstring(pri, s);
13847c478bd9Sstevel@tonic-gate }
13857c478bd9Sstevel@tonic-gate 
13867c478bd9Sstevel@tonic-gate void
13877c478bd9Sstevel@tonic-gate outstring(private_t *pri, const char *s)
13887c478bd9Sstevel@tonic-gate {
13897c478bd9Sstevel@tonic-gate 	int len = strlen(s);
13907c478bd9Sstevel@tonic-gate 
13917c478bd9Sstevel@tonic-gate 	GROW(len);
13927c478bd9Sstevel@tonic-gate 	(void) strcpy(pri->sys_string + pri->sys_leng, s);
13937c478bd9Sstevel@tonic-gate 	pri->sys_leng += len;
13947c478bd9Sstevel@tonic-gate }
13957c478bd9Sstevel@tonic-gate 
13967c478bd9Sstevel@tonic-gate void
13977c478bd9Sstevel@tonic-gate grow(private_t *pri, int nbyte)	/* reallocate format buffer if necessary */
13987c478bd9Sstevel@tonic-gate {
13997c478bd9Sstevel@tonic-gate 	while (pri->sys_leng + nbyte >= pri->sys_ssize)
14007c478bd9Sstevel@tonic-gate 		pri->sys_string = my_realloc(pri->sys_string,
14017c478bd9Sstevel@tonic-gate 		    pri->sys_ssize *= 2, "format buffer");
14027c478bd9Sstevel@tonic-gate }
14037c478bd9Sstevel@tonic-gate 
14047c478bd9Sstevel@tonic-gate void
14057c478bd9Sstevel@tonic-gate prt_clc(private_t *pri, int raw, long val)
14067c478bd9Sstevel@tonic-gate {
14077c478bd9Sstevel@tonic-gate 	const char *s = NULL;
14087c478bd9Sstevel@tonic-gate 
14097c478bd9Sstevel@tonic-gate 	if (!raw) {
14107c478bd9Sstevel@tonic-gate 		switch (val) {
14117c478bd9Sstevel@tonic-gate 		case CL_INITIALIZE:	s = "CL_INITIALIZE";	break;
14127c478bd9Sstevel@tonic-gate 		case CL_CONFIG:		s = "CL_CONFIG";	break;
14137c478bd9Sstevel@tonic-gate 		}
14147c478bd9Sstevel@tonic-gate 	}
14157c478bd9Sstevel@tonic-gate 
14167c478bd9Sstevel@tonic-gate 	if (s == NULL)
14177c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
14187c478bd9Sstevel@tonic-gate 	else
14197c478bd9Sstevel@tonic-gate 		outstring(pri, s);
14207c478bd9Sstevel@tonic-gate }
14217c478bd9Sstevel@tonic-gate 
14227c478bd9Sstevel@tonic-gate void
14237c478bd9Sstevel@tonic-gate prt_clf(private_t *pri, int raw, long val)
14247c478bd9Sstevel@tonic-gate {
14257c478bd9Sstevel@tonic-gate 	const char *s = NULL;
14267c478bd9Sstevel@tonic-gate 
14277c478bd9Sstevel@tonic-gate 	if (!raw) {
14287c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
14297c478bd9Sstevel@tonic-gate 		case CL_CONFIG:
14307c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[1]) {
14317c478bd9Sstevel@tonic-gate 			case CL_NODEID:
14327c478bd9Sstevel@tonic-gate 				s = "CL_NODEID";		break;
14337c478bd9Sstevel@tonic-gate 			case CL_HIGHEST_NODEID:
14347c478bd9Sstevel@tonic-gate 				s = "CL_HIGHEST_NODEID";	break;
14357c478bd9Sstevel@tonic-gate 			}
14367c478bd9Sstevel@tonic-gate 			break;
14377c478bd9Sstevel@tonic-gate 		case CL_INITIALIZE:
14387c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[1]) {
14397c478bd9Sstevel@tonic-gate 			case CL_GET_BOOTFLAG:
14407c478bd9Sstevel@tonic-gate 				s = "CL_GET_BOOTFLAG";		break;
14417c478bd9Sstevel@tonic-gate 			}
14427c478bd9Sstevel@tonic-gate 			break;
14437c478bd9Sstevel@tonic-gate 		}
14447c478bd9Sstevel@tonic-gate 	}
14457c478bd9Sstevel@tonic-gate 
14467c478bd9Sstevel@tonic-gate 	if (s == NULL)
14477c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
14487c478bd9Sstevel@tonic-gate 	else
14497c478bd9Sstevel@tonic-gate 		outstring(pri, s);
14507c478bd9Sstevel@tonic-gate }
14517c478bd9Sstevel@tonic-gate 
14527c478bd9Sstevel@tonic-gate void
14537c478bd9Sstevel@tonic-gate prt_sqc(private_t *pri, int raw, long val)	/* print sigqueue() si_code */
14547c478bd9Sstevel@tonic-gate {
14557c478bd9Sstevel@tonic-gate 	const char *s = NULL;
14567c478bd9Sstevel@tonic-gate 
14577c478bd9Sstevel@tonic-gate 	if (!raw) {
14587c478bd9Sstevel@tonic-gate 		switch ((int)val) {
14597c478bd9Sstevel@tonic-gate 		case SI_QUEUE:		s = "SI_QUEUE";		break;
14607c478bd9Sstevel@tonic-gate 		case SI_TIMER:		s = "SI_TIMER";		break;
14617c478bd9Sstevel@tonic-gate 		case SI_ASYNCIO:	s = "SI_ASYNCIO";	break;
14627c478bd9Sstevel@tonic-gate 		case SI_MESGQ:		s = "SI_MESGQ";		break;
14637c478bd9Sstevel@tonic-gate 		}
14647c478bd9Sstevel@tonic-gate 	}
14657c478bd9Sstevel@tonic-gate 
14667c478bd9Sstevel@tonic-gate 	if (s == NULL)
14677c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
14687c478bd9Sstevel@tonic-gate 	else
14697c478bd9Sstevel@tonic-gate 		outstring(pri, s);
14707c478bd9Sstevel@tonic-gate }
14717c478bd9Sstevel@tonic-gate 
14727c478bd9Sstevel@tonic-gate /*
14737c478bd9Sstevel@tonic-gate  * print priocntlsys() (key, value) pair key.
14747c478bd9Sstevel@tonic-gate  */
14757c478bd9Sstevel@tonic-gate void
14767c478bd9Sstevel@tonic-gate print_pck(private_t *pri, int raw, long val)
14777c478bd9Sstevel@tonic-gate {
14787c478bd9Sstevel@tonic-gate 	const char	*s = NULL;
14797c478bd9Sstevel@tonic-gate 	char		clname[PC_CLNMSZ];
14807c478bd9Sstevel@tonic-gate 
14817c478bd9Sstevel@tonic-gate 	if ((pri->sys_args[2] != PC_GETXPARMS &&
14827c478bd9Sstevel@tonic-gate 	    pri->sys_args[2] != PC_SETXPARMS) || val == 0 || raw) {
14837c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
14847c478bd9Sstevel@tonic-gate 		return;
14857c478bd9Sstevel@tonic-gate 	}
14867c478bd9Sstevel@tonic-gate 
14877c478bd9Sstevel@tonic-gate 	if (pri->sys_args[3] == NULL) {
14887c478bd9Sstevel@tonic-gate 		if (val == PC_KY_CLNAME) {
14897c478bd9Sstevel@tonic-gate 			s = "PC_KY_CLNAME";
14907c478bd9Sstevel@tonic-gate 			outstring(pri, s);
14917c478bd9Sstevel@tonic-gate 		} else
14927c478bd9Sstevel@tonic-gate 			prt_dec(pri, 0, val);
14937c478bd9Sstevel@tonic-gate 		return;
14947c478bd9Sstevel@tonic-gate 	}
14957c478bd9Sstevel@tonic-gate 
14967c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &clname, PC_CLNMSZ, pri->sys_args[3]) != PC_CLNMSZ) {
14977c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
14987c478bd9Sstevel@tonic-gate 		return;
14997c478bd9Sstevel@tonic-gate 	}
15007c478bd9Sstevel@tonic-gate 
15017c478bd9Sstevel@tonic-gate 	if (strcmp(clname, "TS") == 0) {
15027c478bd9Sstevel@tonic-gate 		switch (val) {
15037c478bd9Sstevel@tonic-gate 		case TS_KY_UPRILIM: 	s = "TS_KY_UPRILIM";	break;
15047c478bd9Sstevel@tonic-gate 		case TS_KY_UPRI:	s = "TS_KY_UPRI";	break;
15057c478bd9Sstevel@tonic-gate 		default:					break;
15067c478bd9Sstevel@tonic-gate 		}
15077c478bd9Sstevel@tonic-gate 	} else if (strcmp(clname, "IA") == 0) {
15087c478bd9Sstevel@tonic-gate 		switch (val) {
15097c478bd9Sstevel@tonic-gate 		case IA_KY_UPRILIM: 	s = "IA_KY_UPRILIM";	break;
15107c478bd9Sstevel@tonic-gate 		case IA_KY_UPRI:	s = "IA_KY_UPRI";	break;
15117c478bd9Sstevel@tonic-gate 		case IA_KY_MODE:	s = "IA_KY_MODE";	break;
15127c478bd9Sstevel@tonic-gate 		default:					break;
15137c478bd9Sstevel@tonic-gate 		}
15147c478bd9Sstevel@tonic-gate 	} else if (strcmp(clname, "RT") == 0) {
15157c478bd9Sstevel@tonic-gate 		switch (val) {
15167c478bd9Sstevel@tonic-gate 		case RT_KY_PRI: 	s = "RT_KY_PRI";	break;
15177c478bd9Sstevel@tonic-gate 		case RT_KY_TQSECS:	s = "RT_KY_TQSECS";	break;
15187c478bd9Sstevel@tonic-gate 		case RT_KY_TQNSECS:	s = "RT_KY_TQNSECS";	break;
15197c478bd9Sstevel@tonic-gate 		case RT_KY_TQSIG:	s = "RT_KY_TQSIG";	break;
15207c478bd9Sstevel@tonic-gate 		default:					break;
15217c478bd9Sstevel@tonic-gate 		}
15227c478bd9Sstevel@tonic-gate 	} else if (strcmp(clname, "FSS") == 0) {
15237c478bd9Sstevel@tonic-gate 		switch (val) {
15247c478bd9Sstevel@tonic-gate 		case FSS_KY_UPRILIM: 	s = "FSS_KY_UPRILIM";	break;
15257c478bd9Sstevel@tonic-gate 		case FSS_KY_UPRI:	s = "FSS_KY_UPRI";	break;
15267c478bd9Sstevel@tonic-gate 		default:					break;
15277c478bd9Sstevel@tonic-gate 		}
15287c478bd9Sstevel@tonic-gate 	} else if (strcmp(clname, "FX") == 0) {
15297c478bd9Sstevel@tonic-gate 		switch (val) {
15307c478bd9Sstevel@tonic-gate 		case FX_KY_UPRILIM: 	s = "FX_KY_UPRILIM";	break;
15317c478bd9Sstevel@tonic-gate 		case FX_KY_UPRI:	s = "FX_KY_UPRI";	break;
15327c478bd9Sstevel@tonic-gate 		case FX_KY_TQSECS:	s = "FX_KY_TQSECS";	break;
15337c478bd9Sstevel@tonic-gate 		case FX_KY_TQNSECS:	s = "FX_KY_TQNSECS";	break;
15347c478bd9Sstevel@tonic-gate 		default:					break;
15357c478bd9Sstevel@tonic-gate 		}
15367c478bd9Sstevel@tonic-gate 	}
15377c478bd9Sstevel@tonic-gate 
15387c478bd9Sstevel@tonic-gate 	if (s == NULL)
15397c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
15407c478bd9Sstevel@tonic-gate 	else
15417c478bd9Sstevel@tonic-gate 		outstring(pri, s);
15427c478bd9Sstevel@tonic-gate }
15437c478bd9Sstevel@tonic-gate 
15447c478bd9Sstevel@tonic-gate /*
15457c478bd9Sstevel@tonic-gate  * print priocntlsys() fourth argument.
15467c478bd9Sstevel@tonic-gate  */
15477c478bd9Sstevel@tonic-gate /*ARGSUSED*/
15487c478bd9Sstevel@tonic-gate void
15497c478bd9Sstevel@tonic-gate prt_pc4(private_t *pri, int raw, long val)
15507c478bd9Sstevel@tonic-gate {
15517c478bd9Sstevel@tonic-gate 	/* look at pricntlsys function */
15527c478bd9Sstevel@tonic-gate 	if ((pri->sys_args[2] != PC_GETXPARMS &&
15537c478bd9Sstevel@tonic-gate 	    pri->sys_args[2] != PC_SETXPARMS))
15547c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
15557c478bd9Sstevel@tonic-gate 	else if (val)
15567c478bd9Sstevel@tonic-gate 		prt_stg(pri, 0, val);
15577c478bd9Sstevel@tonic-gate 	else
15587c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
15597c478bd9Sstevel@tonic-gate }
15607c478bd9Sstevel@tonic-gate 
15617c478bd9Sstevel@tonic-gate /*
15627c478bd9Sstevel@tonic-gate  * print priocntlsys() (key, value) pairs (5th argument).
15637c478bd9Sstevel@tonic-gate  */
15647c478bd9Sstevel@tonic-gate /*ARGSUSED*/
15657c478bd9Sstevel@tonic-gate void
15667c478bd9Sstevel@tonic-gate prt_pc5(private_t *pri, int raw, long val)
15677c478bd9Sstevel@tonic-gate {
15687c478bd9Sstevel@tonic-gate 	pc_vaparms_t	prms;
15697c478bd9Sstevel@tonic-gate 	pc_vaparm_t	*vpp = &prms.pc_parms[0];
15707c478bd9Sstevel@tonic-gate 	uint_t		cnt;
15717c478bd9Sstevel@tonic-gate 
15727c478bd9Sstevel@tonic-gate 
15737c478bd9Sstevel@tonic-gate 	/* look at pricntlsys function */
15747c478bd9Sstevel@tonic-gate 	if ((pri->sys_args[2] != PC_GETXPARMS &&
15757c478bd9Sstevel@tonic-gate 	    pri->sys_args[2] != PC_SETXPARMS) || val == 0) {
15767c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, 0);
15777c478bd9Sstevel@tonic-gate 		return;
15787c478bd9Sstevel@tonic-gate 	}
15797c478bd9Sstevel@tonic-gate 
15807c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &prms, sizeof (prms), val) != sizeof (prms)) {
15817c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
15827c478bd9Sstevel@tonic-gate 		return;
15837c478bd9Sstevel@tonic-gate 	}
15847c478bd9Sstevel@tonic-gate 
15857c478bd9Sstevel@tonic-gate 	if ((cnt = prms.pc_vaparmscnt) > PC_VAPARMCNT)
15867c478bd9Sstevel@tonic-gate 		return;
15877c478bd9Sstevel@tonic-gate 
15887c478bd9Sstevel@tonic-gate 	for (; cnt--; vpp++) {
15897c478bd9Sstevel@tonic-gate 		print_pck(pri, 0, vpp->pc_key);
15907c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
15917c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, (long)vpp->pc_parm);
15927c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
15937c478bd9Sstevel@tonic-gate 	}
15947c478bd9Sstevel@tonic-gate 
15957c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, PC_KY_NULL);
15967c478bd9Sstevel@tonic-gate }
15977c478bd9Sstevel@tonic-gate 
15987c478bd9Sstevel@tonic-gate /*
15997c478bd9Sstevel@tonic-gate  * Print processor set id, including logical expansion of "special" ids.
16007c478bd9Sstevel@tonic-gate  */
16017c478bd9Sstevel@tonic-gate void
16027c478bd9Sstevel@tonic-gate prt_pst(private_t *pri, int raw, long val)
16037c478bd9Sstevel@tonic-gate {
16047c478bd9Sstevel@tonic-gate 	const char *s = NULL;
16057c478bd9Sstevel@tonic-gate 
16067c478bd9Sstevel@tonic-gate 	if (!raw) {
16077c478bd9Sstevel@tonic-gate 		switch ((psetid_t)val) {
16087c478bd9Sstevel@tonic-gate 		case PS_NONE:		s = "PS_NONE";		break;
16097c478bd9Sstevel@tonic-gate 		case PS_QUERY:		s = "PS_QUERY";		break;
16107c478bd9Sstevel@tonic-gate 		case PS_MYID:		s = "PS_MYID";		break;
16117c478bd9Sstevel@tonic-gate 		}
16127c478bd9Sstevel@tonic-gate 	}
16137c478bd9Sstevel@tonic-gate 
16147c478bd9Sstevel@tonic-gate 	if (s == NULL)
16157c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
16167c478bd9Sstevel@tonic-gate 	else
16177c478bd9Sstevel@tonic-gate 		outstring(pri, s);
16187c478bd9Sstevel@tonic-gate }
16197c478bd9Sstevel@tonic-gate 
16207c478bd9Sstevel@tonic-gate /*
16217c478bd9Sstevel@tonic-gate  * Print meminfo() argument.
16227c478bd9Sstevel@tonic-gate  */
16237c478bd9Sstevel@tonic-gate /*ARGSUSED*/
16247c478bd9Sstevel@tonic-gate void
16257c478bd9Sstevel@tonic-gate prt_mif(private_t *pri, int raw, long val)
16267c478bd9Sstevel@tonic-gate {
16277c478bd9Sstevel@tonic-gate 	struct meminfo	minfo;
16287c478bd9Sstevel@tonic-gate 
16297c478bd9Sstevel@tonic-gate #ifdef _LP64
16307c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_ILP32) {
16317c478bd9Sstevel@tonic-gate 		struct meminfo32 minfo32;
16327c478bd9Sstevel@tonic-gate 
16337c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &minfo32, sizeof (struct meminfo32), val) !=
16347c478bd9Sstevel@tonic-gate 			sizeof (struct meminfo32)) {
16357c478bd9Sstevel@tonic-gate 			prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
16367c478bd9Sstevel@tonic-gate 			outstring(pri, ", ");
16377c478bd9Sstevel@tonic-gate 			prt_hex(pri, 0, val);
16387c478bd9Sstevel@tonic-gate 			return;
16397c478bd9Sstevel@tonic-gate 		}
16407c478bd9Sstevel@tonic-gate 		/*
16417c478bd9Sstevel@tonic-gate 		 * arrange the arguments in the order that user calls with
16427c478bd9Sstevel@tonic-gate 		 */
16437c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, minfo32.mi_inaddr);
16447c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16457c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
16467c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16477c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, minfo32.mi_info_req);
16487c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16497c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, minfo32.mi_info_count);
16507c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16517c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, minfo32.mi_outdata);
16527c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16537c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, minfo32.mi_validity);
16547c478bd9Sstevel@tonic-gate 		return;
16557c478bd9Sstevel@tonic-gate 	}
16567c478bd9Sstevel@tonic-gate #endif
16577c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &minfo, sizeof (struct meminfo), val) !=
16587c478bd9Sstevel@tonic-gate 		sizeof (struct meminfo)) {
16597c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
16607c478bd9Sstevel@tonic-gate 		outstring(pri, ", ");
16617c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
16627c478bd9Sstevel@tonic-gate 		return;
16637c478bd9Sstevel@tonic-gate 	}
16647c478bd9Sstevel@tonic-gate 	/*
16657c478bd9Sstevel@tonic-gate 	 * arrange the arguments in the order that user calls with
16667c478bd9Sstevel@tonic-gate 	 */
16677c478bd9Sstevel@tonic-gate 	prt_hex(pri, 0, (long)minfo.mi_inaddr);
16687c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
16697c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, pri->sys_args[1]);	/* addr_count */
16707c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
16717c478bd9Sstevel@tonic-gate 	prt_hex(pri, 0, (long)minfo.mi_info_req);
16727c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
16737c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, minfo.mi_info_count);
16747c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
16757c478bd9Sstevel@tonic-gate 	prt_hex(pri, 0, (long)minfo.mi_outdata);
16767c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
16777c478bd9Sstevel@tonic-gate 	prt_hex(pri, 0, (long)minfo.mi_validity);
16787c478bd9Sstevel@tonic-gate }
16797c478bd9Sstevel@tonic-gate 
16807c478bd9Sstevel@tonic-gate 
16817c478bd9Sstevel@tonic-gate /*
16827c478bd9Sstevel@tonic-gate  * Print so_socket() 1st argument.
16837c478bd9Sstevel@tonic-gate  */
16847c478bd9Sstevel@tonic-gate /*ARGSUSED*/
16857c478bd9Sstevel@tonic-gate void
16867c478bd9Sstevel@tonic-gate prt_pfm(private_t *pri, int raw, long val)
16877c478bd9Sstevel@tonic-gate {
16887c478bd9Sstevel@tonic-gate 	/* Protocol Families have same names as Address Families */
16897c478bd9Sstevel@tonic-gate 	if ((ulong_t)val < MAX_AFCODES) {
16907c478bd9Sstevel@tonic-gate 		outstring(pri, "PF_");
16917c478bd9Sstevel@tonic-gate 		outstring(pri, afcodes[val]);
16927c478bd9Sstevel@tonic-gate 	} else {
16937c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
16947c478bd9Sstevel@tonic-gate 	}
16957c478bd9Sstevel@tonic-gate }
16967c478bd9Sstevel@tonic-gate 
16973e95bd4aSAnders Persson /*
16983e95bd4aSAnders Persson  * Print sockconfig() subcode.
16993e95bd4aSAnders Persson  */
17003e95bd4aSAnders Persson /*ARGSUSED*/
17013e95bd4aSAnders Persson void
17023e95bd4aSAnders Persson prt_skc(private_t *pri, int raw, long val)
17033e95bd4aSAnders Persson {
17043e95bd4aSAnders Persson 	const char *s = NULL;
17057c478bd9Sstevel@tonic-gate 
17063e95bd4aSAnders Persson 	if (!raw) {
17073e95bd4aSAnders Persson 		switch (val) {
17083e95bd4aSAnders Persson 		case SOCKCONFIG_ADD_SOCK:
17093e95bd4aSAnders Persson 			s = "SOCKCONFIG_ADD_SOCK"; break;
17103e95bd4aSAnders Persson 		case SOCKCONFIG_REMOVE_SOCK:
17113e95bd4aSAnders Persson 			s = "SOCKCONFIG_REMOVE_SOCK"; break;
17123e95bd4aSAnders Persson 		case SOCKCONFIG_ADD_FILTER:
17133e95bd4aSAnders Persson 			s = "SOCKCONFIG_ADD_FILTER"; break;
17143e95bd4aSAnders Persson 		case SOCKCONFIG_REMOVE_FILTER:
17153e95bd4aSAnders Persson 			s = "SOCKCONFIG_REMOVE_FILTER"; break;
17163e95bd4aSAnders Persson 		}
17173e95bd4aSAnders Persson 	}
17183e95bd4aSAnders Persson 	if (s == NULL)
17193e95bd4aSAnders Persson 		prt_dec(pri, 0, val);
17203e95bd4aSAnders Persson 	else
17213e95bd4aSAnders Persson 		outstring(pri, s);
17223e95bd4aSAnders Persson }
17237c478bd9Sstevel@tonic-gate /*
17247c478bd9Sstevel@tonic-gate  * Print so_socket() 2nd argument.
17257c478bd9Sstevel@tonic-gate  */
17267c478bd9Sstevel@tonic-gate /*ARGSUSED*/
17277c478bd9Sstevel@tonic-gate void
17287c478bd9Sstevel@tonic-gate prt_skt(private_t *pri, int raw, long val)
17297c478bd9Sstevel@tonic-gate {
17307c478bd9Sstevel@tonic-gate 	const char *s;
1731187670a0STheo Schlossnagle 	long type = val & SOCK_TYPE_MASK;
17327c478bd9Sstevel@tonic-gate 
1733187670a0STheo Schlossnagle 	if ((ulong_t)type <= MAX_SOCKTYPES &&
1734187670a0STheo Schlossnagle 	    (s = socktype_codes[type]) != NULL) {
17357c478bd9Sstevel@tonic-gate 		outstring(pri, s);
1736187670a0STheo Schlossnagle 		if ((val & SOCK_CLOEXEC) != 0) {
1737187670a0STheo Schlossnagle 			outstring(pri, "|SOCK_CLOEXEC");
1738187670a0STheo Schlossnagle 		}
1739187670a0STheo Schlossnagle 	} else {
17407c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
17417c478bd9Sstevel@tonic-gate 	}
1742187670a0STheo Schlossnagle }
17437c478bd9Sstevel@tonic-gate 
17447c478bd9Sstevel@tonic-gate 
17457c478bd9Sstevel@tonic-gate /*
17467c478bd9Sstevel@tonic-gate  * Print so_socket() 3rd argument.
17477c478bd9Sstevel@tonic-gate  */
17487c478bd9Sstevel@tonic-gate /*ARGSUSED*/
17497c478bd9Sstevel@tonic-gate void
17507c478bd9Sstevel@tonic-gate prt_skp(private_t *pri, int raw, long val)
17517c478bd9Sstevel@tonic-gate {
17527c478bd9Sstevel@tonic-gate 	const char *s;
17537c478bd9Sstevel@tonic-gate 
17547c478bd9Sstevel@tonic-gate 	/* cheating -- look at the protocol-family */
17557c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
17567c478bd9Sstevel@tonic-gate 	case PF_INET6:
17577c478bd9Sstevel@tonic-gate 	case PF_INET:
17587c478bd9Sstevel@tonic-gate 	case PF_NCA:	if ((s = ipprotos((int)val)) != NULL) {
17597c478bd9Sstevel@tonic-gate 				outstring(pri, s);
17607c478bd9Sstevel@tonic-gate 				break;
17617c478bd9Sstevel@tonic-gate 			}
17627c478bd9Sstevel@tonic-gate 			/* FALLTHROUGH */
17637c478bd9Sstevel@tonic-gate 	default:	prt_dec(pri, 0, val);
17647c478bd9Sstevel@tonic-gate 			break;
17657c478bd9Sstevel@tonic-gate 	}
17667c478bd9Sstevel@tonic-gate }
17677c478bd9Sstevel@tonic-gate 
17687c478bd9Sstevel@tonic-gate 
17697c478bd9Sstevel@tonic-gate /*
17707c478bd9Sstevel@tonic-gate  * Print so_socket() 5th argument.
17717c478bd9Sstevel@tonic-gate  */
17727c478bd9Sstevel@tonic-gate /*ARGSUSED*/
17737c478bd9Sstevel@tonic-gate void
17747c478bd9Sstevel@tonic-gate prt_skv(private_t *pri, int raw, long val)
17757c478bd9Sstevel@tonic-gate {
17767c478bd9Sstevel@tonic-gate 	switch (val) {
17777c478bd9Sstevel@tonic-gate 	case SOV_STREAM:	outstring(pri, "SOV_STREAM");	break;
17787c478bd9Sstevel@tonic-gate 	case SOV_DEFAULT:	outstring(pri, "SOV_DEFAULT");	break;
17797c478bd9Sstevel@tonic-gate 	case SOV_SOCKSTREAM:	outstring(pri, "SOV_SOCKSTREAM");	break;
17807c478bd9Sstevel@tonic-gate 	case SOV_SOCKBSD:	outstring(pri, "SOV_SOCKBSD");	break;
17817c478bd9Sstevel@tonic-gate 	case SOV_XPG4_2:	outstring(pri, "SOV_XPG4_2");	break;
17827c478bd9Sstevel@tonic-gate 	default:		prt_dec(pri, 0, val);		break;
17837c478bd9Sstevel@tonic-gate 	}
17847c478bd9Sstevel@tonic-gate }
17857c478bd9Sstevel@tonic-gate 
17865dbfd19aSTheo Schlossnagle /*
17875dbfd19aSTheo Schlossnagle  * Print accept4() flags argument.
17885dbfd19aSTheo Schlossnagle  */
17895dbfd19aSTheo Schlossnagle void
17905dbfd19aSTheo Schlossnagle prt_acf(private_t *pri, int raw, long val)
17915dbfd19aSTheo Schlossnagle {
17925dbfd19aSTheo Schlossnagle 	int first = 1;
17935dbfd19aSTheo Schlossnagle 	if (raw || !val ||
17945dbfd19aSTheo Schlossnagle 	    (val & ~(SOCK_CLOEXEC|SOCK_NDELAY|SOCK_NONBLOCK))) {
17955dbfd19aSTheo Schlossnagle 		prt_dex(pri, 0, val);
17965dbfd19aSTheo Schlossnagle 		return;
17975dbfd19aSTheo Schlossnagle 	}
17985dbfd19aSTheo Schlossnagle 
17995dbfd19aSTheo Schlossnagle 	if (val & SOCK_CLOEXEC) {
18005dbfd19aSTheo Schlossnagle 		outstring(pri, "|SOCK_CLOEXEC" + first);
18015dbfd19aSTheo Schlossnagle 		first = 0;
18025dbfd19aSTheo Schlossnagle 	}
18035dbfd19aSTheo Schlossnagle 	if (val & SOCK_NDELAY) {
18045dbfd19aSTheo Schlossnagle 		outstring(pri, "|SOCK_NDELAY" + first);
18055dbfd19aSTheo Schlossnagle 		first = 0;
18065dbfd19aSTheo Schlossnagle 	}
18075dbfd19aSTheo Schlossnagle 	if (val & SOCK_NONBLOCK) {
18085dbfd19aSTheo Schlossnagle 		outstring(pri, "|SOCK_NONBLOCK" + first);
18095dbfd19aSTheo Schlossnagle 	}
18105dbfd19aSTheo Schlossnagle }
18115dbfd19aSTheo Schlossnagle 
18127c478bd9Sstevel@tonic-gate 
18137c478bd9Sstevel@tonic-gate /*
18147c478bd9Sstevel@tonic-gate  * Print setsockopt()/getsockopt() 2nd argument.
18157c478bd9Sstevel@tonic-gate  */
18167c478bd9Sstevel@tonic-gate /*ARGSUSED*/
18177c478bd9Sstevel@tonic-gate void
18187c478bd9Sstevel@tonic-gate prt_sol(private_t *pri, int raw, long val)
18197c478bd9Sstevel@tonic-gate {
18207c478bd9Sstevel@tonic-gate 	if (val == SOL_SOCKET) {
18217c478bd9Sstevel@tonic-gate 		outstring(pri, "SOL_SOCKET");
1822e11c3f44Smeem 	} else if (val == SOL_ROUTE) {
1823e11c3f44Smeem 		outstring(pri, "SOL_ROUTE");
18247c478bd9Sstevel@tonic-gate 	} else {
18257c478bd9Sstevel@tonic-gate 		const struct protoent *p;
18267c478bd9Sstevel@tonic-gate 		struct protoent res;
18277c478bd9Sstevel@tonic-gate 		char buf[NSS_BUFLEN_PROTOCOLS];
18287c478bd9Sstevel@tonic-gate 
18297c478bd9Sstevel@tonic-gate 		if ((p = getprotobynumber_r(val, &res,
18307c478bd9Sstevel@tonic-gate 		    (char *)buf, sizeof (buf))) != NULL)
18317c478bd9Sstevel@tonic-gate 			outstring(pri, p->p_name);
18327c478bd9Sstevel@tonic-gate 		else
18337c478bd9Sstevel@tonic-gate 			prt_dec(pri, 0, val);
18347c478bd9Sstevel@tonic-gate 	}
18357c478bd9Sstevel@tonic-gate }
18367c478bd9Sstevel@tonic-gate 
18377c478bd9Sstevel@tonic-gate 
18387c478bd9Sstevel@tonic-gate const char *
18397c478bd9Sstevel@tonic-gate sol_optname(private_t *pri, long val)
18407c478bd9Sstevel@tonic-gate {
18417c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
18427c478bd9Sstevel@tonic-gate 	if (val >= SO_SNDBUF) {
18437c478bd9Sstevel@tonic-gate 		switch (val) {
18447c478bd9Sstevel@tonic-gate 		case SO_SNDBUF:		return ("SO_SNDBUF");
18457c478bd9Sstevel@tonic-gate 		case SO_RCVBUF:		return ("SO_RCVBUF");
18467c478bd9Sstevel@tonic-gate 		case SO_SNDLOWAT:	return ("SO_SNDLOWAT");
18477c478bd9Sstevel@tonic-gate 		case SO_RCVLOWAT:	return ("SO_RCVLOWAT");
18487c478bd9Sstevel@tonic-gate 		case SO_SNDTIMEO:	return ("SO_SNDTIMEO");
18497c478bd9Sstevel@tonic-gate 		case SO_RCVTIMEO:	return ("SO_RCVTIMEO");
18507c478bd9Sstevel@tonic-gate 		case SO_ERROR:		return ("SO_ERROR");
18517c478bd9Sstevel@tonic-gate 		case SO_TYPE:		return ("SO_TYPE");
18527c478bd9Sstevel@tonic-gate 		case SO_PROTOTYPE:	return ("SO_PROTOTYPE");
18537b564b02SJarrett Lu 		case SO_ANON_MLP:	return ("SO_ANON_MLP");
18547b564b02SJarrett Lu 		case SO_MAC_EXEMPT:	return ("SO_MAC_EXEMPT");
18555d0bc3edSsommerfe 		case SO_ALLZONES:	return ("SO_ALLZONES");
18565d3b8cb7SBill Sommerfeld 		case SO_MAC_IMPLICIT:	return ("SO_MAC_IMPLICIT");
18571cb875aeSCathy Zhou 		case SO_VRRP:		return ("SO_VRRP");
1858ae347574Skcpoon 		case SO_EXCLBIND:	return ("SO_EXCLBIND");
185988cda078Skcpoon 		case SO_DOMAIN:		return ("SO_DOMAIN");
18607c478bd9Sstevel@tonic-gate 
18617c478bd9Sstevel@tonic-gate 		default:		(void) snprintf(pri->code_buf, CBSIZE,
18627c478bd9Sstevel@tonic-gate 					    "0x%lx", val);
18637c478bd9Sstevel@tonic-gate 					return (pri->code_buf);
18647c478bd9Sstevel@tonic-gate 		}
18657c478bd9Sstevel@tonic-gate 	} else {
18667c478bd9Sstevel@tonic-gate 		char *s = pri->code_buf;
18677c478bd9Sstevel@tonic-gate 		size_t used = 1;
18687c478bd9Sstevel@tonic-gate 		long val2;
18697c478bd9Sstevel@tonic-gate 
18707c478bd9Sstevel@tonic-gate 		*s = '\0';
18717c478bd9Sstevel@tonic-gate 		val2 = val & ~(SO_DEBUG|SO_ACCEPTCONN|SO_REUSEADDR|SO_KEEPALIVE|
18727c478bd9Sstevel@tonic-gate 		    SO_DONTROUTE|SO_BROADCAST|SO_USELOOPBACK|SO_LINGER|
18737c478bd9Sstevel@tonic-gate 		    SO_OOBINLINE|SO_DGRAM_ERRIND|SO_RECVUCRED);
18747c478bd9Sstevel@tonic-gate 		if (val2)
18757c478bd9Sstevel@tonic-gate 			used = snprintf(s, CBSIZE, "|0x%lx", val2);
18767c478bd9Sstevel@tonic-gate 		if (val & SO_DEBUG)
18777c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_DEBUG", CBSIZE);
18787c478bd9Sstevel@tonic-gate 		if (val & SO_ACCEPTCONN)
18797c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_ACCEPTCONN", CBSIZE);
18807c478bd9Sstevel@tonic-gate 		if (val & SO_REUSEADDR)
18817c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_REUSEADDR", CBSIZE);
18827c478bd9Sstevel@tonic-gate 		if (val & SO_KEEPALIVE)
18837c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_KEEPALIVE", CBSIZE);
18847c478bd9Sstevel@tonic-gate 		if (val & SO_DONTROUTE)
18857c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_DONTROUTE", CBSIZE);
18867c478bd9Sstevel@tonic-gate 		if (val & SO_BROADCAST)
18877c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_BROADCAST", CBSIZE);
18887c478bd9Sstevel@tonic-gate 		if (val & SO_USELOOPBACK)
18897c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_USELOOPBACK", CBSIZE);
18907c478bd9Sstevel@tonic-gate 		if (val & SO_LINGER)
18917c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_LINGER", CBSIZE);
18927c478bd9Sstevel@tonic-gate 		if (val & SO_OOBINLINE)
18937c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_OOBINLINE", CBSIZE);
18947c478bd9Sstevel@tonic-gate 		if (val & SO_DGRAM_ERRIND)
18957c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_DGRAM_ERRIND", CBSIZE);
18967c478bd9Sstevel@tonic-gate 		if (val & SO_RECVUCRED)
18977c478bd9Sstevel@tonic-gate 			used = strlcat(s, "|SO_RECVUCRED", CBSIZE);
18987c478bd9Sstevel@tonic-gate 		if (used >= CBSIZE || val == 0)
18997c478bd9Sstevel@tonic-gate 			(void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
19007c478bd9Sstevel@tonic-gate 		return ((const char *)(s + 1));
19017c478bd9Sstevel@tonic-gate 	}
19027c478bd9Sstevel@tonic-gate #undef CBSIZE
19037c478bd9Sstevel@tonic-gate }
19047c478bd9Sstevel@tonic-gate 
1905e11c3f44Smeem const char *
1906e11c3f44Smeem route_optname(private_t *pri, long val)
1907e11c3f44Smeem {
1908e11c3f44Smeem 	switch (val) {
1909e11c3f44Smeem 	case RT_AWARE:
1910e11c3f44Smeem 		return ("RT_AWARE");
1911e11c3f44Smeem 	default:
1912e11c3f44Smeem 		(void) snprintf(pri->code_buf, sizeof (pri->code_buf),
1913e11c3f44Smeem 		    "0x%lx", val);
1914e11c3f44Smeem 		return (pri->code_buf);
1915e11c3f44Smeem 	}
1916e11c3f44Smeem }
19177c478bd9Sstevel@tonic-gate 
19187c478bd9Sstevel@tonic-gate const char *
19197c478bd9Sstevel@tonic-gate tcp_optname(private_t *pri, long val)
19207c478bd9Sstevel@tonic-gate {
19217c478bd9Sstevel@tonic-gate 	switch (val) {
19227c478bd9Sstevel@tonic-gate 	case TCP_NODELAY:		return ("TCP_NODELAY");
19237c478bd9Sstevel@tonic-gate 	case TCP_MAXSEG:		return ("TCP_MAXSEG");
19247c478bd9Sstevel@tonic-gate 	case TCP_KEEPALIVE:		return ("TCP_KEEPALIVE");
19257c478bd9Sstevel@tonic-gate 	case TCP_NOTIFY_THRESHOLD:	return ("TCP_NOTIFY_THRESHOLD");
19267c478bd9Sstevel@tonic-gate 	case TCP_ABORT_THRESHOLD:	return ("TCP_ABORT_THRESHOLD");
19277c478bd9Sstevel@tonic-gate 	case TCP_CONN_NOTIFY_THRESHOLD:	return ("TCP_CONN_NOTIFY_THRESHOLD");
19287c478bd9Sstevel@tonic-gate 	case TCP_CONN_ABORT_THRESHOLD:	return ("TCP_CONN_ABORT_THRESHOLD");
19297c478bd9Sstevel@tonic-gate 	case TCP_RECVDSTADDR:		return ("TCP_RECVDSTADDR");
19307c478bd9Sstevel@tonic-gate 	case TCP_ANONPRIVBIND:		return ("TCP_ANONPRIVBIND");
19317c478bd9Sstevel@tonic-gate 	case TCP_EXCLBIND:		return ("TCP_EXCLBIND");
1932898479dbSkcpoon 	case TCP_INIT_CWND:		return ("TCP_INIT_CWND");
1933898479dbSkcpoon 	case TCP_KEEPALIVE_THRESHOLD:	return ("TCP_KEEPALIVE_THRESHOLD");
1934898479dbSkcpoon 	case TCP_KEEPALIVE_ABORT_THRESHOLD:
1935898479dbSkcpoon 		return ("TCP_KEEPALIVE_ABORT_THRESHOLD");
1936898479dbSkcpoon 	case TCP_CORK:			return ("TCP_CORK");
1937707e74bcSKacheong Poon 	case TCP_RTO_INITIAL:		return ("TCP_RTO_INITIAL");
1938707e74bcSKacheong Poon 	case TCP_RTO_MIN:		return ("TCP_RTO_MIN");
1939707e74bcSKacheong Poon 	case TCP_RTO_MAX:		return ("TCP_RTO_MAX");
1940707e74bcSKacheong Poon 	case TCP_LINGER2:		return ("TCP_LINGER2");
19417c478bd9Sstevel@tonic-gate 
19427c478bd9Sstevel@tonic-gate 	default:			(void) snprintf(pri->code_buf,
19437c478bd9Sstevel@tonic-gate 					    sizeof (pri->code_buf),
19447c478bd9Sstevel@tonic-gate 					    "0x%lx", val);
19457c478bd9Sstevel@tonic-gate 					return (pri->code_buf);
19467c478bd9Sstevel@tonic-gate 	}
19477c478bd9Sstevel@tonic-gate }
19487c478bd9Sstevel@tonic-gate 
19497c478bd9Sstevel@tonic-gate 
19507c478bd9Sstevel@tonic-gate const char *
19517c478bd9Sstevel@tonic-gate sctp_optname(private_t *pri, long val)
19527c478bd9Sstevel@tonic-gate {
19537c478bd9Sstevel@tonic-gate 	switch (val) {
19547c478bd9Sstevel@tonic-gate 	case SCTP_RTOINFO:		return ("SCTP_RTOINFO");
19557c478bd9Sstevel@tonic-gate 	case SCTP_ASSOCINFO:		return ("SCTP_ASSOCINFO");
19567c478bd9Sstevel@tonic-gate 	case SCTP_INITMSG:		return ("SCTP_INITMSG");
19577c478bd9Sstevel@tonic-gate 	case SCTP_NODELAY:		return ("SCTP_NODELAY");
19587c478bd9Sstevel@tonic-gate 	case SCTP_AUTOCLOSE:		return ("SCTP_AUTOCLOSE");
19597c478bd9Sstevel@tonic-gate 	case SCTP_SET_PEER_PRIMARY_ADDR:
19607c478bd9Sstevel@tonic-gate 		return ("SCTP_SET_PEER_PRIMARY_ADDR");
19617c478bd9Sstevel@tonic-gate 	case SCTP_PRIMARY_ADDR:		return ("SCTP_PRIMARY_ADDR");
1962558fbd03Skcpoon 	case SCTP_ADAPTATION_LAYER:	return ("SCTP_ADAPTATION_LAYER");
19637c478bd9Sstevel@tonic-gate 	case SCTP_DISABLE_FRAGMENTS:	return ("SCTP_DISABLE_FRAGMENTS");
19647c478bd9Sstevel@tonic-gate 	case SCTP_PEER_ADDR_PARAMS:	return ("SCTP_PEER_ADDR_PARAMS");
19657c478bd9Sstevel@tonic-gate 	case SCTP_DEFAULT_SEND_PARAM:	return ("SCTP_DEFAULT_SEND_PARAM");
19667c478bd9Sstevel@tonic-gate 	case SCTP_EVENTS:		return ("SCTP_EVENTS");
19677c478bd9Sstevel@tonic-gate 	case SCTP_I_WANT_MAPPED_V4_ADDR:
19687c478bd9Sstevel@tonic-gate 		return ("SCTP_I_WANT_MAPPED_V4_ADDR");
19697c478bd9Sstevel@tonic-gate 	case SCTP_MAXSEG:		return ("SCTP_MAXSEG");
19707c478bd9Sstevel@tonic-gate 	case SCTP_STATUS:		return ("SCTP_STATUS");
19717c478bd9Sstevel@tonic-gate 	case SCTP_GET_PEER_ADDR_INFO:	return ("SCTP_GET_PEER_ADDR_INFO");
19727c478bd9Sstevel@tonic-gate 
19737c478bd9Sstevel@tonic-gate 	case SCTP_ADD_ADDR:		return ("SCTP_ADD_ADDR");
19747c478bd9Sstevel@tonic-gate 	case SCTP_REM_ADDR:		return ("SCTP_REM_ADDR");
19757c478bd9Sstevel@tonic-gate 
19767c478bd9Sstevel@tonic-gate 	default:			(void) snprintf(pri->code_buf,
19777c478bd9Sstevel@tonic-gate 					    sizeof (pri->code_buf),
19787c478bd9Sstevel@tonic-gate 					    "0x%lx", val);
19797c478bd9Sstevel@tonic-gate 					return (pri->code_buf);
19807c478bd9Sstevel@tonic-gate 	}
19817c478bd9Sstevel@tonic-gate }
19827c478bd9Sstevel@tonic-gate 
19837c478bd9Sstevel@tonic-gate 
19847c478bd9Sstevel@tonic-gate const char *
19857c478bd9Sstevel@tonic-gate udp_optname(private_t *pri, long val)
19867c478bd9Sstevel@tonic-gate {
1987898479dbSkcpoon 	switch (val) {
1988898479dbSkcpoon 	case UDP_CHECKSUM:		return ("UDP_CHECKSUM");
1989898479dbSkcpoon 	case UDP_ANONPRIVBIND:		return ("UDP_ANONPRIVBIND");
1990898479dbSkcpoon 	case UDP_EXCLBIND:		return ("UDP_EXCLBIND");
1991898479dbSkcpoon 	case UDP_RCVHDR:		return ("UDP_RCVHDR");
1992437220cdSdanmcd 	case UDP_NAT_T_ENDPOINT:	return ("UDP_NAT_T_ENDPOINT");
19937c478bd9Sstevel@tonic-gate 
1994898479dbSkcpoon 	default:			(void) snprintf(pri->code_buf,
1995898479dbSkcpoon 					    sizeof (pri->code_buf), "0x%lx",
1996898479dbSkcpoon 					    val);
19977c478bd9Sstevel@tonic-gate 					return (pri->code_buf);
19987c478bd9Sstevel@tonic-gate 	}
1999898479dbSkcpoon }
20007c478bd9Sstevel@tonic-gate 
20017c478bd9Sstevel@tonic-gate 
20027c478bd9Sstevel@tonic-gate /*
20037c478bd9Sstevel@tonic-gate  * Print setsockopt()/getsockopt() 3rd argument.
20047c478bd9Sstevel@tonic-gate  */
20057c478bd9Sstevel@tonic-gate /*ARGSUSED*/
20067c478bd9Sstevel@tonic-gate void
20077c478bd9Sstevel@tonic-gate prt_son(private_t *pri, int raw, long val)
20087c478bd9Sstevel@tonic-gate {
20097c478bd9Sstevel@tonic-gate 	/* cheating -- look at the level */
20107c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[1]) {
20117c478bd9Sstevel@tonic-gate 	case SOL_SOCKET:	outstring(pri, sol_optname(pri, val));
20127c478bd9Sstevel@tonic-gate 				break;
2013e11c3f44Smeem 	case SOL_ROUTE:		outstring(pri, route_optname(pri, val));
2014e11c3f44Smeem 				break;
20157c478bd9Sstevel@tonic-gate 	case IPPROTO_TCP:	outstring(pri, tcp_optname(pri, val));
20167c478bd9Sstevel@tonic-gate 				break;
20177c478bd9Sstevel@tonic-gate 	case IPPROTO_UDP:	outstring(pri, udp_optname(pri, val));
20187c478bd9Sstevel@tonic-gate 				break;
20197c478bd9Sstevel@tonic-gate 	case IPPROTO_SCTP:	outstring(pri, sctp_optname(pri, val));
20207c478bd9Sstevel@tonic-gate 				break;
20217c478bd9Sstevel@tonic-gate 	default:		prt_dec(pri, 0, val);
20227c478bd9Sstevel@tonic-gate 				break;
20237c478bd9Sstevel@tonic-gate 	}
20247c478bd9Sstevel@tonic-gate }
20257c478bd9Sstevel@tonic-gate 
20267c478bd9Sstevel@tonic-gate 
20277c478bd9Sstevel@tonic-gate /*
20287c478bd9Sstevel@tonic-gate  * Print utrap type
20297c478bd9Sstevel@tonic-gate  */
20307c478bd9Sstevel@tonic-gate /*ARGSUSED*/
20317c478bd9Sstevel@tonic-gate void
20327c478bd9Sstevel@tonic-gate prt_utt(private_t *pri, int raw, long val)
20337c478bd9Sstevel@tonic-gate {
20347c478bd9Sstevel@tonic-gate 	const char *s = NULL;
20357c478bd9Sstevel@tonic-gate 
20367c478bd9Sstevel@tonic-gate #ifdef __sparc
20377c478bd9Sstevel@tonic-gate 	if (!raw) {
20387c478bd9Sstevel@tonic-gate 		switch (val) {
20397c478bd9Sstevel@tonic-gate 		case UT_INSTRUCTION_DISABLED:
20407c478bd9Sstevel@tonic-gate 			s = "UT_INSTRUCTION_DISABLED"; break;
20417c478bd9Sstevel@tonic-gate 		case UT_INSTRUCTION_ERROR:
20427c478bd9Sstevel@tonic-gate 			s = "UT_INSTRUCTION_ERROR"; break;
20437c478bd9Sstevel@tonic-gate 		case UT_INSTRUCTION_PROTECTION:
20447c478bd9Sstevel@tonic-gate 			s = "UT_INSTRUCTION_PROTECTION"; break;
20457c478bd9Sstevel@tonic-gate 		case UT_ILLTRAP_INSTRUCTION:
20467c478bd9Sstevel@tonic-gate 			s = "UT_ILLTRAP_INSTRUCTION"; break;
20477c478bd9Sstevel@tonic-gate 		case UT_ILLEGAL_INSTRUCTION:
20487c478bd9Sstevel@tonic-gate 			s = "UT_ILLEGAL_INSTRUCTION"; break;
20497c478bd9Sstevel@tonic-gate 		case UT_PRIVILEGED_OPCODE:
20507c478bd9Sstevel@tonic-gate 			s = "UT_PRIVILEGED_OPCODE"; break;
20517c478bd9Sstevel@tonic-gate 		case UT_FP_DISABLED:
20527c478bd9Sstevel@tonic-gate 			s = "UT_FP_DISABLED"; break;
20537c478bd9Sstevel@tonic-gate 		case UT_FP_EXCEPTION_IEEE_754:
20547c478bd9Sstevel@tonic-gate 			s = "UT_FP_EXCEPTION_IEEE_754"; break;
20557c478bd9Sstevel@tonic-gate 		case UT_FP_EXCEPTION_OTHER:
20567c478bd9Sstevel@tonic-gate 			s = "UT_FP_EXCEPTION_OTHER"; break;
20577c478bd9Sstevel@tonic-gate 		case UT_TAG_OVERFLOW:
20587c478bd9Sstevel@tonic-gate 			s = "UT_TAG_OVERFLOW"; break;
20597c478bd9Sstevel@tonic-gate 		case UT_DIVISION_BY_ZERO:
20607c478bd9Sstevel@tonic-gate 			s = "UT_DIVISION_BY_ZERO"; break;
20617c478bd9Sstevel@tonic-gate 		case UT_DATA_EXCEPTION:
20627c478bd9Sstevel@tonic-gate 			s = "UT_DATA_EXCEPTION"; break;
20637c478bd9Sstevel@tonic-gate 		case UT_DATA_ERROR:
20647c478bd9Sstevel@tonic-gate 			s = "UT_DATA_ERROR"; break;
20657c478bd9Sstevel@tonic-gate 		case UT_DATA_PROTECTION:
20667c478bd9Sstevel@tonic-gate 			s = "UT_DATA_PROTECTION"; break;
20677c478bd9Sstevel@tonic-gate 		case UT_MEM_ADDRESS_NOT_ALIGNED:
20687c478bd9Sstevel@tonic-gate 			s = "UT_MEM_ADDRESS_NOT_ALIGNED"; break;
20697c478bd9Sstevel@tonic-gate 		case UT_PRIVILEGED_ACTION:
20707c478bd9Sstevel@tonic-gate 			s = "UT_PRIVILEGED_ACTION"; break;
20717c478bd9Sstevel@tonic-gate 		case UT_ASYNC_DATA_ERROR:
20727c478bd9Sstevel@tonic-gate 			s = "UT_ASYNC_DATA_ERROR"; break;
20737c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_16:
20747c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_16"; break;
20757c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_17:
20767c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_17"; break;
20777c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_18:
20787c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_18"; break;
20797c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_19:
20807c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_19"; break;
20817c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_20:
20827c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_20"; break;
20837c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_21:
20847c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_21"; break;
20857c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_22:
20867c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_22"; break;
20877c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_23:
20887c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_23"; break;
20897c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_24:
20907c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_24"; break;
20917c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_25:
20927c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_25"; break;
20937c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_26:
20947c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_26"; break;
20957c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_27:
20967c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_27"; break;
20977c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_28:
20987c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_28"; break;
20997c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_29:
21007c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_29"; break;
21017c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_30:
21027c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_30"; break;
21037c478bd9Sstevel@tonic-gate 		case UT_TRAP_INSTRUCTION_31:
21047c478bd9Sstevel@tonic-gate 			s = "UT_TRAP_INSTRUCTION_31"; break;
21057c478bd9Sstevel@tonic-gate 		}
21067c478bd9Sstevel@tonic-gate 	}
21077c478bd9Sstevel@tonic-gate #endif /* __sparc */
21087c478bd9Sstevel@tonic-gate 
21097c478bd9Sstevel@tonic-gate 	if (s == NULL)
21107c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
21117c478bd9Sstevel@tonic-gate 	else
21127c478bd9Sstevel@tonic-gate 		outstring(pri, s);
21137c478bd9Sstevel@tonic-gate }
21147c478bd9Sstevel@tonic-gate 
21157c478bd9Sstevel@tonic-gate 
21167c478bd9Sstevel@tonic-gate /*
21177c478bd9Sstevel@tonic-gate  * Print utrap handler
21187c478bd9Sstevel@tonic-gate  */
21197c478bd9Sstevel@tonic-gate void
21207c478bd9Sstevel@tonic-gate prt_uth(private_t *pri, int raw, long val)
21217c478bd9Sstevel@tonic-gate {
21227c478bd9Sstevel@tonic-gate 	const char *s = NULL;
21237c478bd9Sstevel@tonic-gate 
21247c478bd9Sstevel@tonic-gate 	if (!raw) {
21257c478bd9Sstevel@tonic-gate 		switch (val) {
21267c478bd9Sstevel@tonic-gate 		case (long)UTH_NOCHANGE:	s = "UTH_NOCHANGE"; break;
21277c478bd9Sstevel@tonic-gate 		}
21287c478bd9Sstevel@tonic-gate 	}
21297c478bd9Sstevel@tonic-gate 
21307c478bd9Sstevel@tonic-gate 	if (s == NULL)
21317c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
21327c478bd9Sstevel@tonic-gate 	else
21337c478bd9Sstevel@tonic-gate 		outstring(pri, s);
21347c478bd9Sstevel@tonic-gate }
21357c478bd9Sstevel@tonic-gate 
21367c478bd9Sstevel@tonic-gate const char *
21377c478bd9Sstevel@tonic-gate access_flags(private_t *pri, long arg)
21387c478bd9Sstevel@tonic-gate {
21397c478bd9Sstevel@tonic-gate #define	E_OK 010
21407c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
21417c478bd9Sstevel@tonic-gate 
21427c478bd9Sstevel@tonic-gate 	if (arg & ~(R_OK|W_OK|X_OK|E_OK))
21437c478bd9Sstevel@tonic-gate 		return (NULL);
21447c478bd9Sstevel@tonic-gate 
21457c478bd9Sstevel@tonic-gate 	/* NB: F_OK == 0 */
21467c478bd9Sstevel@tonic-gate 	if (arg == F_OK)
21477c478bd9Sstevel@tonic-gate 		return ("F_OK");
21487c478bd9Sstevel@tonic-gate 	if (arg == E_OK)
21497c478bd9Sstevel@tonic-gate 		return ("F_OK|E_OK");
21507c478bd9Sstevel@tonic-gate 
21517c478bd9Sstevel@tonic-gate 	*str = '\0';
21527c478bd9Sstevel@tonic-gate 	if (arg & R_OK)
21537c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|R_OK", sizeof (pri->code_buf));
21547c478bd9Sstevel@tonic-gate 	if (arg & W_OK)
21557c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|W_OK", sizeof (pri->code_buf));
21567c478bd9Sstevel@tonic-gate 	if (arg & X_OK)
21577c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|X_OK", sizeof (pri->code_buf));
21587c478bd9Sstevel@tonic-gate 	if (arg & E_OK)
21597c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|E_OK", sizeof (pri->code_buf));
21607c478bd9Sstevel@tonic-gate 	return ((const char *)(str + 1));
21617c478bd9Sstevel@tonic-gate #undef E_OK
21627c478bd9Sstevel@tonic-gate }
21637c478bd9Sstevel@tonic-gate 
21647c478bd9Sstevel@tonic-gate /*
21657c478bd9Sstevel@tonic-gate  * Print access() flags.
21667c478bd9Sstevel@tonic-gate  */
21677c478bd9Sstevel@tonic-gate void
21687c478bd9Sstevel@tonic-gate prt_acc(private_t *pri, int raw, long val)
21697c478bd9Sstevel@tonic-gate {
21707c478bd9Sstevel@tonic-gate 	const char *s = raw? NULL : access_flags(pri, val);
21717c478bd9Sstevel@tonic-gate 
21727c478bd9Sstevel@tonic-gate 	if (s == NULL)
21737c478bd9Sstevel@tonic-gate 		prt_dex(pri, 0, val);
21747c478bd9Sstevel@tonic-gate 	else
21757c478bd9Sstevel@tonic-gate 		outstring(pri, s);
21767c478bd9Sstevel@tonic-gate }
21777c478bd9Sstevel@tonic-gate 
21787c478bd9Sstevel@tonic-gate /*
21797c478bd9Sstevel@tonic-gate  * Print shutdown() "how" (2nd) argument
21807c478bd9Sstevel@tonic-gate  */
21817c478bd9Sstevel@tonic-gate void
21827c478bd9Sstevel@tonic-gate prt_sht(private_t *pri, int raw, long val)
21837c478bd9Sstevel@tonic-gate {
21847c478bd9Sstevel@tonic-gate 	if (raw) {
21857c478bd9Sstevel@tonic-gate 		prt_dex(pri, 0, val);
21867c478bd9Sstevel@tonic-gate 		return;
21877c478bd9Sstevel@tonic-gate 	}
21887c478bd9Sstevel@tonic-gate 	switch (val) {
21897c478bd9Sstevel@tonic-gate 	case SHUT_RD:	outstring(pri, "SHUT_RD");	break;
21907c478bd9Sstevel@tonic-gate 	case SHUT_WR:	outstring(pri, "SHUT_WR");	break;
21917c478bd9Sstevel@tonic-gate 	case SHUT_RDWR:	outstring(pri, "SHUT_RDWR");	break;
21927c478bd9Sstevel@tonic-gate 	default:	prt_dec(pri, 0, val);		break;
21937c478bd9Sstevel@tonic-gate 	}
21947c478bd9Sstevel@tonic-gate }
21957c478bd9Sstevel@tonic-gate 
21967c478bd9Sstevel@tonic-gate /*
21977c478bd9Sstevel@tonic-gate  * Print fcntl() F_SETFL flags (3rd) argument or fdsync flag (2nd arg)
21987c478bd9Sstevel@tonic-gate  */
21997c478bd9Sstevel@tonic-gate static struct fcntl_flags {
22007c478bd9Sstevel@tonic-gate 	long		val;
22017c478bd9Sstevel@tonic-gate 	const char	*name;
22027c478bd9Sstevel@tonic-gate } fcntl_flags[] = {
22037c478bd9Sstevel@tonic-gate #define	FC_FL(flag)	{ (long)flag, "|" # flag }
22047c478bd9Sstevel@tonic-gate 	FC_FL(FREVOKED),
22057c478bd9Sstevel@tonic-gate 	FC_FL(FREAD),
22067c478bd9Sstevel@tonic-gate 	FC_FL(FWRITE),
22077c478bd9Sstevel@tonic-gate 	FC_FL(FNDELAY),
22087c478bd9Sstevel@tonic-gate 	FC_FL(FAPPEND),
22097c478bd9Sstevel@tonic-gate 	FC_FL(FSYNC),
22107c478bd9Sstevel@tonic-gate 	FC_FL(FDSYNC),
22117c478bd9Sstevel@tonic-gate 	FC_FL(FRSYNC),
22127c478bd9Sstevel@tonic-gate 	FC_FL(FOFFMAX),
22137c478bd9Sstevel@tonic-gate 	FC_FL(FNONBLOCK),
22147c478bd9Sstevel@tonic-gate 	FC_FL(FCREAT),
22157c478bd9Sstevel@tonic-gate 	FC_FL(FTRUNC),
22167c478bd9Sstevel@tonic-gate 	FC_FL(FEXCL),
22177c478bd9Sstevel@tonic-gate 	FC_FL(FNOCTTY),
22187c478bd9Sstevel@tonic-gate 	FC_FL(FXATTR),
22197c478bd9Sstevel@tonic-gate 	FC_FL(FASYNC),
22207c478bd9Sstevel@tonic-gate 	FC_FL(FNODSYNC)
22217c478bd9Sstevel@tonic-gate #undef FC_FL
22227c478bd9Sstevel@tonic-gate };
22237c478bd9Sstevel@tonic-gate 
22247c478bd9Sstevel@tonic-gate void
22257c478bd9Sstevel@tonic-gate prt_ffg(private_t *pri, int raw, long val)
22267c478bd9Sstevel@tonic-gate {
22277c478bd9Sstevel@tonic-gate #define	CBSIZE	sizeof (pri->code_buf)
22287c478bd9Sstevel@tonic-gate 	char *s = pri->code_buf;
22297c478bd9Sstevel@tonic-gate 	size_t used = 1;
22307c478bd9Sstevel@tonic-gate 	struct fcntl_flags *fp;
22317c478bd9Sstevel@tonic-gate 
22327c478bd9Sstevel@tonic-gate 	if (raw) {
22337c478bd9Sstevel@tonic-gate 		(void) snprintf(s, CBSIZE, "0x%lx", val);
22347c478bd9Sstevel@tonic-gate 		outstring(pri, s);
22357c478bd9Sstevel@tonic-gate 		return;
22367c478bd9Sstevel@tonic-gate 	}
22377c478bd9Sstevel@tonic-gate 	if (val == 0) {
22387c478bd9Sstevel@tonic-gate 		outstring(pri, "(no flags)");
22397c478bd9Sstevel@tonic-gate 		return;
22407c478bd9Sstevel@tonic-gate 	}
22417c478bd9Sstevel@tonic-gate 
22427c478bd9Sstevel@tonic-gate 	*s = '\0';
22437c478bd9Sstevel@tonic-gate 	for (fp = fcntl_flags;
22447c478bd9Sstevel@tonic-gate 	    fp < &fcntl_flags[sizeof (fcntl_flags) / sizeof (*fp)]; fp++) {
22457c478bd9Sstevel@tonic-gate 		if (val & fp->val) {
22467c478bd9Sstevel@tonic-gate 			used = strlcat(s, fp->name, CBSIZE);
22477c478bd9Sstevel@tonic-gate 			val &= ~fp->val;
22487c478bd9Sstevel@tonic-gate 		}
22497c478bd9Sstevel@tonic-gate 	}
22507c478bd9Sstevel@tonic-gate 
22517c478bd9Sstevel@tonic-gate 	if (val != 0 && used <= CBSIZE)
22527c478bd9Sstevel@tonic-gate 		used += snprintf(s + used, CBSIZE - used, "|0x%lx", val);
22537c478bd9Sstevel@tonic-gate 
22547c478bd9Sstevel@tonic-gate 	if (used >= CBSIZE)
22557c478bd9Sstevel@tonic-gate 		(void) snprintf(s + 1, CBSIZE-1, "0x%lx", val);
22567c478bd9Sstevel@tonic-gate 	outstring(pri, s + 1);
22577c478bd9Sstevel@tonic-gate #undef CBSIZE
22587c478bd9Sstevel@tonic-gate }
22597c478bd9Sstevel@tonic-gate 
22607c478bd9Sstevel@tonic-gate void
22617c478bd9Sstevel@tonic-gate prt_prs(private_t *pri, int raw, long val)
22627c478bd9Sstevel@tonic-gate {
22637c478bd9Sstevel@tonic-gate 	static size_t setsize;
22647c478bd9Sstevel@tonic-gate 	priv_set_t *set = priv_allocset();
22657c478bd9Sstevel@tonic-gate 
22667c478bd9Sstevel@tonic-gate 	if (setsize == 0) {
22677c478bd9Sstevel@tonic-gate 		const priv_impl_info_t *info = getprivimplinfo();
22687c478bd9Sstevel@tonic-gate 		if (info != NULL)
22697c478bd9Sstevel@tonic-gate 			setsize = info->priv_setsize * sizeof (priv_chunk_t);
22707c478bd9Sstevel@tonic-gate 	}
22717c478bd9Sstevel@tonic-gate 
22727c478bd9Sstevel@tonic-gate 	if (setsize != 0 && !raw && set != NULL &&
22737c478bd9Sstevel@tonic-gate 	    Pread(Proc, set, setsize, val) == setsize) {
22747c478bd9Sstevel@tonic-gate 		int i;
22757c478bd9Sstevel@tonic-gate 
22767c478bd9Sstevel@tonic-gate 		outstring(pri, "{");
22777c478bd9Sstevel@tonic-gate 		for (i = 0; i < setsize / sizeof (priv_chunk_t); i++) {
22787c478bd9Sstevel@tonic-gate 			char buf[9];	/* 8 hex digits + '\0' */
22797c478bd9Sstevel@tonic-gate 			(void) snprintf(buf, sizeof (buf), "%08x",
22807c478bd9Sstevel@tonic-gate 			    ((priv_chunk_t *)set)[i]);
22817c478bd9Sstevel@tonic-gate 			outstring(pri, buf);
22827c478bd9Sstevel@tonic-gate 		}
22837c478bd9Sstevel@tonic-gate 
22847c478bd9Sstevel@tonic-gate 		outstring(pri, "}");
22857c478bd9Sstevel@tonic-gate 	} else {
22867c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
22877c478bd9Sstevel@tonic-gate 	}
22887c478bd9Sstevel@tonic-gate 
22897c478bd9Sstevel@tonic-gate 	if (set != NULL)
22907c478bd9Sstevel@tonic-gate 		priv_freeset(set);
22917c478bd9Sstevel@tonic-gate }
22927c478bd9Sstevel@tonic-gate 
22937c478bd9Sstevel@tonic-gate /*
22947c478bd9Sstevel@tonic-gate  * Print privilege set operation.
22957c478bd9Sstevel@tonic-gate  */
22967c478bd9Sstevel@tonic-gate void
22977c478bd9Sstevel@tonic-gate prt_pro(private_t *pri, int raw, long val)
22987c478bd9Sstevel@tonic-gate {
22997c478bd9Sstevel@tonic-gate 	const char *s = NULL;
23007c478bd9Sstevel@tonic-gate 
23017c478bd9Sstevel@tonic-gate 	if (!raw) {
23027c478bd9Sstevel@tonic-gate 		switch ((priv_op_t)val) {
23037c478bd9Sstevel@tonic-gate 		case PRIV_ON:		s = "PRIV_ON";		break;
23047c478bd9Sstevel@tonic-gate 		case PRIV_OFF:		s = "PRIV_OFF";		break;
23057c478bd9Sstevel@tonic-gate 		case PRIV_SET:		s = "PRIV_SET";		break;
23067c478bd9Sstevel@tonic-gate 		}
23077c478bd9Sstevel@tonic-gate 	}
23087c478bd9Sstevel@tonic-gate 
23097c478bd9Sstevel@tonic-gate 	if (s == NULL)
23107c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
23117c478bd9Sstevel@tonic-gate 	else
23127c478bd9Sstevel@tonic-gate 		outstring(pri, s);
23137c478bd9Sstevel@tonic-gate }
23147c478bd9Sstevel@tonic-gate 
23157c478bd9Sstevel@tonic-gate /*
23167c478bd9Sstevel@tonic-gate  * Print privilege set name
23177c478bd9Sstevel@tonic-gate  */
23187c478bd9Sstevel@tonic-gate void
23197c478bd9Sstevel@tonic-gate prt_prn(private_t *pri, int raw, long val)
23207c478bd9Sstevel@tonic-gate {
23217c478bd9Sstevel@tonic-gate 	const char *s = NULL;
23227c478bd9Sstevel@tonic-gate 
23237c478bd9Sstevel@tonic-gate 	if (!raw)
23247c478bd9Sstevel@tonic-gate 		s = priv_getsetbynum((int)val);
23257c478bd9Sstevel@tonic-gate 
23267c478bd9Sstevel@tonic-gate 	if (s == NULL)
23277c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
23287c478bd9Sstevel@tonic-gate 	else {
23297c478bd9Sstevel@tonic-gate 		char *dup = strdup(s);
23307c478bd9Sstevel@tonic-gate 		char *q;
23317c478bd9Sstevel@tonic-gate 
23327c478bd9Sstevel@tonic-gate 		/* Do the best we can in this case */
23337c478bd9Sstevel@tonic-gate 		if (dup == NULL) {
23347c478bd9Sstevel@tonic-gate 			outstring(pri, s);
23357c478bd9Sstevel@tonic-gate 			return;
23367c478bd9Sstevel@tonic-gate 		}
23377c478bd9Sstevel@tonic-gate 
23387c478bd9Sstevel@tonic-gate 		outstring(pri, "PRIV_");
23397c478bd9Sstevel@tonic-gate 
23407c478bd9Sstevel@tonic-gate 		q = dup;
23417c478bd9Sstevel@tonic-gate 
23427c478bd9Sstevel@tonic-gate 		while (*q != '\0') {
23437c478bd9Sstevel@tonic-gate 			*q = toupper(*q);
23447c478bd9Sstevel@tonic-gate 			q++;
23457c478bd9Sstevel@tonic-gate 		}
23467c478bd9Sstevel@tonic-gate 		outstring(pri, dup);
23477c478bd9Sstevel@tonic-gate 		free(dup);
23487c478bd9Sstevel@tonic-gate 	}
23497c478bd9Sstevel@tonic-gate }
23507c478bd9Sstevel@tonic-gate 
23517c478bd9Sstevel@tonic-gate /*
23527c478bd9Sstevel@tonic-gate  * Print process flag names.
23537c478bd9Sstevel@tonic-gate  */
23547c478bd9Sstevel@tonic-gate void
23557c478bd9Sstevel@tonic-gate prt_pfl(private_t *pri, int raw, long val)
23567c478bd9Sstevel@tonic-gate {
23577c478bd9Sstevel@tonic-gate 	const char *s = NULL;
23587c478bd9Sstevel@tonic-gate 
23597c478bd9Sstevel@tonic-gate 	if (!raw) {
23607c478bd9Sstevel@tonic-gate 		switch ((int)val) {
23617c478bd9Sstevel@tonic-gate 		case PRIV_DEBUG:	s = "PRIV_DEBUG";	break;
23627c478bd9Sstevel@tonic-gate 		case PRIV_AWARE:	s = "PRIV_AWARE";	break;
2363ddf7fe95Scasper 		case PRIV_XPOLICY:	s = "PRIV_XPOLICY";	break;
2364982b4ad2SCasper H.S. Dik 		case PRIV_AWARE_RESET:  s = "PRIV_AWARE_RESET"; break;
2365134a1f4eSCasper H.S. Dik 		case PRIV_PFEXEC:	s = "PRIV_PFEXEC";	break;
2366ddf7fe95Scasper 		case NET_MAC_AWARE:	s =  "NET_MAC_AWARE";	break;
2367ddf7fe95Scasper 		case NET_MAC_AWARE_INHERIT:
2368ddf7fe95Scasper 			s = "NET_MAC_AWARE_INHERIT";
2369ddf7fe95Scasper 			break;
23707c478bd9Sstevel@tonic-gate 		}
23717c478bd9Sstevel@tonic-gate 	}
23727c478bd9Sstevel@tonic-gate 
23737c478bd9Sstevel@tonic-gate 	if (s == NULL)
23747c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
23757c478bd9Sstevel@tonic-gate 	else
23767c478bd9Sstevel@tonic-gate 		outstring(pri, s);
23777c478bd9Sstevel@tonic-gate }
23787c478bd9Sstevel@tonic-gate 
23797c478bd9Sstevel@tonic-gate /*
23807c478bd9Sstevel@tonic-gate  * Print lgrp_affinity_{get,set}() arguments.
23817c478bd9Sstevel@tonic-gate  */
23827c478bd9Sstevel@tonic-gate /*ARGSUSED*/
23837c478bd9Sstevel@tonic-gate void
23847c478bd9Sstevel@tonic-gate prt_laf(private_t *pri, int raw, long val)
23857c478bd9Sstevel@tonic-gate {
23867c478bd9Sstevel@tonic-gate 	lgrp_affinity_args_t	laff;
23877c478bd9Sstevel@tonic-gate 
23887c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &laff, sizeof (lgrp_affinity_args_t), val) !=
23897c478bd9Sstevel@tonic-gate 	    sizeof (lgrp_affinity_args_t)) {
23907c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
23917c478bd9Sstevel@tonic-gate 		return;
23927c478bd9Sstevel@tonic-gate 	}
23937c478bd9Sstevel@tonic-gate 	/*
23947c478bd9Sstevel@tonic-gate 	 * arrange the arguments in the order that user calls with
23957c478bd9Sstevel@tonic-gate 	 */
23967c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, laff.idtype);
23977c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
23987c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, laff.id);
23997c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
24007c478bd9Sstevel@tonic-gate 	prt_dec(pri, 0, laff.lgrp);
24017c478bd9Sstevel@tonic-gate 	outstring(pri, ", ");
24027c478bd9Sstevel@tonic-gate 	if (pri->sys_args[0] == LGRP_SYS_AFFINITY_SET)
24037c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, laff.aff);
24047c478bd9Sstevel@tonic-gate }
24057c478bd9Sstevel@tonic-gate 
24067c478bd9Sstevel@tonic-gate /*
24077c478bd9Sstevel@tonic-gate  * Print a key_t as IPC_PRIVATE if it is 0.
24087c478bd9Sstevel@tonic-gate  */
24097c478bd9Sstevel@tonic-gate void
24107c478bd9Sstevel@tonic-gate prt_key(private_t *pri, int raw, long val)
24117c478bd9Sstevel@tonic-gate {
24127c478bd9Sstevel@tonic-gate 	if (!raw && val == 0)
24137c478bd9Sstevel@tonic-gate 		outstring(pri, "IPC_PRIVATE");
24147c478bd9Sstevel@tonic-gate 	else
24157c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
24167c478bd9Sstevel@tonic-gate }
24177c478bd9Sstevel@tonic-gate 
24187c478bd9Sstevel@tonic-gate 
24197c478bd9Sstevel@tonic-gate /*
24207c478bd9Sstevel@tonic-gate  * Print zone_getattr() attribute types.
24217c478bd9Sstevel@tonic-gate  */
24227c478bd9Sstevel@tonic-gate void
24237c478bd9Sstevel@tonic-gate prt_zga(private_t *pri, int raw, long val)
24247c478bd9Sstevel@tonic-gate {
24257c478bd9Sstevel@tonic-gate 	const char *s = NULL;
24267c478bd9Sstevel@tonic-gate 
24277c478bd9Sstevel@tonic-gate 	if (!raw) {
24287c478bd9Sstevel@tonic-gate 		switch ((int)val) {
24297c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_NAME:	s = "ZONE_ATTR_NAME";	break;
24307c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_ROOT:	s = "ZONE_ATTR_ROOT";	break;
24317c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_STATUS:	s = "ZONE_ATTR_STATUS";	break;
24327c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_PRIVSET:	s = "ZONE_ATTR_PRIVSET"; break;
24337c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_UNIQID:	s = "ZONE_ATTR_UNIQID"; break;
24347c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_POOLID:	s = "ZONE_ATTR_POOLID"; break;
24357c478bd9Sstevel@tonic-gate 		case ZONE_ATTR_INITPID:	s = "ZONE_ATTR_INITPID"; break;
243645916cd2Sjpk 		case ZONE_ATTR_SLBL:	s = "ZONE_ATTR_SLBL"; break;
24373f2f09c1Sdp 		case ZONE_ATTR_INITNAME:	s = "ZONE_ATTR_INITNAME"; break;
24383f2f09c1Sdp 		case ZONE_ATTR_BOOTARGS:	s = "ZONE_ATTR_BOOTARGS"; break;
2439bafa7067Snn35248 		case ZONE_ATTR_BRAND:	s = "ZONE_ATTR_BRAND"; break;
2440f4b3ec61Sdh155122 		case ZONE_ATTR_FLAGS:	s = "ZONE_ATTR_FLAGS"; break;
24410209230bSgjelinek 		case ZONE_ATTR_PHYS_MCAP: s = "ZONE_ATTR_PHYS_MCAP"; break;
24427c478bd9Sstevel@tonic-gate 		}
24437c478bd9Sstevel@tonic-gate 	}
24447c478bd9Sstevel@tonic-gate 
24457c478bd9Sstevel@tonic-gate 	if (s == NULL)
24467c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
24477c478bd9Sstevel@tonic-gate 	else
24487c478bd9Sstevel@tonic-gate 		outstring(pri, s);
24497c478bd9Sstevel@tonic-gate }
24507c478bd9Sstevel@tonic-gate 
24517c478bd9Sstevel@tonic-gate /*
24527c478bd9Sstevel@tonic-gate  * Print a file descriptor as AT_FDCWD if necessary
24537c478bd9Sstevel@tonic-gate  */
24547c478bd9Sstevel@tonic-gate void
24557c478bd9Sstevel@tonic-gate prt_atc(private_t *pri, int raw, long val)
24567c478bd9Sstevel@tonic-gate {
24578fd04b83SRoger A. Faulkner 	if ((int)val == AT_FDCWD) {
24588fd04b83SRoger A. Faulkner 		if (raw)
24598fd04b83SRoger A. Faulkner 			prt_hex(pri, 0, (uint_t)AT_FDCWD);
24607c478bd9Sstevel@tonic-gate 		else
24618fd04b83SRoger A. Faulkner 			outstring(pri, "AT_FDCWD");
24628fd04b83SRoger A. Faulkner 	} else {
24637c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
24647c478bd9Sstevel@tonic-gate 	}
24658fd04b83SRoger A. Faulkner }
24667c478bd9Sstevel@tonic-gate 
24677c478bd9Sstevel@tonic-gate /*
246845916cd2Sjpk  * Print Trusted Networking database operation codes (labelsys; tn*)
246945916cd2Sjpk  */
247045916cd2Sjpk static void
247145916cd2Sjpk prt_tnd(private_t *pri, int raw, long val)
247245916cd2Sjpk {
247345916cd2Sjpk 	const char *s = NULL;
247445916cd2Sjpk 
247545916cd2Sjpk 	if (!raw) {
247645916cd2Sjpk 		switch ((tsol_dbops_t)val) {
247745916cd2Sjpk 		case TNDB_NOOP:		s = "TNDB_NOOP";	break;
247845916cd2Sjpk 		case TNDB_LOAD:		s = "TNDB_LOAD";	break;
247945916cd2Sjpk 		case TNDB_DELETE:	s = "TNDB_DELETE";	break;
248045916cd2Sjpk 		case TNDB_FLUSH:	s = "TNDB_FLUSH";	break;
248145916cd2Sjpk 		case TNDB_GET:		s = "TNDB_GET";		break;
248245916cd2Sjpk 		}
248345916cd2Sjpk 	}
248445916cd2Sjpk 
248545916cd2Sjpk 	if (s == NULL)
248645916cd2Sjpk 		prt_dec(pri, 0, val);
248745916cd2Sjpk 	else
248845916cd2Sjpk 		outstring(pri, s);
248945916cd2Sjpk }
249045916cd2Sjpk 
249145916cd2Sjpk /*
24927c478bd9Sstevel@tonic-gate  * Print LIO_XX flags
24937c478bd9Sstevel@tonic-gate  */
24947c478bd9Sstevel@tonic-gate void
24957c478bd9Sstevel@tonic-gate prt_lio(private_t *pri, int raw, long val)
24967c478bd9Sstevel@tonic-gate {
24977c478bd9Sstevel@tonic-gate 	if (raw)
24987c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
24997c478bd9Sstevel@tonic-gate 	else if (val == LIO_WAIT)
25007c478bd9Sstevel@tonic-gate 		outstring(pri, "LIO_WAIT");
25017c478bd9Sstevel@tonic-gate 	else if (val == LIO_NOWAIT)
25027c478bd9Sstevel@tonic-gate 		outstring(pri, "LIO_NOWAIT");
25037c478bd9Sstevel@tonic-gate 	else
25047c478bd9Sstevel@tonic-gate 		prt_dec(pri, 0, val);
25057c478bd9Sstevel@tonic-gate }
25067c478bd9Sstevel@tonic-gate 
25077c478bd9Sstevel@tonic-gate const char *
25087c478bd9Sstevel@tonic-gate door_flags(private_t *pri, long val)
25097c478bd9Sstevel@tonic-gate {
25107c478bd9Sstevel@tonic-gate 	door_attr_t attr = (door_attr_t)val;
25117c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
25127c478bd9Sstevel@tonic-gate 
25137c478bd9Sstevel@tonic-gate 	*str = '\0';
25147c478bd9Sstevel@tonic-gate #define	PROCESS_FLAG(flg)						\
25157c478bd9Sstevel@tonic-gate 	if (attr & flg) {						\
25167c478bd9Sstevel@tonic-gate 		(void) strlcat(str, "|" #flg, sizeof (pri->code_buf));	\
25177c478bd9Sstevel@tonic-gate 		attr &= ~flg;						\
25187c478bd9Sstevel@tonic-gate 	}
25197c478bd9Sstevel@tonic-gate 
25207c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_UNREF);
25217c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_UNREF_MULTI);
25227c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_PRIVATE);
25237c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_REFUSE_DESC);
25247c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_NO_CANCEL);
25257c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_LOCAL);
25267c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_REVOKED);
25277c478bd9Sstevel@tonic-gate 	PROCESS_FLAG(DOOR_IS_UNREF);
25287c478bd9Sstevel@tonic-gate #undef PROCESS_FLAG
25297c478bd9Sstevel@tonic-gate 
25307c478bd9Sstevel@tonic-gate 	if (attr != 0 || *str == '\0') {
25317c478bd9Sstevel@tonic-gate 		size_t len = strlen(str);
25327c478bd9Sstevel@tonic-gate 		(void) snprintf(str + len, sizeof (pri->code_buf) - len,
25337c478bd9Sstevel@tonic-gate 		    "|0x%X", attr);
25347c478bd9Sstevel@tonic-gate 	}
25357c478bd9Sstevel@tonic-gate 
25367c478bd9Sstevel@tonic-gate 	return (str + 1);
25377c478bd9Sstevel@tonic-gate }
25387c478bd9Sstevel@tonic-gate 
25397c478bd9Sstevel@tonic-gate /*
25407c478bd9Sstevel@tonic-gate  * Print door_create() flags
25417c478bd9Sstevel@tonic-gate  */
25427c478bd9Sstevel@tonic-gate void
25437c478bd9Sstevel@tonic-gate prt_dfl(private_t *pri, int raw, long val)
25447c478bd9Sstevel@tonic-gate {
25457c478bd9Sstevel@tonic-gate 	if (raw)
25467c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
25477c478bd9Sstevel@tonic-gate 	else
25487c478bd9Sstevel@tonic-gate 		outstring(pri, door_flags(pri, val));
25497c478bd9Sstevel@tonic-gate }
25507c478bd9Sstevel@tonic-gate 
25517c478bd9Sstevel@tonic-gate /*
25527c478bd9Sstevel@tonic-gate  * Print door_*param() param argument
25537c478bd9Sstevel@tonic-gate  */
25547c478bd9Sstevel@tonic-gate void
25557c478bd9Sstevel@tonic-gate prt_dpm(private_t *pri, int raw, long val)
25567c478bd9Sstevel@tonic-gate {
25577c478bd9Sstevel@tonic-gate 	if (raw)
25587c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
25597c478bd9Sstevel@tonic-gate 	else if (val == DOOR_PARAM_DESC_MAX)
25607c478bd9Sstevel@tonic-gate 		outstring(pri, "DOOR_PARAM_DESC_MAX");
25617c478bd9Sstevel@tonic-gate 	else if (val == DOOR_PARAM_DATA_MIN)
25627c478bd9Sstevel@tonic-gate 		outstring(pri, "DOOR_PARAM_DATA_MIN");
25637c478bd9Sstevel@tonic-gate 	else if (val == DOOR_PARAM_DATA_MAX)
25647c478bd9Sstevel@tonic-gate 		outstring(pri, "DOOR_PARAM_DATA_MAX");
25657c478bd9Sstevel@tonic-gate 	else
25667c478bd9Sstevel@tonic-gate 		prt_hex(pri, 0, val);
25677c478bd9Sstevel@tonic-gate }
25687c478bd9Sstevel@tonic-gate 
25697c478bd9Sstevel@tonic-gate /*
2570aa4a4f3bSnf202958  * Print rctlsys subcodes
2571aa4a4f3bSnf202958  */
2572aa4a4f3bSnf202958 void
2573aa4a4f3bSnf202958 prt_rsc(private_t *pri, int raw, long val)	/* print utssys code */
2574aa4a4f3bSnf202958 {
2575aa4a4f3bSnf202958 	const char *s = raw? NULL : rctlsyscode(val);
2576aa4a4f3bSnf202958 
2577aa4a4f3bSnf202958 	if (s == NULL)
2578aa4a4f3bSnf202958 		prt_dec(pri, 0, val);
2579aa4a4f3bSnf202958 	else
2580aa4a4f3bSnf202958 		outstring(pri, s);
2581aa4a4f3bSnf202958 }
2582aa4a4f3bSnf202958 
2583aa4a4f3bSnf202958 /*
2584aa4a4f3bSnf202958  * Print getrctl flags
2585aa4a4f3bSnf202958  */
2586aa4a4f3bSnf202958 void
2587aa4a4f3bSnf202958 prt_rgf(private_t *pri, int raw, long val)
2588aa4a4f3bSnf202958 {
2589aa4a4f3bSnf202958 	long action = val & (~RCTLSYS_ACTION_MASK);
2590aa4a4f3bSnf202958 
2591aa4a4f3bSnf202958 	if (raw)
2592aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2593aa4a4f3bSnf202958 	else if (action == RCTL_FIRST)
2594aa4a4f3bSnf202958 		outstring(pri, "RCTL_FIRST");
2595aa4a4f3bSnf202958 	else if (action == RCTL_NEXT)
2596aa4a4f3bSnf202958 		outstring(pri, "RCTL_NEXT");
2597aa4a4f3bSnf202958 	else if (action == RCTL_USAGE)
2598aa4a4f3bSnf202958 		outstring(pri, "RCTL_USAGE");
2599aa4a4f3bSnf202958 	else
2600aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2601aa4a4f3bSnf202958 }
2602aa4a4f3bSnf202958 
2603aa4a4f3bSnf202958 /*
2604aa4a4f3bSnf202958  * Print setrctl flags
2605aa4a4f3bSnf202958  */
2606aa4a4f3bSnf202958 void
2607aa4a4f3bSnf202958 prt_rsf(private_t *pri, int raw, long val)
2608aa4a4f3bSnf202958 {
2609aa4a4f3bSnf202958 	long action = val & (~RCTLSYS_ACTION_MASK);
2610aa4a4f3bSnf202958 	long pval = val & RCTL_LOCAL_ACTION_MASK;
2611aa4a4f3bSnf202958 	char *s = pri->code_buf;
2612aa4a4f3bSnf202958 
2613aa4a4f3bSnf202958 	if (raw) {
2614aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2615aa4a4f3bSnf202958 		return;
2616aa4a4f3bSnf202958 	} else if (action == RCTL_INSERT)
2617aa4a4f3bSnf202958 		(void) strcpy(s, "RCTL_INSERT");
2618aa4a4f3bSnf202958 	else if (action == RCTL_DELETE)
2619aa4a4f3bSnf202958 		(void) strcpy(s, "RCTL_DELETE");
2620aa4a4f3bSnf202958 	else if (action == RCTL_REPLACE)
2621aa4a4f3bSnf202958 		(void) strcpy(s, "RCTL_REPLACE");
2622aa4a4f3bSnf202958 	else {
2623aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2624aa4a4f3bSnf202958 		return;
2625aa4a4f3bSnf202958 	}
2626aa4a4f3bSnf202958 
2627aa4a4f3bSnf202958 	if (pval & RCTL_USE_RECIPIENT_PID) {
2628aa4a4f3bSnf202958 		pval ^= RCTL_USE_RECIPIENT_PID;
2629aa4a4f3bSnf202958 		(void) strlcat(s, "|RCTL_USE_RECIPIENT_PID",
2630aa4a4f3bSnf202958 		    sizeof (pri->code_buf));
2631aa4a4f3bSnf202958 	}
2632aa4a4f3bSnf202958 
2633aa4a4f3bSnf202958 	if ((pval & RCTLSYS_ACTION_MASK) != 0)
2634aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2635aa4a4f3bSnf202958 	else if (*s != '\0')
2636aa4a4f3bSnf202958 		outstring(pri, s);
2637aa4a4f3bSnf202958 	else
2638aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2639aa4a4f3bSnf202958 }
2640aa4a4f3bSnf202958 
2641aa4a4f3bSnf202958 /*
2642aa4a4f3bSnf202958  * Print rctlctl flags
2643aa4a4f3bSnf202958  */
2644aa4a4f3bSnf202958 void
2645aa4a4f3bSnf202958 prt_rcf(private_t *pri, int raw, long val)
2646aa4a4f3bSnf202958 {
2647aa4a4f3bSnf202958 	long action = val & (~RCTLSYS_ACTION_MASK);
2648aa4a4f3bSnf202958 
2649aa4a4f3bSnf202958 	if (raw)
2650aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2651aa4a4f3bSnf202958 	else if (action == RCTLCTL_GET)
2652aa4a4f3bSnf202958 		outstring(pri, "RCTLCTL_GET");
2653aa4a4f3bSnf202958 	else if (action == RCTLCTL_SET)
2654aa4a4f3bSnf202958 		outstring(pri, "RCTLCTL_SET");
2655aa4a4f3bSnf202958 	else
2656aa4a4f3bSnf202958 		prt_hex(pri, 0, val);
2657aa4a4f3bSnf202958 }
2658aa4a4f3bSnf202958 
2659657b1f3dSraf /*
2660532877c4Srd117015  * Print setprojrctl flags
2661532877c4Srd117015  */
2662532877c4Srd117015 void
2663532877c4Srd117015 prt_spf(private_t *pri, int raw, long val)
2664532877c4Srd117015 {
2665532877c4Srd117015 	long action = val & TASK_PROJ_MASK;
2666532877c4Srd117015 
2667532877c4Srd117015 	if (!raw && (action == TASK_PROJ_PURGE))
2668532877c4Srd117015 		outstring(pri, "TASK_PROJ_PURGE");
2669532877c4Srd117015 	else
2670532877c4Srd117015 		prt_hex(pri, 0, val);
2671532877c4Srd117015 }
2672532877c4Srd117015 
2673532877c4Srd117015 /*
2674657b1f3dSraf  * Print forkx() flags
2675657b1f3dSraf  */
2676657b1f3dSraf void
2677657b1f3dSraf prt_fxf(private_t *pri, int raw, long val)
2678657b1f3dSraf {
2679657b1f3dSraf 	char *str;
2680657b1f3dSraf 
2681657b1f3dSraf 	if (val == 0)
2682657b1f3dSraf 		outstring(pri, "0");
2683657b1f3dSraf 	else if (raw || (val & ~(FORK_NOSIGCHLD | FORK_WAITPID)))
2684657b1f3dSraf 		prt_hhx(pri, 0, val);
2685657b1f3dSraf 	else {
2686657b1f3dSraf 		str = pri->code_buf;
2687657b1f3dSraf 		*str = '\0';
2688657b1f3dSraf 		if (val & FORK_NOSIGCHLD)
2689657b1f3dSraf 			(void) strlcat(str, "|FORK_NOSIGCHLD",
2690657b1f3dSraf 			    sizeof (pri->code_buf));
2691657b1f3dSraf 		if (val & FORK_WAITPID)
2692657b1f3dSraf 			(void) strlcat(str, "|FORK_WAITPID",
2693657b1f3dSraf 			    sizeof (pri->code_buf));
2694657b1f3dSraf 		outstring(pri, str + 1);
2695657b1f3dSraf 	}
2696657b1f3dSraf }
2697aa4a4f3bSnf202958 
2698aa4a4f3bSnf202958 /*
2699794f0adbSRoger A. Faulkner  * Print faccessat() flag
27003b862e9aSRoger A. Faulkner  */
27013b862e9aSRoger A. Faulkner void
2702794f0adbSRoger A. Faulkner prt_fat(private_t *pri, int raw, long val)
2703794f0adbSRoger A. Faulkner {
2704794f0adbSRoger A. Faulkner 	if (val == 0)
2705794f0adbSRoger A. Faulkner 		outstring(pri, "0");
2706794f0adbSRoger A. Faulkner 	else if (!raw && val == AT_EACCESS)
2707794f0adbSRoger A. Faulkner 		outstring(pri, "AT_EACCESS");
2708794f0adbSRoger A. Faulkner 	else
2709794f0adbSRoger A. Faulkner 		prt_hex(pri, 0, val);
2710794f0adbSRoger A. Faulkner }
2711794f0adbSRoger A. Faulkner 
2712794f0adbSRoger A. Faulkner /*
2713794f0adbSRoger A. Faulkner  * Print unlinkat() flag
2714794f0adbSRoger A. Faulkner  */
2715794f0adbSRoger A. Faulkner void
2716794f0adbSRoger A. Faulkner prt_uat(private_t *pri, int raw, long val)
2717794f0adbSRoger A. Faulkner {
2718794f0adbSRoger A. Faulkner 	if (val == 0)
2719794f0adbSRoger A. Faulkner 		outstring(pri, "0");
2720794f0adbSRoger A. Faulkner 	else if (!raw && val == AT_REMOVEDIR)
2721794f0adbSRoger A. Faulkner 		outstring(pri, "AT_REMOVEDIR");
2722794f0adbSRoger A. Faulkner 	else
2723794f0adbSRoger A. Faulkner 		prt_hex(pri, 0, val);
2724794f0adbSRoger A. Faulkner }
2725794f0adbSRoger A. Faulkner 
2726794f0adbSRoger A. Faulkner /*
2727794f0adbSRoger A. Faulkner  * Print AT_SYMLINK_NOFOLLOW / AT_SYMLINK_FOLLOW flag
2728794f0adbSRoger A. Faulkner  */
2729794f0adbSRoger A. Faulkner void
2730794f0adbSRoger A. Faulkner prt_snf(private_t *pri, int raw, long val)
27313b862e9aSRoger A. Faulkner {
27323b862e9aSRoger A. Faulkner 	if (val == 0)
27333b862e9aSRoger A. Faulkner 		outstring(pri, "0");
27343b862e9aSRoger A. Faulkner 	else if (!raw && val == AT_SYMLINK_NOFOLLOW)
27353b862e9aSRoger A. Faulkner 		outstring(pri, "AT_SYMLINK_NOFOLLOW");
2736794f0adbSRoger A. Faulkner 	else if (!raw && val == AT_SYMLINK_FOLLOW)
2737794f0adbSRoger A. Faulkner 		outstring(pri, "AT_SYMLINK_FOLLOW");
27383b862e9aSRoger A. Faulkner 	else
27393b862e9aSRoger A. Faulkner 		prt_hex(pri, 0, val);
27403b862e9aSRoger A. Faulkner }
27413b862e9aSRoger A. Faulkner 
27423b862e9aSRoger A. Faulkner /*
27437c478bd9Sstevel@tonic-gate  * Array of pointers to print functions, one for each format.
27447c478bd9Sstevel@tonic-gate  */
27457c478bd9Sstevel@tonic-gate void (* const Print[])() = {
27467c478bd9Sstevel@tonic-gate 	prt_nov,	/* NOV -- no value */
27477c478bd9Sstevel@tonic-gate 	prt_dec,	/* DEC -- print value in decimal */
27487c478bd9Sstevel@tonic-gate 	prt_oct,	/* OCT -- print value in octal */
27497c478bd9Sstevel@tonic-gate 	prt_hex,	/* HEX -- print value in hexadecimal */
27507c478bd9Sstevel@tonic-gate 	prt_dex,	/* DEX -- print value in hexadecimal if big enough */
27517c478bd9Sstevel@tonic-gate 	prt_stg,	/* STG -- print value as string */
27527c478bd9Sstevel@tonic-gate 	prt_ioc,	/* IOC -- print ioctl code */
27537c478bd9Sstevel@tonic-gate 	prt_fcn,	/* FCN -- print fcntl code */
27547c478bd9Sstevel@tonic-gate 	prt_s86,	/* S86 -- print sysi86 code */
27557c478bd9Sstevel@tonic-gate 	prt_uts,	/* UTS -- print utssys code */
27567c478bd9Sstevel@tonic-gate 	prt_opn,	/* OPN -- print open code */
27577c478bd9Sstevel@tonic-gate 	prt_sig,	/* SIG -- print signal name plus flags */
2758794f0adbSRoger A. Faulkner 	prt_uat,	/* UAT -- print unlinkat() flag */
27597c478bd9Sstevel@tonic-gate 	prt_msc,	/* MSC -- print msgsys command */
27607c478bd9Sstevel@tonic-gate 	prt_msf,	/* MSF -- print msgsys flags */
27617c478bd9Sstevel@tonic-gate 	prt_smc,	/* SMC -- print semsys command */
27627c478bd9Sstevel@tonic-gate 	prt_sef,	/* SEF -- print semsys flags */
27637c478bd9Sstevel@tonic-gate 	prt_shc,	/* SHC -- print shmsys command */
27647c478bd9Sstevel@tonic-gate 	prt_shf,	/* SHF -- print shmsys flags */
2765794f0adbSRoger A. Faulkner 	prt_fat,	/* FAT -- print faccessat( flag */
27667c478bd9Sstevel@tonic-gate 	prt_sfs,	/* SFS -- print sysfs code */
27677c478bd9Sstevel@tonic-gate 	prt_rst,	/* RST -- print string returned by syscall */
27687c478bd9Sstevel@tonic-gate 	prt_smf,	/* SMF -- print streams message flags */
27697c478bd9Sstevel@tonic-gate 	prt_ioa,	/* IOA -- print ioctl argument */
27705dbfd19aSTheo Schlossnagle 	prt_pip,	/* PIP -- print pipe flags */
27717c478bd9Sstevel@tonic-gate 	prt_mtf,	/* MTF -- print mount flags */
27727c478bd9Sstevel@tonic-gate 	prt_mft,	/* MFT -- print mount file system type */
27737c478bd9Sstevel@tonic-gate 	prt_iob,	/* IOB -- print contents of I/O buffer */
27747c478bd9Sstevel@tonic-gate 	prt_hhx,	/* HHX -- print value in hexadecimal (half size) */
27757c478bd9Sstevel@tonic-gate 	prt_wop,	/* WOP -- print waitsys() options */
27767c478bd9Sstevel@tonic-gate 	prt_spm,	/* SPM -- print sigprocmask argument */
27777c478bd9Sstevel@tonic-gate 	prt_rlk,	/* RLK -- print readlink buffer */
27787c478bd9Sstevel@tonic-gate 	prt_mpr,	/* MPR -- print mmap()/mprotect() flags */
27797c478bd9Sstevel@tonic-gate 	prt_mty,	/* MTY -- print mmap() mapping type flags */
27807c478bd9Sstevel@tonic-gate 	prt_mcf,	/* MCF -- print memcntl() function */
27817c478bd9Sstevel@tonic-gate 	prt_mc4,	/* MC4 -- print memcntl() (fourth) argument */
27827c478bd9Sstevel@tonic-gate 	prt_mc5,	/* MC5 -- print memcntl() (fifth) argument */
27837c478bd9Sstevel@tonic-gate 	prt_mad,	/* MAD -- print madvise() argument */
27847c478bd9Sstevel@tonic-gate 	prt_ulm,	/* ULM -- print ulimit() argument */
27857c478bd9Sstevel@tonic-gate 	prt_rlm,	/* RLM -- print get/setrlimit() argument */
27867c478bd9Sstevel@tonic-gate 	prt_cnf,	/* CNF -- print sysconfig() argument */
27877c478bd9Sstevel@tonic-gate 	prt_inf,	/* INF -- print sysinfo() argument */
27887c478bd9Sstevel@tonic-gate 	prt_ptc,	/* PTC -- print pathconf/fpathconf() argument */
27897c478bd9Sstevel@tonic-gate 	prt_fui,	/* FUI -- print fusers() input argument */
27907c478bd9Sstevel@tonic-gate 	prt_idt,	/* IDT -- print idtype_t, waitid() argument */
27917c478bd9Sstevel@tonic-gate 	prt_lwf,	/* LWF -- print lwp_create() flags */
27927c478bd9Sstevel@tonic-gate 	prt_itm,	/* ITM -- print [get|set]itimer() arg */
27937c478bd9Sstevel@tonic-gate 	prt_llo,	/* LLO -- print long long offset arg */
27947c478bd9Sstevel@tonic-gate 	prt_mod,	/* MOD -- print modctl() subcode */
27957c478bd9Sstevel@tonic-gate 	prt_whn,	/* WHN -- print lseek() whence arguiment */
27967c478bd9Sstevel@tonic-gate 	prt_acl,	/* ACL -- print acl() code */
27977c478bd9Sstevel@tonic-gate 	prt_aio,	/* AIO -- print kaio() code */
27987c478bd9Sstevel@tonic-gate 	prt_aud,	/* AUD -- print auditsys() code */
27997c478bd9Sstevel@tonic-gate 	prt_uns,	/* DEC -- print value in unsigned decimal */
28007c478bd9Sstevel@tonic-gate 	prt_clc,	/* CLC -- print cladm command argument */
28017c478bd9Sstevel@tonic-gate 	prt_clf,	/* CLF -- print cladm flag argument */
28027c478bd9Sstevel@tonic-gate 	prt_cor,	/* COR -- print corectl() subcode */
28037c478bd9Sstevel@tonic-gate 	prt_cco,	/* CCO -- print corectl() options */
28047c478bd9Sstevel@tonic-gate 	prt_ccc,	/* CCC -- print corectl() content */
28057c478bd9Sstevel@tonic-gate 	prt_rcc,	/* RCC -- print corectl() returned content */
28067c478bd9Sstevel@tonic-gate 	prt_cpc,	/* CPC -- print cpc() subcode */
28077c478bd9Sstevel@tonic-gate 	prt_sqc,	/* SQC -- print sigqueue() si_code argument */
28087c478bd9Sstevel@tonic-gate 	prt_pc4,	/* PC4 -- print priocntlsys() (fourth) argument */
28097c478bd9Sstevel@tonic-gate 	prt_pc5,	/* PC5 -- print priocntlsys() (key, value) pairs */
28107c478bd9Sstevel@tonic-gate 	prt_pst,	/* PST -- print processor set id */
28117c478bd9Sstevel@tonic-gate 	prt_mif,	/* MIF -- print meminfo() arguments */
28127c478bd9Sstevel@tonic-gate 	prt_pfm,	/* PFM -- print so_socket() proto-family (1st) arg */
28137c478bd9Sstevel@tonic-gate 	prt_skt,	/* SKT -- print so_socket() socket-type (2nd) arg */
28147c478bd9Sstevel@tonic-gate 	prt_skp,	/* SKP -- print so_socket() protocol (3rd) arg */
28157c478bd9Sstevel@tonic-gate 	prt_skv,	/* SKV -- print socket version arg */
28167c478bd9Sstevel@tonic-gate 	prt_sol,	/* SOL -- print [sg]etsockopt() level (2nd) arg */
28177c478bd9Sstevel@tonic-gate 	prt_son,	/* SON -- print [sg]etsockopt() opt-name (3rd) arg */
28187c478bd9Sstevel@tonic-gate 	prt_utt,	/* UTT -- print utrap type */
28197c478bd9Sstevel@tonic-gate 	prt_uth,	/* UTH -- print utrap handler */
28207c478bd9Sstevel@tonic-gate 	prt_acc,	/* ACC -- print access() flags */
28217c478bd9Sstevel@tonic-gate 	prt_sht,	/* SHT -- print shutdown() how (2nd) argument */
28227c478bd9Sstevel@tonic-gate 	prt_ffg,	/* FFG -- print fcntl() flags (3rd) argument */
28237c478bd9Sstevel@tonic-gate 	prt_prs,	/* PRS -- print privilege set */
28247c478bd9Sstevel@tonic-gate 	prt_pro,	/* PRO -- print privilege set operation */
28257c478bd9Sstevel@tonic-gate 	prt_prn,	/* PRN -- print privilege set name */
28267c478bd9Sstevel@tonic-gate 	prt_pfl,	/* PFL -- print privilege/process flag name */
28277c478bd9Sstevel@tonic-gate 	prt_laf,	/* LAF -- print lgrp_affinity arguments */
28287c478bd9Sstevel@tonic-gate 	prt_key,	/* KEY -- print key_t 0 as IPC_PRIVATE */
28297c478bd9Sstevel@tonic-gate 	prt_zga,	/* ZGA -- print zone_getattr attribute types */
28307c478bd9Sstevel@tonic-gate 	prt_atc,	/* ATC -- print AT_FDCWD or file descriptor */
28317c478bd9Sstevel@tonic-gate 	prt_lio,	/* LIO -- print LIO_XX flags */
28327c478bd9Sstevel@tonic-gate 	prt_dfl,	/* DFL -- print door_create() flags */
28337c478bd9Sstevel@tonic-gate 	prt_dpm,	/* DPM -- print DOOR_PARAM_XX flags */
283445916cd2Sjpk 	prt_tnd,	/* TND -- print trusted network data base opcode */
2835aa4a4f3bSnf202958 	prt_rsc,	/* RSC -- print rctlsys() subcodes */
2836aa4a4f3bSnf202958 	prt_rgf,	/* RGF -- print getrctl() flags */
2837aa4a4f3bSnf202958 	prt_rsf,	/* RSF -- print setrctl() flags */
2838aa4a4f3bSnf202958 	prt_rcf,	/* RCF -- print rctlsys_ctl() flags */
2839657b1f3dSraf 	prt_fxf,	/* FXF -- print forkx() flags */
2840532877c4Srd117015 	prt_spf,	/* SPF -- print rctlsys_projset() flags */
2841f48205beScasper 	prt_un1,	/* UN1 -- as prt_uns except for -1 */
2842bcddb677SAli Bahrami 	prt_mob,	/* MOB -- print mmapobj() flags */
2843794f0adbSRoger A. Faulkner 	prt_snf,	/* SNF -- print AT_SYMLINK_[NO]FOLLOW flag */
28443e95bd4aSAnders Persson 	prt_skc,	/* SKC -- print sockconfig() subcode */
28455dbfd19aSTheo Schlossnagle 	prt_acf,	/* ACF -- print accept4 flags */
28465dbfd19aSTheo Schlossnagle 	prt_pfd,	/* PFD -- print pipe fds */
28477c478bd9Sstevel@tonic-gate 	prt_dec,	/* HID -- hidden argument, make this the last one */
28487c478bd9Sstevel@tonic-gate };
2849