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