xref: /illumos-gate/usr/src/cmd/truss/expound.c (revision 0250c53ad267726f2438e3c6556199a0bbf588a2)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52caf0dcdSrshoaib  * Common Development and Distribution License (the "License").
62caf0dcdSrshoaib  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
212caf0dcdSrshoaib 
227c478bd9Sstevel@tonic-gate /*
23a803cc21SGordon Ross  * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
243e95bd4aSAnders Persson  * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
259c3fd121SMatthew Ahrens  * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
267a5aac98SJerry Jelinek  * Copyright 2015 Joyent, Inc.
277c478bd9Sstevel@tonic-gate  */
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
307c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #define	_SYSCALL32
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate #include <stdlib.h>
367c478bd9Sstevel@tonic-gate #include <unistd.h>
377c478bd9Sstevel@tonic-gate #include <ctype.h>
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate #include <sys/mman.h>
407c478bd9Sstevel@tonic-gate #include <libproc.h>
417c478bd9Sstevel@tonic-gate #include <string.h>
427c478bd9Sstevel@tonic-gate #include <limits.h>
437c478bd9Sstevel@tonic-gate #include <sys/statfs.h>
447c478bd9Sstevel@tonic-gate #include <sys/times.h>
457c478bd9Sstevel@tonic-gate #include <sys/timex.h>
467c478bd9Sstevel@tonic-gate #include <sys/utssys.h>
477c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
487c478bd9Sstevel@tonic-gate #include <sys/ipc.h>
497c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h>
507c478bd9Sstevel@tonic-gate #include <sys/msg.h>
517c478bd9Sstevel@tonic-gate #include <sys/msg_impl.h>
527c478bd9Sstevel@tonic-gate #include <sys/sem.h>
537c478bd9Sstevel@tonic-gate #include <sys/sem_impl.h>
547c478bd9Sstevel@tonic-gate #include <sys/shm.h>
557c478bd9Sstevel@tonic-gate #include <sys/shm_impl.h>
567c478bd9Sstevel@tonic-gate #include <sys/dirent.h>
577c478bd9Sstevel@tonic-gate #include <ustat.h>
587c478bd9Sstevel@tonic-gate #include <fcntl.h>
597c478bd9Sstevel@tonic-gate #include <time.h>
607c478bd9Sstevel@tonic-gate #include <sys/termios.h>
617c478bd9Sstevel@tonic-gate #include <sys/termiox.h>
627c478bd9Sstevel@tonic-gate #include <sys/termio.h>
637c478bd9Sstevel@tonic-gate #include <sys/ttold.h>
647c478bd9Sstevel@tonic-gate #include <sys/jioctl.h>
657c478bd9Sstevel@tonic-gate #include <sys/filio.h>
667c478bd9Sstevel@tonic-gate #include <stropts.h>
677c478bd9Sstevel@tonic-gate #include <poll.h>
687c478bd9Sstevel@tonic-gate #include <sys/uio.h>
697c478bd9Sstevel@tonic-gate #include <sys/resource.h>
707c478bd9Sstevel@tonic-gate #include <sys/statvfs.h>
717c478bd9Sstevel@tonic-gate #include <sys/time.h>
727c478bd9Sstevel@tonic-gate #include <sys/aio.h>
737c478bd9Sstevel@tonic-gate #include <sys/socket.h>
747c478bd9Sstevel@tonic-gate #include <netinet/in.h>
757c478bd9Sstevel@tonic-gate #include <sys/un.h>
767c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
777c478bd9Sstevel@tonic-gate #include <arpa/inet.h>
787c478bd9Sstevel@tonic-gate #include <sys/audioio.h>
797c478bd9Sstevel@tonic-gate #include <sys/cladm.h>
807c478bd9Sstevel@tonic-gate #include <sys/synch.h>
817c478bd9Sstevel@tonic-gate #include <sys/synch32.h>
827c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
837c478bd9Sstevel@tonic-gate #include <sys/sendfile.h>
847c478bd9Sstevel@tonic-gate #include <priv.h>
857c478bd9Sstevel@tonic-gate #include <ucred.h>
867c478bd9Sstevel@tonic-gate #include <sys/ucred.h>
877c478bd9Sstevel@tonic-gate #include <sys/port_impl.h>
88821c4a97Sdp #include <sys/zone.h>
89821c4a97Sdp #include <sys/priv_impl.h>
90821c4a97Sdp #include <sys/priv.h>
9145916cd2Sjpk #include <tsol/label.h>
92aa4a4f3bSnf202958 #include <sys/nvpair.h>
93aa4a4f3bSnf202958 #include <libnvpair.h>
94532877c4Srd117015 #include <sys/rctl_impl.h>
953e95bd4aSAnders Persson #include <sys/socketvar.h>
96a803cc21SGordon Ross #include <sys/fs/zfs.h>
97a803cc21SGordon Ross #include <sys/zfs_ioctl.h>
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate #include "ramdata.h"
1007c478bd9Sstevel@tonic-gate #include "systable.h"
1017c478bd9Sstevel@tonic-gate #include "proto.h"
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate void	show_sigset(private_t *, long, const char *);
1047c478bd9Sstevel@tonic-gate void	show_ioctl(private_t *, int, long);
105a803cc21SGordon Ross void	show_zfs_ioc(private_t *, long);
1067c478bd9Sstevel@tonic-gate 
1073b862e9aSRoger A. Faulkner static void
mk_ctime(char * str,size_t maxsize,time_t value)1083b862e9aSRoger A. Faulkner mk_ctime(char *str, size_t maxsize, time_t value)
1093b862e9aSRoger A. Faulkner {
1103b862e9aSRoger A. Faulkner 	(void) strftime(str, maxsize, "%b %e %H:%M:%S %Z %Y",
1113b862e9aSRoger A. Faulkner 	    localtime(&value));
1123b862e9aSRoger A. Faulkner }
1133b862e9aSRoger A. Faulkner 
1147c478bd9Sstevel@tonic-gate void
prtime(private_t * pri,const char * name,time_t value)1157c478bd9Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value)
1167c478bd9Sstevel@tonic-gate {
1177c478bd9Sstevel@tonic-gate 	char str[80];
1187c478bd9Sstevel@tonic-gate 
1193b862e9aSRoger A. Faulkner 	mk_ctime(str, sizeof (str), value);
1203b862e9aSRoger A. Faulkner 	(void) printf("%s\t%s%s  [ %lu ]\n",
1217c478bd9Sstevel@tonic-gate 	    pri->pname,
1227c478bd9Sstevel@tonic-gate 	    name,
1237c478bd9Sstevel@tonic-gate 	    str,
1243b862e9aSRoger A. Faulkner 	    value);
1253b862e9aSRoger A. Faulkner }
1263b862e9aSRoger A. Faulkner 
1273b862e9aSRoger A. Faulkner void
prtimeval(private_t * pri,const char * name,struct timeval * value)1283b862e9aSRoger A. Faulkner prtimeval(private_t *pri, const char *name, struct timeval *value)
1293b862e9aSRoger A. Faulkner {
1303b862e9aSRoger A. Faulkner 	char str[80];
1313b862e9aSRoger A. Faulkner 
1323b862e9aSRoger A. Faulkner 	mk_ctime(str, sizeof (str), value->tv_sec);
1333b862e9aSRoger A. Faulkner 	(void) printf("%s\t%s%s  [ %lu.%6.6lu ]\n",
1343b862e9aSRoger A. Faulkner 	    pri->pname,
1353b862e9aSRoger A. Faulkner 	    name,
1363b862e9aSRoger A. Faulkner 	    str,
1373b862e9aSRoger A. Faulkner 	    value->tv_sec,
1383b862e9aSRoger A. Faulkner 	    value->tv_usec);
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate void
prtimestruc(private_t * pri,const char * name,timestruc_t * value)1427c478bd9Sstevel@tonic-gate prtimestruc(private_t *pri, const char *name, timestruc_t *value)
1437c478bd9Sstevel@tonic-gate {
1443b862e9aSRoger A. Faulkner 	char str[80];
1453b862e9aSRoger A. Faulkner 
1463b862e9aSRoger A. Faulkner 	mk_ctime(str, sizeof (str), value->tv_sec);
1473b862e9aSRoger A. Faulkner 	(void) printf("%s\t%s%s  [ %lu.%9.9lu ]\n",
1483b862e9aSRoger A. Faulkner 	    pri->pname,
1493b862e9aSRoger A. Faulkner 	    name,
1503b862e9aSRoger A. Faulkner 	    str,
1513b862e9aSRoger A. Faulkner 	    value->tv_sec,
1523b862e9aSRoger A. Faulkner 	    value->tv_nsec);
1537c478bd9Sstevel@tonic-gate }
1547c478bd9Sstevel@tonic-gate 
1553b862e9aSRoger A. Faulkner static void
show_utimens(private_t * pri,long offset)1563b862e9aSRoger A. Faulkner show_utimens(private_t *pri, long offset)
1573b862e9aSRoger A. Faulkner {
1583b862e9aSRoger A. Faulkner 	struct {
1593b862e9aSRoger A. Faulkner 		timespec_t atime;
1603b862e9aSRoger A. Faulkner 		timespec_t mtime;
1613b862e9aSRoger A. Faulkner 	} utimbuf;
1623b862e9aSRoger A. Faulkner 
1633b862e9aSRoger A. Faulkner 	if (offset == 0)
1643b862e9aSRoger A. Faulkner 		return;
1653b862e9aSRoger A. Faulkner 
1663b862e9aSRoger A. Faulkner 	if (data_model == PR_MODEL_NATIVE) {
1673b862e9aSRoger A. Faulkner 		if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset)
1683b862e9aSRoger A. Faulkner 		    != sizeof (utimbuf))
1693b862e9aSRoger A. Faulkner 			return;
1703b862e9aSRoger A. Faulkner 	} else {
1713b862e9aSRoger A. Faulkner 		struct {
1723b862e9aSRoger A. Faulkner 			timespec32_t atime;
1733b862e9aSRoger A. Faulkner 			timespec32_t mtime;
1743b862e9aSRoger A. Faulkner 		} utimbuf32;
1753b862e9aSRoger A. Faulkner 
1763b862e9aSRoger A. Faulkner 		if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset)
1773b862e9aSRoger A. Faulkner 		    != sizeof (utimbuf32))
1783b862e9aSRoger A. Faulkner 			return;
1793b862e9aSRoger A. Faulkner 
1803b862e9aSRoger A. Faulkner 		TIMESPEC32_TO_TIMESPEC(&utimbuf.atime, &utimbuf32.atime);
1813b862e9aSRoger A. Faulkner 		TIMESPEC32_TO_TIMESPEC(&utimbuf.mtime, &utimbuf32.mtime);
1823b862e9aSRoger A. Faulkner 	}
1833b862e9aSRoger A. Faulkner 
1843b862e9aSRoger A. Faulkner 	/* print access and modification times */
1853b862e9aSRoger A. Faulkner 	if (utimbuf.atime.tv_nsec == UTIME_OMIT)
1863b862e9aSRoger A. Faulkner 		(void) printf("%s\tat = UTIME_OMIT\n", pri->pname);
1873b862e9aSRoger A. Faulkner 	else if (utimbuf.atime.tv_nsec == UTIME_NOW)
1883b862e9aSRoger A. Faulkner 		(void) printf("%s\tat = UTIME_NOW\n", pri->pname);
1893b862e9aSRoger A. Faulkner 	else
1903b862e9aSRoger A. Faulkner 		prtimestruc(pri, "at = ", &utimbuf.atime);
1913b862e9aSRoger A. Faulkner 	if (utimbuf.mtime.tv_nsec == UTIME_OMIT)
1923b862e9aSRoger A. Faulkner 		(void) printf("%s\tmt = UTIME_OMIT\n", pri->pname);
1933b862e9aSRoger A. Faulkner 	else if (utimbuf.mtime.tv_nsec == UTIME_NOW)
1943b862e9aSRoger A. Faulkner 		(void) printf("%s\tmt = UTIME_NOW\n", pri->pname);
1953b862e9aSRoger A. Faulkner 	else
19635da9b40SPavel Filipensky 		prtimestruc(pri, "mt = ", &utimbuf.mtime);
1977c478bd9Sstevel@tonic-gate }
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate void
show_timeofday(private_t * pri)2007c478bd9Sstevel@tonic-gate show_timeofday(private_t *pri)
2017c478bd9Sstevel@tonic-gate {
2027c478bd9Sstevel@tonic-gate 	struct timeval tod;
2037c478bd9Sstevel@tonic-gate 	long offset;
2047c478bd9Sstevel@tonic-gate 
20527aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
2067c478bd9Sstevel@tonic-gate 		return;
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
2097c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tod, sizeof (tod), offset)
2107c478bd9Sstevel@tonic-gate 		    != sizeof (tod))
2117c478bd9Sstevel@tonic-gate 			return;
2127c478bd9Sstevel@tonic-gate 	} else {
2137c478bd9Sstevel@tonic-gate 		struct timeval32 tod32;
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tod32, sizeof (tod32), offset)
2167c478bd9Sstevel@tonic-gate 		    != sizeof (tod32))
2177c478bd9Sstevel@tonic-gate 			return;
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&tod, &tod32);
2207c478bd9Sstevel@tonic-gate 	}
2217c478bd9Sstevel@tonic-gate 
2223b862e9aSRoger A. Faulkner 	prtimeval(pri, "time: ", &tod);
2237c478bd9Sstevel@tonic-gate }
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate void
show_itimerval(private_t * pri,long offset,const char * name)2267c478bd9Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name)
2277c478bd9Sstevel@tonic-gate {
2287c478bd9Sstevel@tonic-gate 	struct itimerval itimerval;
2297c478bd9Sstevel@tonic-gate 
2303b862e9aSRoger A. Faulkner 	if (offset == 0)
2317c478bd9Sstevel@tonic-gate 		return;
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
2347c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &itimerval, sizeof (itimerval), offset)
2357c478bd9Sstevel@tonic-gate 		    != sizeof (itimerval))
2367c478bd9Sstevel@tonic-gate 			return;
2377c478bd9Sstevel@tonic-gate 	} else {
2387c478bd9Sstevel@tonic-gate 		struct itimerval32 itimerval32;
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset)
2417c478bd9Sstevel@tonic-gate 		    != sizeof (itimerval32))
2427c478bd9Sstevel@tonic-gate 			return;
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate 		ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32);
2457c478bd9Sstevel@tonic-gate 	}
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate 	(void) printf(
2487c478bd9Sstevel@tonic-gate 	    "%s\t%s:  interval: %4ld.%6.6ld sec  value: %4ld.%6.6ld sec\n",
2497c478bd9Sstevel@tonic-gate 	    pri->pname,
2507c478bd9Sstevel@tonic-gate 	    name,
2517c478bd9Sstevel@tonic-gate 	    itimerval.it_interval.tv_sec,
2527c478bd9Sstevel@tonic-gate 	    itimerval.it_interval.tv_usec,
2537c478bd9Sstevel@tonic-gate 	    itimerval.it_value.tv_sec,
2547c478bd9Sstevel@tonic-gate 	    itimerval.it_value.tv_usec);
2557c478bd9Sstevel@tonic-gate }
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate void
show_timeval(private_t * pri,long offset,const char * name)2587c478bd9Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name)
2597c478bd9Sstevel@tonic-gate {
2607c478bd9Sstevel@tonic-gate 	struct timeval timeval;
2617c478bd9Sstevel@tonic-gate 
2623b862e9aSRoger A. Faulkner 	if (offset == 0)
2637c478bd9Sstevel@tonic-gate 		return;
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
2667c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timeval, sizeof (timeval), offset)
2677c478bd9Sstevel@tonic-gate 		    != sizeof (timeval))
2687c478bd9Sstevel@tonic-gate 			return;
2697c478bd9Sstevel@tonic-gate 	} else {
2707c478bd9Sstevel@tonic-gate 		struct timeval32 timeval32;
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timeval32, sizeof (timeval32), offset)
2737c478bd9Sstevel@tonic-gate 		    != sizeof (timeval32))
2747c478bd9Sstevel@tonic-gate 			return;
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32);
2777c478bd9Sstevel@tonic-gate 	}
2787c478bd9Sstevel@tonic-gate 
2797c478bd9Sstevel@tonic-gate 	(void) printf(
2807c478bd9Sstevel@tonic-gate 	    "%s\t%s: %ld.%6.6ld sec\n",
2817c478bd9Sstevel@tonic-gate 	    pri->pname,
2827c478bd9Sstevel@tonic-gate 	    name,
2837c478bd9Sstevel@tonic-gate 	    timeval.tv_sec,
2847c478bd9Sstevel@tonic-gate 	    timeval.tv_usec);
2857c478bd9Sstevel@tonic-gate }
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate void
show_timestruc(private_t * pri,long offset,const char * name)2887c478bd9Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name)
2897c478bd9Sstevel@tonic-gate {
2907c478bd9Sstevel@tonic-gate 	timestruc_t timestruc;
2917c478bd9Sstevel@tonic-gate 
2923b862e9aSRoger A. Faulkner 	if (offset == 0)
2937c478bd9Sstevel@tonic-gate 		return;
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
2967c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timestruc, sizeof (timestruc), offset)
2977c478bd9Sstevel@tonic-gate 		    != sizeof (timestruc))
2987c478bd9Sstevel@tonic-gate 			return;
2997c478bd9Sstevel@tonic-gate 	} else {
3007c478bd9Sstevel@tonic-gate 		timestruc32_t timestruc32;
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &timestruc32, sizeof (timestruc32), offset)
3037c478bd9Sstevel@tonic-gate 		    != sizeof (timestruc32))
3047c478bd9Sstevel@tonic-gate 			return;
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate 		TIMESPEC32_TO_TIMESPEC(&timestruc, &timestruc32);
3077c478bd9Sstevel@tonic-gate 	}
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate 	(void) printf(
3107c478bd9Sstevel@tonic-gate 	    "%s\t%s: %ld.%9.9ld sec\n",
3117c478bd9Sstevel@tonic-gate 	    pri->pname,
3127c478bd9Sstevel@tonic-gate 	    name,
3137c478bd9Sstevel@tonic-gate 	    timestruc.tv_sec,
3147c478bd9Sstevel@tonic-gate 	    timestruc.tv_nsec);
3157c478bd9Sstevel@tonic-gate }
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate void
show_stime(private_t * pri)3187c478bd9Sstevel@tonic-gate show_stime(private_t *pri)
3197c478bd9Sstevel@tonic-gate {
3207c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 1) {
3217c478bd9Sstevel@tonic-gate 		/* print new system time */
3227c478bd9Sstevel@tonic-gate 		prtime(pri, "systime = ", (time_t)pri->sys_args[0]);
3237c478bd9Sstevel@tonic-gate 	}
3247c478bd9Sstevel@tonic-gate }
3257c478bd9Sstevel@tonic-gate 
3267c478bd9Sstevel@tonic-gate void
show_times(private_t * pri)3277c478bd9Sstevel@tonic-gate show_times(private_t *pri)
3287c478bd9Sstevel@tonic-gate {
3297c478bd9Sstevel@tonic-gate 	long hz = sysconf(_SC_CLK_TCK);
3307c478bd9Sstevel@tonic-gate 	long offset;
3317c478bd9Sstevel@tonic-gate 	struct tms tms;
3327c478bd9Sstevel@tonic-gate 
33327aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
3347c478bd9Sstevel@tonic-gate 		return;
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
3377c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tms, sizeof (tms), offset)
3387c478bd9Sstevel@tonic-gate 		    != sizeof (tms))
3397c478bd9Sstevel@tonic-gate 			return;
3407c478bd9Sstevel@tonic-gate 	} else {
3417c478bd9Sstevel@tonic-gate 		struct tms32 tms32;
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &tms32, sizeof (tms32), offset)
3447c478bd9Sstevel@tonic-gate 		    != sizeof (tms32))
3457c478bd9Sstevel@tonic-gate 			return;
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate 		/*
3487c478bd9Sstevel@tonic-gate 		 * This looks a bit odd (since the values are actually
3497c478bd9Sstevel@tonic-gate 		 * signed), but we need to suppress sign extension to
3507c478bd9Sstevel@tonic-gate 		 * preserve compatibility (we've always printed these
3517c478bd9Sstevel@tonic-gate 		 * numbers as unsigned quantities).
3527c478bd9Sstevel@tonic-gate 		 */
3537c478bd9Sstevel@tonic-gate 		tms.tms_utime = (unsigned)tms32.tms_utime;
3547c478bd9Sstevel@tonic-gate 		tms.tms_stime = (unsigned)tms32.tms_stime;
3557c478bd9Sstevel@tonic-gate 		tms.tms_cutime = (unsigned)tms32.tms_cutime;
3567c478bd9Sstevel@tonic-gate 		tms.tms_cstime = (unsigned)tms32.tms_cstime;
3577c478bd9Sstevel@tonic-gate 	}
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate 	(void) printf(
3607c478bd9Sstevel@tonic-gate 	    "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
3617c478bd9Sstevel@tonic-gate 	    pri->pname,
3627c478bd9Sstevel@tonic-gate 	    tms.tms_utime,
3637c478bd9Sstevel@tonic-gate 	    tms.tms_stime,
3647c478bd9Sstevel@tonic-gate 	    tms.tms_cutime,
3657c478bd9Sstevel@tonic-gate 	    tms.tms_cstime,
3667c478bd9Sstevel@tonic-gate 	    hz);
3677c478bd9Sstevel@tonic-gate }
3687c478bd9Sstevel@tonic-gate 
3697c478bd9Sstevel@tonic-gate void
show_uname(private_t * pri,long offset)3707c478bd9Sstevel@tonic-gate show_uname(private_t *pri, long offset)
3717c478bd9Sstevel@tonic-gate {
3727c478bd9Sstevel@tonic-gate 	/*
3737c478bd9Sstevel@tonic-gate 	 * Old utsname buffer (no longer accessible in <sys/utsname.h>).
3747c478bd9Sstevel@tonic-gate 	 */
3757c478bd9Sstevel@tonic-gate 	struct {
3767c478bd9Sstevel@tonic-gate 		char	sysname[9];
3777c478bd9Sstevel@tonic-gate 		char	nodename[9];
3787c478bd9Sstevel@tonic-gate 		char	release[9];
3797c478bd9Sstevel@tonic-gate 		char	version[9];
3807c478bd9Sstevel@tonic-gate 		char	machine[9];
3817c478bd9Sstevel@tonic-gate 	} ubuf;
3827c478bd9Sstevel@tonic-gate 
38327aa4812SToomas Soome 	if (offset != 0 &&
3847c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
3857c478bd9Sstevel@tonic-gate 		(void) printf(
3867c478bd9Sstevel@tonic-gate 		    "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
3877c478bd9Sstevel@tonic-gate 		    pri->pname,
3887c478bd9Sstevel@tonic-gate 		    ubuf.sysname,
3897c478bd9Sstevel@tonic-gate 		    ubuf.nodename,
3907c478bd9Sstevel@tonic-gate 		    ubuf.release,
3917c478bd9Sstevel@tonic-gate 		    ubuf.version,
3927c478bd9Sstevel@tonic-gate 		    ubuf.machine);
3937c478bd9Sstevel@tonic-gate 	}
3947c478bd9Sstevel@tonic-gate }
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
3977c478bd9Sstevel@tonic-gate void
show_ustat(private_t * pri,long offset)3987c478bd9Sstevel@tonic-gate show_ustat(private_t *pri, long offset)
3997c478bd9Sstevel@tonic-gate {
4007c478bd9Sstevel@tonic-gate 	struct ustat ubuf;
4017c478bd9Sstevel@tonic-gate 
40227aa4812SToomas Soome 	if (offset != 0 &&
4037c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4047c478bd9Sstevel@tonic-gate 		(void) printf(
4057c478bd9Sstevel@tonic-gate 		    "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
4067c478bd9Sstevel@tonic-gate 		    pri->pname,
4077c478bd9Sstevel@tonic-gate 		    ubuf.f_tfree,
4087c478bd9Sstevel@tonic-gate 		    ubuf.f_tinode,
4097c478bd9Sstevel@tonic-gate 		    ubuf.f_fname,
4107c478bd9Sstevel@tonic-gate 		    ubuf.f_fpack);
4117c478bd9Sstevel@tonic-gate 	}
4127c478bd9Sstevel@tonic-gate }
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate void
show_ustat32(private_t * pri,long offset)4157c478bd9Sstevel@tonic-gate show_ustat32(private_t *pri, long offset)
4167c478bd9Sstevel@tonic-gate {
4177c478bd9Sstevel@tonic-gate 	struct ustat32 ubuf;
4187c478bd9Sstevel@tonic-gate 
41927aa4812SToomas Soome 	if (offset != 0 &&
4207c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4217c478bd9Sstevel@tonic-gate 		(void) printf(
4227c478bd9Sstevel@tonic-gate 		    "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
4237c478bd9Sstevel@tonic-gate 		    pri->pname,
4247c478bd9Sstevel@tonic-gate 		    ubuf.f_tfree,
4257c478bd9Sstevel@tonic-gate 		    ubuf.f_tinode,
4267c478bd9Sstevel@tonic-gate 		    ubuf.f_fname,
4277c478bd9Sstevel@tonic-gate 		    ubuf.f_fpack);
4287c478bd9Sstevel@tonic-gate 	}
4297c478bd9Sstevel@tonic-gate }
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate void
show_fusers(private_t * pri,long offset,long nproc)4327c478bd9Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc)
4337c478bd9Sstevel@tonic-gate {
4347c478bd9Sstevel@tonic-gate 	f_user_t fubuf;
4357c478bd9Sstevel@tonic-gate 	int serial = (nproc > 4);
4367c478bd9Sstevel@tonic-gate 
4373b862e9aSRoger A. Faulkner 	if (offset == 0)
4387c478bd9Sstevel@tonic-gate 		return;
4397c478bd9Sstevel@tonic-gate 
4407c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
4417c478bd9Sstevel@tonic-gate 	if (serial)
4427c478bd9Sstevel@tonic-gate 		Eserialize();
4437c478bd9Sstevel@tonic-gate 
4447c478bd9Sstevel@tonic-gate 	while (nproc > 0 &&
4457c478bd9Sstevel@tonic-gate 	    Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) {
446f48205beScasper 		(void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
4477c478bd9Sstevel@tonic-gate 		    pri->pname,
4487c478bd9Sstevel@tonic-gate 		    (int)fubuf.fu_pid,
449f48205beScasper 		    fubuf.fu_uid,
4507c478bd9Sstevel@tonic-gate 		    fuflags(pri, fubuf.fu_flags));
4517c478bd9Sstevel@tonic-gate 		nproc--;
4527c478bd9Sstevel@tonic-gate 		offset += sizeof (fubuf);
4537c478bd9Sstevel@tonic-gate 	}
4547c478bd9Sstevel@tonic-gate 
4557c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
4567c478bd9Sstevel@tonic-gate 	if (serial)
4577c478bd9Sstevel@tonic-gate 		Xserialize();
4587c478bd9Sstevel@tonic-gate }
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate void
show_utssys(private_t * pri,long r0)4617c478bd9Sstevel@tonic-gate show_utssys(private_t *pri, long r0)
4627c478bd9Sstevel@tonic-gate {
4637c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
4647c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
4657c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
4667c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
4677c478bd9Sstevel@tonic-gate 			break;
4687c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
4697c478bd9Sstevel@tonic-gate 			show_ustat(pri, (long)pri->sys_args[0]);
4707c478bd9Sstevel@tonic-gate 			break;
4717c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
4727c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
4737c478bd9Sstevel@tonic-gate 			break;
4747c478bd9Sstevel@tonic-gate 		}
4757c478bd9Sstevel@tonic-gate 	}
4767c478bd9Sstevel@tonic-gate }
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate void
show_utssys32(private_t * pri,long r0)4797c478bd9Sstevel@tonic-gate show_utssys32(private_t *pri, long r0)
4807c478bd9Sstevel@tonic-gate {
4817c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
4827c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
4837c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
4847c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
4857c478bd9Sstevel@tonic-gate 			break;
4867c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
4877c478bd9Sstevel@tonic-gate 			show_ustat32(pri, (long)pri->sys_args[0]);
4887c478bd9Sstevel@tonic-gate 			break;
4897c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
4907c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
4917c478bd9Sstevel@tonic-gate 			break;
4927c478bd9Sstevel@tonic-gate 		}
4937c478bd9Sstevel@tonic-gate 	}
4947c478bd9Sstevel@tonic-gate }
4957c478bd9Sstevel@tonic-gate 
4967c478bd9Sstevel@tonic-gate void
show_cladm(private_t * pri,int code,int function,long offset)4977c478bd9Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset)
4987c478bd9Sstevel@tonic-gate {
4997c478bd9Sstevel@tonic-gate 	int	arg;
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate 	switch (code) {
5027c478bd9Sstevel@tonic-gate 	case CL_INITIALIZE:
5037c478bd9Sstevel@tonic-gate 		switch (function) {
5047c478bd9Sstevel@tonic-gate 		case CL_GET_BOOTFLAG:
5057c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
5067c478bd9Sstevel@tonic-gate 			    == sizeof (arg)) {
5077c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_CONFIGURED)
5087c478bd9Sstevel@tonic-gate 					(void) printf("%s\tbootflags="
5097c478bd9Sstevel@tonic-gate 					    "CLUSTER_CONFIGURED", pri->pname);
5107c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_BOOTED)
5117c478bd9Sstevel@tonic-gate 					(void) printf("|CLUSTER_BOOTED\n");
5127c478bd9Sstevel@tonic-gate 			}
5137c478bd9Sstevel@tonic-gate 			break;
5147c478bd9Sstevel@tonic-gate 		}
5157c478bd9Sstevel@tonic-gate 		break;
5167c478bd9Sstevel@tonic-gate 	case CL_CONFIG:
5177c478bd9Sstevel@tonic-gate 		switch (function) {
5187c478bd9Sstevel@tonic-gate 		case CL_NODEID:
5197c478bd9Sstevel@tonic-gate 		case CL_HIGHEST_NODEID:
5207c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
5217c478bd9Sstevel@tonic-gate 			    == sizeof (arg))
5227c478bd9Sstevel@tonic-gate 				(void) printf("%s\tnodeid=%d\n",
5237c478bd9Sstevel@tonic-gate 				    pri->pname, arg);
5247c478bd9Sstevel@tonic-gate 		}
5257c478bd9Sstevel@tonic-gate 		break;
5267c478bd9Sstevel@tonic-gate 	}
5277c478bd9Sstevel@tonic-gate }
5287c478bd9Sstevel@tonic-gate 
5297c478bd9Sstevel@tonic-gate #define	ALL_LOCK_TYPES						\
530883492d5Sraf 	(USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE |	\
531883492d5Sraf 	LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST |	\
532883492d5Sraf 	USYNC_PROCESS_ROBUST)
5337c478bd9Sstevel@tonic-gate 
5347c478bd9Sstevel@tonic-gate /* return cv and mutex types */
5357c478bd9Sstevel@tonic-gate const char *
synch_type(private_t * pri,uint_t type)5367c478bd9Sstevel@tonic-gate synch_type(private_t *pri, uint_t type)
5377c478bd9Sstevel@tonic-gate {
5387c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
5397c478bd9Sstevel@tonic-gate 
5407c478bd9Sstevel@tonic-gate 	if (type & USYNC_PROCESS)
5417c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_PROCESS");
5427c478bd9Sstevel@tonic-gate 	else
5437c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_THREAD");
5447c478bd9Sstevel@tonic-gate 
5457c478bd9Sstevel@tonic-gate 	if (type & LOCK_ERRORCHECK)
5467c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_ERRORCHECK");
5477c478bd9Sstevel@tonic-gate 	if (type & LOCK_RECURSIVE)
5487c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_RECURSIVE");
5497c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_INHERIT)
5507c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_INHERIT");
5517c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_PROTECT)
5527c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_PROTECT");
553883492d5Sraf 	if (type & LOCK_ROBUST)
554883492d5Sraf 		(void) strcat(str, "|LOCK_ROBUST");
555883492d5Sraf 	if (type & USYNC_PROCESS_ROBUST)
556883492d5Sraf 		(void) strcat(str, "|USYNC_PROCESS_ROBUST");
5577c478bd9Sstevel@tonic-gate 
5587c478bd9Sstevel@tonic-gate 	if ((type &= ~ALL_LOCK_TYPES) != 0)
5597c478bd9Sstevel@tonic-gate 		(void) sprintf(str + strlen(str), "|0x%.4X", type);
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate 	return ((const char *)str);
5627c478bd9Sstevel@tonic-gate }
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate void
show_mutex(private_t * pri,long offset)5657c478bd9Sstevel@tonic-gate show_mutex(private_t *pri, long offset)
5667c478bd9Sstevel@tonic-gate {
5677c478bd9Sstevel@tonic-gate 	lwp_mutex_t mutex;
5687c478bd9Sstevel@tonic-gate 
5697c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) {
5707c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmutex type: %s\n",
5717c478bd9Sstevel@tonic-gate 		    pri->pname,
5727c478bd9Sstevel@tonic-gate 		    synch_type(pri, mutex.mutex_type));
5737c478bd9Sstevel@tonic-gate 	}
5747c478bd9Sstevel@tonic-gate }
5757c478bd9Sstevel@tonic-gate 
5767c478bd9Sstevel@tonic-gate void
show_condvar(private_t * pri,long offset)5777c478bd9Sstevel@tonic-gate show_condvar(private_t *pri, long offset)
5787c478bd9Sstevel@tonic-gate {
5797c478bd9Sstevel@tonic-gate 	lwp_cond_t condvar;
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &condvar, sizeof (condvar), offset)
5827c478bd9Sstevel@tonic-gate 	    == sizeof (condvar)) {
5837c478bd9Sstevel@tonic-gate 		(void) printf("%s\tcondvar type: %s\n",
5847c478bd9Sstevel@tonic-gate 		    pri->pname,
5857c478bd9Sstevel@tonic-gate 		    synch_type(pri, condvar.cond_type));
5867c478bd9Sstevel@tonic-gate 	}
5877c478bd9Sstevel@tonic-gate }
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate void
show_sema(private_t * pri,long offset)5907c478bd9Sstevel@tonic-gate show_sema(private_t *pri, long offset)
5917c478bd9Sstevel@tonic-gate {
5927c478bd9Sstevel@tonic-gate 	lwp_sema_t sema;
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) {
5957c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsema type: %s  count = %u\n",
5967c478bd9Sstevel@tonic-gate 		    pri->pname,
5977c478bd9Sstevel@tonic-gate 		    synch_type(pri, sema.sema_type),
5987c478bd9Sstevel@tonic-gate 		    sema.sema_count);
5997c478bd9Sstevel@tonic-gate 	}
6007c478bd9Sstevel@tonic-gate }
6017c478bd9Sstevel@tonic-gate 
6027c478bd9Sstevel@tonic-gate void
show_rwlock(private_t * pri,long offset)6037c478bd9Sstevel@tonic-gate show_rwlock(private_t *pri, long offset)
6047c478bd9Sstevel@tonic-gate {
6057c478bd9Sstevel@tonic-gate 	lwp_rwlock_t rwlock;
6067c478bd9Sstevel@tonic-gate 
6077c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) {
6087c478bd9Sstevel@tonic-gate 		(void) printf("%s\trwlock type: %s  readers = %d\n",
6097c478bd9Sstevel@tonic-gate 		    pri->pname,
6107c478bd9Sstevel@tonic-gate 		    synch_type(pri, rwlock.rwlock_type),
6117c478bd9Sstevel@tonic-gate 		    rwlock.rwlock_readers);
6127c478bd9Sstevel@tonic-gate 	}
6137c478bd9Sstevel@tonic-gate }
6147c478bd9Sstevel@tonic-gate 
6157c478bd9Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */
6167c478bd9Sstevel@tonic-gate char *
show_char(char * buf,int c)6177c478bd9Sstevel@tonic-gate show_char(char *buf, int c)
6187c478bd9Sstevel@tonic-gate {
6197c478bd9Sstevel@tonic-gate 	const char *fmt;
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate 	if (c >= ' ' && c < 0177)
6227c478bd9Sstevel@tonic-gate 		fmt = "'%c'";
6237c478bd9Sstevel@tonic-gate 	else
6247c478bd9Sstevel@tonic-gate 		fmt = "%.3o";
6257c478bd9Sstevel@tonic-gate 
6267c478bd9Sstevel@tonic-gate 	(void) sprintf(buf, fmt, c&0xff);
6277c478bd9Sstevel@tonic-gate 	return (buf);
6287c478bd9Sstevel@tonic-gate }
6297c478bd9Sstevel@tonic-gate 
6307c478bd9Sstevel@tonic-gate void
show_termio(private_t * pri,long offset)6317c478bd9Sstevel@tonic-gate show_termio(private_t *pri, long offset)
6327c478bd9Sstevel@tonic-gate {
6337c478bd9Sstevel@tonic-gate 	struct termio termio;
6347c478bd9Sstevel@tonic-gate 	char cbuf[8];
6357c478bd9Sstevel@tonic-gate 	int i;
6367c478bd9Sstevel@tonic-gate 
6377c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) {
6387c478bd9Sstevel@tonic-gate 		(void) printf(
6397c478bd9Sstevel@tonic-gate 		"%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
6407c478bd9Sstevel@tonic-gate 		    pri->pname,
6417c478bd9Sstevel@tonic-gate 		    termio.c_iflag,
6427c478bd9Sstevel@tonic-gate 		    termio.c_oflag,
6437c478bd9Sstevel@tonic-gate 		    termio.c_cflag,
6447c478bd9Sstevel@tonic-gate 		    termio.c_lflag,
6457c478bd9Sstevel@tonic-gate 		    termio.c_line);
6467c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
6477c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCC; i++)
6487c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
6497c478bd9Sstevel@tonic-gate 			    show_char(cbuf, (int)termio.c_cc[i]));
6507c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
6517c478bd9Sstevel@tonic-gate 	}
6527c478bd9Sstevel@tonic-gate }
6537c478bd9Sstevel@tonic-gate 
6547c478bd9Sstevel@tonic-gate void
show_termios(private_t * pri,long offset)6557c478bd9Sstevel@tonic-gate show_termios(private_t *pri, long offset)
6567c478bd9Sstevel@tonic-gate {
6577c478bd9Sstevel@tonic-gate 	struct termios termios;
6587c478bd9Sstevel@tonic-gate 	char cbuf[8];
6597c478bd9Sstevel@tonic-gate 	int i;
6607c478bd9Sstevel@tonic-gate 
6617c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termios, sizeof (termios), offset)
6627c478bd9Sstevel@tonic-gate 	    == sizeof (termios)) {
6637c478bd9Sstevel@tonic-gate 		(void) printf(
6647c478bd9Sstevel@tonic-gate 		    "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
6657c478bd9Sstevel@tonic-gate 		    pri->pname,
6667c478bd9Sstevel@tonic-gate 		    termios.c_iflag,
6677c478bd9Sstevel@tonic-gate 		    termios.c_oflag,
6687c478bd9Sstevel@tonic-gate 		    termios.c_cflag,
6697c478bd9Sstevel@tonic-gate 		    termios.c_lflag);
6707c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
6717c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCCS; i++) {
6727c478bd9Sstevel@tonic-gate 			if (i == NCC)	/* show new chars on new line */
6737c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t\t", pri->pname);
6747c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
6757c478bd9Sstevel@tonic-gate 			    show_char(cbuf, (int)termios.c_cc[i]));
6767c478bd9Sstevel@tonic-gate 		}
6777c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
6787c478bd9Sstevel@tonic-gate 	}
6797c478bd9Sstevel@tonic-gate }
6807c478bd9Sstevel@tonic-gate 
6817c478bd9Sstevel@tonic-gate void
show_termiox(private_t * pri,long offset)6827c478bd9Sstevel@tonic-gate show_termiox(private_t *pri, long offset)
6837c478bd9Sstevel@tonic-gate {
6847c478bd9Sstevel@tonic-gate 	struct termiox termiox;
6857c478bd9Sstevel@tonic-gate 	int i;
6867c478bd9Sstevel@tonic-gate 
6877c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termiox, sizeof (termiox), offset)
6887c478bd9Sstevel@tonic-gate 	    == sizeof (termiox)) {
6897c478bd9Sstevel@tonic-gate 		(void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
6907c478bd9Sstevel@tonic-gate 		    pri->pname,
6917c478bd9Sstevel@tonic-gate 		    termiox.x_hflag,
6927c478bd9Sstevel@tonic-gate 		    termiox.x_cflag,
6937c478bd9Sstevel@tonic-gate 		    termiox.x_rflag[0]);
6947c478bd9Sstevel@tonic-gate 		for (i = 1; i < NFF; i++)
6957c478bd9Sstevel@tonic-gate 			(void) printf(",0%.3o", termiox.x_rflag[i]);
6967c478bd9Sstevel@tonic-gate 		(void) printf(" sflag=0%.3o\n",
6977c478bd9Sstevel@tonic-gate 		    termiox.x_sflag);
6987c478bd9Sstevel@tonic-gate 	}
6997c478bd9Sstevel@tonic-gate }
7007c478bd9Sstevel@tonic-gate 
7017c478bd9Sstevel@tonic-gate void
show_sgttyb(private_t * pri,long offset)7027c478bd9Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset)
7037c478bd9Sstevel@tonic-gate {
7047c478bd9Sstevel@tonic-gate 	struct sgttyb sgttyb;
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) {
7077c478bd9Sstevel@tonic-gate 		char erase[8];
7087c478bd9Sstevel@tonic-gate 		char kill[8];
7097c478bd9Sstevel@tonic-gate 
7107c478bd9Sstevel@tonic-gate 		(void) printf(
7117c478bd9Sstevel@tonic-gate 		"%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
7127c478bd9Sstevel@tonic-gate 		    pri->pname,
7137c478bd9Sstevel@tonic-gate 		    sgttyb.sg_ispeed&0xff,
7147c478bd9Sstevel@tonic-gate 		    sgttyb.sg_ospeed&0xff,
7157c478bd9Sstevel@tonic-gate 		    show_char(erase, sgttyb.sg_erase),
7167c478bd9Sstevel@tonic-gate 		    show_char(kill, sgttyb.sg_kill),
7177c478bd9Sstevel@tonic-gate 		    sgttyb.sg_flags);
7187c478bd9Sstevel@tonic-gate 	}
7197c478bd9Sstevel@tonic-gate }
7207c478bd9Sstevel@tonic-gate 
7217c478bd9Sstevel@tonic-gate void
show_ltchars(private_t * pri,long offset)7227c478bd9Sstevel@tonic-gate show_ltchars(private_t *pri, long offset)
7237c478bd9Sstevel@tonic-gate {
7247c478bd9Sstevel@tonic-gate 	struct ltchars ltchars;
7257c478bd9Sstevel@tonic-gate 	char *p;
7267c478bd9Sstevel@tonic-gate 	char cbuf[8];
7277c478bd9Sstevel@tonic-gate 	int i;
7287c478bd9Sstevel@tonic-gate 
7297c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &ltchars, sizeof (ltchars), offset)
7307c478bd9Sstevel@tonic-gate 	    == sizeof (ltchars)) {
7317c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
7327c478bd9Sstevel@tonic-gate 		for (p = (char *)&ltchars, i = 0; i < sizeof (ltchars); i++)
7337c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
7347c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
7357c478bd9Sstevel@tonic-gate 	}
7367c478bd9Sstevel@tonic-gate }
7377c478bd9Sstevel@tonic-gate 
7387c478bd9Sstevel@tonic-gate void
show_tchars(private_t * pri,long offset)7397c478bd9Sstevel@tonic-gate show_tchars(private_t *pri, long offset)
7407c478bd9Sstevel@tonic-gate {
7417c478bd9Sstevel@tonic-gate 	struct tchars tchars;
7427c478bd9Sstevel@tonic-gate 	char *p;
7437c478bd9Sstevel@tonic-gate 	char cbuf[8];
7447c478bd9Sstevel@tonic-gate 	int i;
7457c478bd9Sstevel@tonic-gate 
7467c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) {
7477c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
7487c478bd9Sstevel@tonic-gate 		for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++)
7497c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
7507c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
7517c478bd9Sstevel@tonic-gate 	}
7527c478bd9Sstevel@tonic-gate }
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate void
show_termcb(private_t * pri,long offset)7557c478bd9Sstevel@tonic-gate show_termcb(private_t *pri, long offset)
7567c478bd9Sstevel@tonic-gate {
7577c478bd9Sstevel@tonic-gate 	struct termcb termcb;
7587c478bd9Sstevel@tonic-gate 
7597c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) {
7607c478bd9Sstevel@tonic-gate 		(void) printf(
7617c478bd9Sstevel@tonic-gate 		    "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
7627c478bd9Sstevel@tonic-gate 		    pri->pname,
7637c478bd9Sstevel@tonic-gate 		    termcb.st_flgs&0xff,
7647c478bd9Sstevel@tonic-gate 		    termcb.st_termt&0xff,
7657c478bd9Sstevel@tonic-gate 		    termcb.st_crow&0xff,
7667c478bd9Sstevel@tonic-gate 		    termcb.st_ccol&0xff,
7677c478bd9Sstevel@tonic-gate 		    termcb.st_vrow&0xff,
7687c478bd9Sstevel@tonic-gate 		    termcb.st_lrow&0xff);
7697c478bd9Sstevel@tonic-gate 	}
7707c478bd9Sstevel@tonic-gate }
7717c478bd9Sstevel@tonic-gate 
7727c478bd9Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */
7737c478bd9Sstevel@tonic-gate void
show_strint(private_t * pri,int code,long offset)7747c478bd9Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset)
7757c478bd9Sstevel@tonic-gate {
7767c478bd9Sstevel@tonic-gate 	int val;
7777c478bd9Sstevel@tonic-gate 
7787c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
7797c478bd9Sstevel@tonic-gate 		const char *s = NULL;
7807c478bd9Sstevel@tonic-gate 
7817c478bd9Sstevel@tonic-gate 		switch (code) {		/* interpret these symbolically */
7827c478bd9Sstevel@tonic-gate 		case I_GRDOPT:
7837c478bd9Sstevel@tonic-gate 			s = strrdopt(val);
7847c478bd9Sstevel@tonic-gate 			break;
7857c478bd9Sstevel@tonic-gate 		case I_GETSIG:
7867c478bd9Sstevel@tonic-gate 			s = strevents(pri, val);
7877c478bd9Sstevel@tonic-gate 			break;
7887c478bd9Sstevel@tonic-gate 		case TIOCFLUSH:
7897c478bd9Sstevel@tonic-gate 			s = tiocflush(pri, val);
7907c478bd9Sstevel@tonic-gate 			break;
7917c478bd9Sstevel@tonic-gate 		}
7927c478bd9Sstevel@tonic-gate 
7937c478bd9Sstevel@tonic-gate 		if (s == NULL)
7947c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %d\n",
7957c478bd9Sstevel@tonic-gate 			    pri->pname, offset, val);
7967c478bd9Sstevel@tonic-gate 		else
7977c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %s\n",
7987c478bd9Sstevel@tonic-gate 			    pri->pname, offset, s);
7997c478bd9Sstevel@tonic-gate 	}
8007c478bd9Sstevel@tonic-gate }
8017c478bd9Sstevel@tonic-gate 
8027c478bd9Sstevel@tonic-gate void
show_strioctl(private_t * pri,long offset)8037c478bd9Sstevel@tonic-gate show_strioctl(private_t *pri, long offset)
8047c478bd9Sstevel@tonic-gate {
8057c478bd9Sstevel@tonic-gate 	struct strioctl strioctl;
8067c478bd9Sstevel@tonic-gate 
8077c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8087c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
8097c478bd9Sstevel@tonic-gate 		(void) printf(
8107c478bd9Sstevel@tonic-gate 		    "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
8117c478bd9Sstevel@tonic-gate 		    pri->pname,
8127c478bd9Sstevel@tonic-gate 		    ioctlname(pri, strioctl.ic_cmd),
8137c478bd9Sstevel@tonic-gate 		    strioctl.ic_timout,
8147c478bd9Sstevel@tonic-gate 		    strioctl.ic_len,
8157c478bd9Sstevel@tonic-gate 		    (long)strioctl.ic_dp);
8167c478bd9Sstevel@tonic-gate 
8177c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
8187c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
8197c478bd9Sstevel@tonic-gate 			    (long)strioctl.ic_dp);
8207c478bd9Sstevel@tonic-gate 		--pri->recur;
8217c478bd9Sstevel@tonic-gate 	}
8227c478bd9Sstevel@tonic-gate }
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate void
show_strioctl32(private_t * pri,long offset)8257c478bd9Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset)
8267c478bd9Sstevel@tonic-gate {
8277c478bd9Sstevel@tonic-gate 	struct strioctl32 strioctl;
8287c478bd9Sstevel@tonic-gate 
8297c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8307c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
8317c478bd9Sstevel@tonic-gate 		(void) printf(
8327c478bd9Sstevel@tonic-gate 		    "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
8337c478bd9Sstevel@tonic-gate 		    pri->pname,
8347c478bd9Sstevel@tonic-gate 		    ioctlname(pri, strioctl.ic_cmd),
8357c478bd9Sstevel@tonic-gate 		    strioctl.ic_timout,
8367c478bd9Sstevel@tonic-gate 		    strioctl.ic_len,
8377c478bd9Sstevel@tonic-gate 		    (long)strioctl.ic_dp);
8387c478bd9Sstevel@tonic-gate 
8397c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
8407c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
8417c478bd9Sstevel@tonic-gate 			    (long)strioctl.ic_dp);
8427c478bd9Sstevel@tonic-gate 		--pri->recur;
8437c478bd9Sstevel@tonic-gate 	}
8447c478bd9Sstevel@tonic-gate }
8457c478bd9Sstevel@tonic-gate 
8467c478bd9Sstevel@tonic-gate void
print_strbuf(private_t * pri,struct strbuf * sp,const char * name,int dump)8477c478bd9Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump)
8487c478bd9Sstevel@tonic-gate {
8497c478bd9Sstevel@tonic-gate 	(void) printf(
8507c478bd9Sstevel@tonic-gate 	    "%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
8517c478bd9Sstevel@tonic-gate 	    pri->pname,
8527c478bd9Sstevel@tonic-gate 	    name,
8537c478bd9Sstevel@tonic-gate 	    sp->maxlen,
8547c478bd9Sstevel@tonic-gate 	    sp->len,
8557c478bd9Sstevel@tonic-gate 	    (long)sp->buf);
8567c478bd9Sstevel@tonic-gate 	/*
8577c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
8587c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
8597c478bd9Sstevel@tonic-gate 	 */
8607c478bd9Sstevel@tonic-gate 	if (sp->buf == NULL || sp->len <= 0)
8617c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
8627c478bd9Sstevel@tonic-gate 	else {
8637c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
8647c478bd9Sstevel@tonic-gate 		char buffer[8];
8657c478bd9Sstevel@tonic-gate 		char obuf[40];
8667c478bd9Sstevel@tonic-gate 
8677c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
8687c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
8697c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
8707c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
8717c478bd9Sstevel@tonic-gate 			    (nb == sp->len)?
8727c478bd9Sstevel@tonic-gate 			    (const char *)"\"" : (const char *)"\"..");
8737c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
8747c478bd9Sstevel@tonic-gate 		}
8757c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
8767c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
8777c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
8787c478bd9Sstevel@tonic-gate 	}
8797c478bd9Sstevel@tonic-gate }
8807c478bd9Sstevel@tonic-gate 
8817c478bd9Sstevel@tonic-gate void
print_strbuf32(private_t * pri,struct strbuf32 * sp,const char * name,int dump)8827c478bd9Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump)
8837c478bd9Sstevel@tonic-gate {
8847c478bd9Sstevel@tonic-gate 	(void) printf(
8857c478bd9Sstevel@tonic-gate 	    "%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
8867c478bd9Sstevel@tonic-gate 	    pri->pname,
8877c478bd9Sstevel@tonic-gate 	    name,
8887c478bd9Sstevel@tonic-gate 	    sp->maxlen,
8897c478bd9Sstevel@tonic-gate 	    sp->len,
8907c478bd9Sstevel@tonic-gate 	    (long)sp->buf);
8917c478bd9Sstevel@tonic-gate 	/*
8927c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
8937c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
8947c478bd9Sstevel@tonic-gate 	 */
89527aa4812SToomas Soome 	if (sp->buf == 0 || sp->len <= 0)
8967c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
8977c478bd9Sstevel@tonic-gate 	else {
8987c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
8997c478bd9Sstevel@tonic-gate 		char buffer[8];
9007c478bd9Sstevel@tonic-gate 		char obuf[40];
9017c478bd9Sstevel@tonic-gate 
9027c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
9037c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
9047c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
9057c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
9067c478bd9Sstevel@tonic-gate 			    (nb == sp->len)?
9077c478bd9Sstevel@tonic-gate 			    (const char *)"\"" : (const char *)"\"..");
9087c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
9097c478bd9Sstevel@tonic-gate 		}
9107c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
9117c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
9127c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
9137c478bd9Sstevel@tonic-gate 	}
9147c478bd9Sstevel@tonic-gate }
9157c478bd9Sstevel@tonic-gate 
9167c478bd9Sstevel@tonic-gate /* strpeek and strfdinsert flags word */
9177c478bd9Sstevel@tonic-gate const char *
strflags(private_t * pri,int flags)9187c478bd9Sstevel@tonic-gate strflags(private_t *pri, int flags)
9197c478bd9Sstevel@tonic-gate {
9207c478bd9Sstevel@tonic-gate 	const char *s;
9217c478bd9Sstevel@tonic-gate 
9227c478bd9Sstevel@tonic-gate 	switch (flags) {
9237c478bd9Sstevel@tonic-gate 	case 0:
9247c478bd9Sstevel@tonic-gate 		s = "0";
9257c478bd9Sstevel@tonic-gate 		break;
9267c478bd9Sstevel@tonic-gate 	case RS_HIPRI:
9277c478bd9Sstevel@tonic-gate 		s = "RS_HIPRI";
9287c478bd9Sstevel@tonic-gate 		break;
9297c478bd9Sstevel@tonic-gate 	default:
9307c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "0x%.4X", flags);
9317c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
9327c478bd9Sstevel@tonic-gate 	}
9337c478bd9Sstevel@tonic-gate 
9347c478bd9Sstevel@tonic-gate 	return (s);
9357c478bd9Sstevel@tonic-gate }
9367c478bd9Sstevel@tonic-gate 
9377c478bd9Sstevel@tonic-gate void
show_strpeek(private_t * pri,long offset)9387c478bd9Sstevel@tonic-gate show_strpeek(private_t *pri, long offset)
9397c478bd9Sstevel@tonic-gate {
9407c478bd9Sstevel@tonic-gate 	struct strpeek strpeek;
9417c478bd9Sstevel@tonic-gate 
9427c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9437c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
9447c478bd9Sstevel@tonic-gate 
9457c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE);
9467c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.databuf, "dat", FALSE);
9477c478bd9Sstevel@tonic-gate 
9487c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
9497c478bd9Sstevel@tonic-gate 		    pri->pname,
9507c478bd9Sstevel@tonic-gate 		    strflags(pri, strpeek.flags));
9517c478bd9Sstevel@tonic-gate 	}
9527c478bd9Sstevel@tonic-gate }
9537c478bd9Sstevel@tonic-gate 
9547c478bd9Sstevel@tonic-gate void
show_strpeek32(private_t * pri,long offset)9557c478bd9Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset)
9567c478bd9Sstevel@tonic-gate {
9577c478bd9Sstevel@tonic-gate 	struct strpeek32 strpeek;
9587c478bd9Sstevel@tonic-gate 
9597c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9607c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE);
9637c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.databuf, "dat", FALSE);
9647c478bd9Sstevel@tonic-gate 
9657c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
9667c478bd9Sstevel@tonic-gate 		    pri->pname,
9677c478bd9Sstevel@tonic-gate 		    strflags(pri, strpeek.flags));
9687c478bd9Sstevel@tonic-gate 	}
9697c478bd9Sstevel@tonic-gate }
9707c478bd9Sstevel@tonic-gate 
9717c478bd9Sstevel@tonic-gate void
show_strfdinsert(private_t * pri,long offset)9727c478bd9Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset)
9737c478bd9Sstevel@tonic-gate {
9747c478bd9Sstevel@tonic-gate 	struct strfdinsert strfdinsert;
9757c478bd9Sstevel@tonic-gate 
9767c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
9777c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
9787c478bd9Sstevel@tonic-gate 
9797c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
9807c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE);
9817c478bd9Sstevel@tonic-gate 
9827c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
9837c478bd9Sstevel@tonic-gate 		    pri->pname,
9847c478bd9Sstevel@tonic-gate 		    strflags(pri, strfdinsert.flags),
9857c478bd9Sstevel@tonic-gate 		    strfdinsert.fildes,
9867c478bd9Sstevel@tonic-gate 		    strfdinsert.offset);
9877c478bd9Sstevel@tonic-gate 	}
9887c478bd9Sstevel@tonic-gate }
9897c478bd9Sstevel@tonic-gate 
9907c478bd9Sstevel@tonic-gate void
show_strfdinsert32(private_t * pri,long offset)9917c478bd9Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset)
9927c478bd9Sstevel@tonic-gate {
9937c478bd9Sstevel@tonic-gate 	struct strfdinsert32 strfdinsert;
9947c478bd9Sstevel@tonic-gate 
9957c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
9967c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
9977c478bd9Sstevel@tonic-gate 
9987c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
9997c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE);
10007c478bd9Sstevel@tonic-gate 
10017c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
10027c478bd9Sstevel@tonic-gate 		    pri->pname,
10037c478bd9Sstevel@tonic-gate 		    strflags(pri, strfdinsert.flags),
10047c478bd9Sstevel@tonic-gate 		    strfdinsert.fildes,
10057c478bd9Sstevel@tonic-gate 		    strfdinsert.offset);
10067c478bd9Sstevel@tonic-gate 	}
10077c478bd9Sstevel@tonic-gate }
10087c478bd9Sstevel@tonic-gate 
10097c478bd9Sstevel@tonic-gate void
show_strrecvfd(private_t * pri,long offset)10107c478bd9Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset)
10117c478bd9Sstevel@tonic-gate {
10127c478bd9Sstevel@tonic-gate 	struct strrecvfd strrecvfd;
10137c478bd9Sstevel@tonic-gate 
10147c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) ==
10157c478bd9Sstevel@tonic-gate 	    sizeof (strrecvfd)) {
10167c478bd9Sstevel@tonic-gate 		(void) printf(
1017f48205beScasper 		    "%s\tfd=%-5d uid=%-5u gid=%u\n",
10187c478bd9Sstevel@tonic-gate 		    pri->pname,
10197c478bd9Sstevel@tonic-gate 		    strrecvfd.fd,
1020f48205beScasper 		    strrecvfd.uid,
1021f48205beScasper 		    strrecvfd.gid);
10227c478bd9Sstevel@tonic-gate 	}
10237c478bd9Sstevel@tonic-gate }
10247c478bd9Sstevel@tonic-gate 
10257c478bd9Sstevel@tonic-gate void
show_strlist(private_t * pri,long offset)10267c478bd9Sstevel@tonic-gate show_strlist(private_t *pri, long offset)
10277c478bd9Sstevel@tonic-gate {
10287c478bd9Sstevel@tonic-gate 	struct str_list strlist;
10297c478bd9Sstevel@tonic-gate 	struct str_mlist list;
10307c478bd9Sstevel@tonic-gate 	int count;
10317c478bd9Sstevel@tonic-gate 
10327c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10337c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
10347c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
10357c478bd9Sstevel@tonic-gate 		    pri->pname,
10367c478bd9Sstevel@tonic-gate 		    strlist.sl_nmods,
10377c478bd9Sstevel@tonic-gate 		    (long)strlist.sl_modlist);
10387c478bd9Sstevel@tonic-gate 
10397c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
10407c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
10417c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
10427c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
10437c478bd9Sstevel@tonic-gate 			    sizeof (list))
10447c478bd9Sstevel@tonic-gate 				break;
10457c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
10467c478bd9Sstevel@tonic-gate 			    pri->pname,
10477c478bd9Sstevel@tonic-gate 			    (int)sizeof (list.l_name),
10487c478bd9Sstevel@tonic-gate 			    list.l_name);
10497c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
10507c478bd9Sstevel@tonic-gate 		}
10517c478bd9Sstevel@tonic-gate 	}
10527c478bd9Sstevel@tonic-gate }
10537c478bd9Sstevel@tonic-gate 
10547c478bd9Sstevel@tonic-gate void
show_strlist32(private_t * pri,long offset)10557c478bd9Sstevel@tonic-gate show_strlist32(private_t *pri, long offset)
10567c478bd9Sstevel@tonic-gate {
10577c478bd9Sstevel@tonic-gate 	struct str_list32 strlist;
10587c478bd9Sstevel@tonic-gate 	struct str_mlist list;
10597c478bd9Sstevel@tonic-gate 	int count;
10607c478bd9Sstevel@tonic-gate 
10617c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10627c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
10637c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
10647c478bd9Sstevel@tonic-gate 		    pri->pname,
10657c478bd9Sstevel@tonic-gate 		    strlist.sl_nmods,
10667c478bd9Sstevel@tonic-gate 		    (long)strlist.sl_modlist);
10677c478bd9Sstevel@tonic-gate 
10687c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
10697c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
10707c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
10717c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
10727c478bd9Sstevel@tonic-gate 			    sizeof (list))
10737c478bd9Sstevel@tonic-gate 				break;
10747c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
10757c478bd9Sstevel@tonic-gate 			    pri->pname,
10767c478bd9Sstevel@tonic-gate 			    (int)sizeof (list.l_name),
10777c478bd9Sstevel@tonic-gate 			    list.l_name);
10787c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
10797c478bd9Sstevel@tonic-gate 		}
10807c478bd9Sstevel@tonic-gate 	}
10817c478bd9Sstevel@tonic-gate }
10827c478bd9Sstevel@tonic-gate 
10837c478bd9Sstevel@tonic-gate void
show_jwinsize(private_t * pri,long offset)10847c478bd9Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset)
10857c478bd9Sstevel@tonic-gate {
10867c478bd9Sstevel@tonic-gate 	struct jwinsize jwinsize;
10877c478bd9Sstevel@tonic-gate 
10887c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) ==
10897c478bd9Sstevel@tonic-gate 	    sizeof (jwinsize)) {
10907c478bd9Sstevel@tonic-gate 		(void) printf(
10917c478bd9Sstevel@tonic-gate 		    "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
10927c478bd9Sstevel@tonic-gate 		    pri->pname,
10937c478bd9Sstevel@tonic-gate 		    (unsigned)jwinsize.bytesx,
10947c478bd9Sstevel@tonic-gate 		    (unsigned)jwinsize.bytesy,
10957c478bd9Sstevel@tonic-gate 		    (unsigned)jwinsize.bitsx,
10967c478bd9Sstevel@tonic-gate 		    (unsigned)jwinsize.bitsy);
10977c478bd9Sstevel@tonic-gate 	}
10987c478bd9Sstevel@tonic-gate }
10997c478bd9Sstevel@tonic-gate 
11007c478bd9Sstevel@tonic-gate void
show_winsize(private_t * pri,long offset)11017c478bd9Sstevel@tonic-gate show_winsize(private_t *pri, long offset)
11027c478bd9Sstevel@tonic-gate {
11037c478bd9Sstevel@tonic-gate 	struct winsize winsize;
11047c478bd9Sstevel@tonic-gate 
11057c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &winsize, sizeof (winsize), offset)
11067c478bd9Sstevel@tonic-gate 	    == sizeof (winsize)) {
11077c478bd9Sstevel@tonic-gate 		(void) printf(
11087c478bd9Sstevel@tonic-gate 		    "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
11097c478bd9Sstevel@tonic-gate 		    pri->pname,
11107c478bd9Sstevel@tonic-gate 		    winsize.ws_row,
11117c478bd9Sstevel@tonic-gate 		    winsize.ws_col,
11127c478bd9Sstevel@tonic-gate 		    winsize.ws_xpixel,
11137c478bd9Sstevel@tonic-gate 		    winsize.ws_ypixel);
11147c478bd9Sstevel@tonic-gate 	}
11157c478bd9Sstevel@tonic-gate }
11167c478bd9Sstevel@tonic-gate 
11177c478bd9Sstevel@tonic-gate struct audio_stuff {
11187c478bd9Sstevel@tonic-gate 	uint_t	bit;
11197c478bd9Sstevel@tonic-gate 	const char *str;
11207c478bd9Sstevel@tonic-gate };
11217c478bd9Sstevel@tonic-gate 
11227c478bd9Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = {
11237c478bd9Sstevel@tonic-gate 	{ AUDIO_SPEAKER, "SPEAKER" },
11247c478bd9Sstevel@tonic-gate 	{ AUDIO_HEADPHONE, "HEADPHONE" },
11257c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_OUT, "LINE_OUT" },
11267c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_OUT, "SPDIF_OUT" },
11277c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_OUT, "AUX1_OUT" },
11287c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_OUT, "AUX2_OUT" },
11297c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11307c478bd9Sstevel@tonic-gate };
11317c478bd9Sstevel@tonic-gate 
11327c478bd9Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = {
11337c478bd9Sstevel@tonic-gate 	{ AUDIO_MICROPHONE, "MICROPHONE" },
11347c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_IN, "LINE_IN" },
11357c478bd9Sstevel@tonic-gate 	{ AUDIO_CD, "CD" },
11367c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_IN, "SPDIF_IN" },
11377c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_IN, "AUX1_IN" },
11387c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_IN, "AUX2_IN" },
11397c478bd9Sstevel@tonic-gate 	{ AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" },
11407c478bd9Sstevel@tonic-gate 	{ AUDIO_SUNVTS, "SUNVTS" },
11417c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11427c478bd9Sstevel@tonic-gate };
11437c478bd9Sstevel@tonic-gate 
11447c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = {
11457c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_DUPLEX, "DUPLEX" },
11467c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_MSCODEC, "MSCODEC" },
11477c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_IN2OUT, "IN2OUT" },
11487c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_PLAY, "PLAY" },
11497c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_RECORD, "RECORD" },
11507c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11517c478bd9Sstevel@tonic-gate };
11527c478bd9Sstevel@tonic-gate 
11537c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = {
11547c478bd9Sstevel@tonic-gate 	{ AUDIO_SWFEATURE_MIXER, "MIXER" },
11557c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11567c478bd9Sstevel@tonic-gate };
11577c478bd9Sstevel@tonic-gate 
11587c478bd9Sstevel@tonic-gate void
show_audio_features(const private_t * pri,const struct audio_stuff * audio_porttab,uint_t features,const char * name)11597c478bd9Sstevel@tonic-gate show_audio_features(const private_t *pri,
11607c478bd9Sstevel@tonic-gate     const struct audio_stuff *audio_porttab, uint_t features,
11617c478bd9Sstevel@tonic-gate     const char *name)
11627c478bd9Sstevel@tonic-gate {
11637c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s=", pri->pname, name);
11647c478bd9Sstevel@tonic-gate 	if (features == 0) {
11657c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
11667c478bd9Sstevel@tonic-gate 		return;
11677c478bd9Sstevel@tonic-gate 	}
11687c478bd9Sstevel@tonic-gate 
11697c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
11707c478bd9Sstevel@tonic-gate 		if (features & audio_porttab->bit) {
11717c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
11727c478bd9Sstevel@tonic-gate 			features &= ~audio_porttab->bit;
11737c478bd9Sstevel@tonic-gate 			if (features)
11747c478bd9Sstevel@tonic-gate 				(void) putchar('|');
11757c478bd9Sstevel@tonic-gate 		}
11767c478bd9Sstevel@tonic-gate 	}
11777c478bd9Sstevel@tonic-gate 	if (features)
11787c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", features);
11797c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
11807c478bd9Sstevel@tonic-gate }
11817c478bd9Sstevel@tonic-gate 
11827c478bd9Sstevel@tonic-gate void
show_audio_ports(private_t * pri,const char * mode,const char * field,uint_t ports)11837c478bd9Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode,
11847c478bd9Sstevel@tonic-gate     const char *field, uint_t ports)
11857c478bd9Sstevel@tonic-gate {
11867c478bd9Sstevel@tonic-gate 	const struct audio_stuff *audio_porttab;
11877c478bd9Sstevel@tonic-gate 
11887c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\t%s=", pri->pname, mode, field);
11897c478bd9Sstevel@tonic-gate 	if (ports == 0) {
11907c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
11917c478bd9Sstevel@tonic-gate 		return;
11927c478bd9Sstevel@tonic-gate 	}
11937c478bd9Sstevel@tonic-gate 	if (*mode == 'p')
11947c478bd9Sstevel@tonic-gate 		audio_porttab = audio_output_ports;
11957c478bd9Sstevel@tonic-gate 	else
11967c478bd9Sstevel@tonic-gate 		audio_porttab = audio_input_ports;
11977c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
11987c478bd9Sstevel@tonic-gate 		if (ports & audio_porttab->bit) {
11997c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
12007c478bd9Sstevel@tonic-gate 			ports &= ~audio_porttab->bit;
12017c478bd9Sstevel@tonic-gate 			if (ports)
12027c478bd9Sstevel@tonic-gate 				(void) putchar('|');
12037c478bd9Sstevel@tonic-gate 		}
12047c478bd9Sstevel@tonic-gate 	}
12057c478bd9Sstevel@tonic-gate 	if (ports)
12067c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", ports);
12077c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
12087c478bd9Sstevel@tonic-gate }
12097c478bd9Sstevel@tonic-gate 
12107c478bd9Sstevel@tonic-gate void
show_audio_prinfo(private_t * pri,const char * mode,struct audio_prinfo * au_pr)12117c478bd9Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr)
12127c478bd9Sstevel@tonic-gate {
12137c478bd9Sstevel@tonic-gate 	const char *s;
12147c478bd9Sstevel@tonic-gate 
12157c478bd9Sstevel@tonic-gate 	/*
12167c478bd9Sstevel@tonic-gate 	 * The following values describe the audio data encoding.
12177c478bd9Sstevel@tonic-gate 	 */
12187c478bd9Sstevel@tonic-gate 
12197c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
12207c478bd9Sstevel@tonic-gate 	    pri->pname, mode,
12217c478bd9Sstevel@tonic-gate 	    au_pr->sample_rate,
12227c478bd9Sstevel@tonic-gate 	    au_pr->channels,
12237c478bd9Sstevel@tonic-gate 	    au_pr->precision);
12247c478bd9Sstevel@tonic-gate 
12257c478bd9Sstevel@tonic-gate 	s = NULL;
12267c478bd9Sstevel@tonic-gate 	switch (au_pr->encoding) {
12277c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_NONE:	s = "NONE";	break;
12287c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ULAW:	s = "ULAW";	break;
12297c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ALAW:	s = "ALAW";	break;
12307c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR:	s = "LINEAR";	break;
12317c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_DVI:	s = "DVI";	break;
12327c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR8:	s = "LINEAR8";	break;
12337c478bd9Sstevel@tonic-gate 	}
12347c478bd9Sstevel@tonic-gate 	if (s)
12357c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s);
12367c478bd9Sstevel@tonic-gate 	else {
12377c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%u\n",
12387c478bd9Sstevel@tonic-gate 		    pri->pname, mode, au_pr->encoding);
12397c478bd9Sstevel@tonic-gate 	}
12407c478bd9Sstevel@tonic-gate 
12417c478bd9Sstevel@tonic-gate 	/*
12427c478bd9Sstevel@tonic-gate 	 * The following values control audio device configuration
12437c478bd9Sstevel@tonic-gate 	 */
12447c478bd9Sstevel@tonic-gate 
12457c478bd9Sstevel@tonic-gate 	(void) printf(
12467c478bd9Sstevel@tonic-gate 	    "%s\t%s\tgain=%u buffer_size=%u\n",
12477c478bd9Sstevel@tonic-gate 	    pri->pname, mode,
12487c478bd9Sstevel@tonic-gate 	    au_pr->gain,
12497c478bd9Sstevel@tonic-gate 	    au_pr->buffer_size);
12507c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "port", au_pr->port);
12517c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports);
12527c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports);
12537c478bd9Sstevel@tonic-gate 
12547c478bd9Sstevel@tonic-gate 	/*
12557c478bd9Sstevel@tonic-gate 	 * The following values describe driver state
12567c478bd9Sstevel@tonic-gate 	 */
12577c478bd9Sstevel@tonic-gate 
12587c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
12597c478bd9Sstevel@tonic-gate 	    pri->pname, mode,
12607c478bd9Sstevel@tonic-gate 	    au_pr->samples,
12617c478bd9Sstevel@tonic-gate 	    au_pr->eof,
12627c478bd9Sstevel@tonic-gate 	    au_pr->pause,
12637c478bd9Sstevel@tonic-gate 	    au_pr->error);
12647c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
12657c478bd9Sstevel@tonic-gate 	    pri->pname, mode,
12667c478bd9Sstevel@tonic-gate 	    au_pr->waiting,
12677c478bd9Sstevel@tonic-gate 	    au_pr->balance,
12687c478bd9Sstevel@tonic-gate 	    au_pr->minordev);
12697c478bd9Sstevel@tonic-gate 
12707c478bd9Sstevel@tonic-gate 	/*
12717c478bd9Sstevel@tonic-gate 	 * The following values are read-only state flags
12727c478bd9Sstevel@tonic-gate 	 */
12737c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\topen=%u active=%u\n",
12747c478bd9Sstevel@tonic-gate 	    pri->pname, mode,
12757c478bd9Sstevel@tonic-gate 	    au_pr->open,
12767c478bd9Sstevel@tonic-gate 	    au_pr->active);
12777c478bd9Sstevel@tonic-gate }
12787c478bd9Sstevel@tonic-gate 
12797c478bd9Sstevel@tonic-gate void
show_audio_info(private_t * pri,long offset)12807c478bd9Sstevel@tonic-gate show_audio_info(private_t *pri, long offset)
12817c478bd9Sstevel@tonic-gate {
12827c478bd9Sstevel@tonic-gate 	struct audio_info au;
12837c478bd9Sstevel@tonic-gate 
12847c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) {
12857c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "play", &au.play);
12867c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "record", &au.record);
12877c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
12887c478bd9Sstevel@tonic-gate 		    pri->pname, au.monitor_gain, au.output_muted);
12897c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_hw_features, au.hw_features,
12907c478bd9Sstevel@tonic-gate 		    "hw_features");
12917c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features, au.sw_features,
12927c478bd9Sstevel@tonic-gate 		    "sw_features");
12937c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features,
12947c478bd9Sstevel@tonic-gate 		    au.sw_features_enabled, "sw_features_enabled");
12957c478bd9Sstevel@tonic-gate 	}
12967c478bd9Sstevel@tonic-gate }
12977c478bd9Sstevel@tonic-gate 
12987c478bd9Sstevel@tonic-gate void
show_ioctl(private_t * pri,int code,long offset)12997c478bd9Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset)
13007c478bd9Sstevel@tonic-gate {
13017c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
13027c478bd9Sstevel@tonic-gate 	int err = pri->Errno;	/* don't display output parameters */
13037c478bd9Sstevel@tonic-gate 				/* for a failed system call */
13043b862e9aSRoger A. Faulkner 	if (offset == 0)
13057c478bd9Sstevel@tonic-gate 		return;
13067c478bd9Sstevel@tonic-gate 
13077c478bd9Sstevel@tonic-gate 	switch (code) {
13087c478bd9Sstevel@tonic-gate 	case TCGETA:
13097c478bd9Sstevel@tonic-gate 		if (err)
13107c478bd9Sstevel@tonic-gate 			break;
13117c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13127c478bd9Sstevel@tonic-gate 	case TCSETA:
13137c478bd9Sstevel@tonic-gate 	case TCSETAW:
13147c478bd9Sstevel@tonic-gate 	case TCSETAF:
13157c478bd9Sstevel@tonic-gate 		show_termio(pri, offset);
13167c478bd9Sstevel@tonic-gate 		break;
13177c478bd9Sstevel@tonic-gate 	case TCGETS:
13187c478bd9Sstevel@tonic-gate 		if (err)
13197c478bd9Sstevel@tonic-gate 			break;
13207c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13217c478bd9Sstevel@tonic-gate 	case TCSETS:
13227c478bd9Sstevel@tonic-gate 	case TCSETSW:
13237c478bd9Sstevel@tonic-gate 	case TCSETSF:
13247c478bd9Sstevel@tonic-gate 		show_termios(pri, offset);
13257c478bd9Sstevel@tonic-gate 		break;
13267c478bd9Sstevel@tonic-gate 	case TCGETX:
13277c478bd9Sstevel@tonic-gate 		if (err)
13287c478bd9Sstevel@tonic-gate 			break;
13297c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13307c478bd9Sstevel@tonic-gate 	case TCSETX:
13317c478bd9Sstevel@tonic-gate 	case TCSETXW:
13327c478bd9Sstevel@tonic-gate 	case TCSETXF:
13337c478bd9Sstevel@tonic-gate 		show_termiox(pri, offset);
13347c478bd9Sstevel@tonic-gate 		break;
13357c478bd9Sstevel@tonic-gate 	case TIOCGETP:
13367c478bd9Sstevel@tonic-gate 		if (err)
13377c478bd9Sstevel@tonic-gate 			break;
13387c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13397c478bd9Sstevel@tonic-gate 	case TIOCSETN:
13407c478bd9Sstevel@tonic-gate 	case TIOCSETP:
13417c478bd9Sstevel@tonic-gate 		show_sgttyb(pri, offset);
13427c478bd9Sstevel@tonic-gate 		break;
13437c478bd9Sstevel@tonic-gate 	case TIOCGLTC:
13447c478bd9Sstevel@tonic-gate 		if (err)
13457c478bd9Sstevel@tonic-gate 			break;
13467c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13477c478bd9Sstevel@tonic-gate 	case TIOCSLTC:
13487c478bd9Sstevel@tonic-gate 		show_ltchars(pri, offset);
13497c478bd9Sstevel@tonic-gate 		break;
13507c478bd9Sstevel@tonic-gate 	case TIOCGETC:
13517c478bd9Sstevel@tonic-gate 		if (err)
13527c478bd9Sstevel@tonic-gate 			break;
13537c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13547c478bd9Sstevel@tonic-gate 	case TIOCSETC:
13557c478bd9Sstevel@tonic-gate 		show_tchars(pri, offset);
13567c478bd9Sstevel@tonic-gate 		break;
13577c478bd9Sstevel@tonic-gate 	case LDGETT:
13587c478bd9Sstevel@tonic-gate 		if (err)
13597c478bd9Sstevel@tonic-gate 			break;
13607c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13617c478bd9Sstevel@tonic-gate 	case LDSETT:
13627c478bd9Sstevel@tonic-gate 		show_termcb(pri, offset);
13637c478bd9Sstevel@tonic-gate 		break;
13647c478bd9Sstevel@tonic-gate 	/* streams ioctl()s */
13657c478bd9Sstevel@tonic-gate #if 0
13667c478bd9Sstevel@tonic-gate 		/* these are displayed as strings in the arg list */
13677c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13687c478bd9Sstevel@tonic-gate 	case I_PUSH:
13697c478bd9Sstevel@tonic-gate 	case I_LOOK:
13707c478bd9Sstevel@tonic-gate 	case I_FIND:
13717c478bd9Sstevel@tonic-gate 		/* these are displayed as decimal in the arg list */
13727c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13737c478bd9Sstevel@tonic-gate 	case I_LINK:
13747c478bd9Sstevel@tonic-gate 	case I_UNLINK:
13757c478bd9Sstevel@tonic-gate 	case I_SENDFD:
13767c478bd9Sstevel@tonic-gate 		/* these are displayed symbolically in the arg list */
13777c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13787c478bd9Sstevel@tonic-gate 	case I_SRDOPT:
13797c478bd9Sstevel@tonic-gate 	case I_SETSIG:
13807c478bd9Sstevel@tonic-gate 	case I_FLUSH:
13817c478bd9Sstevel@tonic-gate 		break;
13827c478bd9Sstevel@tonic-gate 		/* this one just ignores the argument */
13837c478bd9Sstevel@tonic-gate 	case I_POP:
13847c478bd9Sstevel@tonic-gate 		break;
13857c478bd9Sstevel@tonic-gate #endif
13867c478bd9Sstevel@tonic-gate 		/* these return something in an int pointed to by arg */
13877c478bd9Sstevel@tonic-gate 	case I_NREAD:
13887c478bd9Sstevel@tonic-gate 	case I_GRDOPT:
13897c478bd9Sstevel@tonic-gate 	case I_GETSIG:
13907c478bd9Sstevel@tonic-gate 	case TIOCGSID:
13917c478bd9Sstevel@tonic-gate 	case TIOCGPGRP:
13927c478bd9Sstevel@tonic-gate 	case TIOCLGET:
13937c478bd9Sstevel@tonic-gate 	case FIONREAD:
13947c478bd9Sstevel@tonic-gate 	case FIORDCHK:
13957c478bd9Sstevel@tonic-gate 		if (err)
13967c478bd9Sstevel@tonic-gate 			break;
13977c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13987c478bd9Sstevel@tonic-gate 		/* these pass something in an int pointed to by arg */
13997c478bd9Sstevel@tonic-gate 	case TIOCSPGRP:
14007c478bd9Sstevel@tonic-gate 	case TIOCFLUSH:
14017c478bd9Sstevel@tonic-gate 	case TIOCLBIS:
14027c478bd9Sstevel@tonic-gate 	case TIOCLBIC:
14037c478bd9Sstevel@tonic-gate 	case TIOCLSET:
14047c478bd9Sstevel@tonic-gate 		show_strint(pri, code, offset);
14057c478bd9Sstevel@tonic-gate 		break;
14067c478bd9Sstevel@tonic-gate 		/* these all point to structures */
14077c478bd9Sstevel@tonic-gate 	case I_STR:
14087c478bd9Sstevel@tonic-gate 		if (lp64)
14097c478bd9Sstevel@tonic-gate 			show_strioctl(pri, offset);
14107c478bd9Sstevel@tonic-gate 		else
14117c478bd9Sstevel@tonic-gate 			show_strioctl32(pri, offset);
14127c478bd9Sstevel@tonic-gate 		break;
14137c478bd9Sstevel@tonic-gate 	case I_PEEK:
14147c478bd9Sstevel@tonic-gate 		if (lp64)
14157c478bd9Sstevel@tonic-gate 			show_strpeek(pri, offset);
14167c478bd9Sstevel@tonic-gate 		else
14177c478bd9Sstevel@tonic-gate 			show_strpeek32(pri, offset);
14187c478bd9Sstevel@tonic-gate 		break;
14197c478bd9Sstevel@tonic-gate 	case I_FDINSERT:
14207c478bd9Sstevel@tonic-gate 		if (lp64)
14217c478bd9Sstevel@tonic-gate 			show_strfdinsert(pri, offset);
14227c478bd9Sstevel@tonic-gate 		else
14237c478bd9Sstevel@tonic-gate 			show_strfdinsert32(pri, offset);
14247c478bd9Sstevel@tonic-gate 		break;
14257c478bd9Sstevel@tonic-gate 	case I_RECVFD:
14267c478bd9Sstevel@tonic-gate 		if (err)
14277c478bd9Sstevel@tonic-gate 			break;
14287c478bd9Sstevel@tonic-gate 		show_strrecvfd(pri, offset);
14297c478bd9Sstevel@tonic-gate 		break;
14307c478bd9Sstevel@tonic-gate 	case I_LIST:
14317c478bd9Sstevel@tonic-gate 		if (err)
14327c478bd9Sstevel@tonic-gate 			break;
14337c478bd9Sstevel@tonic-gate 		if (lp64)
14347c478bd9Sstevel@tonic-gate 			show_strlist(pri, offset);
14357c478bd9Sstevel@tonic-gate 		else
14367c478bd9Sstevel@tonic-gate 			show_strlist32(pri, offset);
14377c478bd9Sstevel@tonic-gate 		break;
14387c478bd9Sstevel@tonic-gate 	case JWINSIZE:
14397c478bd9Sstevel@tonic-gate 		if (err)
14407c478bd9Sstevel@tonic-gate 			break;
14417c478bd9Sstevel@tonic-gate 		show_jwinsize(pri, offset);
14427c478bd9Sstevel@tonic-gate 		break;
14437c478bd9Sstevel@tonic-gate 	case TIOCGWINSZ:
14447c478bd9Sstevel@tonic-gate 		if (err)
14457c478bd9Sstevel@tonic-gate 			break;
14467c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
14477c478bd9Sstevel@tonic-gate 	case TIOCSWINSZ:
14487c478bd9Sstevel@tonic-gate 		show_winsize(pri, offset);
14497c478bd9Sstevel@tonic-gate 		break;
14507c478bd9Sstevel@tonic-gate 	case AUDIO_GETINFO:
14517c478bd9Sstevel@tonic-gate 	case (int)AUDIO_SETINFO:
14527c478bd9Sstevel@tonic-gate 		show_audio_info(pri, offset);
14537c478bd9Sstevel@tonic-gate 		break;
14547c478bd9Sstevel@tonic-gate 
14557c478bd9Sstevel@tonic-gate 	default:
1456a803cc21SGordon Ross 		if ((code & ~0xff) == ZFS_IOC) {
1457a803cc21SGordon Ross 			show_zfs_ioc(pri, offset);
1458a803cc21SGordon Ross 			break;
1459a803cc21SGordon Ross 		}
1460a803cc21SGordon Ross 
14617c478bd9Sstevel@tonic-gate 		if (code & IOC_INOUT) {
14627c478bd9Sstevel@tonic-gate 			const char *str = ioctldatastruct(code);
14637c478bd9Sstevel@tonic-gate 
14647c478bd9Sstevel@tonic-gate 			(void) printf("\t\t%s",
14657c478bd9Sstevel@tonic-gate 			    (code & IOC_INOUT) == IOC_INOUT ? "write/read" :
14667c478bd9Sstevel@tonic-gate 			    code & IOC_IN ? "write" : "read");
14677c478bd9Sstevel@tonic-gate 			if (str != NULL) {
14687c478bd9Sstevel@tonic-gate 				(void) printf(" (struct %s)\n", str);
14697c478bd9Sstevel@tonic-gate 			} else {
14707c478bd9Sstevel@tonic-gate 				(void) printf(" %d bytes\n",
14717c478bd9Sstevel@tonic-gate 				    (code >> 16) & IOCPARM_MASK);
14727c478bd9Sstevel@tonic-gate 			}
14737c478bd9Sstevel@tonic-gate 		}
14747c478bd9Sstevel@tonic-gate 	}
14757c478bd9Sstevel@tonic-gate }
14767c478bd9Sstevel@tonic-gate 
14777c478bd9Sstevel@tonic-gate void
show_statvfs(private_t * pri)14787c478bd9Sstevel@tonic-gate show_statvfs(private_t *pri)
14797c478bd9Sstevel@tonic-gate {
14807c478bd9Sstevel@tonic-gate 	long offset;
14817c478bd9Sstevel@tonic-gate 	struct statvfs statvfs;
14827c478bd9Sstevel@tonic-gate 	char *cp;
14837c478bd9Sstevel@tonic-gate 
148427aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
14857c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
14867c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
14877c478bd9Sstevel@tonic-gate 		(void) printf(
14887c478bd9Sstevel@tonic-gate 		"%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
14897c478bd9Sstevel@tonic-gate 		    pri->pname,
14907c478bd9Sstevel@tonic-gate 		    statvfs.f_bsize,
14917c478bd9Sstevel@tonic-gate 		    statvfs.f_frsize,
14927c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_blocks,
14937c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_bfree);
14947c478bd9Sstevel@tonic-gate 		(void) printf(
14957c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
14967c478bd9Sstevel@tonic-gate 		    pri->pname,
14977c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_bavail,
14987c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_files,
14997c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_ffree,
15007c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_favail);
15017c478bd9Sstevel@tonic-gate 		(void) printf(
15027c478bd9Sstevel@tonic-gate 		    "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
15037c478bd9Sstevel@tonic-gate 		    pri->pname,
15047c478bd9Sstevel@tonic-gate 		    statvfs.f_fsid,
15057c478bd9Sstevel@tonic-gate 		    statvfs.f_basetype,
15067c478bd9Sstevel@tonic-gate 		    (long)statvfs.f_namemax);
15077c478bd9Sstevel@tonic-gate 		(void) printf(
15087c478bd9Sstevel@tonic-gate 		    "%s\tflag=%s\n",
15097c478bd9Sstevel@tonic-gate 		    pri->pname,
15107c478bd9Sstevel@tonic-gate 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
15117c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15127c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15137c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
15147c478bd9Sstevel@tonic-gate 			*cp = ' ';
15157c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
15167c478bd9Sstevel@tonic-gate 		    pri->pname,
15177c478bd9Sstevel@tonic-gate 		    (int)sizeof (statvfs.f_fstr),
15187c478bd9Sstevel@tonic-gate 		    statvfs.f_fstr);
15197c478bd9Sstevel@tonic-gate 	}
15207c478bd9Sstevel@tonic-gate }
15217c478bd9Sstevel@tonic-gate 
15227c478bd9Sstevel@tonic-gate void
show_statvfs32(private_t * pri)15237c478bd9Sstevel@tonic-gate show_statvfs32(private_t *pri)
15247c478bd9Sstevel@tonic-gate {
15257c478bd9Sstevel@tonic-gate 	long offset;
15267c478bd9Sstevel@tonic-gate 	struct statvfs32 statvfs;
15277c478bd9Sstevel@tonic-gate 	char *cp;
15287c478bd9Sstevel@tonic-gate 
152927aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15307c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
15317c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
15327c478bd9Sstevel@tonic-gate 		(void) printf(
15337c478bd9Sstevel@tonic-gate 		    "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
15347c478bd9Sstevel@tonic-gate 		    pri->pname,
15357c478bd9Sstevel@tonic-gate 		    statvfs.f_bsize,
15367c478bd9Sstevel@tonic-gate 		    statvfs.f_frsize,
15377c478bd9Sstevel@tonic-gate 		    statvfs.f_blocks,
15387c478bd9Sstevel@tonic-gate 		    statvfs.f_bfree);
15397c478bd9Sstevel@tonic-gate 		(void) printf(
15407c478bd9Sstevel@tonic-gate 		    "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
15417c478bd9Sstevel@tonic-gate 		    pri->pname,
15427c478bd9Sstevel@tonic-gate 		    statvfs.f_bavail,
15437c478bd9Sstevel@tonic-gate 		    statvfs.f_files,
15447c478bd9Sstevel@tonic-gate 		    statvfs.f_ffree,
15457c478bd9Sstevel@tonic-gate 		    statvfs.f_favail);
15467c478bd9Sstevel@tonic-gate 		(void) printf(
15477c478bd9Sstevel@tonic-gate 		    "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
15487c478bd9Sstevel@tonic-gate 		    pri->pname,
15497c478bd9Sstevel@tonic-gate 		    statvfs.f_fsid,
15507c478bd9Sstevel@tonic-gate 		    statvfs.f_basetype,
15517c478bd9Sstevel@tonic-gate 		    (int)statvfs.f_namemax);
15527c478bd9Sstevel@tonic-gate 		(void) printf(
15537c478bd9Sstevel@tonic-gate 		    "%s\tflag=%s\n",
15547c478bd9Sstevel@tonic-gate 		    pri->pname,
15557c478bd9Sstevel@tonic-gate 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
15567c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15577c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15587c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
15597c478bd9Sstevel@tonic-gate 			*cp = ' ';
15607c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
15617c478bd9Sstevel@tonic-gate 		    pri->pname,
15627c478bd9Sstevel@tonic-gate 		    (int)sizeof (statvfs.f_fstr),
15637c478bd9Sstevel@tonic-gate 		    statvfs.f_fstr);
15647c478bd9Sstevel@tonic-gate 	}
15657c478bd9Sstevel@tonic-gate }
15667c478bd9Sstevel@tonic-gate 
15677c478bd9Sstevel@tonic-gate void
show_statvfs64(private_t * pri)15687c478bd9Sstevel@tonic-gate show_statvfs64(private_t *pri)
15697c478bd9Sstevel@tonic-gate {
15707c478bd9Sstevel@tonic-gate 	long offset;
15717c478bd9Sstevel@tonic-gate 	struct statvfs64_32 statvfs;
15727c478bd9Sstevel@tonic-gate 	char *cp;
15737c478bd9Sstevel@tonic-gate 
157427aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15757c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
15767c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
15777c478bd9Sstevel@tonic-gate 		(void) printf(
15787c478bd9Sstevel@tonic-gate 		    "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
15797c478bd9Sstevel@tonic-gate 		    pri->pname,
15807c478bd9Sstevel@tonic-gate 		    statvfs.f_bsize,
15817c478bd9Sstevel@tonic-gate 		    statvfs.f_frsize,
15827c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_blocks,
15837c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_bfree);
15847c478bd9Sstevel@tonic-gate 		(void) printf(
15857c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
15867c478bd9Sstevel@tonic-gate 		    pri->pname,
15877c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_bavail,
15887c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_files,
15897c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_ffree,
15907c478bd9Sstevel@tonic-gate 		    (u_longlong_t)statvfs.f_favail);
15917c478bd9Sstevel@tonic-gate 		(void) printf(
15927c478bd9Sstevel@tonic-gate 		    "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
15937c478bd9Sstevel@tonic-gate 		    pri->pname,
15947c478bd9Sstevel@tonic-gate 		    statvfs.f_fsid,
15957c478bd9Sstevel@tonic-gate 		    statvfs.f_basetype,
15967c478bd9Sstevel@tonic-gate 		    (int)statvfs.f_namemax);
15977c478bd9Sstevel@tonic-gate 		(void) printf(
15987c478bd9Sstevel@tonic-gate 		    "%s\tflag=%s\n",
15997c478bd9Sstevel@tonic-gate 		    pri->pname,
16007c478bd9Sstevel@tonic-gate 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
16017c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
16027c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
16037c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
16047c478bd9Sstevel@tonic-gate 			*cp = ' ';
16057c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
16067c478bd9Sstevel@tonic-gate 		    pri->pname,
16077c478bd9Sstevel@tonic-gate 		    (int)sizeof (statvfs.f_fstr),
16087c478bd9Sstevel@tonic-gate 		    statvfs.f_fstr);
16097c478bd9Sstevel@tonic-gate 	}
16107c478bd9Sstevel@tonic-gate }
16117c478bd9Sstevel@tonic-gate 
16127c478bd9Sstevel@tonic-gate void
show_statfs(private_t * pri)16137c478bd9Sstevel@tonic-gate show_statfs(private_t *pri)
16147c478bd9Sstevel@tonic-gate {
16157c478bd9Sstevel@tonic-gate 	long offset;
16167c478bd9Sstevel@tonic-gate 	struct statfs statfs;
16177c478bd9Sstevel@tonic-gate 
161827aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16197c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16207c478bd9Sstevel@tonic-gate 		(void) printf(
16217c478bd9Sstevel@tonic-gate 		"%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
16227c478bd9Sstevel@tonic-gate 		    pri->pname,
16237c478bd9Sstevel@tonic-gate 		    statfs.f_fstyp,
16247c478bd9Sstevel@tonic-gate 		    statfs.f_bsize,
16257c478bd9Sstevel@tonic-gate 		    statfs.f_frsize,
16267c478bd9Sstevel@tonic-gate 		    statfs.f_blocks,
16277c478bd9Sstevel@tonic-gate 		    statfs.f_bfree,
16287c478bd9Sstevel@tonic-gate 		    statfs.f_files,
16297c478bd9Sstevel@tonic-gate 		    statfs.f_ffree);
16307c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
16317c478bd9Sstevel@tonic-gate 		    pri->pname,
16327c478bd9Sstevel@tonic-gate 		    statfs.f_fname,
16337c478bd9Sstevel@tonic-gate 		    statfs.f_fpack);
16347c478bd9Sstevel@tonic-gate 	}
16357c478bd9Sstevel@tonic-gate }
16367c478bd9Sstevel@tonic-gate 
16377c478bd9Sstevel@tonic-gate void
show_statfs32(private_t * pri)16387c478bd9Sstevel@tonic-gate show_statfs32(private_t *pri)
16397c478bd9Sstevel@tonic-gate {
16407c478bd9Sstevel@tonic-gate 	long offset;
16417c478bd9Sstevel@tonic-gate 	struct statfs32 statfs;
16427c478bd9Sstevel@tonic-gate 
164327aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16447c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16457c478bd9Sstevel@tonic-gate 		(void) printf(
16467c478bd9Sstevel@tonic-gate 		    "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
16477c478bd9Sstevel@tonic-gate 		    pri->pname,
16487c478bd9Sstevel@tonic-gate 		    statfs.f_fstyp,
16497c478bd9Sstevel@tonic-gate 		    statfs.f_bsize,
16507c478bd9Sstevel@tonic-gate 		    statfs.f_frsize,
16517c478bd9Sstevel@tonic-gate 		    statfs.f_blocks,
16527c478bd9Sstevel@tonic-gate 		    statfs.f_bfree,
16537c478bd9Sstevel@tonic-gate 		    statfs.f_files,
16547c478bd9Sstevel@tonic-gate 		    statfs.f_ffree);
16557c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
16567c478bd9Sstevel@tonic-gate 		    pri->pname,
16577c478bd9Sstevel@tonic-gate 		    statfs.f_fname,
16587c478bd9Sstevel@tonic-gate 		    statfs.f_fpack);
16597c478bd9Sstevel@tonic-gate 	}
16607c478bd9Sstevel@tonic-gate }
16617c478bd9Sstevel@tonic-gate 
16627c478bd9Sstevel@tonic-gate void
show_flock32(private_t * pri,long offset)16637c478bd9Sstevel@tonic-gate show_flock32(private_t *pri, long offset)
16647c478bd9Sstevel@tonic-gate {
16657c478bd9Sstevel@tonic-gate 	struct flock32 flock;
16667c478bd9Sstevel@tonic-gate 
16677c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
16687c478bd9Sstevel@tonic-gate 		const char *str = NULL;
16697c478bd9Sstevel@tonic-gate 
16707c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
16717c478bd9Sstevel@tonic-gate 
16727c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
16737c478bd9Sstevel@tonic-gate 		case F_RDLCK:
16747c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
16757c478bd9Sstevel@tonic-gate 			break;
16767c478bd9Sstevel@tonic-gate 		case F_WRLCK:
16777c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
16787c478bd9Sstevel@tonic-gate 			break;
16797c478bd9Sstevel@tonic-gate 		case F_UNLCK:
16807c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
16817c478bd9Sstevel@tonic-gate 			break;
16827c478bd9Sstevel@tonic-gate 		}
16837c478bd9Sstevel@tonic-gate 		if (str != NULL)
16847c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
16857c478bd9Sstevel@tonic-gate 		else
16867c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
16877c478bd9Sstevel@tonic-gate 
16887c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
16897c478bd9Sstevel@tonic-gate 		if (str != NULL)
16907c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
16917c478bd9Sstevel@tonic-gate 		else
16927c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
16937c478bd9Sstevel@tonic-gate 
16947c478bd9Sstevel@tonic-gate 		(void) printf(
16957c478bd9Sstevel@tonic-gate 		    " start=%-5d len=%-5d sys=%-2u pid=%d\n",
16967c478bd9Sstevel@tonic-gate 		    flock.l_start,
16977c478bd9Sstevel@tonic-gate 		    flock.l_len,
16987c478bd9Sstevel@tonic-gate 		    flock.l_sysid,
16997c478bd9Sstevel@tonic-gate 		    flock.l_pid);
17007c478bd9Sstevel@tonic-gate 	}
17017c478bd9Sstevel@tonic-gate }
17027c478bd9Sstevel@tonic-gate 
17037c478bd9Sstevel@tonic-gate void
show_flock64(private_t * pri,long offset)17047c478bd9Sstevel@tonic-gate show_flock64(private_t *pri, long offset)
17057c478bd9Sstevel@tonic-gate {
17067c478bd9Sstevel@tonic-gate 	struct flock64 flock;
17077c478bd9Sstevel@tonic-gate 
17087c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
17097c478bd9Sstevel@tonic-gate 		const char *str = NULL;
17107c478bd9Sstevel@tonic-gate 
17117c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
17127c478bd9Sstevel@tonic-gate 
17137c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
17147c478bd9Sstevel@tonic-gate 		case F_RDLCK:
17157c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
17167c478bd9Sstevel@tonic-gate 			break;
17177c478bd9Sstevel@tonic-gate 		case F_WRLCK:
17187c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
17197c478bd9Sstevel@tonic-gate 			break;
17207c478bd9Sstevel@tonic-gate 		case F_UNLCK:
17217c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
17227c478bd9Sstevel@tonic-gate 			break;
17237c478bd9Sstevel@tonic-gate 		}
17247c478bd9Sstevel@tonic-gate 		if (str != NULL)
17257c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
17267c478bd9Sstevel@tonic-gate 		else
17277c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
17287c478bd9Sstevel@tonic-gate 
17297c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
17307c478bd9Sstevel@tonic-gate 		if (str != NULL)
17317c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
17327c478bd9Sstevel@tonic-gate 		else
17337c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
17347c478bd9Sstevel@tonic-gate 
17357c478bd9Sstevel@tonic-gate 		(void) printf(
17367c478bd9Sstevel@tonic-gate 		    " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
17377c478bd9Sstevel@tonic-gate 		    (long long)flock.l_start,
17387c478bd9Sstevel@tonic-gate 		    (long long)flock.l_len,
17397c478bd9Sstevel@tonic-gate 		    flock.l_sysid,
17407c478bd9Sstevel@tonic-gate 		    (int)flock.l_pid);
17417c478bd9Sstevel@tonic-gate 	}
17427c478bd9Sstevel@tonic-gate }
17437c478bd9Sstevel@tonic-gate 
17447c478bd9Sstevel@tonic-gate void
show_share(private_t * pri,long offset)17457c478bd9Sstevel@tonic-gate show_share(private_t *pri, long offset)
17467c478bd9Sstevel@tonic-gate {
17477c478bd9Sstevel@tonic-gate 	struct fshare fshare;
17487c478bd9Sstevel@tonic-gate 
17497c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) {
17507c478bd9Sstevel@tonic-gate 		const char *str = NULL;
17517c478bd9Sstevel@tonic-gate 		int manddny = 0;
17527c478bd9Sstevel@tonic-gate 
17537c478bd9Sstevel@tonic-gate 		(void) printf("%s\taccess=", pri->pname);
17547c478bd9Sstevel@tonic-gate 
17557c478bd9Sstevel@tonic-gate 		switch (fshare.f_access) {
17567c478bd9Sstevel@tonic-gate 		case F_RDACC:
17577c478bd9Sstevel@tonic-gate 			str = "F_RDACC";
17587c478bd9Sstevel@tonic-gate 			break;
17597c478bd9Sstevel@tonic-gate 		case F_WRACC:
17607c478bd9Sstevel@tonic-gate 			str = "F_WRACC";
17617c478bd9Sstevel@tonic-gate 			break;
17627c478bd9Sstevel@tonic-gate 		case F_RWACC:
17637c478bd9Sstevel@tonic-gate 			str = "F_RWACC";
17647c478bd9Sstevel@tonic-gate 			break;
17657c478bd9Sstevel@tonic-gate 		}
17667c478bd9Sstevel@tonic-gate 		if (str != NULL)
17677c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
17687c478bd9Sstevel@tonic-gate 		else
17697c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", fshare.f_access);
17707c478bd9Sstevel@tonic-gate 
17717c478bd9Sstevel@tonic-gate 		str = NULL;
17727c478bd9Sstevel@tonic-gate 		if (fshare.f_deny & F_MANDDNY) {
17737c478bd9Sstevel@tonic-gate 			fshare.f_deny &= ~F_MANDDNY;
17747c478bd9Sstevel@tonic-gate 			manddny = 1;
17757c478bd9Sstevel@tonic-gate 		}
17767c478bd9Sstevel@tonic-gate 		switch (fshare.f_deny) {
17777c478bd9Sstevel@tonic-gate 		case F_NODNY:
17787c478bd9Sstevel@tonic-gate 			str = "F_NODNY";
17797c478bd9Sstevel@tonic-gate 			break;
17807c478bd9Sstevel@tonic-gate 		case F_RDDNY:
17817c478bd9Sstevel@tonic-gate 			str = "F_RDDNY";
17827c478bd9Sstevel@tonic-gate 			break;
17837c478bd9Sstevel@tonic-gate 		case F_WRDNY:
17847c478bd9Sstevel@tonic-gate 			str = "F_WRDNY";
17857c478bd9Sstevel@tonic-gate 			break;
17867c478bd9Sstevel@tonic-gate 		case F_RWDNY:
17877c478bd9Sstevel@tonic-gate 			str = "F_RWDNY";
17887c478bd9Sstevel@tonic-gate 			break;
17897c478bd9Sstevel@tonic-gate 		case F_COMPAT:
17907c478bd9Sstevel@tonic-gate 			str = "F_COMPAT";
17917c478bd9Sstevel@tonic-gate 			break;
17927c478bd9Sstevel@tonic-gate 		}
17937c478bd9Sstevel@tonic-gate 		if (str != NULL) {
17947c478bd9Sstevel@tonic-gate 			if (manddny)
17957c478bd9Sstevel@tonic-gate 				(void) printf("  deny=F_MANDDNY|%s", str);
17967c478bd9Sstevel@tonic-gate 			else
17977c478bd9Sstevel@tonic-gate 				(void) printf("  deny=%s", str);
17987c478bd9Sstevel@tonic-gate 		} else {
17997c478bd9Sstevel@tonic-gate 			(void) printf("  deny=0x%x", manddny?
18007c478bd9Sstevel@tonic-gate 			    fshare.f_deny | F_MANDDNY : fshare.f_deny);
18017c478bd9Sstevel@tonic-gate 		}
18027c478bd9Sstevel@tonic-gate 
18037c478bd9Sstevel@tonic-gate 		(void) printf("  id=%x\n", fshare.f_id);
18047c478bd9Sstevel@tonic-gate 	}
18057c478bd9Sstevel@tonic-gate }
18067c478bd9Sstevel@tonic-gate 
18077c478bd9Sstevel@tonic-gate void
show_ffg(private_t * pri)18087c478bd9Sstevel@tonic-gate show_ffg(private_t *pri)
18097c478bd9Sstevel@tonic-gate {
18107c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
18117c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
18127c478bd9Sstevel@tonic-gate 	prt_ffg(pri, 0, pri->Rval1);
18137c478bd9Sstevel@tonic-gate 	(void) puts(pri->sys_string);
18147c478bd9Sstevel@tonic-gate }
18157c478bd9Sstevel@tonic-gate 
1816*0250c53aSRobert Mustacchi void
show_ffd(private_t * pri)1817*0250c53aSRobert Mustacchi show_ffd(private_t *pri)
1818*0250c53aSRobert Mustacchi {
1819*0250c53aSRobert Mustacchi 	(void) putchar('\t');
1820*0250c53aSRobert Mustacchi 	(void) putchar('\t');
1821*0250c53aSRobert Mustacchi 	prt_ffd(pri, 0, pri->Rval1);
1822*0250c53aSRobert Mustacchi 	(void) puts(pri->sys_string);
1823*0250c53aSRobert Mustacchi }
1824*0250c53aSRobert Mustacchi 
18257c478bd9Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */
18267c478bd9Sstevel@tonic-gate void
show_fcntl(private_t * pri)18277c478bd9Sstevel@tonic-gate show_fcntl(private_t *pri)
18287c478bd9Sstevel@tonic-gate {
18297c478bd9Sstevel@tonic-gate 	long offset;
18307c478bd9Sstevel@tonic-gate 
18317c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) {
18327c478bd9Sstevel@tonic-gate 		show_ffg(pri);
18337c478bd9Sstevel@tonic-gate 		return;
18347c478bd9Sstevel@tonic-gate 	}
18357c478bd9Sstevel@tonic-gate 
1836*0250c53aSRobert Mustacchi 	if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFD) {
1837*0250c53aSRobert Mustacchi 		show_ffd(pri);
1838*0250c53aSRobert Mustacchi 		return;
1839*0250c53aSRobert Mustacchi 	}
1840*0250c53aSRobert Mustacchi 
184127aa4812SToomas Soome 	if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == 0)
18427c478bd9Sstevel@tonic-gate 		return;
18437c478bd9Sstevel@tonic-gate 
18447c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[1]) {
18457c478bd9Sstevel@tonic-gate 	case F_GETLK:
18467c478bd9Sstevel@tonic-gate 	case F_SETLK:
18477c478bd9Sstevel@tonic-gate 	case F_SETLKW:
18487c478bd9Sstevel@tonic-gate 	case F_FREESP:
18497c478bd9Sstevel@tonic-gate 	case F_ALLOCSP:
18507c478bd9Sstevel@tonic-gate 	case F_SETLK_NBMAND:
18517a5aac98SJerry Jelinek 	case F_OFD_GETLK:
18527a5aac98SJerry Jelinek 	case F_OFD_SETLK:
18537a5aac98SJerry Jelinek 	case F_OFD_SETLKW:
18547a5aac98SJerry Jelinek 	case F_FLOCK:
18557a5aac98SJerry Jelinek 	case F_FLOCKW:
18567c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
18577c478bd9Sstevel@tonic-gate 			show_flock64(pri, offset);
18587c478bd9Sstevel@tonic-gate 		else
18597c478bd9Sstevel@tonic-gate 			show_flock32(pri, offset);
18607c478bd9Sstevel@tonic-gate 		break;
18617c478bd9Sstevel@tonic-gate 	case 33:	/* F_GETLK64 */
18627c478bd9Sstevel@tonic-gate 	case 34:	/* F_SETLK64 */
18637c478bd9Sstevel@tonic-gate 	case 35:	/* F_SETLKW64 */
18647c478bd9Sstevel@tonic-gate 	case 27:	/* F_FREESP64 */
1865019c3c43Sraf 	case 28:	/* F_ALLOCSP64 */
18667c478bd9Sstevel@tonic-gate 	case 44:	/* F_SETLK64_NBMAND */
18677a5aac98SJerry Jelinek 	case 50:	/* F_OFD_GETLK64 */
18687a5aac98SJerry Jelinek 	case 51:	/* F_OFD_SETLK64 */
18697a5aac98SJerry Jelinek 	case 52:	/* F_OFD_SETLKW64 */
18707a5aac98SJerry Jelinek 	case 55:	/* F_FLOCK64 */
18717a5aac98SJerry Jelinek 	case 56:	/* F_FLOCKW64 */
18727c478bd9Sstevel@tonic-gate 		show_flock64(pri, offset);
18737c478bd9Sstevel@tonic-gate 		break;
18747c478bd9Sstevel@tonic-gate 	case F_SHARE:
18757c478bd9Sstevel@tonic-gate 	case F_UNSHARE:
18767c478bd9Sstevel@tonic-gate 		show_share(pri, offset);
18777c478bd9Sstevel@tonic-gate 		break;
18787c478bd9Sstevel@tonic-gate 	}
18797c478bd9Sstevel@tonic-gate }
18807c478bd9Sstevel@tonic-gate 
18817c478bd9Sstevel@tonic-gate void
show_strbuf(private_t * pri,long offset,const char * name,int dump)18827c478bd9Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump)
18837c478bd9Sstevel@tonic-gate {
18847c478bd9Sstevel@tonic-gate 	struct strbuf strbuf;
18857c478bd9Sstevel@tonic-gate 
18867c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
18877c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strbuf, name, dump);
18887c478bd9Sstevel@tonic-gate }
18897c478bd9Sstevel@tonic-gate 
18907c478bd9Sstevel@tonic-gate void
show_strbuf32(private_t * pri,long offset,const char * name,int dump)18917c478bd9Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump)
18927c478bd9Sstevel@tonic-gate {
18937c478bd9Sstevel@tonic-gate 	struct strbuf32 strbuf;
18947c478bd9Sstevel@tonic-gate 
18957c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
18967c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strbuf, name, dump);
18977c478bd9Sstevel@tonic-gate }
18987c478bd9Sstevel@tonic-gate 
18997c478bd9Sstevel@tonic-gate void
show_gp_msg(private_t * pri,int what)19007c478bd9Sstevel@tonic-gate show_gp_msg(private_t *pri, int what)
19017c478bd9Sstevel@tonic-gate {
19027c478bd9Sstevel@tonic-gate 	long offset;
19037c478bd9Sstevel@tonic-gate 	int dump = FALSE;
19047c478bd9Sstevel@tonic-gate 	int fdp1 = pri->sys_args[0] + 1;
19057c478bd9Sstevel@tonic-gate 
19067c478bd9Sstevel@tonic-gate 	switch (what) {
19077c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
19087c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
19097c478bd9Sstevel@tonic-gate 		if (pri->Errno == 0 && prismember(&readfd, fdp1))
19107c478bd9Sstevel@tonic-gate 			dump = TRUE;
19117c478bd9Sstevel@tonic-gate 		break;
19127c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
19137c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
19147c478bd9Sstevel@tonic-gate 		if (prismember(&writefd, fdp1))
19157c478bd9Sstevel@tonic-gate 			dump = TRUE;
19167c478bd9Sstevel@tonic-gate 		break;
19177c478bd9Sstevel@tonic-gate 	}
19187c478bd9Sstevel@tonic-gate 
19197c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
19207c478bd9Sstevel@tonic-gate 	if (dump)
19217c478bd9Sstevel@tonic-gate 		Eserialize();
19227c478bd9Sstevel@tonic-gate 
192327aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0) {
19247c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
19257c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "ctl", dump);
19267c478bd9Sstevel@tonic-gate 		else
19277c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "ctl", dump);
19287c478bd9Sstevel@tonic-gate 	}
192927aa4812SToomas Soome 	if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != 0) {
19307c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
19317c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "dat", dump);
19327c478bd9Sstevel@tonic-gate 		else
19337c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "dat", dump);
19347c478bd9Sstevel@tonic-gate 	}
19357c478bd9Sstevel@tonic-gate 
19367c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
19377c478bd9Sstevel@tonic-gate 	if (dump)
19387c478bd9Sstevel@tonic-gate 		Xserialize();
19397c478bd9Sstevel@tonic-gate }
19407c478bd9Sstevel@tonic-gate 
19417c478bd9Sstevel@tonic-gate void
show_int(private_t * pri,long offset,const char * name)19427c478bd9Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name)
19437c478bd9Sstevel@tonic-gate {
19447c478bd9Sstevel@tonic-gate 	int value;
19457c478bd9Sstevel@tonic-gate 
19467c478bd9Sstevel@tonic-gate 	if (offset != 0 &&
19477c478bd9Sstevel@tonic-gate 	    Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
19487c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t%d\n",
19497c478bd9Sstevel@tonic-gate 		    pri->pname,
19507c478bd9Sstevel@tonic-gate 		    name,
19517c478bd9Sstevel@tonic-gate 		    value);
19527c478bd9Sstevel@tonic-gate }
19537c478bd9Sstevel@tonic-gate 
19547c478bd9Sstevel@tonic-gate void
show_hhex_int(private_t * pri,long offset,const char * name)19557c478bd9Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name)
19567c478bd9Sstevel@tonic-gate {
19577c478bd9Sstevel@tonic-gate 	int value;
19587c478bd9Sstevel@tonic-gate 
19597c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
19607c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t0x%.4X\n",
19617c478bd9Sstevel@tonic-gate 		    pri->pname,
19627c478bd9Sstevel@tonic-gate 		    name,
19637c478bd9Sstevel@tonic-gate 		    value);
19647c478bd9Sstevel@tonic-gate }
19657c478bd9Sstevel@tonic-gate 
19667c478bd9Sstevel@tonic-gate #define	ALL_POLL_FLAGS	(POLLIN|POLLPRI|POLLOUT| \
19677c478bd9Sstevel@tonic-gate 	POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
19687c478bd9Sstevel@tonic-gate 
19697c478bd9Sstevel@tonic-gate const char *
pollevent(private_t * pri,int arg)19707c478bd9Sstevel@tonic-gate pollevent(private_t *pri, int arg)
19717c478bd9Sstevel@tonic-gate {
19727c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
19737c478bd9Sstevel@tonic-gate 
19747c478bd9Sstevel@tonic-gate 	if (arg == 0)
19757c478bd9Sstevel@tonic-gate 		return ("0");
19767c478bd9Sstevel@tonic-gate 	if (arg & ~ALL_POLL_FLAGS) {
19777c478bd9Sstevel@tonic-gate 		(void) sprintf(str, "0x%-5X", arg);
19787c478bd9Sstevel@tonic-gate 		return ((const char *)str);
19797c478bd9Sstevel@tonic-gate 	}
19807c478bd9Sstevel@tonic-gate 
19817c478bd9Sstevel@tonic-gate 	*str = '\0';
19827c478bd9Sstevel@tonic-gate 	if (arg & POLLIN)
19837c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLIN");
19847c478bd9Sstevel@tonic-gate 	if (arg & POLLPRI)
19857c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLPRI");
19867c478bd9Sstevel@tonic-gate 	if (arg & POLLOUT)
19877c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLOUT");
19887c478bd9Sstevel@tonic-gate 	if (arg & POLLRDNORM)
19897c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDNORM");
19907c478bd9Sstevel@tonic-gate 	if (arg & POLLRDBAND)
19917c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDBAND");
19927c478bd9Sstevel@tonic-gate 	if (arg & POLLWRBAND)
19937c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLWRBAND");
19947c478bd9Sstevel@tonic-gate 	if (arg & POLLERR)
19957c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLERR");
19967c478bd9Sstevel@tonic-gate 	if (arg & POLLHUP)
19977c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLHUP");
19987c478bd9Sstevel@tonic-gate 	if (arg & POLLNVAL)
19997c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLNVAL");
20007c478bd9Sstevel@tonic-gate 
20017c478bd9Sstevel@tonic-gate 	return ((const char *)(str+1));
20027c478bd9Sstevel@tonic-gate }
20037c478bd9Sstevel@tonic-gate 
20047c478bd9Sstevel@tonic-gate static void
show_one_pollfd(private_t * pri,struct pollfd * ppollfd)20057c478bd9Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd)
20067c478bd9Sstevel@tonic-gate {
20077c478bd9Sstevel@tonic-gate 	/*
20087c478bd9Sstevel@tonic-gate 	 * can't print both events and revents in same printf.
20097c478bd9Sstevel@tonic-gate 	 * pollevent() returns a pointer to a TSD location.
20107c478bd9Sstevel@tonic-gate 	 */
20117c478bd9Sstevel@tonic-gate 	(void) printf("%s\tfd=%-2d ev=%s",
20127c478bd9Sstevel@tonic-gate 	    pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events));
20137c478bd9Sstevel@tonic-gate 	(void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents));
20147c478bd9Sstevel@tonic-gate }
20157c478bd9Sstevel@tonic-gate 
20167c478bd9Sstevel@tonic-gate static void
show_all_pollfds(private_t * pri,long offset,int nfds)20177c478bd9Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds)
20187c478bd9Sstevel@tonic-gate {
20197c478bd9Sstevel@tonic-gate 	struct pollfd pollfd[2];
20207c478bd9Sstevel@tonic-gate 	int skip = -1;
20217c478bd9Sstevel@tonic-gate 
20227c478bd9Sstevel@tonic-gate 	for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) {
20237c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) !=
20247c478bd9Sstevel@tonic-gate 		    sizeof (struct pollfd))
20257c478bd9Sstevel@tonic-gate 			continue;
20267c478bd9Sstevel@tonic-gate 
20277c478bd9Sstevel@tonic-gate 		if (skip >= 0 && pollfd[0].fd == pollfd[1].fd &&
20287c478bd9Sstevel@tonic-gate 		    pollfd[0].events == pollfd[1].events &&
20297c478bd9Sstevel@tonic-gate 		    pollfd[0].revents == pollfd[1].revents) {
20307c478bd9Sstevel@tonic-gate 			skip++;
20317c478bd9Sstevel@tonic-gate 			continue;
20327c478bd9Sstevel@tonic-gate 		}
20337c478bd9Sstevel@tonic-gate 
20347c478bd9Sstevel@tonic-gate 		if (skip > 0)
20357c478bd9Sstevel@tonic-gate 			(void) printf("%s\t...last pollfd structure"
20367c478bd9Sstevel@tonic-gate 			    " repeated %d time%s...\n",
20377c478bd9Sstevel@tonic-gate 			    pri->pname, skip, (skip == 1 ? "" : "s"));
20387c478bd9Sstevel@tonic-gate 
20397c478bd9Sstevel@tonic-gate 		skip = 0;
20407c478bd9Sstevel@tonic-gate 		show_one_pollfd(pri, &pollfd[0]);
20417c478bd9Sstevel@tonic-gate 		pollfd[1] = pollfd[0];
20427c478bd9Sstevel@tonic-gate 	}
20437c478bd9Sstevel@tonic-gate 
20447c478bd9Sstevel@tonic-gate 	if (skip > 0)
20457c478bd9Sstevel@tonic-gate 		(void) printf(
20467c478bd9Sstevel@tonic-gate 		    "%s\t...last pollfd structure repeated %d time%s...\n",
20477c478bd9Sstevel@tonic-gate 		    pri->pname, skip, (skip == 1 ? "" : "s"));
20487c478bd9Sstevel@tonic-gate }
20497c478bd9Sstevel@tonic-gate 
20507c478bd9Sstevel@tonic-gate void
show_pollsys(private_t * pri)20517c478bd9Sstevel@tonic-gate show_pollsys(private_t *pri)
20527c478bd9Sstevel@tonic-gate {
20537c478bd9Sstevel@tonic-gate 	long offset;
20547c478bd9Sstevel@tonic-gate 	int nfds;
20557c478bd9Sstevel@tonic-gate 	int serial = 0;
20567c478bd9Sstevel@tonic-gate 
20577c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2)
20587c478bd9Sstevel@tonic-gate 		return;
20597c478bd9Sstevel@tonic-gate 
20607c478bd9Sstevel@tonic-gate 	offset = pri->sys_args[0];
20617c478bd9Sstevel@tonic-gate 	nfds = pri->sys_args[1];
20627c478bd9Sstevel@tonic-gate 
20637c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
206427aa4812SToomas Soome 	if (offset != 0 && nfds > 32) {
20657c478bd9Sstevel@tonic-gate 		Eserialize();
20667c478bd9Sstevel@tonic-gate 		serial = 1;
20677c478bd9Sstevel@tonic-gate 	}
20687c478bd9Sstevel@tonic-gate 
206927aa4812SToomas Soome 	if (offset != 0 && nfds > 0)
20707c478bd9Sstevel@tonic-gate 		show_all_pollfds(pri, offset, nfds);
20717c478bd9Sstevel@tonic-gate 
20727c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 2)
20737c478bd9Sstevel@tonic-gate 		show_timestruc(pri, (long)pri->sys_args[2], "timeout");
20747c478bd9Sstevel@tonic-gate 
20757c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 3)
20767c478bd9Sstevel@tonic-gate 		show_sigset(pri, (long)pri->sys_args[3], "sigmask");
20777c478bd9Sstevel@tonic-gate 
20787c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
20797c478bd9Sstevel@tonic-gate 	if (serial)
20807c478bd9Sstevel@tonic-gate 		Xserialize();
20817c478bd9Sstevel@tonic-gate }
20827c478bd9Sstevel@tonic-gate 
20837c478bd9Sstevel@tonic-gate static void
show_perm64(private_t * pri,struct ipc_perm64 * ip)20847c478bd9Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip)
20857c478bd9Sstevel@tonic-gate {
2086f48205beScasper 	(void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
20877c478bd9Sstevel@tonic-gate 	    "m=0%.6o key=%d projid=%-5d\n",
20887c478bd9Sstevel@tonic-gate 	    pri->pname,
2089f48205beScasper 	    ip->ipcx_uid,
2090f48205beScasper 	    ip->ipcx_gid,
2091f48205beScasper 	    ip->ipcx_cuid,
2092f48205beScasper 	    ip->ipcx_cgid,
20937c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_zoneid,
20947c478bd9Sstevel@tonic-gate 	    (unsigned int)ip->ipcx_mode,
20957c478bd9Sstevel@tonic-gate 	    ip->ipcx_key,
20967c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_projid);
20977c478bd9Sstevel@tonic-gate }
20987c478bd9Sstevel@tonic-gate 
20997c478bd9Sstevel@tonic-gate void
show_perm(private_t * pri,struct ipc_perm * ip)21007c478bd9Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip)
21017c478bd9Sstevel@tonic-gate {
21027c478bd9Sstevel@tonic-gate 	(void) printf(
21037c478bd9Sstevel@tonic-gate 	    "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
21047c478bd9Sstevel@tonic-gate 	    pri->pname,
2105f48205beScasper 	    ip->uid,
2106f48205beScasper 	    ip->gid,
2107f48205beScasper 	    ip->cuid,
2108f48205beScasper 	    ip->cgid,
21097c478bd9Sstevel@tonic-gate 	    (int)ip->mode,
21107c478bd9Sstevel@tonic-gate 	    ip->seq,
21117c478bd9Sstevel@tonic-gate 	    ip->key);
21127c478bd9Sstevel@tonic-gate }
21137c478bd9Sstevel@tonic-gate 
21147c478bd9Sstevel@tonic-gate void
show_perm32(private_t * pri,struct ipc_perm32 * ip)21157c478bd9Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip)
21167c478bd9Sstevel@tonic-gate {
21177c478bd9Sstevel@tonic-gate 	(void) printf(
21187c478bd9Sstevel@tonic-gate 	    "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
21197c478bd9Sstevel@tonic-gate 	    pri->pname,
21207c478bd9Sstevel@tonic-gate 	    ip->uid,
21217c478bd9Sstevel@tonic-gate 	    ip->gid,
21227c478bd9Sstevel@tonic-gate 	    ip->cuid,
21237c478bd9Sstevel@tonic-gate 	    ip->cgid,
21247c478bd9Sstevel@tonic-gate 	    ip->mode,
21257c478bd9Sstevel@tonic-gate 	    ip->seq,
21267c478bd9Sstevel@tonic-gate 	    ip->key);
21277c478bd9Sstevel@tonic-gate }
21287c478bd9Sstevel@tonic-gate 
21297c478bd9Sstevel@tonic-gate static void
show_msgctl64(private_t * pri,long offset)21307c478bd9Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset)
21317c478bd9Sstevel@tonic-gate {
21327c478bd9Sstevel@tonic-gate 	struct msqid_ds64 msgq;
21337c478bd9Sstevel@tonic-gate 
213427aa4812SToomas Soome 	if (offset != 0 &&
21357c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21367c478bd9Sstevel@tonic-gate 		show_perm64(pri, &msgq.msgx_perm);
21377c478bd9Sstevel@tonic-gate 
21387c478bd9Sstevel@tonic-gate 		(void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
21397c478bd9Sstevel@tonic-gate 		    "lspid=%-5d lrpid=%-5d\n", pri->pname,
21407c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_cbytes,
21417c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qnum,
21427c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qbytes,
21437c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lspid,
21447c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lrpid);
21457c478bd9Sstevel@tonic-gate 
21467c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", (time_t)msgq.msgx_stime);
21477c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", (time_t)msgq.msgx_rtime);
21487c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)msgq.msgx_ctime);
21497c478bd9Sstevel@tonic-gate 	}
21507c478bd9Sstevel@tonic-gate }
21517c478bd9Sstevel@tonic-gate 
21527c478bd9Sstevel@tonic-gate void
show_msgctl(private_t * pri,long offset)21537c478bd9Sstevel@tonic-gate show_msgctl(private_t *pri, long offset)
21547c478bd9Sstevel@tonic-gate {
21557c478bd9Sstevel@tonic-gate 	struct msqid_ds msgq;
21567c478bd9Sstevel@tonic-gate 
215727aa4812SToomas Soome 	if (offset != 0 &&
21587c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21597c478bd9Sstevel@tonic-gate 		show_perm(pri, &msgq.msg_perm);
21607c478bd9Sstevel@tonic-gate 
21617c478bd9Sstevel@tonic-gate 		(void) printf(
21627c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
21637c478bd9Sstevel@tonic-gate 		    pri->pname,
21647c478bd9Sstevel@tonic-gate 		    msgq.msg_cbytes,
21657c478bd9Sstevel@tonic-gate 		    msgq.msg_qnum,
21667c478bd9Sstevel@tonic-gate 		    msgq.msg_qbytes,
21677c478bd9Sstevel@tonic-gate 		    (int)msgq.msg_lspid,
21687c478bd9Sstevel@tonic-gate 		    (int)msgq.msg_lrpid);
21697c478bd9Sstevel@tonic-gate 
21707c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
21717c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
21727c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
21737c478bd9Sstevel@tonic-gate 	}
21747c478bd9Sstevel@tonic-gate }
21757c478bd9Sstevel@tonic-gate 
21767c478bd9Sstevel@tonic-gate void
show_msgctl32(private_t * pri,long offset)21777c478bd9Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset)
21787c478bd9Sstevel@tonic-gate {
21797c478bd9Sstevel@tonic-gate 	struct msqid_ds32 msgq;
21807c478bd9Sstevel@tonic-gate 
218127aa4812SToomas Soome 	if (offset != 0 &&
21827c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21837c478bd9Sstevel@tonic-gate 		show_perm32(pri, &msgq.msg_perm);
21847c478bd9Sstevel@tonic-gate 
21857c478bd9Sstevel@tonic-gate 		(void) printf(
21867c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
21877c478bd9Sstevel@tonic-gate 		    pri->pname,
21887c478bd9Sstevel@tonic-gate 		    msgq.msg_cbytes,
21897c478bd9Sstevel@tonic-gate 		    msgq.msg_qnum,
21907c478bd9Sstevel@tonic-gate 		    msgq.msg_qbytes,
21917c478bd9Sstevel@tonic-gate 		    msgq.msg_lspid,
21927c478bd9Sstevel@tonic-gate 		    msgq.msg_lrpid);
21937c478bd9Sstevel@tonic-gate 
21947c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
21957c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
21967c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
21977c478bd9Sstevel@tonic-gate 	}
21987c478bd9Sstevel@tonic-gate }
21997c478bd9Sstevel@tonic-gate 
22007c478bd9Sstevel@tonic-gate void
show_msgbuf(private_t * pri,long offset,long msgsz)22017c478bd9Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz)
22027c478bd9Sstevel@tonic-gate {
22037c478bd9Sstevel@tonic-gate 	struct msgbuf msgb;
22047c478bd9Sstevel@tonic-gate 
220527aa4812SToomas Soome 	if (offset != 0 &&
22067c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
22077c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
22087c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
22097c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22107c478bd9Sstevel@tonic-gate 			Eserialize();
22117c478bd9Sstevel@tonic-gate 
22127c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%lu  mtext[]=\n",
22137c478bd9Sstevel@tonic-gate 		    pri->pname,
22147c478bd9Sstevel@tonic-gate 		    msgb.mtype);
22157c478bd9Sstevel@tonic-gate 		showbuffer(pri,
22167c478bd9Sstevel@tonic-gate 		    (long)(offset + sizeof (msgb.mtype)), msgsz);
22177c478bd9Sstevel@tonic-gate 
22187c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
22197c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22207c478bd9Sstevel@tonic-gate 			Xserialize();
22217c478bd9Sstevel@tonic-gate 	}
22227c478bd9Sstevel@tonic-gate }
22237c478bd9Sstevel@tonic-gate 
22247c478bd9Sstevel@tonic-gate void
show_msgbuf32(private_t * pri,long offset,long msgsz)22257c478bd9Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz)
22267c478bd9Sstevel@tonic-gate {
22277c478bd9Sstevel@tonic-gate 	struct ipcmsgbuf32 msgb;
22287c478bd9Sstevel@tonic-gate 
222927aa4812SToomas Soome 	if (offset != 0 &&
22307c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
22317c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
22327c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
22337c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22347c478bd9Sstevel@tonic-gate 			Eserialize();
22357c478bd9Sstevel@tonic-gate 
22367c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%u  mtext[]=\n",
22377c478bd9Sstevel@tonic-gate 		    pri->pname,
22387c478bd9Sstevel@tonic-gate 		    msgb.mtype);
22397c478bd9Sstevel@tonic-gate 		showbuffer(pri,
22407c478bd9Sstevel@tonic-gate 		    (long)(offset + sizeof (msgb.mtype)), msgsz);
22417c478bd9Sstevel@tonic-gate 
22427c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
22437c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22447c478bd9Sstevel@tonic-gate 			Xserialize();
22457c478bd9Sstevel@tonic-gate 	}
22467c478bd9Sstevel@tonic-gate }
22477c478bd9Sstevel@tonic-gate 
22487c478bd9Sstevel@tonic-gate void
show_msgsys(private_t * pri,long msgsz)22497c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
22507c478bd9Sstevel@tonic-gate {
22517c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
22527c478bd9Sstevel@tonic-gate 	case 0:			/* msgget() */
22537c478bd9Sstevel@tonic-gate 		break;
22547c478bd9Sstevel@tonic-gate 	case 1:			/* msgctl() */
22557c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
22567c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
22577c478bd9Sstevel@tonic-gate 			case IPC_STAT:
22587c478bd9Sstevel@tonic-gate 				if (pri->Errno)
22597c478bd9Sstevel@tonic-gate 					break;
22607c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
22617c478bd9Sstevel@tonic-gate 			case IPC_SET:
22627c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
22637c478bd9Sstevel@tonic-gate 					show_msgctl(pri,
22647c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[3]);
22657c478bd9Sstevel@tonic-gate 				else
22667c478bd9Sstevel@tonic-gate 					show_msgctl32(pri,
22677c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[3]);
22687c478bd9Sstevel@tonic-gate 				break;
22697c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
22707c478bd9Sstevel@tonic-gate 				if (pri->Errno)
22717c478bd9Sstevel@tonic-gate 					break;
22727c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
22737c478bd9Sstevel@tonic-gate 			case IPC_SET64:
22747c478bd9Sstevel@tonic-gate 				show_msgctl64(pri, (long)pri->sys_args[3]);
22757c478bd9Sstevel@tonic-gate 				break;
22767c478bd9Sstevel@tonic-gate 			}
22777c478bd9Sstevel@tonic-gate 		}
22787c478bd9Sstevel@tonic-gate 		break;
22797c478bd9Sstevel@tonic-gate 	case 2:			/* msgrcv() */
22807c478bd9Sstevel@tonic-gate 		if (!pri->Errno && pri->sys_nargs > 2) {
22817c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
22827c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2], msgsz);
22837c478bd9Sstevel@tonic-gate 			else
22847c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2], msgsz);
22857c478bd9Sstevel@tonic-gate 		}
22867c478bd9Sstevel@tonic-gate 		break;
22877c478bd9Sstevel@tonic-gate 	case 3:			/* msgsnd() */
22887c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
22897c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
22907c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2],
22917c478bd9Sstevel@tonic-gate 				    pri->sys_args[3]);
22927c478bd9Sstevel@tonic-gate 			else
22937c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2],
22947c478bd9Sstevel@tonic-gate 				    pri->sys_args[3]);
22957c478bd9Sstevel@tonic-gate 		}
22967c478bd9Sstevel@tonic-gate 		break;
22977c478bd9Sstevel@tonic-gate 	case 4:			/* msgids() */
22987c478bd9Sstevel@tonic-gate 	case 5:			/* msgsnap() */
22997c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
23007c478bd9Sstevel@tonic-gate 		break;
23017c478bd9Sstevel@tonic-gate 	}
23027c478bd9Sstevel@tonic-gate }
23037c478bd9Sstevel@tonic-gate 
23047c478bd9Sstevel@tonic-gate static void
show_semctl64(private_t * pri,long offset)23057c478bd9Sstevel@tonic-gate show_semctl64(private_t *pri, long offset)
23067c478bd9Sstevel@tonic-gate {
23077c478bd9Sstevel@tonic-gate 	struct semid_ds64 semds;
23087c478bd9Sstevel@tonic-gate 
230927aa4812SToomas Soome 	if (offset != 0 &&
23107c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
23117c478bd9Sstevel@tonic-gate 		show_perm64(pri, &semds.semx_perm);
23127c478bd9Sstevel@tonic-gate 
23137c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems);
23147c478bd9Sstevel@tonic-gate 
23157c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", (time_t)semds.semx_otime);
23167c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)semds.semx_ctime);
23177c478bd9Sstevel@tonic-gate 	}
23187c478bd9Sstevel@tonic-gate }
23197c478bd9Sstevel@tonic-gate 
23207c478bd9Sstevel@tonic-gate void
show_semctl(private_t * pri,long offset)23217c478bd9Sstevel@tonic-gate show_semctl(private_t *pri, long offset)
23227c478bd9Sstevel@tonic-gate {
23237c478bd9Sstevel@tonic-gate 	struct semid_ds semds;
23247c478bd9Sstevel@tonic-gate 
232527aa4812SToomas Soome 	if (offset != 0 &&
23267c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
23277c478bd9Sstevel@tonic-gate 		show_perm(pri, &semds.sem_perm);
23287c478bd9Sstevel@tonic-gate 
23297c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
23307c478bd9Sstevel@tonic-gate 		    pri->pname,
23317c478bd9Sstevel@tonic-gate 		    semds.sem_nsems);
23327c478bd9Sstevel@tonic-gate 
23337c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
23347c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
23357c478bd9Sstevel@tonic-gate 	}
23367c478bd9Sstevel@tonic-gate }
23377c478bd9Sstevel@tonic-gate 
23387c478bd9Sstevel@tonic-gate void
show_semctl32(private_t * pri,long offset)23397c478bd9Sstevel@tonic-gate show_semctl32(private_t *pri, long offset)
23407c478bd9Sstevel@tonic-gate {
23417c478bd9Sstevel@tonic-gate 	struct semid_ds32 semds;
23427c478bd9Sstevel@tonic-gate 
234327aa4812SToomas Soome 	if (offset != 0 &&
23447c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
23457c478bd9Sstevel@tonic-gate 		show_perm32(pri, &semds.sem_perm);
23467c478bd9Sstevel@tonic-gate 
23477c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
23487c478bd9Sstevel@tonic-gate 		    pri->pname,
23497c478bd9Sstevel@tonic-gate 		    semds.sem_nsems);
23507c478bd9Sstevel@tonic-gate 
23517c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
23527c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
23537c478bd9Sstevel@tonic-gate 	}
23547c478bd9Sstevel@tonic-gate }
23557c478bd9Sstevel@tonic-gate 
23567c478bd9Sstevel@tonic-gate void
show_semop(private_t * pri,long offset,long nsops,long timeout)23577c478bd9Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout)
23587c478bd9Sstevel@tonic-gate {
23597c478bd9Sstevel@tonic-gate 	struct sembuf sembuf;
23607c478bd9Sstevel@tonic-gate 	const char *str;
23617c478bd9Sstevel@tonic-gate 
23623b862e9aSRoger A. Faulkner 	if (offset == 0)
23637c478bd9Sstevel@tonic-gate 		return;
23647c478bd9Sstevel@tonic-gate 
23657c478bd9Sstevel@tonic-gate 	if (nsops > 40)		/* let's not be ridiculous */
23667c478bd9Sstevel@tonic-gate 		nsops = 40;
23677c478bd9Sstevel@tonic-gate 
23687c478bd9Sstevel@tonic-gate 	for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) {
23697c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &sembuf, sizeof (sembuf), offset) !=
23707c478bd9Sstevel@tonic-gate 		    sizeof (sembuf))
23717c478bd9Sstevel@tonic-gate 			break;
23727c478bd9Sstevel@tonic-gate 
23737c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
23747c478bd9Sstevel@tonic-gate 		    pri->pname,
23757c478bd9Sstevel@tonic-gate 		    sembuf.sem_num,
23767c478bd9Sstevel@tonic-gate 		    sembuf.sem_op);
23777c478bd9Sstevel@tonic-gate 
23787c478bd9Sstevel@tonic-gate 		if (sembuf.sem_flg == 0)
23797c478bd9Sstevel@tonic-gate 			(void) printf("0\n");
23807c478bd9Sstevel@tonic-gate 		else if ((str = semflags(pri, sembuf.sem_flg)) != NULL)
23817c478bd9Sstevel@tonic-gate 			(void) printf("%s\n", str);
23827c478bd9Sstevel@tonic-gate 		else
23837c478bd9Sstevel@tonic-gate 			(void) printf("0%.6o\n", sembuf.sem_flg);
23847c478bd9Sstevel@tonic-gate 	}
23857c478bd9Sstevel@tonic-gate 	if (timeout)
23867c478bd9Sstevel@tonic-gate 		show_timestruc(pri, timeout, "timeout");
23877c478bd9Sstevel@tonic-gate }
23887c478bd9Sstevel@tonic-gate 
23897c478bd9Sstevel@tonic-gate void
show_semsys(private_t * pri)23907c478bd9Sstevel@tonic-gate show_semsys(private_t *pri)
23917c478bd9Sstevel@tonic-gate {
23927c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
23937c478bd9Sstevel@tonic-gate 	case 0:			/* semctl() */
23947c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4) {
23957c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[3]) {
23967c478bd9Sstevel@tonic-gate 			case IPC_STAT:
23977c478bd9Sstevel@tonic-gate 				if (pri->Errno)
23987c478bd9Sstevel@tonic-gate 					break;
23997c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
24007c478bd9Sstevel@tonic-gate 			case IPC_SET:
24017c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
24027c478bd9Sstevel@tonic-gate 					show_semctl(pri,
24037c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[4]);
24047c478bd9Sstevel@tonic-gate 				else
24057c478bd9Sstevel@tonic-gate 					show_semctl32(pri,
24067c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[4]);
24077c478bd9Sstevel@tonic-gate 				break;
24087c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
24097c478bd9Sstevel@tonic-gate 				if (pri->Errno)
24107c478bd9Sstevel@tonic-gate 					break;
24117c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
24127c478bd9Sstevel@tonic-gate 			case IPC_SET64:
24137c478bd9Sstevel@tonic-gate 				show_semctl64(pri, (long)pri->sys_args[4]);
24147c478bd9Sstevel@tonic-gate 				break;
24157c478bd9Sstevel@tonic-gate 			}
24167c478bd9Sstevel@tonic-gate 		}
24177c478bd9Sstevel@tonic-gate 		break;
24187c478bd9Sstevel@tonic-gate 	case 1:			/* semget() */
24197c478bd9Sstevel@tonic-gate 		break;
24207c478bd9Sstevel@tonic-gate 	case 2:			/* semop() */
24217c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
24227c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
24237c478bd9Sstevel@tonic-gate 			    pri->sys_args[3], 0);
24247c478bd9Sstevel@tonic-gate 		break;
24257c478bd9Sstevel@tonic-gate 	case 3:			/* semids() */
24267c478bd9Sstevel@tonic-gate 		break;
24277c478bd9Sstevel@tonic-gate 	case 4:			/* semtimedop() */
24287c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
24297c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
24307c478bd9Sstevel@tonic-gate 			    pri->sys_args[3], pri->sys_args[4]);
24317c478bd9Sstevel@tonic-gate 		break;
24327c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
24337c478bd9Sstevel@tonic-gate 		break;
24347c478bd9Sstevel@tonic-gate 	}
24357c478bd9Sstevel@tonic-gate }
24367c478bd9Sstevel@tonic-gate 
24377c478bd9Sstevel@tonic-gate static void
show_shmctl64(private_t * pri,long offset)24387c478bd9Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset)
24397c478bd9Sstevel@tonic-gate {
24407c478bd9Sstevel@tonic-gate 	struct shmid_ds64 shmds;
24417c478bd9Sstevel@tonic-gate 
244227aa4812SToomas Soome 	if (offset != 0 &&
24437c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24447c478bd9Sstevel@tonic-gate 		show_perm64(pri, &shmds.shmx_perm);
24457c478bd9Sstevel@tonic-gate 
24467c478bd9Sstevel@tonic-gate 		(void) printf(
24477c478bd9Sstevel@tonic-gate 		    "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
24487c478bd9Sstevel@tonic-gate 		    pri->pname,
24497c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_segsz,
24507c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_lpid,
24517c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_cpid,
24527c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_nattch,
24537c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_cnattch);
24547c478bd9Sstevel@tonic-gate 
24557c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", (time_t)shmds.shmx_atime);
24567c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", (time_t)shmds.shmx_dtime);
24577c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)shmds.shmx_ctime);
24587c478bd9Sstevel@tonic-gate 	}
24597c478bd9Sstevel@tonic-gate }
24607c478bd9Sstevel@tonic-gate 
24617c478bd9Sstevel@tonic-gate void
show_shmctl(private_t * pri,long offset)24627c478bd9Sstevel@tonic-gate show_shmctl(private_t *pri, long offset)
24637c478bd9Sstevel@tonic-gate {
24647c478bd9Sstevel@tonic-gate 	struct shmid_ds shmds;
24657c478bd9Sstevel@tonic-gate 
246627aa4812SToomas Soome 	if (offset != 0 &&
24677c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24687c478bd9Sstevel@tonic-gate 		show_perm(pri, &shmds.shm_perm);
24697c478bd9Sstevel@tonic-gate 
24707c478bd9Sstevel@tonic-gate 		(void) printf(
24717c478bd9Sstevel@tonic-gate 		    "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
24727c478bd9Sstevel@tonic-gate 		    pri->pname,
24737c478bd9Sstevel@tonic-gate 		    (ulong_t)shmds.shm_segsz,
24747c478bd9Sstevel@tonic-gate 		    (int)shmds.shm_lpid,
24757c478bd9Sstevel@tonic-gate 		    (int)shmds.shm_cpid,
24767c478bd9Sstevel@tonic-gate 		    shmds.shm_nattch,
24777c478bd9Sstevel@tonic-gate 		    shmds.shm_cnattch);
24787c478bd9Sstevel@tonic-gate 
24797c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
24807c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
24817c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
24827c478bd9Sstevel@tonic-gate 	}
24837c478bd9Sstevel@tonic-gate }
24847c478bd9Sstevel@tonic-gate 
24857c478bd9Sstevel@tonic-gate void
show_shmctl32(private_t * pri,long offset)24867c478bd9Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset)
24877c478bd9Sstevel@tonic-gate {
24887c478bd9Sstevel@tonic-gate 	struct shmid_ds32 shmds;
24897c478bd9Sstevel@tonic-gate 
249027aa4812SToomas Soome 	if (offset != 0 &&
24917c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24927c478bd9Sstevel@tonic-gate 		show_perm32(pri, &shmds.shm_perm);
24937c478bd9Sstevel@tonic-gate 
24947c478bd9Sstevel@tonic-gate 		(void) printf(
24957c478bd9Sstevel@tonic-gate 		    "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
24967c478bd9Sstevel@tonic-gate 		    pri->pname,
24977c478bd9Sstevel@tonic-gate 		    shmds.shm_segsz,
24987c478bd9Sstevel@tonic-gate 		    shmds.shm_lpid,
24997c478bd9Sstevel@tonic-gate 		    shmds.shm_cpid,
25007c478bd9Sstevel@tonic-gate 		    shmds.shm_nattch,
25017c478bd9Sstevel@tonic-gate 		    shmds.shm_cnattch);
25027c478bd9Sstevel@tonic-gate 
25037c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
25047c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
25057c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
25067c478bd9Sstevel@tonic-gate 	}
25077c478bd9Sstevel@tonic-gate }
25087c478bd9Sstevel@tonic-gate 
25097c478bd9Sstevel@tonic-gate void
show_shmsys(private_t * pri)25107c478bd9Sstevel@tonic-gate show_shmsys(private_t *pri)
25117c478bd9Sstevel@tonic-gate {
25127c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
25137c478bd9Sstevel@tonic-gate 	case 0:			/* shmat() */
25147c478bd9Sstevel@tonic-gate 		break;
25157c478bd9Sstevel@tonic-gate 	case 1:			/* shmctl() */
25167c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
25177c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
25187c478bd9Sstevel@tonic-gate 			case IPC_STAT:
25197c478bd9Sstevel@tonic-gate 				if (pri->Errno)
25207c478bd9Sstevel@tonic-gate 					break;
25217c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
25227c478bd9Sstevel@tonic-gate 			case IPC_SET:
25237c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
25247c478bd9Sstevel@tonic-gate 					show_shmctl(pri,
25257c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[3]);
25267c478bd9Sstevel@tonic-gate 				else
25277c478bd9Sstevel@tonic-gate 					show_shmctl32(pri,
25287c478bd9Sstevel@tonic-gate 					    (long)pri->sys_args[3]);
25297c478bd9Sstevel@tonic-gate 				break;
25307c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
25317c478bd9Sstevel@tonic-gate 				if (pri->Errno)
25327c478bd9Sstevel@tonic-gate 					break;
25337c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
25347c478bd9Sstevel@tonic-gate 			case IPC_SET64:
25357c478bd9Sstevel@tonic-gate 				show_shmctl64(pri, (long)pri->sys_args[3]);
25367c478bd9Sstevel@tonic-gate 				break;
25377c478bd9Sstevel@tonic-gate 			}
25387c478bd9Sstevel@tonic-gate 		}
25397c478bd9Sstevel@tonic-gate 		break;
25407c478bd9Sstevel@tonic-gate 	case 2:			/* shmdt() */
25417c478bd9Sstevel@tonic-gate 	case 3:			/* shmget() */
25427c478bd9Sstevel@tonic-gate 	case 4:			/* shmids() */
25437c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
25447c478bd9Sstevel@tonic-gate 		break;
25457c478bd9Sstevel@tonic-gate 	}
25467c478bd9Sstevel@tonic-gate }
25477c478bd9Sstevel@tonic-gate 
25487c478bd9Sstevel@tonic-gate void
show_groups(private_t * pri,long offset,long count)25497c478bd9Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count)
25507c478bd9Sstevel@tonic-gate {
25517c478bd9Sstevel@tonic-gate 	int groups[100];
25527c478bd9Sstevel@tonic-gate 
25537c478bd9Sstevel@tonic-gate 	if (count > 100)
25547c478bd9Sstevel@tonic-gate 		count = 100;
25557c478bd9Sstevel@tonic-gate 
255627aa4812SToomas Soome 	if (count > 0 && offset != 0 &&
25577c478bd9Sstevel@tonic-gate 	    Pread(Proc, &groups[0], count*sizeof (int), offset) ==
25587c478bd9Sstevel@tonic-gate 	    count*sizeof (int)) {
25597c478bd9Sstevel@tonic-gate 		int n;
25607c478bd9Sstevel@tonic-gate 
25617c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
25627c478bd9Sstevel@tonic-gate 		for (n = 0; !interrupt && n < count; n++) {
25637c478bd9Sstevel@tonic-gate 			if (n != 0 && n%10 == 0)
25647c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t", pri->pname);
25657c478bd9Sstevel@tonic-gate 			(void) printf(" %5d", groups[n]);
25667c478bd9Sstevel@tonic-gate 		}
25677c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
25687c478bd9Sstevel@tonic-gate 	}
25697c478bd9Sstevel@tonic-gate }
25707c478bd9Sstevel@tonic-gate 
25717c478bd9Sstevel@tonic-gate /*
25727c478bd9Sstevel@tonic-gate  * This assumes that a sigset_t is simply an array of ints.
25737c478bd9Sstevel@tonic-gate  */
25747c478bd9Sstevel@tonic-gate char *
sigset_string(private_t * pri,sigset_t * sp)25757c478bd9Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp)
25767c478bd9Sstevel@tonic-gate {
25777c478bd9Sstevel@tonic-gate 	char *s = pri->code_buf;
25787c478bd9Sstevel@tonic-gate 	int n = sizeof (*sp) / sizeof (int32_t);
25797c478bd9Sstevel@tonic-gate 	int32_t *lp = (int32_t *)sp;
25807c478bd9Sstevel@tonic-gate 
25817c478bd9Sstevel@tonic-gate 	while (--n >= 0) {
25827c478bd9Sstevel@tonic-gate 		int32_t val = *lp++;
25837c478bd9Sstevel@tonic-gate 
25847c478bd9Sstevel@tonic-gate 		if (val == 0)
25857c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0");
25867c478bd9Sstevel@tonic-gate 		else
25877c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0x%.8X", val);
25887c478bd9Sstevel@tonic-gate 	}
25897c478bd9Sstevel@tonic-gate 
25907c478bd9Sstevel@tonic-gate 	return (pri->code_buf);
25917c478bd9Sstevel@tonic-gate }
25927c478bd9Sstevel@tonic-gate 
25937c478bd9Sstevel@tonic-gate void
show_sigset(private_t * pri,long offset,const char * name)25947c478bd9Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name)
25957c478bd9Sstevel@tonic-gate {
25967c478bd9Sstevel@tonic-gate 	sigset_t sigset;
25977c478bd9Sstevel@tonic-gate 
259827aa4812SToomas Soome 	if (offset != 0 &&
25997c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) {
26007c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s =%s\n",
26017c478bd9Sstevel@tonic-gate 		    pri->pname, name, sigset_string(pri, &sigset));
26027c478bd9Sstevel@tonic-gate 	}
26037c478bd9Sstevel@tonic-gate }
26047c478bd9Sstevel@tonic-gate 
26057c478bd9Sstevel@tonic-gate void
show_sigaltstack32(private_t * pri,long offset,const char * name)26067c478bd9Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name)
26077c478bd9Sstevel@tonic-gate {
26087c478bd9Sstevel@tonic-gate 	struct sigaltstack32 altstack;
26097c478bd9Sstevel@tonic-gate 
261027aa4812SToomas Soome 	if (offset != 0 &&
26117c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
26127c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
26137c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
26147c478bd9Sstevel@tonic-gate 		    pri->pname,
26157c478bd9Sstevel@tonic-gate 		    name,
26167c478bd9Sstevel@tonic-gate 		    altstack.ss_sp,
26177c478bd9Sstevel@tonic-gate 		    altstack.ss_size,
26187c478bd9Sstevel@tonic-gate 		    altstack.ss_flags);
26197c478bd9Sstevel@tonic-gate 	}
26207c478bd9Sstevel@tonic-gate }
26217c478bd9Sstevel@tonic-gate 
26227c478bd9Sstevel@tonic-gate void
show_sigaltstack(private_t * pri,long offset,const char * name)26237c478bd9Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name)
26247c478bd9Sstevel@tonic-gate {
26257c478bd9Sstevel@tonic-gate 	struct sigaltstack altstack;
26267c478bd9Sstevel@tonic-gate 
26277c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
26287c478bd9Sstevel@tonic-gate 		show_sigaltstack32(pri, offset, name);
26297c478bd9Sstevel@tonic-gate 		return;
26307c478bd9Sstevel@tonic-gate 	}
263127aa4812SToomas Soome 	if (offset != 0 &&
26327c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
26337c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
26347c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
26357c478bd9Sstevel@tonic-gate 		    pri->pname,
26367c478bd9Sstevel@tonic-gate 		    name,
26377c478bd9Sstevel@tonic-gate 		    (ulong_t)altstack.ss_sp,
26387c478bd9Sstevel@tonic-gate 		    (ulong_t)altstack.ss_size,
26397c478bd9Sstevel@tonic-gate 		    altstack.ss_flags);
26407c478bd9Sstevel@tonic-gate 	}
26417c478bd9Sstevel@tonic-gate }
26427c478bd9Sstevel@tonic-gate 
26437c478bd9Sstevel@tonic-gate void
show_sigaction32(private_t * pri,long offset,const char * name,long odisp)26447c478bd9Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp)
26457c478bd9Sstevel@tonic-gate {
26467c478bd9Sstevel@tonic-gate 	struct sigaction32 sigaction;
26477c478bd9Sstevel@tonic-gate 
264827aa4812SToomas Soome 	if (offset != 0 &&
26497c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
26507c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
26517c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
265227aa4812SToomas Soome 		if (odisp != 0)
26537c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (caddr32_t)odisp;
26547c478bd9Sstevel@tonic-gate 		(void) printf(
26557c478bd9Sstevel@tonic-gate 		    "%s    %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
26567c478bd9Sstevel@tonic-gate 		    pri->pname,
26577c478bd9Sstevel@tonic-gate 		    name,
26587c478bd9Sstevel@tonic-gate 		    sigaction.sa_handler,
26597c478bd9Sstevel@tonic-gate 		    sigset_string(pri, (sigset_t *)&sigaction.sa_mask),
26607c478bd9Sstevel@tonic-gate 		    sigaction.sa_flags);
26617c478bd9Sstevel@tonic-gate 	}
26627c478bd9Sstevel@tonic-gate }
26637c478bd9Sstevel@tonic-gate 
26647c478bd9Sstevel@tonic-gate void
show_sigaction(private_t * pri,long offset,const char * name,long odisp)26657c478bd9Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp)
26667c478bd9Sstevel@tonic-gate {
26677c478bd9Sstevel@tonic-gate 	struct sigaction sigaction;
26687c478bd9Sstevel@tonic-gate 
26697c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
26707c478bd9Sstevel@tonic-gate 		show_sigaction32(pri, offset, name, odisp);
26717c478bd9Sstevel@tonic-gate 		return;
26727c478bd9Sstevel@tonic-gate 	}
267327aa4812SToomas Soome 	if (offset != 0 &&
26747c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
26757c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
26767c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
267727aa4812SToomas Soome 		if (odisp != 0)
26787c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (void (*)())odisp;
26797c478bd9Sstevel@tonic-gate 		(void) printf(
26807c478bd9Sstevel@tonic-gate 		    "%s    %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
26817c478bd9Sstevel@tonic-gate 		    pri->pname,
26827c478bd9Sstevel@tonic-gate 		    name,
26837c478bd9Sstevel@tonic-gate 		    (long)sigaction.sa_handler,
26847c478bd9Sstevel@tonic-gate 		    sigset_string(pri, &sigaction.sa_mask),
26857c478bd9Sstevel@tonic-gate 		    sigaction.sa_flags);
26867c478bd9Sstevel@tonic-gate 	}
26877c478bd9Sstevel@tonic-gate }
26887c478bd9Sstevel@tonic-gate 
26897c478bd9Sstevel@tonic-gate void
print_siginfo32(private_t * pri,const siginfo32_t * sip)26907c478bd9Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip)
26917c478bd9Sstevel@tonic-gate {
26927c478bd9Sstevel@tonic-gate 	const char *code = NULL;
26937c478bd9Sstevel@tonic-gate 
26947c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
26957c478bd9Sstevel@tonic-gate 	    signame(pri, sip->si_signo));
26967c478bd9Sstevel@tonic-gate 
26977c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
26987c478bd9Sstevel@tonic-gate 		(void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid);
26997c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
27007c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
27017c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
27027c478bd9Sstevel@tonic-gate 		return;
27037c478bd9Sstevel@tonic-gate 	}
27047c478bd9Sstevel@tonic-gate 
27057c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
27067c478bd9Sstevel@tonic-gate 	default:
27077c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
27087c478bd9Sstevel@tonic-gate 		return;
27097c478bd9Sstevel@tonic-gate 	case SIGILL:
27107c478bd9Sstevel@tonic-gate 	case SIGTRAP:
27117c478bd9Sstevel@tonic-gate 	case SIGFPE:
27127c478bd9Sstevel@tonic-gate 	case SIGSEGV:
27137c478bd9Sstevel@tonic-gate 	case SIGBUS:
27147c478bd9Sstevel@tonic-gate 	case SIGEMT:
27157c478bd9Sstevel@tonic-gate 	case SIGCLD:
27167c478bd9Sstevel@tonic-gate 	case SIGPOLL:
27177c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
27187c478bd9Sstevel@tonic-gate 		break;
27197c478bd9Sstevel@tonic-gate 	}
27207c478bd9Sstevel@tonic-gate 
27217c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
27227c478bd9Sstevel@tonic-gate 	case SIGILL:
27237c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27247c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
27257c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
27267c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
27277c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
27287c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
27297c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
27307c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
27317c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
27327c478bd9Sstevel@tonic-gate 		}
27337c478bd9Sstevel@tonic-gate 		break;
27347c478bd9Sstevel@tonic-gate 	case SIGTRAP:
27357c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27367c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
27377c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
27387c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
27397c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
27407c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
27417c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
27427c478bd9Sstevel@tonic-gate 		}
27437c478bd9Sstevel@tonic-gate 		break;
27447c478bd9Sstevel@tonic-gate 	case SIGFPE:
27457c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27467c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
27477c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
27487c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
27497c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
27507c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
27517c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
27527c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
27537c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
27547c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
27557c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
27567c478bd9Sstevel@tonic-gate #endif
27577c478bd9Sstevel@tonic-gate 		}
27587c478bd9Sstevel@tonic-gate 		break;
27597c478bd9Sstevel@tonic-gate 	case SIGSEGV:
27607c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27617c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
27627c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
27637c478bd9Sstevel@tonic-gate 		}
27647c478bd9Sstevel@tonic-gate 		break;
27657c478bd9Sstevel@tonic-gate 	case SIGEMT:
27667c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27677c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
27687c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
27697c478bd9Sstevel@tonic-gate #endif
27707c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
27717c478bd9Sstevel@tonic-gate 		}
27727c478bd9Sstevel@tonic-gate 		break;
27737c478bd9Sstevel@tonic-gate 	case SIGBUS:
27747c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27757c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
27767c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
27777c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
27787c478bd9Sstevel@tonic-gate 		}
27797c478bd9Sstevel@tonic-gate 		break;
27807c478bd9Sstevel@tonic-gate 	case SIGCLD:
27817c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27827c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
27837c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
27847c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
27857c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
27867c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
27877c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
27887c478bd9Sstevel@tonic-gate 		}
27897c478bd9Sstevel@tonic-gate 		break;
27907c478bd9Sstevel@tonic-gate 	case SIGPOLL:
27917c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
27927c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
27937c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
27947c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
27957c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
27967c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
27977c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
27987c478bd9Sstevel@tonic-gate 		}
27997c478bd9Sstevel@tonic-gate 		break;
28007c478bd9Sstevel@tonic-gate 	}
28017c478bd9Sstevel@tonic-gate 
28027c478bd9Sstevel@tonic-gate 	if (code == NULL) {
28037c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
28047c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
28057c478bd9Sstevel@tonic-gate 	}
28067c478bd9Sstevel@tonic-gate 
28077c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
28087c478bd9Sstevel@tonic-gate 	case SIGILL:
28097c478bd9Sstevel@tonic-gate 	case SIGTRAP:
28107c478bd9Sstevel@tonic-gate 	case SIGFPE:
28117c478bd9Sstevel@tonic-gate 	case SIGSEGV:
28127c478bd9Sstevel@tonic-gate 	case SIGBUS:
28137c478bd9Sstevel@tonic-gate 	case SIGEMT:
28147c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8X",
28157c478bd9Sstevel@tonic-gate 		    code,
28167c478bd9Sstevel@tonic-gate 		    sip->si_addr);
28177c478bd9Sstevel@tonic-gate 		break;
28187c478bd9Sstevel@tonic-gate 	case SIGCLD:
28197c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
28207c478bd9Sstevel@tonic-gate 		    code,
28217c478bd9Sstevel@tonic-gate 		    sip->si_pid,
28227c478bd9Sstevel@tonic-gate 		    sip->si_status);
28237c478bd9Sstevel@tonic-gate 		break;
28247c478bd9Sstevel@tonic-gate 	case SIGPOLL:
28257c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
28267c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%d",
28277c478bd9Sstevel@tonic-gate 		    code,
28287c478bd9Sstevel@tonic-gate 		    sip->si_fd,
28297c478bd9Sstevel@tonic-gate 		    sip->si_band);
28307c478bd9Sstevel@tonic-gate 		break;
28317c478bd9Sstevel@tonic-gate 	}
28327c478bd9Sstevel@tonic-gate 
28337c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
28347c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
28357c478bd9Sstevel@tonic-gate 
28367c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
28377c478bd9Sstevel@tonic-gate 		if (ename != NULL)
28387c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
28397c478bd9Sstevel@tonic-gate 	}
28407c478bd9Sstevel@tonic-gate 
28417c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
28427c478bd9Sstevel@tonic-gate }
28437c478bd9Sstevel@tonic-gate 
28447c478bd9Sstevel@tonic-gate void
print_siginfo(private_t * pri,const siginfo_t * sip)28457c478bd9Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip)
28467c478bd9Sstevel@tonic-gate {
28477c478bd9Sstevel@tonic-gate 	const char *code = NULL;
28487c478bd9Sstevel@tonic-gate 
28497c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
28507c478bd9Sstevel@tonic-gate 	    signame(pri, sip->si_signo));
28517c478bd9Sstevel@tonic-gate 
28527c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
2853f48205beScasper 		(void) printf(" pid=%d uid=%u",
28547c478bd9Sstevel@tonic-gate 		    (int)sip->si_pid,
2855f48205beScasper 		    sip->si_uid);
28567c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
28577c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
28587c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
28597c478bd9Sstevel@tonic-gate 		return;
28607c478bd9Sstevel@tonic-gate 	}
28617c478bd9Sstevel@tonic-gate 
28627c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
28637c478bd9Sstevel@tonic-gate 	default:
28647c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
28657c478bd9Sstevel@tonic-gate 		return;
28667c478bd9Sstevel@tonic-gate 	case SIGILL:
28677c478bd9Sstevel@tonic-gate 	case SIGTRAP:
28687c478bd9Sstevel@tonic-gate 	case SIGFPE:
28697c478bd9Sstevel@tonic-gate 	case SIGSEGV:
28707c478bd9Sstevel@tonic-gate 	case SIGBUS:
28717c478bd9Sstevel@tonic-gate 	case SIGEMT:
28727c478bd9Sstevel@tonic-gate 	case SIGCLD:
28737c478bd9Sstevel@tonic-gate 	case SIGPOLL:
28747c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
28757c478bd9Sstevel@tonic-gate 		break;
28767c478bd9Sstevel@tonic-gate 	}
28777c478bd9Sstevel@tonic-gate 
28787c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
28797c478bd9Sstevel@tonic-gate 	case SIGILL:
28807c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28817c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
28827c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
28837c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
28847c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
28857c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
28867c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
28877c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
28887c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
28897c478bd9Sstevel@tonic-gate 		}
28907c478bd9Sstevel@tonic-gate 		break;
28917c478bd9Sstevel@tonic-gate 	case SIGTRAP:
28927c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28937c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
28947c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
28957c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
28967c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
28977c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
28987c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
28997c478bd9Sstevel@tonic-gate 		}
29007c478bd9Sstevel@tonic-gate 		break;
29017c478bd9Sstevel@tonic-gate 	case SIGFPE:
29027c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29037c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
29047c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
29057c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
29067c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
29077c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
29087c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
29097c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
29107c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
29117c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
29127c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
29137c478bd9Sstevel@tonic-gate #endif
29147c478bd9Sstevel@tonic-gate 		}
29157c478bd9Sstevel@tonic-gate 		break;
29167c478bd9Sstevel@tonic-gate 	case SIGSEGV:
29177c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29187c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
29197c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
29207c478bd9Sstevel@tonic-gate 		}
29217c478bd9Sstevel@tonic-gate 		break;
29227c478bd9Sstevel@tonic-gate 	case SIGEMT:
29237c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29247c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
29257c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
29267c478bd9Sstevel@tonic-gate #endif
29277c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
29287c478bd9Sstevel@tonic-gate 		}
29297c478bd9Sstevel@tonic-gate 		break;
29307c478bd9Sstevel@tonic-gate 	case SIGBUS:
29317c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29327c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
29337c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
29347c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
29357c478bd9Sstevel@tonic-gate 		}
29367c478bd9Sstevel@tonic-gate 		break;
29377c478bd9Sstevel@tonic-gate 	case SIGCLD:
29387c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29397c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
29407c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
29417c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
29427c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
29437c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
29447c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
29457c478bd9Sstevel@tonic-gate 		}
29467c478bd9Sstevel@tonic-gate 		break;
29477c478bd9Sstevel@tonic-gate 	case SIGPOLL:
29487c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29497c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
29507c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
29517c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
29527c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
29537c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
29547c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
29557c478bd9Sstevel@tonic-gate 		}
29567c478bd9Sstevel@tonic-gate 		break;
29577c478bd9Sstevel@tonic-gate 	}
29587c478bd9Sstevel@tonic-gate 
29597c478bd9Sstevel@tonic-gate 	if (code == NULL) {
29607c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
29617c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
29627c478bd9Sstevel@tonic-gate 	}
29637c478bd9Sstevel@tonic-gate 
29647c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
29657c478bd9Sstevel@tonic-gate 	case SIGILL:
29667c478bd9Sstevel@tonic-gate 	case SIGTRAP:
29677c478bd9Sstevel@tonic-gate 	case SIGFPE:
29687c478bd9Sstevel@tonic-gate 	case SIGSEGV:
29697c478bd9Sstevel@tonic-gate 	case SIGBUS:
29707c478bd9Sstevel@tonic-gate 	case SIGEMT:
29717c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8lX",
29727c478bd9Sstevel@tonic-gate 		    code,
29737c478bd9Sstevel@tonic-gate 		    (long)sip->si_addr);
29747c478bd9Sstevel@tonic-gate 		break;
29757c478bd9Sstevel@tonic-gate 	case SIGCLD:
29767c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
29777c478bd9Sstevel@tonic-gate 		    code,
29787c478bd9Sstevel@tonic-gate 		    (int)sip->si_pid,
29797c478bd9Sstevel@tonic-gate 		    sip->si_status);
29807c478bd9Sstevel@tonic-gate 		break;
29817c478bd9Sstevel@tonic-gate 	case SIGPOLL:
29827c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
29837c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%ld",
29847c478bd9Sstevel@tonic-gate 		    code,
29857c478bd9Sstevel@tonic-gate 		    sip->si_fd,
29867c478bd9Sstevel@tonic-gate 		    sip->si_band);
29877c478bd9Sstevel@tonic-gate 		break;
29887c478bd9Sstevel@tonic-gate 	}
29897c478bd9Sstevel@tonic-gate 
29907c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
29917c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
29927c478bd9Sstevel@tonic-gate 
29937c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
29947c478bd9Sstevel@tonic-gate 		if (ename != NULL)
29957c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
29967c478bd9Sstevel@tonic-gate 	}
29977c478bd9Sstevel@tonic-gate 
29987c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
29997c478bd9Sstevel@tonic-gate }
30007c478bd9Sstevel@tonic-gate 
30017c478bd9Sstevel@tonic-gate void
show_siginfo32(private_t * pri,long offset)30027c478bd9Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset)
30037c478bd9Sstevel@tonic-gate {
30047c478bd9Sstevel@tonic-gate 	struct siginfo32 siginfo;
30057c478bd9Sstevel@tonic-gate 
300627aa4812SToomas Soome 	if (offset != 0 &&
30077c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
30087c478bd9Sstevel@tonic-gate 		print_siginfo32(pri, &siginfo);
30097c478bd9Sstevel@tonic-gate }
30107c478bd9Sstevel@tonic-gate 
30117c478bd9Sstevel@tonic-gate void
show_siginfo(private_t * pri,long offset)30127c478bd9Sstevel@tonic-gate show_siginfo(private_t *pri, long offset)
30137c478bd9Sstevel@tonic-gate {
30147c478bd9Sstevel@tonic-gate 	struct siginfo siginfo;
30157c478bd9Sstevel@tonic-gate 
30167c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
30177c478bd9Sstevel@tonic-gate 		show_siginfo32(pri, offset);
30187c478bd9Sstevel@tonic-gate 		return;
30197c478bd9Sstevel@tonic-gate 	}
302027aa4812SToomas Soome 	if (offset != 0 &&
30217c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
30227c478bd9Sstevel@tonic-gate 		print_siginfo(pri, &siginfo);
30237c478bd9Sstevel@tonic-gate }
30247c478bd9Sstevel@tonic-gate 
30257c478bd9Sstevel@tonic-gate void
show_bool(private_t * pri,long offset,int count)30267c478bd9Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count)
30277c478bd9Sstevel@tonic-gate {
30287c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4);
30297c478bd9Sstevel@tonic-gate 
30307c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
30317c478bd9Sstevel@tonic-gate 	if (serial)
30327c478bd9Sstevel@tonic-gate 		Eserialize();
30337c478bd9Sstevel@tonic-gate 
30347c478bd9Sstevel@tonic-gate 	while (count > 0) {
30357c478bd9Sstevel@tonic-gate 		char buf[32];
30367c478bd9Sstevel@tonic-gate 		int nb = (count < 32)? count : 32;
30377c478bd9Sstevel@tonic-gate 		int i;
30387c478bd9Sstevel@tonic-gate 
30397c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buf, (size_t)nb, offset) != nb)
30407c478bd9Sstevel@tonic-gate 			break;
30417c478bd9Sstevel@tonic-gate 
30427c478bd9Sstevel@tonic-gate 		(void) printf("%s   ", pri->pname);
30437c478bd9Sstevel@tonic-gate 		for (i = 0; i < nb; i++)
30447c478bd9Sstevel@tonic-gate 			(void) printf(" %d", buf[i]);
30457c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
30467c478bd9Sstevel@tonic-gate 
30477c478bd9Sstevel@tonic-gate 		count -= nb;
30487c478bd9Sstevel@tonic-gate 		offset += nb;
30497c478bd9Sstevel@tonic-gate 	}
30507c478bd9Sstevel@tonic-gate 
30517c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
30527c478bd9Sstevel@tonic-gate 	if (serial)
30537c478bd9Sstevel@tonic-gate 		Xserialize();
30547c478bd9Sstevel@tonic-gate }
30557c478bd9Sstevel@tonic-gate 
30567c478bd9Sstevel@tonic-gate void
show_iovec32(private_t * pri,long offset,int niov,int showbuf,long count)30577c478bd9Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count)
30587c478bd9Sstevel@tonic-gate {
30597c478bd9Sstevel@tonic-gate 	iovec32_t iovec[16];
30607c478bd9Sstevel@tonic-gate 	iovec32_t *ip;
30617c478bd9Sstevel@tonic-gate 	long nb;
30627c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
30637c478bd9Sstevel@tonic-gate 
30647c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
30657c478bd9Sstevel@tonic-gate 		niov = 16;
30667c478bd9Sstevel@tonic-gate 
306727aa4812SToomas Soome 	if (offset != 0 && niov > 0 &&
30687c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset)
30697c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec32_t)) {
30707c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
30717c478bd9Sstevel@tonic-gate 		if (serial)
30727c478bd9Sstevel@tonic-gate 			Eserialize();
30737c478bd9Sstevel@tonic-gate 
30747c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
30757c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8X  iov_len = %d\n",
30767c478bd9Sstevel@tonic-gate 			    pri->pname,
30777c478bd9Sstevel@tonic-gate 			    ip->iov_base,
30787c478bd9Sstevel@tonic-gate 			    ip->iov_len);
30797c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
30807c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
30817c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
30827c478bd9Sstevel@tonic-gate 				if (nb > 0)
30837c478bd9Sstevel@tonic-gate 					count -= nb;
30847c478bd9Sstevel@tonic-gate 			}
30857c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
30867c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
30877c478bd9Sstevel@tonic-gate 		}
30887c478bd9Sstevel@tonic-gate 
30897c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
30907c478bd9Sstevel@tonic-gate 		if (serial)
30917c478bd9Sstevel@tonic-gate 			Xserialize();
30927c478bd9Sstevel@tonic-gate 	}
30937c478bd9Sstevel@tonic-gate }
30947c478bd9Sstevel@tonic-gate 
30957c478bd9Sstevel@tonic-gate void
show_iovec(private_t * pri,long offset,long niov,int showbuf,long count)30967c478bd9Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count)
30977c478bd9Sstevel@tonic-gate {
30987c478bd9Sstevel@tonic-gate 	iovec_t iovec[16];
30997c478bd9Sstevel@tonic-gate 	iovec_t *ip;
31007c478bd9Sstevel@tonic-gate 	long nb;
31017c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
31027c478bd9Sstevel@tonic-gate 
31037c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
31047c478bd9Sstevel@tonic-gate 		show_iovec32(pri, offset, niov, showbuf, count);
31057c478bd9Sstevel@tonic-gate 		return;
31067c478bd9Sstevel@tonic-gate 	}
31077c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
31087c478bd9Sstevel@tonic-gate 		niov = 16;
31097c478bd9Sstevel@tonic-gate 
311027aa4812SToomas Soome 	if (offset != 0 && niov > 0 &&
31117c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset)
31127c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec_t)) {
31137c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
31147c478bd9Sstevel@tonic-gate 		if (serial)
31157c478bd9Sstevel@tonic-gate 			Eserialize();
31167c478bd9Sstevel@tonic-gate 
31177c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
31187c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8lX  iov_len = %lu\n",
31197c478bd9Sstevel@tonic-gate 			    pri->pname,
31207c478bd9Sstevel@tonic-gate 			    (long)ip->iov_base,
31217c478bd9Sstevel@tonic-gate 			    ip->iov_len);
31227c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
31237c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
31247c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
31257c478bd9Sstevel@tonic-gate 				if (nb > 0)
31267c478bd9Sstevel@tonic-gate 					count -= nb;
31277c478bd9Sstevel@tonic-gate 			}
31287c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
31297c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
31307c478bd9Sstevel@tonic-gate 		}
31317c478bd9Sstevel@tonic-gate 
31327c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
31337c478bd9Sstevel@tonic-gate 		if (serial)
31347c478bd9Sstevel@tonic-gate 			Xserialize();
31357c478bd9Sstevel@tonic-gate 	}
31367c478bd9Sstevel@tonic-gate }
31377c478bd9Sstevel@tonic-gate 
31387c478bd9Sstevel@tonic-gate void
show_dents32(private_t * pri,long offset,long count)31397c478bd9Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count)
31407c478bd9Sstevel@tonic-gate {
31417c478bd9Sstevel@tonic-gate 	long buf[MYBUFSIZ / sizeof (long)];
31427c478bd9Sstevel@tonic-gate 	struct dirent32 *dp;
31437c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
31447c478bd9Sstevel@tonic-gate 
31453b862e9aSRoger A. Faulkner 	if (offset == 0)
31467c478bd9Sstevel@tonic-gate 		return;
31477c478bd9Sstevel@tonic-gate 
31487c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
31497c478bd9Sstevel@tonic-gate 	if (serial)
31507c478bd9Sstevel@tonic-gate 		Eserialize();
31517c478bd9Sstevel@tonic-gate 
31527c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
31537c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
31547c478bd9Sstevel@tonic-gate 
31557c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
31567c478bd9Sstevel@tonic-gate 			break;
31577c478bd9Sstevel@tonic-gate 
31587c478bd9Sstevel@tonic-gate 		dp = (struct dirent32 *)&buf[0];
31597c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
31607c478bd9Sstevel@tonic-gate 			break;
31617c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
31627c478bd9Sstevel@tonic-gate 			/* getdents() error? */
31637c478bd9Sstevel@tonic-gate 			(void) printf(
31647c478bd9Sstevel@tonic-gate 			    "%s    ino=%-5u off=%-4d rlen=%-3d\n",
31657c478bd9Sstevel@tonic-gate 			    pri->pname,
31667c478bd9Sstevel@tonic-gate 			    dp->d_ino,
31677c478bd9Sstevel@tonic-gate 			    dp->d_off,
31687c478bd9Sstevel@tonic-gate 			    dp->d_reclen);
31697c478bd9Sstevel@tonic-gate 			break;
31707c478bd9Sstevel@tonic-gate 		}
31717c478bd9Sstevel@tonic-gate 
31727c478bd9Sstevel@tonic-gate 		while (!interrupt &&
31737c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
31747c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
31757c478bd9Sstevel@tonic-gate 			(void) printf(
31767c478bd9Sstevel@tonic-gate 			    "%s    ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
31777c478bd9Sstevel@tonic-gate 			    pri->pname,
31787c478bd9Sstevel@tonic-gate 			    dp->d_ino,
31797c478bd9Sstevel@tonic-gate 			    dp->d_off,
31807c478bd9Sstevel@tonic-gate 			    dp->d_reclen,
31817c478bd9Sstevel@tonic-gate 			    dp->d_reclen - (int)(dp->d_name - (char *)dp),
31827c478bd9Sstevel@tonic-gate 			    dp->d_name);
31837c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
31847c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
31857c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
31867c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
31877c478bd9Sstevel@tonic-gate 			dp = (struct dirent32 *)((char *)dp + dp->d_reclen);
31887c478bd9Sstevel@tonic-gate 		}
31897c478bd9Sstevel@tonic-gate 	}
31907c478bd9Sstevel@tonic-gate 
31917c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
31927c478bd9Sstevel@tonic-gate 	if (serial)
31937c478bd9Sstevel@tonic-gate 		Xserialize();
31947c478bd9Sstevel@tonic-gate }
31957c478bd9Sstevel@tonic-gate 
31967c478bd9Sstevel@tonic-gate void
show_dents64(private_t * pri,long offset,long count)31977c478bd9Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count)
31987c478bd9Sstevel@tonic-gate {
31997c478bd9Sstevel@tonic-gate 	long long buf[MYBUFSIZ / sizeof (long long)];
32007c478bd9Sstevel@tonic-gate 	struct dirent64 *dp;
32017c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
32027c478bd9Sstevel@tonic-gate 
32033b862e9aSRoger A. Faulkner 	if (offset == 0)
32047c478bd9Sstevel@tonic-gate 		return;
32057c478bd9Sstevel@tonic-gate 
32067c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
32077c478bd9Sstevel@tonic-gate 	if (serial)
32087c478bd9Sstevel@tonic-gate 		Eserialize();
32097c478bd9Sstevel@tonic-gate 
32107c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
32117c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
32127c478bd9Sstevel@tonic-gate 
32137c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
32147c478bd9Sstevel@tonic-gate 			break;
32157c478bd9Sstevel@tonic-gate 
32167c478bd9Sstevel@tonic-gate 		dp = (struct dirent64 *)&buf[0];
32177c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
32187c478bd9Sstevel@tonic-gate 			break;
32197c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
32207c478bd9Sstevel@tonic-gate 			/* getdents() error? */
32217c478bd9Sstevel@tonic-gate 			(void) printf(
32227c478bd9Sstevel@tonic-gate 			    "%s    ino=%-5llu off=%-4lld rlen=%-3d\n",
32237c478bd9Sstevel@tonic-gate 			    pri->pname,
32247c478bd9Sstevel@tonic-gate 			    (long long)dp->d_ino,
32257c478bd9Sstevel@tonic-gate 			    (long long)dp->d_off,
32267c478bd9Sstevel@tonic-gate 			    dp->d_reclen);
32277c478bd9Sstevel@tonic-gate 			break;
32287c478bd9Sstevel@tonic-gate 		}
32297c478bd9Sstevel@tonic-gate 
32307c478bd9Sstevel@tonic-gate 		while (!interrupt &&
32317c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
32327c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
32337c478bd9Sstevel@tonic-gate 			(void) printf(
32347c478bd9Sstevel@tonic-gate 			    "%s    ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
32357c478bd9Sstevel@tonic-gate 			    pri->pname,
32367c478bd9Sstevel@tonic-gate 			    (long long)dp->d_ino,
32377c478bd9Sstevel@tonic-gate 			    (long long)dp->d_off,
32387c478bd9Sstevel@tonic-gate 			    dp->d_reclen,
32397c478bd9Sstevel@tonic-gate 			    dp->d_reclen - (int)(dp->d_name - (char *)dp),
32407c478bd9Sstevel@tonic-gate 			    dp->d_name);
32417c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
32427c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
32437c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
32447c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
32457c478bd9Sstevel@tonic-gate 			dp = (struct dirent64 *)((char *)dp + dp->d_reclen);
32467c478bd9Sstevel@tonic-gate 		}
32477c478bd9Sstevel@tonic-gate 	}
32487c478bd9Sstevel@tonic-gate 
32497c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
32507c478bd9Sstevel@tonic-gate 	if (serial)
32517c478bd9Sstevel@tonic-gate 		Xserialize();
32527c478bd9Sstevel@tonic-gate }
32537c478bd9Sstevel@tonic-gate 
32547c478bd9Sstevel@tonic-gate void
show_rlimit32(private_t * pri,long offset)32557c478bd9Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset)
32567c478bd9Sstevel@tonic-gate {
32577c478bd9Sstevel@tonic-gate 	struct rlimit32 rlimit;
32587c478bd9Sstevel@tonic-gate 
325927aa4812SToomas Soome 	if (offset != 0 &&
32607c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
32617c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
32627c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
32637c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
32647c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_INFINITY", stdout);
32657c478bd9Sstevel@tonic-gate 			break;
32667c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
32677c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_MAX", stdout);
32687c478bd9Sstevel@tonic-gate 			break;
32697c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
32707c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_CUR", stdout);
32717c478bd9Sstevel@tonic-gate 			break;
32727c478bd9Sstevel@tonic-gate 		default:
32737c478bd9Sstevel@tonic-gate 			(void) printf("cur = %lu", (long)rlimit.rlim_cur);
32747c478bd9Sstevel@tonic-gate 			break;
32757c478bd9Sstevel@tonic-gate 		}
32767c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
32777c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
32787c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_INFINITY\n", stdout);
32797c478bd9Sstevel@tonic-gate 			break;
32807c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
32817c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_MAX\n", stdout);
32827c478bd9Sstevel@tonic-gate 			break;
32837c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
32847c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_CUR\n", stdout);
32857c478bd9Sstevel@tonic-gate 			break;
32867c478bd9Sstevel@tonic-gate 		default:
32877c478bd9Sstevel@tonic-gate 			(void) printf("  max = %lu\n", (long)rlimit.rlim_max);
32887c478bd9Sstevel@tonic-gate 			break;
32897c478bd9Sstevel@tonic-gate 		}
32907c478bd9Sstevel@tonic-gate 	}
32917c478bd9Sstevel@tonic-gate }
32927c478bd9Sstevel@tonic-gate 
32937c478bd9Sstevel@tonic-gate void
show_rlimit64(private_t * pri,long offset)32947c478bd9Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset)
32957c478bd9Sstevel@tonic-gate {
32967c478bd9Sstevel@tonic-gate 	struct rlimit64 rlimit;
32977c478bd9Sstevel@tonic-gate 
329827aa4812SToomas Soome 	if (offset != 0 &&
32997c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
33007c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
33017c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
33027c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
33037c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_INFINITY", stdout);
33047c478bd9Sstevel@tonic-gate 			break;
33057c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
33067c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_MAX", stdout);
33077c478bd9Sstevel@tonic-gate 			break;
33087c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
33097c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_CUR", stdout);
33107c478bd9Sstevel@tonic-gate 			break;
33117c478bd9Sstevel@tonic-gate 		default:
33127c478bd9Sstevel@tonic-gate 			(void) printf("cur = %llu",
33137c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_cur);
33147c478bd9Sstevel@tonic-gate 			break;
33157c478bd9Sstevel@tonic-gate 		}
33167c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
33177c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
33187c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_INFINITY\n", stdout);
33197c478bd9Sstevel@tonic-gate 			break;
33207c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
33217c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_MAX\n", stdout);
33227c478bd9Sstevel@tonic-gate 			break;
33237c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
33247c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_CUR\n", stdout);
33257c478bd9Sstevel@tonic-gate 			break;
33267c478bd9Sstevel@tonic-gate 		default:
33277c478bd9Sstevel@tonic-gate 			(void) printf("  max = %llu\n",
33287c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_max);
33297c478bd9Sstevel@tonic-gate 			break;
33307c478bd9Sstevel@tonic-gate 		}
33317c478bd9Sstevel@tonic-gate 	}
33327c478bd9Sstevel@tonic-gate }
33337c478bd9Sstevel@tonic-gate 
33347c478bd9Sstevel@tonic-gate void
show_nuname(private_t * pri,long offset)33357c478bd9Sstevel@tonic-gate show_nuname(private_t *pri, long offset)
33367c478bd9Sstevel@tonic-gate {
33377c478bd9Sstevel@tonic-gate 	struct utsname ubuf;
33387c478bd9Sstevel@tonic-gate 
333927aa4812SToomas Soome 	if (offset != 0 &&
33407c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
33417c478bd9Sstevel@tonic-gate 		(void) printf(
33427c478bd9Sstevel@tonic-gate 		    "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
33437c478bd9Sstevel@tonic-gate 		    pri->pname,
33447c478bd9Sstevel@tonic-gate 		    ubuf.sysname,
33457c478bd9Sstevel@tonic-gate 		    ubuf.nodename,
33467c478bd9Sstevel@tonic-gate 		    ubuf.release,
33477c478bd9Sstevel@tonic-gate 		    ubuf.version,
33487c478bd9Sstevel@tonic-gate 		    ubuf.machine);
33497c478bd9Sstevel@tonic-gate 	}
33507c478bd9Sstevel@tonic-gate }
33517c478bd9Sstevel@tonic-gate 
33527c478bd9Sstevel@tonic-gate void
show_adjtime(private_t * pri,long off1,long off2)33537c478bd9Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2)
33547c478bd9Sstevel@tonic-gate {
33557c478bd9Sstevel@tonic-gate 	show_timeval(pri, off1, "   delta");
33567c478bd9Sstevel@tonic-gate 	show_timeval(pri, off2, "olddelta");
33577c478bd9Sstevel@tonic-gate }
33587c478bd9Sstevel@tonic-gate 
33597c478bd9Sstevel@tonic-gate void
show_sockaddr(private_t * pri,const char * str,long addroff,long lenoff,long len)33607c478bd9Sstevel@tonic-gate show_sockaddr(private_t *pri,
33617c478bd9Sstevel@tonic-gate     const char *str, long addroff, long lenoff, long len)
33627c478bd9Sstevel@tonic-gate {
33637c478bd9Sstevel@tonic-gate 	/*
33647c478bd9Sstevel@tonic-gate 	 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
33657c478bd9Sstevel@tonic-gate 	 * also large enough to store a sockaddr_in or a sockaddr_in6.
33667c478bd9Sstevel@tonic-gate 	 */
33677c478bd9Sstevel@tonic-gate 	long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1)
33687c478bd9Sstevel@tonic-gate 	    / sizeof (long)];
33697c478bd9Sstevel@tonic-gate 	struct sockaddr *sa = (struct sockaddr *)buf;
33707c478bd9Sstevel@tonic-gate 	struct sockaddr_in *sin = (struct sockaddr_in *)buf;
33717c478bd9Sstevel@tonic-gate 	struct sockaddr_un *soun = (struct sockaddr_un *)buf;
33727c478bd9Sstevel@tonic-gate 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf;
33737c478bd9Sstevel@tonic-gate 	char addrbuf[INET6_ADDRSTRLEN];
33747c478bd9Sstevel@tonic-gate 
33757c478bd9Sstevel@tonic-gate 	if (lenoff != 0) {
33767c478bd9Sstevel@tonic-gate 		uint_t ilen;
33777c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen))
33787c478bd9Sstevel@tonic-gate 			return;
33797c478bd9Sstevel@tonic-gate 		len = ilen;
33807c478bd9Sstevel@tonic-gate 	}
33817c478bd9Sstevel@tonic-gate 
33827c478bd9Sstevel@tonic-gate 	if (len >= sizeof (buf))	/* protect against ridiculous length */
33837c478bd9Sstevel@tonic-gate 		len = sizeof (buf) - 1;
33847c478bd9Sstevel@tonic-gate 	if (Pread(Proc, buf, len, addroff) != len)
33857c478bd9Sstevel@tonic-gate 		return;
33867c478bd9Sstevel@tonic-gate 
33877c478bd9Sstevel@tonic-gate 	switch (sa->sa_family) {
33887c478bd9Sstevel@tonic-gate 	case AF_INET6:
33897c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_INET6  %s = %s  port = %u\n",
33907c478bd9Sstevel@tonic-gate 		    pri->pname, str,
33917c478bd9Sstevel@tonic-gate 		    inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf,
33927c478bd9Sstevel@tonic-gate 		    sizeof (addrbuf)),
33937c478bd9Sstevel@tonic-gate 		    ntohs(sin6->sin6_port));
33947c478bd9Sstevel@tonic-gate 		(void) printf("%s\tscope id = %u  source id = 0x%x\n"
33957c478bd9Sstevel@tonic-gate 		    "%s\tflow class = 0x%02x  flow label = 0x%05x\n",
33967c478bd9Sstevel@tonic-gate 		    pri->pname, ntohl(sin6->sin6_scope_id),
33977c478bd9Sstevel@tonic-gate 		    ntohl(sin6->__sin6_src_id),
33987c478bd9Sstevel@tonic-gate 		    pri->pname,
33997c478bd9Sstevel@tonic-gate 		    ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20),
34007c478bd9Sstevel@tonic-gate 		    ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL));
34017c478bd9Sstevel@tonic-gate 		break;
34027c478bd9Sstevel@tonic-gate 	case AF_INET:
34037c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_%s  %s = %s  port = %u\n",
34042caf0dcdSrshoaib 		    pri->pname, "INET",
34057c478bd9Sstevel@tonic-gate 		    str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf,
34067c478bd9Sstevel@tonic-gate 		    sizeof (addrbuf)), ntohs(sin->sin_port));
34077c478bd9Sstevel@tonic-gate 		break;
34087c478bd9Sstevel@tonic-gate 	case AF_UNIX:
34097c478bd9Sstevel@tonic-gate 		len -= sizeof (soun->sun_family);
34107c478bd9Sstevel@tonic-gate 		if (len >= 0) {
34117c478bd9Sstevel@tonic-gate 			/* Null terminate */
341227aa4812SToomas Soome 			soun->sun_path[len] = 0;
34137c478bd9Sstevel@tonic-gate 			(void) printf("%s\tAF_UNIX  %s = %s\n", pri->pname,
34147c478bd9Sstevel@tonic-gate 			    str, soun->sun_path);
34157c478bd9Sstevel@tonic-gate 		}
34167c478bd9Sstevel@tonic-gate 		break;
34177c478bd9Sstevel@tonic-gate 	}
34187c478bd9Sstevel@tonic-gate }
34197c478bd9Sstevel@tonic-gate 
34207c478bd9Sstevel@tonic-gate void
show_msghdr(private_t * pri,long offset)34217c478bd9Sstevel@tonic-gate show_msghdr(private_t *pri, long offset)
34227c478bd9Sstevel@tonic-gate {
342381006e0fSja97890 	const lwpstatus_t *Lsp = pri->lwpstat;
342481006e0fSja97890 	int what = Lsp->pr_what;
342581006e0fSja97890 	int err = pri->Errno;
34267c478bd9Sstevel@tonic-gate 	struct msghdr msg;
342781006e0fSja97890 	int showbuf = FALSE;
342881006e0fSja97890 	int i = pri->sys_args[0]+1;
342981006e0fSja97890 	long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
34307c478bd9Sstevel@tonic-gate 
34317c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
34327c478bd9Sstevel@tonic-gate 		return;
343381006e0fSja97890 
34347c478bd9Sstevel@tonic-gate 	if (msg.msg_name != NULL && msg.msg_namelen != 0)
34357c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
34367c478bd9Sstevel@tonic-gate 		    (long)msg.msg_name, 0, (long)msg.msg_namelen);
343781006e0fSja97890 
343881006e0fSja97890 	/*
343981006e0fSja97890 	 * Print the iovec if the syscall was successful and the fd is
344081006e0fSja97890 	 * part of the set being traced.
344181006e0fSja97890 	 */
344281006e0fSja97890 	if ((what == SYS_recvmsg && !err &&
344381006e0fSja97890 	    prismember(&readfd, i)) ||
344481006e0fSja97890 	    (what == SYS_sendmsg &&
344581006e0fSja97890 	    prismember(&writefd, i)))
344681006e0fSja97890 		showbuf = TRUE;
344781006e0fSja97890 
344881006e0fSja97890 	show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
344981006e0fSja97890 
34507c478bd9Sstevel@tonic-gate }
34517c478bd9Sstevel@tonic-gate 
34527c478bd9Sstevel@tonic-gate void
show_msghdr32(private_t * pri,long offset)34537c478bd9Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset)
34547c478bd9Sstevel@tonic-gate {
34557c478bd9Sstevel@tonic-gate 	struct msghdr32 {
34567c478bd9Sstevel@tonic-gate 		caddr32_t	msg_name;
345781006e0fSja97890 		uint32_t	msg_namelen;
345881006e0fSja97890 		caddr32_t	msg_iov;
345981006e0fSja97890 		int32_t		msg_iovlen;
34607c478bd9Sstevel@tonic-gate 	} msg;
346181006e0fSja97890 	const lwpstatus_t *Lsp = pri->lwpstat;
346281006e0fSja97890 	int what = Lsp->pr_what;
346381006e0fSja97890 	int err = pri->Errno;
346481006e0fSja97890 	int showbuf = FALSE;
346581006e0fSja97890 	int i = pri->sys_args[0]+1;
346681006e0fSja97890 	long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
34677c478bd9Sstevel@tonic-gate 
34687c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
34697c478bd9Sstevel@tonic-gate 		return;
347081006e0fSja97890 
347127aa4812SToomas Soome 	if (msg.msg_name != 0 && msg.msg_namelen != 0)
34727c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
34737c478bd9Sstevel@tonic-gate 		    (long)msg.msg_name, 0, (long)msg.msg_namelen);
347481006e0fSja97890 	/*
347581006e0fSja97890 	 * Print the iovec if the syscall was successful and the fd is
347681006e0fSja97890 	 * part of the set being traced.
347781006e0fSja97890 	 */
347881006e0fSja97890 	if ((what == SYS_recvmsg && !err &&
347981006e0fSja97890 	    prismember(&readfd, i)) ||
348081006e0fSja97890 	    (what == SYS_sendmsg &&
348181006e0fSja97890 	    prismember(&writefd, i)))
348281006e0fSja97890 		showbuf = TRUE;
348381006e0fSja97890 
348481006e0fSja97890 	show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
348581006e0fSja97890 
34867c478bd9Sstevel@tonic-gate }
34877c478bd9Sstevel@tonic-gate 
34887c478bd9Sstevel@tonic-gate static void
show_doorargs(private_t * pri,long offset)34897c478bd9Sstevel@tonic-gate show_doorargs(private_t *pri, long offset)
34907c478bd9Sstevel@tonic-gate {
34917c478bd9Sstevel@tonic-gate 	door_arg_t args;
34927c478bd9Sstevel@tonic-gate 
34937c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
34947c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
34957c478bd9Sstevel@tonic-gate 		    pri->pname,
34967c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_ptr,
34977c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_size);
34987c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
34997c478bd9Sstevel@tonic-gate 		    pri->pname,
35007c478bd9Sstevel@tonic-gate 		    (ulong_t)args.desc_ptr,
35017c478bd9Sstevel@tonic-gate 		    args.desc_num);
35027c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%lX rsize=%lu\n",
35037c478bd9Sstevel@tonic-gate 		    pri->pname,
35047c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rbuf,
35057c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rsize);
35067c478bd9Sstevel@tonic-gate 	}
35077c478bd9Sstevel@tonic-gate }
35087c478bd9Sstevel@tonic-gate 
35097c478bd9Sstevel@tonic-gate static void
show_ucred_privsets(private_t * pri,ucred_t * uc)35107c478bd9Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc)
35117c478bd9Sstevel@tonic-gate {
35127c478bd9Sstevel@tonic-gate 	int i = 0;
35137c478bd9Sstevel@tonic-gate 	const priv_set_t *s;
35147c478bd9Sstevel@tonic-gate 	priv_ptype_t sn;
35157c478bd9Sstevel@tonic-gate 	char *str;
35167c478bd9Sstevel@tonic-gate 
35177c478bd9Sstevel@tonic-gate 	while ((sn = priv_getsetbynum(i++)) != NULL) {
35187c478bd9Sstevel@tonic-gate 		s = ucred_getprivset(uc, sn);
35197c478bd9Sstevel@tonic-gate 
35207c478bd9Sstevel@tonic-gate 		if (s == NULL)
35217c478bd9Sstevel@tonic-gate 			continue;
35227c478bd9Sstevel@tonic-gate 
35237c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%c: %s\n",
35247c478bd9Sstevel@tonic-gate 		    pri->pname,
35257c478bd9Sstevel@tonic-gate 		    *sn,
35267c478bd9Sstevel@tonic-gate 		    str = priv_set_to_str(s, ',', PRIV_STR_SHORT));
35277c478bd9Sstevel@tonic-gate 
35287c478bd9Sstevel@tonic-gate 		free(str);
35297c478bd9Sstevel@tonic-gate 	}
35307c478bd9Sstevel@tonic-gate }
35317c478bd9Sstevel@tonic-gate 
35327c478bd9Sstevel@tonic-gate static void
show_ucred(private_t * pri,long offset)35337c478bd9Sstevel@tonic-gate show_ucred(private_t *pri, long offset)
35347c478bd9Sstevel@tonic-gate {
35357c478bd9Sstevel@tonic-gate 	ucred_t *uc = _ucred_alloc();
35367c478bd9Sstevel@tonic-gate 	size_t sz;
35377c478bd9Sstevel@tonic-gate 
35387c478bd9Sstevel@tonic-gate 	if (uc == NULL)
35397c478bd9Sstevel@tonic-gate 		return;
35407c478bd9Sstevel@tonic-gate 
35417c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, uc, uc->uc_size, offset);
35427c478bd9Sstevel@tonic-gate 
35437c478bd9Sstevel@tonic-gate 	/*
35447c478bd9Sstevel@tonic-gate 	 * A new uc_size is read, it could be smaller than the previously
35457c478bd9Sstevel@tonic-gate 	 * value.  We accept short reads that fill the whole header.
35467c478bd9Sstevel@tonic-gate 	 */
35477c478bd9Sstevel@tonic-gate 	if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) {
3548f48205beScasper 		(void) printf("%s\teuid=%u egid=%u\n",
35497c478bd9Sstevel@tonic-gate 		    pri->pname,
3550f48205beScasper 		    ucred_geteuid(uc),
3551f48205beScasper 		    ucred_getegid(uc));
3552f48205beScasper 		(void) printf("%s\truid=%u rgid=%u\n",
35537c478bd9Sstevel@tonic-gate 		    pri->pname,
3554f48205beScasper 		    ucred_getruid(uc),
3555f48205beScasper 		    ucred_getrgid(uc));
35567c478bd9Sstevel@tonic-gate 		(void) printf("%s\tpid=%d zoneid=%d\n",
35577c478bd9Sstevel@tonic-gate 		    pri->pname,
35587c478bd9Sstevel@tonic-gate 		    (int)ucred_getpid(uc),
35597c478bd9Sstevel@tonic-gate 		    (int)ucred_getzoneid(uc));
35607c478bd9Sstevel@tonic-gate 		show_ucred_privsets(pri, uc);
35617c478bd9Sstevel@tonic-gate 	}
35627c478bd9Sstevel@tonic-gate 	ucred_free(uc);
35637c478bd9Sstevel@tonic-gate }
35647c478bd9Sstevel@tonic-gate 
35657c478bd9Sstevel@tonic-gate static void
show_privset(private_t * pri,long offset,size_t size,char * label)3566821c4a97Sdp show_privset(private_t *pri, long offset, size_t size, char *label)
35677c478bd9Sstevel@tonic-gate {
35687c478bd9Sstevel@tonic-gate 	priv_set_t *tmp = priv_allocset();
35697c478bd9Sstevel@tonic-gate 	size_t sz;
35707c478bd9Sstevel@tonic-gate 
35717c478bd9Sstevel@tonic-gate 	if (tmp == NULL)
35727c478bd9Sstevel@tonic-gate 		return;
35737c478bd9Sstevel@tonic-gate 
35747c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, tmp, size, offset);
35757c478bd9Sstevel@tonic-gate 
35767c478bd9Sstevel@tonic-gate 	if (sz == size) {
35777c478bd9Sstevel@tonic-gate 		char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT);
35787c478bd9Sstevel@tonic-gate 		if (str != NULL) {
3579821c4a97Sdp 			(void) printf("%s\t%s%s\n", pri->pname, label, str);
35807c478bd9Sstevel@tonic-gate 			free(str);
35817c478bd9Sstevel@tonic-gate 		}
35827c478bd9Sstevel@tonic-gate 	}
35837c478bd9Sstevel@tonic-gate 	priv_freeset(tmp);
35847c478bd9Sstevel@tonic-gate }
35857c478bd9Sstevel@tonic-gate 
35867c478bd9Sstevel@tonic-gate static void
show_doorinfo(private_t * pri,long offset)35877c478bd9Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset)
35887c478bd9Sstevel@tonic-gate {
35897c478bd9Sstevel@tonic-gate 	door_info_t info;
35907c478bd9Sstevel@tonic-gate 	door_attr_t attr;
35917c478bd9Sstevel@tonic-gate 
35927c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info))
35937c478bd9Sstevel@tonic-gate 		return;
35947c478bd9Sstevel@tonic-gate 	(void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
35957c478bd9Sstevel@tonic-gate 	    pri->pname,
35967c478bd9Sstevel@tonic-gate 	    (int)info.di_target,
35977c478bd9Sstevel@tonic-gate 	    info.di_proc,
35987c478bd9Sstevel@tonic-gate 	    info.di_data);
35997c478bd9Sstevel@tonic-gate 	attr = info.di_attributes;
36007c478bd9Sstevel@tonic-gate 	(void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr));
36017c478bd9Sstevel@tonic-gate 	(void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier);
36027c478bd9Sstevel@tonic-gate }
36037c478bd9Sstevel@tonic-gate 
36047c478bd9Sstevel@tonic-gate static void
show_doorparam(private_t * pri,long offset)36057c478bd9Sstevel@tonic-gate show_doorparam(private_t *pri, long offset)
36067c478bd9Sstevel@tonic-gate {
36077c478bd9Sstevel@tonic-gate 	ulong_t val;
36087c478bd9Sstevel@tonic-gate 
36097c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
36107c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%lu\n",
36117c478bd9Sstevel@tonic-gate 		    pri->pname,
36127c478bd9Sstevel@tonic-gate 		    val);
36137c478bd9Sstevel@tonic-gate 	}
36147c478bd9Sstevel@tonic-gate }
36157c478bd9Sstevel@tonic-gate 
36167c478bd9Sstevel@tonic-gate 
36177c478bd9Sstevel@tonic-gate static void
show_doorargs32(private_t * pri,long offset)36187c478bd9Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset)
36197c478bd9Sstevel@tonic-gate {
36207c478bd9Sstevel@tonic-gate 	struct door_arg32 args;
36217c478bd9Sstevel@tonic-gate 
36227c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36237c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=%X data_size=%u\n",
36247c478bd9Sstevel@tonic-gate 		    pri->pname,
36257c478bd9Sstevel@tonic-gate 		    args.data_ptr,
36267c478bd9Sstevel@tonic-gate 		    args.data_size);
36277c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
36287c478bd9Sstevel@tonic-gate 		    pri->pname,
36297c478bd9Sstevel@tonic-gate 		    args.desc_ptr,
36307c478bd9Sstevel@tonic-gate 		    args.desc_num);
36317c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%X rsize=%u\n",
36327c478bd9Sstevel@tonic-gate 		    pri->pname,
36337c478bd9Sstevel@tonic-gate 		    args.rbuf,
36347c478bd9Sstevel@tonic-gate 		    args.rsize);
36357c478bd9Sstevel@tonic-gate 	}
36367c478bd9Sstevel@tonic-gate }
36377c478bd9Sstevel@tonic-gate 
36387c478bd9Sstevel@tonic-gate static void
show_doorparam32(private_t * pri,long offset)36397c478bd9Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset)
36407c478bd9Sstevel@tonic-gate {
36417c478bd9Sstevel@tonic-gate 	uint_t val;
36427c478bd9Sstevel@tonic-gate 
36437c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
36447c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%u\n",
36457c478bd9Sstevel@tonic-gate 		    pri->pname,
36467c478bd9Sstevel@tonic-gate 		    val);
36477c478bd9Sstevel@tonic-gate 	}
36487c478bd9Sstevel@tonic-gate }
36497c478bd9Sstevel@tonic-gate 
36507c478bd9Sstevel@tonic-gate 
36517c478bd9Sstevel@tonic-gate static void
show_doors(private_t * pri)36527c478bd9Sstevel@tonic-gate show_doors(private_t *pri)
36537c478bd9Sstevel@tonic-gate {
36547c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[5]) {
36557c478bd9Sstevel@tonic-gate 	case DOOR_CALL:
36567c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
36577c478bd9Sstevel@tonic-gate 			show_doorargs(pri, (long)pri->sys_args[1]);
36587c478bd9Sstevel@tonic-gate 		else
36597c478bd9Sstevel@tonic-gate 			show_doorargs32(pri, (long)pri->sys_args[1]);
36607c478bd9Sstevel@tonic-gate 		break;
36617c478bd9Sstevel@tonic-gate 	case DOOR_UCRED:
36627c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
36637c478bd9Sstevel@tonic-gate 			show_ucred(pri, (long)pri->sys_args[0]);
36647c478bd9Sstevel@tonic-gate 		break;
36657c478bd9Sstevel@tonic-gate 	case DOOR_INFO:
36667c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
36677c478bd9Sstevel@tonic-gate 			show_doorinfo(pri, (long)pri->sys_args[1]);
36687c478bd9Sstevel@tonic-gate 		break;
36697c478bd9Sstevel@tonic-gate 	case DOOR_GETPARAM:
36707c478bd9Sstevel@tonic-gate 		if (!pri->Errno) {
36717c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
36727c478bd9Sstevel@tonic-gate 				show_doorparam(pri, (long)pri->sys_args[2]);
36737c478bd9Sstevel@tonic-gate 			else
36747c478bd9Sstevel@tonic-gate 				show_doorparam32(pri, (long)pri->sys_args[2]);
36757c478bd9Sstevel@tonic-gate 		}
36767c478bd9Sstevel@tonic-gate 		break;
36777c478bd9Sstevel@tonic-gate 	}
36787c478bd9Sstevel@tonic-gate }
36797c478bd9Sstevel@tonic-gate 
36807c478bd9Sstevel@tonic-gate static void
show_portargs(private_t * pri,long offset)36817c478bd9Sstevel@tonic-gate show_portargs(private_t *pri, long offset)
36827c478bd9Sstevel@tonic-gate {
36837c478bd9Sstevel@tonic-gate 	port_event_t args;
36847c478bd9Sstevel@tonic-gate 
36857c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36867c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
36877c478bd9Sstevel@tonic-gate 		    pri->pname,
36887c478bd9Sstevel@tonic-gate 		    args.portev_events,
36897c478bd9Sstevel@tonic-gate 		    args.portev_source);
36907c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%p user=0x%p\n",
36917c478bd9Sstevel@tonic-gate 		    pri->pname,
36927c478bd9Sstevel@tonic-gate 		    (void *)args.portev_object,
36937c478bd9Sstevel@tonic-gate 		    (void *)args.portev_user);
36947c478bd9Sstevel@tonic-gate 	}
36957c478bd9Sstevel@tonic-gate }
36967c478bd9Sstevel@tonic-gate 
36977c478bd9Sstevel@tonic-gate 
36987c478bd9Sstevel@tonic-gate 
36997c478bd9Sstevel@tonic-gate static void
show_portargs32(private_t * pri,long offset)37007c478bd9Sstevel@tonic-gate show_portargs32(private_t *pri, long offset)
37017c478bd9Sstevel@tonic-gate {
37027c478bd9Sstevel@tonic-gate 	port_event32_t args;
37037c478bd9Sstevel@tonic-gate 
37047c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
37057c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
37067c478bd9Sstevel@tonic-gate 		    pri->pname,
37077c478bd9Sstevel@tonic-gate 		    args.portev_events,
37087c478bd9Sstevel@tonic-gate 		    args.portev_source);
37097c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%x user=0x%x\n",
37107c478bd9Sstevel@tonic-gate 		    pri->pname,
37117c478bd9Sstevel@tonic-gate 		    args.portev_object,
37127c478bd9Sstevel@tonic-gate 		    args.portev_user);
37137c478bd9Sstevel@tonic-gate 	}
37147c478bd9Sstevel@tonic-gate }
37157c478bd9Sstevel@tonic-gate 
37167c478bd9Sstevel@tonic-gate 
37177c478bd9Sstevel@tonic-gate static void
show_ports(private_t * pri)37187c478bd9Sstevel@tonic-gate show_ports(private_t *pri)
37197c478bd9Sstevel@tonic-gate {
37207c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
37217c478bd9Sstevel@tonic-gate 	case PORT_GET:
37227c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
37237c478bd9Sstevel@tonic-gate 			show_portargs(pri, (long)pri->sys_args[2]);
37247c478bd9Sstevel@tonic-gate 		else
37257c478bd9Sstevel@tonic-gate 			show_portargs32(pri, (long)pri->sys_args[2]);
37267c478bd9Sstevel@tonic-gate 		break;
37277c478bd9Sstevel@tonic-gate 	}
37287c478bd9Sstevel@tonic-gate }
37297c478bd9Sstevel@tonic-gate 
37307c478bd9Sstevel@tonic-gate #define	MAX_SNDFL_PRD 16
37317c478bd9Sstevel@tonic-gate 
37327c478bd9Sstevel@tonic-gate 
37337c478bd9Sstevel@tonic-gate static void
show_ksendfilevec32(private_t * pri,int fd,ksendfilevec32_t * sndvec,int sfvcnt)37347c478bd9Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd,
37357c478bd9Sstevel@tonic-gate     ksendfilevec32_t *sndvec, int sfvcnt)
37367c478bd9Sstevel@tonic-gate {
37377c478bd9Sstevel@tonic-gate 	ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD];
37387c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
37397c478bd9Sstevel@tonic-gate 
37407c478bd9Sstevel@tonic-gate 	Eserialize();
37417c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
37427c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
37437c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
37447c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
37457c478bd9Sstevel@tonic-gate 
37467c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
37477c478bd9Sstevel@tonic-gate 			break;
37487c478bd9Sstevel@tonic-gate 
37497c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
37507c478bd9Sstevel@tonic-gate 
37517c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
37527c478bd9Sstevel@tonic-gate 			(void) printf(
37537c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
37547c478bd9Sstevel@tonic-gate 			    "sfv_off=%d\tsfv_len=%u\n",
37557c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
37567c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
37577c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
37587c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
37597c478bd9Sstevel@tonic-gate 
37607c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
37617c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
37627c478bd9Sstevel@tonic-gate 				showbuffer(pri,
37637c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
37647c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
37657c478bd9Sstevel@tonic-gate 			}
37667c478bd9Sstevel@tonic-gate 
37677c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
37687c478bd9Sstevel@tonic-gate 			snd_ptr++;
37697c478bd9Sstevel@tonic-gate 		}
37707c478bd9Sstevel@tonic-gate 
37717c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
37727c478bd9Sstevel@tonic-gate 	}
37737c478bd9Sstevel@tonic-gate 	Xserialize();
37747c478bd9Sstevel@tonic-gate }
37757c478bd9Sstevel@tonic-gate 
37767c478bd9Sstevel@tonic-gate static void
show_ksendfilevec64(private_t * pri,int fd,ksendfilevec64_t * sndvec,int sfvcnt)37777c478bd9Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd,
37787c478bd9Sstevel@tonic-gate     ksendfilevec64_t *sndvec, int sfvcnt)
37797c478bd9Sstevel@tonic-gate {
37807c478bd9Sstevel@tonic-gate 	ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
37817c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
37827c478bd9Sstevel@tonic-gate 
37837c478bd9Sstevel@tonic-gate 	Eserialize();
37847c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
37857c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
37867c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
37877c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
37887c478bd9Sstevel@tonic-gate 
37897c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
37907c478bd9Sstevel@tonic-gate 			break;
37917c478bd9Sstevel@tonic-gate 
37927c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
37937c478bd9Sstevel@tonic-gate 
37947c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
37957c478bd9Sstevel@tonic-gate 			(void) printf(
37967c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
37977c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%u\n",
37987c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
37997c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
38007c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
38017c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
38027c478bd9Sstevel@tonic-gate 
38037c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
38047c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
38057c478bd9Sstevel@tonic-gate 				showbuffer(pri,
38067c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
38077c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
38087c478bd9Sstevel@tonic-gate 			}
38097c478bd9Sstevel@tonic-gate 
38107c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
38117c478bd9Sstevel@tonic-gate 			snd_ptr++;
38127c478bd9Sstevel@tonic-gate 		}
38137c478bd9Sstevel@tonic-gate 
38147c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
38157c478bd9Sstevel@tonic-gate 	}
38167c478bd9Sstevel@tonic-gate 	Xserialize();
38177c478bd9Sstevel@tonic-gate }
38187c478bd9Sstevel@tonic-gate 
38197c478bd9Sstevel@tonic-gate 
38207c478bd9Sstevel@tonic-gate /*ARGSUSED*/
38217c478bd9Sstevel@tonic-gate static void
show_sendfilevec(private_t * pri,int fd,sendfilevec_t * sndvec,int sfvcnt)38227c478bd9Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt)
38237c478bd9Sstevel@tonic-gate {
38247c478bd9Sstevel@tonic-gate 	sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD];
38257c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
38267c478bd9Sstevel@tonic-gate 
38277c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
38287c478bd9Sstevel@tonic-gate 		show_ksendfilevec32(pri, fd,
38297c478bd9Sstevel@tonic-gate 		    (ksendfilevec32_t *)sndvec, sfvcnt);
38307c478bd9Sstevel@tonic-gate 		return;
38317c478bd9Sstevel@tonic-gate 	}
38327c478bd9Sstevel@tonic-gate 	Eserialize();
38337c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
38347c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
38357c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
38367c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
38377c478bd9Sstevel@tonic-gate 
38387c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
38397c478bd9Sstevel@tonic-gate 			break;
38407c478bd9Sstevel@tonic-gate 
38417c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
38427c478bd9Sstevel@tonic-gate 
38437c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
38447c478bd9Sstevel@tonic-gate 			(void) printf(
38457c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
38467c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
38477c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
38487c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
38497c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
38507c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
38517c478bd9Sstevel@tonic-gate 
38527c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
38537c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
38547c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
38557c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
38567c478bd9Sstevel@tonic-gate 			}
38577c478bd9Sstevel@tonic-gate 
38587c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
38597c478bd9Sstevel@tonic-gate 			snd_ptr++;
38607c478bd9Sstevel@tonic-gate 		}
38617c478bd9Sstevel@tonic-gate 
38627c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
38637c478bd9Sstevel@tonic-gate 	}
38647c478bd9Sstevel@tonic-gate 	Xserialize();
38657c478bd9Sstevel@tonic-gate }
38667c478bd9Sstevel@tonic-gate 
38677c478bd9Sstevel@tonic-gate /*ARGSUSED*/
38687c478bd9Sstevel@tonic-gate static void
show_sendfilevec64(private_t * pri,int fd,sendfilevec64_t * sndvec,int sfvcnt)38697c478bd9Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt)
38707c478bd9Sstevel@tonic-gate {
38717c478bd9Sstevel@tonic-gate 	sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
38727c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
38737c478bd9Sstevel@tonic-gate 
38747c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
38757c478bd9Sstevel@tonic-gate 		show_ksendfilevec64(pri, fd,
38767c478bd9Sstevel@tonic-gate 		    (ksendfilevec64_t *)sndvec, sfvcnt);
38777c478bd9Sstevel@tonic-gate 		return;
38787c478bd9Sstevel@tonic-gate 	}
38797c478bd9Sstevel@tonic-gate 
38807c478bd9Sstevel@tonic-gate 	Eserialize();
38817c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
38827c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
38837c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
38847c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
38857c478bd9Sstevel@tonic-gate 
38867c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
38877c478bd9Sstevel@tonic-gate 			break;
38887c478bd9Sstevel@tonic-gate 
38897c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
38907c478bd9Sstevel@tonic-gate 
38917c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
38927c478bd9Sstevel@tonic-gate 			(void) printf(
38937c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
38947c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
38957c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
38967c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
38977c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
38987c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
38997c478bd9Sstevel@tonic-gate 
39007c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
39017c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
39027c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
39037c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
39047c478bd9Sstevel@tonic-gate 			}
39057c478bd9Sstevel@tonic-gate 
39067c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
39077c478bd9Sstevel@tonic-gate 			snd_ptr++;
39087c478bd9Sstevel@tonic-gate 		}
39097c478bd9Sstevel@tonic-gate 
39107c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
39117c478bd9Sstevel@tonic-gate 	}
39127c478bd9Sstevel@tonic-gate 	Xserialize();
39137c478bd9Sstevel@tonic-gate }
39147c478bd9Sstevel@tonic-gate 
39157c478bd9Sstevel@tonic-gate static void
show_memcntl_mha(private_t * pri,long offset)39167c478bd9Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset)
39177c478bd9Sstevel@tonic-gate {
39187c478bd9Sstevel@tonic-gate 	struct memcntl_mha mha;
39197c478bd9Sstevel@tonic-gate 	const char *s = NULL;
39207c478bd9Sstevel@tonic-gate 
39217c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) {
39227c478bd9Sstevel@tonic-gate 		switch (mha.mha_cmd) {
39237c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
39247c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
39257c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
39267c478bd9Sstevel@tonic-gate 		}
39277c478bd9Sstevel@tonic-gate 		if (s)
39287c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
39297c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
39307c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha.mha_flags,
39317c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
39327c478bd9Sstevel@tonic-gate 		else
39337c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
39347c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
39357c478bd9Sstevel@tonic-gate 			    pri->pname, mha.mha_cmd, mha.mha_flags,
39367c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
39377c478bd9Sstevel@tonic-gate 	}
39387c478bd9Sstevel@tonic-gate }
39397c478bd9Sstevel@tonic-gate 
39407c478bd9Sstevel@tonic-gate 
39417c478bd9Sstevel@tonic-gate static void
show_memcntl_mha32(private_t * pri,long offset)39427c478bd9Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset)
39437c478bd9Sstevel@tonic-gate {
39447c478bd9Sstevel@tonic-gate 	struct memcntl_mha32 mha32;
39457c478bd9Sstevel@tonic-gate 	const char *s = NULL;
39467c478bd9Sstevel@tonic-gate 
39477c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha32, sizeof (mha32), offset) ==
39487c478bd9Sstevel@tonic-gate 	    sizeof (mha32)) {
39497c478bd9Sstevel@tonic-gate 		switch (mha32.mha_cmd) {
39507c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
39517c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
39527c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
39537c478bd9Sstevel@tonic-gate 		}
39547c478bd9Sstevel@tonic-gate 		if (s)
39557c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
39567c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
39577c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha32.mha_flags, mha32.mha_pagesize);
39587c478bd9Sstevel@tonic-gate 		else
39597c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
39607c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
39617c478bd9Sstevel@tonic-gate 			    pri->pname, mha32.mha_cmd, mha32.mha_flags,
39627c478bd9Sstevel@tonic-gate 			    mha32.mha_pagesize);
39637c478bd9Sstevel@tonic-gate 	}
39647c478bd9Sstevel@tonic-gate }
39657c478bd9Sstevel@tonic-gate 
39667c478bd9Sstevel@tonic-gate 
39677c478bd9Sstevel@tonic-gate static void
show_memcntl(private_t * pri)39687c478bd9Sstevel@tonic-gate show_memcntl(private_t *pri)
39697c478bd9Sstevel@tonic-gate {
39707c478bd9Sstevel@tonic-gate 
39717c478bd9Sstevel@tonic-gate 	if ((int)pri->sys_args[2] != MC_HAT_ADVISE)
39727c478bd9Sstevel@tonic-gate 		return;
39737c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_LP64)
39747c478bd9Sstevel@tonic-gate 		show_memcntl_mha(pri, (long)pri->sys_args[3]);
39757c478bd9Sstevel@tonic-gate 	else
39767c478bd9Sstevel@tonic-gate 		show_memcntl_mha32(pri, (long)pri->sys_args[3]);
39777c478bd9Sstevel@tonic-gate }
39787c478bd9Sstevel@tonic-gate 
39797c478bd9Sstevel@tonic-gate void
show_ids(private_t * pri,long offset,int count)39807c478bd9Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count)
39817c478bd9Sstevel@tonic-gate {
39827c478bd9Sstevel@tonic-gate 	id_t buf[MYBUFSIZ / sizeof (id_t)];
39837c478bd9Sstevel@tonic-gate 	id_t *idp;
39847c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 48);
39857c478bd9Sstevel@tonic-gate 
39863b862e9aSRoger A. Faulkner 	if (offset == 0)
39877c478bd9Sstevel@tonic-gate 		return;
39887c478bd9Sstevel@tonic-gate 
39897c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
39907c478bd9Sstevel@tonic-gate 	if (serial)
39917c478bd9Sstevel@tonic-gate 		Eserialize();
39927c478bd9Sstevel@tonic-gate 
39937c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
39947c478bd9Sstevel@tonic-gate 		ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)?
39957c478bd9Sstevel@tonic-gate 		    count * sizeof (id_t) : MYBUFSIZ;
39967c478bd9Sstevel@tonic-gate 
39977c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 ||
39987c478bd9Sstevel@tonic-gate 		    nb < sizeof (id_t))
39997c478bd9Sstevel@tonic-gate 			break;
40007c478bd9Sstevel@tonic-gate 
40017c478bd9Sstevel@tonic-gate 		idp = buf;
40027c478bd9Sstevel@tonic-gate 		while (!interrupt && nb >= sizeof (id_t)) {
40037c478bd9Sstevel@tonic-gate 			(void) printf("%s\t%8d\n", pri->pname, (int)*idp);
40047c478bd9Sstevel@tonic-gate 			offset += sizeof (id_t);
40057c478bd9Sstevel@tonic-gate 			nb -= sizeof (id_t);
40067c478bd9Sstevel@tonic-gate 			idp++;
40077c478bd9Sstevel@tonic-gate 			count--;
40087c478bd9Sstevel@tonic-gate 		}
40097c478bd9Sstevel@tonic-gate 	}
40107c478bd9Sstevel@tonic-gate 
40117c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
40127c478bd9Sstevel@tonic-gate 	if (serial)
40137c478bd9Sstevel@tonic-gate 		Xserialize();
40147c478bd9Sstevel@tonic-gate }
40157c478bd9Sstevel@tonic-gate 
40167c478bd9Sstevel@tonic-gate void
show_ntp_gettime(private_t * pri)40177c478bd9Sstevel@tonic-gate show_ntp_gettime(private_t *pri)
40187c478bd9Sstevel@tonic-gate {
40197c478bd9Sstevel@tonic-gate 	struct ntptimeval ntv;
40207c478bd9Sstevel@tonic-gate 	long offset;
40217c478bd9Sstevel@tonic-gate 
402227aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
40237c478bd9Sstevel@tonic-gate 		return;
40247c478bd9Sstevel@tonic-gate 
40257c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
40267c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv, sizeof (ntv), offset)
40277c478bd9Sstevel@tonic-gate 		    != sizeof (ntv))
40287c478bd9Sstevel@tonic-gate 			return;
40297c478bd9Sstevel@tonic-gate 	} else {
40307c478bd9Sstevel@tonic-gate 		struct ntptimeval32 ntv32;
40317c478bd9Sstevel@tonic-gate 
40327c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv32, sizeof (ntv32), offset)
40337c478bd9Sstevel@tonic-gate 		    != sizeof (ntv32))
40347c478bd9Sstevel@tonic-gate 			return;
40357c478bd9Sstevel@tonic-gate 
40367c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time);
40377c478bd9Sstevel@tonic-gate 		ntv.maxerror = ntv32.maxerror;
40387c478bd9Sstevel@tonic-gate 		ntv.esterror = ntv32.esterror;
40397c478bd9Sstevel@tonic-gate 	}
40407c478bd9Sstevel@tonic-gate 
40417c478bd9Sstevel@tonic-gate 	(void) printf("\ttime:     %ld.%6.6ld sec\n",
40427c478bd9Sstevel@tonic-gate 	    ntv.time.tv_sec, ntv.time.tv_usec);
40437c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror: %11d usec\n", ntv.maxerror);
40447c478bd9Sstevel@tonic-gate 	(void) printf("\testerror: %11d usec\n", ntv.esterror);
40457c478bd9Sstevel@tonic-gate }
40467c478bd9Sstevel@tonic-gate 
40477c478bd9Sstevel@tonic-gate static char *
get_timex_modes(private_t * pri,uint32_t val)40487c478bd9Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val)
40497c478bd9Sstevel@tonic-gate {
40507c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
40517c478bd9Sstevel@tonic-gate 	size_t used = 0;
40527c478bd9Sstevel@tonic-gate 
40537c478bd9Sstevel@tonic-gate 	*str = '\0';
40547c478bd9Sstevel@tonic-gate 	if (val & MOD_OFFSET)
40557c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf));
40567c478bd9Sstevel@tonic-gate 	if (val & MOD_FREQUENCY)
40577c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf));
40587c478bd9Sstevel@tonic-gate 	if (val & MOD_MAXERROR)
40597c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf));
40607c478bd9Sstevel@tonic-gate 	if (val & MOD_ESTERROR)
40617c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf));
40627c478bd9Sstevel@tonic-gate 	if (val & MOD_STATUS)
40637c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf));
40647c478bd9Sstevel@tonic-gate 	if (val & MOD_TIMECONST)
40657c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf));
40667c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKB)
40677c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf));
40687c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKA)
40697c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf));
40707c478bd9Sstevel@tonic-gate 
40717c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
40727c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
40737c478bd9Sstevel@tonic-gate 
40747c478bd9Sstevel@tonic-gate 	return (str + 1);
40757c478bd9Sstevel@tonic-gate }
40767c478bd9Sstevel@tonic-gate 
40777c478bd9Sstevel@tonic-gate static char *
get_timex_status(private_t * pri,int32_t val)40787c478bd9Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val)
40797c478bd9Sstevel@tonic-gate {
40807c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
40817c478bd9Sstevel@tonic-gate 	size_t used = 0;
40827c478bd9Sstevel@tonic-gate 
40837c478bd9Sstevel@tonic-gate 	*str = '\0';
40847c478bd9Sstevel@tonic-gate 	if (val & STA_PLL)
40857c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf));
40867c478bd9Sstevel@tonic-gate 	if (val & STA_PPSFREQ)
40877c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf));
40887c478bd9Sstevel@tonic-gate 	if (val & STA_PPSTIME)
40897c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf));
40907c478bd9Sstevel@tonic-gate 	if (val & STA_FLL)
40917c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf));
40927c478bd9Sstevel@tonic-gate 
40937c478bd9Sstevel@tonic-gate 	if (val & STA_INS)
40947c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_INS", sizeof (pri->code_buf));
40957c478bd9Sstevel@tonic-gate 	if (val & STA_DEL)
40967c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf));
40977c478bd9Sstevel@tonic-gate 	if (val & STA_UNSYNC)
40987c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf));
40997c478bd9Sstevel@tonic-gate 	if (val & STA_FREQHOLD)
41007c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf));
41017c478bd9Sstevel@tonic-gate 
41027c478bd9Sstevel@tonic-gate 	if (val & STA_PPSSIGNAL)
41037c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf));
41047c478bd9Sstevel@tonic-gate 	if (val & STA_PPSJITTER)
41057c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf));
41067c478bd9Sstevel@tonic-gate 	if (val & STA_PPSWANDER)
41077c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf));
41087c478bd9Sstevel@tonic-gate 	if (val & STA_PPSERROR)
41097c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf));
41107c478bd9Sstevel@tonic-gate 
41117c478bd9Sstevel@tonic-gate 	if (val & STA_CLOCKERR)
41127c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf));
41137c478bd9Sstevel@tonic-gate 
41147c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
41157c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
41167c478bd9Sstevel@tonic-gate 
41177c478bd9Sstevel@tonic-gate 	return (str + 1);
41187c478bd9Sstevel@tonic-gate }
41197c478bd9Sstevel@tonic-gate 
41207c478bd9Sstevel@tonic-gate void
show_ntp_adjtime(private_t * pri)41217c478bd9Sstevel@tonic-gate show_ntp_adjtime(private_t *pri)
41227c478bd9Sstevel@tonic-gate {
41237c478bd9Sstevel@tonic-gate 	struct timex timex;
41247c478bd9Sstevel@tonic-gate 	long offset;
41257c478bd9Sstevel@tonic-gate 
412627aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
41277c478bd9Sstevel@tonic-gate 		return;
41287c478bd9Sstevel@tonic-gate 
41297c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex))
41307c478bd9Sstevel@tonic-gate 		return;
41317c478bd9Sstevel@tonic-gate 
41327c478bd9Sstevel@tonic-gate 	(void) printf("\tmodes:     %s\n", get_timex_modes(pri, timex.modes));
41337c478bd9Sstevel@tonic-gate 	(void) printf("\toffset:    %11d usec\n", timex.offset);
41347c478bd9Sstevel@tonic-gate 	(void) printf("\tfreq:      %11d scaled ppm\n", timex.freq);
41357c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror:  %11d usec\n", timex.maxerror);
41367c478bd9Sstevel@tonic-gate 	(void) printf("\testerror:  %11d usec\n", timex.esterror);
41377c478bd9Sstevel@tonic-gate 	(void) printf("\tstatus:    %s\n", get_timex_status(pri, timex.status));
41387c478bd9Sstevel@tonic-gate 	(void) printf("\tconstant:  %11d\n", timex.constant);
41397c478bd9Sstevel@tonic-gate 	(void) printf("\tprecision: %11d usec\n", timex.precision);
41407c478bd9Sstevel@tonic-gate 	(void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance);
41417c478bd9Sstevel@tonic-gate 	(void) printf("\tppsfreq:   %11d scaled ppm\n", timex.ppsfreq);
41427c478bd9Sstevel@tonic-gate 	(void) printf("\tjitter:    %11d usec\n", timex.jitter);
41437c478bd9Sstevel@tonic-gate 	(void) printf("\tshift:     %11d sec\n", timex.shift);
41447c478bd9Sstevel@tonic-gate 	(void) printf("\tstabil:    %11d scaled ppm\n", timex.stabil);
41457c478bd9Sstevel@tonic-gate 	(void) printf("\tjitcnt:    %11d\n", timex.jitcnt);
41467c478bd9Sstevel@tonic-gate 	(void) printf("\tcalcnt:    %11d\n", timex.calcnt);
41477c478bd9Sstevel@tonic-gate 	(void) printf("\terrcnt:    %11d\n", timex.errcnt);
41487c478bd9Sstevel@tonic-gate 	(void) printf("\tstbcnt:    %11d\n", timex.stbcnt);
41497c478bd9Sstevel@tonic-gate }
41507c478bd9Sstevel@tonic-gate 
41517c478bd9Sstevel@tonic-gate void
show_getrusage(long offset)41527c478bd9Sstevel@tonic-gate show_getrusage(long offset)
41537c478bd9Sstevel@tonic-gate {
41547c478bd9Sstevel@tonic-gate 	struct rusage r;
41557c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
41567c478bd9Sstevel@tonic-gate 		return;
41577c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %ld.%6.6ld sec\n",
41587c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
41597c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
41607c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %ld.%6.6ld sec\n",
41617c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
41627c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
41637c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %ld\n",
41647c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
41657c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %ld\n",
41667c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
41677c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %ld\n",
41687c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
41697c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %ld\n",
41707c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
41717c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %ld\n",
41727c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
41737c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %ld\n",
41747c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
41757c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %ld\n",
41767c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
41777c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %ld\n",
41787c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
41797c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %ld\n",
41807c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
41817c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %ld\n",
41827c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
41837c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %ld\n",
41847c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
41857c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %ld\n",
41867c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
41877c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %ld\n",
41887c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
41897c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %ld\n",
41907c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
41917c478bd9Sstevel@tonic-gate }
41927c478bd9Sstevel@tonic-gate 
41937c478bd9Sstevel@tonic-gate void
show_getrusage32(long offset)41947c478bd9Sstevel@tonic-gate show_getrusage32(long offset)
41957c478bd9Sstevel@tonic-gate {
41967c478bd9Sstevel@tonic-gate 	struct rusage32 r;
41977c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
41987c478bd9Sstevel@tonic-gate 		return;
41997c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %d.%6.6d sec\n",
42007c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
42017c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
42027c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %d.%6.6d sec\n",
42037c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
42047c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
42057c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %d\n",
42067c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
42077c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %d\n",
42087c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
42097c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %d\n",
42107c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
42117c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %d\n",
42127c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
42137c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %d\n",
42147c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
42157c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %d\n",
42167c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
42177c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %d\n",
42187c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
42197c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %d\n",
42207c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
42217c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %d\n",
42227c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
42237c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %d\n",
42247c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
42257c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %d\n",
42267c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
42277c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %d\n",
42287c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
42297c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %d\n",
42307c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
42317c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %d\n",
42327c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
42337c478bd9Sstevel@tonic-gate }
42347c478bd9Sstevel@tonic-gate 
4235aa4a4f3bSnf202958 /*
4236aa4a4f3bSnf202958  * Utility function to print a packed nvlist by unpacking
4237aa4a4f3bSnf202958  * and calling the libnvpair pretty printer.  Frees all
4238aa4a4f3bSnf202958  * allocated memory internally.
4239aa4a4f3bSnf202958  */
4240aa4a4f3bSnf202958 static void
show_packed_nvlist(private_t * pri,uintptr_t offset,size_t size)4241aa4a4f3bSnf202958 show_packed_nvlist(private_t *pri, uintptr_t offset, size_t size)
4242aa4a4f3bSnf202958 {
4243aa4a4f3bSnf202958 	nvlist_t *nvl = NULL;
4244aa4a4f3bSnf202958 	size_t readsize;
4245aa4a4f3bSnf202958 	char *buf;
4246aa4a4f3bSnf202958 
4247aa4a4f3bSnf202958 	if ((offset == 0) || (size == 0)) {
4248aa4a4f3bSnf202958 		return;
4249aa4a4f3bSnf202958 	}
4250aa4a4f3bSnf202958 
4251aa4a4f3bSnf202958 	buf = my_malloc(size, "nvlist decode buffer");
4252aa4a4f3bSnf202958 	readsize = Pread(Proc, buf, size, offset);
4253aa4a4f3bSnf202958 	if (readsize != size) {
4254aa4a4f3bSnf202958 		(void) printf("%s\t<?>", pri->pname);
4255aa4a4f3bSnf202958 	} else {
4256aa4a4f3bSnf202958 		int result;
4257aa4a4f3bSnf202958 
4258aa4a4f3bSnf202958 		result = nvlist_unpack(buf, size, &nvl, 0);
4259aa4a4f3bSnf202958 		if (result == 0) {
4260a803cc21SGordon Ross 			dump_nvlist(nvl, 8);
4261aa4a4f3bSnf202958 			nvlist_free(nvl);
4262aa4a4f3bSnf202958 		} else {
4263aa4a4f3bSnf202958 			(void) printf("%s\tunpack of nvlist"
4264aa4a4f3bSnf202958 			    " failed: %d\n", pri->pname, result);
4265aa4a4f3bSnf202958 		}
4266aa4a4f3bSnf202958 	}
4267aa4a4f3bSnf202958 	free(buf);
4268aa4a4f3bSnf202958 }
4269aa4a4f3bSnf202958 
4270821c4a97Sdp static void
show_zone_create_args(private_t * pri,long offset)4271821c4a97Sdp show_zone_create_args(private_t *pri, long offset)
4272821c4a97Sdp {
4273821c4a97Sdp 	zone_def args;
4274821c4a97Sdp 	char zone_name[ZONENAME_MAX];
4275821c4a97Sdp 	char zone_root[MAXPATHLEN];
4276821c4a97Sdp 	char *zone_zfs = NULL;
4277821c4a97Sdp 
4278821c4a97Sdp 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4279821c4a97Sdp 
4280821c4a97Sdp 		if (Pread_string(Proc, zone_name, sizeof (zone_name),
4281821c4a97Sdp 		    (uintptr_t)args.zone_name) == -1)
4282821c4a97Sdp 			(void) strcpy(zone_name, "<?>");
4283821c4a97Sdp 
4284821c4a97Sdp 		if (Pread_string(Proc, zone_root, sizeof (zone_root),
4285821c4a97Sdp 		    (uintptr_t)args.zone_root) == -1)
4286821c4a97Sdp 			(void) strcpy(zone_root, "<?>");
4287821c4a97Sdp 
4288821c4a97Sdp 		if (args.zfsbufsz > 0) {
4289821c4a97Sdp 			zone_zfs = malloc(MIN(4, args.zfsbufsz));
4290821c4a97Sdp 			if (zone_zfs != NULL) {
4291821c4a97Sdp 				if (Pread(Proc, zone_zfs, args.zfsbufsz,
4292821c4a97Sdp 				    (uintptr_t)args.zfsbuf) == -1)
4293821c4a97Sdp 					(void) strcpy(zone_zfs, "<?>");
4294821c4a97Sdp 			}
4295821c4a97Sdp 		} else {
4296821c4a97Sdp 			zone_zfs = "";
4297821c4a97Sdp 		}
4298821c4a97Sdp 
4299821c4a97Sdp 		(void) printf("%s\t     zone_name: %s\n", pri->pname,
4300821c4a97Sdp 		    zone_name);
4301821c4a97Sdp 		(void) printf("%s\t     zone_root: %s\n", pri->pname,
4302821c4a97Sdp 		    zone_root);
4303821c4a97Sdp 
4304821c4a97Sdp 		show_privset(pri, (uintptr_t)args.zone_privs,
4305821c4a97Sdp 		    args.zone_privssz, "    zone_privs: ");
4306821c4a97Sdp 
4307821c4a97Sdp 		(void) printf("%s\t       rctlbuf: 0x%p\n", pri->pname,
4308821c4a97Sdp 		    (void *)args.rctlbuf);
4309821c4a97Sdp 		(void) printf("%s\t     rctlbufsz: %lu\n", pri->pname,
4310821c4a97Sdp 		    (ulong_t)args.rctlbufsz);
4311821c4a97Sdp 
4312aa4a4f3bSnf202958 		show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4313aa4a4f3bSnf202958 		    args.rctlbufsz);
4314aa4a4f3bSnf202958 
4315821c4a97Sdp 		(void) printf("%s\t           zfs: %s\n", pri->pname, zone_zfs);
4316821c4a97Sdp 
4317821c4a97Sdp 		(void) printf("%s\textended_error: 0x%p\n", pri->pname,
4318821c4a97Sdp 		    (void *)args.extended_error);
4319821c4a97Sdp 
432045916cd2Sjpk 		if (is_system_labeled()) {
432145916cd2Sjpk 			char		*label_str = NULL;
432245916cd2Sjpk 			bslabel_t	zone_label;
432345916cd2Sjpk 
432445916cd2Sjpk 			(void) printf("%s\t         match: %d\n", pri->pname,
432545916cd2Sjpk 			    args.match);
432645916cd2Sjpk 			(void) printf("%s\t           doi: %d\n", pri->pname,
432745916cd2Sjpk 			    args.doi);
432845916cd2Sjpk 
432945916cd2Sjpk 			if (Pread_string(Proc, (char *)&zone_label,
433045916cd2Sjpk 			    sizeof (zone_label), (uintptr_t)args.label) != -1) {
433145916cd2Sjpk 				/* show the label as string */
433245916cd2Sjpk 				if (label_to_str(&zone_label, &label_str,
433345916cd2Sjpk 				    M_LABEL, SHORT_NAMES) != 0) {
433445916cd2Sjpk 					/* have to dump label as raw string */
433545916cd2Sjpk 					(void) label_to_str(&zone_label,
433645916cd2Sjpk 					    &label_str, M_INTERNAL,
433745916cd2Sjpk 					    SHORT_NAMES);
433845916cd2Sjpk 				}
433945916cd2Sjpk 			}
434045916cd2Sjpk 
434145916cd2Sjpk 			(void) printf("%s\t         label: %s\n",
434245916cd2Sjpk 			    pri->pname, label_str != NULL ? label_str : "<?>");
434345916cd2Sjpk 			if (label_str)
434445916cd2Sjpk 				free(label_str);
434545916cd2Sjpk 		}
434645916cd2Sjpk 
4347821c4a97Sdp 		if (args.zfsbufsz > 0)
4348821c4a97Sdp 			free(zone_zfs);
4349821c4a97Sdp 	}
4350821c4a97Sdp }
4351821c4a97Sdp 
4352821c4a97Sdp 
4353821c4a97Sdp 
4354821c4a97Sdp static void
show_zone_create_args32(private_t * pri,long offset)4355821c4a97Sdp show_zone_create_args32(private_t *pri, long offset)
4356821c4a97Sdp {
4357821c4a97Sdp 	zone_def32 args;
4358821c4a97Sdp 	char zone_name[ZONENAME_MAX];
4359821c4a97Sdp 	char zone_root[MAXPATHLEN];
4360821c4a97Sdp 	char *zone_zfs = NULL;
4361821c4a97Sdp 
4362821c4a97Sdp 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4363821c4a97Sdp 
4364821c4a97Sdp 		if (Pread_string(Proc, zone_name, sizeof (zone_name),
4365821c4a97Sdp 		    (uintptr_t)args.zone_name) == -1)
4366821c4a97Sdp 			(void) strcpy(zone_name, "<?>");
4367821c4a97Sdp 
4368821c4a97Sdp 		if (Pread_string(Proc, zone_root, sizeof (zone_root),
4369821c4a97Sdp 		    (uintptr_t)args.zone_root) == -1)
4370821c4a97Sdp 			(void) strcpy(zone_root, "<?>");
4371821c4a97Sdp 
4372821c4a97Sdp 		if (args.zfsbufsz > 0) {
4373821c4a97Sdp 			zone_zfs = malloc(MIN(4, args.zfsbufsz));
4374821c4a97Sdp 			if (zone_zfs != NULL) {
4375821c4a97Sdp 				if (Pread(Proc, zone_zfs, args.zfsbufsz,
4376821c4a97Sdp 				    (uintptr_t)args.zfsbuf) == -1)
4377821c4a97Sdp 					(void) strcpy(zone_zfs, "<?>");
4378821c4a97Sdp 			}
4379821c4a97Sdp 		} else {
4380821c4a97Sdp 			zone_zfs = "";
4381821c4a97Sdp 		}
4382821c4a97Sdp 
4383821c4a97Sdp 		(void) printf("%s\t     zone_name: %s\n", pri->pname,
4384821c4a97Sdp 		    zone_name);
4385821c4a97Sdp 		(void) printf("%s\t     zone_root: %s\n", pri->pname,
4386821c4a97Sdp 		    zone_root);
4387821c4a97Sdp 
4388821c4a97Sdp 		show_privset(pri, (uintptr_t)args.zone_privs,
4389821c4a97Sdp 		    args.zone_privssz, "    zone_privs: ");
4390821c4a97Sdp 
43913246257cSdp 		(void) printf("%s\t       rctlbuf: 0x%x\n", pri->pname,
43923246257cSdp 		    (caddr32_t)args.rctlbuf);
4393821c4a97Sdp 		(void) printf("%s\t     rctlbufsz: %lu\n", pri->pname,
4394821c4a97Sdp 		    (ulong_t)args.rctlbufsz);
4395821c4a97Sdp 
4396aa4a4f3bSnf202958 		show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4397aa4a4f3bSnf202958 		    args.rctlbufsz);
4398aa4a4f3bSnf202958 
4399821c4a97Sdp 		(void) printf("%s\t           zfs: %s\n", pri->pname, zone_zfs);
4400821c4a97Sdp 
44013246257cSdp 		(void) printf("%s\textended_error: 0x%x\n", pri->pname,
44023246257cSdp 		    (caddr32_t)args.extended_error);
4403821c4a97Sdp 
440445916cd2Sjpk 		if (is_system_labeled()) {
440545916cd2Sjpk 			char		*label_str = NULL;
440645916cd2Sjpk 			bslabel_t	zone_label;
440745916cd2Sjpk 
440845916cd2Sjpk 			(void) printf("%s\t         match: %d\n", pri->pname,
440945916cd2Sjpk 			    args.match);
441045916cd2Sjpk 			(void) printf("%s\t           doi: %d\n", pri->pname,
441145916cd2Sjpk 			    args.doi);
441245916cd2Sjpk 
441345916cd2Sjpk 			if (Pread_string(Proc, (char *)&zone_label,
441445916cd2Sjpk 			    sizeof (zone_label), (caddr32_t)args.label) != -1) {
441545916cd2Sjpk 				/* show the label as string */
441645916cd2Sjpk 				if (label_to_str(&zone_label, &label_str,
441745916cd2Sjpk 				    M_LABEL, SHORT_NAMES) != 0) {
441845916cd2Sjpk 					/* have to dump label as raw string */
441945916cd2Sjpk 					(void) label_to_str(&zone_label,
442045916cd2Sjpk 					    &label_str, M_INTERNAL,
442145916cd2Sjpk 					    SHORT_NAMES);
442245916cd2Sjpk 				}
442345916cd2Sjpk 			}
442445916cd2Sjpk 			(void) printf("%s\t         label: %s\n",
442545916cd2Sjpk 			    pri->pname, label_str != NULL ? label_str : "<?>");
442645916cd2Sjpk 			if (label_str)
442745916cd2Sjpk 				free(label_str);
442845916cd2Sjpk 		}
442945916cd2Sjpk 
4430821c4a97Sdp 		if (args.zfsbufsz > 0)
4431821c4a97Sdp 			free(zone_zfs);
4432821c4a97Sdp 	}
4433821c4a97Sdp }
4434821c4a97Sdp 
4435821c4a97Sdp 
4436821c4a97Sdp static void
show_zones(private_t * pri)4437821c4a97Sdp show_zones(private_t *pri)
4438821c4a97Sdp {
4439821c4a97Sdp 	switch (pri->sys_args[0]) {
4440821c4a97Sdp 	case ZONE_CREATE:
4441821c4a97Sdp 		if (data_model == PR_MODEL_LP64)
4442821c4a97Sdp 			show_zone_create_args(pri, (long)pri->sys_args[1]);
4443821c4a97Sdp 		else
4444821c4a97Sdp 			show_zone_create_args32(pri, (long)pri->sys_args[1]);
4445821c4a97Sdp 		break;
4446821c4a97Sdp 	}
4447821c4a97Sdp }
4448821c4a97Sdp 
4449aa4a4f3bSnf202958 static void
show_rctlblk(private_t * pri,long _rctlblk)4450aa4a4f3bSnf202958 show_rctlblk(private_t *pri, long _rctlblk)
4451aa4a4f3bSnf202958 {
4452aa4a4f3bSnf202958 	rctlblk_t *blk;
4453aa4a4f3bSnf202958 	int size = rctlblk_size();
4454aa4a4f3bSnf202958 	size_t readsize;
4455aa4a4f3bSnf202958 	const char *s;
4456aa4a4f3bSnf202958 
4457aa4a4f3bSnf202958 	blk = my_malloc(size, "rctlblk decode buffer");
4458aa4a4f3bSnf202958 	readsize = Pread(Proc, blk, size, _rctlblk);
4459aa4a4f3bSnf202958 	if (readsize != size) {
4460aa4a4f3bSnf202958 		(void) printf("%s\t\t<?>", pri->pname);
4461aa4a4f3bSnf202958 	} else {
4462aa4a4f3bSnf202958 		(void) printf("%s\t\t     Privilege: 0x%x\n",
4463aa4a4f3bSnf202958 		    pri->pname,
4464aa4a4f3bSnf202958 		    rctlblk_get_privilege(blk));
4465aa4a4f3bSnf202958 		(void) printf("%s\t\t         Value: %lld\n",
4466aa4a4f3bSnf202958 		    pri->pname,
4467aa4a4f3bSnf202958 		    rctlblk_get_value(blk));
4468aa4a4f3bSnf202958 		(void) printf("%s\t\tEnforced Value: %lld\n",
4469aa4a4f3bSnf202958 		    pri->pname,
4470aa4a4f3bSnf202958 		    rctlblk_get_enforced_value(blk));
4471aa4a4f3bSnf202958 
4472aa4a4f3bSnf202958 		{
4473aa4a4f3bSnf202958 			int sig, act;
4474aa4a4f3bSnf202958 			act = rctlblk_get_local_action(blk, &sig);
4475aa4a4f3bSnf202958 
4476aa4a4f3bSnf202958 			s = rctl_local_action(pri, act);
4477aa4a4f3bSnf202958 			if (s == NULL) {
4478aa4a4f3bSnf202958 				(void) printf("%s\t\t  Local action: 0x%x\n",
4479aa4a4f3bSnf202958 				    pri->pname, act);
4480aa4a4f3bSnf202958 			} else {
4481aa4a4f3bSnf202958 				(void) printf("%s\t\t  Local action: %s\n",
4482aa4a4f3bSnf202958 				    pri->pname, s);
4483aa4a4f3bSnf202958 			}
4484aa4a4f3bSnf202958 
4485aa4a4f3bSnf202958 			if (act & RCTL_LOCAL_SIGNAL) {
4486aa4a4f3bSnf202958 				(void) printf("%s\t\t                "
4487aa4a4f3bSnf202958 				    "For signal %s\n",
4488aa4a4f3bSnf202958 				    pri->pname, signame(pri, sig));
4489aa4a4f3bSnf202958 			}
4490aa4a4f3bSnf202958 		}
4491aa4a4f3bSnf202958 
4492aa4a4f3bSnf202958 		s = rctl_local_flags(pri, rctlblk_get_local_flags(blk));
4493aa4a4f3bSnf202958 		if (s == NULL) {
4494aa4a4f3bSnf202958 			(void) printf("%s\t\t   Local flags: 0x%x\n",
4495aa4a4f3bSnf202958 			    pri->pname, rctlblk_get_local_flags(blk));
4496aa4a4f3bSnf202958 		} else {
4497aa4a4f3bSnf202958 			(void) printf("%s\t\t   Local flags: %s\n",
4498aa4a4f3bSnf202958 			    pri->pname, s);
4499aa4a4f3bSnf202958 		}
4500aa4a4f3bSnf202958 
4501aa4a4f3bSnf202958 		(void) printf("%s\t\t Recipient PID: %d\n",
4502aa4a4f3bSnf202958 		    pri->pname,
4503aa4a4f3bSnf202958 		    rctlblk_get_recipient_pid(blk));
4504aa4a4f3bSnf202958 		(void) printf("%s\t\t   Firing Time: %lld\n",
4505aa4a4f3bSnf202958 		    pri->pname,
4506aa4a4f3bSnf202958 		    rctlblk_get_firing_time(blk));
4507aa4a4f3bSnf202958 	}
4508aa4a4f3bSnf202958 	free(blk);
4509aa4a4f3bSnf202958 }
4510aa4a4f3bSnf202958 
4511aa4a4f3bSnf202958 static void
show_rctls(private_t * pri)4512aa4a4f3bSnf202958 show_rctls(private_t *pri)
4513aa4a4f3bSnf202958 {
4514532877c4Srd117015 	int entry;
4515532877c4Srd117015 
4516aa4a4f3bSnf202958 	switch (pri->sys_args[0]) {
4517aa4a4f3bSnf202958 	case 0:	/* getrctl */
4518aa4a4f3bSnf202958 	case 1: /* setrctl */
4519aa4a4f3bSnf202958 		/*
4520aa4a4f3bSnf202958 		 * If these offsets look a little odd, remember that they're
4521aa4a4f3bSnf202958 		 * into the _raw_ system call
4522aa4a4f3bSnf202958 		 */
4523aa4a4f3bSnf202958 		(void) printf("%s\tOld rctlblk: 0x%lx\n", pri->pname,
4524aa4a4f3bSnf202958 		    pri->sys_args[2]);
452527aa4812SToomas Soome 		if (pri->sys_args[2] != 0) {
4526aa4a4f3bSnf202958 			show_rctlblk(pri, pri->sys_args[2]);
4527aa4a4f3bSnf202958 		}
4528aa4a4f3bSnf202958 		(void) printf("%s\tNew rctlblk: 0x%lx\n", pri->pname,
4529aa4a4f3bSnf202958 		    pri->sys_args[3]);
453027aa4812SToomas Soome 		if (pri->sys_args[3] != 0) {
4531aa4a4f3bSnf202958 			show_rctlblk(pri, pri->sys_args[3]);
4532aa4a4f3bSnf202958 		}
4533aa4a4f3bSnf202958 		break;
4534532877c4Srd117015 	case 4: /* setprojrctl */
4535532877c4Srd117015 		for (entry = 0; entry < pri->sys_args[4]; entry++) {
4536532877c4Srd117015 			(void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4537532877c4Srd117015 			    pri->pname, entry,
4538532877c4Srd117015 			    (long)RCTLBLK_INC(pri->sys_args[3], entry));
4539532877c4Srd117015 			if (RCTLBLK_INC(pri->sys_args[3], entry) != NULL) {
4540532877c4Srd117015 				show_rctlblk(pri,
4541532877c4Srd117015 				    (long)RCTLBLK_INC(pri->sys_args[3], entry));
4542532877c4Srd117015 			}
4543532877c4Srd117015 		}
4544aa4a4f3bSnf202958 	}
4545aa4a4f3bSnf202958 }
4546821c4a97Sdp 
45473b862e9aSRoger A. Faulkner void
show_utimesys(private_t * pri)45483b862e9aSRoger A. Faulkner show_utimesys(private_t *pri)
45493b862e9aSRoger A. Faulkner {
45503b862e9aSRoger A. Faulkner 	switch (pri->sys_args[0]) {
45513b862e9aSRoger A. Faulkner 	case 0:			/* futimens() */
45523b862e9aSRoger A. Faulkner 		if (pri->sys_nargs > 2)
45533b862e9aSRoger A. Faulkner 			show_utimens(pri, (long)pri->sys_args[2]);
45543b862e9aSRoger A. Faulkner 		break;
45553b862e9aSRoger A. Faulkner 	case 1:			/* utimensat */
45563b862e9aSRoger A. Faulkner 		if (pri->sys_nargs > 3)
45573b862e9aSRoger A. Faulkner 			show_utimens(pri, (long)pri->sys_args[3]);
45583b862e9aSRoger A. Faulkner 		break;
45593b862e9aSRoger A. Faulkner 	default:		/* unexpected subcode */
45603b862e9aSRoger A. Faulkner 		break;
45613b862e9aSRoger A. Faulkner 	}
45623b862e9aSRoger A. Faulkner }
45633b862e9aSRoger A. Faulkner 
45643e95bd4aSAnders Persson static void
show_sockconfig_filter_prop32(private_t * pri,long addr)45653e95bd4aSAnders Persson show_sockconfig_filter_prop32(private_t *pri, long addr)
45663e95bd4aSAnders Persson {
45673e95bd4aSAnders Persson 	struct sockconfig_filter_props32 props;
45683e95bd4aSAnders Persson 	const char *s = NULL;
45693e95bd4aSAnders Persson 	char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
45703e95bd4aSAnders Persson 	sof_socktuple32_t *tup;
45713e95bd4aSAnders Persson 	size_t sz;
45723e95bd4aSAnders Persson 	int i;
45733e95bd4aSAnders Persson 
45743e95bd4aSAnders Persson 	if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
45753e95bd4aSAnders Persson 		if (Pread_string(Proc, buf, sizeof (buf),
45763e95bd4aSAnders Persson 		    (uintptr_t)props.sfp_modname) == -1)
45773e95bd4aSAnders Persson 			(void) strcpy(buf, "<?>");
45783e95bd4aSAnders Persson 		(void) printf("%s\tmodule name: %s\n", pri->pname, buf);
45793e95bd4aSAnders Persson 		(void) printf("%s\tattach semantics: %s", pri->pname,
45803e95bd4aSAnders Persson 		    props.sfp_autoattach ? "automatic" : "progammatic");
45813e95bd4aSAnders Persson 		if (props.sfp_autoattach) {
45823e95bd4aSAnders Persson 			buf[0] = '\0';
45833e95bd4aSAnders Persson 			switch (props.sfp_hint) {
45843e95bd4aSAnders Persson 			case SOF_HINT_TOP:	s = "top"; break;
45853e95bd4aSAnders Persson 			case SOF_HINT_BOTTOM:	s = "bottom"; break;
45863e95bd4aSAnders Persson 			case SOF_HINT_BEFORE:
45873e95bd4aSAnders Persson 			case SOF_HINT_AFTER:
45883e95bd4aSAnders Persson 				s = (props.sfp_hint == SOF_HINT_BEFORE) ?
45893e95bd4aSAnders Persson 				    "before" : "after";
45903e95bd4aSAnders Persson 				if (Pread_string(Proc, buf, sizeof (buf),
45913e95bd4aSAnders Persson 				    (uintptr_t)props.sfp_hintarg) == -1)
45923e95bd4aSAnders Persson 					(void) strcpy(buf, "<?>");
45933e95bd4aSAnders Persson 			}
45943e95bd4aSAnders Persson 			if (s != NULL) {
45953e95bd4aSAnders Persson 				(void) printf(", placement: %s %s", s, buf);
45963e95bd4aSAnders Persson 			}
45973e95bd4aSAnders Persson 		}
45983e95bd4aSAnders Persson 		(void) printf("\n");
45993e95bd4aSAnders Persson 		(void) printf("%s\tsocket tuples:\n", pri->pname);
46003e95bd4aSAnders Persson 		if (props.sfp_socktuple_cnt == 0) {
46013e95bd4aSAnders Persson 			(void) printf("\t\t<empty>\n");
46023e95bd4aSAnders Persson 			return;
46033e95bd4aSAnders Persson 		}
46043e95bd4aSAnders Persson 		sz = props.sfp_socktuple_cnt * sizeof (*tup);
46053e95bd4aSAnders Persson 		tup = my_malloc(sz, "socket tuple buffer");
46063e95bd4aSAnders Persson 		if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
46073e95bd4aSAnders Persson 			for (i = 0; i < props.sfp_socktuple_cnt; i++) {
46083e95bd4aSAnders Persson 				(void) printf(
46093e95bd4aSAnders Persson 				    "\t\tfamily: %d, type: %d, proto: %d\n",
46103e95bd4aSAnders Persson 				    tup[i].sofst_family, tup[i].sofst_type,
46113e95bd4aSAnders Persson 				    tup[i].sofst_protocol);
46123e95bd4aSAnders Persson 			}
46133e95bd4aSAnders Persson 	}
46143e95bd4aSAnders Persson }
46153e95bd4aSAnders Persson static void
show_sockconfig_filter_prop(private_t * pri,long addr)46163e95bd4aSAnders Persson show_sockconfig_filter_prop(private_t *pri, long addr)
46173e95bd4aSAnders Persson {
46183e95bd4aSAnders Persson 	struct sockconfig_filter_props props;
46193e95bd4aSAnders Persson 	const char *s = NULL;
46203e95bd4aSAnders Persson 	char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
46213e95bd4aSAnders Persson 	sof_socktuple_t *tup;
46223e95bd4aSAnders Persson 	size_t sz;
46233e95bd4aSAnders Persson 	int i;
46243e95bd4aSAnders Persson 
46253e95bd4aSAnders Persson 	if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
46263e95bd4aSAnders Persson 		if (Pread_string(Proc, buf, sizeof (buf),
46273e95bd4aSAnders Persson 		    (uintptr_t)props.sfp_modname) == -1)
46283e95bd4aSAnders Persson 			(void) strcpy(buf, "<?>");
46293e95bd4aSAnders Persson 		(void) printf("%s\tmodule name: %s\n", pri->pname, buf);
46303e95bd4aSAnders Persson 		(void) printf("%s\tattach semantics: %s", pri->pname,
46313e95bd4aSAnders Persson 		    props.sfp_autoattach ? "automatic" : "progammatic");
46323e95bd4aSAnders Persson 		if (props.sfp_autoattach) {
46333e95bd4aSAnders Persson 			buf[0] = '\0';
46343e95bd4aSAnders Persson 			switch (props.sfp_hint) {
46353e95bd4aSAnders Persson 			case SOF_HINT_TOP:	s = "top"; break;
46363e95bd4aSAnders Persson 			case SOF_HINT_BOTTOM:	s = "bottom"; break;
46373e95bd4aSAnders Persson 			case SOF_HINT_BEFORE:
46383e95bd4aSAnders Persson 			case SOF_HINT_AFTER:
46393e95bd4aSAnders Persson 				s = (props.sfp_hint == SOF_HINT_BEFORE) ?
46403e95bd4aSAnders Persson 				    "before" : "after";
46413e95bd4aSAnders Persson 				if (Pread_string(Proc, buf, sizeof (buf),
46423e95bd4aSAnders Persson 				    (uintptr_t)props.sfp_hintarg) == -1)
46433e95bd4aSAnders Persson 					(void) strcpy(buf, "<?>");
46443e95bd4aSAnders Persson 			}
46453e95bd4aSAnders Persson 			if (s != NULL) {
46463e95bd4aSAnders Persson 				(void) printf(", placement: %s", s);
46473e95bd4aSAnders Persson 			}
46483e95bd4aSAnders Persson 		}
46493e95bd4aSAnders Persson 		(void) printf("\n");
46503e95bd4aSAnders Persson 		(void) printf("%s\tsocket tuples:\n", pri->pname);
46513e95bd4aSAnders Persson 		if (props.sfp_socktuple_cnt == 0) {
46523e95bd4aSAnders Persson 			(void) printf("\t\t<empty>\n");
46533e95bd4aSAnders Persson 			return;
46543e95bd4aSAnders Persson 		}
46553e95bd4aSAnders Persson 		sz = props.sfp_socktuple_cnt * sizeof (*tup);
46563e95bd4aSAnders Persson 		tup = my_malloc(sz, "socket tuple buffer");
46573e95bd4aSAnders Persson 		if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
46583e95bd4aSAnders Persson 			for (i = 0; i < props.sfp_socktuple_cnt; i++) {
46593e95bd4aSAnders Persson 				(void) printf(
46603e95bd4aSAnders Persson 				    "\t\tfamily: %d, type: %d, proto: %d\n",
46613e95bd4aSAnders Persson 				    tup[i].sofst_family, tup[i].sofst_type,
46623e95bd4aSAnders Persson 				    tup[i].sofst_protocol);
46633e95bd4aSAnders Persson 			}
46643e95bd4aSAnders Persson 	}
46653e95bd4aSAnders Persson }
46663e95bd4aSAnders Persson 
46673e95bd4aSAnders Persson void
show_sockconfig(private_t * pri)46683e95bd4aSAnders Persson show_sockconfig(private_t *pri)
46693e95bd4aSAnders Persson {
46703e95bd4aSAnders Persson 	switch (pri->sys_args[0]) {
46713e95bd4aSAnders Persson 	case SOCKCONFIG_ADD_FILTER:
46723e95bd4aSAnders Persson 		if (data_model == PR_MODEL_LP64)
46733e95bd4aSAnders Persson 			show_sockconfig_filter_prop(pri,
46743e95bd4aSAnders Persson 			    (long)pri->sys_args[2]);
46753e95bd4aSAnders Persson 		else
46763e95bd4aSAnders Persson 			show_sockconfig_filter_prop32(pri,
46773e95bd4aSAnders Persson 			    (long)pri->sys_args[2]);
46783e95bd4aSAnders Persson 		break;
46793e95bd4aSAnders Persson 	default:
46803e95bd4aSAnders Persson 		break;
46813e95bd4aSAnders Persson 	}
46823e95bd4aSAnders Persson }
46833e95bd4aSAnders Persson 
4684a803cc21SGordon Ross void
show_zfs_ioc(private_t * pri,long addr)4685a803cc21SGordon Ross show_zfs_ioc(private_t *pri, long addr)
4686a803cc21SGordon Ross {
4687a803cc21SGordon Ross 	static const zfs_share_t zero_share = {0};
4688a803cc21SGordon Ross 	static const dmu_objset_stats_t zero_objstats = {0};
4689a803cc21SGordon Ross 	static const struct drr_begin zero_drrbegin = {0};
4690a803cc21SGordon Ross 	static const zinject_record_t zero_injectrec = {0};
4691a803cc21SGordon Ross 	static const zfs_stat_t zero_zstat = {0};
4692a803cc21SGordon Ross 	zfs_cmd_t zc;
4693a803cc21SGordon Ross 
4694a803cc21SGordon Ross 	if (Pread(Proc, &zc, sizeof (zc), addr) != sizeof (zc)) {
4695a803cc21SGordon Ross 		(void) printf(" zfs_ioctl read failed\n");
4696a803cc21SGordon Ross 		return;
4697a803cc21SGordon Ross 	}
4698a803cc21SGordon Ross 
4699a803cc21SGordon Ross 	if (zc.zc_name[0])
4700a803cc21SGordon Ross 		(void) printf("    zc_name=%s\n", zc.zc_name);
4701a803cc21SGordon Ross 	if (zc.zc_value[0])
4702a803cc21SGordon Ross 		(void) printf("    zc_value=%s\n", zc.zc_value);
4703a803cc21SGordon Ross 	if (zc.zc_string[0])
47043b2aab18SMatthew Ahrens 		(void) printf("    zc_string=%s\n", zc.zc_string);
4705a803cc21SGordon Ross 	if (zc.zc_guid != 0) {
4706a803cc21SGordon Ross 		(void) printf("    zc_guid=%llu\n",
4707a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_guid);
4708a803cc21SGordon Ross 	}
4709a803cc21SGordon Ross 	if (zc.zc_nvlist_conf_size) {
4710a803cc21SGordon Ross 		(void) printf("    nvlist_conf:\n");
4711a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_conf,
4712a803cc21SGordon Ross 		    zc.zc_nvlist_conf_size);
4713a803cc21SGordon Ross 	}
4714a803cc21SGordon Ross 	if (zc.zc_nvlist_src_size) {
4715a803cc21SGordon Ross 		(void) printf("    nvlist_src:\n");
4716a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_src,
4717a803cc21SGordon Ross 		    zc.zc_nvlist_src_size);
4718a803cc21SGordon Ross 	}
4719a803cc21SGordon Ross 	if (zc.zc_nvlist_dst_size) {
4720a803cc21SGordon Ross 		(void) printf("    nvlist_dst:\n");
4721a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_dst,
4722a803cc21SGordon Ross 		    zc.zc_nvlist_dst_size);
4723a803cc21SGordon Ross 	}
4724a803cc21SGordon Ross 	if (zc.zc_cookie != 0) {
4725a803cc21SGordon Ross 		(void) printf("    zc_cookie=%llu\n",
4726a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_cookie);
4727a803cc21SGordon Ross 	}
4728a803cc21SGordon Ross 	if (zc.zc_objset_type != 0) {
4729a803cc21SGordon Ross 		(void) printf("    zc_objset_type=%llu\n",
4730a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_objset_type);
4731a803cc21SGordon Ross 	}
4732a803cc21SGordon Ross 	if (zc.zc_perm_action != 0) {
4733a803cc21SGordon Ross 		(void) printf("    zc_perm_action=%llu\n",
4734a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_perm_action);
4735a803cc21SGordon Ross 	}
4736a803cc21SGordon Ross 	if (zc.zc_history != 0) {
4737a803cc21SGordon Ross 		(void) printf("    zc_history=%llu\n",
4738a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_history);
4739a803cc21SGordon Ross 	}
4740a803cc21SGordon Ross 	if (zc.zc_obj != 0) {
4741a803cc21SGordon Ross 		(void) printf("    zc_obj=%llu\n",
4742a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_obj);
4743a803cc21SGordon Ross 	}
4744a803cc21SGordon Ross 	if (zc.zc_iflags != 0) {
4745a803cc21SGordon Ross 		(void) printf("    zc_obj=0x%llx\n",
4746a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_iflags);
4747a803cc21SGordon Ross 	}
4748a803cc21SGordon Ross 
4749a803cc21SGordon Ross 	if (memcmp(&zc.zc_share, &zero_share, sizeof (zc.zc_share))) {
4750a803cc21SGordon Ross 		zfs_share_t *z = &zc.zc_share;
4751a803cc21SGordon Ross 		(void) printf("    zc_share:\n");
4752a803cc21SGordon Ross 		if (z->z_exportdata) {
4753a803cc21SGordon Ross 			(void) printf("\tz_exportdata=0x%llx\n",
4754a803cc21SGordon Ross 			    (u_longlong_t)z->z_exportdata);
4755a803cc21SGordon Ross 		}
4756a803cc21SGordon Ross 		if (z->z_sharedata) {
4757a803cc21SGordon Ross 			(void) printf("\tz_sharedata=0x%llx\n",
4758a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharedata);
4759a803cc21SGordon Ross 		}
4760a803cc21SGordon Ross 		if (z->z_sharetype) {
4761a803cc21SGordon Ross 			(void) printf("\tz_sharetype=%llu\n",
4762a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharetype);
4763a803cc21SGordon Ross 		}
4764a803cc21SGordon Ross 		if (z->z_sharemax) {
4765a803cc21SGordon Ross 			(void) printf("\tz_sharemax=%llu\n",
4766a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharemax);
4767a803cc21SGordon Ross 		}
4768a803cc21SGordon Ross 	}
4769a803cc21SGordon Ross 
4770a803cc21SGordon Ross 	if (memcmp(&zc.zc_objset_stats, &zero_objstats,
4771a803cc21SGordon Ross 	    sizeof (zc.zc_objset_stats))) {
4772a803cc21SGordon Ross 		dmu_objset_stats_t *dds = &zc.zc_objset_stats;
4773a803cc21SGordon Ross 		(void) printf("    zc_objset_stats:\n");
4774a803cc21SGordon Ross 		if (dds->dds_num_clones) {
4775a803cc21SGordon Ross 			(void) printf("\tdds_num_clones=%llu\n",
4776a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_num_clones);
4777a803cc21SGordon Ross 		}
4778a803cc21SGordon Ross 		if (dds->dds_creation_txg) {
4779a803cc21SGordon Ross 			(void) printf("\tdds_creation_txg=%llu\n",
4780a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_creation_txg);
4781a803cc21SGordon Ross 		}
4782a803cc21SGordon Ross 		if (dds->dds_guid) {
4783a803cc21SGordon Ross 			(void) printf("\tdds_guid=%llu\n",
4784a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_guid);
4785a803cc21SGordon Ross 		}
4786a803cc21SGordon Ross 		if (dds->dds_type)
4787a803cc21SGordon Ross 			(void) printf("\tdds_type=%u\n", dds->dds_type);
4788a803cc21SGordon Ross 		if (dds->dds_is_snapshot) {
4789a803cc21SGordon Ross 			(void) printf("\tdds_is_snapshot=%u\n",
4790a803cc21SGordon Ross 			    dds->dds_is_snapshot);
4791a803cc21SGordon Ross 		}
4792a803cc21SGordon Ross 		if (dds->dds_inconsistent) {
4793a803cc21SGordon Ross 			(void) printf("\tdds_inconsitent=%u\n",
4794a803cc21SGordon Ross 			    dds->dds_inconsistent);
4795a803cc21SGordon Ross 		}
4796a803cc21SGordon Ross 		if (dds->dds_origin[0]) {
4797a803cc21SGordon Ross 			(void) printf("\tdds_origin=%s\n", dds->dds_origin);
4798a803cc21SGordon Ross 		}
4799a803cc21SGordon Ross 	}
4800a803cc21SGordon Ross 
4801a803cc21SGordon Ross 	if (memcmp(&zc.zc_begin_record, &zero_drrbegin,
4802a803cc21SGordon Ross 	    sizeof (zc.zc_begin_record))) {
48039c3fd121SMatthew Ahrens 		struct drr_begin *drr = &zc.zc_begin_record.drr_u.drr_begin;
4804a803cc21SGordon Ross 		(void) printf("    zc_begin_record:\n");
4805a803cc21SGordon Ross 		if (drr->drr_magic) {
4806a803cc21SGordon Ross 			(void) printf("\tdrr_magic=%llu\n",
4807a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_magic);
4808a803cc21SGordon Ross 		}
4809a803cc21SGordon Ross 		if (drr->drr_versioninfo) {
4810a803cc21SGordon Ross 			(void) printf("\tdrr_versioninfo=%llu\n",
4811a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_versioninfo);
4812a803cc21SGordon Ross 		}
4813a803cc21SGordon Ross 		if (drr->drr_creation_time) {
4814a803cc21SGordon Ross 			(void) printf("\tdrr_creation_time=%llu\n",
4815a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_creation_time);
4816a803cc21SGordon Ross 		}
4817a803cc21SGordon Ross 		if (drr->drr_type)
4818a803cc21SGordon Ross 			(void) printf("\tdrr_type=%u\n", drr->drr_type);
4819a803cc21SGordon Ross 		if (drr->drr_flags)
4820a803cc21SGordon Ross 			(void) printf("\tdrr_flags=0x%x\n", drr->drr_flags);
4821a803cc21SGordon Ross 		if (drr->drr_toguid) {
4822a803cc21SGordon Ross 			(void) printf("\tdrr_toguid=%llu\n",
4823a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_toguid);
4824a803cc21SGordon Ross 		}
4825a803cc21SGordon Ross 		if (drr->drr_fromguid) {
4826a803cc21SGordon Ross 			(void) printf("\tdrr_fromguid=%llu\n",
4827a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_fromguid);
4828a803cc21SGordon Ross 		}
4829a803cc21SGordon Ross 		if (drr->drr_toname[0]) {
4830a803cc21SGordon Ross 			(void) printf("\tdrr_toname=%s\n", drr->drr_toname);
4831a803cc21SGordon Ross 		}
4832a803cc21SGordon Ross 	}
4833a803cc21SGordon Ross 
4834a803cc21SGordon Ross 	if (memcmp(&zc.zc_inject_record, &zero_injectrec,
4835a803cc21SGordon Ross 	    sizeof (zc.zc_inject_record))) {
4836a803cc21SGordon Ross 		zinject_record_t *zi = &zc.zc_inject_record;
4837a803cc21SGordon Ross 		(void) printf("    zc_inject_record:\n");
4838a803cc21SGordon Ross 		if (zi->zi_objset) {
4839a803cc21SGordon Ross 			(void) printf("\tzi_objset=%llu\n",
4840a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_objset);
4841a803cc21SGordon Ross 		}
4842a803cc21SGordon Ross 		if (zi->zi_object) {
4843a803cc21SGordon Ross 			(void) printf("\tzi_object=%llu\n",
4844a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_object);
4845a803cc21SGordon Ross 		}
4846a803cc21SGordon Ross 		if (zi->zi_start) {
4847a803cc21SGordon Ross 			(void) printf("\tzi_start=%llu\n",
4848a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_start);
4849a803cc21SGordon Ross 		}
4850a803cc21SGordon Ross 		if (zi->zi_end) {
4851a803cc21SGordon Ross 			(void) printf("\tzi_end=%llu\n",
4852a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_end);
4853a803cc21SGordon Ross 		}
4854a803cc21SGordon Ross 		if (zi->zi_guid) {
4855a803cc21SGordon Ross 			(void) printf("\tzi_guid=%llu\n",
4856a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_guid);
4857a803cc21SGordon Ross 		}
4858a803cc21SGordon Ross 		if (zi->zi_level) {
4859a803cc21SGordon Ross 			(void) printf("\tzi_level=%lu\n",
4860a803cc21SGordon Ross 			    (ulong_t)zi->zi_level);
4861a803cc21SGordon Ross 		}
4862a803cc21SGordon Ross 		if (zi->zi_error) {
4863a803cc21SGordon Ross 			(void) printf("\tzi_error=%lu\n",
4864a803cc21SGordon Ross 			    (ulong_t)zi->zi_error);
4865a803cc21SGordon Ross 		}
4866a803cc21SGordon Ross 		if (zi->zi_type) {
4867a803cc21SGordon Ross 			(void) printf("\tzi_type=%llu\n",
4868a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_type);
4869a803cc21SGordon Ross 		}
4870a803cc21SGordon Ross 		if (zi->zi_freq) {
4871a803cc21SGordon Ross 			(void) printf("\tzi_freq=%lu\n",
4872a803cc21SGordon Ross 			    (ulong_t)zi->zi_freq);
4873a803cc21SGordon Ross 		}
4874a803cc21SGordon Ross 		if (zi->zi_failfast) {
4875a803cc21SGordon Ross 			(void) printf("\tzi_failfast=%lu\n",
4876a803cc21SGordon Ross 			    (ulong_t)zi->zi_failfast);
4877a803cc21SGordon Ross 		}
4878a803cc21SGordon Ross 		if (zi->zi_func[0])
4879a803cc21SGordon Ross 			(void) printf("\tzi_func=%s\n", zi->zi_func);
4880a803cc21SGordon Ross 		if (zi->zi_iotype) {
4881a803cc21SGordon Ross 			(void) printf("\tzi_iotype=%lu\n",
4882a803cc21SGordon Ross 			    (ulong_t)zi->zi_iotype);
4883a803cc21SGordon Ross 		}
4884a803cc21SGordon Ross 		if (zi->zi_duration) {
4885a803cc21SGordon Ross 			(void) printf("\tzi_duration=%ld\n",
4886a803cc21SGordon Ross 			    (long)zi->zi_duration);
4887a803cc21SGordon Ross 		}
4888a803cc21SGordon Ross 		if (zi->zi_timer) {
4889a803cc21SGordon Ross 			(void) printf("\tzi_timer=%llu\n",
4890a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_timer);
4891a803cc21SGordon Ross 		}
4892a803cc21SGordon Ross 	}
4893a803cc21SGordon Ross 
4894a803cc21SGordon Ross 	if (zc.zc_defer_destroy) {
4895a803cc21SGordon Ross 		(void) printf("    zc_defer_destroy=%d\n",
4896a803cc21SGordon Ross 		    (int)zc.zc_defer_destroy);
4897a803cc21SGordon Ross 	}
48985d7b4d43SMatthew Ahrens 	if (zc.zc_flags) {
48995d7b4d43SMatthew Ahrens 		(void) printf("    zc_flags=0x%x\n",
49005d7b4d43SMatthew Ahrens 		    zc.zc_flags);
4901a803cc21SGordon Ross 	}
4902a803cc21SGordon Ross 	if (zc.zc_action_handle) {
4903a803cc21SGordon Ross 		(void) printf("    zc_action_handle=%llu\n",
4904a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_action_handle);
4905a803cc21SGordon Ross 	}
4906a803cc21SGordon Ross 	if (zc.zc_cleanup_fd >= 0)
4907a803cc21SGordon Ross 		(void) printf("    zc_cleanup_fd=%d\n", zc.zc_cleanup_fd);
4908a803cc21SGordon Ross 	if (zc.zc_sendobj) {
4909a803cc21SGordon Ross 		(void) printf("    zc_sendobj=%llu\n",
4910a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_sendobj);
4911a803cc21SGordon Ross 	}
4912a803cc21SGordon Ross 	if (zc.zc_fromobj) {
4913a803cc21SGordon Ross 		(void) printf("    zc_fromobj=%llu\n",
4914a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_fromobj);
4915a803cc21SGordon Ross 	}
4916a803cc21SGordon Ross 	if (zc.zc_createtxg) {
4917a803cc21SGordon Ross 		(void) printf("    zc_createtxg=%llu\n",
4918a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_createtxg);
4919a803cc21SGordon Ross 	}
4920a803cc21SGordon Ross 
4921a803cc21SGordon Ross 	if (memcmp(&zc.zc_stat, &zero_zstat, sizeof (zc.zc_stat))) {
4922a803cc21SGordon Ross 		zfs_stat_t *zs = &zc.zc_stat;
4923a803cc21SGordon Ross 		(void) printf("    zc_stat:\n");
4924a803cc21SGordon Ross 		if (zs->zs_gen) {
4925a803cc21SGordon Ross 			(void) printf("\tzs_gen=%llu\n",
4926a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_gen);
4927a803cc21SGordon Ross 		}
4928a803cc21SGordon Ross 		if (zs->zs_mode) {
4929a803cc21SGordon Ross 			(void) printf("\tzs_mode=%llu\n",
4930a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_mode);
4931a803cc21SGordon Ross 		}
4932a803cc21SGordon Ross 		if (zs->zs_links) {
4933a803cc21SGordon Ross 			(void) printf("\tzs_links=%llu\n",
4934a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_links);
4935a803cc21SGordon Ross 		}
4936a803cc21SGordon Ross 		if (zs->zs_ctime[0]) {
4937a803cc21SGordon Ross 			(void) printf("\tzs_ctime[0]=%llu\n",
4938a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_ctime[0]);
4939a803cc21SGordon Ross 		}
4940a803cc21SGordon Ross 		if (zs->zs_ctime[1]) {
4941a803cc21SGordon Ross 			(void) printf("\tzs_ctime[1]=%llu\n",
4942a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_ctime[1]);
4943a803cc21SGordon Ross 		}
4944a803cc21SGordon Ross 	}
4945a803cc21SGordon Ross }
4946a803cc21SGordon Ross 
49477c478bd9Sstevel@tonic-gate /* expound verbosely upon syscall arguments */
49487c478bd9Sstevel@tonic-gate /*ARGSUSED*/
49497c478bd9Sstevel@tonic-gate void
expound(private_t * pri,long r0,int raw)49507c478bd9Sstevel@tonic-gate expound(private_t *pri, long r0, int raw)
49517c478bd9Sstevel@tonic-gate {
49527c478bd9Sstevel@tonic-gate 	const lwpstatus_t *Lsp = pri->lwpstat;
49537c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
49547c478bd9Sstevel@tonic-gate 	int what = Lsp->pr_what;
49557c478bd9Sstevel@tonic-gate 	int err = pri->Errno;		/* don't display output parameters */
49567c478bd9Sstevel@tonic-gate 					/* for a failed system call */
49577c478bd9Sstevel@tonic-gate 	/* for reporting sleeping system calls */
49587c478bd9Sstevel@tonic-gate 	if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP)))
49597c478bd9Sstevel@tonic-gate 		what = Lsp->pr_syscall;
49607c478bd9Sstevel@tonic-gate 
49617c478bd9Sstevel@tonic-gate 	switch (what) {
49627c478bd9Sstevel@tonic-gate 	case SYS_gettimeofday:
49637c478bd9Sstevel@tonic-gate 		if (!err)
49647c478bd9Sstevel@tonic-gate 			show_timeofday(pri);
49657c478bd9Sstevel@tonic-gate 		break;
49667c478bd9Sstevel@tonic-gate 	case SYS_getitimer:
49677c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
49687c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
49697c478bd9Sstevel@tonic-gate 			    " value");
49707c478bd9Sstevel@tonic-gate 		break;
49717c478bd9Sstevel@tonic-gate 	case SYS_setitimer:
49727c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
49737c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
49747c478bd9Sstevel@tonic-gate 			    " value");
49757c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
49767c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[2],
49777c478bd9Sstevel@tonic-gate 			    "ovalue");
49787c478bd9Sstevel@tonic-gate 		break;
49797c478bd9Sstevel@tonic-gate 	case SYS_stime:
49807c478bd9Sstevel@tonic-gate 		show_stime(pri);
49817c478bd9Sstevel@tonic-gate 		break;
49827c478bd9Sstevel@tonic-gate 	case SYS_times:
49837c478bd9Sstevel@tonic-gate 		if (!err)
49847c478bd9Sstevel@tonic-gate 			show_times(pri);
49857c478bd9Sstevel@tonic-gate 		break;
49867c478bd9Sstevel@tonic-gate 	case SYS_utssys:
49877c478bd9Sstevel@tonic-gate 		if (err)
49887c478bd9Sstevel@tonic-gate 			break;
49897c478bd9Sstevel@tonic-gate 		if (lp64)
49907c478bd9Sstevel@tonic-gate 			show_utssys(pri, r0);
49917c478bd9Sstevel@tonic-gate 		else
49927c478bd9Sstevel@tonic-gate 			show_utssys32(pri, r0);
49937c478bd9Sstevel@tonic-gate 		break;
49947c478bd9Sstevel@tonic-gate 	case SYS_ioctl:
49957c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs >= 3) /* each case must decide for itself */
49967c478bd9Sstevel@tonic-gate 			show_ioctl(pri, pri->sys_args[1],
49977c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2]);
49987c478bd9Sstevel@tonic-gate 		break;
49998fd04b83SRoger A. Faulkner 	case SYS_fstatat:
50008fd04b83SRoger A. Faulkner 		if (!err && pri->sys_nargs >= 3)
50018fd04b83SRoger A. Faulkner 			show_stat(pri, (long)pri->sys_args[2]);
50028fd04b83SRoger A. Faulkner 		break;
50038fd04b83SRoger A. Faulkner 	case SYS_fstatat64:
50048fd04b83SRoger A. Faulkner 		if (!err && pri->sys_nargs >= 3)
50058fd04b83SRoger A. Faulkner 			show_stat64_32(pri, (long)pri->sys_args[2]);
50068fd04b83SRoger A. Faulkner 		break;
50077c478bd9Sstevel@tonic-gate 	case SYS_stat:
50087c478bd9Sstevel@tonic-gate 	case SYS_fstat:
50097c478bd9Sstevel@tonic-gate 	case SYS_lstat:
50107c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
50117c478bd9Sstevel@tonic-gate 			show_stat(pri, (long)pri->sys_args[1]);
50127c478bd9Sstevel@tonic-gate 		break;
50137c478bd9Sstevel@tonic-gate 	case SYS_stat64:
50147c478bd9Sstevel@tonic-gate 	case SYS_fstat64:
50157c478bd9Sstevel@tonic-gate 	case SYS_lstat64:
50167c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
50177c478bd9Sstevel@tonic-gate 			show_stat64_32(pri, (long)pri->sys_args[1]);
50187c478bd9Sstevel@tonic-gate 		break;
50197c478bd9Sstevel@tonic-gate 	case SYS_statvfs:
50207c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs:
50217c478bd9Sstevel@tonic-gate 		if (err)
50227c478bd9Sstevel@tonic-gate 			break;
50237c478bd9Sstevel@tonic-gate 		if (!lp64) {
50247c478bd9Sstevel@tonic-gate 			show_statvfs32(pri);
50257c478bd9Sstevel@tonic-gate 			break;
50267c478bd9Sstevel@tonic-gate 		}
50277c478bd9Sstevel@tonic-gate 		show_statvfs(pri);
50287c478bd9Sstevel@tonic-gate 		break;
50297c478bd9Sstevel@tonic-gate 	case SYS_statvfs64:
50307c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs64:
50317c478bd9Sstevel@tonic-gate 		if (err)
50327c478bd9Sstevel@tonic-gate 			break;
50337c478bd9Sstevel@tonic-gate 		show_statvfs64(pri);
50347c478bd9Sstevel@tonic-gate 		break;
50357c478bd9Sstevel@tonic-gate 	case SYS_statfs:
50367c478bd9Sstevel@tonic-gate 	case SYS_fstatfs:
50377c478bd9Sstevel@tonic-gate 		if (err)
50387c478bd9Sstevel@tonic-gate 			break;
50397c478bd9Sstevel@tonic-gate 		if (lp64)
50407c478bd9Sstevel@tonic-gate 			show_statfs(pri);
50417c478bd9Sstevel@tonic-gate 		else
50427c478bd9Sstevel@tonic-gate 			show_statfs32(pri);
50437c478bd9Sstevel@tonic-gate 		break;
50447c478bd9Sstevel@tonic-gate 	case SYS_fcntl:
50457c478bd9Sstevel@tonic-gate 		show_fcntl(pri);
50467c478bd9Sstevel@tonic-gate 		break;
50477c478bd9Sstevel@tonic-gate 	case SYS_msgsys:
50487c478bd9Sstevel@tonic-gate 		show_msgsys(pri, r0); /* each case must decide for itself */
50497c478bd9Sstevel@tonic-gate 		break;
50507c478bd9Sstevel@tonic-gate 	case SYS_semsys:
50517c478bd9Sstevel@tonic-gate 		show_semsys(pri);	/* each case must decide for itself */
50527c478bd9Sstevel@tonic-gate 		break;
50537c478bd9Sstevel@tonic-gate 	case SYS_shmsys:
50547c478bd9Sstevel@tonic-gate 		show_shmsys(pri);	/* each case must decide for itself */
50557c478bd9Sstevel@tonic-gate 		break;
50567c478bd9Sstevel@tonic-gate 	case SYS_getdents:
50577c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
50587c478bd9Sstevel@tonic-gate 			break;
50597c478bd9Sstevel@tonic-gate 		if (!lp64) {
50607c478bd9Sstevel@tonic-gate 			show_dents32(pri, (long)pri->sys_args[1], r0);
50617c478bd9Sstevel@tonic-gate 			break;
50627c478bd9Sstevel@tonic-gate 		}
50630b09d754SToomas Soome 		/* FALLTHROUGH */
50647c478bd9Sstevel@tonic-gate 	case SYS_getdents64:
50657c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
50667c478bd9Sstevel@tonic-gate 			break;
50677c478bd9Sstevel@tonic-gate 		show_dents64(pri, (long)pri->sys_args[1], r0);
50687c478bd9Sstevel@tonic-gate 		break;
50697c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
50707c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
50717c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
50727c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "flags");
50737c478bd9Sstevel@tonic-gate 		break;
50747c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
50757c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
50767c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
50777c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "band");
50787c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
50797c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[4], "flags");
50807c478bd9Sstevel@tonic-gate 		break;
50817c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
50827c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
50837c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
50847c478bd9Sstevel@tonic-gate 		break;
50857c478bd9Sstevel@tonic-gate 	case SYS_pollsys:
50867c478bd9Sstevel@tonic-gate 		show_pollsys(pri);
50877c478bd9Sstevel@tonic-gate 		break;
50887c478bd9Sstevel@tonic-gate 	case SYS_setgroups:
50897c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0)
50907c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
50917c478bd9Sstevel@tonic-gate 		break;
50927c478bd9Sstevel@tonic-gate 	case SYS_getgroups:
50937c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0)
50947c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
50957c478bd9Sstevel@tonic-gate 		break;
50967c478bd9Sstevel@tonic-gate 	case SYS_sigprocmask:
50977c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
50987c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], " set");
50997c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
51007c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[2], "oset");
51017c478bd9Sstevel@tonic-gate 		break;
51027c478bd9Sstevel@tonic-gate 	case SYS_sigsuspend:
51037c478bd9Sstevel@tonic-gate 	case SYS_sigtimedwait:
51047c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
51057c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[0], "sigmask");
51067c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
51077c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[1]);
51087c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
51097c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
51107c478bd9Sstevel@tonic-gate 		break;
51117c478bd9Sstevel@tonic-gate 	case SYS_sigaltstack:
51127c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
51137c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[0],
51147c478bd9Sstevel@tonic-gate 			    "new");
51157c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
51167c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[1],
51177c478bd9Sstevel@tonic-gate 			    "old");
51187c478bd9Sstevel@tonic-gate 		break;
51197c478bd9Sstevel@tonic-gate 	case SYS_sigaction:
51207c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
51217c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[1],
512227aa4812SToomas Soome 			    "new", 0);
51237c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
51247c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[2],
51257c478bd9Sstevel@tonic-gate 			    "old", r0);
51267c478bd9Sstevel@tonic-gate 		break;
5127f48068adSraf 	case SYS_signotify:
5128f48068adSraf 		if (pri->sys_nargs > 1)
5129f48068adSraf 			show_siginfo(pri, (long)pri->sys_args[1]);
5130f48068adSraf 		break;
5131f48068adSraf 	case SYS_sigresend:
5132f48068adSraf 		if (pri->sys_nargs > 1)
5133f48068adSraf 			show_siginfo(pri, (long)pri->sys_args[1]);
5134f48068adSraf 		if (pri->sys_nargs > 2)
5135f48068adSraf 			show_sigset(pri, (long)pri->sys_args[2], "sigmask");
5136f48068adSraf 		break;
51377c478bd9Sstevel@tonic-gate 	case SYS_sigpending:
51387c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
51397c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], "sigmask");
51407c478bd9Sstevel@tonic-gate 		break;
5141a574db85Sraf 	case SYS_waitid:
51427c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
51437c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[2]);
51447c478bd9Sstevel@tonic-gate 		break;
51457c478bd9Sstevel@tonic-gate 	case SYS_sigsendsys:
51467c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
51477c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[0]);
51487c478bd9Sstevel@tonic-gate 		break;
51497c478bd9Sstevel@tonic-gate 	case SYS_priocntlsys:
51507c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
51517c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[1]);
51527c478bd9Sstevel@tonic-gate 		break;
51537c478bd9Sstevel@tonic-gate 	case SYS_mincore:
51547c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
51557c478bd9Sstevel@tonic-gate 			show_bool(pri, (long)pri->sys_args[2],
51567c478bd9Sstevel@tonic-gate 			    (pri->sys_args[1] + pagesize - 1) / pagesize);
51577c478bd9Sstevel@tonic-gate 		break;
51587c478bd9Sstevel@tonic-gate 	case SYS_readv:
51597c478bd9Sstevel@tonic-gate 	case SYS_writev:
51607c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2) {
51617c478bd9Sstevel@tonic-gate 			int i = pri->sys_args[0]+1;
51627c478bd9Sstevel@tonic-gate 			int showbuf = FALSE;
51637c478bd9Sstevel@tonic-gate 			long nb = (what == SYS_readv)? r0 : 32*1024;
51647c478bd9Sstevel@tonic-gate 
51657c478bd9Sstevel@tonic-gate 			if ((what == SYS_readv && !err &&
51667c478bd9Sstevel@tonic-gate 			    prismember(&readfd, i)) ||
51677c478bd9Sstevel@tonic-gate 			    (what == SYS_writev &&
51687c478bd9Sstevel@tonic-gate 			    prismember(&writefd, i)))
51697c478bd9Sstevel@tonic-gate 				showbuf = TRUE;
51707c478bd9Sstevel@tonic-gate 			show_iovec(pri, (long)pri->sys_args[1],
51717c478bd9Sstevel@tonic-gate 			    pri->sys_args[2], showbuf, nb);
51727c478bd9Sstevel@tonic-gate 		}
51737c478bd9Sstevel@tonic-gate 		break;
51747c478bd9Sstevel@tonic-gate 	case SYS_getrlimit:
51757c478bd9Sstevel@tonic-gate 		if (err)
51767c478bd9Sstevel@tonic-gate 			break;
51777c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
51787c478bd9Sstevel@tonic-gate 	case SYS_setrlimit:
51797c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
51807c478bd9Sstevel@tonic-gate 			break;
51817c478bd9Sstevel@tonic-gate 		if (lp64)
51827c478bd9Sstevel@tonic-gate 			show_rlimit64(pri, (long)pri->sys_args[1]);
51837c478bd9Sstevel@tonic-gate 		else
51847c478bd9Sstevel@tonic-gate 			show_rlimit32(pri, (long)pri->sys_args[1]);
51857c478bd9Sstevel@tonic-gate 		break;
51867c478bd9Sstevel@tonic-gate 	case SYS_getrlimit64:
51877c478bd9Sstevel@tonic-gate 		if (err)
51887c478bd9Sstevel@tonic-gate 			break;
51897c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
51907c478bd9Sstevel@tonic-gate 	case SYS_setrlimit64:
51917c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
51927c478bd9Sstevel@tonic-gate 			break;
51937c478bd9Sstevel@tonic-gate 		show_rlimit64(pri, (long)pri->sys_args[1]);
51947c478bd9Sstevel@tonic-gate 		break;
51957c478bd9Sstevel@tonic-gate 	case SYS_uname:
51967c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
51977c478bd9Sstevel@tonic-gate 			show_nuname(pri, (long)pri->sys_args[0]);
51987c478bd9Sstevel@tonic-gate 		break;
51997c478bd9Sstevel@tonic-gate 	case SYS_adjtime:
52007c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
52017c478bd9Sstevel@tonic-gate 			show_adjtime(pri, (long)pri->sys_args[0],
52027c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[1]);
52037c478bd9Sstevel@tonic-gate 		break;
52047c478bd9Sstevel@tonic-gate 	case SYS_lwp_info:
52057c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
52067c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "cpu time");
52077c478bd9Sstevel@tonic-gate 		break;
52087c478bd9Sstevel@tonic-gate 	case SYS_lwp_wait:
52097c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
52107c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[1], "lwpid");
52117c478bd9Sstevel@tonic-gate 		break;
52127c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_wakeup:
52137c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_unlock:
52147c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_trylock:
5215883492d5Sraf 	case SYS_lwp_mutex_register:
52167c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52177c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
52187c478bd9Sstevel@tonic-gate 		break;
52197c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_timedlock:
52207c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52217c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
52227c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
52237c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
52247c478bd9Sstevel@tonic-gate 		break;
52257c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_wait:
52267c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52277c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
52287c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
52297c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[1]);
52307c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
52317c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
52327c478bd9Sstevel@tonic-gate 		break;
52337c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_signal:
52347c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_broadcast:
52357c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52367c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
52377c478bd9Sstevel@tonic-gate 		break;
52387c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_trywait:
52397c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_post:
52407c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52417c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
52427c478bd9Sstevel@tonic-gate 		break;
52437c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_timedwait:
52447c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52457c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
52467c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
52477c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
52487c478bd9Sstevel@tonic-gate 		break;
52497c478bd9Sstevel@tonic-gate 	case SYS_lwp_rwlock_sys:
52507c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
52517c478bd9Sstevel@tonic-gate 			show_rwlock(pri, (long)pri->sys_args[1]);
52527c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 &&
52537c478bd9Sstevel@tonic-gate 		    (pri->sys_args[0] == 0 || pri->sys_args[0] == 1))
52547c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
52557c478bd9Sstevel@tonic-gate 		break;
52567c478bd9Sstevel@tonic-gate 	case SYS_lwp_create:
52577c478bd9Sstevel@tonic-gate 		/* XXX print some values in ucontext ??? */
52587c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
52597c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[2], "lwpid");
52607c478bd9Sstevel@tonic-gate 		break;
52617c478bd9Sstevel@tonic-gate 	case SYS_kaio:
52627c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1)
52637c478bd9Sstevel@tonic-gate 			show_timeval(pri, (long)pri->sys_args[1], "timeout");
52647c478bd9Sstevel@tonic-gate 		break;
52657c478bd9Sstevel@tonic-gate 	case SYS_nanosleep:
52667c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
52677c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "tmout");
52687c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (err == 0 || err == EINTR))
52697c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "resid");
52707c478bd9Sstevel@tonic-gate 		break;
52717c478bd9Sstevel@tonic-gate 	case SYS_privsys:
52727c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
52737c478bd9Sstevel@tonic-gate 		case PRIVSYS_SETPPRIV:
52747c478bd9Sstevel@tonic-gate 		case PRIVSYS_GETPPRIV:
52757c478bd9Sstevel@tonic-gate 			if (!err)
52767c478bd9Sstevel@tonic-gate 				show_privset(pri, (long)pri->sys_args[3],
5277821c4a97Sdp 				    (size_t)pri->sys_args[4], "");
52787c478bd9Sstevel@tonic-gate 		}
52797c478bd9Sstevel@tonic-gate 		break;
52807c478bd9Sstevel@tonic-gate 	case SYS_ucredsys:
52817c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
52827c478bd9Sstevel@tonic-gate 		case UCREDSYS_UCREDGET:
52837c478bd9Sstevel@tonic-gate 		case UCREDSYS_GETPEERUCRED:
52847c478bd9Sstevel@tonic-gate 			if (err == 0)
52857c478bd9Sstevel@tonic-gate 				show_ucred(pri, (long)pri->sys_args[2]);
52867c478bd9Sstevel@tonic-gate 			break;
52877c478bd9Sstevel@tonic-gate 		}
52887c478bd9Sstevel@tonic-gate 		break;
52897c478bd9Sstevel@tonic-gate 	case SYS_bind:
52907c478bd9Sstevel@tonic-gate 	case SYS_connect:
52917c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
52927c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
52937c478bd9Sstevel@tonic-gate 			    0, (long)pri->sys_args[2]);
52947c478bd9Sstevel@tonic-gate 		break;
52957c478bd9Sstevel@tonic-gate 	case SYS_sendto:
52967c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 5)
52977c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "to", (long)pri->sys_args[4], 0,
52987c478bd9Sstevel@tonic-gate 			    pri->sys_args[5]);
52997c478bd9Sstevel@tonic-gate 		break;
53007c478bd9Sstevel@tonic-gate 	case SYS_accept:
53017c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53027c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
53037c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2], 0);
53047c478bd9Sstevel@tonic-gate 		break;
53057c478bd9Sstevel@tonic-gate 	case SYS_getsockname:
53067c478bd9Sstevel@tonic-gate 	case SYS_getpeername:
53077c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53087c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
53097c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2], 0);
53107c478bd9Sstevel@tonic-gate 		break;
53117c478bd9Sstevel@tonic-gate 	case SYS_cladm:
53127c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53137c478bd9Sstevel@tonic-gate 			show_cladm(pri, pri->sys_args[0], pri->sys_args[1],
53147c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2]);
53157c478bd9Sstevel@tonic-gate 		break;
53167c478bd9Sstevel@tonic-gate 	case SYS_recvfrom:
53177c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 5)
53187c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "from", (long)pri->sys_args[4],
53197c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[5], 0);
53207c478bd9Sstevel@tonic-gate 		break;
53217c478bd9Sstevel@tonic-gate 	case SYS_recvmsg:
53227c478bd9Sstevel@tonic-gate 		if (err)
53237c478bd9Sstevel@tonic-gate 			break;
53247c478bd9Sstevel@tonic-gate 		/* FALLTHROUGH */
53257c478bd9Sstevel@tonic-gate 	case SYS_sendmsg:
532681006e0fSja97890 		if (pri->sys_nargs <= 2)
53277c478bd9Sstevel@tonic-gate 			break;
53287c478bd9Sstevel@tonic-gate 		if (lp64)
53297c478bd9Sstevel@tonic-gate 			show_msghdr(pri, pri->sys_args[1]);
53307c478bd9Sstevel@tonic-gate 		else
53317c478bd9Sstevel@tonic-gate 			show_msghdr32(pri, pri->sys_args[1]);
53327c478bd9Sstevel@tonic-gate 		break;
53337c478bd9Sstevel@tonic-gate 	case SYS_door:
53347c478bd9Sstevel@tonic-gate 		show_doors(pri);
53357c478bd9Sstevel@tonic-gate 		break;
53367c478bd9Sstevel@tonic-gate 	case SYS_sendfilev:
53377c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs != 5)
53387c478bd9Sstevel@tonic-gate 			break;
53397c478bd9Sstevel@tonic-gate 
53407c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == SENDFILEV) {
53417c478bd9Sstevel@tonic-gate 			show_sendfilevec(pri, (int)pri->sys_args[1],
53427c478bd9Sstevel@tonic-gate 			    (sendfilevec_t *)pri->sys_args[2],
53437c478bd9Sstevel@tonic-gate 			    (int)pri->sys_args[3]);
53447c478bd9Sstevel@tonic-gate 		} else if (pri->sys_args[0] == SENDFILEV64) {
53457c478bd9Sstevel@tonic-gate 			show_sendfilevec64(pri, (int)pri->sys_args[1],
53467c478bd9Sstevel@tonic-gate 			    (sendfilevec64_t *)pri->sys_args[2],
53477c478bd9Sstevel@tonic-gate 			    (int)pri->sys_args[3]);
53487c478bd9Sstevel@tonic-gate 		}
53497c478bd9Sstevel@tonic-gate 		break;
53507c478bd9Sstevel@tonic-gate 	case SYS_memcntl:
53517c478bd9Sstevel@tonic-gate 		show_memcntl(pri);
53527c478bd9Sstevel@tonic-gate 		break;
53537c478bd9Sstevel@tonic-gate 	case SYS_lwp_park:
535447eb4d1eSsl108498 		/*
535547eb4d1eSsl108498 		 * subcode 0: lwp_park(timespec_t *, id_t)
535647eb4d1eSsl108498 		 * subcode 4: lwp_set_park(timespec_t *, id_t)
535747eb4d1eSsl108498 		 */
535847eb4d1eSsl108498 		if (pri->sys_nargs > 1 &&
535947eb4d1eSsl108498 		    (pri->sys_args[0] == 0 || pri->sys_args[0] == 4))
53607c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
53617c478bd9Sstevel@tonic-gate 		/* subcode 2: lwp_unpark_all(id_t *, int) */
53627c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 && pri->sys_args[0] == 2)
53637c478bd9Sstevel@tonic-gate 			show_ids(pri, (long)pri->sys_args[1],
53647c478bd9Sstevel@tonic-gate 			    (int)pri->sys_args[2]);
53657c478bd9Sstevel@tonic-gate 		break;
53667c478bd9Sstevel@tonic-gate 	case SYS_ntp_gettime:
53677c478bd9Sstevel@tonic-gate 		if (!err)
53687c478bd9Sstevel@tonic-gate 			show_ntp_gettime(pri);
53697c478bd9Sstevel@tonic-gate 		break;
53707c478bd9Sstevel@tonic-gate 	case SYS_ntp_adjtime:
53717c478bd9Sstevel@tonic-gate 		if (!err)
53727c478bd9Sstevel@tonic-gate 			show_ntp_adjtime(pri);
53737c478bd9Sstevel@tonic-gate 		break;
53747c478bd9Sstevel@tonic-gate 	case SYS_rusagesys:
53757c478bd9Sstevel@tonic-gate 		if (!err)
53767c478bd9Sstevel@tonic-gate 			if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) {
53777c478bd9Sstevel@tonic-gate 				if (!lp64)
53787c478bd9Sstevel@tonic-gate 					show_getrusage32(pri->sys_args[1]);
53797c478bd9Sstevel@tonic-gate 				else
53807c478bd9Sstevel@tonic-gate 					show_getrusage(pri->sys_args[1]);
53817c478bd9Sstevel@tonic-gate 			}
53827c478bd9Sstevel@tonic-gate 		break;
53837c478bd9Sstevel@tonic-gate 	case SYS_port:
53847c478bd9Sstevel@tonic-gate 		show_ports(pri);
53857c478bd9Sstevel@tonic-gate 		break;
5386821c4a97Sdp 	case SYS_zone:
5387821c4a97Sdp 		show_zones(pri);
5388821c4a97Sdp 		break;
5389aa4a4f3bSnf202958 	case SYS_rctlsys:
5390aa4a4f3bSnf202958 		show_rctls(pri);
5391aa4a4f3bSnf202958 		break;
53923b862e9aSRoger A. Faulkner 	case SYS_utimesys:
53933b862e9aSRoger A. Faulkner 		show_utimesys(pri);
53943b862e9aSRoger A. Faulkner 		break;
53953e95bd4aSAnders Persson 	case SYS_sockconfig:
53963e95bd4aSAnders Persson 		show_sockconfig(pri);
53973e95bd4aSAnders Persson 		break;
53987c478bd9Sstevel@tonic-gate 	}
53997c478bd9Sstevel@tonic-gate }
5400