xref: /illumos-gate/usr/src/cmd/truss/expound.c (revision 7c478bd95313f5f23a4c958a745db2134aa0324)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #define	_SYSCALL32
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #include <stdio.h>
36*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
37*7c478bd9Sstevel@tonic-gate #include <unistd.h>
38*7c478bd9Sstevel@tonic-gate #include <ctype.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/mman.h>
41*7c478bd9Sstevel@tonic-gate #include <libproc.h>
42*7c478bd9Sstevel@tonic-gate #include <string.h>
43*7c478bd9Sstevel@tonic-gate #include <limits.h>
44*7c478bd9Sstevel@tonic-gate #include <sys/statfs.h>
45*7c478bd9Sstevel@tonic-gate #include <sys/times.h>
46*7c478bd9Sstevel@tonic-gate #include <sys/timex.h>
47*7c478bd9Sstevel@tonic-gate #include <sys/utssys.h>
48*7c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
49*7c478bd9Sstevel@tonic-gate #include <sys/ipc.h>
50*7c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h>
51*7c478bd9Sstevel@tonic-gate #include <sys/msg.h>
52*7c478bd9Sstevel@tonic-gate #include <sys/msg_impl.h>
53*7c478bd9Sstevel@tonic-gate #include <sys/sem.h>
54*7c478bd9Sstevel@tonic-gate #include <sys/sem_impl.h>
55*7c478bd9Sstevel@tonic-gate #include <sys/shm.h>
56*7c478bd9Sstevel@tonic-gate #include <sys/shm_impl.h>
57*7c478bd9Sstevel@tonic-gate #include <sys/dirent.h>
58*7c478bd9Sstevel@tonic-gate #include <sys/utime.h>
59*7c478bd9Sstevel@tonic-gate #include <ustat.h>
60*7c478bd9Sstevel@tonic-gate #include <fcntl.h>
61*7c478bd9Sstevel@tonic-gate #include <time.h>
62*7c478bd9Sstevel@tonic-gate #include <sys/termios.h>
63*7c478bd9Sstevel@tonic-gate #include <sys/termiox.h>
64*7c478bd9Sstevel@tonic-gate #include <sys/termio.h>
65*7c478bd9Sstevel@tonic-gate #include <sys/ttold.h>
66*7c478bd9Sstevel@tonic-gate #include <sys/jioctl.h>
67*7c478bd9Sstevel@tonic-gate #include <sys/filio.h>
68*7c478bd9Sstevel@tonic-gate #include <stropts.h>
69*7c478bd9Sstevel@tonic-gate #include <poll.h>
70*7c478bd9Sstevel@tonic-gate #include <sys/uio.h>
71*7c478bd9Sstevel@tonic-gate #include <sys/resource.h>
72*7c478bd9Sstevel@tonic-gate #include <sys/statvfs.h>
73*7c478bd9Sstevel@tonic-gate #include <sys/time.h>
74*7c478bd9Sstevel@tonic-gate #include <sys/aio.h>
75*7c478bd9Sstevel@tonic-gate #include <sys/socket.h>
76*7c478bd9Sstevel@tonic-gate #include <netinet/in.h>
77*7c478bd9Sstevel@tonic-gate #include <sys/un.h>
78*7c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
79*7c478bd9Sstevel@tonic-gate #include <arpa/inet.h>
80*7c478bd9Sstevel@tonic-gate #include <sys/audioio.h>
81*7c478bd9Sstevel@tonic-gate #include <sys/cladm.h>
82*7c478bd9Sstevel@tonic-gate #include <sys/synch.h>
83*7c478bd9Sstevel@tonic-gate #include <sys/synch32.h>
84*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
85*7c478bd9Sstevel@tonic-gate #include <sys/sendfile.h>
86*7c478bd9Sstevel@tonic-gate #include <priv.h>
87*7c478bd9Sstevel@tonic-gate #include <ucred.h>
88*7c478bd9Sstevel@tonic-gate #include <sys/ucred.h>
89*7c478bd9Sstevel@tonic-gate #include <sys/port_impl.h>
90*7c478bd9Sstevel@tonic-gate 
91*7c478bd9Sstevel@tonic-gate #include "ramdata.h"
92*7c478bd9Sstevel@tonic-gate #include "systable.h"
93*7c478bd9Sstevel@tonic-gate #include "proto.h"
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate void	show_sigset(private_t *, long, const char *);
96*7c478bd9Sstevel@tonic-gate void	show_ioctl(private_t *, int, long);
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate void
99*7c478bd9Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value)
100*7c478bd9Sstevel@tonic-gate {
101*7c478bd9Sstevel@tonic-gate 	char str[80];
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 	(void) strftime(str, sizeof (str), "%b %e %H:%M:%S %Z %Y",
104*7c478bd9Sstevel@tonic-gate 		localtime(&value));
105*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s%s  [ %llu ]\n",
106*7c478bd9Sstevel@tonic-gate 	    pri->pname,
107*7c478bd9Sstevel@tonic-gate 	    name,
108*7c478bd9Sstevel@tonic-gate 	    str,
109*7c478bd9Sstevel@tonic-gate 	    (longlong_t)value);
110*7c478bd9Sstevel@tonic-gate }
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate void
113*7c478bd9Sstevel@tonic-gate prtimestruc(private_t *pri, const char *name, timestruc_t *value)
114*7c478bd9Sstevel@tonic-gate {
115*7c478bd9Sstevel@tonic-gate 	prtime(pri, name, value->tv_sec);
116*7c478bd9Sstevel@tonic-gate }
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate void
119*7c478bd9Sstevel@tonic-gate show_utime(private_t *pri)
120*7c478bd9Sstevel@tonic-gate {
121*7c478bd9Sstevel@tonic-gate 	long offset;
122*7c478bd9Sstevel@tonic-gate 	struct utimbuf utimbuf;
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL)
125*7c478bd9Sstevel@tonic-gate 		return;
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
128*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset)
129*7c478bd9Sstevel@tonic-gate 		    != sizeof (utimbuf))
130*7c478bd9Sstevel@tonic-gate 			return;
131*7c478bd9Sstevel@tonic-gate 	} else {
132*7c478bd9Sstevel@tonic-gate 		struct utimbuf32 utimbuf32;
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset)
135*7c478bd9Sstevel@tonic-gate 		    != sizeof (utimbuf32))
136*7c478bd9Sstevel@tonic-gate 			return;
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate 		utimbuf.actime = (time_t)utimbuf32.actime;
139*7c478bd9Sstevel@tonic-gate 		utimbuf.modtime = (time_t)utimbuf32.modtime;
140*7c478bd9Sstevel@tonic-gate 	}
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate 	/* print access and modification times */
143*7c478bd9Sstevel@tonic-gate 	prtime(pri, "atime: ", utimbuf.actime);
144*7c478bd9Sstevel@tonic-gate 	prtime(pri, "mtime: ", utimbuf.modtime);
145*7c478bd9Sstevel@tonic-gate }
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate void
148*7c478bd9Sstevel@tonic-gate show_utimes(private_t *pri)
149*7c478bd9Sstevel@tonic-gate {
150*7c478bd9Sstevel@tonic-gate 	long offset;
151*7c478bd9Sstevel@tonic-gate 	struct {
152*7c478bd9Sstevel@tonic-gate 		struct timeval	atime;
153*7c478bd9Sstevel@tonic-gate 		struct timeval	mtime;
154*7c478bd9Sstevel@tonic-gate 	} utimbuf;
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL)
157*7c478bd9Sstevel@tonic-gate 		return;
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
160*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset)
161*7c478bd9Sstevel@tonic-gate 		    != sizeof (utimbuf))
162*7c478bd9Sstevel@tonic-gate 			return;
163*7c478bd9Sstevel@tonic-gate 	} else {
164*7c478bd9Sstevel@tonic-gate 		struct {
165*7c478bd9Sstevel@tonic-gate 			struct timeval32 atime;
166*7c478bd9Sstevel@tonic-gate 			struct timeval32 mtime;
167*7c478bd9Sstevel@tonic-gate 		} utimbuf32;
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset)
170*7c478bd9Sstevel@tonic-gate 		    != sizeof (utimbuf32))
171*7c478bd9Sstevel@tonic-gate 			return;
172*7c478bd9Sstevel@tonic-gate 
173*7c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&utimbuf.atime, &utimbuf32.atime);
174*7c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&utimbuf.mtime, &utimbuf32.mtime);
175*7c478bd9Sstevel@tonic-gate 	}
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	/* print access and modification times */
178*7c478bd9Sstevel@tonic-gate 	prtime(pri, "atime: ", utimbuf.atime.tv_sec);
179*7c478bd9Sstevel@tonic-gate 	prtime(pri, "mtime: ", utimbuf.mtime.tv_sec);
180*7c478bd9Sstevel@tonic-gate }
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate void
183*7c478bd9Sstevel@tonic-gate show_timeofday(private_t *pri)
184*7c478bd9Sstevel@tonic-gate {
185*7c478bd9Sstevel@tonic-gate 	struct timeval tod;
186*7c478bd9Sstevel@tonic-gate 	long offset;
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
189*7c478bd9Sstevel@tonic-gate 		return;
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
192*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tod, sizeof (tod), offset)
193*7c478bd9Sstevel@tonic-gate 		    != sizeof (tod))
194*7c478bd9Sstevel@tonic-gate 			return;
195*7c478bd9Sstevel@tonic-gate 	} else {
196*7c478bd9Sstevel@tonic-gate 		struct timeval32 tod32;
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tod32, sizeof (tod32), offset)
199*7c478bd9Sstevel@tonic-gate 		    != sizeof (tod32))
200*7c478bd9Sstevel@tonic-gate 			return;
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&tod, &tod32);
203*7c478bd9Sstevel@tonic-gate 	}
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate 	prtime(pri, "time: ", tod.tv_sec);
206*7c478bd9Sstevel@tonic-gate }
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate void
209*7c478bd9Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name)
210*7c478bd9Sstevel@tonic-gate {
211*7c478bd9Sstevel@tonic-gate 	struct itimerval itimerval;
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
214*7c478bd9Sstevel@tonic-gate 		return;
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
217*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &itimerval, sizeof (itimerval), offset)
218*7c478bd9Sstevel@tonic-gate 		    != sizeof (itimerval))
219*7c478bd9Sstevel@tonic-gate 			return;
220*7c478bd9Sstevel@tonic-gate 	} else {
221*7c478bd9Sstevel@tonic-gate 		struct itimerval32 itimerval32;
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset)
224*7c478bd9Sstevel@tonic-gate 		    != sizeof (itimerval32))
225*7c478bd9Sstevel@tonic-gate 			return;
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate 		ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32);
228*7c478bd9Sstevel@tonic-gate 	}
229*7c478bd9Sstevel@tonic-gate 
230*7c478bd9Sstevel@tonic-gate 	(void) printf(
231*7c478bd9Sstevel@tonic-gate 	    "%s\t%s:  interval: %4ld.%6.6ld sec  value: %4ld.%6.6ld sec\n",
232*7c478bd9Sstevel@tonic-gate 	    pri->pname,
233*7c478bd9Sstevel@tonic-gate 	    name,
234*7c478bd9Sstevel@tonic-gate 	    itimerval.it_interval.tv_sec,
235*7c478bd9Sstevel@tonic-gate 	    itimerval.it_interval.tv_usec,
236*7c478bd9Sstevel@tonic-gate 	    itimerval.it_value.tv_sec,
237*7c478bd9Sstevel@tonic-gate 	    itimerval.it_value.tv_usec);
238*7c478bd9Sstevel@tonic-gate }
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate void
241*7c478bd9Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name)
242*7c478bd9Sstevel@tonic-gate {
243*7c478bd9Sstevel@tonic-gate 	struct timeval timeval;
244*7c478bd9Sstevel@tonic-gate 
245*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
246*7c478bd9Sstevel@tonic-gate 		return;
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
249*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timeval, sizeof (timeval), offset)
250*7c478bd9Sstevel@tonic-gate 		    != sizeof (timeval))
251*7c478bd9Sstevel@tonic-gate 			return;
252*7c478bd9Sstevel@tonic-gate 	} else {
253*7c478bd9Sstevel@tonic-gate 		struct timeval32 timeval32;
254*7c478bd9Sstevel@tonic-gate 
255*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timeval32, sizeof (timeval32), offset)
256*7c478bd9Sstevel@tonic-gate 		    != sizeof (timeval32))
257*7c478bd9Sstevel@tonic-gate 			return;
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32);
260*7c478bd9Sstevel@tonic-gate 	}
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate 	(void) printf(
263*7c478bd9Sstevel@tonic-gate 	    "%s\t%s: %ld.%6.6ld sec\n",
264*7c478bd9Sstevel@tonic-gate 	    pri->pname,
265*7c478bd9Sstevel@tonic-gate 	    name,
266*7c478bd9Sstevel@tonic-gate 	    timeval.tv_sec,
267*7c478bd9Sstevel@tonic-gate 	    timeval.tv_usec);
268*7c478bd9Sstevel@tonic-gate }
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate void
271*7c478bd9Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name)
272*7c478bd9Sstevel@tonic-gate {
273*7c478bd9Sstevel@tonic-gate 	timestruc_t timestruc;
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
276*7c478bd9Sstevel@tonic-gate 		return;
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
279*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timestruc, sizeof (timestruc), offset)
280*7c478bd9Sstevel@tonic-gate 		    != sizeof (timestruc))
281*7c478bd9Sstevel@tonic-gate 			return;
282*7c478bd9Sstevel@tonic-gate 	} else {
283*7c478bd9Sstevel@tonic-gate 		timestruc32_t timestruc32;
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timestruc32, sizeof (timestruc32), offset)
286*7c478bd9Sstevel@tonic-gate 		    != sizeof (timestruc32))
287*7c478bd9Sstevel@tonic-gate 			return;
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate 		TIMESPEC32_TO_TIMESPEC(&timestruc, &timestruc32);
290*7c478bd9Sstevel@tonic-gate 	}
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate 	(void) printf(
293*7c478bd9Sstevel@tonic-gate 	    "%s\t%s: %ld.%9.9ld sec\n",
294*7c478bd9Sstevel@tonic-gate 	    pri->pname,
295*7c478bd9Sstevel@tonic-gate 	    name,
296*7c478bd9Sstevel@tonic-gate 	    timestruc.tv_sec,
297*7c478bd9Sstevel@tonic-gate 	    timestruc.tv_nsec);
298*7c478bd9Sstevel@tonic-gate }
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate void
301*7c478bd9Sstevel@tonic-gate show_stime(private_t *pri)
302*7c478bd9Sstevel@tonic-gate {
303*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 1) {
304*7c478bd9Sstevel@tonic-gate 		/* print new system time */
305*7c478bd9Sstevel@tonic-gate 		prtime(pri, "systime = ", (time_t)pri->sys_args[0]);
306*7c478bd9Sstevel@tonic-gate 	}
307*7c478bd9Sstevel@tonic-gate }
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate void
310*7c478bd9Sstevel@tonic-gate show_times(private_t *pri)
311*7c478bd9Sstevel@tonic-gate {
312*7c478bd9Sstevel@tonic-gate 	long hz = sysconf(_SC_CLK_TCK);
313*7c478bd9Sstevel@tonic-gate 	long offset;
314*7c478bd9Sstevel@tonic-gate 	struct tms tms;
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
317*7c478bd9Sstevel@tonic-gate 		return;
318*7c478bd9Sstevel@tonic-gate 
319*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
320*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tms, sizeof (tms), offset)
321*7c478bd9Sstevel@tonic-gate 		    != sizeof (tms))
322*7c478bd9Sstevel@tonic-gate 			return;
323*7c478bd9Sstevel@tonic-gate 	} else {
324*7c478bd9Sstevel@tonic-gate 		struct tms32 tms32;
325*7c478bd9Sstevel@tonic-gate 
326*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tms32, sizeof (tms32), offset)
327*7c478bd9Sstevel@tonic-gate 		    != sizeof (tms32))
328*7c478bd9Sstevel@tonic-gate 			return;
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate 		/*
331*7c478bd9Sstevel@tonic-gate 		 * This looks a bit odd (since the values are actually
332*7c478bd9Sstevel@tonic-gate 		 * signed), but we need to suppress sign extension to
333*7c478bd9Sstevel@tonic-gate 		 * preserve compatibility (we've always printed these
334*7c478bd9Sstevel@tonic-gate 		 * numbers as unsigned quantities).
335*7c478bd9Sstevel@tonic-gate 		 */
336*7c478bd9Sstevel@tonic-gate 		tms.tms_utime = (unsigned)tms32.tms_utime;
337*7c478bd9Sstevel@tonic-gate 		tms.tms_stime = (unsigned)tms32.tms_stime;
338*7c478bd9Sstevel@tonic-gate 		tms.tms_cutime = (unsigned)tms32.tms_cutime;
339*7c478bd9Sstevel@tonic-gate 		tms.tms_cstime = (unsigned)tms32.tms_cstime;
340*7c478bd9Sstevel@tonic-gate 	}
341*7c478bd9Sstevel@tonic-gate 
342*7c478bd9Sstevel@tonic-gate 	(void) printf(
343*7c478bd9Sstevel@tonic-gate 	    "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
344*7c478bd9Sstevel@tonic-gate 	    pri->pname,
345*7c478bd9Sstevel@tonic-gate 	    tms.tms_utime,
346*7c478bd9Sstevel@tonic-gate 	    tms.tms_stime,
347*7c478bd9Sstevel@tonic-gate 	    tms.tms_cutime,
348*7c478bd9Sstevel@tonic-gate 	    tms.tms_cstime,
349*7c478bd9Sstevel@tonic-gate 	    hz);
350*7c478bd9Sstevel@tonic-gate }
351*7c478bd9Sstevel@tonic-gate 
352*7c478bd9Sstevel@tonic-gate void
353*7c478bd9Sstevel@tonic-gate show_uname(private_t *pri, long offset)
354*7c478bd9Sstevel@tonic-gate {
355*7c478bd9Sstevel@tonic-gate 	/*
356*7c478bd9Sstevel@tonic-gate 	 * Old utsname buffer (no longer accessible in <sys/utsname.h>).
357*7c478bd9Sstevel@tonic-gate 	 */
358*7c478bd9Sstevel@tonic-gate 	struct {
359*7c478bd9Sstevel@tonic-gate 		char	sysname[9];
360*7c478bd9Sstevel@tonic-gate 		char	nodename[9];
361*7c478bd9Sstevel@tonic-gate 		char	release[9];
362*7c478bd9Sstevel@tonic-gate 		char	version[9];
363*7c478bd9Sstevel@tonic-gate 		char	machine[9];
364*7c478bd9Sstevel@tonic-gate 	} ubuf;
365*7c478bd9Sstevel@tonic-gate 
366*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
367*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
368*7c478bd9Sstevel@tonic-gate 		(void) printf(
369*7c478bd9Sstevel@tonic-gate 		"%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
370*7c478bd9Sstevel@tonic-gate 			pri->pname,
371*7c478bd9Sstevel@tonic-gate 			ubuf.sysname,
372*7c478bd9Sstevel@tonic-gate 			ubuf.nodename,
373*7c478bd9Sstevel@tonic-gate 			ubuf.release,
374*7c478bd9Sstevel@tonic-gate 			ubuf.version,
375*7c478bd9Sstevel@tonic-gate 			ubuf.machine);
376*7c478bd9Sstevel@tonic-gate 	}
377*7c478bd9Sstevel@tonic-gate }
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
380*7c478bd9Sstevel@tonic-gate void
381*7c478bd9Sstevel@tonic-gate show_ustat(private_t *pri, long offset)
382*7c478bd9Sstevel@tonic-gate {
383*7c478bd9Sstevel@tonic-gate 	struct ustat ubuf;
384*7c478bd9Sstevel@tonic-gate 
385*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
386*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
387*7c478bd9Sstevel@tonic-gate 		(void) printf(
388*7c478bd9Sstevel@tonic-gate 		"%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
389*7c478bd9Sstevel@tonic-gate 			pri->pname,
390*7c478bd9Sstevel@tonic-gate 			ubuf.f_tfree,
391*7c478bd9Sstevel@tonic-gate 			ubuf.f_tinode,
392*7c478bd9Sstevel@tonic-gate 			ubuf.f_fname,
393*7c478bd9Sstevel@tonic-gate 			ubuf.f_fpack);
394*7c478bd9Sstevel@tonic-gate 	}
395*7c478bd9Sstevel@tonic-gate }
396*7c478bd9Sstevel@tonic-gate 
397*7c478bd9Sstevel@tonic-gate #ifdef _LP64
398*7c478bd9Sstevel@tonic-gate void
399*7c478bd9Sstevel@tonic-gate show_ustat32(private_t *pri, long offset)
400*7c478bd9Sstevel@tonic-gate {
401*7c478bd9Sstevel@tonic-gate 	struct ustat32 ubuf;
402*7c478bd9Sstevel@tonic-gate 
403*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
404*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
405*7c478bd9Sstevel@tonic-gate 		(void) printf(
406*7c478bd9Sstevel@tonic-gate 		"%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
407*7c478bd9Sstevel@tonic-gate 			pri->pname,
408*7c478bd9Sstevel@tonic-gate 			ubuf.f_tfree,
409*7c478bd9Sstevel@tonic-gate 			ubuf.f_tinode,
410*7c478bd9Sstevel@tonic-gate 			ubuf.f_fname,
411*7c478bd9Sstevel@tonic-gate 			ubuf.f_fpack);
412*7c478bd9Sstevel@tonic-gate 	}
413*7c478bd9Sstevel@tonic-gate }
414*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
415*7c478bd9Sstevel@tonic-gate 
416*7c478bd9Sstevel@tonic-gate void
417*7c478bd9Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc)
418*7c478bd9Sstevel@tonic-gate {
419*7c478bd9Sstevel@tonic-gate 	f_user_t fubuf;
420*7c478bd9Sstevel@tonic-gate 	int serial = (nproc > 4);
421*7c478bd9Sstevel@tonic-gate 
422*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
423*7c478bd9Sstevel@tonic-gate 		return;
424*7c478bd9Sstevel@tonic-gate 
425*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
426*7c478bd9Sstevel@tonic-gate 	if (serial)
427*7c478bd9Sstevel@tonic-gate 		Eserialize();
428*7c478bd9Sstevel@tonic-gate 
429*7c478bd9Sstevel@tonic-gate 	while (nproc > 0 &&
430*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) {
431*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tpid=%-5d uid=%-5d flags=%s\n",
432*7c478bd9Sstevel@tonic-gate 		    pri->pname,
433*7c478bd9Sstevel@tonic-gate 		    (int)fubuf.fu_pid,
434*7c478bd9Sstevel@tonic-gate 		    (int)fubuf.fu_uid,
435*7c478bd9Sstevel@tonic-gate 		    fuflags(pri, fubuf.fu_flags));
436*7c478bd9Sstevel@tonic-gate 		nproc--;
437*7c478bd9Sstevel@tonic-gate 		offset += sizeof (fubuf);
438*7c478bd9Sstevel@tonic-gate 	}
439*7c478bd9Sstevel@tonic-gate 
440*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
441*7c478bd9Sstevel@tonic-gate 	if (serial)
442*7c478bd9Sstevel@tonic-gate 		Xserialize();
443*7c478bd9Sstevel@tonic-gate }
444*7c478bd9Sstevel@tonic-gate 
445*7c478bd9Sstevel@tonic-gate void
446*7c478bd9Sstevel@tonic-gate show_utssys(private_t *pri, long r0)
447*7c478bd9Sstevel@tonic-gate {
448*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
449*7c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
450*7c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
451*7c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
452*7c478bd9Sstevel@tonic-gate 			break;
453*7c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
454*7c478bd9Sstevel@tonic-gate 			show_ustat(pri, (long)pri->sys_args[0]);
455*7c478bd9Sstevel@tonic-gate 			break;
456*7c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
457*7c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
458*7c478bd9Sstevel@tonic-gate 			break;
459*7c478bd9Sstevel@tonic-gate 		}
460*7c478bd9Sstevel@tonic-gate 	}
461*7c478bd9Sstevel@tonic-gate }
462*7c478bd9Sstevel@tonic-gate 
463*7c478bd9Sstevel@tonic-gate #ifdef _LP64
464*7c478bd9Sstevel@tonic-gate void
465*7c478bd9Sstevel@tonic-gate show_utssys32(private_t *pri, long r0)
466*7c478bd9Sstevel@tonic-gate {
467*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
468*7c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
469*7c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
470*7c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
471*7c478bd9Sstevel@tonic-gate 			break;
472*7c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
473*7c478bd9Sstevel@tonic-gate 			show_ustat32(pri, (long)pri->sys_args[0]);
474*7c478bd9Sstevel@tonic-gate 			break;
475*7c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
476*7c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
477*7c478bd9Sstevel@tonic-gate 			break;
478*7c478bd9Sstevel@tonic-gate 		}
479*7c478bd9Sstevel@tonic-gate 	}
480*7c478bd9Sstevel@tonic-gate }
481*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
482*7c478bd9Sstevel@tonic-gate 
483*7c478bd9Sstevel@tonic-gate void
484*7c478bd9Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset)
485*7c478bd9Sstevel@tonic-gate {
486*7c478bd9Sstevel@tonic-gate 	int	arg;
487*7c478bd9Sstevel@tonic-gate 
488*7c478bd9Sstevel@tonic-gate 	switch (code) {
489*7c478bd9Sstevel@tonic-gate 	case CL_INITIALIZE:
490*7c478bd9Sstevel@tonic-gate 		switch (function) {
491*7c478bd9Sstevel@tonic-gate 		case CL_GET_BOOTFLAG:
492*7c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
493*7c478bd9Sstevel@tonic-gate 			    == sizeof (arg)) {
494*7c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_CONFIGURED)
495*7c478bd9Sstevel@tonic-gate 					(void) printf("%s\tbootflags="
496*7c478bd9Sstevel@tonic-gate 					    "CLUSTER_CONFIGURED", pri->pname);
497*7c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_BOOTED)
498*7c478bd9Sstevel@tonic-gate 					(void) printf("|CLUSTER_BOOTED\n");
499*7c478bd9Sstevel@tonic-gate 			}
500*7c478bd9Sstevel@tonic-gate 			break;
501*7c478bd9Sstevel@tonic-gate 		}
502*7c478bd9Sstevel@tonic-gate 		break;
503*7c478bd9Sstevel@tonic-gate 	case CL_CONFIG:
504*7c478bd9Sstevel@tonic-gate 		switch (function) {
505*7c478bd9Sstevel@tonic-gate 		case CL_NODEID:
506*7c478bd9Sstevel@tonic-gate 		case CL_HIGHEST_NODEID:
507*7c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
508*7c478bd9Sstevel@tonic-gate 			    == sizeof (arg))
509*7c478bd9Sstevel@tonic-gate 				(void) printf("%s\tnodeid=%d\n",
510*7c478bd9Sstevel@tonic-gate 					pri->pname, arg);
511*7c478bd9Sstevel@tonic-gate 		}
512*7c478bd9Sstevel@tonic-gate 		break;
513*7c478bd9Sstevel@tonic-gate 	}
514*7c478bd9Sstevel@tonic-gate }
515*7c478bd9Sstevel@tonic-gate 
516*7c478bd9Sstevel@tonic-gate #define	ALL_LOCK_TYPES	\
517*7c478bd9Sstevel@tonic-gate 	(USYNC_PROCESS|LOCK_ERRORCHECK|LOCK_RECURSIVE|USYNC_PROCESS_ROBUST|\
518*7c478bd9Sstevel@tonic-gate 	    LOCK_PRIO_INHERIT|LOCK_PRIO_PROTECT|LOCK_ROBUST_NP)
519*7c478bd9Sstevel@tonic-gate 
520*7c478bd9Sstevel@tonic-gate /* return cv and mutex types */
521*7c478bd9Sstevel@tonic-gate const char *
522*7c478bd9Sstevel@tonic-gate synch_type(private_t *pri, uint_t type)
523*7c478bd9Sstevel@tonic-gate {
524*7c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
525*7c478bd9Sstevel@tonic-gate 
526*7c478bd9Sstevel@tonic-gate 	if (type & USYNC_PROCESS)
527*7c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_PROCESS");
528*7c478bd9Sstevel@tonic-gate 	else
529*7c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_THREAD");
530*7c478bd9Sstevel@tonic-gate 
531*7c478bd9Sstevel@tonic-gate 	if (type & LOCK_ERRORCHECK)
532*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_ERRORCHECK");
533*7c478bd9Sstevel@tonic-gate 	if (type & LOCK_RECURSIVE)
534*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_RECURSIVE");
535*7c478bd9Sstevel@tonic-gate 	if (type & USYNC_PROCESS_ROBUST)
536*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|USYNC_PROCESS_ROBUST");
537*7c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_INHERIT)
538*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_INHERIT");
539*7c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_PROTECT)
540*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_PROTECT");
541*7c478bd9Sstevel@tonic-gate 	if (type & LOCK_ROBUST_NP)
542*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_ROBUST_NP");
543*7c478bd9Sstevel@tonic-gate 
544*7c478bd9Sstevel@tonic-gate 	if ((type &= ~ALL_LOCK_TYPES) != 0)
545*7c478bd9Sstevel@tonic-gate 		(void) sprintf(str + strlen(str), "|0x%.4X", type);
546*7c478bd9Sstevel@tonic-gate 
547*7c478bd9Sstevel@tonic-gate 	return ((const char *)str);
548*7c478bd9Sstevel@tonic-gate }
549*7c478bd9Sstevel@tonic-gate 
550*7c478bd9Sstevel@tonic-gate void
551*7c478bd9Sstevel@tonic-gate show_mutex(private_t *pri, long offset)
552*7c478bd9Sstevel@tonic-gate {
553*7c478bd9Sstevel@tonic-gate 	lwp_mutex_t mutex;
554*7c478bd9Sstevel@tonic-gate 
555*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) {
556*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmutex type: %s\n",
557*7c478bd9Sstevel@tonic-gate 			pri->pname,
558*7c478bd9Sstevel@tonic-gate 			synch_type(pri, mutex.mutex_type));
559*7c478bd9Sstevel@tonic-gate 	}
560*7c478bd9Sstevel@tonic-gate }
561*7c478bd9Sstevel@tonic-gate 
562*7c478bd9Sstevel@tonic-gate void
563*7c478bd9Sstevel@tonic-gate show_condvar(private_t *pri, long offset)
564*7c478bd9Sstevel@tonic-gate {
565*7c478bd9Sstevel@tonic-gate 	lwp_cond_t condvar;
566*7c478bd9Sstevel@tonic-gate 
567*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &condvar, sizeof (condvar), offset)
568*7c478bd9Sstevel@tonic-gate 	    == sizeof (condvar)) {
569*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tcondvar type: %s\n",
570*7c478bd9Sstevel@tonic-gate 			pri->pname,
571*7c478bd9Sstevel@tonic-gate 			synch_type(pri, condvar.cond_type));
572*7c478bd9Sstevel@tonic-gate 	}
573*7c478bd9Sstevel@tonic-gate }
574*7c478bd9Sstevel@tonic-gate 
575*7c478bd9Sstevel@tonic-gate void
576*7c478bd9Sstevel@tonic-gate show_sema(private_t *pri, long offset)
577*7c478bd9Sstevel@tonic-gate {
578*7c478bd9Sstevel@tonic-gate 	lwp_sema_t sema;
579*7c478bd9Sstevel@tonic-gate 
580*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) {
581*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsema type: %s  count = %u\n",
582*7c478bd9Sstevel@tonic-gate 			pri->pname,
583*7c478bd9Sstevel@tonic-gate 			synch_type(pri, sema.sema_type),
584*7c478bd9Sstevel@tonic-gate 			sema.sema_count);
585*7c478bd9Sstevel@tonic-gate 	}
586*7c478bd9Sstevel@tonic-gate }
587*7c478bd9Sstevel@tonic-gate 
588*7c478bd9Sstevel@tonic-gate void
589*7c478bd9Sstevel@tonic-gate show_rwlock(private_t *pri, long offset)
590*7c478bd9Sstevel@tonic-gate {
591*7c478bd9Sstevel@tonic-gate 	lwp_rwlock_t rwlock;
592*7c478bd9Sstevel@tonic-gate 
593*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) {
594*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\trwlock type: %s  readers = %d\n",
595*7c478bd9Sstevel@tonic-gate 			pri->pname,
596*7c478bd9Sstevel@tonic-gate 			synch_type(pri, rwlock.rwlock_type),
597*7c478bd9Sstevel@tonic-gate 			rwlock.rwlock_readers);
598*7c478bd9Sstevel@tonic-gate 	}
599*7c478bd9Sstevel@tonic-gate }
600*7c478bd9Sstevel@tonic-gate 
601*7c478bd9Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */
602*7c478bd9Sstevel@tonic-gate char *
603*7c478bd9Sstevel@tonic-gate show_char(char *buf, int c)
604*7c478bd9Sstevel@tonic-gate {
605*7c478bd9Sstevel@tonic-gate 	const char *fmt;
606*7c478bd9Sstevel@tonic-gate 
607*7c478bd9Sstevel@tonic-gate 	if (c >= ' ' && c < 0177)
608*7c478bd9Sstevel@tonic-gate 		fmt = "'%c'";
609*7c478bd9Sstevel@tonic-gate 	else
610*7c478bd9Sstevel@tonic-gate 		fmt = "%.3o";
611*7c478bd9Sstevel@tonic-gate 
612*7c478bd9Sstevel@tonic-gate 	(void) sprintf(buf, fmt, c&0xff);
613*7c478bd9Sstevel@tonic-gate 	return (buf);
614*7c478bd9Sstevel@tonic-gate }
615*7c478bd9Sstevel@tonic-gate 
616*7c478bd9Sstevel@tonic-gate void
617*7c478bd9Sstevel@tonic-gate show_termio(private_t *pri, long offset)
618*7c478bd9Sstevel@tonic-gate {
619*7c478bd9Sstevel@tonic-gate 	struct termio termio;
620*7c478bd9Sstevel@tonic-gate 	char cbuf[8];
621*7c478bd9Sstevel@tonic-gate 	int i;
622*7c478bd9Sstevel@tonic-gate 
623*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) {
624*7c478bd9Sstevel@tonic-gate 		(void) printf(
625*7c478bd9Sstevel@tonic-gate 		"%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
626*7c478bd9Sstevel@tonic-gate 			pri->pname,
627*7c478bd9Sstevel@tonic-gate 			termio.c_iflag,
628*7c478bd9Sstevel@tonic-gate 			termio.c_oflag,
629*7c478bd9Sstevel@tonic-gate 			termio.c_cflag,
630*7c478bd9Sstevel@tonic-gate 			termio.c_lflag,
631*7c478bd9Sstevel@tonic-gate 			termio.c_line);
632*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
633*7c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCC; i++)
634*7c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
635*7c478bd9Sstevel@tonic-gate 				show_char(cbuf, (int)termio.c_cc[i]));
636*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
637*7c478bd9Sstevel@tonic-gate 	}
638*7c478bd9Sstevel@tonic-gate }
639*7c478bd9Sstevel@tonic-gate 
640*7c478bd9Sstevel@tonic-gate void
641*7c478bd9Sstevel@tonic-gate show_termios(private_t *pri, long offset)
642*7c478bd9Sstevel@tonic-gate {
643*7c478bd9Sstevel@tonic-gate 	struct termios termios;
644*7c478bd9Sstevel@tonic-gate 	char cbuf[8];
645*7c478bd9Sstevel@tonic-gate 	int i;
646*7c478bd9Sstevel@tonic-gate 
647*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termios, sizeof (termios), offset)
648*7c478bd9Sstevel@tonic-gate 	    == sizeof (termios)) {
649*7c478bd9Sstevel@tonic-gate 		(void) printf(
650*7c478bd9Sstevel@tonic-gate 		"%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
651*7c478bd9Sstevel@tonic-gate 			pri->pname,
652*7c478bd9Sstevel@tonic-gate 			termios.c_iflag,
653*7c478bd9Sstevel@tonic-gate 			termios.c_oflag,
654*7c478bd9Sstevel@tonic-gate 			termios.c_cflag,
655*7c478bd9Sstevel@tonic-gate 			termios.c_lflag);
656*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
657*7c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCCS; i++) {
658*7c478bd9Sstevel@tonic-gate 			if (i == NCC)	/* show new chars on new line */
659*7c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t\t", pri->pname);
660*7c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
661*7c478bd9Sstevel@tonic-gate 				show_char(cbuf, (int)termios.c_cc[i]));
662*7c478bd9Sstevel@tonic-gate 		}
663*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
664*7c478bd9Sstevel@tonic-gate 	}
665*7c478bd9Sstevel@tonic-gate }
666*7c478bd9Sstevel@tonic-gate 
667*7c478bd9Sstevel@tonic-gate void
668*7c478bd9Sstevel@tonic-gate show_termiox(private_t *pri, long offset)
669*7c478bd9Sstevel@tonic-gate {
670*7c478bd9Sstevel@tonic-gate 	struct termiox termiox;
671*7c478bd9Sstevel@tonic-gate 	int i;
672*7c478bd9Sstevel@tonic-gate 
673*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termiox, sizeof (termiox), offset)
674*7c478bd9Sstevel@tonic-gate 	    == sizeof (termiox)) {
675*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
676*7c478bd9Sstevel@tonic-gate 			pri->pname,
677*7c478bd9Sstevel@tonic-gate 			termiox.x_hflag,
678*7c478bd9Sstevel@tonic-gate 			termiox.x_cflag,
679*7c478bd9Sstevel@tonic-gate 			termiox.x_rflag[0]);
680*7c478bd9Sstevel@tonic-gate 		for (i = 1; i < NFF; i++)
681*7c478bd9Sstevel@tonic-gate 			(void) printf(",0%.3o", termiox.x_rflag[i]);
682*7c478bd9Sstevel@tonic-gate 		(void) printf(" sflag=0%.3o\n",
683*7c478bd9Sstevel@tonic-gate 			termiox.x_sflag);
684*7c478bd9Sstevel@tonic-gate 	}
685*7c478bd9Sstevel@tonic-gate }
686*7c478bd9Sstevel@tonic-gate 
687*7c478bd9Sstevel@tonic-gate void
688*7c478bd9Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset)
689*7c478bd9Sstevel@tonic-gate {
690*7c478bd9Sstevel@tonic-gate 	struct sgttyb sgttyb;
691*7c478bd9Sstevel@tonic-gate 
692*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) {
693*7c478bd9Sstevel@tonic-gate 		char erase[8];
694*7c478bd9Sstevel@tonic-gate 		char kill[8];
695*7c478bd9Sstevel@tonic-gate 
696*7c478bd9Sstevel@tonic-gate 		(void) printf(
697*7c478bd9Sstevel@tonic-gate 		"%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
698*7c478bd9Sstevel@tonic-gate 			pri->pname,
699*7c478bd9Sstevel@tonic-gate 			sgttyb.sg_ispeed&0xff,
700*7c478bd9Sstevel@tonic-gate 			sgttyb.sg_ospeed&0xff,
701*7c478bd9Sstevel@tonic-gate 			show_char(erase, sgttyb.sg_erase),
702*7c478bd9Sstevel@tonic-gate 			show_char(kill, sgttyb.sg_kill),
703*7c478bd9Sstevel@tonic-gate 			sgttyb.sg_flags);
704*7c478bd9Sstevel@tonic-gate 	}
705*7c478bd9Sstevel@tonic-gate }
706*7c478bd9Sstevel@tonic-gate 
707*7c478bd9Sstevel@tonic-gate void
708*7c478bd9Sstevel@tonic-gate show_ltchars(private_t *pri, long offset)
709*7c478bd9Sstevel@tonic-gate {
710*7c478bd9Sstevel@tonic-gate 	struct ltchars ltchars;
711*7c478bd9Sstevel@tonic-gate 	char *p;
712*7c478bd9Sstevel@tonic-gate 	char cbuf[8];
713*7c478bd9Sstevel@tonic-gate 	int i;
714*7c478bd9Sstevel@tonic-gate 
715*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &ltchars, sizeof (ltchars), offset)
716*7c478bd9Sstevel@tonic-gate 	    == sizeof (ltchars)) {
717*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
718*7c478bd9Sstevel@tonic-gate 		for (p = (char *)&ltchars, i = 0; i < sizeof (ltchars); i++)
719*7c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
720*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
721*7c478bd9Sstevel@tonic-gate 	}
722*7c478bd9Sstevel@tonic-gate }
723*7c478bd9Sstevel@tonic-gate 
724*7c478bd9Sstevel@tonic-gate void
725*7c478bd9Sstevel@tonic-gate show_tchars(private_t *pri, long offset)
726*7c478bd9Sstevel@tonic-gate {
727*7c478bd9Sstevel@tonic-gate 	struct tchars tchars;
728*7c478bd9Sstevel@tonic-gate 	char *p;
729*7c478bd9Sstevel@tonic-gate 	char cbuf[8];
730*7c478bd9Sstevel@tonic-gate 	int i;
731*7c478bd9Sstevel@tonic-gate 
732*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) {
733*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
734*7c478bd9Sstevel@tonic-gate 		for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++)
735*7c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
736*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
737*7c478bd9Sstevel@tonic-gate 	}
738*7c478bd9Sstevel@tonic-gate }
739*7c478bd9Sstevel@tonic-gate 
740*7c478bd9Sstevel@tonic-gate void
741*7c478bd9Sstevel@tonic-gate show_termcb(private_t *pri, long offset)
742*7c478bd9Sstevel@tonic-gate {
743*7c478bd9Sstevel@tonic-gate 	struct termcb termcb;
744*7c478bd9Sstevel@tonic-gate 
745*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) {
746*7c478bd9Sstevel@tonic-gate 		(void) printf(
747*7c478bd9Sstevel@tonic-gate 		"%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
748*7c478bd9Sstevel@tonic-gate 			pri->pname,
749*7c478bd9Sstevel@tonic-gate 			termcb.st_flgs&0xff,
750*7c478bd9Sstevel@tonic-gate 			termcb.st_termt&0xff,
751*7c478bd9Sstevel@tonic-gate 			termcb.st_crow&0xff,
752*7c478bd9Sstevel@tonic-gate 			termcb.st_ccol&0xff,
753*7c478bd9Sstevel@tonic-gate 			termcb.st_vrow&0xff,
754*7c478bd9Sstevel@tonic-gate 			termcb.st_lrow&0xff);
755*7c478bd9Sstevel@tonic-gate 	}
756*7c478bd9Sstevel@tonic-gate }
757*7c478bd9Sstevel@tonic-gate 
758*7c478bd9Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */
759*7c478bd9Sstevel@tonic-gate void
760*7c478bd9Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset)
761*7c478bd9Sstevel@tonic-gate {
762*7c478bd9Sstevel@tonic-gate 	int val;
763*7c478bd9Sstevel@tonic-gate 
764*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
765*7c478bd9Sstevel@tonic-gate 		const char *s = NULL;
766*7c478bd9Sstevel@tonic-gate 
767*7c478bd9Sstevel@tonic-gate 		switch (code) {		/* interpret these symbolically */
768*7c478bd9Sstevel@tonic-gate 		case I_GRDOPT:
769*7c478bd9Sstevel@tonic-gate 			s = strrdopt(val);
770*7c478bd9Sstevel@tonic-gate 			break;
771*7c478bd9Sstevel@tonic-gate 		case I_GETSIG:
772*7c478bd9Sstevel@tonic-gate 			s = strevents(pri, val);
773*7c478bd9Sstevel@tonic-gate 			break;
774*7c478bd9Sstevel@tonic-gate 		case TIOCFLUSH:
775*7c478bd9Sstevel@tonic-gate 			s = tiocflush(pri, val);
776*7c478bd9Sstevel@tonic-gate 			break;
777*7c478bd9Sstevel@tonic-gate 		}
778*7c478bd9Sstevel@tonic-gate 
779*7c478bd9Sstevel@tonic-gate 		if (s == NULL)
780*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %d\n",
781*7c478bd9Sstevel@tonic-gate 				pri->pname, offset, val);
782*7c478bd9Sstevel@tonic-gate 		else
783*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %s\n",
784*7c478bd9Sstevel@tonic-gate 				pri->pname, offset, s);
785*7c478bd9Sstevel@tonic-gate 	}
786*7c478bd9Sstevel@tonic-gate }
787*7c478bd9Sstevel@tonic-gate 
788*7c478bd9Sstevel@tonic-gate void
789*7c478bd9Sstevel@tonic-gate show_strioctl(private_t *pri, long offset)
790*7c478bd9Sstevel@tonic-gate {
791*7c478bd9Sstevel@tonic-gate 	struct strioctl strioctl;
792*7c478bd9Sstevel@tonic-gate 
793*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
794*7c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
795*7c478bd9Sstevel@tonic-gate 		(void) printf(
796*7c478bd9Sstevel@tonic-gate 			"%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
797*7c478bd9Sstevel@tonic-gate 			pri->pname,
798*7c478bd9Sstevel@tonic-gate 			ioctlname(pri, strioctl.ic_cmd),
799*7c478bd9Sstevel@tonic-gate 			strioctl.ic_timout,
800*7c478bd9Sstevel@tonic-gate 			strioctl.ic_len,
801*7c478bd9Sstevel@tonic-gate 			(long)strioctl.ic_dp);
802*7c478bd9Sstevel@tonic-gate 
803*7c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
804*7c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
805*7c478bd9Sstevel@tonic-gate 				(long)strioctl.ic_dp);
806*7c478bd9Sstevel@tonic-gate 		--pri->recur;
807*7c478bd9Sstevel@tonic-gate 	}
808*7c478bd9Sstevel@tonic-gate }
809*7c478bd9Sstevel@tonic-gate 
810*7c478bd9Sstevel@tonic-gate #ifdef _LP64
811*7c478bd9Sstevel@tonic-gate void
812*7c478bd9Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset)
813*7c478bd9Sstevel@tonic-gate {
814*7c478bd9Sstevel@tonic-gate 	struct strioctl32 strioctl;
815*7c478bd9Sstevel@tonic-gate 
816*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
817*7c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
818*7c478bd9Sstevel@tonic-gate 		(void) printf(
819*7c478bd9Sstevel@tonic-gate 			"%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
820*7c478bd9Sstevel@tonic-gate 			pri->pname,
821*7c478bd9Sstevel@tonic-gate 			ioctlname(pri, strioctl.ic_cmd),
822*7c478bd9Sstevel@tonic-gate 			strioctl.ic_timout,
823*7c478bd9Sstevel@tonic-gate 			strioctl.ic_len,
824*7c478bd9Sstevel@tonic-gate 			(long)strioctl.ic_dp);
825*7c478bd9Sstevel@tonic-gate 
826*7c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
827*7c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
828*7c478bd9Sstevel@tonic-gate 				(long)strioctl.ic_dp);
829*7c478bd9Sstevel@tonic-gate 		--pri->recur;
830*7c478bd9Sstevel@tonic-gate 	}
831*7c478bd9Sstevel@tonic-gate }
832*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
833*7c478bd9Sstevel@tonic-gate 
834*7c478bd9Sstevel@tonic-gate void
835*7c478bd9Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump)
836*7c478bd9Sstevel@tonic-gate {
837*7c478bd9Sstevel@tonic-gate 	(void) printf(
838*7c478bd9Sstevel@tonic-gate 		"%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
839*7c478bd9Sstevel@tonic-gate 		pri->pname,
840*7c478bd9Sstevel@tonic-gate 		name,
841*7c478bd9Sstevel@tonic-gate 		sp->maxlen,
842*7c478bd9Sstevel@tonic-gate 		sp->len,
843*7c478bd9Sstevel@tonic-gate 		(long)sp->buf);
844*7c478bd9Sstevel@tonic-gate 	/*
845*7c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
846*7c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
847*7c478bd9Sstevel@tonic-gate 	 */
848*7c478bd9Sstevel@tonic-gate 	if (sp->buf == NULL || sp->len <= 0)
849*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
850*7c478bd9Sstevel@tonic-gate 	else {
851*7c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
852*7c478bd9Sstevel@tonic-gate 		char buffer[8];
853*7c478bd9Sstevel@tonic-gate 		char obuf[40];
854*7c478bd9Sstevel@tonic-gate 
855*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
856*7c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
857*7c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
858*7c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
859*7c478bd9Sstevel@tonic-gate 				(nb == sp->len)?
860*7c478bd9Sstevel@tonic-gate 				    (const char *)"\"" : (const char *)"\"..");
861*7c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
862*7c478bd9Sstevel@tonic-gate 		}
863*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
864*7c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
865*7c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
866*7c478bd9Sstevel@tonic-gate 	}
867*7c478bd9Sstevel@tonic-gate }
868*7c478bd9Sstevel@tonic-gate 
869*7c478bd9Sstevel@tonic-gate #ifdef _LP64
870*7c478bd9Sstevel@tonic-gate void
871*7c478bd9Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump)
872*7c478bd9Sstevel@tonic-gate {
873*7c478bd9Sstevel@tonic-gate 	(void) printf(
874*7c478bd9Sstevel@tonic-gate 		"%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
875*7c478bd9Sstevel@tonic-gate 		pri->pname,
876*7c478bd9Sstevel@tonic-gate 		name,
877*7c478bd9Sstevel@tonic-gate 		sp->maxlen,
878*7c478bd9Sstevel@tonic-gate 		sp->len,
879*7c478bd9Sstevel@tonic-gate 		(long)sp->buf);
880*7c478bd9Sstevel@tonic-gate 	/*
881*7c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
882*7c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
883*7c478bd9Sstevel@tonic-gate 	 */
884*7c478bd9Sstevel@tonic-gate 	if (sp->buf == NULL || sp->len <= 0)
885*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
886*7c478bd9Sstevel@tonic-gate 	else {
887*7c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
888*7c478bd9Sstevel@tonic-gate 		char buffer[8];
889*7c478bd9Sstevel@tonic-gate 		char obuf[40];
890*7c478bd9Sstevel@tonic-gate 
891*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
892*7c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
893*7c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
894*7c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
895*7c478bd9Sstevel@tonic-gate 				(nb == sp->len)?
896*7c478bd9Sstevel@tonic-gate 				    (const char *)"\"" : (const char *)"\"..");
897*7c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
898*7c478bd9Sstevel@tonic-gate 		}
899*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
900*7c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
901*7c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
902*7c478bd9Sstevel@tonic-gate 	}
903*7c478bd9Sstevel@tonic-gate }
904*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
905*7c478bd9Sstevel@tonic-gate 
906*7c478bd9Sstevel@tonic-gate /* strpeek and strfdinsert flags word */
907*7c478bd9Sstevel@tonic-gate const char *
908*7c478bd9Sstevel@tonic-gate strflags(private_t *pri, int flags)
909*7c478bd9Sstevel@tonic-gate {
910*7c478bd9Sstevel@tonic-gate 	const char *s;
911*7c478bd9Sstevel@tonic-gate 
912*7c478bd9Sstevel@tonic-gate 	switch (flags) {
913*7c478bd9Sstevel@tonic-gate 	case 0:
914*7c478bd9Sstevel@tonic-gate 		s = "0";
915*7c478bd9Sstevel@tonic-gate 		break;
916*7c478bd9Sstevel@tonic-gate 	case RS_HIPRI:
917*7c478bd9Sstevel@tonic-gate 		s = "RS_HIPRI";
918*7c478bd9Sstevel@tonic-gate 		break;
919*7c478bd9Sstevel@tonic-gate 	default:
920*7c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "0x%.4X", flags);
921*7c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
922*7c478bd9Sstevel@tonic-gate 	}
923*7c478bd9Sstevel@tonic-gate 
924*7c478bd9Sstevel@tonic-gate 	return (s);
925*7c478bd9Sstevel@tonic-gate }
926*7c478bd9Sstevel@tonic-gate 
927*7c478bd9Sstevel@tonic-gate void
928*7c478bd9Sstevel@tonic-gate show_strpeek(private_t *pri, long offset)
929*7c478bd9Sstevel@tonic-gate {
930*7c478bd9Sstevel@tonic-gate 	struct strpeek strpeek;
931*7c478bd9Sstevel@tonic-gate 
932*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
933*7c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
934*7c478bd9Sstevel@tonic-gate 
935*7c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE);
936*7c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.databuf, "dat", FALSE);
937*7c478bd9Sstevel@tonic-gate 
938*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
939*7c478bd9Sstevel@tonic-gate 			pri->pname,
940*7c478bd9Sstevel@tonic-gate 			strflags(pri, strpeek.flags));
941*7c478bd9Sstevel@tonic-gate 	}
942*7c478bd9Sstevel@tonic-gate }
943*7c478bd9Sstevel@tonic-gate 
944*7c478bd9Sstevel@tonic-gate #ifdef _LP64
945*7c478bd9Sstevel@tonic-gate void
946*7c478bd9Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset)
947*7c478bd9Sstevel@tonic-gate {
948*7c478bd9Sstevel@tonic-gate 	struct strpeek32 strpeek;
949*7c478bd9Sstevel@tonic-gate 
950*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
951*7c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
952*7c478bd9Sstevel@tonic-gate 
953*7c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE);
954*7c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.databuf, "dat", FALSE);
955*7c478bd9Sstevel@tonic-gate 
956*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
957*7c478bd9Sstevel@tonic-gate 			pri->pname,
958*7c478bd9Sstevel@tonic-gate 			strflags(pri, strpeek.flags));
959*7c478bd9Sstevel@tonic-gate 	}
960*7c478bd9Sstevel@tonic-gate }
961*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
962*7c478bd9Sstevel@tonic-gate 
963*7c478bd9Sstevel@tonic-gate void
964*7c478bd9Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset)
965*7c478bd9Sstevel@tonic-gate {
966*7c478bd9Sstevel@tonic-gate 	struct strfdinsert strfdinsert;
967*7c478bd9Sstevel@tonic-gate 
968*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
969*7c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
970*7c478bd9Sstevel@tonic-gate 
971*7c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
972*7c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE);
973*7c478bd9Sstevel@tonic-gate 
974*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
975*7c478bd9Sstevel@tonic-gate 			pri->pname,
976*7c478bd9Sstevel@tonic-gate 			strflags(pri, strfdinsert.flags),
977*7c478bd9Sstevel@tonic-gate 			strfdinsert.fildes,
978*7c478bd9Sstevel@tonic-gate 			strfdinsert.offset);
979*7c478bd9Sstevel@tonic-gate 	}
980*7c478bd9Sstevel@tonic-gate }
981*7c478bd9Sstevel@tonic-gate 
982*7c478bd9Sstevel@tonic-gate #ifdef _LP64
983*7c478bd9Sstevel@tonic-gate void
984*7c478bd9Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset)
985*7c478bd9Sstevel@tonic-gate {
986*7c478bd9Sstevel@tonic-gate 	struct strfdinsert32 strfdinsert;
987*7c478bd9Sstevel@tonic-gate 
988*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
989*7c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
990*7c478bd9Sstevel@tonic-gate 
991*7c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
992*7c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE);
993*7c478bd9Sstevel@tonic-gate 
994*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
995*7c478bd9Sstevel@tonic-gate 			pri->pname,
996*7c478bd9Sstevel@tonic-gate 			strflags(pri, strfdinsert.flags),
997*7c478bd9Sstevel@tonic-gate 			strfdinsert.fildes,
998*7c478bd9Sstevel@tonic-gate 			strfdinsert.offset);
999*7c478bd9Sstevel@tonic-gate 	}
1000*7c478bd9Sstevel@tonic-gate }
1001*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1002*7c478bd9Sstevel@tonic-gate 
1003*7c478bd9Sstevel@tonic-gate void
1004*7c478bd9Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset)
1005*7c478bd9Sstevel@tonic-gate {
1006*7c478bd9Sstevel@tonic-gate 	struct strrecvfd strrecvfd;
1007*7c478bd9Sstevel@tonic-gate 
1008*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) ==
1009*7c478bd9Sstevel@tonic-gate 	    sizeof (strrecvfd)) {
1010*7c478bd9Sstevel@tonic-gate 		(void) printf(
1011*7c478bd9Sstevel@tonic-gate 			"%s\tfd=%-5d uid=%-5d gid=%d\n",
1012*7c478bd9Sstevel@tonic-gate 			pri->pname,
1013*7c478bd9Sstevel@tonic-gate 			strrecvfd.fd,
1014*7c478bd9Sstevel@tonic-gate 			(int)strrecvfd.uid,
1015*7c478bd9Sstevel@tonic-gate 			(int)strrecvfd.gid);
1016*7c478bd9Sstevel@tonic-gate 	}
1017*7c478bd9Sstevel@tonic-gate }
1018*7c478bd9Sstevel@tonic-gate 
1019*7c478bd9Sstevel@tonic-gate void
1020*7c478bd9Sstevel@tonic-gate show_strlist(private_t *pri, long offset)
1021*7c478bd9Sstevel@tonic-gate {
1022*7c478bd9Sstevel@tonic-gate 	struct str_list strlist;
1023*7c478bd9Sstevel@tonic-gate 	struct str_mlist list;
1024*7c478bd9Sstevel@tonic-gate 	int count;
1025*7c478bd9Sstevel@tonic-gate 
1026*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
1027*7c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
1028*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
1029*7c478bd9Sstevel@tonic-gate 			pri->pname,
1030*7c478bd9Sstevel@tonic-gate 			strlist.sl_nmods,
1031*7c478bd9Sstevel@tonic-gate 			(long)strlist.sl_modlist);
1032*7c478bd9Sstevel@tonic-gate 
1033*7c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
1034*7c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
1035*7c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
1036*7c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
1037*7c478bd9Sstevel@tonic-gate 			    sizeof (list))
1038*7c478bd9Sstevel@tonic-gate 				break;
1039*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
1040*7c478bd9Sstevel@tonic-gate 				pri->pname,
1041*7c478bd9Sstevel@tonic-gate 				(int)sizeof (list.l_name),
1042*7c478bd9Sstevel@tonic-gate 				list.l_name);
1043*7c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
1044*7c478bd9Sstevel@tonic-gate 		}
1045*7c478bd9Sstevel@tonic-gate 	}
1046*7c478bd9Sstevel@tonic-gate }
1047*7c478bd9Sstevel@tonic-gate 
1048*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1049*7c478bd9Sstevel@tonic-gate void
1050*7c478bd9Sstevel@tonic-gate show_strlist32(private_t *pri, long offset)
1051*7c478bd9Sstevel@tonic-gate {
1052*7c478bd9Sstevel@tonic-gate 	struct str_list32 strlist;
1053*7c478bd9Sstevel@tonic-gate 	struct str_mlist list;
1054*7c478bd9Sstevel@tonic-gate 	int count;
1055*7c478bd9Sstevel@tonic-gate 
1056*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
1057*7c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
1058*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
1059*7c478bd9Sstevel@tonic-gate 			pri->pname,
1060*7c478bd9Sstevel@tonic-gate 			strlist.sl_nmods,
1061*7c478bd9Sstevel@tonic-gate 			(long)strlist.sl_modlist);
1062*7c478bd9Sstevel@tonic-gate 
1063*7c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
1064*7c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
1065*7c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
1066*7c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
1067*7c478bd9Sstevel@tonic-gate 			    sizeof (list))
1068*7c478bd9Sstevel@tonic-gate 				break;
1069*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
1070*7c478bd9Sstevel@tonic-gate 				pri->pname,
1071*7c478bd9Sstevel@tonic-gate 				(int)sizeof (list.l_name),
1072*7c478bd9Sstevel@tonic-gate 				list.l_name);
1073*7c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
1074*7c478bd9Sstevel@tonic-gate 		}
1075*7c478bd9Sstevel@tonic-gate 	}
1076*7c478bd9Sstevel@tonic-gate }
1077*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1078*7c478bd9Sstevel@tonic-gate 
1079*7c478bd9Sstevel@tonic-gate void
1080*7c478bd9Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset)
1081*7c478bd9Sstevel@tonic-gate {
1082*7c478bd9Sstevel@tonic-gate 	struct jwinsize jwinsize;
1083*7c478bd9Sstevel@tonic-gate 
1084*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) ==
1085*7c478bd9Sstevel@tonic-gate 	    sizeof (jwinsize)) {
1086*7c478bd9Sstevel@tonic-gate 		(void) printf(
1087*7c478bd9Sstevel@tonic-gate 			"%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1088*7c478bd9Sstevel@tonic-gate 			pri->pname,
1089*7c478bd9Sstevel@tonic-gate 			(unsigned)jwinsize.bytesx,
1090*7c478bd9Sstevel@tonic-gate 			(unsigned)jwinsize.bytesy,
1091*7c478bd9Sstevel@tonic-gate 			(unsigned)jwinsize.bitsx,
1092*7c478bd9Sstevel@tonic-gate 			(unsigned)jwinsize.bitsy);
1093*7c478bd9Sstevel@tonic-gate 	}
1094*7c478bd9Sstevel@tonic-gate }
1095*7c478bd9Sstevel@tonic-gate 
1096*7c478bd9Sstevel@tonic-gate void
1097*7c478bd9Sstevel@tonic-gate show_winsize(private_t *pri, long offset)
1098*7c478bd9Sstevel@tonic-gate {
1099*7c478bd9Sstevel@tonic-gate 	struct winsize winsize;
1100*7c478bd9Sstevel@tonic-gate 
1101*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &winsize, sizeof (winsize), offset)
1102*7c478bd9Sstevel@tonic-gate 	    == sizeof (winsize)) {
1103*7c478bd9Sstevel@tonic-gate 		(void) printf(
1104*7c478bd9Sstevel@tonic-gate 			"%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1105*7c478bd9Sstevel@tonic-gate 			pri->pname,
1106*7c478bd9Sstevel@tonic-gate 			winsize.ws_row,
1107*7c478bd9Sstevel@tonic-gate 			winsize.ws_col,
1108*7c478bd9Sstevel@tonic-gate 			winsize.ws_xpixel,
1109*7c478bd9Sstevel@tonic-gate 			winsize.ws_ypixel);
1110*7c478bd9Sstevel@tonic-gate 	}
1111*7c478bd9Sstevel@tonic-gate }
1112*7c478bd9Sstevel@tonic-gate 
1113*7c478bd9Sstevel@tonic-gate struct audio_stuff {
1114*7c478bd9Sstevel@tonic-gate 	uint_t	bit;
1115*7c478bd9Sstevel@tonic-gate 	const char *str;
1116*7c478bd9Sstevel@tonic-gate };
1117*7c478bd9Sstevel@tonic-gate 
1118*7c478bd9Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = {
1119*7c478bd9Sstevel@tonic-gate 	{ AUDIO_SPEAKER, "SPEAKER" },
1120*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HEADPHONE, "HEADPHONE" },
1121*7c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_OUT, "LINE_OUT" },
1122*7c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_OUT, "SPDIF_OUT" },
1123*7c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_OUT, "AUX1_OUT" },
1124*7c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_OUT, "AUX2_OUT" },
1125*7c478bd9Sstevel@tonic-gate 	{ 0, NULL }
1126*7c478bd9Sstevel@tonic-gate };
1127*7c478bd9Sstevel@tonic-gate 
1128*7c478bd9Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = {
1129*7c478bd9Sstevel@tonic-gate 	{ AUDIO_MICROPHONE, "MICROPHONE" },
1130*7c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_IN, "LINE_IN" },
1131*7c478bd9Sstevel@tonic-gate 	{ AUDIO_CD, "CD" },
1132*7c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_IN, "SPDIF_IN" },
1133*7c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_IN, "AUX1_IN" },
1134*7c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_IN, "AUX2_IN" },
1135*7c478bd9Sstevel@tonic-gate 	{ AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" },
1136*7c478bd9Sstevel@tonic-gate 	{ AUDIO_SUNVTS, "SUNVTS" },
1137*7c478bd9Sstevel@tonic-gate 	{ 0, NULL }
1138*7c478bd9Sstevel@tonic-gate };
1139*7c478bd9Sstevel@tonic-gate 
1140*7c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = {
1141*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_DUPLEX, "DUPLEX" },
1142*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_MSCODEC, "MSCODEC" },
1143*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_IN2OUT, "IN2OUT" },
1144*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_PLAY, "PLAY" },
1145*7c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_RECORD, "RECORD" },
1146*7c478bd9Sstevel@tonic-gate 	{ 0, NULL }
1147*7c478bd9Sstevel@tonic-gate };
1148*7c478bd9Sstevel@tonic-gate 
1149*7c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = {
1150*7c478bd9Sstevel@tonic-gate 	{ AUDIO_SWFEATURE_MIXER, "MIXER" },
1151*7c478bd9Sstevel@tonic-gate 	{ 0, NULL }
1152*7c478bd9Sstevel@tonic-gate };
1153*7c478bd9Sstevel@tonic-gate 
1154*7c478bd9Sstevel@tonic-gate void
1155*7c478bd9Sstevel@tonic-gate show_audio_features(const private_t *pri,
1156*7c478bd9Sstevel@tonic-gate 	const struct audio_stuff *audio_porttab, uint_t features,
1157*7c478bd9Sstevel@tonic-gate 	const char *name)
1158*7c478bd9Sstevel@tonic-gate {
1159*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s=", pri->pname, name);
1160*7c478bd9Sstevel@tonic-gate 	if (features == 0) {
1161*7c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
1162*7c478bd9Sstevel@tonic-gate 		return;
1163*7c478bd9Sstevel@tonic-gate 	}
1164*7c478bd9Sstevel@tonic-gate 
1165*7c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
1166*7c478bd9Sstevel@tonic-gate 		if (features & audio_porttab->bit) {
1167*7c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
1168*7c478bd9Sstevel@tonic-gate 			features &= ~audio_porttab->bit;
1169*7c478bd9Sstevel@tonic-gate 			if (features)
1170*7c478bd9Sstevel@tonic-gate 				(void) putchar('|');
1171*7c478bd9Sstevel@tonic-gate 		}
1172*7c478bd9Sstevel@tonic-gate 	}
1173*7c478bd9Sstevel@tonic-gate 	if (features)
1174*7c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", features);
1175*7c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
1176*7c478bd9Sstevel@tonic-gate }
1177*7c478bd9Sstevel@tonic-gate 
1178*7c478bd9Sstevel@tonic-gate void
1179*7c478bd9Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode,
1180*7c478bd9Sstevel@tonic-gate 	const char *field, uint_t ports)
1181*7c478bd9Sstevel@tonic-gate {
1182*7c478bd9Sstevel@tonic-gate 	const struct audio_stuff *audio_porttab;
1183*7c478bd9Sstevel@tonic-gate 
1184*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\t%s=", pri->pname, mode, field);
1185*7c478bd9Sstevel@tonic-gate 	if (ports == 0) {
1186*7c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
1187*7c478bd9Sstevel@tonic-gate 		return;
1188*7c478bd9Sstevel@tonic-gate 	}
1189*7c478bd9Sstevel@tonic-gate 	if (*mode == 'p')
1190*7c478bd9Sstevel@tonic-gate 		audio_porttab = audio_output_ports;
1191*7c478bd9Sstevel@tonic-gate 	else
1192*7c478bd9Sstevel@tonic-gate 		audio_porttab = audio_input_ports;
1193*7c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
1194*7c478bd9Sstevel@tonic-gate 		if (ports & audio_porttab->bit) {
1195*7c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
1196*7c478bd9Sstevel@tonic-gate 			ports &= ~audio_porttab->bit;
1197*7c478bd9Sstevel@tonic-gate 			if (ports)
1198*7c478bd9Sstevel@tonic-gate 				(void) putchar('|');
1199*7c478bd9Sstevel@tonic-gate 		}
1200*7c478bd9Sstevel@tonic-gate 	}
1201*7c478bd9Sstevel@tonic-gate 	if (ports)
1202*7c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", ports);
1203*7c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
1204*7c478bd9Sstevel@tonic-gate }
1205*7c478bd9Sstevel@tonic-gate 
1206*7c478bd9Sstevel@tonic-gate void
1207*7c478bd9Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr)
1208*7c478bd9Sstevel@tonic-gate {
1209*7c478bd9Sstevel@tonic-gate 	const char *s;
1210*7c478bd9Sstevel@tonic-gate 
1211*7c478bd9Sstevel@tonic-gate 	/*
1212*7c478bd9Sstevel@tonic-gate 	 * The following values describe the audio data encoding.
1213*7c478bd9Sstevel@tonic-gate 	 */
1214*7c478bd9Sstevel@tonic-gate 
1215*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1216*7c478bd9Sstevel@tonic-gate 		pri->pname, mode,
1217*7c478bd9Sstevel@tonic-gate 		au_pr->sample_rate,
1218*7c478bd9Sstevel@tonic-gate 		au_pr->channels,
1219*7c478bd9Sstevel@tonic-gate 		au_pr->precision);
1220*7c478bd9Sstevel@tonic-gate 
1221*7c478bd9Sstevel@tonic-gate 	s = NULL;
1222*7c478bd9Sstevel@tonic-gate 	switch (au_pr->encoding) {
1223*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_NONE:	s = "NONE";	break;
1224*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ULAW:	s = "ULAW";	break;
1225*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ALAW:	s = "ALAW";	break;
1226*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR:	s = "LINEAR";	break;
1227*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_DVI:	s = "DVI";	break;
1228*7c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR8:	s = "LINEAR8";	break;
1229*7c478bd9Sstevel@tonic-gate 	}
1230*7c478bd9Sstevel@tonic-gate 	if (s)
1231*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s);
1232*7c478bd9Sstevel@tonic-gate 	else {
1233*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%u\n",
1234*7c478bd9Sstevel@tonic-gate 			pri->pname, mode, au_pr->encoding);
1235*7c478bd9Sstevel@tonic-gate 	}
1236*7c478bd9Sstevel@tonic-gate 
1237*7c478bd9Sstevel@tonic-gate 	/*
1238*7c478bd9Sstevel@tonic-gate 	 * The following values control audio device configuration
1239*7c478bd9Sstevel@tonic-gate 	 */
1240*7c478bd9Sstevel@tonic-gate 
1241*7c478bd9Sstevel@tonic-gate 	(void) printf(
1242*7c478bd9Sstevel@tonic-gate 	"%s\t%s\tgain=%u buffer_size=%u\n",
1243*7c478bd9Sstevel@tonic-gate 		pri->pname, mode,
1244*7c478bd9Sstevel@tonic-gate 		au_pr->gain,
1245*7c478bd9Sstevel@tonic-gate 		au_pr->buffer_size);
1246*7c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "port", au_pr->port);
1247*7c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports);
1248*7c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports);
1249*7c478bd9Sstevel@tonic-gate 
1250*7c478bd9Sstevel@tonic-gate 	/*
1251*7c478bd9Sstevel@tonic-gate 	 * The following values describe driver state
1252*7c478bd9Sstevel@tonic-gate 	 */
1253*7c478bd9Sstevel@tonic-gate 
1254*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1255*7c478bd9Sstevel@tonic-gate 		pri->pname, mode,
1256*7c478bd9Sstevel@tonic-gate 		au_pr->samples,
1257*7c478bd9Sstevel@tonic-gate 		au_pr->eof,
1258*7c478bd9Sstevel@tonic-gate 		au_pr->pause,
1259*7c478bd9Sstevel@tonic-gate 		au_pr->error);
1260*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1261*7c478bd9Sstevel@tonic-gate 		pri->pname, mode,
1262*7c478bd9Sstevel@tonic-gate 		au_pr->waiting,
1263*7c478bd9Sstevel@tonic-gate 		au_pr->balance,
1264*7c478bd9Sstevel@tonic-gate 		au_pr->minordev);
1265*7c478bd9Sstevel@tonic-gate 
1266*7c478bd9Sstevel@tonic-gate 	/*
1267*7c478bd9Sstevel@tonic-gate 	 * The following values are read-only state flags
1268*7c478bd9Sstevel@tonic-gate 	 */
1269*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\topen=%u active=%u\n",
1270*7c478bd9Sstevel@tonic-gate 		pri->pname, mode,
1271*7c478bd9Sstevel@tonic-gate 		au_pr->open,
1272*7c478bd9Sstevel@tonic-gate 		au_pr->active);
1273*7c478bd9Sstevel@tonic-gate }
1274*7c478bd9Sstevel@tonic-gate 
1275*7c478bd9Sstevel@tonic-gate void
1276*7c478bd9Sstevel@tonic-gate show_audio_info(private_t *pri, long offset)
1277*7c478bd9Sstevel@tonic-gate {
1278*7c478bd9Sstevel@tonic-gate 	struct audio_info au;
1279*7c478bd9Sstevel@tonic-gate 
1280*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) {
1281*7c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "play", &au.play);
1282*7c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "record", &au.record);
1283*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1284*7c478bd9Sstevel@tonic-gate 			pri->pname, au.monitor_gain, au.output_muted);
1285*7c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_hw_features, au.hw_features,
1286*7c478bd9Sstevel@tonic-gate 		    "hw_features");
1287*7c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features, au.sw_features,
1288*7c478bd9Sstevel@tonic-gate 		    "sw_features");
1289*7c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features,
1290*7c478bd9Sstevel@tonic-gate 		    au.sw_features_enabled, "sw_features_enabled");
1291*7c478bd9Sstevel@tonic-gate 	}
1292*7c478bd9Sstevel@tonic-gate }
1293*7c478bd9Sstevel@tonic-gate 
1294*7c478bd9Sstevel@tonic-gate void
1295*7c478bd9Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset)
1296*7c478bd9Sstevel@tonic-gate {
1297*7c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
1298*7c478bd9Sstevel@tonic-gate 	int err = pri->Errno;	/* don't display output parameters */
1299*7c478bd9Sstevel@tonic-gate 				/* for a failed system call */
1300*7c478bd9Sstevel@tonic-gate #ifndef _LP64
1301*7c478bd9Sstevel@tonic-gate 	if (lp64)
1302*7c478bd9Sstevel@tonic-gate 		return;
1303*7c478bd9Sstevel@tonic-gate #endif
1304*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
1305*7c478bd9Sstevel@tonic-gate 		return;
1306*7c478bd9Sstevel@tonic-gate 
1307*7c478bd9Sstevel@tonic-gate 	switch (code) {
1308*7c478bd9Sstevel@tonic-gate 	case TCGETA:
1309*7c478bd9Sstevel@tonic-gate 		if (err)
1310*7c478bd9Sstevel@tonic-gate 			break;
1311*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1312*7c478bd9Sstevel@tonic-gate 	case TCSETA:
1313*7c478bd9Sstevel@tonic-gate 	case TCSETAW:
1314*7c478bd9Sstevel@tonic-gate 	case TCSETAF:
1315*7c478bd9Sstevel@tonic-gate 		show_termio(pri, offset);
1316*7c478bd9Sstevel@tonic-gate 		break;
1317*7c478bd9Sstevel@tonic-gate 	case TCGETS:
1318*7c478bd9Sstevel@tonic-gate 		if (err)
1319*7c478bd9Sstevel@tonic-gate 			break;
1320*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1321*7c478bd9Sstevel@tonic-gate 	case TCSETS:
1322*7c478bd9Sstevel@tonic-gate 	case TCSETSW:
1323*7c478bd9Sstevel@tonic-gate 	case TCSETSF:
1324*7c478bd9Sstevel@tonic-gate 		show_termios(pri, offset);
1325*7c478bd9Sstevel@tonic-gate 		break;
1326*7c478bd9Sstevel@tonic-gate 	case TCGETX:
1327*7c478bd9Sstevel@tonic-gate 		if (err)
1328*7c478bd9Sstevel@tonic-gate 			break;
1329*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1330*7c478bd9Sstevel@tonic-gate 	case TCSETX:
1331*7c478bd9Sstevel@tonic-gate 	case TCSETXW:
1332*7c478bd9Sstevel@tonic-gate 	case TCSETXF:
1333*7c478bd9Sstevel@tonic-gate 		show_termiox(pri, offset);
1334*7c478bd9Sstevel@tonic-gate 		break;
1335*7c478bd9Sstevel@tonic-gate 	case TIOCGETP:
1336*7c478bd9Sstevel@tonic-gate 		if (err)
1337*7c478bd9Sstevel@tonic-gate 			break;
1338*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1339*7c478bd9Sstevel@tonic-gate 	case TIOCSETN:
1340*7c478bd9Sstevel@tonic-gate 	case TIOCSETP:
1341*7c478bd9Sstevel@tonic-gate 		show_sgttyb(pri, offset);
1342*7c478bd9Sstevel@tonic-gate 		break;
1343*7c478bd9Sstevel@tonic-gate 	case TIOCGLTC:
1344*7c478bd9Sstevel@tonic-gate 		if (err)
1345*7c478bd9Sstevel@tonic-gate 			break;
1346*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1347*7c478bd9Sstevel@tonic-gate 	case TIOCSLTC:
1348*7c478bd9Sstevel@tonic-gate 		show_ltchars(pri, offset);
1349*7c478bd9Sstevel@tonic-gate 		break;
1350*7c478bd9Sstevel@tonic-gate 	case TIOCGETC:
1351*7c478bd9Sstevel@tonic-gate 		if (err)
1352*7c478bd9Sstevel@tonic-gate 			break;
1353*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1354*7c478bd9Sstevel@tonic-gate 	case TIOCSETC:
1355*7c478bd9Sstevel@tonic-gate 		show_tchars(pri, offset);
1356*7c478bd9Sstevel@tonic-gate 		break;
1357*7c478bd9Sstevel@tonic-gate 	case LDGETT:
1358*7c478bd9Sstevel@tonic-gate 		if (err)
1359*7c478bd9Sstevel@tonic-gate 			break;
1360*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1361*7c478bd9Sstevel@tonic-gate 	case LDSETT:
1362*7c478bd9Sstevel@tonic-gate 		show_termcb(pri, offset);
1363*7c478bd9Sstevel@tonic-gate 		break;
1364*7c478bd9Sstevel@tonic-gate 	/* streams ioctl()s */
1365*7c478bd9Sstevel@tonic-gate #if 0
1366*7c478bd9Sstevel@tonic-gate 		/* these are displayed as strings in the arg list */
1367*7c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
1368*7c478bd9Sstevel@tonic-gate 	case I_PUSH:
1369*7c478bd9Sstevel@tonic-gate 	case I_LOOK:
1370*7c478bd9Sstevel@tonic-gate 	case I_FIND:
1371*7c478bd9Sstevel@tonic-gate 		/* these are displayed as decimal in the arg list */
1372*7c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
1373*7c478bd9Sstevel@tonic-gate 	case I_LINK:
1374*7c478bd9Sstevel@tonic-gate 	case I_UNLINK:
1375*7c478bd9Sstevel@tonic-gate 	case I_SENDFD:
1376*7c478bd9Sstevel@tonic-gate 		/* these are displayed symbolically in the arg list */
1377*7c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
1378*7c478bd9Sstevel@tonic-gate 	case I_SRDOPT:
1379*7c478bd9Sstevel@tonic-gate 	case I_SETSIG:
1380*7c478bd9Sstevel@tonic-gate 	case I_FLUSH:
1381*7c478bd9Sstevel@tonic-gate 		break;
1382*7c478bd9Sstevel@tonic-gate 		/* this one just ignores the argument */
1383*7c478bd9Sstevel@tonic-gate 	case I_POP:
1384*7c478bd9Sstevel@tonic-gate 		break;
1385*7c478bd9Sstevel@tonic-gate #endif
1386*7c478bd9Sstevel@tonic-gate 		/* these return something in an int pointed to by arg */
1387*7c478bd9Sstevel@tonic-gate 	case I_NREAD:
1388*7c478bd9Sstevel@tonic-gate 	case I_GRDOPT:
1389*7c478bd9Sstevel@tonic-gate 	case I_GETSIG:
1390*7c478bd9Sstevel@tonic-gate 	case TIOCGSID:
1391*7c478bd9Sstevel@tonic-gate 	case TIOCGPGRP:
1392*7c478bd9Sstevel@tonic-gate 	case TIOCLGET:
1393*7c478bd9Sstevel@tonic-gate 	case FIONREAD:
1394*7c478bd9Sstevel@tonic-gate 	case FIORDCHK:
1395*7c478bd9Sstevel@tonic-gate 		if (err)
1396*7c478bd9Sstevel@tonic-gate 			break;
1397*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1398*7c478bd9Sstevel@tonic-gate 		/* these pass something in an int pointed to by arg */
1399*7c478bd9Sstevel@tonic-gate 	case TIOCSPGRP:
1400*7c478bd9Sstevel@tonic-gate 	case TIOCFLUSH:
1401*7c478bd9Sstevel@tonic-gate 	case TIOCLBIS:
1402*7c478bd9Sstevel@tonic-gate 	case TIOCLBIC:
1403*7c478bd9Sstevel@tonic-gate 	case TIOCLSET:
1404*7c478bd9Sstevel@tonic-gate 		show_strint(pri, code, offset);
1405*7c478bd9Sstevel@tonic-gate 		break;
1406*7c478bd9Sstevel@tonic-gate 		/* these all point to structures */
1407*7c478bd9Sstevel@tonic-gate 	case I_STR:
1408*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1409*7c478bd9Sstevel@tonic-gate 		if (lp64)
1410*7c478bd9Sstevel@tonic-gate 			show_strioctl(pri, offset);
1411*7c478bd9Sstevel@tonic-gate 		else
1412*7c478bd9Sstevel@tonic-gate 			show_strioctl32(pri, offset);
1413*7c478bd9Sstevel@tonic-gate #else
1414*7c478bd9Sstevel@tonic-gate 		show_strioctl(pri, offset);
1415*7c478bd9Sstevel@tonic-gate #endif
1416*7c478bd9Sstevel@tonic-gate 		break;
1417*7c478bd9Sstevel@tonic-gate 	case I_PEEK:
1418*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1419*7c478bd9Sstevel@tonic-gate 		if (lp64)
1420*7c478bd9Sstevel@tonic-gate 			show_strpeek(pri, offset);
1421*7c478bd9Sstevel@tonic-gate 		else
1422*7c478bd9Sstevel@tonic-gate 			show_strpeek32(pri, offset);
1423*7c478bd9Sstevel@tonic-gate #else
1424*7c478bd9Sstevel@tonic-gate 		show_strpeek(pri, offset);
1425*7c478bd9Sstevel@tonic-gate #endif
1426*7c478bd9Sstevel@tonic-gate 		break;
1427*7c478bd9Sstevel@tonic-gate 	case I_FDINSERT:
1428*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1429*7c478bd9Sstevel@tonic-gate 		if (lp64)
1430*7c478bd9Sstevel@tonic-gate 			show_strfdinsert(pri, offset);
1431*7c478bd9Sstevel@tonic-gate 		else
1432*7c478bd9Sstevel@tonic-gate 			show_strfdinsert32(pri, offset);
1433*7c478bd9Sstevel@tonic-gate #else
1434*7c478bd9Sstevel@tonic-gate 		show_strfdinsert(pri, offset);
1435*7c478bd9Sstevel@tonic-gate #endif
1436*7c478bd9Sstevel@tonic-gate 		break;
1437*7c478bd9Sstevel@tonic-gate 	case I_RECVFD:
1438*7c478bd9Sstevel@tonic-gate 		if (err)
1439*7c478bd9Sstevel@tonic-gate 			break;
1440*7c478bd9Sstevel@tonic-gate 		show_strrecvfd(pri, offset);
1441*7c478bd9Sstevel@tonic-gate 		break;
1442*7c478bd9Sstevel@tonic-gate 	case I_LIST:
1443*7c478bd9Sstevel@tonic-gate 		if (err)
1444*7c478bd9Sstevel@tonic-gate 			break;
1445*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1446*7c478bd9Sstevel@tonic-gate 		if (lp64)
1447*7c478bd9Sstevel@tonic-gate 			show_strlist(pri, offset);
1448*7c478bd9Sstevel@tonic-gate 		else
1449*7c478bd9Sstevel@tonic-gate 			show_strlist32(pri, offset);
1450*7c478bd9Sstevel@tonic-gate #else
1451*7c478bd9Sstevel@tonic-gate 		show_strlist(pri, offset);
1452*7c478bd9Sstevel@tonic-gate #endif
1453*7c478bd9Sstevel@tonic-gate 		break;
1454*7c478bd9Sstevel@tonic-gate 	case JWINSIZE:
1455*7c478bd9Sstevel@tonic-gate 		if (err)
1456*7c478bd9Sstevel@tonic-gate 			break;
1457*7c478bd9Sstevel@tonic-gate 		show_jwinsize(pri, offset);
1458*7c478bd9Sstevel@tonic-gate 		break;
1459*7c478bd9Sstevel@tonic-gate 	case TIOCGWINSZ:
1460*7c478bd9Sstevel@tonic-gate 		if (err)
1461*7c478bd9Sstevel@tonic-gate 			break;
1462*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
1463*7c478bd9Sstevel@tonic-gate 	case TIOCSWINSZ:
1464*7c478bd9Sstevel@tonic-gate 		show_winsize(pri, offset);
1465*7c478bd9Sstevel@tonic-gate 		break;
1466*7c478bd9Sstevel@tonic-gate 	case AUDIO_GETINFO:
1467*7c478bd9Sstevel@tonic-gate 	case (int)AUDIO_SETINFO:
1468*7c478bd9Sstevel@tonic-gate 		show_audio_info(pri, offset);
1469*7c478bd9Sstevel@tonic-gate 		break;
1470*7c478bd9Sstevel@tonic-gate 
1471*7c478bd9Sstevel@tonic-gate 	default:
1472*7c478bd9Sstevel@tonic-gate 		if (code & IOC_INOUT) {
1473*7c478bd9Sstevel@tonic-gate 			const char *str = ioctldatastruct(code);
1474*7c478bd9Sstevel@tonic-gate 
1475*7c478bd9Sstevel@tonic-gate 			(void) printf("\t\t%s",
1476*7c478bd9Sstevel@tonic-gate 			    (code & IOC_INOUT) == IOC_INOUT ? "write/read" :
1477*7c478bd9Sstevel@tonic-gate 			    code & IOC_IN ? "write" : "read");
1478*7c478bd9Sstevel@tonic-gate 			if (str != NULL) {
1479*7c478bd9Sstevel@tonic-gate 				(void) printf(" (struct %s)\n", str);
1480*7c478bd9Sstevel@tonic-gate 			} else {
1481*7c478bd9Sstevel@tonic-gate 				(void) printf(" %d bytes\n",
1482*7c478bd9Sstevel@tonic-gate 				    (code >> 16) & IOCPARM_MASK);
1483*7c478bd9Sstevel@tonic-gate 			}
1484*7c478bd9Sstevel@tonic-gate 		}
1485*7c478bd9Sstevel@tonic-gate 	}
1486*7c478bd9Sstevel@tonic-gate }
1487*7c478bd9Sstevel@tonic-gate 
1488*7c478bd9Sstevel@tonic-gate void
1489*7c478bd9Sstevel@tonic-gate show_statvfs(private_t *pri)
1490*7c478bd9Sstevel@tonic-gate {
1491*7c478bd9Sstevel@tonic-gate 	long offset;
1492*7c478bd9Sstevel@tonic-gate 	struct statvfs statvfs;
1493*7c478bd9Sstevel@tonic-gate 	char *cp;
1494*7c478bd9Sstevel@tonic-gate 
1495*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
1496*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
1497*7c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
1498*7c478bd9Sstevel@tonic-gate 		(void) printf(
1499*7c478bd9Sstevel@tonic-gate 		"%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1500*7c478bd9Sstevel@tonic-gate 			pri->pname,
1501*7c478bd9Sstevel@tonic-gate 			statvfs.f_bsize,
1502*7c478bd9Sstevel@tonic-gate 			statvfs.f_frsize,
1503*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_blocks,
1504*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_bfree);
1505*7c478bd9Sstevel@tonic-gate 		(void) printf(
1506*7c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1507*7c478bd9Sstevel@tonic-gate 			pri->pname,
1508*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_bavail,
1509*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_files,
1510*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_ffree,
1511*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_favail);
1512*7c478bd9Sstevel@tonic-gate 		(void) printf(
1513*7c478bd9Sstevel@tonic-gate 		"%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1514*7c478bd9Sstevel@tonic-gate 			pri->pname,
1515*7c478bd9Sstevel@tonic-gate 			statvfs.f_fsid,
1516*7c478bd9Sstevel@tonic-gate 			statvfs.f_basetype,
1517*7c478bd9Sstevel@tonic-gate 			(long)statvfs.f_namemax);
1518*7c478bd9Sstevel@tonic-gate 		(void) printf(
1519*7c478bd9Sstevel@tonic-gate 		"%s\tflag=%s\n",
1520*7c478bd9Sstevel@tonic-gate 			pri->pname,
1521*7c478bd9Sstevel@tonic-gate 			svfsflags(pri, (ulong_t)statvfs.f_flag));
1522*7c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
1523*7c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
1524*7c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
1525*7c478bd9Sstevel@tonic-gate 			*cp = ' ';
1526*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1527*7c478bd9Sstevel@tonic-gate 			pri->pname,
1528*7c478bd9Sstevel@tonic-gate 			(int)sizeof (statvfs.f_fstr),
1529*7c478bd9Sstevel@tonic-gate 			statvfs.f_fstr);
1530*7c478bd9Sstevel@tonic-gate 	}
1531*7c478bd9Sstevel@tonic-gate }
1532*7c478bd9Sstevel@tonic-gate 
1533*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1534*7c478bd9Sstevel@tonic-gate void
1535*7c478bd9Sstevel@tonic-gate show_statvfs32(private_t *pri)
1536*7c478bd9Sstevel@tonic-gate {
1537*7c478bd9Sstevel@tonic-gate 	long offset;
1538*7c478bd9Sstevel@tonic-gate 	struct statvfs32 statvfs;
1539*7c478bd9Sstevel@tonic-gate 	char *cp;
1540*7c478bd9Sstevel@tonic-gate 
1541*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
1542*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
1543*7c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
1544*7c478bd9Sstevel@tonic-gate 		(void) printf(
1545*7c478bd9Sstevel@tonic-gate 		"%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1546*7c478bd9Sstevel@tonic-gate 			pri->pname,
1547*7c478bd9Sstevel@tonic-gate 			statvfs.f_bsize,
1548*7c478bd9Sstevel@tonic-gate 			statvfs.f_frsize,
1549*7c478bd9Sstevel@tonic-gate 			statvfs.f_blocks,
1550*7c478bd9Sstevel@tonic-gate 			statvfs.f_bfree);
1551*7c478bd9Sstevel@tonic-gate 		(void) printf(
1552*7c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1553*7c478bd9Sstevel@tonic-gate 			pri->pname,
1554*7c478bd9Sstevel@tonic-gate 			statvfs.f_bavail,
1555*7c478bd9Sstevel@tonic-gate 			statvfs.f_files,
1556*7c478bd9Sstevel@tonic-gate 			statvfs.f_ffree,
1557*7c478bd9Sstevel@tonic-gate 			statvfs.f_favail);
1558*7c478bd9Sstevel@tonic-gate 		(void) printf(
1559*7c478bd9Sstevel@tonic-gate 		"%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1560*7c478bd9Sstevel@tonic-gate 			pri->pname,
1561*7c478bd9Sstevel@tonic-gate 			statvfs.f_fsid,
1562*7c478bd9Sstevel@tonic-gate 			statvfs.f_basetype,
1563*7c478bd9Sstevel@tonic-gate 			(int)statvfs.f_namemax);
1564*7c478bd9Sstevel@tonic-gate 		(void) printf(
1565*7c478bd9Sstevel@tonic-gate 		"%s\tflag=%s\n",
1566*7c478bd9Sstevel@tonic-gate 			pri->pname,
1567*7c478bd9Sstevel@tonic-gate 			svfsflags(pri, (ulong_t)statvfs.f_flag));
1568*7c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
1569*7c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
1570*7c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
1571*7c478bd9Sstevel@tonic-gate 			*cp = ' ';
1572*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1573*7c478bd9Sstevel@tonic-gate 			pri->pname,
1574*7c478bd9Sstevel@tonic-gate 			(int)sizeof (statvfs.f_fstr),
1575*7c478bd9Sstevel@tonic-gate 			statvfs.f_fstr);
1576*7c478bd9Sstevel@tonic-gate 	}
1577*7c478bd9Sstevel@tonic-gate }
1578*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1579*7c478bd9Sstevel@tonic-gate 
1580*7c478bd9Sstevel@tonic-gate void
1581*7c478bd9Sstevel@tonic-gate show_statvfs64(private_t *pri)
1582*7c478bd9Sstevel@tonic-gate {
1583*7c478bd9Sstevel@tonic-gate 	long offset;
1584*7c478bd9Sstevel@tonic-gate 	struct statvfs64_32 statvfs;
1585*7c478bd9Sstevel@tonic-gate 	char *cp;
1586*7c478bd9Sstevel@tonic-gate 
1587*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL &&
1588*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
1589*7c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
1590*7c478bd9Sstevel@tonic-gate 		(void) printf(
1591*7c478bd9Sstevel@tonic-gate 		"%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1592*7c478bd9Sstevel@tonic-gate 			pri->pname,
1593*7c478bd9Sstevel@tonic-gate 			statvfs.f_bsize,
1594*7c478bd9Sstevel@tonic-gate 			statvfs.f_frsize,
1595*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_blocks,
1596*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_bfree);
1597*7c478bd9Sstevel@tonic-gate 		(void) printf(
1598*7c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1599*7c478bd9Sstevel@tonic-gate 			pri->pname,
1600*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_bavail,
1601*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_files,
1602*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_ffree,
1603*7c478bd9Sstevel@tonic-gate 			(u_longlong_t)statvfs.f_favail);
1604*7c478bd9Sstevel@tonic-gate 		(void) printf(
1605*7c478bd9Sstevel@tonic-gate 		"%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1606*7c478bd9Sstevel@tonic-gate 			pri->pname,
1607*7c478bd9Sstevel@tonic-gate 			statvfs.f_fsid,
1608*7c478bd9Sstevel@tonic-gate 			statvfs.f_basetype,
1609*7c478bd9Sstevel@tonic-gate 			(int)statvfs.f_namemax);
1610*7c478bd9Sstevel@tonic-gate 		(void) printf(
1611*7c478bd9Sstevel@tonic-gate 		"%s\tflag=%s\n",
1612*7c478bd9Sstevel@tonic-gate 			pri->pname,
1613*7c478bd9Sstevel@tonic-gate 			svfsflags(pri, (ulong_t)statvfs.f_flag));
1614*7c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
1615*7c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
1616*7c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
1617*7c478bd9Sstevel@tonic-gate 			*cp = ' ';
1618*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1619*7c478bd9Sstevel@tonic-gate 			pri->pname,
1620*7c478bd9Sstevel@tonic-gate 			(int)sizeof (statvfs.f_fstr),
1621*7c478bd9Sstevel@tonic-gate 			statvfs.f_fstr);
1622*7c478bd9Sstevel@tonic-gate 	}
1623*7c478bd9Sstevel@tonic-gate }
1624*7c478bd9Sstevel@tonic-gate 
1625*7c478bd9Sstevel@tonic-gate void
1626*7c478bd9Sstevel@tonic-gate show_statfs(private_t *pri)
1627*7c478bd9Sstevel@tonic-gate {
1628*7c478bd9Sstevel@tonic-gate 	long offset;
1629*7c478bd9Sstevel@tonic-gate 	struct statfs statfs;
1630*7c478bd9Sstevel@tonic-gate 
1631*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL &&
1632*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
1633*7c478bd9Sstevel@tonic-gate 		(void) printf(
1634*7c478bd9Sstevel@tonic-gate 		"%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1635*7c478bd9Sstevel@tonic-gate 			pri->pname,
1636*7c478bd9Sstevel@tonic-gate 			statfs.f_fstyp,
1637*7c478bd9Sstevel@tonic-gate 			statfs.f_bsize,
1638*7c478bd9Sstevel@tonic-gate 			statfs.f_frsize,
1639*7c478bd9Sstevel@tonic-gate 			statfs.f_blocks,
1640*7c478bd9Sstevel@tonic-gate 			statfs.f_bfree,
1641*7c478bd9Sstevel@tonic-gate 			statfs.f_files,
1642*7c478bd9Sstevel@tonic-gate 			statfs.f_ffree);
1643*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
1644*7c478bd9Sstevel@tonic-gate 			pri->pname,
1645*7c478bd9Sstevel@tonic-gate 			statfs.f_fname,
1646*7c478bd9Sstevel@tonic-gate 			statfs.f_fpack);
1647*7c478bd9Sstevel@tonic-gate 	}
1648*7c478bd9Sstevel@tonic-gate }
1649*7c478bd9Sstevel@tonic-gate 
1650*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1651*7c478bd9Sstevel@tonic-gate void
1652*7c478bd9Sstevel@tonic-gate show_statfs32(private_t *pri)
1653*7c478bd9Sstevel@tonic-gate {
1654*7c478bd9Sstevel@tonic-gate 	long offset;
1655*7c478bd9Sstevel@tonic-gate 	struct statfs32 statfs;
1656*7c478bd9Sstevel@tonic-gate 
1657*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL &&
1658*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
1659*7c478bd9Sstevel@tonic-gate 		(void) printf(
1660*7c478bd9Sstevel@tonic-gate 		"%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1661*7c478bd9Sstevel@tonic-gate 			pri->pname,
1662*7c478bd9Sstevel@tonic-gate 			statfs.f_fstyp,
1663*7c478bd9Sstevel@tonic-gate 			statfs.f_bsize,
1664*7c478bd9Sstevel@tonic-gate 			statfs.f_frsize,
1665*7c478bd9Sstevel@tonic-gate 			statfs.f_blocks,
1666*7c478bd9Sstevel@tonic-gate 			statfs.f_bfree,
1667*7c478bd9Sstevel@tonic-gate 			statfs.f_files,
1668*7c478bd9Sstevel@tonic-gate 			statfs.f_ffree);
1669*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
1670*7c478bd9Sstevel@tonic-gate 			pri->pname,
1671*7c478bd9Sstevel@tonic-gate 			statfs.f_fname,
1672*7c478bd9Sstevel@tonic-gate 			statfs.f_fpack);
1673*7c478bd9Sstevel@tonic-gate 	}
1674*7c478bd9Sstevel@tonic-gate }
1675*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1676*7c478bd9Sstevel@tonic-gate 
1677*7c478bd9Sstevel@tonic-gate void
1678*7c478bd9Sstevel@tonic-gate show_flock32(private_t *pri, long offset)
1679*7c478bd9Sstevel@tonic-gate {
1680*7c478bd9Sstevel@tonic-gate 	struct flock32 flock;
1681*7c478bd9Sstevel@tonic-gate 
1682*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
1683*7c478bd9Sstevel@tonic-gate 		const char *str = NULL;
1684*7c478bd9Sstevel@tonic-gate 
1685*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
1686*7c478bd9Sstevel@tonic-gate 
1687*7c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
1688*7c478bd9Sstevel@tonic-gate 		case F_RDLCK:
1689*7c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
1690*7c478bd9Sstevel@tonic-gate 			break;
1691*7c478bd9Sstevel@tonic-gate 		case F_WRLCK:
1692*7c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
1693*7c478bd9Sstevel@tonic-gate 			break;
1694*7c478bd9Sstevel@tonic-gate 		case F_UNLCK:
1695*7c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
1696*7c478bd9Sstevel@tonic-gate 			break;
1697*7c478bd9Sstevel@tonic-gate 		}
1698*7c478bd9Sstevel@tonic-gate 		if (str != NULL)
1699*7c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
1700*7c478bd9Sstevel@tonic-gate 		else
1701*7c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
1702*7c478bd9Sstevel@tonic-gate 
1703*7c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
1704*7c478bd9Sstevel@tonic-gate 		if (str != NULL)
1705*7c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
1706*7c478bd9Sstevel@tonic-gate 		else
1707*7c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
1708*7c478bd9Sstevel@tonic-gate 
1709*7c478bd9Sstevel@tonic-gate 		(void) printf(
1710*7c478bd9Sstevel@tonic-gate 			" start=%-5d len=%-5d sys=%-2u pid=%d\n",
1711*7c478bd9Sstevel@tonic-gate 			flock.l_start,
1712*7c478bd9Sstevel@tonic-gate 			flock.l_len,
1713*7c478bd9Sstevel@tonic-gate 			flock.l_sysid,
1714*7c478bd9Sstevel@tonic-gate 			flock.l_pid);
1715*7c478bd9Sstevel@tonic-gate 	}
1716*7c478bd9Sstevel@tonic-gate }
1717*7c478bd9Sstevel@tonic-gate 
1718*7c478bd9Sstevel@tonic-gate void
1719*7c478bd9Sstevel@tonic-gate show_flock64(private_t *pri, long offset)
1720*7c478bd9Sstevel@tonic-gate {
1721*7c478bd9Sstevel@tonic-gate 	struct flock64 flock;
1722*7c478bd9Sstevel@tonic-gate 
1723*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
1724*7c478bd9Sstevel@tonic-gate 		const char *str = NULL;
1725*7c478bd9Sstevel@tonic-gate 
1726*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
1727*7c478bd9Sstevel@tonic-gate 
1728*7c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
1729*7c478bd9Sstevel@tonic-gate 		case F_RDLCK:
1730*7c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
1731*7c478bd9Sstevel@tonic-gate 			break;
1732*7c478bd9Sstevel@tonic-gate 		case F_WRLCK:
1733*7c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
1734*7c478bd9Sstevel@tonic-gate 			break;
1735*7c478bd9Sstevel@tonic-gate 		case F_UNLCK:
1736*7c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
1737*7c478bd9Sstevel@tonic-gate 			break;
1738*7c478bd9Sstevel@tonic-gate 		}
1739*7c478bd9Sstevel@tonic-gate 		if (str != NULL)
1740*7c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
1741*7c478bd9Sstevel@tonic-gate 		else
1742*7c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
1743*7c478bd9Sstevel@tonic-gate 
1744*7c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
1745*7c478bd9Sstevel@tonic-gate 		if (str != NULL)
1746*7c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
1747*7c478bd9Sstevel@tonic-gate 		else
1748*7c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
1749*7c478bd9Sstevel@tonic-gate 
1750*7c478bd9Sstevel@tonic-gate 		(void) printf(
1751*7c478bd9Sstevel@tonic-gate 			" start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1752*7c478bd9Sstevel@tonic-gate 			(long long)flock.l_start,
1753*7c478bd9Sstevel@tonic-gate 			(long long)flock.l_len,
1754*7c478bd9Sstevel@tonic-gate 			flock.l_sysid,
1755*7c478bd9Sstevel@tonic-gate 			(int)flock.l_pid);
1756*7c478bd9Sstevel@tonic-gate 	}
1757*7c478bd9Sstevel@tonic-gate }
1758*7c478bd9Sstevel@tonic-gate 
1759*7c478bd9Sstevel@tonic-gate void
1760*7c478bd9Sstevel@tonic-gate show_share(private_t *pri, long offset)
1761*7c478bd9Sstevel@tonic-gate {
1762*7c478bd9Sstevel@tonic-gate 	struct fshare fshare;
1763*7c478bd9Sstevel@tonic-gate 
1764*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) {
1765*7c478bd9Sstevel@tonic-gate 		const char *str = NULL;
1766*7c478bd9Sstevel@tonic-gate 		int manddny = 0;
1767*7c478bd9Sstevel@tonic-gate 
1768*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\taccess=", pri->pname);
1769*7c478bd9Sstevel@tonic-gate 
1770*7c478bd9Sstevel@tonic-gate 		switch (fshare.f_access) {
1771*7c478bd9Sstevel@tonic-gate 		case F_RDACC:
1772*7c478bd9Sstevel@tonic-gate 			str = "F_RDACC";
1773*7c478bd9Sstevel@tonic-gate 			break;
1774*7c478bd9Sstevel@tonic-gate 		case F_WRACC:
1775*7c478bd9Sstevel@tonic-gate 			str = "F_WRACC";
1776*7c478bd9Sstevel@tonic-gate 			break;
1777*7c478bd9Sstevel@tonic-gate 		case F_RWACC:
1778*7c478bd9Sstevel@tonic-gate 			str = "F_RWACC";
1779*7c478bd9Sstevel@tonic-gate 			break;
1780*7c478bd9Sstevel@tonic-gate 		}
1781*7c478bd9Sstevel@tonic-gate 		if (str != NULL)
1782*7c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
1783*7c478bd9Sstevel@tonic-gate 		else
1784*7c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", fshare.f_access);
1785*7c478bd9Sstevel@tonic-gate 
1786*7c478bd9Sstevel@tonic-gate 		str = NULL;
1787*7c478bd9Sstevel@tonic-gate 		if (fshare.f_deny & F_MANDDNY) {
1788*7c478bd9Sstevel@tonic-gate 			fshare.f_deny &= ~F_MANDDNY;
1789*7c478bd9Sstevel@tonic-gate 			manddny = 1;
1790*7c478bd9Sstevel@tonic-gate 		}
1791*7c478bd9Sstevel@tonic-gate 		switch (fshare.f_deny) {
1792*7c478bd9Sstevel@tonic-gate 		case F_NODNY:
1793*7c478bd9Sstevel@tonic-gate 			str = "F_NODNY";
1794*7c478bd9Sstevel@tonic-gate 			break;
1795*7c478bd9Sstevel@tonic-gate 		case F_RDDNY:
1796*7c478bd9Sstevel@tonic-gate 			str = "F_RDDNY";
1797*7c478bd9Sstevel@tonic-gate 			break;
1798*7c478bd9Sstevel@tonic-gate 		case F_WRDNY:
1799*7c478bd9Sstevel@tonic-gate 			str = "F_WRDNY";
1800*7c478bd9Sstevel@tonic-gate 			break;
1801*7c478bd9Sstevel@tonic-gate 		case F_RWDNY:
1802*7c478bd9Sstevel@tonic-gate 			str = "F_RWDNY";
1803*7c478bd9Sstevel@tonic-gate 			break;
1804*7c478bd9Sstevel@tonic-gate 		case F_COMPAT:
1805*7c478bd9Sstevel@tonic-gate 			str = "F_COMPAT";
1806*7c478bd9Sstevel@tonic-gate 			break;
1807*7c478bd9Sstevel@tonic-gate 		}
1808*7c478bd9Sstevel@tonic-gate 		if (str != NULL) {
1809*7c478bd9Sstevel@tonic-gate 			if (manddny)
1810*7c478bd9Sstevel@tonic-gate 				(void) printf("  deny=F_MANDDNY|%s", str);
1811*7c478bd9Sstevel@tonic-gate 			else
1812*7c478bd9Sstevel@tonic-gate 				(void) printf("  deny=%s", str);
1813*7c478bd9Sstevel@tonic-gate 		} else {
1814*7c478bd9Sstevel@tonic-gate 			(void) printf("  deny=0x%x", manddny?
1815*7c478bd9Sstevel@tonic-gate 				fshare.f_deny | F_MANDDNY : fshare.f_deny);
1816*7c478bd9Sstevel@tonic-gate 		}
1817*7c478bd9Sstevel@tonic-gate 
1818*7c478bd9Sstevel@tonic-gate 		(void) printf("  id=%x\n", fshare.f_id);
1819*7c478bd9Sstevel@tonic-gate 	}
1820*7c478bd9Sstevel@tonic-gate }
1821*7c478bd9Sstevel@tonic-gate 
1822*7c478bd9Sstevel@tonic-gate void
1823*7c478bd9Sstevel@tonic-gate show_ffg(private_t *pri)
1824*7c478bd9Sstevel@tonic-gate {
1825*7c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
1826*7c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
1827*7c478bd9Sstevel@tonic-gate 	prt_ffg(pri, 0, pri->Rval1);
1828*7c478bd9Sstevel@tonic-gate 	(void) puts(pri->sys_string);
1829*7c478bd9Sstevel@tonic-gate }
1830*7c478bd9Sstevel@tonic-gate 
1831*7c478bd9Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */
1832*7c478bd9Sstevel@tonic-gate void
1833*7c478bd9Sstevel@tonic-gate show_fcntl(private_t *pri)
1834*7c478bd9Sstevel@tonic-gate {
1835*7c478bd9Sstevel@tonic-gate 	long offset;
1836*7c478bd9Sstevel@tonic-gate 
1837*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) {
1838*7c478bd9Sstevel@tonic-gate 		show_ffg(pri);
1839*7c478bd9Sstevel@tonic-gate 		return;
1840*7c478bd9Sstevel@tonic-gate 	}
1841*7c478bd9Sstevel@tonic-gate 
1842*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == NULL)
1843*7c478bd9Sstevel@tonic-gate 		return;
1844*7c478bd9Sstevel@tonic-gate 
1845*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[1]) {
1846*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1847*7c478bd9Sstevel@tonic-gate 	case F_GETLK:
1848*7c478bd9Sstevel@tonic-gate 	case F_SETLK:
1849*7c478bd9Sstevel@tonic-gate 	case F_SETLKW:
1850*7c478bd9Sstevel@tonic-gate 	case F_FREESP:
1851*7c478bd9Sstevel@tonic-gate 	case F_ALLOCSP:
1852*7c478bd9Sstevel@tonic-gate 	case F_SETLK_NBMAND:
1853*7c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
1854*7c478bd9Sstevel@tonic-gate 			show_flock64(pri, offset);
1855*7c478bd9Sstevel@tonic-gate 		else
1856*7c478bd9Sstevel@tonic-gate 			show_flock32(pri, offset);
1857*7c478bd9Sstevel@tonic-gate 		break;
1858*7c478bd9Sstevel@tonic-gate 	case 33:	/* F_GETLK64 */
1859*7c478bd9Sstevel@tonic-gate 	case 34:	/* F_SETLK64 */
1860*7c478bd9Sstevel@tonic-gate 	case 35:	/* F_SETLKW64 */
1861*7c478bd9Sstevel@tonic-gate 	case 27:	/* F_FREESP64 */
1862*7c478bd9Sstevel@tonic-gate 	case 44:	/* F_SETLK64_NBMAND */
1863*7c478bd9Sstevel@tonic-gate 		show_flock64(pri, offset);
1864*7c478bd9Sstevel@tonic-gate 		break;
1865*7c478bd9Sstevel@tonic-gate #else	/* _LP64 */
1866*7c478bd9Sstevel@tonic-gate 	case F_GETLK:
1867*7c478bd9Sstevel@tonic-gate 	case F_SETLK:
1868*7c478bd9Sstevel@tonic-gate 	case F_SETLKW:
1869*7c478bd9Sstevel@tonic-gate 	case F_FREESP:
1870*7c478bd9Sstevel@tonic-gate 	case F_ALLOCSP:
1871*7c478bd9Sstevel@tonic-gate 	case F_SETLK_NBMAND:
1872*7c478bd9Sstevel@tonic-gate 		show_flock32(pri, offset);
1873*7c478bd9Sstevel@tonic-gate 		break;
1874*7c478bd9Sstevel@tonic-gate 	case F_GETLK64:
1875*7c478bd9Sstevel@tonic-gate 	case F_SETLK64:
1876*7c478bd9Sstevel@tonic-gate 	case F_SETLKW64:
1877*7c478bd9Sstevel@tonic-gate 	case F_FREESP64:
1878*7c478bd9Sstevel@tonic-gate 	case F_SETLK64_NBMAND:
1879*7c478bd9Sstevel@tonic-gate 		show_flock64(pri, offset);
1880*7c478bd9Sstevel@tonic-gate 		break;
1881*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1882*7c478bd9Sstevel@tonic-gate 	case F_SHARE:
1883*7c478bd9Sstevel@tonic-gate 	case F_UNSHARE:
1884*7c478bd9Sstevel@tonic-gate 		show_share(pri, offset);
1885*7c478bd9Sstevel@tonic-gate 		break;
1886*7c478bd9Sstevel@tonic-gate 	}
1887*7c478bd9Sstevel@tonic-gate }
1888*7c478bd9Sstevel@tonic-gate 
1889*7c478bd9Sstevel@tonic-gate void
1890*7c478bd9Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump)
1891*7c478bd9Sstevel@tonic-gate {
1892*7c478bd9Sstevel@tonic-gate 	struct strbuf strbuf;
1893*7c478bd9Sstevel@tonic-gate 
1894*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
1895*7c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strbuf, name, dump);
1896*7c478bd9Sstevel@tonic-gate }
1897*7c478bd9Sstevel@tonic-gate 
1898*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1899*7c478bd9Sstevel@tonic-gate void
1900*7c478bd9Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump)
1901*7c478bd9Sstevel@tonic-gate {
1902*7c478bd9Sstevel@tonic-gate 	struct strbuf32 strbuf;
1903*7c478bd9Sstevel@tonic-gate 
1904*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
1905*7c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strbuf, name, dump);
1906*7c478bd9Sstevel@tonic-gate }
1907*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1908*7c478bd9Sstevel@tonic-gate 
1909*7c478bd9Sstevel@tonic-gate void
1910*7c478bd9Sstevel@tonic-gate show_gp_msg(private_t *pri, int what)
1911*7c478bd9Sstevel@tonic-gate {
1912*7c478bd9Sstevel@tonic-gate 	long offset;
1913*7c478bd9Sstevel@tonic-gate 	int dump = FALSE;
1914*7c478bd9Sstevel@tonic-gate 	int fdp1 = pri->sys_args[0] + 1;
1915*7c478bd9Sstevel@tonic-gate 
1916*7c478bd9Sstevel@tonic-gate 	switch (what) {
1917*7c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
1918*7c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
1919*7c478bd9Sstevel@tonic-gate 		if (pri->Errno == 0 && prismember(&readfd, fdp1))
1920*7c478bd9Sstevel@tonic-gate 			dump = TRUE;
1921*7c478bd9Sstevel@tonic-gate 		break;
1922*7c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
1923*7c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
1924*7c478bd9Sstevel@tonic-gate 		if (prismember(&writefd, fdp1))
1925*7c478bd9Sstevel@tonic-gate 			dump = TRUE;
1926*7c478bd9Sstevel@tonic-gate 		break;
1927*7c478bd9Sstevel@tonic-gate 	}
1928*7c478bd9Sstevel@tonic-gate 
1929*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
1930*7c478bd9Sstevel@tonic-gate 	if (dump)
1931*7c478bd9Sstevel@tonic-gate 		Eserialize();
1932*7c478bd9Sstevel@tonic-gate 
1933*7c478bd9Sstevel@tonic-gate #ifdef _LP64
1934*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) {
1935*7c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
1936*7c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "ctl", dump);
1937*7c478bd9Sstevel@tonic-gate 		else
1938*7c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "ctl", dump);
1939*7c478bd9Sstevel@tonic-gate 	}
1940*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) {
1941*7c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
1942*7c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "dat", dump);
1943*7c478bd9Sstevel@tonic-gate 		else
1944*7c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "dat", dump);
1945*7c478bd9Sstevel@tonic-gate 	}
1946*7c478bd9Sstevel@tonic-gate #else	/* _LP64 */
1947*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL)
1948*7c478bd9Sstevel@tonic-gate 		show_strbuf(pri, offset, "ctl", dump);
1949*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL)
1950*7c478bd9Sstevel@tonic-gate 		show_strbuf(pri, offset, "dat", dump);
1951*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
1952*7c478bd9Sstevel@tonic-gate 
1953*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
1954*7c478bd9Sstevel@tonic-gate 	if (dump)
1955*7c478bd9Sstevel@tonic-gate 		Xserialize();
1956*7c478bd9Sstevel@tonic-gate }
1957*7c478bd9Sstevel@tonic-gate 
1958*7c478bd9Sstevel@tonic-gate void
1959*7c478bd9Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name)
1960*7c478bd9Sstevel@tonic-gate {
1961*7c478bd9Sstevel@tonic-gate 	int value;
1962*7c478bd9Sstevel@tonic-gate 
1963*7c478bd9Sstevel@tonic-gate 	if (offset != 0 &&
1964*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
1965*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t%d\n",
1966*7c478bd9Sstevel@tonic-gate 			pri->pname,
1967*7c478bd9Sstevel@tonic-gate 			name,
1968*7c478bd9Sstevel@tonic-gate 			value);
1969*7c478bd9Sstevel@tonic-gate }
1970*7c478bd9Sstevel@tonic-gate 
1971*7c478bd9Sstevel@tonic-gate void
1972*7c478bd9Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name)
1973*7c478bd9Sstevel@tonic-gate {
1974*7c478bd9Sstevel@tonic-gate 	int value;
1975*7c478bd9Sstevel@tonic-gate 
1976*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
1977*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t0x%.4X\n",
1978*7c478bd9Sstevel@tonic-gate 			pri->pname,
1979*7c478bd9Sstevel@tonic-gate 			name,
1980*7c478bd9Sstevel@tonic-gate 			value);
1981*7c478bd9Sstevel@tonic-gate }
1982*7c478bd9Sstevel@tonic-gate 
1983*7c478bd9Sstevel@tonic-gate #define	ALL_POLL_FLAGS	(POLLIN|POLLPRI|POLLOUT| \
1984*7c478bd9Sstevel@tonic-gate 	POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
1985*7c478bd9Sstevel@tonic-gate 
1986*7c478bd9Sstevel@tonic-gate const char *
1987*7c478bd9Sstevel@tonic-gate pollevent(private_t *pri, int arg)
1988*7c478bd9Sstevel@tonic-gate {
1989*7c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
1990*7c478bd9Sstevel@tonic-gate 
1991*7c478bd9Sstevel@tonic-gate 	if (arg == 0)
1992*7c478bd9Sstevel@tonic-gate 		return ("0");
1993*7c478bd9Sstevel@tonic-gate 	if (arg & ~ALL_POLL_FLAGS) {
1994*7c478bd9Sstevel@tonic-gate 		(void) sprintf(str, "0x%-5X", arg);
1995*7c478bd9Sstevel@tonic-gate 		return ((const char *)str);
1996*7c478bd9Sstevel@tonic-gate 	}
1997*7c478bd9Sstevel@tonic-gate 
1998*7c478bd9Sstevel@tonic-gate 	*str = '\0';
1999*7c478bd9Sstevel@tonic-gate 	if (arg & POLLIN)
2000*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLIN");
2001*7c478bd9Sstevel@tonic-gate 	if (arg & POLLPRI)
2002*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLPRI");
2003*7c478bd9Sstevel@tonic-gate 	if (arg & POLLOUT)
2004*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLOUT");
2005*7c478bd9Sstevel@tonic-gate 	if (arg & POLLRDNORM)
2006*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDNORM");
2007*7c478bd9Sstevel@tonic-gate 	if (arg & POLLRDBAND)
2008*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDBAND");
2009*7c478bd9Sstevel@tonic-gate 	if (arg & POLLWRBAND)
2010*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLWRBAND");
2011*7c478bd9Sstevel@tonic-gate 	if (arg & POLLERR)
2012*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLERR");
2013*7c478bd9Sstevel@tonic-gate 	if (arg & POLLHUP)
2014*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLHUP");
2015*7c478bd9Sstevel@tonic-gate 	if (arg & POLLNVAL)
2016*7c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLNVAL");
2017*7c478bd9Sstevel@tonic-gate 
2018*7c478bd9Sstevel@tonic-gate 	return ((const char *)(str+1));
2019*7c478bd9Sstevel@tonic-gate }
2020*7c478bd9Sstevel@tonic-gate 
2021*7c478bd9Sstevel@tonic-gate static void
2022*7c478bd9Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd)
2023*7c478bd9Sstevel@tonic-gate {
2024*7c478bd9Sstevel@tonic-gate 	/*
2025*7c478bd9Sstevel@tonic-gate 	 * can't print both events and revents in same printf.
2026*7c478bd9Sstevel@tonic-gate 	 * pollevent() returns a pointer to a TSD location.
2027*7c478bd9Sstevel@tonic-gate 	 */
2028*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\tfd=%-2d ev=%s",
2029*7c478bd9Sstevel@tonic-gate 	    pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events));
2030*7c478bd9Sstevel@tonic-gate 	(void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents));
2031*7c478bd9Sstevel@tonic-gate }
2032*7c478bd9Sstevel@tonic-gate 
2033*7c478bd9Sstevel@tonic-gate static void
2034*7c478bd9Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds)
2035*7c478bd9Sstevel@tonic-gate {
2036*7c478bd9Sstevel@tonic-gate 	struct pollfd pollfd[2];
2037*7c478bd9Sstevel@tonic-gate 	int skip = -1;
2038*7c478bd9Sstevel@tonic-gate 
2039*7c478bd9Sstevel@tonic-gate 	for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) {
2040*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) !=
2041*7c478bd9Sstevel@tonic-gate 		    sizeof (struct pollfd))
2042*7c478bd9Sstevel@tonic-gate 			continue;
2043*7c478bd9Sstevel@tonic-gate 
2044*7c478bd9Sstevel@tonic-gate 		if (skip >= 0 && pollfd[0].fd == pollfd[1].fd &&
2045*7c478bd9Sstevel@tonic-gate 		    pollfd[0].events == pollfd[1].events &&
2046*7c478bd9Sstevel@tonic-gate 		    pollfd[0].revents == pollfd[1].revents) {
2047*7c478bd9Sstevel@tonic-gate 			skip++;
2048*7c478bd9Sstevel@tonic-gate 			continue;
2049*7c478bd9Sstevel@tonic-gate 		}
2050*7c478bd9Sstevel@tonic-gate 
2051*7c478bd9Sstevel@tonic-gate 		if (skip > 0)
2052*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t...last pollfd structure"
2053*7c478bd9Sstevel@tonic-gate 			    " repeated %d time%s...\n",
2054*7c478bd9Sstevel@tonic-gate 			    pri->pname, skip, (skip == 1 ? "" : "s"));
2055*7c478bd9Sstevel@tonic-gate 
2056*7c478bd9Sstevel@tonic-gate 		skip = 0;
2057*7c478bd9Sstevel@tonic-gate 		show_one_pollfd(pri, &pollfd[0]);
2058*7c478bd9Sstevel@tonic-gate 		pollfd[1] = pollfd[0];
2059*7c478bd9Sstevel@tonic-gate 	}
2060*7c478bd9Sstevel@tonic-gate 
2061*7c478bd9Sstevel@tonic-gate 	if (skip > 0)
2062*7c478bd9Sstevel@tonic-gate 		(void) printf(
2063*7c478bd9Sstevel@tonic-gate 		    "%s\t...last pollfd structure repeated %d time%s...\n",
2064*7c478bd9Sstevel@tonic-gate 		    pri->pname, skip, (skip == 1 ? "" : "s"));
2065*7c478bd9Sstevel@tonic-gate }
2066*7c478bd9Sstevel@tonic-gate 
2067*7c478bd9Sstevel@tonic-gate void
2068*7c478bd9Sstevel@tonic-gate show_poll(private_t *pri)
2069*7c478bd9Sstevel@tonic-gate {
2070*7c478bd9Sstevel@tonic-gate 	long offset;
2071*7c478bd9Sstevel@tonic-gate 	int nfds;
2072*7c478bd9Sstevel@tonic-gate 	int serial = 0;
2073*7c478bd9Sstevel@tonic-gate 
2074*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2 || (offset = pri->sys_args[0]) == NULL ||
2075*7c478bd9Sstevel@tonic-gate 	    (nfds = pri->sys_args[1]) <= 0)
2076*7c478bd9Sstevel@tonic-gate 		return;
2077*7c478bd9Sstevel@tonic-gate 
2078*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
2079*7c478bd9Sstevel@tonic-gate 	if (nfds > 32) {
2080*7c478bd9Sstevel@tonic-gate 		Eserialize();
2081*7c478bd9Sstevel@tonic-gate 		serial = 1;
2082*7c478bd9Sstevel@tonic-gate 	}
2083*7c478bd9Sstevel@tonic-gate 
2084*7c478bd9Sstevel@tonic-gate 	show_all_pollfds(pri, offset, nfds);
2085*7c478bd9Sstevel@tonic-gate 
2086*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
2087*7c478bd9Sstevel@tonic-gate 	if (serial)
2088*7c478bd9Sstevel@tonic-gate 		Xserialize();
2089*7c478bd9Sstevel@tonic-gate }
2090*7c478bd9Sstevel@tonic-gate 
2091*7c478bd9Sstevel@tonic-gate void
2092*7c478bd9Sstevel@tonic-gate show_pollsys(private_t *pri)
2093*7c478bd9Sstevel@tonic-gate {
2094*7c478bd9Sstevel@tonic-gate 	long offset;
2095*7c478bd9Sstevel@tonic-gate 	int nfds;
2096*7c478bd9Sstevel@tonic-gate 	int serial = 0;
2097*7c478bd9Sstevel@tonic-gate 
2098*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2)
2099*7c478bd9Sstevel@tonic-gate 		return;
2100*7c478bd9Sstevel@tonic-gate 
2101*7c478bd9Sstevel@tonic-gate 	offset = pri->sys_args[0];
2102*7c478bd9Sstevel@tonic-gate 	nfds = pri->sys_args[1];
2103*7c478bd9Sstevel@tonic-gate 
2104*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
2105*7c478bd9Sstevel@tonic-gate 	if (offset != NULL && nfds > 32) {
2106*7c478bd9Sstevel@tonic-gate 		Eserialize();
2107*7c478bd9Sstevel@tonic-gate 		serial = 1;
2108*7c478bd9Sstevel@tonic-gate 	}
2109*7c478bd9Sstevel@tonic-gate 
2110*7c478bd9Sstevel@tonic-gate 	if (offset != NULL && nfds > 0)
2111*7c478bd9Sstevel@tonic-gate 		show_all_pollfds(pri, offset, nfds);
2112*7c478bd9Sstevel@tonic-gate 
2113*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 2)
2114*7c478bd9Sstevel@tonic-gate 		show_timestruc(pri, (long)pri->sys_args[2], "timeout");
2115*7c478bd9Sstevel@tonic-gate 
2116*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 3)
2117*7c478bd9Sstevel@tonic-gate 		show_sigset(pri, (long)pri->sys_args[3], "sigmask");
2118*7c478bd9Sstevel@tonic-gate 
2119*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
2120*7c478bd9Sstevel@tonic-gate 	if (serial)
2121*7c478bd9Sstevel@tonic-gate 		Xserialize();
2122*7c478bd9Sstevel@tonic-gate }
2123*7c478bd9Sstevel@tonic-gate 
2124*7c478bd9Sstevel@tonic-gate static void
2125*7c478bd9Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip)
2126*7c478bd9Sstevel@tonic-gate {
2127*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\tu=%-5d g=%-5d cu=%-5d cg=%-5d z=%-5d "
2128*7c478bd9Sstevel@tonic-gate 	    "m=0%.6o key=%d projid=%-5d\n",
2129*7c478bd9Sstevel@tonic-gate 	    pri->pname,
2130*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_uid,
2131*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_gid,
2132*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_cuid,
2133*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_cgid,
2134*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_zoneid,
2135*7c478bd9Sstevel@tonic-gate 	    (unsigned int)ip->ipcx_mode,
2136*7c478bd9Sstevel@tonic-gate 	    ip->ipcx_key,
2137*7c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_projid);
2138*7c478bd9Sstevel@tonic-gate }
2139*7c478bd9Sstevel@tonic-gate 
2140*7c478bd9Sstevel@tonic-gate void
2141*7c478bd9Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip)
2142*7c478bd9Sstevel@tonic-gate {
2143*7c478bd9Sstevel@tonic-gate 	(void) printf(
2144*7c478bd9Sstevel@tonic-gate 	"%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2145*7c478bd9Sstevel@tonic-gate 		pri->pname,
2146*7c478bd9Sstevel@tonic-gate 		(int)ip->uid,
2147*7c478bd9Sstevel@tonic-gate 		(int)ip->gid,
2148*7c478bd9Sstevel@tonic-gate 		(int)ip->cuid,
2149*7c478bd9Sstevel@tonic-gate 		(int)ip->cgid,
2150*7c478bd9Sstevel@tonic-gate 		(int)ip->mode,
2151*7c478bd9Sstevel@tonic-gate 		ip->seq,
2152*7c478bd9Sstevel@tonic-gate 		ip->key);
2153*7c478bd9Sstevel@tonic-gate }
2154*7c478bd9Sstevel@tonic-gate 
2155*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2156*7c478bd9Sstevel@tonic-gate void
2157*7c478bd9Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip)
2158*7c478bd9Sstevel@tonic-gate {
2159*7c478bd9Sstevel@tonic-gate 	(void) printf(
2160*7c478bd9Sstevel@tonic-gate 	"%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2161*7c478bd9Sstevel@tonic-gate 		pri->pname,
2162*7c478bd9Sstevel@tonic-gate 		ip->uid,
2163*7c478bd9Sstevel@tonic-gate 		ip->gid,
2164*7c478bd9Sstevel@tonic-gate 		ip->cuid,
2165*7c478bd9Sstevel@tonic-gate 		ip->cgid,
2166*7c478bd9Sstevel@tonic-gate 		ip->mode,
2167*7c478bd9Sstevel@tonic-gate 		ip->seq,
2168*7c478bd9Sstevel@tonic-gate 		ip->key);
2169*7c478bd9Sstevel@tonic-gate }
2170*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2171*7c478bd9Sstevel@tonic-gate 
2172*7c478bd9Sstevel@tonic-gate static void
2173*7c478bd9Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset)
2174*7c478bd9Sstevel@tonic-gate {
2175*7c478bd9Sstevel@tonic-gate 	struct msqid_ds64 msgq;
2176*7c478bd9Sstevel@tonic-gate 
2177*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2178*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
2179*7c478bd9Sstevel@tonic-gate 		show_perm64(pri, &msgq.msgx_perm);
2180*7c478bd9Sstevel@tonic-gate 
2181*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
2182*7c478bd9Sstevel@tonic-gate 		    "lspid=%-5d lrpid=%-5d\n", pri->pname,
2183*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_cbytes,
2184*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qnum,
2185*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qbytes,
2186*7c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lspid,
2187*7c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lrpid);
2188*7c478bd9Sstevel@tonic-gate 
2189*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", (time_t)msgq.msgx_stime);
2190*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", (time_t)msgq.msgx_rtime);
2191*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)msgq.msgx_ctime);
2192*7c478bd9Sstevel@tonic-gate 	}
2193*7c478bd9Sstevel@tonic-gate }
2194*7c478bd9Sstevel@tonic-gate 
2195*7c478bd9Sstevel@tonic-gate void
2196*7c478bd9Sstevel@tonic-gate show_msgctl(private_t *pri, long offset)
2197*7c478bd9Sstevel@tonic-gate {
2198*7c478bd9Sstevel@tonic-gate 	struct msqid_ds msgq;
2199*7c478bd9Sstevel@tonic-gate 
2200*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2201*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
2202*7c478bd9Sstevel@tonic-gate 		show_perm(pri, &msgq.msg_perm);
2203*7c478bd9Sstevel@tonic-gate 
2204*7c478bd9Sstevel@tonic-gate 		(void) printf(
2205*7c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2206*7c478bd9Sstevel@tonic-gate 			pri->pname,
2207*7c478bd9Sstevel@tonic-gate 			msgq.msg_cbytes,
2208*7c478bd9Sstevel@tonic-gate 			msgq.msg_qnum,
2209*7c478bd9Sstevel@tonic-gate 			msgq.msg_qbytes,
2210*7c478bd9Sstevel@tonic-gate 			(int)msgq.msg_lspid,
2211*7c478bd9Sstevel@tonic-gate 			(int)msgq.msg_lrpid);
2212*7c478bd9Sstevel@tonic-gate 
2213*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
2214*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
2215*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
2216*7c478bd9Sstevel@tonic-gate 	}
2217*7c478bd9Sstevel@tonic-gate }
2218*7c478bd9Sstevel@tonic-gate 
2219*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2220*7c478bd9Sstevel@tonic-gate void
2221*7c478bd9Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset)
2222*7c478bd9Sstevel@tonic-gate {
2223*7c478bd9Sstevel@tonic-gate 	struct msqid_ds32 msgq;
2224*7c478bd9Sstevel@tonic-gate 
2225*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2226*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
2227*7c478bd9Sstevel@tonic-gate 		show_perm32(pri, &msgq.msg_perm);
2228*7c478bd9Sstevel@tonic-gate 
2229*7c478bd9Sstevel@tonic-gate 		(void) printf(
2230*7c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2231*7c478bd9Sstevel@tonic-gate 			pri->pname,
2232*7c478bd9Sstevel@tonic-gate 			msgq.msg_cbytes,
2233*7c478bd9Sstevel@tonic-gate 			msgq.msg_qnum,
2234*7c478bd9Sstevel@tonic-gate 			msgq.msg_qbytes,
2235*7c478bd9Sstevel@tonic-gate 			msgq.msg_lspid,
2236*7c478bd9Sstevel@tonic-gate 			msgq.msg_lrpid);
2237*7c478bd9Sstevel@tonic-gate 
2238*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
2239*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
2240*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
2241*7c478bd9Sstevel@tonic-gate 	}
2242*7c478bd9Sstevel@tonic-gate }
2243*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2244*7c478bd9Sstevel@tonic-gate 
2245*7c478bd9Sstevel@tonic-gate void
2246*7c478bd9Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz)
2247*7c478bd9Sstevel@tonic-gate {
2248*7c478bd9Sstevel@tonic-gate 	struct msgbuf msgb;
2249*7c478bd9Sstevel@tonic-gate 
2250*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2251*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
2252*7c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
2253*7c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
2254*7c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
2255*7c478bd9Sstevel@tonic-gate 			Eserialize();
2256*7c478bd9Sstevel@tonic-gate 
2257*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%lu  mtext[]=\n",
2258*7c478bd9Sstevel@tonic-gate 			pri->pname,
2259*7c478bd9Sstevel@tonic-gate 			msgb.mtype);
2260*7c478bd9Sstevel@tonic-gate 		showbuffer(pri,
2261*7c478bd9Sstevel@tonic-gate 			(long)(offset + sizeof (msgb.mtype)), msgsz);
2262*7c478bd9Sstevel@tonic-gate 
2263*7c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
2264*7c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
2265*7c478bd9Sstevel@tonic-gate 			Xserialize();
2266*7c478bd9Sstevel@tonic-gate 	}
2267*7c478bd9Sstevel@tonic-gate }
2268*7c478bd9Sstevel@tonic-gate 
2269*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2270*7c478bd9Sstevel@tonic-gate void
2271*7c478bd9Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz)
2272*7c478bd9Sstevel@tonic-gate {
2273*7c478bd9Sstevel@tonic-gate 	struct ipcmsgbuf32 msgb;
2274*7c478bd9Sstevel@tonic-gate 
2275*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2276*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
2277*7c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
2278*7c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
2279*7c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
2280*7c478bd9Sstevel@tonic-gate 			Eserialize();
2281*7c478bd9Sstevel@tonic-gate 
2282*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%u  mtext[]=\n",
2283*7c478bd9Sstevel@tonic-gate 			pri->pname,
2284*7c478bd9Sstevel@tonic-gate 			msgb.mtype);
2285*7c478bd9Sstevel@tonic-gate 		showbuffer(pri,
2286*7c478bd9Sstevel@tonic-gate 			(long)(offset + sizeof (msgb.mtype)), msgsz);
2287*7c478bd9Sstevel@tonic-gate 
2288*7c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
2289*7c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
2290*7c478bd9Sstevel@tonic-gate 			Xserialize();
2291*7c478bd9Sstevel@tonic-gate 	}
2292*7c478bd9Sstevel@tonic-gate }
2293*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2294*7c478bd9Sstevel@tonic-gate 
2295*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2296*7c478bd9Sstevel@tonic-gate void
2297*7c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
2298*7c478bd9Sstevel@tonic-gate {
2299*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
2300*7c478bd9Sstevel@tonic-gate 	case 0:			/* msgget() */
2301*7c478bd9Sstevel@tonic-gate 		break;
2302*7c478bd9Sstevel@tonic-gate 	case 1:			/* msgctl() */
2303*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
2304*7c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
2305*7c478bd9Sstevel@tonic-gate 			case IPC_STAT:
2306*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2307*7c478bd9Sstevel@tonic-gate 					break;
2308*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2309*7c478bd9Sstevel@tonic-gate 			case IPC_SET:
2310*7c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
2311*7c478bd9Sstevel@tonic-gate 					show_msgctl(pri,
2312*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[3]);
2313*7c478bd9Sstevel@tonic-gate 				else
2314*7c478bd9Sstevel@tonic-gate 					show_msgctl32(pri,
2315*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[3]);
2316*7c478bd9Sstevel@tonic-gate 				break;
2317*7c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
2318*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2319*7c478bd9Sstevel@tonic-gate 					break;
2320*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2321*7c478bd9Sstevel@tonic-gate 			case IPC_SET64:
2322*7c478bd9Sstevel@tonic-gate 				show_msgctl64(pri, (long)pri->sys_args[3]);
2323*7c478bd9Sstevel@tonic-gate 				break;
2324*7c478bd9Sstevel@tonic-gate 			}
2325*7c478bd9Sstevel@tonic-gate 		}
2326*7c478bd9Sstevel@tonic-gate 		break;
2327*7c478bd9Sstevel@tonic-gate 	case 2:			/* msgrcv() */
2328*7c478bd9Sstevel@tonic-gate 		if (!pri->Errno && pri->sys_nargs > 2) {
2329*7c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
2330*7c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2], msgsz);
2331*7c478bd9Sstevel@tonic-gate 			else
2332*7c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2], msgsz);
2333*7c478bd9Sstevel@tonic-gate 		}
2334*7c478bd9Sstevel@tonic-gate 		break;
2335*7c478bd9Sstevel@tonic-gate 	case 3:			/* msgsnd() */
2336*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
2337*7c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
2338*7c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2],
2339*7c478bd9Sstevel@tonic-gate 					pri->sys_args[3]);
2340*7c478bd9Sstevel@tonic-gate 			else
2341*7c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2],
2342*7c478bd9Sstevel@tonic-gate 					pri->sys_args[3]);
2343*7c478bd9Sstevel@tonic-gate 		}
2344*7c478bd9Sstevel@tonic-gate 		break;
2345*7c478bd9Sstevel@tonic-gate 	case 4:			/* msgids() */
2346*7c478bd9Sstevel@tonic-gate 	case 5:			/* msgsnap() */
2347*7c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
2348*7c478bd9Sstevel@tonic-gate 		break;
2349*7c478bd9Sstevel@tonic-gate 	}
2350*7c478bd9Sstevel@tonic-gate }
2351*7c478bd9Sstevel@tonic-gate #else	/* _LP64 */
2352*7c478bd9Sstevel@tonic-gate void
2353*7c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
2354*7c478bd9Sstevel@tonic-gate {
2355*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
2356*7c478bd9Sstevel@tonic-gate 	case 0:			/* msgget() */
2357*7c478bd9Sstevel@tonic-gate 		break;
2358*7c478bd9Sstevel@tonic-gate 	case 1:			/* msgctl() */
2359*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
2360*7c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
2361*7c478bd9Sstevel@tonic-gate 			case IPC_STAT:
2362*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2363*7c478bd9Sstevel@tonic-gate 					break;
2364*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2365*7c478bd9Sstevel@tonic-gate 			case IPC_SET:
2366*7c478bd9Sstevel@tonic-gate 				show_msgctl(pri, (long)pri->sys_args[3]);
2367*7c478bd9Sstevel@tonic-gate 				break;
2368*7c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
2369*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2370*7c478bd9Sstevel@tonic-gate 					break;
2371*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2372*7c478bd9Sstevel@tonic-gate 			case IPC_SET64:
2373*7c478bd9Sstevel@tonic-gate 				show_msgctl64(pri, (long)pri->sys_args[3]);
2374*7c478bd9Sstevel@tonic-gate 				break;
2375*7c478bd9Sstevel@tonic-gate 			}
2376*7c478bd9Sstevel@tonic-gate 		}
2377*7c478bd9Sstevel@tonic-gate 		break;
2378*7c478bd9Sstevel@tonic-gate 	case 2:			/* msgrcv() */
2379*7c478bd9Sstevel@tonic-gate 		if (!pri->Errno && pri->sys_nargs > 2)
2380*7c478bd9Sstevel@tonic-gate 			show_msgbuf(pri, pri->sys_args[2], msgsz);
2381*7c478bd9Sstevel@tonic-gate 		break;
2382*7c478bd9Sstevel@tonic-gate 	case 3:			/* msgsnd() */
2383*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
2384*7c478bd9Sstevel@tonic-gate 			show_msgbuf(pri, pri->sys_args[2],
2385*7c478bd9Sstevel@tonic-gate 				pri->sys_args[3]);
2386*7c478bd9Sstevel@tonic-gate 		break;
2387*7c478bd9Sstevel@tonic-gate 	case 4:			/* msgids() */
2388*7c478bd9Sstevel@tonic-gate 	case 5:			/* msgsnap() */
2389*7c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
2390*7c478bd9Sstevel@tonic-gate 		break;
2391*7c478bd9Sstevel@tonic-gate 	}
2392*7c478bd9Sstevel@tonic-gate }
2393*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2394*7c478bd9Sstevel@tonic-gate 
2395*7c478bd9Sstevel@tonic-gate static void
2396*7c478bd9Sstevel@tonic-gate show_semctl64(private_t *pri, long offset)
2397*7c478bd9Sstevel@tonic-gate {
2398*7c478bd9Sstevel@tonic-gate 	struct semid_ds64 semds;
2399*7c478bd9Sstevel@tonic-gate 
2400*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2401*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
2402*7c478bd9Sstevel@tonic-gate 		show_perm64(pri, &semds.semx_perm);
2403*7c478bd9Sstevel@tonic-gate 
2404*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems);
2405*7c478bd9Sstevel@tonic-gate 
2406*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", (time_t)semds.semx_otime);
2407*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)semds.semx_ctime);
2408*7c478bd9Sstevel@tonic-gate 	}
2409*7c478bd9Sstevel@tonic-gate }
2410*7c478bd9Sstevel@tonic-gate 
2411*7c478bd9Sstevel@tonic-gate void
2412*7c478bd9Sstevel@tonic-gate show_semctl(private_t *pri, long offset)
2413*7c478bd9Sstevel@tonic-gate {
2414*7c478bd9Sstevel@tonic-gate 	struct semid_ds semds;
2415*7c478bd9Sstevel@tonic-gate 
2416*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2417*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
2418*7c478bd9Sstevel@tonic-gate 		show_perm(pri, &semds.sem_perm);
2419*7c478bd9Sstevel@tonic-gate 
2420*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
2421*7c478bd9Sstevel@tonic-gate 			pri->pname,
2422*7c478bd9Sstevel@tonic-gate 			semds.sem_nsems);
2423*7c478bd9Sstevel@tonic-gate 
2424*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
2425*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
2426*7c478bd9Sstevel@tonic-gate 	}
2427*7c478bd9Sstevel@tonic-gate }
2428*7c478bd9Sstevel@tonic-gate 
2429*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2430*7c478bd9Sstevel@tonic-gate void
2431*7c478bd9Sstevel@tonic-gate show_semctl32(private_t *pri, long offset)
2432*7c478bd9Sstevel@tonic-gate {
2433*7c478bd9Sstevel@tonic-gate 	struct semid_ds32 semds;
2434*7c478bd9Sstevel@tonic-gate 
2435*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2436*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
2437*7c478bd9Sstevel@tonic-gate 		show_perm32(pri, &semds.sem_perm);
2438*7c478bd9Sstevel@tonic-gate 
2439*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
2440*7c478bd9Sstevel@tonic-gate 			pri->pname,
2441*7c478bd9Sstevel@tonic-gate 			semds.sem_nsems);
2442*7c478bd9Sstevel@tonic-gate 
2443*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
2444*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
2445*7c478bd9Sstevel@tonic-gate 	}
2446*7c478bd9Sstevel@tonic-gate }
2447*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2448*7c478bd9Sstevel@tonic-gate 
2449*7c478bd9Sstevel@tonic-gate void
2450*7c478bd9Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout)
2451*7c478bd9Sstevel@tonic-gate {
2452*7c478bd9Sstevel@tonic-gate 	struct sembuf sembuf;
2453*7c478bd9Sstevel@tonic-gate 	const char *str;
2454*7c478bd9Sstevel@tonic-gate 
2455*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
2456*7c478bd9Sstevel@tonic-gate 		return;
2457*7c478bd9Sstevel@tonic-gate 
2458*7c478bd9Sstevel@tonic-gate 	if (nsops > 40)		/* let's not be ridiculous */
2459*7c478bd9Sstevel@tonic-gate 		nsops = 40;
2460*7c478bd9Sstevel@tonic-gate 
2461*7c478bd9Sstevel@tonic-gate 	for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) {
2462*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &sembuf, sizeof (sembuf), offset) !=
2463*7c478bd9Sstevel@tonic-gate 		    sizeof (sembuf))
2464*7c478bd9Sstevel@tonic-gate 			break;
2465*7c478bd9Sstevel@tonic-gate 
2466*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2467*7c478bd9Sstevel@tonic-gate 			pri->pname,
2468*7c478bd9Sstevel@tonic-gate 			sembuf.sem_num,
2469*7c478bd9Sstevel@tonic-gate 			sembuf.sem_op);
2470*7c478bd9Sstevel@tonic-gate 
2471*7c478bd9Sstevel@tonic-gate 		if (sembuf.sem_flg == 0)
2472*7c478bd9Sstevel@tonic-gate 			(void) printf("0\n");
2473*7c478bd9Sstevel@tonic-gate 		else if ((str = semflags(pri, sembuf.sem_flg)) != NULL)
2474*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\n", str);
2475*7c478bd9Sstevel@tonic-gate 		else
2476*7c478bd9Sstevel@tonic-gate 			(void) printf("0%.6o\n", sembuf.sem_flg);
2477*7c478bd9Sstevel@tonic-gate 	}
2478*7c478bd9Sstevel@tonic-gate 	if (timeout)
2479*7c478bd9Sstevel@tonic-gate 		show_timestruc(pri, timeout, "timeout");
2480*7c478bd9Sstevel@tonic-gate }
2481*7c478bd9Sstevel@tonic-gate 
2482*7c478bd9Sstevel@tonic-gate void
2483*7c478bd9Sstevel@tonic-gate show_semsys(private_t *pri)
2484*7c478bd9Sstevel@tonic-gate {
2485*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
2486*7c478bd9Sstevel@tonic-gate 	case 0:			/* semctl() */
2487*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4) {
2488*7c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[3]) {
2489*7c478bd9Sstevel@tonic-gate 			case IPC_STAT:
2490*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2491*7c478bd9Sstevel@tonic-gate 					break;
2492*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2493*7c478bd9Sstevel@tonic-gate 			case IPC_SET:
2494*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2495*7c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
2496*7c478bd9Sstevel@tonic-gate 					show_semctl(pri,
2497*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[4]);
2498*7c478bd9Sstevel@tonic-gate 				else
2499*7c478bd9Sstevel@tonic-gate 					show_semctl32(pri,
2500*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[4]);
2501*7c478bd9Sstevel@tonic-gate #else
2502*7c478bd9Sstevel@tonic-gate 				show_semctl(pri, (long)pri->sys_args[4]);
2503*7c478bd9Sstevel@tonic-gate #endif
2504*7c478bd9Sstevel@tonic-gate 				break;
2505*7c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
2506*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2507*7c478bd9Sstevel@tonic-gate 					break;
2508*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2509*7c478bd9Sstevel@tonic-gate 			case IPC_SET64:
2510*7c478bd9Sstevel@tonic-gate 				show_semctl64(pri, (long)pri->sys_args[4]);
2511*7c478bd9Sstevel@tonic-gate 				break;
2512*7c478bd9Sstevel@tonic-gate 			}
2513*7c478bd9Sstevel@tonic-gate 		}
2514*7c478bd9Sstevel@tonic-gate 		break;
2515*7c478bd9Sstevel@tonic-gate 	case 1:			/* semget() */
2516*7c478bd9Sstevel@tonic-gate 		break;
2517*7c478bd9Sstevel@tonic-gate 	case 2:			/* semop() */
2518*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
2519*7c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
2520*7c478bd9Sstevel@tonic-gate 				pri->sys_args[3], 0);
2521*7c478bd9Sstevel@tonic-gate 		break;
2522*7c478bd9Sstevel@tonic-gate 	case 3:			/* semids() */
2523*7c478bd9Sstevel@tonic-gate 		break;
2524*7c478bd9Sstevel@tonic-gate 	case 4:			/* semtimedop() */
2525*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
2526*7c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
2527*7c478bd9Sstevel@tonic-gate 				pri->sys_args[3], pri->sys_args[4]);
2528*7c478bd9Sstevel@tonic-gate 		break;
2529*7c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
2530*7c478bd9Sstevel@tonic-gate 		break;
2531*7c478bd9Sstevel@tonic-gate 	}
2532*7c478bd9Sstevel@tonic-gate }
2533*7c478bd9Sstevel@tonic-gate 
2534*7c478bd9Sstevel@tonic-gate static void
2535*7c478bd9Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset)
2536*7c478bd9Sstevel@tonic-gate {
2537*7c478bd9Sstevel@tonic-gate 	struct shmid_ds64 shmds;
2538*7c478bd9Sstevel@tonic-gate 
2539*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2540*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
2541*7c478bd9Sstevel@tonic-gate 		show_perm64(pri, &shmds.shmx_perm);
2542*7c478bd9Sstevel@tonic-gate 
2543*7c478bd9Sstevel@tonic-gate 		(void) printf(
2544*7c478bd9Sstevel@tonic-gate 		    "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
2545*7c478bd9Sstevel@tonic-gate 		    pri->pname,
2546*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_segsz,
2547*7c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_lpid,
2548*7c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_cpid,
2549*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_nattch,
2550*7c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_cnattch);
2551*7c478bd9Sstevel@tonic-gate 
2552*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", (time_t)shmds.shmx_atime);
2553*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", (time_t)shmds.shmx_dtime);
2554*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)shmds.shmx_ctime);
2555*7c478bd9Sstevel@tonic-gate 	}
2556*7c478bd9Sstevel@tonic-gate }
2557*7c478bd9Sstevel@tonic-gate 
2558*7c478bd9Sstevel@tonic-gate void
2559*7c478bd9Sstevel@tonic-gate show_shmctl(private_t *pri, long offset)
2560*7c478bd9Sstevel@tonic-gate {
2561*7c478bd9Sstevel@tonic-gate 	struct shmid_ds shmds;
2562*7c478bd9Sstevel@tonic-gate 
2563*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2564*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
2565*7c478bd9Sstevel@tonic-gate 		show_perm(pri, &shmds.shm_perm);
2566*7c478bd9Sstevel@tonic-gate 
2567*7c478bd9Sstevel@tonic-gate 		(void) printf(
2568*7c478bd9Sstevel@tonic-gate 		"%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2569*7c478bd9Sstevel@tonic-gate 			pri->pname,
2570*7c478bd9Sstevel@tonic-gate 			(ulong_t)shmds.shm_segsz,
2571*7c478bd9Sstevel@tonic-gate 			(int)shmds.shm_lpid,
2572*7c478bd9Sstevel@tonic-gate 			(int)shmds.shm_cpid,
2573*7c478bd9Sstevel@tonic-gate 			shmds.shm_nattch,
2574*7c478bd9Sstevel@tonic-gate 			shmds.shm_cnattch);
2575*7c478bd9Sstevel@tonic-gate 
2576*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
2577*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
2578*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
2579*7c478bd9Sstevel@tonic-gate 	}
2580*7c478bd9Sstevel@tonic-gate }
2581*7c478bd9Sstevel@tonic-gate 
2582*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2583*7c478bd9Sstevel@tonic-gate void
2584*7c478bd9Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset)
2585*7c478bd9Sstevel@tonic-gate {
2586*7c478bd9Sstevel@tonic-gate 	struct shmid_ds32 shmds;
2587*7c478bd9Sstevel@tonic-gate 
2588*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2589*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
2590*7c478bd9Sstevel@tonic-gate 		show_perm32(pri, &shmds.shm_perm);
2591*7c478bd9Sstevel@tonic-gate 
2592*7c478bd9Sstevel@tonic-gate 		(void) printf(
2593*7c478bd9Sstevel@tonic-gate 		"%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2594*7c478bd9Sstevel@tonic-gate 			pri->pname,
2595*7c478bd9Sstevel@tonic-gate 			shmds.shm_segsz,
2596*7c478bd9Sstevel@tonic-gate 			shmds.shm_lpid,
2597*7c478bd9Sstevel@tonic-gate 			shmds.shm_cpid,
2598*7c478bd9Sstevel@tonic-gate 			shmds.shm_nattch,
2599*7c478bd9Sstevel@tonic-gate 			shmds.shm_cnattch);
2600*7c478bd9Sstevel@tonic-gate 
2601*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
2602*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
2603*7c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
2604*7c478bd9Sstevel@tonic-gate 	}
2605*7c478bd9Sstevel@tonic-gate }
2606*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2607*7c478bd9Sstevel@tonic-gate 
2608*7c478bd9Sstevel@tonic-gate void
2609*7c478bd9Sstevel@tonic-gate show_shmsys(private_t *pri)
2610*7c478bd9Sstevel@tonic-gate {
2611*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
2612*7c478bd9Sstevel@tonic-gate 	case 0:			/* shmat() */
2613*7c478bd9Sstevel@tonic-gate 		break;
2614*7c478bd9Sstevel@tonic-gate 	case 1:			/* shmctl() */
2615*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
2616*7c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
2617*7c478bd9Sstevel@tonic-gate 			case IPC_STAT:
2618*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2619*7c478bd9Sstevel@tonic-gate 					break;
2620*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2621*7c478bd9Sstevel@tonic-gate 			case IPC_SET:
2622*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2623*7c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
2624*7c478bd9Sstevel@tonic-gate 					show_shmctl(pri,
2625*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[3]);
2626*7c478bd9Sstevel@tonic-gate 				else
2627*7c478bd9Sstevel@tonic-gate 					show_shmctl32(pri,
2628*7c478bd9Sstevel@tonic-gate 						(long)pri->sys_args[3]);
2629*7c478bd9Sstevel@tonic-gate #else
2630*7c478bd9Sstevel@tonic-gate 				show_shmctl(pri, (long)pri->sys_args[3]);
2631*7c478bd9Sstevel@tonic-gate #endif
2632*7c478bd9Sstevel@tonic-gate 				break;
2633*7c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
2634*7c478bd9Sstevel@tonic-gate 				if (pri->Errno)
2635*7c478bd9Sstevel@tonic-gate 					break;
2636*7c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
2637*7c478bd9Sstevel@tonic-gate 			case IPC_SET64:
2638*7c478bd9Sstevel@tonic-gate 				show_shmctl64(pri, (long)pri->sys_args[3]);
2639*7c478bd9Sstevel@tonic-gate 				break;
2640*7c478bd9Sstevel@tonic-gate 			}
2641*7c478bd9Sstevel@tonic-gate 		}
2642*7c478bd9Sstevel@tonic-gate 		break;
2643*7c478bd9Sstevel@tonic-gate 	case 2:			/* shmdt() */
2644*7c478bd9Sstevel@tonic-gate 	case 3:			/* shmget() */
2645*7c478bd9Sstevel@tonic-gate 	case 4:			/* shmids() */
2646*7c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
2647*7c478bd9Sstevel@tonic-gate 		break;
2648*7c478bd9Sstevel@tonic-gate 	}
2649*7c478bd9Sstevel@tonic-gate }
2650*7c478bd9Sstevel@tonic-gate 
2651*7c478bd9Sstevel@tonic-gate void
2652*7c478bd9Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count)
2653*7c478bd9Sstevel@tonic-gate {
2654*7c478bd9Sstevel@tonic-gate 	int groups[100];
2655*7c478bd9Sstevel@tonic-gate 
2656*7c478bd9Sstevel@tonic-gate 	if (count > 100)
2657*7c478bd9Sstevel@tonic-gate 		count = 100;
2658*7c478bd9Sstevel@tonic-gate 
2659*7c478bd9Sstevel@tonic-gate 	if (count > 0 && offset != NULL &&
2660*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &groups[0], count*sizeof (int), offset) ==
2661*7c478bd9Sstevel@tonic-gate 	    count*sizeof (int)) {
2662*7c478bd9Sstevel@tonic-gate 		int n;
2663*7c478bd9Sstevel@tonic-gate 
2664*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
2665*7c478bd9Sstevel@tonic-gate 		for (n = 0; !interrupt && n < count; n++) {
2666*7c478bd9Sstevel@tonic-gate 			if (n != 0 && n%10 == 0)
2667*7c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t", pri->pname);
2668*7c478bd9Sstevel@tonic-gate 			(void) printf(" %5d", groups[n]);
2669*7c478bd9Sstevel@tonic-gate 		}
2670*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
2671*7c478bd9Sstevel@tonic-gate 	}
2672*7c478bd9Sstevel@tonic-gate }
2673*7c478bd9Sstevel@tonic-gate 
2674*7c478bd9Sstevel@tonic-gate /*
2675*7c478bd9Sstevel@tonic-gate  * This assumes that a sigset_t is simply an array of ints.
2676*7c478bd9Sstevel@tonic-gate  */
2677*7c478bd9Sstevel@tonic-gate char *
2678*7c478bd9Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp)
2679*7c478bd9Sstevel@tonic-gate {
2680*7c478bd9Sstevel@tonic-gate 	char *s = pri->code_buf;
2681*7c478bd9Sstevel@tonic-gate 	int n = sizeof (*sp) / sizeof (int32_t);
2682*7c478bd9Sstevel@tonic-gate 	int32_t *lp = (int32_t *)sp;
2683*7c478bd9Sstevel@tonic-gate 
2684*7c478bd9Sstevel@tonic-gate 	while (--n >= 0) {
2685*7c478bd9Sstevel@tonic-gate 		int32_t val = *lp++;
2686*7c478bd9Sstevel@tonic-gate 
2687*7c478bd9Sstevel@tonic-gate 		if (val == 0)
2688*7c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0");
2689*7c478bd9Sstevel@tonic-gate 		else
2690*7c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0x%.8X", val);
2691*7c478bd9Sstevel@tonic-gate 	}
2692*7c478bd9Sstevel@tonic-gate 
2693*7c478bd9Sstevel@tonic-gate 	return (pri->code_buf);
2694*7c478bd9Sstevel@tonic-gate }
2695*7c478bd9Sstevel@tonic-gate 
2696*7c478bd9Sstevel@tonic-gate void
2697*7c478bd9Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name)
2698*7c478bd9Sstevel@tonic-gate {
2699*7c478bd9Sstevel@tonic-gate 	sigset_t sigset;
2700*7c478bd9Sstevel@tonic-gate 
2701*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2702*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) {
2703*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s =%s\n",
2704*7c478bd9Sstevel@tonic-gate 			pri->pname, name, sigset_string(pri, &sigset));
2705*7c478bd9Sstevel@tonic-gate 	}
2706*7c478bd9Sstevel@tonic-gate }
2707*7c478bd9Sstevel@tonic-gate 
2708*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2709*7c478bd9Sstevel@tonic-gate void
2710*7c478bd9Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name)
2711*7c478bd9Sstevel@tonic-gate {
2712*7c478bd9Sstevel@tonic-gate 	struct sigaltstack32 altstack;
2713*7c478bd9Sstevel@tonic-gate 
2714*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2715*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
2716*7c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
2717*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2718*7c478bd9Sstevel@tonic-gate 			pri->pname,
2719*7c478bd9Sstevel@tonic-gate 			name,
2720*7c478bd9Sstevel@tonic-gate 			altstack.ss_sp,
2721*7c478bd9Sstevel@tonic-gate 			altstack.ss_size,
2722*7c478bd9Sstevel@tonic-gate 			altstack.ss_flags);
2723*7c478bd9Sstevel@tonic-gate 	}
2724*7c478bd9Sstevel@tonic-gate }
2725*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2726*7c478bd9Sstevel@tonic-gate 
2727*7c478bd9Sstevel@tonic-gate void
2728*7c478bd9Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name)
2729*7c478bd9Sstevel@tonic-gate {
2730*7c478bd9Sstevel@tonic-gate 	struct sigaltstack altstack;
2731*7c478bd9Sstevel@tonic-gate 
2732*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2733*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
2734*7c478bd9Sstevel@tonic-gate 		show_sigaltstack32(pri, offset, name);
2735*7c478bd9Sstevel@tonic-gate 		return;
2736*7c478bd9Sstevel@tonic-gate 	}
2737*7c478bd9Sstevel@tonic-gate #endif
2738*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2739*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
2740*7c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
2741*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2742*7c478bd9Sstevel@tonic-gate 			pri->pname,
2743*7c478bd9Sstevel@tonic-gate 			name,
2744*7c478bd9Sstevel@tonic-gate 			(ulong_t)altstack.ss_sp,
2745*7c478bd9Sstevel@tonic-gate 			(ulong_t)altstack.ss_size,
2746*7c478bd9Sstevel@tonic-gate 			altstack.ss_flags);
2747*7c478bd9Sstevel@tonic-gate 	}
2748*7c478bd9Sstevel@tonic-gate }
2749*7c478bd9Sstevel@tonic-gate 
2750*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2751*7c478bd9Sstevel@tonic-gate void
2752*7c478bd9Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp)
2753*7c478bd9Sstevel@tonic-gate {
2754*7c478bd9Sstevel@tonic-gate 	struct sigaction32 sigaction;
2755*7c478bd9Sstevel@tonic-gate 
2756*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2757*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
2758*7c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
2759*7c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
2760*7c478bd9Sstevel@tonic-gate 		if (odisp != NULL)
2761*7c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (caddr32_t)odisp;
2762*7c478bd9Sstevel@tonic-gate 		(void) printf(
2763*7c478bd9Sstevel@tonic-gate 			"%s    %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2764*7c478bd9Sstevel@tonic-gate 			pri->pname,
2765*7c478bd9Sstevel@tonic-gate 			name,
2766*7c478bd9Sstevel@tonic-gate 			sigaction.sa_handler,
2767*7c478bd9Sstevel@tonic-gate 			sigset_string(pri, (sigset_t *)&sigaction.sa_mask),
2768*7c478bd9Sstevel@tonic-gate 			sigaction.sa_flags);
2769*7c478bd9Sstevel@tonic-gate 	}
2770*7c478bd9Sstevel@tonic-gate }
2771*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2772*7c478bd9Sstevel@tonic-gate 
2773*7c478bd9Sstevel@tonic-gate void
2774*7c478bd9Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp)
2775*7c478bd9Sstevel@tonic-gate {
2776*7c478bd9Sstevel@tonic-gate 	struct sigaction sigaction;
2777*7c478bd9Sstevel@tonic-gate 
2778*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2779*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
2780*7c478bd9Sstevel@tonic-gate 		show_sigaction32(pri, offset, name, odisp);
2781*7c478bd9Sstevel@tonic-gate 		return;
2782*7c478bd9Sstevel@tonic-gate 	}
2783*7c478bd9Sstevel@tonic-gate #endif
2784*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
2785*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
2786*7c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
2787*7c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
2788*7c478bd9Sstevel@tonic-gate 		if (odisp != NULL)
2789*7c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (void (*)())odisp;
2790*7c478bd9Sstevel@tonic-gate 		(void) printf(
2791*7c478bd9Sstevel@tonic-gate 			"%s    %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2792*7c478bd9Sstevel@tonic-gate 			pri->pname,
2793*7c478bd9Sstevel@tonic-gate 			name,
2794*7c478bd9Sstevel@tonic-gate 			(long)sigaction.sa_handler,
2795*7c478bd9Sstevel@tonic-gate 			sigset_string(pri, &sigaction.sa_mask),
2796*7c478bd9Sstevel@tonic-gate 			sigaction.sa_flags);
2797*7c478bd9Sstevel@tonic-gate 	}
2798*7c478bd9Sstevel@tonic-gate }
2799*7c478bd9Sstevel@tonic-gate 
2800*7c478bd9Sstevel@tonic-gate #ifdef _LP64
2801*7c478bd9Sstevel@tonic-gate void
2802*7c478bd9Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip)
2803*7c478bd9Sstevel@tonic-gate {
2804*7c478bd9Sstevel@tonic-gate 	const char *code = NULL;
2805*7c478bd9Sstevel@tonic-gate 
2806*7c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
2807*7c478bd9Sstevel@tonic-gate 		signame(pri, sip->si_signo));
2808*7c478bd9Sstevel@tonic-gate 
2809*7c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
2810*7c478bd9Sstevel@tonic-gate 		(void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid);
2811*7c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
2812*7c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
2813*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
2814*7c478bd9Sstevel@tonic-gate 		return;
2815*7c478bd9Sstevel@tonic-gate 	}
2816*7c478bd9Sstevel@tonic-gate 
2817*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
2818*7c478bd9Sstevel@tonic-gate 	default:
2819*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
2820*7c478bd9Sstevel@tonic-gate 		return;
2821*7c478bd9Sstevel@tonic-gate 	case SIGILL:
2822*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
2823*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
2824*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
2825*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
2826*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
2827*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
2828*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
2829*7c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
2830*7c478bd9Sstevel@tonic-gate 		break;
2831*7c478bd9Sstevel@tonic-gate 	}
2832*7c478bd9Sstevel@tonic-gate 
2833*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
2834*7c478bd9Sstevel@tonic-gate 	case SIGILL:
2835*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2836*7c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
2837*7c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
2838*7c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
2839*7c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
2840*7c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
2841*7c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
2842*7c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
2843*7c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
2844*7c478bd9Sstevel@tonic-gate 		}
2845*7c478bd9Sstevel@tonic-gate 		break;
2846*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
2847*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2848*7c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
2849*7c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
2850*7c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
2851*7c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
2852*7c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
2853*7c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
2854*7c478bd9Sstevel@tonic-gate 		}
2855*7c478bd9Sstevel@tonic-gate 		break;
2856*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
2857*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2858*7c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
2859*7c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
2860*7c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
2861*7c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
2862*7c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
2863*7c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
2864*7c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
2865*7c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
2866*7c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
2867*7c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
2868*7c478bd9Sstevel@tonic-gate #endif
2869*7c478bd9Sstevel@tonic-gate 		}
2870*7c478bd9Sstevel@tonic-gate 		break;
2871*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
2872*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2873*7c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
2874*7c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
2875*7c478bd9Sstevel@tonic-gate 		}
2876*7c478bd9Sstevel@tonic-gate 		break;
2877*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
2878*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2879*7c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
2880*7c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
2881*7c478bd9Sstevel@tonic-gate #endif
2882*7c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
2883*7c478bd9Sstevel@tonic-gate 		}
2884*7c478bd9Sstevel@tonic-gate 		break;
2885*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
2886*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2887*7c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
2888*7c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
2889*7c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
2890*7c478bd9Sstevel@tonic-gate 		}
2891*7c478bd9Sstevel@tonic-gate 		break;
2892*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
2893*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2894*7c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
2895*7c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
2896*7c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
2897*7c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
2898*7c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
2899*7c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
2900*7c478bd9Sstevel@tonic-gate 		}
2901*7c478bd9Sstevel@tonic-gate 		break;
2902*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
2903*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2904*7c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
2905*7c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
2906*7c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
2907*7c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
2908*7c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
2909*7c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
2910*7c478bd9Sstevel@tonic-gate 		}
2911*7c478bd9Sstevel@tonic-gate 		break;
2912*7c478bd9Sstevel@tonic-gate 	}
2913*7c478bd9Sstevel@tonic-gate 
2914*7c478bd9Sstevel@tonic-gate 	if (code == NULL) {
2915*7c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
2916*7c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
2917*7c478bd9Sstevel@tonic-gate 	}
2918*7c478bd9Sstevel@tonic-gate 
2919*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
2920*7c478bd9Sstevel@tonic-gate 	case SIGILL:
2921*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
2922*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
2923*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
2924*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
2925*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
2926*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8X",
2927*7c478bd9Sstevel@tonic-gate 			code,
2928*7c478bd9Sstevel@tonic-gate 			sip->si_addr);
2929*7c478bd9Sstevel@tonic-gate 		break;
2930*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
2931*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
2932*7c478bd9Sstevel@tonic-gate 			code,
2933*7c478bd9Sstevel@tonic-gate 			sip->si_pid,
2934*7c478bd9Sstevel@tonic-gate 			sip->si_status);
2935*7c478bd9Sstevel@tonic-gate 		break;
2936*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
2937*7c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
2938*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%d",
2939*7c478bd9Sstevel@tonic-gate 			code,
2940*7c478bd9Sstevel@tonic-gate 			sip->si_fd,
2941*7c478bd9Sstevel@tonic-gate 			sip->si_band);
2942*7c478bd9Sstevel@tonic-gate 		break;
2943*7c478bd9Sstevel@tonic-gate 	}
2944*7c478bd9Sstevel@tonic-gate 
2945*7c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
2946*7c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
2947*7c478bd9Sstevel@tonic-gate 
2948*7c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
2949*7c478bd9Sstevel@tonic-gate 		if (ename != NULL)
2950*7c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
2951*7c478bd9Sstevel@tonic-gate 	}
2952*7c478bd9Sstevel@tonic-gate 
2953*7c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
2954*7c478bd9Sstevel@tonic-gate }
2955*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
2956*7c478bd9Sstevel@tonic-gate 
2957*7c478bd9Sstevel@tonic-gate void
2958*7c478bd9Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip)
2959*7c478bd9Sstevel@tonic-gate {
2960*7c478bd9Sstevel@tonic-gate 	const char *code = NULL;
2961*7c478bd9Sstevel@tonic-gate 
2962*7c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
2963*7c478bd9Sstevel@tonic-gate 		signame(pri, sip->si_signo));
2964*7c478bd9Sstevel@tonic-gate 
2965*7c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
2966*7c478bd9Sstevel@tonic-gate 		(void) printf(" pid=%d uid=%d",
2967*7c478bd9Sstevel@tonic-gate 		    (int)sip->si_pid,
2968*7c478bd9Sstevel@tonic-gate 		    (int)sip->si_uid);
2969*7c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
2970*7c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
2971*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
2972*7c478bd9Sstevel@tonic-gate 		return;
2973*7c478bd9Sstevel@tonic-gate 	}
2974*7c478bd9Sstevel@tonic-gate 
2975*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
2976*7c478bd9Sstevel@tonic-gate 	default:
2977*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
2978*7c478bd9Sstevel@tonic-gate 		return;
2979*7c478bd9Sstevel@tonic-gate 	case SIGILL:
2980*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
2981*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
2982*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
2983*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
2984*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
2985*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
2986*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
2987*7c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
2988*7c478bd9Sstevel@tonic-gate 		break;
2989*7c478bd9Sstevel@tonic-gate 	}
2990*7c478bd9Sstevel@tonic-gate 
2991*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
2992*7c478bd9Sstevel@tonic-gate 	case SIGILL:
2993*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
2994*7c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
2995*7c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
2996*7c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
2997*7c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
2998*7c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
2999*7c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
3000*7c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
3001*7c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
3002*7c478bd9Sstevel@tonic-gate 		}
3003*7c478bd9Sstevel@tonic-gate 		break;
3004*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
3005*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3006*7c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
3007*7c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
3008*7c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
3009*7c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
3010*7c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
3011*7c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
3012*7c478bd9Sstevel@tonic-gate 		}
3013*7c478bd9Sstevel@tonic-gate 		break;
3014*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
3015*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3016*7c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
3017*7c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
3018*7c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
3019*7c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
3020*7c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
3021*7c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
3022*7c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
3023*7c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
3024*7c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
3025*7c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
3026*7c478bd9Sstevel@tonic-gate #endif
3027*7c478bd9Sstevel@tonic-gate 		}
3028*7c478bd9Sstevel@tonic-gate 		break;
3029*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
3030*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3031*7c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
3032*7c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
3033*7c478bd9Sstevel@tonic-gate 		}
3034*7c478bd9Sstevel@tonic-gate 		break;
3035*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
3036*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3037*7c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
3038*7c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
3039*7c478bd9Sstevel@tonic-gate #endif
3040*7c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
3041*7c478bd9Sstevel@tonic-gate 		}
3042*7c478bd9Sstevel@tonic-gate 		break;
3043*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
3044*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3045*7c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
3046*7c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
3047*7c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
3048*7c478bd9Sstevel@tonic-gate 		}
3049*7c478bd9Sstevel@tonic-gate 		break;
3050*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
3051*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3052*7c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
3053*7c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
3054*7c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
3055*7c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
3056*7c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
3057*7c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
3058*7c478bd9Sstevel@tonic-gate 		}
3059*7c478bd9Sstevel@tonic-gate 		break;
3060*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
3061*7c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
3062*7c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
3063*7c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
3064*7c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
3065*7c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
3066*7c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
3067*7c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
3068*7c478bd9Sstevel@tonic-gate 		}
3069*7c478bd9Sstevel@tonic-gate 		break;
3070*7c478bd9Sstevel@tonic-gate 	}
3071*7c478bd9Sstevel@tonic-gate 
3072*7c478bd9Sstevel@tonic-gate 	if (code == NULL) {
3073*7c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
3074*7c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
3075*7c478bd9Sstevel@tonic-gate 	}
3076*7c478bd9Sstevel@tonic-gate 
3077*7c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
3078*7c478bd9Sstevel@tonic-gate 	case SIGILL:
3079*7c478bd9Sstevel@tonic-gate 	case SIGTRAP:
3080*7c478bd9Sstevel@tonic-gate 	case SIGFPE:
3081*7c478bd9Sstevel@tonic-gate 	case SIGSEGV:
3082*7c478bd9Sstevel@tonic-gate 	case SIGBUS:
3083*7c478bd9Sstevel@tonic-gate 	case SIGEMT:
3084*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8lX",
3085*7c478bd9Sstevel@tonic-gate 			code,
3086*7c478bd9Sstevel@tonic-gate 			(long)sip->si_addr);
3087*7c478bd9Sstevel@tonic-gate 		break;
3088*7c478bd9Sstevel@tonic-gate 	case SIGCLD:
3089*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
3090*7c478bd9Sstevel@tonic-gate 			code,
3091*7c478bd9Sstevel@tonic-gate 			(int)sip->si_pid,
3092*7c478bd9Sstevel@tonic-gate 			sip->si_status);
3093*7c478bd9Sstevel@tonic-gate 		break;
3094*7c478bd9Sstevel@tonic-gate 	case SIGPOLL:
3095*7c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
3096*7c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%ld",
3097*7c478bd9Sstevel@tonic-gate 			code,
3098*7c478bd9Sstevel@tonic-gate 			sip->si_fd,
3099*7c478bd9Sstevel@tonic-gate 			sip->si_band);
3100*7c478bd9Sstevel@tonic-gate 		break;
3101*7c478bd9Sstevel@tonic-gate 	}
3102*7c478bd9Sstevel@tonic-gate 
3103*7c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
3104*7c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
3105*7c478bd9Sstevel@tonic-gate 
3106*7c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
3107*7c478bd9Sstevel@tonic-gate 		if (ename != NULL)
3108*7c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
3109*7c478bd9Sstevel@tonic-gate 	}
3110*7c478bd9Sstevel@tonic-gate 
3111*7c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
3112*7c478bd9Sstevel@tonic-gate }
3113*7c478bd9Sstevel@tonic-gate 
3114*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3115*7c478bd9Sstevel@tonic-gate void
3116*7c478bd9Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset)
3117*7c478bd9Sstevel@tonic-gate {
3118*7c478bd9Sstevel@tonic-gate 	struct siginfo32 siginfo;
3119*7c478bd9Sstevel@tonic-gate 
3120*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
3121*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
3122*7c478bd9Sstevel@tonic-gate 		print_siginfo32(pri, &siginfo);
3123*7c478bd9Sstevel@tonic-gate }
3124*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3125*7c478bd9Sstevel@tonic-gate 
3126*7c478bd9Sstevel@tonic-gate void
3127*7c478bd9Sstevel@tonic-gate show_siginfo(private_t *pri, long offset)
3128*7c478bd9Sstevel@tonic-gate {
3129*7c478bd9Sstevel@tonic-gate 	struct siginfo siginfo;
3130*7c478bd9Sstevel@tonic-gate 
3131*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3132*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
3133*7c478bd9Sstevel@tonic-gate 		show_siginfo32(pri, offset);
3134*7c478bd9Sstevel@tonic-gate 		return;
3135*7c478bd9Sstevel@tonic-gate 	}
3136*7c478bd9Sstevel@tonic-gate #endif
3137*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
3138*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
3139*7c478bd9Sstevel@tonic-gate 		print_siginfo(pri, &siginfo);
3140*7c478bd9Sstevel@tonic-gate }
3141*7c478bd9Sstevel@tonic-gate 
3142*7c478bd9Sstevel@tonic-gate void
3143*7c478bd9Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count)
3144*7c478bd9Sstevel@tonic-gate {
3145*7c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4);
3146*7c478bd9Sstevel@tonic-gate 
3147*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
3148*7c478bd9Sstevel@tonic-gate 	if (serial)
3149*7c478bd9Sstevel@tonic-gate 		Eserialize();
3150*7c478bd9Sstevel@tonic-gate 
3151*7c478bd9Sstevel@tonic-gate 	while (count > 0) {
3152*7c478bd9Sstevel@tonic-gate 		char buf[32];
3153*7c478bd9Sstevel@tonic-gate 		int nb = (count < 32)? count : 32;
3154*7c478bd9Sstevel@tonic-gate 		int i;
3155*7c478bd9Sstevel@tonic-gate 
3156*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buf, (size_t)nb, offset) != nb)
3157*7c478bd9Sstevel@tonic-gate 			break;
3158*7c478bd9Sstevel@tonic-gate 
3159*7c478bd9Sstevel@tonic-gate 		(void) printf("%s   ", pri->pname);
3160*7c478bd9Sstevel@tonic-gate 		for (i = 0; i < nb; i++)
3161*7c478bd9Sstevel@tonic-gate 			(void) printf(" %d", buf[i]);
3162*7c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
3163*7c478bd9Sstevel@tonic-gate 
3164*7c478bd9Sstevel@tonic-gate 		count -= nb;
3165*7c478bd9Sstevel@tonic-gate 		offset += nb;
3166*7c478bd9Sstevel@tonic-gate 	}
3167*7c478bd9Sstevel@tonic-gate 
3168*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
3169*7c478bd9Sstevel@tonic-gate 	if (serial)
3170*7c478bd9Sstevel@tonic-gate 		Xserialize();
3171*7c478bd9Sstevel@tonic-gate }
3172*7c478bd9Sstevel@tonic-gate 
3173*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3174*7c478bd9Sstevel@tonic-gate void
3175*7c478bd9Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count)
3176*7c478bd9Sstevel@tonic-gate {
3177*7c478bd9Sstevel@tonic-gate 	iovec32_t iovec[16];
3178*7c478bd9Sstevel@tonic-gate 	iovec32_t *ip;
3179*7c478bd9Sstevel@tonic-gate 	long nb;
3180*7c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
3181*7c478bd9Sstevel@tonic-gate 
3182*7c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
3183*7c478bd9Sstevel@tonic-gate 		niov = 16;
3184*7c478bd9Sstevel@tonic-gate 
3185*7c478bd9Sstevel@tonic-gate 	if (offset != NULL && niov > 0 &&
3186*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset)
3187*7c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec32_t)) {
3188*7c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
3189*7c478bd9Sstevel@tonic-gate 		if (serial)
3190*7c478bd9Sstevel@tonic-gate 			Eserialize();
3191*7c478bd9Sstevel@tonic-gate 
3192*7c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
3193*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8X  iov_len = %d\n",
3194*7c478bd9Sstevel@tonic-gate 				pri->pname,
3195*7c478bd9Sstevel@tonic-gate 				ip->iov_base,
3196*7c478bd9Sstevel@tonic-gate 				ip->iov_len);
3197*7c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
3198*7c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
3199*7c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
3200*7c478bd9Sstevel@tonic-gate 				if (nb > 0)
3201*7c478bd9Sstevel@tonic-gate 					count -= nb;
3202*7c478bd9Sstevel@tonic-gate 			}
3203*7c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
3204*7c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
3205*7c478bd9Sstevel@tonic-gate 		}
3206*7c478bd9Sstevel@tonic-gate 
3207*7c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
3208*7c478bd9Sstevel@tonic-gate 		if (serial)
3209*7c478bd9Sstevel@tonic-gate 			Xserialize();
3210*7c478bd9Sstevel@tonic-gate 	}
3211*7c478bd9Sstevel@tonic-gate }
3212*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3213*7c478bd9Sstevel@tonic-gate 
3214*7c478bd9Sstevel@tonic-gate void
3215*7c478bd9Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count)
3216*7c478bd9Sstevel@tonic-gate {
3217*7c478bd9Sstevel@tonic-gate 	iovec_t iovec[16];
3218*7c478bd9Sstevel@tonic-gate 	iovec_t *ip;
3219*7c478bd9Sstevel@tonic-gate 	long nb;
3220*7c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
3221*7c478bd9Sstevel@tonic-gate 
3222*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3223*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
3224*7c478bd9Sstevel@tonic-gate 		show_iovec32(pri, offset, niov, showbuf, count);
3225*7c478bd9Sstevel@tonic-gate 		return;
3226*7c478bd9Sstevel@tonic-gate 	}
3227*7c478bd9Sstevel@tonic-gate #endif
3228*7c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
3229*7c478bd9Sstevel@tonic-gate 		niov = 16;
3230*7c478bd9Sstevel@tonic-gate 
3231*7c478bd9Sstevel@tonic-gate 	if (offset != NULL && niov > 0 &&
3232*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset)
3233*7c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec_t)) {
3234*7c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
3235*7c478bd9Sstevel@tonic-gate 		if (serial)
3236*7c478bd9Sstevel@tonic-gate 			Eserialize();
3237*7c478bd9Sstevel@tonic-gate 
3238*7c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
3239*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8lX  iov_len = %lu\n",
3240*7c478bd9Sstevel@tonic-gate 				pri->pname,
3241*7c478bd9Sstevel@tonic-gate 				(long)ip->iov_base,
3242*7c478bd9Sstevel@tonic-gate 				ip->iov_len);
3243*7c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
3244*7c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
3245*7c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
3246*7c478bd9Sstevel@tonic-gate 				if (nb > 0)
3247*7c478bd9Sstevel@tonic-gate 					count -= nb;
3248*7c478bd9Sstevel@tonic-gate 			}
3249*7c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
3250*7c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
3251*7c478bd9Sstevel@tonic-gate 		}
3252*7c478bd9Sstevel@tonic-gate 
3253*7c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
3254*7c478bd9Sstevel@tonic-gate 		if (serial)
3255*7c478bd9Sstevel@tonic-gate 			Xserialize();
3256*7c478bd9Sstevel@tonic-gate 	}
3257*7c478bd9Sstevel@tonic-gate }
3258*7c478bd9Sstevel@tonic-gate 
3259*7c478bd9Sstevel@tonic-gate void
3260*7c478bd9Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count)
3261*7c478bd9Sstevel@tonic-gate {
3262*7c478bd9Sstevel@tonic-gate 	long buf[MYBUFSIZ / sizeof (long)];
3263*7c478bd9Sstevel@tonic-gate 	struct dirent32 *dp;
3264*7c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
3265*7c478bd9Sstevel@tonic-gate 
3266*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
3267*7c478bd9Sstevel@tonic-gate 		return;
3268*7c478bd9Sstevel@tonic-gate 
3269*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
3270*7c478bd9Sstevel@tonic-gate 	if (serial)
3271*7c478bd9Sstevel@tonic-gate 		Eserialize();
3272*7c478bd9Sstevel@tonic-gate 
3273*7c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
3274*7c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
3275*7c478bd9Sstevel@tonic-gate 
3276*7c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
3277*7c478bd9Sstevel@tonic-gate 			break;
3278*7c478bd9Sstevel@tonic-gate 
3279*7c478bd9Sstevel@tonic-gate 		dp = (struct dirent32 *)&buf[0];
3280*7c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
3281*7c478bd9Sstevel@tonic-gate 			break;
3282*7c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
3283*7c478bd9Sstevel@tonic-gate 			/* getdents() error? */
3284*7c478bd9Sstevel@tonic-gate 			(void) printf(
3285*7c478bd9Sstevel@tonic-gate 			"%s    ino=%-5u off=%-4d rlen=%-3d\n",
3286*7c478bd9Sstevel@tonic-gate 				pri->pname,
3287*7c478bd9Sstevel@tonic-gate 				dp->d_ino,
3288*7c478bd9Sstevel@tonic-gate 				dp->d_off,
3289*7c478bd9Sstevel@tonic-gate 				dp->d_reclen);
3290*7c478bd9Sstevel@tonic-gate 			break;
3291*7c478bd9Sstevel@tonic-gate 		}
3292*7c478bd9Sstevel@tonic-gate 
3293*7c478bd9Sstevel@tonic-gate 		while (!interrupt &&
3294*7c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
3295*7c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
3296*7c478bd9Sstevel@tonic-gate 			(void) printf(
3297*7c478bd9Sstevel@tonic-gate 			"%s    ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3298*7c478bd9Sstevel@tonic-gate 				pri->pname,
3299*7c478bd9Sstevel@tonic-gate 				dp->d_ino,
3300*7c478bd9Sstevel@tonic-gate 				dp->d_off,
3301*7c478bd9Sstevel@tonic-gate 				dp->d_reclen,
3302*7c478bd9Sstevel@tonic-gate 				dp->d_reclen - (int)(dp->d_name - (char *)dp),
3303*7c478bd9Sstevel@tonic-gate 				dp->d_name);
3304*7c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
3305*7c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
3306*7c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
3307*7c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
3308*7c478bd9Sstevel@tonic-gate 			dp = (struct dirent32 *)((char *)dp + dp->d_reclen);
3309*7c478bd9Sstevel@tonic-gate 		}
3310*7c478bd9Sstevel@tonic-gate 	}
3311*7c478bd9Sstevel@tonic-gate 
3312*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
3313*7c478bd9Sstevel@tonic-gate 	if (serial)
3314*7c478bd9Sstevel@tonic-gate 		Xserialize();
3315*7c478bd9Sstevel@tonic-gate }
3316*7c478bd9Sstevel@tonic-gate 
3317*7c478bd9Sstevel@tonic-gate void
3318*7c478bd9Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count)
3319*7c478bd9Sstevel@tonic-gate {
3320*7c478bd9Sstevel@tonic-gate 	long long buf[MYBUFSIZ / sizeof (long long)];
3321*7c478bd9Sstevel@tonic-gate 	struct dirent64 *dp;
3322*7c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
3323*7c478bd9Sstevel@tonic-gate 
3324*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
3325*7c478bd9Sstevel@tonic-gate 		return;
3326*7c478bd9Sstevel@tonic-gate 
3327*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
3328*7c478bd9Sstevel@tonic-gate 	if (serial)
3329*7c478bd9Sstevel@tonic-gate 		Eserialize();
3330*7c478bd9Sstevel@tonic-gate 
3331*7c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
3332*7c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
3333*7c478bd9Sstevel@tonic-gate 
3334*7c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
3335*7c478bd9Sstevel@tonic-gate 			break;
3336*7c478bd9Sstevel@tonic-gate 
3337*7c478bd9Sstevel@tonic-gate 		dp = (struct dirent64 *)&buf[0];
3338*7c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
3339*7c478bd9Sstevel@tonic-gate 			break;
3340*7c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
3341*7c478bd9Sstevel@tonic-gate 			/* getdents() error? */
3342*7c478bd9Sstevel@tonic-gate 			(void) printf(
3343*7c478bd9Sstevel@tonic-gate 			"%s    ino=%-5llu off=%-4lld rlen=%-3d\n",
3344*7c478bd9Sstevel@tonic-gate 				pri->pname,
3345*7c478bd9Sstevel@tonic-gate 				(long long)dp->d_ino,
3346*7c478bd9Sstevel@tonic-gate 				(long long)dp->d_off,
3347*7c478bd9Sstevel@tonic-gate 				dp->d_reclen);
3348*7c478bd9Sstevel@tonic-gate 			break;
3349*7c478bd9Sstevel@tonic-gate 		}
3350*7c478bd9Sstevel@tonic-gate 
3351*7c478bd9Sstevel@tonic-gate 		while (!interrupt &&
3352*7c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
3353*7c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
3354*7c478bd9Sstevel@tonic-gate 			(void) printf(
3355*7c478bd9Sstevel@tonic-gate 			"%s    ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3356*7c478bd9Sstevel@tonic-gate 				pri->pname,
3357*7c478bd9Sstevel@tonic-gate 				(long long)dp->d_ino,
3358*7c478bd9Sstevel@tonic-gate 				(long long)dp->d_off,
3359*7c478bd9Sstevel@tonic-gate 				dp->d_reclen,
3360*7c478bd9Sstevel@tonic-gate 				dp->d_reclen - (int)(dp->d_name - (char *)dp),
3361*7c478bd9Sstevel@tonic-gate 				dp->d_name);
3362*7c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
3363*7c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
3364*7c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
3365*7c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
3366*7c478bd9Sstevel@tonic-gate 			dp = (struct dirent64 *)((char *)dp + dp->d_reclen);
3367*7c478bd9Sstevel@tonic-gate 		}
3368*7c478bd9Sstevel@tonic-gate 	}
3369*7c478bd9Sstevel@tonic-gate 
3370*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
3371*7c478bd9Sstevel@tonic-gate 	if (serial)
3372*7c478bd9Sstevel@tonic-gate 		Xserialize();
3373*7c478bd9Sstevel@tonic-gate }
3374*7c478bd9Sstevel@tonic-gate 
3375*7c478bd9Sstevel@tonic-gate void
3376*7c478bd9Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset)
3377*7c478bd9Sstevel@tonic-gate {
3378*7c478bd9Sstevel@tonic-gate 	struct rlimit32 rlimit;
3379*7c478bd9Sstevel@tonic-gate 
3380*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
3381*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
3382*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
3383*7c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
3384*7c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
3385*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_INFINITY", stdout);
3386*7c478bd9Sstevel@tonic-gate 			break;
3387*7c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
3388*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_MAX", stdout);
3389*7c478bd9Sstevel@tonic-gate 			break;
3390*7c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
3391*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_CUR", stdout);
3392*7c478bd9Sstevel@tonic-gate 			break;
3393*7c478bd9Sstevel@tonic-gate 		default:
3394*7c478bd9Sstevel@tonic-gate 			(void) printf("cur = %lu", (long)rlimit.rlim_cur);
3395*7c478bd9Sstevel@tonic-gate 			break;
3396*7c478bd9Sstevel@tonic-gate 		}
3397*7c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
3398*7c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
3399*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_INFINITY\n", stdout);
3400*7c478bd9Sstevel@tonic-gate 			break;
3401*7c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
3402*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_MAX\n", stdout);
3403*7c478bd9Sstevel@tonic-gate 			break;
3404*7c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
3405*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_CUR\n", stdout);
3406*7c478bd9Sstevel@tonic-gate 			break;
3407*7c478bd9Sstevel@tonic-gate 		default:
3408*7c478bd9Sstevel@tonic-gate 			(void) printf("  max = %lu\n", (long)rlimit.rlim_max);
3409*7c478bd9Sstevel@tonic-gate 			break;
3410*7c478bd9Sstevel@tonic-gate 		}
3411*7c478bd9Sstevel@tonic-gate 	}
3412*7c478bd9Sstevel@tonic-gate }
3413*7c478bd9Sstevel@tonic-gate 
3414*7c478bd9Sstevel@tonic-gate void
3415*7c478bd9Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset)
3416*7c478bd9Sstevel@tonic-gate {
3417*7c478bd9Sstevel@tonic-gate 	struct rlimit64 rlimit;
3418*7c478bd9Sstevel@tonic-gate 
3419*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
3420*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
3421*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
3422*7c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
3423*7c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
3424*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_INFINITY", stdout);
3425*7c478bd9Sstevel@tonic-gate 			break;
3426*7c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
3427*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_MAX", stdout);
3428*7c478bd9Sstevel@tonic-gate 			break;
3429*7c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
3430*7c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_CUR", stdout);
3431*7c478bd9Sstevel@tonic-gate 			break;
3432*7c478bd9Sstevel@tonic-gate 		default:
3433*7c478bd9Sstevel@tonic-gate 			(void) printf("cur = %llu",
3434*7c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_cur);
3435*7c478bd9Sstevel@tonic-gate 			break;
3436*7c478bd9Sstevel@tonic-gate 		}
3437*7c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
3438*7c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
3439*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_INFINITY\n", stdout);
3440*7c478bd9Sstevel@tonic-gate 			break;
3441*7c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
3442*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_MAX\n", stdout);
3443*7c478bd9Sstevel@tonic-gate 			break;
3444*7c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
3445*7c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_CUR\n", stdout);
3446*7c478bd9Sstevel@tonic-gate 			break;
3447*7c478bd9Sstevel@tonic-gate 		default:
3448*7c478bd9Sstevel@tonic-gate 			(void) printf("  max = %llu\n",
3449*7c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_max);
3450*7c478bd9Sstevel@tonic-gate 			break;
3451*7c478bd9Sstevel@tonic-gate 		}
3452*7c478bd9Sstevel@tonic-gate 	}
3453*7c478bd9Sstevel@tonic-gate }
3454*7c478bd9Sstevel@tonic-gate 
3455*7c478bd9Sstevel@tonic-gate void
3456*7c478bd9Sstevel@tonic-gate show_nuname(private_t *pri, long offset)
3457*7c478bd9Sstevel@tonic-gate {
3458*7c478bd9Sstevel@tonic-gate 	struct utsname ubuf;
3459*7c478bd9Sstevel@tonic-gate 
3460*7c478bd9Sstevel@tonic-gate 	if (offset != NULL &&
3461*7c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
3462*7c478bd9Sstevel@tonic-gate 		(void) printf(
3463*7c478bd9Sstevel@tonic-gate 		"%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3464*7c478bd9Sstevel@tonic-gate 			pri->pname,
3465*7c478bd9Sstevel@tonic-gate 			ubuf.sysname,
3466*7c478bd9Sstevel@tonic-gate 			ubuf.nodename,
3467*7c478bd9Sstevel@tonic-gate 			ubuf.release,
3468*7c478bd9Sstevel@tonic-gate 			ubuf.version,
3469*7c478bd9Sstevel@tonic-gate 			ubuf.machine);
3470*7c478bd9Sstevel@tonic-gate 	}
3471*7c478bd9Sstevel@tonic-gate }
3472*7c478bd9Sstevel@tonic-gate 
3473*7c478bd9Sstevel@tonic-gate void
3474*7c478bd9Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2)
3475*7c478bd9Sstevel@tonic-gate {
3476*7c478bd9Sstevel@tonic-gate 	show_timeval(pri, off1, "   delta");
3477*7c478bd9Sstevel@tonic-gate 	show_timeval(pri, off2, "olddelta");
3478*7c478bd9Sstevel@tonic-gate }
3479*7c478bd9Sstevel@tonic-gate 
3480*7c478bd9Sstevel@tonic-gate void
3481*7c478bd9Sstevel@tonic-gate show_sockaddr(private_t *pri,
3482*7c478bd9Sstevel@tonic-gate 	const char *str, long addroff, long lenoff, long len)
3483*7c478bd9Sstevel@tonic-gate {
3484*7c478bd9Sstevel@tonic-gate 	/*
3485*7c478bd9Sstevel@tonic-gate 	 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
3486*7c478bd9Sstevel@tonic-gate 	 * also large enough to store a sockaddr_in or a sockaddr_in6.
3487*7c478bd9Sstevel@tonic-gate 	 */
3488*7c478bd9Sstevel@tonic-gate 	long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1)
3489*7c478bd9Sstevel@tonic-gate 		/ sizeof (long)];
3490*7c478bd9Sstevel@tonic-gate 	struct sockaddr *sa = (struct sockaddr *)buf;
3491*7c478bd9Sstevel@tonic-gate 	struct sockaddr_in *sin = (struct sockaddr_in *)buf;
3492*7c478bd9Sstevel@tonic-gate 	struct sockaddr_un *soun = (struct sockaddr_un *)buf;
3493*7c478bd9Sstevel@tonic-gate 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf;
3494*7c478bd9Sstevel@tonic-gate 	char addrbuf[INET6_ADDRSTRLEN];
3495*7c478bd9Sstevel@tonic-gate 
3496*7c478bd9Sstevel@tonic-gate 	if (lenoff != 0) {
3497*7c478bd9Sstevel@tonic-gate 		uint_t ilen;
3498*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen))
3499*7c478bd9Sstevel@tonic-gate 			return;
3500*7c478bd9Sstevel@tonic-gate 		len = ilen;
3501*7c478bd9Sstevel@tonic-gate 	}
3502*7c478bd9Sstevel@tonic-gate 
3503*7c478bd9Sstevel@tonic-gate 	if (len >= sizeof (buf))	/* protect against ridiculous length */
3504*7c478bd9Sstevel@tonic-gate 		len = sizeof (buf) - 1;
3505*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, buf, len, addroff) != len)
3506*7c478bd9Sstevel@tonic-gate 		return;
3507*7c478bd9Sstevel@tonic-gate 
3508*7c478bd9Sstevel@tonic-gate 	switch (sa->sa_family) {
3509*7c478bd9Sstevel@tonic-gate 	case AF_INET6:
3510*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_INET6  %s = %s  port = %u\n",
3511*7c478bd9Sstevel@tonic-gate 		    pri->pname, str,
3512*7c478bd9Sstevel@tonic-gate 		    inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf,
3513*7c478bd9Sstevel@tonic-gate 			sizeof (addrbuf)),
3514*7c478bd9Sstevel@tonic-gate 		    ntohs(sin6->sin6_port));
3515*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tscope id = %u  source id = 0x%x\n"
3516*7c478bd9Sstevel@tonic-gate 		    "%s\tflow class = 0x%02x  flow label = 0x%05x\n",
3517*7c478bd9Sstevel@tonic-gate 		    pri->pname, ntohl(sin6->sin6_scope_id),
3518*7c478bd9Sstevel@tonic-gate 		    ntohl(sin6->__sin6_src_id),
3519*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3520*7c478bd9Sstevel@tonic-gate 		    ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20),
3521*7c478bd9Sstevel@tonic-gate 		    ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL));
3522*7c478bd9Sstevel@tonic-gate 		break;
3523*7c478bd9Sstevel@tonic-gate 	case AF_INET:
3524*7c478bd9Sstevel@tonic-gate 	case AF_NCA:
3525*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_%s  %s = %s  port = %u\n",
3526*7c478bd9Sstevel@tonic-gate 		    pri->pname, sa->sa_family == AF_INET ? "INET" : "NCA",
3527*7c478bd9Sstevel@tonic-gate 		    str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf,
3528*7c478bd9Sstevel@tonic-gate 		    sizeof (addrbuf)), ntohs(sin->sin_port));
3529*7c478bd9Sstevel@tonic-gate 		break;
3530*7c478bd9Sstevel@tonic-gate 	case AF_UNIX:
3531*7c478bd9Sstevel@tonic-gate 		len -= sizeof (soun->sun_family);
3532*7c478bd9Sstevel@tonic-gate 		if (len >= 0) {
3533*7c478bd9Sstevel@tonic-gate 			/* Null terminate */
3534*7c478bd9Sstevel@tonic-gate 			soun->sun_path[len] = NULL;
3535*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tAF_UNIX  %s = %s\n", pri->pname,
3536*7c478bd9Sstevel@tonic-gate 				str, soun->sun_path);
3537*7c478bd9Sstevel@tonic-gate 		}
3538*7c478bd9Sstevel@tonic-gate 		break;
3539*7c478bd9Sstevel@tonic-gate 	}
3540*7c478bd9Sstevel@tonic-gate }
3541*7c478bd9Sstevel@tonic-gate 
3542*7c478bd9Sstevel@tonic-gate void
3543*7c478bd9Sstevel@tonic-gate show_msghdr(private_t *pri, long offset)
3544*7c478bd9Sstevel@tonic-gate {
3545*7c478bd9Sstevel@tonic-gate 	struct msghdr msg;
3546*7c478bd9Sstevel@tonic-gate 
3547*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
3548*7c478bd9Sstevel@tonic-gate 		return;
3549*7c478bd9Sstevel@tonic-gate 	if (msg.msg_name != NULL && msg.msg_namelen != 0)
3550*7c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
3551*7c478bd9Sstevel@tonic-gate 			(long)msg.msg_name, 0, (long)msg.msg_namelen);
3552*7c478bd9Sstevel@tonic-gate 	/* XXX add msg_iov printing */
3553*7c478bd9Sstevel@tonic-gate }
3554*7c478bd9Sstevel@tonic-gate 
3555*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3556*7c478bd9Sstevel@tonic-gate void
3557*7c478bd9Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset)
3558*7c478bd9Sstevel@tonic-gate {
3559*7c478bd9Sstevel@tonic-gate 	struct msghdr32 {
3560*7c478bd9Sstevel@tonic-gate 		caddr32_t	msg_name;
3561*7c478bd9Sstevel@tonic-gate 		int32_t		msg_namelen;
3562*7c478bd9Sstevel@tonic-gate 	} msg;
3563*7c478bd9Sstevel@tonic-gate 
3564*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
3565*7c478bd9Sstevel@tonic-gate 		return;
3566*7c478bd9Sstevel@tonic-gate 	if (msg.msg_name != NULL && msg.msg_namelen != 0)
3567*7c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
3568*7c478bd9Sstevel@tonic-gate 			(long)msg.msg_name, 0, (long)msg.msg_namelen);
3569*7c478bd9Sstevel@tonic-gate 	/* XXX add msg_iov printing */
3570*7c478bd9Sstevel@tonic-gate }
3571*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3572*7c478bd9Sstevel@tonic-gate 
3573*7c478bd9Sstevel@tonic-gate static void
3574*7c478bd9Sstevel@tonic-gate show_doorargs(private_t *pri, long offset)
3575*7c478bd9Sstevel@tonic-gate {
3576*7c478bd9Sstevel@tonic-gate 	door_arg_t args;
3577*7c478bd9Sstevel@tonic-gate 
3578*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
3579*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
3580*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3581*7c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_ptr,
3582*7c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_size);
3583*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
3584*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3585*7c478bd9Sstevel@tonic-gate 		    (ulong_t)args.desc_ptr,
3586*7c478bd9Sstevel@tonic-gate 		    args.desc_num);
3587*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%lX rsize=%lu\n",
3588*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3589*7c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rbuf,
3590*7c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rsize);
3591*7c478bd9Sstevel@tonic-gate 	}
3592*7c478bd9Sstevel@tonic-gate }
3593*7c478bd9Sstevel@tonic-gate 
3594*7c478bd9Sstevel@tonic-gate static void
3595*7c478bd9Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc)
3596*7c478bd9Sstevel@tonic-gate {
3597*7c478bd9Sstevel@tonic-gate 	int i = 0;
3598*7c478bd9Sstevel@tonic-gate 	const priv_set_t *s;
3599*7c478bd9Sstevel@tonic-gate 	priv_ptype_t sn;
3600*7c478bd9Sstevel@tonic-gate 	char *str;
3601*7c478bd9Sstevel@tonic-gate 
3602*7c478bd9Sstevel@tonic-gate 	while ((sn = priv_getsetbynum(i++)) != NULL) {
3603*7c478bd9Sstevel@tonic-gate 		s = ucred_getprivset(uc, sn);
3604*7c478bd9Sstevel@tonic-gate 
3605*7c478bd9Sstevel@tonic-gate 		if (s == NULL)
3606*7c478bd9Sstevel@tonic-gate 			continue;
3607*7c478bd9Sstevel@tonic-gate 
3608*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%c: %s\n",
3609*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3610*7c478bd9Sstevel@tonic-gate 		    *sn,
3611*7c478bd9Sstevel@tonic-gate 		    str = priv_set_to_str(s, ',', PRIV_STR_SHORT));
3612*7c478bd9Sstevel@tonic-gate 
3613*7c478bd9Sstevel@tonic-gate 		free(str);
3614*7c478bd9Sstevel@tonic-gate 	}
3615*7c478bd9Sstevel@tonic-gate }
3616*7c478bd9Sstevel@tonic-gate 
3617*7c478bd9Sstevel@tonic-gate static void
3618*7c478bd9Sstevel@tonic-gate show_ucred(private_t *pri, long offset)
3619*7c478bd9Sstevel@tonic-gate {
3620*7c478bd9Sstevel@tonic-gate 	ucred_t *uc = _ucred_alloc();
3621*7c478bd9Sstevel@tonic-gate 	size_t sz;
3622*7c478bd9Sstevel@tonic-gate 
3623*7c478bd9Sstevel@tonic-gate 	if (uc == NULL)
3624*7c478bd9Sstevel@tonic-gate 		return;
3625*7c478bd9Sstevel@tonic-gate 
3626*7c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, uc, uc->uc_size, offset);
3627*7c478bd9Sstevel@tonic-gate 
3628*7c478bd9Sstevel@tonic-gate 	/*
3629*7c478bd9Sstevel@tonic-gate 	 * A new uc_size is read, it could be smaller than the previously
3630*7c478bd9Sstevel@tonic-gate 	 * value.  We accept short reads that fill the whole header.
3631*7c478bd9Sstevel@tonic-gate 	 */
3632*7c478bd9Sstevel@tonic-gate 	if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) {
3633*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\teuid=%d egid=%d\n",
3634*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3635*7c478bd9Sstevel@tonic-gate 		    (int)ucred_geteuid(uc),
3636*7c478bd9Sstevel@tonic-gate 		    (int)ucred_getegid(uc));
3637*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\truid=%d rgid=%d\n",
3638*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3639*7c478bd9Sstevel@tonic-gate 		    (int)ucred_getruid(uc),
3640*7c478bd9Sstevel@tonic-gate 		    (int)ucred_getrgid(uc));
3641*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tpid=%d zoneid=%d\n",
3642*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3643*7c478bd9Sstevel@tonic-gate 		    (int)ucred_getpid(uc),
3644*7c478bd9Sstevel@tonic-gate 		    (int)ucred_getzoneid(uc));
3645*7c478bd9Sstevel@tonic-gate 		show_ucred_privsets(pri, uc);
3646*7c478bd9Sstevel@tonic-gate 	}
3647*7c478bd9Sstevel@tonic-gate 	ucred_free(uc);
3648*7c478bd9Sstevel@tonic-gate }
3649*7c478bd9Sstevel@tonic-gate 
3650*7c478bd9Sstevel@tonic-gate static void
3651*7c478bd9Sstevel@tonic-gate show_privset(private_t *pri, long offset, size_t size)
3652*7c478bd9Sstevel@tonic-gate {
3653*7c478bd9Sstevel@tonic-gate 	priv_set_t *tmp = priv_allocset();
3654*7c478bd9Sstevel@tonic-gate 	size_t sz;
3655*7c478bd9Sstevel@tonic-gate 
3656*7c478bd9Sstevel@tonic-gate 	if (tmp == NULL)
3657*7c478bd9Sstevel@tonic-gate 		return;
3658*7c478bd9Sstevel@tonic-gate 
3659*7c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, tmp, size, offset);
3660*7c478bd9Sstevel@tonic-gate 
3661*7c478bd9Sstevel@tonic-gate 	if (sz == size) {
3662*7c478bd9Sstevel@tonic-gate 		char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT);
3663*7c478bd9Sstevel@tonic-gate 		if (str != NULL) {
3664*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t%s\n", pri->pname, str);
3665*7c478bd9Sstevel@tonic-gate 			free(str);
3666*7c478bd9Sstevel@tonic-gate 		}
3667*7c478bd9Sstevel@tonic-gate 	}
3668*7c478bd9Sstevel@tonic-gate 	priv_freeset(tmp);
3669*7c478bd9Sstevel@tonic-gate }
3670*7c478bd9Sstevel@tonic-gate 
3671*7c478bd9Sstevel@tonic-gate static void
3672*7c478bd9Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset)
3673*7c478bd9Sstevel@tonic-gate {
3674*7c478bd9Sstevel@tonic-gate 	door_info_t info;
3675*7c478bd9Sstevel@tonic-gate 	door_attr_t attr;
3676*7c478bd9Sstevel@tonic-gate 
3677*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info))
3678*7c478bd9Sstevel@tonic-gate 		return;
3679*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
3680*7c478bd9Sstevel@tonic-gate 	    pri->pname,
3681*7c478bd9Sstevel@tonic-gate 	    (int)info.di_target,
3682*7c478bd9Sstevel@tonic-gate 	    info.di_proc,
3683*7c478bd9Sstevel@tonic-gate 	    info.di_data);
3684*7c478bd9Sstevel@tonic-gate 	attr = info.di_attributes;
3685*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr));
3686*7c478bd9Sstevel@tonic-gate 	(void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier);
3687*7c478bd9Sstevel@tonic-gate }
3688*7c478bd9Sstevel@tonic-gate 
3689*7c478bd9Sstevel@tonic-gate static void
3690*7c478bd9Sstevel@tonic-gate show_doorparam(private_t *pri, long offset)
3691*7c478bd9Sstevel@tonic-gate {
3692*7c478bd9Sstevel@tonic-gate 	ulong_t val;
3693*7c478bd9Sstevel@tonic-gate 
3694*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
3695*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%lu\n",
3696*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3697*7c478bd9Sstevel@tonic-gate 		    val);
3698*7c478bd9Sstevel@tonic-gate 	}
3699*7c478bd9Sstevel@tonic-gate }
3700*7c478bd9Sstevel@tonic-gate 
3701*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3702*7c478bd9Sstevel@tonic-gate 
3703*7c478bd9Sstevel@tonic-gate static void
3704*7c478bd9Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset)
3705*7c478bd9Sstevel@tonic-gate {
3706*7c478bd9Sstevel@tonic-gate 	struct door_arg32 args;
3707*7c478bd9Sstevel@tonic-gate 
3708*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
3709*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=%X data_size=%u\n",
3710*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3711*7c478bd9Sstevel@tonic-gate 		    args.data_ptr,
3712*7c478bd9Sstevel@tonic-gate 		    args.data_size);
3713*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
3714*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3715*7c478bd9Sstevel@tonic-gate 		    args.desc_ptr,
3716*7c478bd9Sstevel@tonic-gate 		    args.desc_num);
3717*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%X rsize=%u\n",
3718*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3719*7c478bd9Sstevel@tonic-gate 		    args.rbuf,
3720*7c478bd9Sstevel@tonic-gate 		    args.rsize);
3721*7c478bd9Sstevel@tonic-gate 	}
3722*7c478bd9Sstevel@tonic-gate }
3723*7c478bd9Sstevel@tonic-gate 
3724*7c478bd9Sstevel@tonic-gate static void
3725*7c478bd9Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset)
3726*7c478bd9Sstevel@tonic-gate {
3727*7c478bd9Sstevel@tonic-gate 	uint_t val;
3728*7c478bd9Sstevel@tonic-gate 
3729*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
3730*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%u\n",
3731*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3732*7c478bd9Sstevel@tonic-gate 		    val);
3733*7c478bd9Sstevel@tonic-gate 	}
3734*7c478bd9Sstevel@tonic-gate }
3735*7c478bd9Sstevel@tonic-gate 
3736*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3737*7c478bd9Sstevel@tonic-gate 
3738*7c478bd9Sstevel@tonic-gate static void
3739*7c478bd9Sstevel@tonic-gate show_doors(private_t *pri)
3740*7c478bd9Sstevel@tonic-gate {
3741*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[5]) {
3742*7c478bd9Sstevel@tonic-gate 	case DOOR_CALL:
3743*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3744*7c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
3745*7c478bd9Sstevel@tonic-gate 			show_doorargs(pri, (long)pri->sys_args[1]);
3746*7c478bd9Sstevel@tonic-gate 		else
3747*7c478bd9Sstevel@tonic-gate 			show_doorargs32(pri, (long)pri->sys_args[1]);
3748*7c478bd9Sstevel@tonic-gate #else
3749*7c478bd9Sstevel@tonic-gate 		show_doorargs(pri, (long)pri->sys_args[1]);
3750*7c478bd9Sstevel@tonic-gate #endif
3751*7c478bd9Sstevel@tonic-gate 		break;
3752*7c478bd9Sstevel@tonic-gate 	case DOOR_UCRED:
3753*7c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
3754*7c478bd9Sstevel@tonic-gate 			show_ucred(pri, (long)pri->sys_args[0]);
3755*7c478bd9Sstevel@tonic-gate 		break;
3756*7c478bd9Sstevel@tonic-gate 	case DOOR_INFO:
3757*7c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
3758*7c478bd9Sstevel@tonic-gate 			show_doorinfo(pri, (long)pri->sys_args[1]);
3759*7c478bd9Sstevel@tonic-gate 		break;
3760*7c478bd9Sstevel@tonic-gate 	case DOOR_GETPARAM:
3761*7c478bd9Sstevel@tonic-gate 		if (!pri->Errno) {
3762*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3763*7c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
3764*7c478bd9Sstevel@tonic-gate 				show_doorparam(pri, (long)pri->sys_args[2]);
3765*7c478bd9Sstevel@tonic-gate 			else
3766*7c478bd9Sstevel@tonic-gate 				show_doorparam32(pri, (long)pri->sys_args[2]);
3767*7c478bd9Sstevel@tonic-gate #else
3768*7c478bd9Sstevel@tonic-gate 			show_doorparam(pri, (long)pri->sys_args[2]);
3769*7c478bd9Sstevel@tonic-gate #endif
3770*7c478bd9Sstevel@tonic-gate 		}
3771*7c478bd9Sstevel@tonic-gate 		break;
3772*7c478bd9Sstevel@tonic-gate 	}
3773*7c478bd9Sstevel@tonic-gate }
3774*7c478bd9Sstevel@tonic-gate 
3775*7c478bd9Sstevel@tonic-gate static void
3776*7c478bd9Sstevel@tonic-gate show_portargs(private_t *pri, long offset)
3777*7c478bd9Sstevel@tonic-gate {
3778*7c478bd9Sstevel@tonic-gate 	port_event_t args;
3779*7c478bd9Sstevel@tonic-gate 
3780*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
3781*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
3782*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3783*7c478bd9Sstevel@tonic-gate 		    args.portev_events,
3784*7c478bd9Sstevel@tonic-gate 		    args.portev_source);
3785*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%p user=0x%p\n",
3786*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3787*7c478bd9Sstevel@tonic-gate 		    (void *)args.portev_object,
3788*7c478bd9Sstevel@tonic-gate 		    (void *)args.portev_user);
3789*7c478bd9Sstevel@tonic-gate 	}
3790*7c478bd9Sstevel@tonic-gate }
3791*7c478bd9Sstevel@tonic-gate 
3792*7c478bd9Sstevel@tonic-gate 
3793*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3794*7c478bd9Sstevel@tonic-gate 
3795*7c478bd9Sstevel@tonic-gate static void
3796*7c478bd9Sstevel@tonic-gate show_portargs32(private_t *pri, long offset)
3797*7c478bd9Sstevel@tonic-gate {
3798*7c478bd9Sstevel@tonic-gate 	port_event32_t args;
3799*7c478bd9Sstevel@tonic-gate 
3800*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
3801*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
3802*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3803*7c478bd9Sstevel@tonic-gate 		    args.portev_events,
3804*7c478bd9Sstevel@tonic-gate 		    args.portev_source);
3805*7c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%x user=0x%x\n",
3806*7c478bd9Sstevel@tonic-gate 		    pri->pname,
3807*7c478bd9Sstevel@tonic-gate 		    args.portev_object,
3808*7c478bd9Sstevel@tonic-gate 		    args.portev_user);
3809*7c478bd9Sstevel@tonic-gate 	}
3810*7c478bd9Sstevel@tonic-gate }
3811*7c478bd9Sstevel@tonic-gate 
3812*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
3813*7c478bd9Sstevel@tonic-gate 
3814*7c478bd9Sstevel@tonic-gate static void
3815*7c478bd9Sstevel@tonic-gate show_ports(private_t *pri)
3816*7c478bd9Sstevel@tonic-gate {
3817*7c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
3818*7c478bd9Sstevel@tonic-gate 	case PORT_GET:
3819*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3820*7c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
3821*7c478bd9Sstevel@tonic-gate 			show_portargs(pri, (long)pri->sys_args[2]);
3822*7c478bd9Sstevel@tonic-gate 		else
3823*7c478bd9Sstevel@tonic-gate 			show_portargs32(pri, (long)pri->sys_args[2]);
3824*7c478bd9Sstevel@tonic-gate #else
3825*7c478bd9Sstevel@tonic-gate 		show_portargs(pri, (long)pri->sys_args[2]);
3826*7c478bd9Sstevel@tonic-gate #endif
3827*7c478bd9Sstevel@tonic-gate 		break;
3828*7c478bd9Sstevel@tonic-gate 	}
3829*7c478bd9Sstevel@tonic-gate }
3830*7c478bd9Sstevel@tonic-gate 
3831*7c478bd9Sstevel@tonic-gate #define	MAX_SNDFL_PRD 16
3832*7c478bd9Sstevel@tonic-gate 
3833*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3834*7c478bd9Sstevel@tonic-gate 
3835*7c478bd9Sstevel@tonic-gate static void
3836*7c478bd9Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd,
3837*7c478bd9Sstevel@tonic-gate     ksendfilevec32_t *sndvec, int sfvcnt)
3838*7c478bd9Sstevel@tonic-gate {
3839*7c478bd9Sstevel@tonic-gate 	ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD];
3840*7c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
3841*7c478bd9Sstevel@tonic-gate 
3842*7c478bd9Sstevel@tonic-gate 	Eserialize();
3843*7c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
3844*7c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
3845*7c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
3846*7c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
3847*7c478bd9Sstevel@tonic-gate 
3848*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
3849*7c478bd9Sstevel@tonic-gate 			break;
3850*7c478bd9Sstevel@tonic-gate 
3851*7c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
3852*7c478bd9Sstevel@tonic-gate 
3853*7c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
3854*7c478bd9Sstevel@tonic-gate 			(void) printf(
3855*7c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
3856*7c478bd9Sstevel@tonic-gate 			    "sfv_off=%d\tsfv_len=%u\n",
3857*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
3858*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
3859*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
3860*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
3861*7c478bd9Sstevel@tonic-gate 
3862*7c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
3863*7c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
3864*7c478bd9Sstevel@tonic-gate 				showbuffer(pri,
3865*7c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
3866*7c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
3867*7c478bd9Sstevel@tonic-gate 			}
3868*7c478bd9Sstevel@tonic-gate 
3869*7c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
3870*7c478bd9Sstevel@tonic-gate 			snd_ptr++;
3871*7c478bd9Sstevel@tonic-gate 		}
3872*7c478bd9Sstevel@tonic-gate 
3873*7c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
3874*7c478bd9Sstevel@tonic-gate 	}
3875*7c478bd9Sstevel@tonic-gate 	Xserialize();
3876*7c478bd9Sstevel@tonic-gate }
3877*7c478bd9Sstevel@tonic-gate 
3878*7c478bd9Sstevel@tonic-gate static void
3879*7c478bd9Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd,
3880*7c478bd9Sstevel@tonic-gate     ksendfilevec64_t *sndvec, int sfvcnt)
3881*7c478bd9Sstevel@tonic-gate {
3882*7c478bd9Sstevel@tonic-gate 	ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
3883*7c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
3884*7c478bd9Sstevel@tonic-gate 
3885*7c478bd9Sstevel@tonic-gate 	Eserialize();
3886*7c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
3887*7c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
3888*7c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
3889*7c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
3890*7c478bd9Sstevel@tonic-gate 
3891*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
3892*7c478bd9Sstevel@tonic-gate 			break;
3893*7c478bd9Sstevel@tonic-gate 
3894*7c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
3895*7c478bd9Sstevel@tonic-gate 
3896*7c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
3897*7c478bd9Sstevel@tonic-gate 			(void) printf(
3898*7c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
3899*7c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%u\n",
3900*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
3901*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
3902*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
3903*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
3904*7c478bd9Sstevel@tonic-gate 
3905*7c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
3906*7c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
3907*7c478bd9Sstevel@tonic-gate 				showbuffer(pri,
3908*7c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
3909*7c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
3910*7c478bd9Sstevel@tonic-gate 			}
3911*7c478bd9Sstevel@tonic-gate 
3912*7c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
3913*7c478bd9Sstevel@tonic-gate 			snd_ptr++;
3914*7c478bd9Sstevel@tonic-gate 		}
3915*7c478bd9Sstevel@tonic-gate 
3916*7c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
3917*7c478bd9Sstevel@tonic-gate 	}
3918*7c478bd9Sstevel@tonic-gate 	Xserialize();
3919*7c478bd9Sstevel@tonic-gate }
3920*7c478bd9Sstevel@tonic-gate 
3921*7c478bd9Sstevel@tonic-gate #endif /* _LP64 */
3922*7c478bd9Sstevel@tonic-gate 
3923*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
3924*7c478bd9Sstevel@tonic-gate static void
3925*7c478bd9Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt)
3926*7c478bd9Sstevel@tonic-gate {
3927*7c478bd9Sstevel@tonic-gate 	sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD];
3928*7c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
3929*7c478bd9Sstevel@tonic-gate 
3930*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3931*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
3932*7c478bd9Sstevel@tonic-gate 		show_ksendfilevec32(pri, fd,
3933*7c478bd9Sstevel@tonic-gate 		    (ksendfilevec32_t *)sndvec, sfvcnt);
3934*7c478bd9Sstevel@tonic-gate 		return;
3935*7c478bd9Sstevel@tonic-gate 	}
3936*7c478bd9Sstevel@tonic-gate #endif
3937*7c478bd9Sstevel@tonic-gate 	Eserialize();
3938*7c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
3939*7c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
3940*7c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
3941*7c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
3942*7c478bd9Sstevel@tonic-gate 
3943*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
3944*7c478bd9Sstevel@tonic-gate 			break;
3945*7c478bd9Sstevel@tonic-gate 
3946*7c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
3947*7c478bd9Sstevel@tonic-gate 
3948*7c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
3949*7c478bd9Sstevel@tonic-gate 			(void) printf(
3950*7c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
3951*7c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
3952*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
3953*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
3954*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
3955*7c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
3956*7c478bd9Sstevel@tonic-gate 
3957*7c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
3958*7c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
3959*7c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
3960*7c478bd9Sstevel@tonic-gate 					    (long)snd_ptr->sfv_len);
3961*7c478bd9Sstevel@tonic-gate 			}
3962*7c478bd9Sstevel@tonic-gate 
3963*7c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
3964*7c478bd9Sstevel@tonic-gate 			snd_ptr++;
3965*7c478bd9Sstevel@tonic-gate 		}
3966*7c478bd9Sstevel@tonic-gate 
3967*7c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
3968*7c478bd9Sstevel@tonic-gate 	}
3969*7c478bd9Sstevel@tonic-gate 	Xserialize();
3970*7c478bd9Sstevel@tonic-gate }
3971*7c478bd9Sstevel@tonic-gate 
3972*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
3973*7c478bd9Sstevel@tonic-gate static void
3974*7c478bd9Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt)
3975*7c478bd9Sstevel@tonic-gate {
3976*7c478bd9Sstevel@tonic-gate 	sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
3977*7c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
3978*7c478bd9Sstevel@tonic-gate 
3979*7c478bd9Sstevel@tonic-gate #ifdef _LP64
3980*7c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
3981*7c478bd9Sstevel@tonic-gate 		show_ksendfilevec64(pri, fd,
3982*7c478bd9Sstevel@tonic-gate 		    (ksendfilevec64_t *)sndvec, sfvcnt);
3983*7c478bd9Sstevel@tonic-gate 		return;
3984*7c478bd9Sstevel@tonic-gate 	}
3985*7c478bd9Sstevel@tonic-gate #endif
3986*7c478bd9Sstevel@tonic-gate 
3987*7c478bd9Sstevel@tonic-gate 	Eserialize();
3988*7c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
3989*7c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
3990*7c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
3991*7c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
3992*7c478bd9Sstevel@tonic-gate 
3993*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
3994*7c478bd9Sstevel@tonic-gate 			break;
3995*7c478bd9Sstevel@tonic-gate 
3996*7c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
3997*7c478bd9Sstevel@tonic-gate 
3998*7c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
3999*7c478bd9Sstevel@tonic-gate 			(void) printf(
4000*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4001*7c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
4002*7c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
4003*7c478bd9Sstevel@tonic-gate #else
4004*7c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
4005*7c478bd9Sstevel@tonic-gate 			    "sfv_off=%lld\tsfv_len=%lu\n",
4006*7c478bd9Sstevel@tonic-gate #endif
4007*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
4008*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
4009*7c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
4010*7c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
4011*7c478bd9Sstevel@tonic-gate 
4012*7c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
4013*7c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
4014*7c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
4015*7c478bd9Sstevel@tonic-gate 					    (long)snd_ptr->sfv_len);
4016*7c478bd9Sstevel@tonic-gate 			}
4017*7c478bd9Sstevel@tonic-gate 
4018*7c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
4019*7c478bd9Sstevel@tonic-gate 			snd_ptr++;
4020*7c478bd9Sstevel@tonic-gate 		}
4021*7c478bd9Sstevel@tonic-gate 
4022*7c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
4023*7c478bd9Sstevel@tonic-gate 	}
4024*7c478bd9Sstevel@tonic-gate 	Xserialize();
4025*7c478bd9Sstevel@tonic-gate }
4026*7c478bd9Sstevel@tonic-gate 
4027*7c478bd9Sstevel@tonic-gate static void
4028*7c478bd9Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset)
4029*7c478bd9Sstevel@tonic-gate {
4030*7c478bd9Sstevel@tonic-gate 	struct memcntl_mha mha;
4031*7c478bd9Sstevel@tonic-gate 	const char *s = NULL;
4032*7c478bd9Sstevel@tonic-gate 
4033*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) {
4034*7c478bd9Sstevel@tonic-gate 		switch (mha.mha_cmd) {
4035*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
4036*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
4037*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
4038*7c478bd9Sstevel@tonic-gate 		}
4039*7c478bd9Sstevel@tonic-gate 		if (s)
4040*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4041*7c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
4042*7c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha.mha_flags,
4043*7c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
4044*7c478bd9Sstevel@tonic-gate 		else
4045*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4046*7c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
4047*7c478bd9Sstevel@tonic-gate 			    pri->pname, mha.mha_cmd, mha.mha_flags,
4048*7c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
4049*7c478bd9Sstevel@tonic-gate 	}
4050*7c478bd9Sstevel@tonic-gate }
4051*7c478bd9Sstevel@tonic-gate 
4052*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4053*7c478bd9Sstevel@tonic-gate 
4054*7c478bd9Sstevel@tonic-gate static void
4055*7c478bd9Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset)
4056*7c478bd9Sstevel@tonic-gate {
4057*7c478bd9Sstevel@tonic-gate 	struct memcntl_mha32 mha32;
4058*7c478bd9Sstevel@tonic-gate 	const char *s = NULL;
4059*7c478bd9Sstevel@tonic-gate 
4060*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha32, sizeof (mha32), offset) ==
4061*7c478bd9Sstevel@tonic-gate 	    sizeof (mha32)) {
4062*7c478bd9Sstevel@tonic-gate 		switch (mha32.mha_cmd) {
4063*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
4064*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
4065*7c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
4066*7c478bd9Sstevel@tonic-gate 		}
4067*7c478bd9Sstevel@tonic-gate 		if (s)
4068*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4069*7c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
4070*7c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha32.mha_flags, mha32.mha_pagesize);
4071*7c478bd9Sstevel@tonic-gate 		else
4072*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4073*7c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
4074*7c478bd9Sstevel@tonic-gate 			    pri->pname, mha32.mha_cmd, mha32.mha_flags,
4075*7c478bd9Sstevel@tonic-gate 			    mha32.mha_pagesize);
4076*7c478bd9Sstevel@tonic-gate 	}
4077*7c478bd9Sstevel@tonic-gate }
4078*7c478bd9Sstevel@tonic-gate 
4079*7c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
4080*7c478bd9Sstevel@tonic-gate 
4081*7c478bd9Sstevel@tonic-gate static void
4082*7c478bd9Sstevel@tonic-gate show_memcntl(private_t *pri)
4083*7c478bd9Sstevel@tonic-gate {
4084*7c478bd9Sstevel@tonic-gate 
4085*7c478bd9Sstevel@tonic-gate 	if ((int)pri->sys_args[2] != MC_HAT_ADVISE)
4086*7c478bd9Sstevel@tonic-gate 		return;
4087*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4088*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_LP64)
4089*7c478bd9Sstevel@tonic-gate 		show_memcntl_mha(pri, (long)pri->sys_args[3]);
4090*7c478bd9Sstevel@tonic-gate 	else
4091*7c478bd9Sstevel@tonic-gate 		show_memcntl_mha32(pri, (long)pri->sys_args[3]);
4092*7c478bd9Sstevel@tonic-gate #else
4093*7c478bd9Sstevel@tonic-gate 	show_memcntl_mha(pri, (long)pri->sys_args[3]);
4094*7c478bd9Sstevel@tonic-gate #endif
4095*7c478bd9Sstevel@tonic-gate }
4096*7c478bd9Sstevel@tonic-gate 
4097*7c478bd9Sstevel@tonic-gate void
4098*7c478bd9Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count)
4099*7c478bd9Sstevel@tonic-gate {
4100*7c478bd9Sstevel@tonic-gate 	id_t buf[MYBUFSIZ / sizeof (id_t)];
4101*7c478bd9Sstevel@tonic-gate 	id_t *idp;
4102*7c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 48);
4103*7c478bd9Sstevel@tonic-gate 
4104*7c478bd9Sstevel@tonic-gate 	if (offset == NULL)
4105*7c478bd9Sstevel@tonic-gate 		return;
4106*7c478bd9Sstevel@tonic-gate 
4107*7c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
4108*7c478bd9Sstevel@tonic-gate 	if (serial)
4109*7c478bd9Sstevel@tonic-gate 		Eserialize();
4110*7c478bd9Sstevel@tonic-gate 
4111*7c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
4112*7c478bd9Sstevel@tonic-gate 		ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)?
4113*7c478bd9Sstevel@tonic-gate 			count * sizeof (id_t) : MYBUFSIZ;
4114*7c478bd9Sstevel@tonic-gate 
4115*7c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 ||
4116*7c478bd9Sstevel@tonic-gate 		    nb < sizeof (id_t))
4117*7c478bd9Sstevel@tonic-gate 			break;
4118*7c478bd9Sstevel@tonic-gate 
4119*7c478bd9Sstevel@tonic-gate 		idp = buf;
4120*7c478bd9Sstevel@tonic-gate 		while (!interrupt && nb >= sizeof (id_t)) {
4121*7c478bd9Sstevel@tonic-gate 			(void) printf("%s\t%8d\n", pri->pname, (int)*idp);
4122*7c478bd9Sstevel@tonic-gate 			offset += sizeof (id_t);
4123*7c478bd9Sstevel@tonic-gate 			nb -= sizeof (id_t);
4124*7c478bd9Sstevel@tonic-gate 			idp++;
4125*7c478bd9Sstevel@tonic-gate 			count--;
4126*7c478bd9Sstevel@tonic-gate 		}
4127*7c478bd9Sstevel@tonic-gate 	}
4128*7c478bd9Sstevel@tonic-gate 
4129*7c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
4130*7c478bd9Sstevel@tonic-gate 	if (serial)
4131*7c478bd9Sstevel@tonic-gate 		Xserialize();
4132*7c478bd9Sstevel@tonic-gate }
4133*7c478bd9Sstevel@tonic-gate 
4134*7c478bd9Sstevel@tonic-gate void
4135*7c478bd9Sstevel@tonic-gate show_ntp_gettime(private_t *pri)
4136*7c478bd9Sstevel@tonic-gate {
4137*7c478bd9Sstevel@tonic-gate 	struct ntptimeval ntv;
4138*7c478bd9Sstevel@tonic-gate 	long offset;
4139*7c478bd9Sstevel@tonic-gate 
4140*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
4141*7c478bd9Sstevel@tonic-gate 		return;
4142*7c478bd9Sstevel@tonic-gate 
4143*7c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
4144*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv, sizeof (ntv), offset)
4145*7c478bd9Sstevel@tonic-gate 		    != sizeof (ntv))
4146*7c478bd9Sstevel@tonic-gate 			return;
4147*7c478bd9Sstevel@tonic-gate 	} else {
4148*7c478bd9Sstevel@tonic-gate 		struct ntptimeval32 ntv32;
4149*7c478bd9Sstevel@tonic-gate 
4150*7c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv32, sizeof (ntv32), offset)
4151*7c478bd9Sstevel@tonic-gate 		    != sizeof (ntv32))
4152*7c478bd9Sstevel@tonic-gate 			return;
4153*7c478bd9Sstevel@tonic-gate 
4154*7c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time);
4155*7c478bd9Sstevel@tonic-gate 		ntv.maxerror = ntv32.maxerror;
4156*7c478bd9Sstevel@tonic-gate 		ntv.esterror = ntv32.esterror;
4157*7c478bd9Sstevel@tonic-gate 	}
4158*7c478bd9Sstevel@tonic-gate 
4159*7c478bd9Sstevel@tonic-gate 	(void) printf("\ttime:     %ld.%6.6ld sec\n",
4160*7c478bd9Sstevel@tonic-gate 	    ntv.time.tv_sec, ntv.time.tv_usec);
4161*7c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror: %11d usec\n", ntv.maxerror);
4162*7c478bd9Sstevel@tonic-gate 	(void) printf("\testerror: %11d usec\n", ntv.esterror);
4163*7c478bd9Sstevel@tonic-gate }
4164*7c478bd9Sstevel@tonic-gate 
4165*7c478bd9Sstevel@tonic-gate static char *
4166*7c478bd9Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val)
4167*7c478bd9Sstevel@tonic-gate {
4168*7c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
4169*7c478bd9Sstevel@tonic-gate 	size_t used = 0;
4170*7c478bd9Sstevel@tonic-gate 
4171*7c478bd9Sstevel@tonic-gate 	*str = '\0';
4172*7c478bd9Sstevel@tonic-gate 	if (val & MOD_OFFSET)
4173*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf));
4174*7c478bd9Sstevel@tonic-gate 	if (val & MOD_FREQUENCY)
4175*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf));
4176*7c478bd9Sstevel@tonic-gate 	if (val & MOD_MAXERROR)
4177*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf));
4178*7c478bd9Sstevel@tonic-gate 	if (val & MOD_ESTERROR)
4179*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf));
4180*7c478bd9Sstevel@tonic-gate 	if (val & MOD_STATUS)
4181*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf));
4182*7c478bd9Sstevel@tonic-gate 	if (val & MOD_TIMECONST)
4183*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf));
4184*7c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKB)
4185*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf));
4186*7c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKA)
4187*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf));
4188*7c478bd9Sstevel@tonic-gate 
4189*7c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
4190*7c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
4191*7c478bd9Sstevel@tonic-gate 
4192*7c478bd9Sstevel@tonic-gate 	return (str + 1);
4193*7c478bd9Sstevel@tonic-gate }
4194*7c478bd9Sstevel@tonic-gate 
4195*7c478bd9Sstevel@tonic-gate static char *
4196*7c478bd9Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val)
4197*7c478bd9Sstevel@tonic-gate {
4198*7c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
4199*7c478bd9Sstevel@tonic-gate 	size_t used = 0;
4200*7c478bd9Sstevel@tonic-gate 
4201*7c478bd9Sstevel@tonic-gate 	*str = '\0';
4202*7c478bd9Sstevel@tonic-gate 	if (val & STA_PLL)
4203*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf));
4204*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSFREQ)
4205*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf));
4206*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSTIME)
4207*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf));
4208*7c478bd9Sstevel@tonic-gate 	if (val & STA_FLL)
4209*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf));
4210*7c478bd9Sstevel@tonic-gate 
4211*7c478bd9Sstevel@tonic-gate 	if (val & STA_INS)
4212*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_INS", sizeof (pri->code_buf));
4213*7c478bd9Sstevel@tonic-gate 	if (val & STA_DEL)
4214*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf));
4215*7c478bd9Sstevel@tonic-gate 	if (val & STA_UNSYNC)
4216*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf));
4217*7c478bd9Sstevel@tonic-gate 	if (val & STA_FREQHOLD)
4218*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf));
4219*7c478bd9Sstevel@tonic-gate 
4220*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSSIGNAL)
4221*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf));
4222*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSJITTER)
4223*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf));
4224*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSWANDER)
4225*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf));
4226*7c478bd9Sstevel@tonic-gate 	if (val & STA_PPSERROR)
4227*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf));
4228*7c478bd9Sstevel@tonic-gate 
4229*7c478bd9Sstevel@tonic-gate 	if (val & STA_CLOCKERR)
4230*7c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf));
4231*7c478bd9Sstevel@tonic-gate 
4232*7c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
4233*7c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
4234*7c478bd9Sstevel@tonic-gate 
4235*7c478bd9Sstevel@tonic-gate 	return (str + 1);
4236*7c478bd9Sstevel@tonic-gate }
4237*7c478bd9Sstevel@tonic-gate 
4238*7c478bd9Sstevel@tonic-gate void
4239*7c478bd9Sstevel@tonic-gate show_ntp_adjtime(private_t *pri)
4240*7c478bd9Sstevel@tonic-gate {
4241*7c478bd9Sstevel@tonic-gate 	struct timex timex;
4242*7c478bd9Sstevel@tonic-gate 	long offset;
4243*7c478bd9Sstevel@tonic-gate 
4244*7c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL)
4245*7c478bd9Sstevel@tonic-gate 		return;
4246*7c478bd9Sstevel@tonic-gate 
4247*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex))
4248*7c478bd9Sstevel@tonic-gate 		return;
4249*7c478bd9Sstevel@tonic-gate 
4250*7c478bd9Sstevel@tonic-gate 	(void) printf("\tmodes:     %s\n", get_timex_modes(pri, timex.modes));
4251*7c478bd9Sstevel@tonic-gate 	(void) printf("\toffset:    %11d usec\n", timex.offset);
4252*7c478bd9Sstevel@tonic-gate 	(void) printf("\tfreq:      %11d scaled ppm\n", timex.freq);
4253*7c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror:  %11d usec\n", timex.maxerror);
4254*7c478bd9Sstevel@tonic-gate 	(void) printf("\testerror:  %11d usec\n", timex.esterror);
4255*7c478bd9Sstevel@tonic-gate 	(void) printf("\tstatus:    %s\n", get_timex_status(pri, timex.status));
4256*7c478bd9Sstevel@tonic-gate 	(void) printf("\tconstant:  %11d\n", timex.constant);
4257*7c478bd9Sstevel@tonic-gate 	(void) printf("\tprecision: %11d usec\n", timex.precision);
4258*7c478bd9Sstevel@tonic-gate 	(void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance);
4259*7c478bd9Sstevel@tonic-gate 	(void) printf("\tppsfreq:   %11d scaled ppm\n", timex.ppsfreq);
4260*7c478bd9Sstevel@tonic-gate 	(void) printf("\tjitter:    %11d usec\n", timex.jitter);
4261*7c478bd9Sstevel@tonic-gate 	(void) printf("\tshift:     %11d sec\n", timex.shift);
4262*7c478bd9Sstevel@tonic-gate 	(void) printf("\tstabil:    %11d scaled ppm\n", timex.stabil);
4263*7c478bd9Sstevel@tonic-gate 	(void) printf("\tjitcnt:    %11d\n", timex.jitcnt);
4264*7c478bd9Sstevel@tonic-gate 	(void) printf("\tcalcnt:    %11d\n", timex.calcnt);
4265*7c478bd9Sstevel@tonic-gate 	(void) printf("\terrcnt:    %11d\n", timex.errcnt);
4266*7c478bd9Sstevel@tonic-gate 	(void) printf("\tstbcnt:    %11d\n", timex.stbcnt);
4267*7c478bd9Sstevel@tonic-gate }
4268*7c478bd9Sstevel@tonic-gate 
4269*7c478bd9Sstevel@tonic-gate void
4270*7c478bd9Sstevel@tonic-gate show_getrusage(long offset)
4271*7c478bd9Sstevel@tonic-gate {
4272*7c478bd9Sstevel@tonic-gate 	struct rusage r;
4273*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
4274*7c478bd9Sstevel@tonic-gate 		return;
4275*7c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %ld.%6.6ld sec\n",
4276*7c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
4277*7c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
4278*7c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %ld.%6.6ld sec\n",
4279*7c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
4280*7c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
4281*7c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %ld\n",
4282*7c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
4283*7c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %ld\n",
4284*7c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
4285*7c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %ld\n",
4286*7c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
4287*7c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %ld\n",
4288*7c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
4289*7c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %ld\n",
4290*7c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
4291*7c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %ld\n",
4292*7c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
4293*7c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %ld\n",
4294*7c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
4295*7c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %ld\n",
4296*7c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
4297*7c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %ld\n",
4298*7c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
4299*7c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %ld\n",
4300*7c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
4301*7c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %ld\n",
4302*7c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
4303*7c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %ld\n",
4304*7c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
4305*7c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %ld\n",
4306*7c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
4307*7c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %ld\n",
4308*7c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
4309*7c478bd9Sstevel@tonic-gate }
4310*7c478bd9Sstevel@tonic-gate 
4311*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4312*7c478bd9Sstevel@tonic-gate void
4313*7c478bd9Sstevel@tonic-gate show_getrusage32(long offset)
4314*7c478bd9Sstevel@tonic-gate {
4315*7c478bd9Sstevel@tonic-gate 	struct rusage32 r;
4316*7c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
4317*7c478bd9Sstevel@tonic-gate 		return;
4318*7c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %d.%6.6d sec\n",
4319*7c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
4320*7c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
4321*7c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %d.%6.6d sec\n",
4322*7c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
4323*7c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
4324*7c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %d\n",
4325*7c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
4326*7c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %d\n",
4327*7c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
4328*7c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %d\n",
4329*7c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
4330*7c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %d\n",
4331*7c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
4332*7c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %d\n",
4333*7c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
4334*7c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %d\n",
4335*7c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
4336*7c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %d\n",
4337*7c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
4338*7c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %d\n",
4339*7c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
4340*7c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %d\n",
4341*7c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
4342*7c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %d\n",
4343*7c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
4344*7c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %d\n",
4345*7c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
4346*7c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %d\n",
4347*7c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
4348*7c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %d\n",
4349*7c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
4350*7c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %d\n",
4351*7c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
4352*7c478bd9Sstevel@tonic-gate }
4353*7c478bd9Sstevel@tonic-gate #endif
4354*7c478bd9Sstevel@tonic-gate 
4355*7c478bd9Sstevel@tonic-gate /* expound verbosely upon syscall arguments */
4356*7c478bd9Sstevel@tonic-gate /*ARGSUSED*/
4357*7c478bd9Sstevel@tonic-gate void
4358*7c478bd9Sstevel@tonic-gate expound(private_t *pri, long r0, int raw)
4359*7c478bd9Sstevel@tonic-gate {
4360*7c478bd9Sstevel@tonic-gate 	const lwpstatus_t *Lsp = pri->lwpstat;
4361*7c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
4362*7c478bd9Sstevel@tonic-gate 	int what = Lsp->pr_what;
4363*7c478bd9Sstevel@tonic-gate 	int err = pri->Errno;		/* don't display output parameters */
4364*7c478bd9Sstevel@tonic-gate 					/* for a failed system call */
4365*7c478bd9Sstevel@tonic-gate #ifndef _LP64
4366*7c478bd9Sstevel@tonic-gate 	/* We are a 32-bit truss; we can't grok a 64-bit process */
4367*7c478bd9Sstevel@tonic-gate 	if (lp64)
4368*7c478bd9Sstevel@tonic-gate 		return;
4369*7c478bd9Sstevel@tonic-gate #endif
4370*7c478bd9Sstevel@tonic-gate 	/* for reporting sleeping system calls */
4371*7c478bd9Sstevel@tonic-gate 	if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP)))
4372*7c478bd9Sstevel@tonic-gate 		what = Lsp->pr_syscall;
4373*7c478bd9Sstevel@tonic-gate 
4374*7c478bd9Sstevel@tonic-gate 	switch (what) {
4375*7c478bd9Sstevel@tonic-gate 	case SYS_utime:
4376*7c478bd9Sstevel@tonic-gate 		show_utime(pri);
4377*7c478bd9Sstevel@tonic-gate 		break;
4378*7c478bd9Sstevel@tonic-gate 	case SYS_utimes:
4379*7c478bd9Sstevel@tonic-gate 		show_utimes(pri);
4380*7c478bd9Sstevel@tonic-gate 		break;
4381*7c478bd9Sstevel@tonic-gate 	case SYS_gettimeofday:
4382*7c478bd9Sstevel@tonic-gate 		if (!err)
4383*7c478bd9Sstevel@tonic-gate 			show_timeofday(pri);
4384*7c478bd9Sstevel@tonic-gate 		break;
4385*7c478bd9Sstevel@tonic-gate 	case SYS_getitimer:
4386*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4387*7c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
4388*7c478bd9Sstevel@tonic-gate 				" value");
4389*7c478bd9Sstevel@tonic-gate 		break;
4390*7c478bd9Sstevel@tonic-gate 	case SYS_setitimer:
4391*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4392*7c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
4393*7c478bd9Sstevel@tonic-gate 				" value");
4394*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4395*7c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[2],
4396*7c478bd9Sstevel@tonic-gate 				"ovalue");
4397*7c478bd9Sstevel@tonic-gate 		break;
4398*7c478bd9Sstevel@tonic-gate 	case SYS_stime:
4399*7c478bd9Sstevel@tonic-gate 		show_stime(pri);
4400*7c478bd9Sstevel@tonic-gate 		break;
4401*7c478bd9Sstevel@tonic-gate 	case SYS_times:
4402*7c478bd9Sstevel@tonic-gate 		if (!err)
4403*7c478bd9Sstevel@tonic-gate 			show_times(pri);
4404*7c478bd9Sstevel@tonic-gate 		break;
4405*7c478bd9Sstevel@tonic-gate 	case SYS_utssys:
4406*7c478bd9Sstevel@tonic-gate 		if (err)
4407*7c478bd9Sstevel@tonic-gate 			break;
4408*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4409*7c478bd9Sstevel@tonic-gate 		if (lp64)
4410*7c478bd9Sstevel@tonic-gate 			show_utssys(pri, r0);
4411*7c478bd9Sstevel@tonic-gate 		else
4412*7c478bd9Sstevel@tonic-gate 			show_utssys32(pri, r0);
4413*7c478bd9Sstevel@tonic-gate #else
4414*7c478bd9Sstevel@tonic-gate 		show_utssys(pri, r0);
4415*7c478bd9Sstevel@tonic-gate #endif
4416*7c478bd9Sstevel@tonic-gate 		break;
4417*7c478bd9Sstevel@tonic-gate 	case SYS_ioctl:
4418*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs >= 3) /* each case must decide for itself */
4419*7c478bd9Sstevel@tonic-gate 			show_ioctl(pri, pri->sys_args[1],
4420*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[2]);
4421*7c478bd9Sstevel@tonic-gate 		break;
4422*7c478bd9Sstevel@tonic-gate 	case SYS_stat:
4423*7c478bd9Sstevel@tonic-gate 	case SYS_fstat:
4424*7c478bd9Sstevel@tonic-gate 	case SYS_lstat:
4425*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
4426*7c478bd9Sstevel@tonic-gate 			show_stat(pri, (long)pri->sys_args[1]);
4427*7c478bd9Sstevel@tonic-gate 		break;
4428*7c478bd9Sstevel@tonic-gate 	case SYS_stat64:
4429*7c478bd9Sstevel@tonic-gate 	case SYS_fstat64:
4430*7c478bd9Sstevel@tonic-gate 	case SYS_lstat64:
4431*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
4432*7c478bd9Sstevel@tonic-gate 			show_stat64_32(pri, (long)pri->sys_args[1]);
4433*7c478bd9Sstevel@tonic-gate 		break;
4434*7c478bd9Sstevel@tonic-gate 	case SYS_fsat:
4435*7c478bd9Sstevel@tonic-gate 		/*
4436*7c478bd9Sstevel@tonic-gate 		 * subcodes for fstatat() and fstatat64().
4437*7c478bd9Sstevel@tonic-gate 		 */
4438*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 4) {
4439*7c478bd9Sstevel@tonic-gate 			if (pri->sys_args[0] == 3)
4440*7c478bd9Sstevel@tonic-gate 				show_statat(pri, (long)pri->sys_args[3]);
4441*7c478bd9Sstevel@tonic-gate 			else if (pri->sys_args[0] == 2)
4442*7c478bd9Sstevel@tonic-gate 				show_stat64_32(pri, (long)pri->sys_args[3]);
4443*7c478bd9Sstevel@tonic-gate 		}
4444*7c478bd9Sstevel@tonic-gate 		break;
4445*7c478bd9Sstevel@tonic-gate 	case SYS_xstat:
4446*7c478bd9Sstevel@tonic-gate 	case SYS_fxstat:
4447*7c478bd9Sstevel@tonic-gate 	case SYS_lxstat:
4448*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 3)
4449*7c478bd9Sstevel@tonic-gate 			show_xstat(pri, (int)pri->sys_args[0],
4450*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[2]);
4451*7c478bd9Sstevel@tonic-gate 		break;
4452*7c478bd9Sstevel@tonic-gate 	case SYS_statvfs:
4453*7c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs:
4454*7c478bd9Sstevel@tonic-gate 		if (err)
4455*7c478bd9Sstevel@tonic-gate 			break;
4456*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4457*7c478bd9Sstevel@tonic-gate 		if (!lp64) {
4458*7c478bd9Sstevel@tonic-gate 			show_statvfs32(pri);
4459*7c478bd9Sstevel@tonic-gate 			break;
4460*7c478bd9Sstevel@tonic-gate 		}
4461*7c478bd9Sstevel@tonic-gate #endif
4462*7c478bd9Sstevel@tonic-gate 		show_statvfs(pri);
4463*7c478bd9Sstevel@tonic-gate 		break;
4464*7c478bd9Sstevel@tonic-gate 	case SYS_statvfs64:
4465*7c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs64:
4466*7c478bd9Sstevel@tonic-gate 		if (err)
4467*7c478bd9Sstevel@tonic-gate 			break;
4468*7c478bd9Sstevel@tonic-gate 		show_statvfs64(pri);
4469*7c478bd9Sstevel@tonic-gate 		break;
4470*7c478bd9Sstevel@tonic-gate 	case SYS_statfs:
4471*7c478bd9Sstevel@tonic-gate 	case SYS_fstatfs:
4472*7c478bd9Sstevel@tonic-gate 		if (err)
4473*7c478bd9Sstevel@tonic-gate 			break;
4474*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4475*7c478bd9Sstevel@tonic-gate 		if (lp64)
4476*7c478bd9Sstevel@tonic-gate 			show_statfs(pri);
4477*7c478bd9Sstevel@tonic-gate 		else
4478*7c478bd9Sstevel@tonic-gate 			show_statfs32(pri);
4479*7c478bd9Sstevel@tonic-gate #else
4480*7c478bd9Sstevel@tonic-gate 		show_statfs(pri);
4481*7c478bd9Sstevel@tonic-gate #endif
4482*7c478bd9Sstevel@tonic-gate 		break;
4483*7c478bd9Sstevel@tonic-gate 	case SYS_fcntl:
4484*7c478bd9Sstevel@tonic-gate 		show_fcntl(pri);
4485*7c478bd9Sstevel@tonic-gate 		break;
4486*7c478bd9Sstevel@tonic-gate 	case SYS_msgsys:
4487*7c478bd9Sstevel@tonic-gate 		show_msgsys(pri, r0); /* each case must decide for itself */
4488*7c478bd9Sstevel@tonic-gate 		break;
4489*7c478bd9Sstevel@tonic-gate 	case SYS_semsys:
4490*7c478bd9Sstevel@tonic-gate 		show_semsys(pri);	/* each case must decide for itself */
4491*7c478bd9Sstevel@tonic-gate 		break;
4492*7c478bd9Sstevel@tonic-gate 	case SYS_shmsys:
4493*7c478bd9Sstevel@tonic-gate 		show_shmsys(pri);	/* each case must decide for itself */
4494*7c478bd9Sstevel@tonic-gate 		break;
4495*7c478bd9Sstevel@tonic-gate 	case SYS_getdents:
4496*7c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
4497*7c478bd9Sstevel@tonic-gate 			break;
4498*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4499*7c478bd9Sstevel@tonic-gate 		if (!lp64) {
4500*7c478bd9Sstevel@tonic-gate 			show_dents32(pri, (long)pri->sys_args[1], r0);
4501*7c478bd9Sstevel@tonic-gate 			break;
4502*7c478bd9Sstevel@tonic-gate 		}
4503*7c478bd9Sstevel@tonic-gate 		/* FALLTHROUGH */
4504*7c478bd9Sstevel@tonic-gate #else
4505*7c478bd9Sstevel@tonic-gate 		show_dents32(pri, (long)pri->sys_args[1], r0);
4506*7c478bd9Sstevel@tonic-gate 		break;
4507*7c478bd9Sstevel@tonic-gate #endif
4508*7c478bd9Sstevel@tonic-gate 	case SYS_getdents64:
4509*7c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
4510*7c478bd9Sstevel@tonic-gate 			break;
4511*7c478bd9Sstevel@tonic-gate 		show_dents64(pri, (long)pri->sys_args[1], r0);
4512*7c478bd9Sstevel@tonic-gate 		break;
4513*7c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
4514*7c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
4515*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
4516*7c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "flags");
4517*7c478bd9Sstevel@tonic-gate 		break;
4518*7c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
4519*7c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
4520*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
4521*7c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "band");
4522*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
4523*7c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[4], "flags");
4524*7c478bd9Sstevel@tonic-gate 		break;
4525*7c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
4526*7c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
4527*7c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
4528*7c478bd9Sstevel@tonic-gate 		break;
4529*7c478bd9Sstevel@tonic-gate 	case SYS_poll:
4530*7c478bd9Sstevel@tonic-gate 		show_poll(pri);
4531*7c478bd9Sstevel@tonic-gate 		break;
4532*7c478bd9Sstevel@tonic-gate 	case SYS_pollsys:
4533*7c478bd9Sstevel@tonic-gate 		show_pollsys(pri);
4534*7c478bd9Sstevel@tonic-gate 		break;
4535*7c478bd9Sstevel@tonic-gate 	case SYS_setgroups:
4536*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0)
4537*7c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
4538*7c478bd9Sstevel@tonic-gate 		break;
4539*7c478bd9Sstevel@tonic-gate 	case SYS_getgroups:
4540*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0)
4541*7c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
4542*7c478bd9Sstevel@tonic-gate 		break;
4543*7c478bd9Sstevel@tonic-gate 	case SYS_sigprocmask:
4544*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4545*7c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], " set");
4546*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4547*7c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[2], "oset");
4548*7c478bd9Sstevel@tonic-gate 		break;
4549*7c478bd9Sstevel@tonic-gate 	case SYS_sigsuspend:
4550*7c478bd9Sstevel@tonic-gate 	case SYS_sigtimedwait:
4551*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4552*7c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[0], "sigmask");
4553*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4554*7c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[1]);
4555*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
4556*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
4557*7c478bd9Sstevel@tonic-gate 		break;
4558*7c478bd9Sstevel@tonic-gate 	case SYS_sigaltstack:
4559*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4560*7c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[0],
4561*7c478bd9Sstevel@tonic-gate 				"new");
4562*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4563*7c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[1],
4564*7c478bd9Sstevel@tonic-gate 				"old");
4565*7c478bd9Sstevel@tonic-gate 		break;
4566*7c478bd9Sstevel@tonic-gate 	case SYS_sigaction:
4567*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4568*7c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[1],
4569*7c478bd9Sstevel@tonic-gate 				"new", NULL);
4570*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4571*7c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[2],
4572*7c478bd9Sstevel@tonic-gate 				"old", r0);
4573*7c478bd9Sstevel@tonic-gate 		break;
4574*7c478bd9Sstevel@tonic-gate 	case SYS_sigpending:
4575*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4576*7c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], "sigmask");
4577*7c478bd9Sstevel@tonic-gate 		break;
4578*7c478bd9Sstevel@tonic-gate 	case SYS_waitsys:
4579*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4580*7c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[2]);
4581*7c478bd9Sstevel@tonic-gate 		break;
4582*7c478bd9Sstevel@tonic-gate 	case SYS_sigsendsys:
4583*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4584*7c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[0]);
4585*7c478bd9Sstevel@tonic-gate 		break;
4586*7c478bd9Sstevel@tonic-gate 	case SYS_priocntlsys:
4587*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4588*7c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[1]);
4589*7c478bd9Sstevel@tonic-gate 		break;
4590*7c478bd9Sstevel@tonic-gate 	case SYS_mincore:
4591*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4592*7c478bd9Sstevel@tonic-gate 			show_bool(pri, (long)pri->sys_args[2],
4593*7c478bd9Sstevel@tonic-gate 				(pri->sys_args[1] + pagesize - 1) / pagesize);
4594*7c478bd9Sstevel@tonic-gate 		break;
4595*7c478bd9Sstevel@tonic-gate 	case SYS_readv:
4596*7c478bd9Sstevel@tonic-gate 	case SYS_writev:
4597*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2) {
4598*7c478bd9Sstevel@tonic-gate 			int i = pri->sys_args[0]+1;
4599*7c478bd9Sstevel@tonic-gate 			int showbuf = FALSE;
4600*7c478bd9Sstevel@tonic-gate 			long nb = (what == SYS_readv)? r0 : 32*1024;
4601*7c478bd9Sstevel@tonic-gate 
4602*7c478bd9Sstevel@tonic-gate 			if ((what == SYS_readv && !err &&
4603*7c478bd9Sstevel@tonic-gate 			    prismember(&readfd, i)) ||
4604*7c478bd9Sstevel@tonic-gate 			    (what == SYS_writev &&
4605*7c478bd9Sstevel@tonic-gate 			    prismember(&writefd, i)))
4606*7c478bd9Sstevel@tonic-gate 				showbuf = TRUE;
4607*7c478bd9Sstevel@tonic-gate 			show_iovec(pri, (long)pri->sys_args[1],
4608*7c478bd9Sstevel@tonic-gate 				pri->sys_args[2], showbuf, nb);
4609*7c478bd9Sstevel@tonic-gate 		}
4610*7c478bd9Sstevel@tonic-gate 		break;
4611*7c478bd9Sstevel@tonic-gate 	case SYS_getrlimit:
4612*7c478bd9Sstevel@tonic-gate 		if (err)
4613*7c478bd9Sstevel@tonic-gate 			break;
4614*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
4615*7c478bd9Sstevel@tonic-gate 	case SYS_setrlimit:
4616*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
4617*7c478bd9Sstevel@tonic-gate 			break;
4618*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4619*7c478bd9Sstevel@tonic-gate 		if (lp64)
4620*7c478bd9Sstevel@tonic-gate 			show_rlimit64(pri, (long)pri->sys_args[1]);
4621*7c478bd9Sstevel@tonic-gate 		else
4622*7c478bd9Sstevel@tonic-gate 			show_rlimit32(pri, (long)pri->sys_args[1]);
4623*7c478bd9Sstevel@tonic-gate #else
4624*7c478bd9Sstevel@tonic-gate 		show_rlimit32(pri, (long)pri->sys_args[1]);
4625*7c478bd9Sstevel@tonic-gate #endif
4626*7c478bd9Sstevel@tonic-gate 		break;
4627*7c478bd9Sstevel@tonic-gate 	case SYS_getrlimit64:
4628*7c478bd9Sstevel@tonic-gate 		if (err)
4629*7c478bd9Sstevel@tonic-gate 			break;
4630*7c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
4631*7c478bd9Sstevel@tonic-gate 	case SYS_setrlimit64:
4632*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
4633*7c478bd9Sstevel@tonic-gate 			break;
4634*7c478bd9Sstevel@tonic-gate 		show_rlimit64(pri, (long)pri->sys_args[1]);
4635*7c478bd9Sstevel@tonic-gate 		break;
4636*7c478bd9Sstevel@tonic-gate 	case SYS_uname:
4637*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
4638*7c478bd9Sstevel@tonic-gate 			show_nuname(pri, (long)pri->sys_args[0]);
4639*7c478bd9Sstevel@tonic-gate 		break;
4640*7c478bd9Sstevel@tonic-gate 	case SYS_adjtime:
4641*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4642*7c478bd9Sstevel@tonic-gate 			show_adjtime(pri, (long)pri->sys_args[0],
4643*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[1]);
4644*7c478bd9Sstevel@tonic-gate 		break;
4645*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_info:
4646*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
4647*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "cpu time");
4648*7c478bd9Sstevel@tonic-gate 		break;
4649*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_wait:
4650*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
4651*7c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[1], "lwpid");
4652*7c478bd9Sstevel@tonic-gate 		break;
4653*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_wakeup:
4654*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_lock:
4655*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_unlock:
4656*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_trylock:
4657*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_init:
4658*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4659*7c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
4660*7c478bd9Sstevel@tonic-gate 		break;
4661*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_timedlock:
4662*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4663*7c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
4664*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4665*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
4666*7c478bd9Sstevel@tonic-gate 		break;
4667*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_wait:
4668*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4669*7c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
4670*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4671*7c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[1]);
4672*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
4673*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
4674*7c478bd9Sstevel@tonic-gate 		break;
4675*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_signal:
4676*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_broadcast:
4677*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4678*7c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
4679*7c478bd9Sstevel@tonic-gate 		break;
4680*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_wait:
4681*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_trywait:
4682*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_post:
4683*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4684*7c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
4685*7c478bd9Sstevel@tonic-gate 		break;
4686*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_timedwait:
4687*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4688*7c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
4689*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4690*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
4691*7c478bd9Sstevel@tonic-gate 		break;
4692*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_rwlock_sys:
4693*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
4694*7c478bd9Sstevel@tonic-gate 			show_rwlock(pri, (long)pri->sys_args[1]);
4695*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 &&
4696*7c478bd9Sstevel@tonic-gate 		    (pri->sys_args[0] == 0 || pri->sys_args[0] == 1))
4697*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
4698*7c478bd9Sstevel@tonic-gate 		break;
4699*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_create:
4700*7c478bd9Sstevel@tonic-gate 		/* XXX print some values in ucontext ??? */
4701*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4702*7c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[2], "lwpid");
4703*7c478bd9Sstevel@tonic-gate 		break;
4704*7c478bd9Sstevel@tonic-gate 	case SYS_kaio:
4705*7c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1)
4706*7c478bd9Sstevel@tonic-gate 			show_timeval(pri, (long)pri->sys_args[1], "timeout");
4707*7c478bd9Sstevel@tonic-gate 		break;
4708*7c478bd9Sstevel@tonic-gate 	case SYS_nanosleep:
4709*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
4710*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "tmout");
4711*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (err == 0 || err == EINTR))
4712*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "resid");
4713*7c478bd9Sstevel@tonic-gate 		break;
4714*7c478bd9Sstevel@tonic-gate 	case SYS_privsys:
4715*7c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
4716*7c478bd9Sstevel@tonic-gate 		case PRIVSYS_SETPPRIV:
4717*7c478bd9Sstevel@tonic-gate 		case PRIVSYS_GETPPRIV:
4718*7c478bd9Sstevel@tonic-gate 			if (!err)
4719*7c478bd9Sstevel@tonic-gate 				show_privset(pri, (long)pri->sys_args[3],
4720*7c478bd9Sstevel@tonic-gate 					(size_t)pri->sys_args[4]);
4721*7c478bd9Sstevel@tonic-gate 		}
4722*7c478bd9Sstevel@tonic-gate 		break;
4723*7c478bd9Sstevel@tonic-gate 	case SYS_ucredsys:
4724*7c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
4725*7c478bd9Sstevel@tonic-gate 		case UCREDSYS_UCREDGET:
4726*7c478bd9Sstevel@tonic-gate 		case UCREDSYS_GETPEERUCRED:
4727*7c478bd9Sstevel@tonic-gate 			if (err == 0)
4728*7c478bd9Sstevel@tonic-gate 				show_ucred(pri, (long)pri->sys_args[2]);
4729*7c478bd9Sstevel@tonic-gate 			break;
4730*7c478bd9Sstevel@tonic-gate 		}
4731*7c478bd9Sstevel@tonic-gate 		break;
4732*7c478bd9Sstevel@tonic-gate 	case SYS_bind:
4733*7c478bd9Sstevel@tonic-gate 	case SYS_connect:
4734*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
4735*7c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
4736*7c478bd9Sstevel@tonic-gate 				0, (long)pri->sys_args[2]);
4737*7c478bd9Sstevel@tonic-gate 		break;
4738*7c478bd9Sstevel@tonic-gate 	case SYS_sendto:
4739*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 5)
4740*7c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "to", (long)pri->sys_args[4], 0,
4741*7c478bd9Sstevel@tonic-gate 				pri->sys_args[5]);
4742*7c478bd9Sstevel@tonic-gate 		break;
4743*7c478bd9Sstevel@tonic-gate 	case SYS_accept:
4744*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4745*7c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
4746*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[2], 0);
4747*7c478bd9Sstevel@tonic-gate 		break;
4748*7c478bd9Sstevel@tonic-gate 	case SYS_getsockname:
4749*7c478bd9Sstevel@tonic-gate 	case SYS_getpeername:
4750*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4751*7c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
4752*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[2], 0);
4753*7c478bd9Sstevel@tonic-gate 		break;
4754*7c478bd9Sstevel@tonic-gate 	case SYS_cladm:
4755*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
4756*7c478bd9Sstevel@tonic-gate 			show_cladm(pri, pri->sys_args[0], pri->sys_args[1],
4757*7c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2]);
4758*7c478bd9Sstevel@tonic-gate 		break;
4759*7c478bd9Sstevel@tonic-gate 	case SYS_recvfrom:
4760*7c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 5)
4761*7c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "from", (long)pri->sys_args[4],
4762*7c478bd9Sstevel@tonic-gate 				(long)pri->sys_args[5], 0);
4763*7c478bd9Sstevel@tonic-gate 		break;
4764*7c478bd9Sstevel@tonic-gate 	case SYS_recvmsg:
4765*7c478bd9Sstevel@tonic-gate 		if (err)
4766*7c478bd9Sstevel@tonic-gate 			break;
4767*7c478bd9Sstevel@tonic-gate 		/* FALLTHROUGH */
4768*7c478bd9Sstevel@tonic-gate 	case SYS_sendmsg:
4769*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
4770*7c478bd9Sstevel@tonic-gate 			break;
4771*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4772*7c478bd9Sstevel@tonic-gate 		if (lp64)
4773*7c478bd9Sstevel@tonic-gate 			show_msghdr(pri, pri->sys_args[1]);
4774*7c478bd9Sstevel@tonic-gate 		else
4775*7c478bd9Sstevel@tonic-gate 			show_msghdr32(pri, pri->sys_args[1]);
4776*7c478bd9Sstevel@tonic-gate #else
4777*7c478bd9Sstevel@tonic-gate 		show_msghdr(pri, pri->sys_args[1]);
4778*7c478bd9Sstevel@tonic-gate #endif
4779*7c478bd9Sstevel@tonic-gate 		break;
4780*7c478bd9Sstevel@tonic-gate 	case SYS_door:
4781*7c478bd9Sstevel@tonic-gate 		show_doors(pri);
4782*7c478bd9Sstevel@tonic-gate 		break;
4783*7c478bd9Sstevel@tonic-gate 	case SYS_sendfilev:
4784*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs != 5)
4785*7c478bd9Sstevel@tonic-gate 			break;
4786*7c478bd9Sstevel@tonic-gate 
4787*7c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == SENDFILEV) {
4788*7c478bd9Sstevel@tonic-gate 			show_sendfilevec(pri, (int)pri->sys_args[1],
4789*7c478bd9Sstevel@tonic-gate 				(sendfilevec_t *)pri->sys_args[2],
4790*7c478bd9Sstevel@tonic-gate 				(int)pri->sys_args[3]);
4791*7c478bd9Sstevel@tonic-gate 		} else if (pri->sys_args[0] == SENDFILEV64) {
4792*7c478bd9Sstevel@tonic-gate 			show_sendfilevec64(pri, (int)pri->sys_args[1],
4793*7c478bd9Sstevel@tonic-gate 				(sendfilevec64_t *)pri->sys_args[2],
4794*7c478bd9Sstevel@tonic-gate 				(int)pri->sys_args[3]);
4795*7c478bd9Sstevel@tonic-gate 		}
4796*7c478bd9Sstevel@tonic-gate 		break;
4797*7c478bd9Sstevel@tonic-gate 	case SYS_memcntl:
4798*7c478bd9Sstevel@tonic-gate 		show_memcntl(pri);
4799*7c478bd9Sstevel@tonic-gate 		break;
4800*7c478bd9Sstevel@tonic-gate 	case SYS_lwp_park:
4801*7c478bd9Sstevel@tonic-gate 		/* subcode 0: lwp_park(timespec_t *, id_t) */
4802*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && pri->sys_args[0] == 0)
4803*7c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
4804*7c478bd9Sstevel@tonic-gate 		/* subcode 2: lwp_unpark_all(id_t *, int) */
4805*7c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 && pri->sys_args[0] == 2)
4806*7c478bd9Sstevel@tonic-gate 			show_ids(pri, (long)pri->sys_args[1],
4807*7c478bd9Sstevel@tonic-gate 				(int)pri->sys_args[2]);
4808*7c478bd9Sstevel@tonic-gate 		break;
4809*7c478bd9Sstevel@tonic-gate 	case SYS_ntp_gettime:
4810*7c478bd9Sstevel@tonic-gate 		if (!err)
4811*7c478bd9Sstevel@tonic-gate 			show_ntp_gettime(pri);
4812*7c478bd9Sstevel@tonic-gate 		break;
4813*7c478bd9Sstevel@tonic-gate 	case SYS_ntp_adjtime:
4814*7c478bd9Sstevel@tonic-gate 		if (!err)
4815*7c478bd9Sstevel@tonic-gate 			show_ntp_adjtime(pri);
4816*7c478bd9Sstevel@tonic-gate 		break;
4817*7c478bd9Sstevel@tonic-gate 	case SYS_rusagesys:
4818*7c478bd9Sstevel@tonic-gate 		if (!err)
4819*7c478bd9Sstevel@tonic-gate 			if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) {
4820*7c478bd9Sstevel@tonic-gate #ifdef _LP64
4821*7c478bd9Sstevel@tonic-gate 				if (!lp64)
4822*7c478bd9Sstevel@tonic-gate 				    show_getrusage32(pri->sys_args[1]);
4823*7c478bd9Sstevel@tonic-gate 				else
4824*7c478bd9Sstevel@tonic-gate #endif
4825*7c478bd9Sstevel@tonic-gate 				    show_getrusage(pri->sys_args[1]);
4826*7c478bd9Sstevel@tonic-gate 			}
4827*7c478bd9Sstevel@tonic-gate 		break;
4828*7c478bd9Sstevel@tonic-gate 	case SYS_port:
4829*7c478bd9Sstevel@tonic-gate 		show_ports(pri);
4830*7c478bd9Sstevel@tonic-gate 		break;
4831*7c478bd9Sstevel@tonic-gate 	}
4832*7c478bd9Sstevel@tonic-gate }
4833