xref: /illumos-gate/usr/src/cmd/truss/expound.c (revision 27aa48129e712ec06bc239dce1a21a4ae5b19994)
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	*/
30*27aa4812SToomas Soome /*	  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>
92aa4a4f3bSnf #include <sys/nvpair.h>
93aa4a4f3bSnf #include <libnvpair.h>
94532877c4Srd #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
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
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);
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate void
1283b862e9aSRoger A. Faulkner prtimeval(private_t *pri, const char *name, struct timeval *value)
1297c478bd9Sstevel@tonic-gate {
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
1423b862e9aSRoger A. Faulkner prtimestruc(private_t *pri, const char *name, timestruc_t *value)
1433b862e9aSRoger A. Faulkner {
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);
1533b862e9aSRoger A. Faulkner }
1543b862e9aSRoger A. Faulkner 
1553b862e9aSRoger A. Faulkner static void
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
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 
205*27aa4812SToomas 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
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
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
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
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
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 
333*27aa4812SToomas 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
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 
383*27aa4812SToomas Soome 	if (offset != 0 &&
3847c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
3857c478bd9Sstevel@tonic-gate 		(void) printf(
386019c3c43Sraf 		    "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
387019c3c43Sraf 		    pri->pname,
388019c3c43Sraf 		    ubuf.sysname,
389019c3c43Sraf 		    ubuf.nodename,
390019c3c43Sraf 		    ubuf.release,
391019c3c43Sraf 		    ubuf.version,
392019c3c43Sraf 		    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
3987c478bd9Sstevel@tonic-gate show_ustat(private_t *pri, long offset)
3997c478bd9Sstevel@tonic-gate {
4007c478bd9Sstevel@tonic-gate 	struct ustat ubuf;
4017c478bd9Sstevel@tonic-gate 
402*27aa4812SToomas Soome 	if (offset != 0 &&
4037c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4047c478bd9Sstevel@tonic-gate 		(void) printf(
405019c3c43Sraf 		    "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
406019c3c43Sraf 		    pri->pname,
407019c3c43Sraf 		    ubuf.f_tfree,
408019c3c43Sraf 		    ubuf.f_tinode,
409019c3c43Sraf 		    ubuf.f_fname,
410019c3c43Sraf 		    ubuf.f_fpack);
4117c478bd9Sstevel@tonic-gate 	}
4127c478bd9Sstevel@tonic-gate }
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate #ifdef _LP64
4157c478bd9Sstevel@tonic-gate void
4167c478bd9Sstevel@tonic-gate show_ustat32(private_t *pri, long offset)
4177c478bd9Sstevel@tonic-gate {
4187c478bd9Sstevel@tonic-gate 	struct ustat32 ubuf;
4197c478bd9Sstevel@tonic-gate 
420*27aa4812SToomas Soome 	if (offset != 0 &&
4217c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4227c478bd9Sstevel@tonic-gate 		(void) printf(
423019c3c43Sraf 		    "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
424019c3c43Sraf 		    pri->pname,
425019c3c43Sraf 		    ubuf.f_tfree,
426019c3c43Sraf 		    ubuf.f_tinode,
427019c3c43Sraf 		    ubuf.f_fname,
428019c3c43Sraf 		    ubuf.f_fpack);
4297c478bd9Sstevel@tonic-gate 	}
4307c478bd9Sstevel@tonic-gate }
4317c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate void
4347c478bd9Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc)
4357c478bd9Sstevel@tonic-gate {
4367c478bd9Sstevel@tonic-gate 	f_user_t fubuf;
4377c478bd9Sstevel@tonic-gate 	int serial = (nproc > 4);
4387c478bd9Sstevel@tonic-gate 
4393b862e9aSRoger A. Faulkner 	if (offset == 0)
4407c478bd9Sstevel@tonic-gate 		return;
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
4437c478bd9Sstevel@tonic-gate 	if (serial)
4447c478bd9Sstevel@tonic-gate 		Eserialize();
4457c478bd9Sstevel@tonic-gate 
4467c478bd9Sstevel@tonic-gate 	while (nproc > 0 &&
4477c478bd9Sstevel@tonic-gate 	    Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) {
448f48205beScasper 		(void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
4497c478bd9Sstevel@tonic-gate 		    pri->pname,
4507c478bd9Sstevel@tonic-gate 		    (int)fubuf.fu_pid,
451f48205beScasper 		    fubuf.fu_uid,
4527c478bd9Sstevel@tonic-gate 		    fuflags(pri, fubuf.fu_flags));
4537c478bd9Sstevel@tonic-gate 		nproc--;
4547c478bd9Sstevel@tonic-gate 		offset += sizeof (fubuf);
4557c478bd9Sstevel@tonic-gate 	}
4567c478bd9Sstevel@tonic-gate 
4577c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
4587c478bd9Sstevel@tonic-gate 	if (serial)
4597c478bd9Sstevel@tonic-gate 		Xserialize();
4607c478bd9Sstevel@tonic-gate }
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate void
4637c478bd9Sstevel@tonic-gate show_utssys(private_t *pri, long r0)
4647c478bd9Sstevel@tonic-gate {
4657c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
4667c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
4677c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
4687c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
4697c478bd9Sstevel@tonic-gate 			break;
4707c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
4717c478bd9Sstevel@tonic-gate 			show_ustat(pri, (long)pri->sys_args[0]);
4727c478bd9Sstevel@tonic-gate 			break;
4737c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
4747c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
4757c478bd9Sstevel@tonic-gate 			break;
4767c478bd9Sstevel@tonic-gate 		}
4777c478bd9Sstevel@tonic-gate 	}
4787c478bd9Sstevel@tonic-gate }
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate #ifdef _LP64
4817c478bd9Sstevel@tonic-gate void
4827c478bd9Sstevel@tonic-gate show_utssys32(private_t *pri, long r0)
4837c478bd9Sstevel@tonic-gate {
4847c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 3) {
4857c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[2]) {
4867c478bd9Sstevel@tonic-gate 		case UTS_UNAME:
4877c478bd9Sstevel@tonic-gate 			show_uname(pri, (long)pri->sys_args[0]);
4887c478bd9Sstevel@tonic-gate 			break;
4897c478bd9Sstevel@tonic-gate 		case UTS_USTAT:
4907c478bd9Sstevel@tonic-gate 			show_ustat32(pri, (long)pri->sys_args[0]);
4917c478bd9Sstevel@tonic-gate 			break;
4927c478bd9Sstevel@tonic-gate 		case UTS_FUSERS:
4937c478bd9Sstevel@tonic-gate 			show_fusers(pri, (long)pri->sys_args[3], r0);
4947c478bd9Sstevel@tonic-gate 			break;
4957c478bd9Sstevel@tonic-gate 		}
4967c478bd9Sstevel@tonic-gate 	}
4977c478bd9Sstevel@tonic-gate }
4987c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
4997c478bd9Sstevel@tonic-gate 
5007c478bd9Sstevel@tonic-gate void
5017c478bd9Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset)
5027c478bd9Sstevel@tonic-gate {
5037c478bd9Sstevel@tonic-gate 	int	arg;
5047c478bd9Sstevel@tonic-gate 
5057c478bd9Sstevel@tonic-gate 	switch (code) {
5067c478bd9Sstevel@tonic-gate 	case CL_INITIALIZE:
5077c478bd9Sstevel@tonic-gate 		switch (function) {
5087c478bd9Sstevel@tonic-gate 		case CL_GET_BOOTFLAG:
5097c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
5107c478bd9Sstevel@tonic-gate 			    == sizeof (arg)) {
5117c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_CONFIGURED)
5127c478bd9Sstevel@tonic-gate 					(void) printf("%s\tbootflags="
5137c478bd9Sstevel@tonic-gate 					    "CLUSTER_CONFIGURED", pri->pname);
5147c478bd9Sstevel@tonic-gate 				if (arg & CLUSTER_BOOTED)
5157c478bd9Sstevel@tonic-gate 					(void) printf("|CLUSTER_BOOTED\n");
5167c478bd9Sstevel@tonic-gate 			}
5177c478bd9Sstevel@tonic-gate 			break;
5187c478bd9Sstevel@tonic-gate 		}
5197c478bd9Sstevel@tonic-gate 		break;
5207c478bd9Sstevel@tonic-gate 	case CL_CONFIG:
5217c478bd9Sstevel@tonic-gate 		switch (function) {
5227c478bd9Sstevel@tonic-gate 		case CL_NODEID:
5237c478bd9Sstevel@tonic-gate 		case CL_HIGHEST_NODEID:
5247c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &arg, sizeof (arg), offset)
5257c478bd9Sstevel@tonic-gate 			    == sizeof (arg))
5267c478bd9Sstevel@tonic-gate 				(void) printf("%s\tnodeid=%d\n",
527019c3c43Sraf 				    pri->pname, arg);
5287c478bd9Sstevel@tonic-gate 		}
5297c478bd9Sstevel@tonic-gate 		break;
5307c478bd9Sstevel@tonic-gate 	}
5317c478bd9Sstevel@tonic-gate }
5327c478bd9Sstevel@tonic-gate 
533883492d5Sraf #define	ALL_LOCK_TYPES						\
534*27aa4812SToomas Soome 	(USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE |	\
535*27aa4812SToomas Soome 	LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST |	\
536883492d5Sraf 	USYNC_PROCESS_ROBUST)
5377c478bd9Sstevel@tonic-gate 
5387c478bd9Sstevel@tonic-gate /* return cv and mutex types */
5397c478bd9Sstevel@tonic-gate const char *
5407c478bd9Sstevel@tonic-gate synch_type(private_t *pri, uint_t type)
5417c478bd9Sstevel@tonic-gate {
5427c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
5437c478bd9Sstevel@tonic-gate 
5447c478bd9Sstevel@tonic-gate 	if (type & USYNC_PROCESS)
5457c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_PROCESS");
5467c478bd9Sstevel@tonic-gate 	else
5477c478bd9Sstevel@tonic-gate 		(void) strcpy(str, "USYNC_THREAD");
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate 	if (type & LOCK_ERRORCHECK)
5507c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_ERRORCHECK");
5517c478bd9Sstevel@tonic-gate 	if (type & LOCK_RECURSIVE)
5527c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_RECURSIVE");
5537c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_INHERIT)
5547c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_INHERIT");
5557c478bd9Sstevel@tonic-gate 	if (type & LOCK_PRIO_PROTECT)
5567c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|LOCK_PRIO_PROTECT");
557883492d5Sraf 	if (type & LOCK_ROBUST)
558883492d5Sraf 		(void) strcat(str, "|LOCK_ROBUST");
559883492d5Sraf 	if (type & USYNC_PROCESS_ROBUST)
560883492d5Sraf 		(void) strcat(str, "|USYNC_PROCESS_ROBUST");
5617c478bd9Sstevel@tonic-gate 
5627c478bd9Sstevel@tonic-gate 	if ((type &= ~ALL_LOCK_TYPES) != 0)
5637c478bd9Sstevel@tonic-gate 		(void) sprintf(str + strlen(str), "|0x%.4X", type);
5647c478bd9Sstevel@tonic-gate 
5657c478bd9Sstevel@tonic-gate 	return ((const char *)str);
5667c478bd9Sstevel@tonic-gate }
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate void
5697c478bd9Sstevel@tonic-gate show_mutex(private_t *pri, long offset)
5707c478bd9Sstevel@tonic-gate {
5717c478bd9Sstevel@tonic-gate 	lwp_mutex_t mutex;
5727c478bd9Sstevel@tonic-gate 
5737c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) {
5747c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmutex type: %s\n",
575019c3c43Sraf 		    pri->pname,
576019c3c43Sraf 		    synch_type(pri, mutex.mutex_type));
5777c478bd9Sstevel@tonic-gate 	}
5787c478bd9Sstevel@tonic-gate }
5797c478bd9Sstevel@tonic-gate 
5807c478bd9Sstevel@tonic-gate void
5817c478bd9Sstevel@tonic-gate show_condvar(private_t *pri, long offset)
5827c478bd9Sstevel@tonic-gate {
5837c478bd9Sstevel@tonic-gate 	lwp_cond_t condvar;
5847c478bd9Sstevel@tonic-gate 
5857c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &condvar, sizeof (condvar), offset)
5867c478bd9Sstevel@tonic-gate 	    == sizeof (condvar)) {
5877c478bd9Sstevel@tonic-gate 		(void) printf("%s\tcondvar type: %s\n",
588019c3c43Sraf 		    pri->pname,
589019c3c43Sraf 		    synch_type(pri, condvar.cond_type));
5907c478bd9Sstevel@tonic-gate 	}
5917c478bd9Sstevel@tonic-gate }
5927c478bd9Sstevel@tonic-gate 
5937c478bd9Sstevel@tonic-gate void
5947c478bd9Sstevel@tonic-gate show_sema(private_t *pri, long offset)
5957c478bd9Sstevel@tonic-gate {
5967c478bd9Sstevel@tonic-gate 	lwp_sema_t sema;
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) {
5997c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsema type: %s  count = %u\n",
600019c3c43Sraf 		    pri->pname,
601019c3c43Sraf 		    synch_type(pri, sema.sema_type),
602019c3c43Sraf 		    sema.sema_count);
6037c478bd9Sstevel@tonic-gate 	}
6047c478bd9Sstevel@tonic-gate }
6057c478bd9Sstevel@tonic-gate 
6067c478bd9Sstevel@tonic-gate void
6077c478bd9Sstevel@tonic-gate show_rwlock(private_t *pri, long offset)
6087c478bd9Sstevel@tonic-gate {
6097c478bd9Sstevel@tonic-gate 	lwp_rwlock_t rwlock;
6107c478bd9Sstevel@tonic-gate 
6117c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) {
6127c478bd9Sstevel@tonic-gate 		(void) printf("%s\trwlock type: %s  readers = %d\n",
613019c3c43Sraf 		    pri->pname,
614019c3c43Sraf 		    synch_type(pri, rwlock.rwlock_type),
615019c3c43Sraf 		    rwlock.rwlock_readers);
6167c478bd9Sstevel@tonic-gate 	}
6177c478bd9Sstevel@tonic-gate }
6187c478bd9Sstevel@tonic-gate 
6197c478bd9Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */
6207c478bd9Sstevel@tonic-gate char *
6217c478bd9Sstevel@tonic-gate show_char(char *buf, int c)
6227c478bd9Sstevel@tonic-gate {
6237c478bd9Sstevel@tonic-gate 	const char *fmt;
6247c478bd9Sstevel@tonic-gate 
6257c478bd9Sstevel@tonic-gate 	if (c >= ' ' && c < 0177)
6267c478bd9Sstevel@tonic-gate 		fmt = "'%c'";
6277c478bd9Sstevel@tonic-gate 	else
6287c478bd9Sstevel@tonic-gate 		fmt = "%.3o";
6297c478bd9Sstevel@tonic-gate 
6307c478bd9Sstevel@tonic-gate 	(void) sprintf(buf, fmt, c&0xff);
6317c478bd9Sstevel@tonic-gate 	return (buf);
6327c478bd9Sstevel@tonic-gate }
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate void
6357c478bd9Sstevel@tonic-gate show_termio(private_t *pri, long offset)
6367c478bd9Sstevel@tonic-gate {
6377c478bd9Sstevel@tonic-gate 	struct termio termio;
6387c478bd9Sstevel@tonic-gate 	char cbuf[8];
6397c478bd9Sstevel@tonic-gate 	int i;
6407c478bd9Sstevel@tonic-gate 
6417c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) {
6427c478bd9Sstevel@tonic-gate 		(void) printf(
6437c478bd9Sstevel@tonic-gate 		"%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
644019c3c43Sraf 		    pri->pname,
645019c3c43Sraf 		    termio.c_iflag,
646019c3c43Sraf 		    termio.c_oflag,
647019c3c43Sraf 		    termio.c_cflag,
648019c3c43Sraf 		    termio.c_lflag,
649019c3c43Sraf 		    termio.c_line);
6507c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
6517c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCC; i++)
6527c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
653019c3c43Sraf 			    show_char(cbuf, (int)termio.c_cc[i]));
6547c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
6557c478bd9Sstevel@tonic-gate 	}
6567c478bd9Sstevel@tonic-gate }
6577c478bd9Sstevel@tonic-gate 
6587c478bd9Sstevel@tonic-gate void
6597c478bd9Sstevel@tonic-gate show_termios(private_t *pri, long offset)
6607c478bd9Sstevel@tonic-gate {
6617c478bd9Sstevel@tonic-gate 	struct termios termios;
6627c478bd9Sstevel@tonic-gate 	char cbuf[8];
6637c478bd9Sstevel@tonic-gate 	int i;
6647c478bd9Sstevel@tonic-gate 
6657c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termios, sizeof (termios), offset)
6667c478bd9Sstevel@tonic-gate 	    == sizeof (termios)) {
6677c478bd9Sstevel@tonic-gate 		(void) printf(
668019c3c43Sraf 		    "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
669019c3c43Sraf 		    pri->pname,
670019c3c43Sraf 		    termios.c_iflag,
671019c3c43Sraf 		    termios.c_oflag,
672019c3c43Sraf 		    termios.c_cflag,
673019c3c43Sraf 		    termios.c_lflag);
6747c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
6757c478bd9Sstevel@tonic-gate 		for (i = 0; i < NCCS; i++) {
6767c478bd9Sstevel@tonic-gate 			if (i == NCC)	/* show new chars on new line */
6777c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t\t", pri->pname);
6787c478bd9Sstevel@tonic-gate 			(void) printf(" %s",
679019c3c43Sraf 			    show_char(cbuf, (int)termios.c_cc[i]));
6807c478bd9Sstevel@tonic-gate 		}
6817c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
6827c478bd9Sstevel@tonic-gate 	}
6837c478bd9Sstevel@tonic-gate }
6847c478bd9Sstevel@tonic-gate 
6857c478bd9Sstevel@tonic-gate void
6867c478bd9Sstevel@tonic-gate show_termiox(private_t *pri, long offset)
6877c478bd9Sstevel@tonic-gate {
6887c478bd9Sstevel@tonic-gate 	struct termiox termiox;
6897c478bd9Sstevel@tonic-gate 	int i;
6907c478bd9Sstevel@tonic-gate 
6917c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termiox, sizeof (termiox), offset)
6927c478bd9Sstevel@tonic-gate 	    == sizeof (termiox)) {
6937c478bd9Sstevel@tonic-gate 		(void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
694019c3c43Sraf 		    pri->pname,
695019c3c43Sraf 		    termiox.x_hflag,
696019c3c43Sraf 		    termiox.x_cflag,
697019c3c43Sraf 		    termiox.x_rflag[0]);
6987c478bd9Sstevel@tonic-gate 		for (i = 1; i < NFF; i++)
6997c478bd9Sstevel@tonic-gate 			(void) printf(",0%.3o", termiox.x_rflag[i]);
7007c478bd9Sstevel@tonic-gate 		(void) printf(" sflag=0%.3o\n",
701019c3c43Sraf 		    termiox.x_sflag);
7027c478bd9Sstevel@tonic-gate 	}
7037c478bd9Sstevel@tonic-gate }
7047c478bd9Sstevel@tonic-gate 
7057c478bd9Sstevel@tonic-gate void
7067c478bd9Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset)
7077c478bd9Sstevel@tonic-gate {
7087c478bd9Sstevel@tonic-gate 	struct sgttyb sgttyb;
7097c478bd9Sstevel@tonic-gate 
7107c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) {
7117c478bd9Sstevel@tonic-gate 		char erase[8];
7127c478bd9Sstevel@tonic-gate 		char kill[8];
7137c478bd9Sstevel@tonic-gate 
7147c478bd9Sstevel@tonic-gate 		(void) printf(
7157c478bd9Sstevel@tonic-gate 		"%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
716019c3c43Sraf 		    pri->pname,
717019c3c43Sraf 		    sgttyb.sg_ispeed&0xff,
718019c3c43Sraf 		    sgttyb.sg_ospeed&0xff,
719019c3c43Sraf 		    show_char(erase, sgttyb.sg_erase),
720019c3c43Sraf 		    show_char(kill, sgttyb.sg_kill),
721019c3c43Sraf 		    sgttyb.sg_flags);
7227c478bd9Sstevel@tonic-gate 	}
7237c478bd9Sstevel@tonic-gate }
7247c478bd9Sstevel@tonic-gate 
7257c478bd9Sstevel@tonic-gate void
7267c478bd9Sstevel@tonic-gate show_ltchars(private_t *pri, long offset)
7277c478bd9Sstevel@tonic-gate {
7287c478bd9Sstevel@tonic-gate 	struct ltchars ltchars;
7297c478bd9Sstevel@tonic-gate 	char *p;
7307c478bd9Sstevel@tonic-gate 	char cbuf[8];
7317c478bd9Sstevel@tonic-gate 	int i;
7327c478bd9Sstevel@tonic-gate 
7337c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &ltchars, sizeof (ltchars), offset)
7347c478bd9Sstevel@tonic-gate 	    == sizeof (ltchars)) {
7357c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
7367c478bd9Sstevel@tonic-gate 		for (p = (char *)&ltchars, i = 0; i < sizeof (ltchars); i++)
7377c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
7387c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
7397c478bd9Sstevel@tonic-gate 	}
7407c478bd9Sstevel@tonic-gate }
7417c478bd9Sstevel@tonic-gate 
7427c478bd9Sstevel@tonic-gate void
7437c478bd9Sstevel@tonic-gate show_tchars(private_t *pri, long offset)
7447c478bd9Sstevel@tonic-gate {
7457c478bd9Sstevel@tonic-gate 	struct tchars tchars;
7467c478bd9Sstevel@tonic-gate 	char *p;
7477c478bd9Sstevel@tonic-gate 	char cbuf[8];
7487c478bd9Sstevel@tonic-gate 	int i;
7497c478bd9Sstevel@tonic-gate 
7507c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) {
7517c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    cc: ", pri->pname);
7527c478bd9Sstevel@tonic-gate 		for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++)
7537c478bd9Sstevel@tonic-gate 			(void) printf(" %s", show_char(cbuf, (int)*p++));
7547c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
7557c478bd9Sstevel@tonic-gate 	}
7567c478bd9Sstevel@tonic-gate }
7577c478bd9Sstevel@tonic-gate 
7587c478bd9Sstevel@tonic-gate void
7597c478bd9Sstevel@tonic-gate show_termcb(private_t *pri, long offset)
7607c478bd9Sstevel@tonic-gate {
7617c478bd9Sstevel@tonic-gate 	struct termcb termcb;
7627c478bd9Sstevel@tonic-gate 
7637c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) {
7647c478bd9Sstevel@tonic-gate 		(void) printf(
765019c3c43Sraf 		    "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
766019c3c43Sraf 		    pri->pname,
767019c3c43Sraf 		    termcb.st_flgs&0xff,
768019c3c43Sraf 		    termcb.st_termt&0xff,
769019c3c43Sraf 		    termcb.st_crow&0xff,
770019c3c43Sraf 		    termcb.st_ccol&0xff,
771019c3c43Sraf 		    termcb.st_vrow&0xff,
772019c3c43Sraf 		    termcb.st_lrow&0xff);
7737c478bd9Sstevel@tonic-gate 	}
7747c478bd9Sstevel@tonic-gate }
7757c478bd9Sstevel@tonic-gate 
7767c478bd9Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */
7777c478bd9Sstevel@tonic-gate void
7787c478bd9Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset)
7797c478bd9Sstevel@tonic-gate {
7807c478bd9Sstevel@tonic-gate 	int val;
7817c478bd9Sstevel@tonic-gate 
7827c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
7837c478bd9Sstevel@tonic-gate 		const char *s = NULL;
7847c478bd9Sstevel@tonic-gate 
7857c478bd9Sstevel@tonic-gate 		switch (code) {		/* interpret these symbolically */
7867c478bd9Sstevel@tonic-gate 		case I_GRDOPT:
7877c478bd9Sstevel@tonic-gate 			s = strrdopt(val);
7887c478bd9Sstevel@tonic-gate 			break;
7897c478bd9Sstevel@tonic-gate 		case I_GETSIG:
7907c478bd9Sstevel@tonic-gate 			s = strevents(pri, val);
7917c478bd9Sstevel@tonic-gate 			break;
7927c478bd9Sstevel@tonic-gate 		case TIOCFLUSH:
7937c478bd9Sstevel@tonic-gate 			s = tiocflush(pri, val);
7947c478bd9Sstevel@tonic-gate 			break;
7957c478bd9Sstevel@tonic-gate 		}
7967c478bd9Sstevel@tonic-gate 
7977c478bd9Sstevel@tonic-gate 		if (s == NULL)
7987c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %d\n",
799019c3c43Sraf 			    pri->pname, offset, val);
8007c478bd9Sstevel@tonic-gate 		else
8017c478bd9Sstevel@tonic-gate 			(void) printf("%s\t0x%.8lX: %s\n",
802019c3c43Sraf 			    pri->pname, offset, s);
8037c478bd9Sstevel@tonic-gate 	}
8047c478bd9Sstevel@tonic-gate }
8057c478bd9Sstevel@tonic-gate 
8067c478bd9Sstevel@tonic-gate void
8077c478bd9Sstevel@tonic-gate show_strioctl(private_t *pri, long offset)
8087c478bd9Sstevel@tonic-gate {
8097c478bd9Sstevel@tonic-gate 	struct strioctl strioctl;
8107c478bd9Sstevel@tonic-gate 
8117c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8127c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
8137c478bd9Sstevel@tonic-gate 		(void) printf(
814019c3c43Sraf 		    "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
815019c3c43Sraf 		    pri->pname,
816019c3c43Sraf 		    ioctlname(pri, strioctl.ic_cmd),
817019c3c43Sraf 		    strioctl.ic_timout,
818019c3c43Sraf 		    strioctl.ic_len,
819019c3c43Sraf 		    (long)strioctl.ic_dp);
8207c478bd9Sstevel@tonic-gate 
8217c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
8227c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
823019c3c43Sraf 			    (long)strioctl.ic_dp);
8247c478bd9Sstevel@tonic-gate 		--pri->recur;
8257c478bd9Sstevel@tonic-gate 	}
8267c478bd9Sstevel@tonic-gate }
8277c478bd9Sstevel@tonic-gate 
8287c478bd9Sstevel@tonic-gate #ifdef _LP64
8297c478bd9Sstevel@tonic-gate void
8307c478bd9Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset)
8317c478bd9Sstevel@tonic-gate {
8327c478bd9Sstevel@tonic-gate 	struct strioctl32 strioctl;
8337c478bd9Sstevel@tonic-gate 
8347c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8357c478bd9Sstevel@tonic-gate 	    sizeof (strioctl)) {
8367c478bd9Sstevel@tonic-gate 		(void) printf(
837019c3c43Sraf 		    "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
838019c3c43Sraf 		    pri->pname,
839019c3c43Sraf 		    ioctlname(pri, strioctl.ic_cmd),
840019c3c43Sraf 		    strioctl.ic_timout,
841019c3c43Sraf 		    strioctl.ic_len,
842019c3c43Sraf 		    (long)strioctl.ic_dp);
8437c478bd9Sstevel@tonic-gate 
8447c478bd9Sstevel@tonic-gate 		if (pri->recur++ == 0)	/* avoid indefinite recursion */
8457c478bd9Sstevel@tonic-gate 			show_ioctl(pri, strioctl.ic_cmd,
846019c3c43Sraf 			    (long)strioctl.ic_dp);
8477c478bd9Sstevel@tonic-gate 		--pri->recur;
8487c478bd9Sstevel@tonic-gate 	}
8497c478bd9Sstevel@tonic-gate }
8507c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
8517c478bd9Sstevel@tonic-gate 
8527c478bd9Sstevel@tonic-gate void
8537c478bd9Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump)
8547c478bd9Sstevel@tonic-gate {
8557c478bd9Sstevel@tonic-gate 	(void) printf(
856019c3c43Sraf 	    "%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
857019c3c43Sraf 	    pri->pname,
858019c3c43Sraf 	    name,
859019c3c43Sraf 	    sp->maxlen,
860019c3c43Sraf 	    sp->len,
861019c3c43Sraf 	    (long)sp->buf);
8627c478bd9Sstevel@tonic-gate 	/*
8637c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
8647c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
8657c478bd9Sstevel@tonic-gate 	 */
8667c478bd9Sstevel@tonic-gate 	if (sp->buf == NULL || sp->len <= 0)
8677c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
8687c478bd9Sstevel@tonic-gate 	else {
8697c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
8707c478bd9Sstevel@tonic-gate 		char buffer[8];
8717c478bd9Sstevel@tonic-gate 		char obuf[40];
8727c478bd9Sstevel@tonic-gate 
8737c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
8747c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
8757c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
8767c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
877019c3c43Sraf 			    (nb == sp->len)?
878019c3c43Sraf 			    (const char *)"\"" : (const char *)"\"..");
8797c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
8807c478bd9Sstevel@tonic-gate 		}
8817c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
8827c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
8837c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
8847c478bd9Sstevel@tonic-gate 	}
8857c478bd9Sstevel@tonic-gate }
8867c478bd9Sstevel@tonic-gate 
8877c478bd9Sstevel@tonic-gate #ifdef _LP64
8887c478bd9Sstevel@tonic-gate void
8897c478bd9Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump)
8907c478bd9Sstevel@tonic-gate {
8917c478bd9Sstevel@tonic-gate 	(void) printf(
892019c3c43Sraf 	    "%s\t%s:  maxlen=%-4d len=%-4d buf=0x%.8lX",
893019c3c43Sraf 	    pri->pname,
894019c3c43Sraf 	    name,
895019c3c43Sraf 	    sp->maxlen,
896019c3c43Sraf 	    sp->len,
897019c3c43Sraf 	    (long)sp->buf);
8987c478bd9Sstevel@tonic-gate 	/*
8997c478bd9Sstevel@tonic-gate 	 * Should we show the buffer contents?
9007c478bd9Sstevel@tonic-gate 	 * Keyed to the '-r fds' and '-w fds' options?
9017c478bd9Sstevel@tonic-gate 	 */
902*27aa4812SToomas Soome 	if (sp->buf == 0 || sp->len <= 0)
9037c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
9047c478bd9Sstevel@tonic-gate 	else {
9057c478bd9Sstevel@tonic-gate 		int nb = (sp->len > 8)? 8 : sp->len;
9067c478bd9Sstevel@tonic-gate 		char buffer[8];
9077c478bd9Sstevel@tonic-gate 		char obuf[40];
9087c478bd9Sstevel@tonic-gate 
9097c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
9107c478bd9Sstevel@tonic-gate 			(void) strcpy(obuf, ": \"");
9117c478bd9Sstevel@tonic-gate 			showbytes(buffer, nb, obuf+3);
9127c478bd9Sstevel@tonic-gate 			(void) strcat(obuf,
913019c3c43Sraf 			    (nb == sp->len)?
914019c3c43Sraf 			    (const char *)"\"" : (const char *)"\"..");
9157c478bd9Sstevel@tonic-gate 			(void) fputs(obuf, stdout);
9167c478bd9Sstevel@tonic-gate 		}
9177c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
9187c478bd9Sstevel@tonic-gate 		if (dump && sp->len > 8)
9197c478bd9Sstevel@tonic-gate 			showbuffer(pri, (long)sp->buf, (long)sp->len);
9207c478bd9Sstevel@tonic-gate 	}
9217c478bd9Sstevel@tonic-gate }
9227c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
9237c478bd9Sstevel@tonic-gate 
9247c478bd9Sstevel@tonic-gate /* strpeek and strfdinsert flags word */
9257c478bd9Sstevel@tonic-gate const char *
9267c478bd9Sstevel@tonic-gate strflags(private_t *pri, int flags)
9277c478bd9Sstevel@tonic-gate {
9287c478bd9Sstevel@tonic-gate 	const char *s;
9297c478bd9Sstevel@tonic-gate 
9307c478bd9Sstevel@tonic-gate 	switch (flags) {
9317c478bd9Sstevel@tonic-gate 	case 0:
9327c478bd9Sstevel@tonic-gate 		s = "0";
9337c478bd9Sstevel@tonic-gate 		break;
9347c478bd9Sstevel@tonic-gate 	case RS_HIPRI:
9357c478bd9Sstevel@tonic-gate 		s = "RS_HIPRI";
9367c478bd9Sstevel@tonic-gate 		break;
9377c478bd9Sstevel@tonic-gate 	default:
9387c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "0x%.4X", flags);
9397c478bd9Sstevel@tonic-gate 		s = pri->code_buf;
9407c478bd9Sstevel@tonic-gate 	}
9417c478bd9Sstevel@tonic-gate 
9427c478bd9Sstevel@tonic-gate 	return (s);
9437c478bd9Sstevel@tonic-gate }
9447c478bd9Sstevel@tonic-gate 
9457c478bd9Sstevel@tonic-gate void
9467c478bd9Sstevel@tonic-gate show_strpeek(private_t *pri, long offset)
9477c478bd9Sstevel@tonic-gate {
9487c478bd9Sstevel@tonic-gate 	struct strpeek strpeek;
9497c478bd9Sstevel@tonic-gate 
9507c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9517c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
9527c478bd9Sstevel@tonic-gate 
9537c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE);
9547c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strpeek.databuf, "dat", FALSE);
9557c478bd9Sstevel@tonic-gate 
9567c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
957019c3c43Sraf 		    pri->pname,
958019c3c43Sraf 		    strflags(pri, strpeek.flags));
9597c478bd9Sstevel@tonic-gate 	}
9607c478bd9Sstevel@tonic-gate }
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate #ifdef _LP64
9637c478bd9Sstevel@tonic-gate void
9647c478bd9Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset)
9657c478bd9Sstevel@tonic-gate {
9667c478bd9Sstevel@tonic-gate 	struct strpeek32 strpeek;
9677c478bd9Sstevel@tonic-gate 
9687c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9697c478bd9Sstevel@tonic-gate 	    == sizeof (strpeek)) {
9707c478bd9Sstevel@tonic-gate 
9717c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE);
9727c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strpeek.databuf, "dat", FALSE);
9737c478bd9Sstevel@tonic-gate 
9747c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s\n",
975019c3c43Sraf 		    pri->pname,
976019c3c43Sraf 		    strflags(pri, strpeek.flags));
9777c478bd9Sstevel@tonic-gate 	}
9787c478bd9Sstevel@tonic-gate }
9797c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
9807c478bd9Sstevel@tonic-gate 
9817c478bd9Sstevel@tonic-gate void
9827c478bd9Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset)
9837c478bd9Sstevel@tonic-gate {
9847c478bd9Sstevel@tonic-gate 	struct strfdinsert strfdinsert;
9857c478bd9Sstevel@tonic-gate 
9867c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
9877c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
9907c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE);
9917c478bd9Sstevel@tonic-gate 
9927c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
993019c3c43Sraf 		    pri->pname,
994019c3c43Sraf 		    strflags(pri, strfdinsert.flags),
995019c3c43Sraf 		    strfdinsert.fildes,
996019c3c43Sraf 		    strfdinsert.offset);
9977c478bd9Sstevel@tonic-gate 	}
9987c478bd9Sstevel@tonic-gate }
9997c478bd9Sstevel@tonic-gate 
10007c478bd9Sstevel@tonic-gate #ifdef _LP64
10017c478bd9Sstevel@tonic-gate void
10027c478bd9Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset)
10037c478bd9Sstevel@tonic-gate {
10047c478bd9Sstevel@tonic-gate 	struct strfdinsert32 strfdinsert;
10057c478bd9Sstevel@tonic-gate 
10067c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
10077c478bd9Sstevel@tonic-gate 	    sizeof (strfdinsert)) {
10087c478bd9Sstevel@tonic-gate 
10097c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
10107c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE);
10117c478bd9Sstevel@tonic-gate 
10127c478bd9Sstevel@tonic-gate 		(void) printf("%s\tflags=%s fildes=%d offset=%d\n",
1013019c3c43Sraf 		    pri->pname,
1014019c3c43Sraf 		    strflags(pri, strfdinsert.flags),
1015019c3c43Sraf 		    strfdinsert.fildes,
1016019c3c43Sraf 		    strfdinsert.offset);
10177c478bd9Sstevel@tonic-gate 	}
10187c478bd9Sstevel@tonic-gate }
10197c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
10207c478bd9Sstevel@tonic-gate 
10217c478bd9Sstevel@tonic-gate void
10227c478bd9Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset)
10237c478bd9Sstevel@tonic-gate {
10247c478bd9Sstevel@tonic-gate 	struct strrecvfd strrecvfd;
10257c478bd9Sstevel@tonic-gate 
10267c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) ==
10277c478bd9Sstevel@tonic-gate 	    sizeof (strrecvfd)) {
10287c478bd9Sstevel@tonic-gate 		(void) printf(
1029019c3c43Sraf 		    "%s\tfd=%-5d uid=%-5u gid=%u\n",
1030019c3c43Sraf 		    pri->pname,
1031019c3c43Sraf 		    strrecvfd.fd,
1032019c3c43Sraf 		    strrecvfd.uid,
1033019c3c43Sraf 		    strrecvfd.gid);
10347c478bd9Sstevel@tonic-gate 	}
10357c478bd9Sstevel@tonic-gate }
10367c478bd9Sstevel@tonic-gate 
10377c478bd9Sstevel@tonic-gate void
10387c478bd9Sstevel@tonic-gate show_strlist(private_t *pri, long offset)
10397c478bd9Sstevel@tonic-gate {
10407c478bd9Sstevel@tonic-gate 	struct str_list strlist;
10417c478bd9Sstevel@tonic-gate 	struct str_mlist list;
10427c478bd9Sstevel@tonic-gate 	int count;
10437c478bd9Sstevel@tonic-gate 
10447c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10457c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
10467c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
1047019c3c43Sraf 		    pri->pname,
1048019c3c43Sraf 		    strlist.sl_nmods,
1049019c3c43Sraf 		    (long)strlist.sl_modlist);
10507c478bd9Sstevel@tonic-gate 
10517c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
10527c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
10537c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
10547c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
10557c478bd9Sstevel@tonic-gate 			    sizeof (list))
10567c478bd9Sstevel@tonic-gate 				break;
10577c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
1058019c3c43Sraf 			    pri->pname,
1059019c3c43Sraf 			    (int)sizeof (list.l_name),
1060019c3c43Sraf 			    list.l_name);
10617c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
10627c478bd9Sstevel@tonic-gate 		}
10637c478bd9Sstevel@tonic-gate 	}
10647c478bd9Sstevel@tonic-gate }
10657c478bd9Sstevel@tonic-gate 
10667c478bd9Sstevel@tonic-gate #ifdef _LP64
10677c478bd9Sstevel@tonic-gate void
10687c478bd9Sstevel@tonic-gate show_strlist32(private_t *pri, long offset)
10697c478bd9Sstevel@tonic-gate {
10707c478bd9Sstevel@tonic-gate 	struct str_list32 strlist;
10717c478bd9Sstevel@tonic-gate 	struct str_mlist list;
10727c478bd9Sstevel@tonic-gate 	int count;
10737c478bd9Sstevel@tonic-gate 
10747c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10757c478bd9Sstevel@tonic-gate 	    sizeof (strlist)) {
10767c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnmods=%d  modlist=0x%.8lX\n",
1077019c3c43Sraf 		    pri->pname,
1078019c3c43Sraf 		    strlist.sl_nmods,
1079019c3c43Sraf 		    (long)strlist.sl_modlist);
10807c478bd9Sstevel@tonic-gate 
10817c478bd9Sstevel@tonic-gate 		count = strlist.sl_nmods;
10827c478bd9Sstevel@tonic-gate 		offset = (long)strlist.sl_modlist;
10837c478bd9Sstevel@tonic-gate 		while (!interrupt && --count >= 0) {
10847c478bd9Sstevel@tonic-gate 			if (Pread(Proc, &list, sizeof (list), offset) !=
10857c478bd9Sstevel@tonic-gate 			    sizeof (list))
10867c478bd9Sstevel@tonic-gate 				break;
10877c478bd9Sstevel@tonic-gate 			(void) printf("%s\t\t\"%.*s\"\n",
1088019c3c43Sraf 			    pri->pname,
1089019c3c43Sraf 			    (int)sizeof (list.l_name),
1090019c3c43Sraf 			    list.l_name);
10917c478bd9Sstevel@tonic-gate 			offset += sizeof (struct str_mlist);
10927c478bd9Sstevel@tonic-gate 		}
10937c478bd9Sstevel@tonic-gate 	}
10947c478bd9Sstevel@tonic-gate }
10957c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
10967c478bd9Sstevel@tonic-gate 
10977c478bd9Sstevel@tonic-gate void
10987c478bd9Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset)
10997c478bd9Sstevel@tonic-gate {
11007c478bd9Sstevel@tonic-gate 	struct jwinsize jwinsize;
11017c478bd9Sstevel@tonic-gate 
11027c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) ==
11037c478bd9Sstevel@tonic-gate 	    sizeof (jwinsize)) {
11047c478bd9Sstevel@tonic-gate 		(void) printf(
1105019c3c43Sraf 		    "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1106019c3c43Sraf 		    pri->pname,
1107019c3c43Sraf 		    (unsigned)jwinsize.bytesx,
1108019c3c43Sraf 		    (unsigned)jwinsize.bytesy,
1109019c3c43Sraf 		    (unsigned)jwinsize.bitsx,
1110019c3c43Sraf 		    (unsigned)jwinsize.bitsy);
11117c478bd9Sstevel@tonic-gate 	}
11127c478bd9Sstevel@tonic-gate }
11137c478bd9Sstevel@tonic-gate 
11147c478bd9Sstevel@tonic-gate void
11157c478bd9Sstevel@tonic-gate show_winsize(private_t *pri, long offset)
11167c478bd9Sstevel@tonic-gate {
11177c478bd9Sstevel@tonic-gate 	struct winsize winsize;
11187c478bd9Sstevel@tonic-gate 
11197c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &winsize, sizeof (winsize), offset)
11207c478bd9Sstevel@tonic-gate 	    == sizeof (winsize)) {
11217c478bd9Sstevel@tonic-gate 		(void) printf(
1122019c3c43Sraf 		    "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1123019c3c43Sraf 		    pri->pname,
1124019c3c43Sraf 		    winsize.ws_row,
1125019c3c43Sraf 		    winsize.ws_col,
1126019c3c43Sraf 		    winsize.ws_xpixel,
1127019c3c43Sraf 		    winsize.ws_ypixel);
11287c478bd9Sstevel@tonic-gate 	}
11297c478bd9Sstevel@tonic-gate }
11307c478bd9Sstevel@tonic-gate 
11317c478bd9Sstevel@tonic-gate struct audio_stuff {
11327c478bd9Sstevel@tonic-gate 	uint_t	bit;
11337c478bd9Sstevel@tonic-gate 	const char *str;
11347c478bd9Sstevel@tonic-gate };
11357c478bd9Sstevel@tonic-gate 
11367c478bd9Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = {
11377c478bd9Sstevel@tonic-gate 	{ AUDIO_SPEAKER, "SPEAKER" },
11387c478bd9Sstevel@tonic-gate 	{ AUDIO_HEADPHONE, "HEADPHONE" },
11397c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_OUT, "LINE_OUT" },
11407c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_OUT, "SPDIF_OUT" },
11417c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_OUT, "AUX1_OUT" },
11427c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_OUT, "AUX2_OUT" },
11437c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11447c478bd9Sstevel@tonic-gate };
11457c478bd9Sstevel@tonic-gate 
11467c478bd9Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = {
11477c478bd9Sstevel@tonic-gate 	{ AUDIO_MICROPHONE, "MICROPHONE" },
11487c478bd9Sstevel@tonic-gate 	{ AUDIO_LINE_IN, "LINE_IN" },
11497c478bd9Sstevel@tonic-gate 	{ AUDIO_CD, "CD" },
11507c478bd9Sstevel@tonic-gate 	{ AUDIO_SPDIF_IN, "SPDIF_IN" },
11517c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX1_IN, "AUX1_IN" },
11527c478bd9Sstevel@tonic-gate 	{ AUDIO_AUX2_IN, "AUX2_IN" },
11537c478bd9Sstevel@tonic-gate 	{ AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" },
11547c478bd9Sstevel@tonic-gate 	{ AUDIO_SUNVTS, "SUNVTS" },
11557c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11567c478bd9Sstevel@tonic-gate };
11577c478bd9Sstevel@tonic-gate 
11587c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = {
11597c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_DUPLEX, "DUPLEX" },
11607c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_MSCODEC, "MSCODEC" },
11617c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_IN2OUT, "IN2OUT" },
11627c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_PLAY, "PLAY" },
11637c478bd9Sstevel@tonic-gate 	{ AUDIO_HWFEATURE_RECORD, "RECORD" },
11647c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11657c478bd9Sstevel@tonic-gate };
11667c478bd9Sstevel@tonic-gate 
11677c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = {
11687c478bd9Sstevel@tonic-gate 	{ AUDIO_SWFEATURE_MIXER, "MIXER" },
11697c478bd9Sstevel@tonic-gate 	{ 0, NULL }
11707c478bd9Sstevel@tonic-gate };
11717c478bd9Sstevel@tonic-gate 
11727c478bd9Sstevel@tonic-gate void
11737c478bd9Sstevel@tonic-gate show_audio_features(const private_t *pri,
11740b09d754SToomas Soome     const struct audio_stuff *audio_porttab, uint_t features,
11750b09d754SToomas Soome     const char *name)
11767c478bd9Sstevel@tonic-gate {
11777c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s=", pri->pname, name);
11787c478bd9Sstevel@tonic-gate 	if (features == 0) {
11797c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
11807c478bd9Sstevel@tonic-gate 		return;
11817c478bd9Sstevel@tonic-gate 	}
11827c478bd9Sstevel@tonic-gate 
11837c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
11847c478bd9Sstevel@tonic-gate 		if (features & audio_porttab->bit) {
11857c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
11867c478bd9Sstevel@tonic-gate 			features &= ~audio_porttab->bit;
11877c478bd9Sstevel@tonic-gate 			if (features)
11887c478bd9Sstevel@tonic-gate 				(void) putchar('|');
11897c478bd9Sstevel@tonic-gate 		}
11907c478bd9Sstevel@tonic-gate 	}
11917c478bd9Sstevel@tonic-gate 	if (features)
11927c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", features);
11937c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
11947c478bd9Sstevel@tonic-gate }
11957c478bd9Sstevel@tonic-gate 
11967c478bd9Sstevel@tonic-gate void
11977c478bd9Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode,
11980b09d754SToomas Soome     const char *field, uint_t ports)
11997c478bd9Sstevel@tonic-gate {
12007c478bd9Sstevel@tonic-gate 	const struct audio_stuff *audio_porttab;
12017c478bd9Sstevel@tonic-gate 
12027c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\t%s=", pri->pname, mode, field);
12037c478bd9Sstevel@tonic-gate 	if (ports == 0) {
12047c478bd9Sstevel@tonic-gate 		(void) printf("0\n");
12057c478bd9Sstevel@tonic-gate 		return;
12067c478bd9Sstevel@tonic-gate 	}
12077c478bd9Sstevel@tonic-gate 	if (*mode == 'p')
12087c478bd9Sstevel@tonic-gate 		audio_porttab = audio_output_ports;
12097c478bd9Sstevel@tonic-gate 	else
12107c478bd9Sstevel@tonic-gate 		audio_porttab = audio_input_ports;
12117c478bd9Sstevel@tonic-gate 	for (; audio_porttab->bit != 0; ++audio_porttab) {
12127c478bd9Sstevel@tonic-gate 		if (ports & audio_porttab->bit) {
12137c478bd9Sstevel@tonic-gate 			(void) printf(audio_porttab->str);
12147c478bd9Sstevel@tonic-gate 			ports &= ~audio_porttab->bit;
12157c478bd9Sstevel@tonic-gate 			if (ports)
12167c478bd9Sstevel@tonic-gate 				(void) putchar('|');
12177c478bd9Sstevel@tonic-gate 		}
12187c478bd9Sstevel@tonic-gate 	}
12197c478bd9Sstevel@tonic-gate 	if (ports)
12207c478bd9Sstevel@tonic-gate 		(void) printf("0x%x", ports);
12217c478bd9Sstevel@tonic-gate 	(void) putchar('\n');
12227c478bd9Sstevel@tonic-gate }
12237c478bd9Sstevel@tonic-gate 
12247c478bd9Sstevel@tonic-gate void
12257c478bd9Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr)
12267c478bd9Sstevel@tonic-gate {
12277c478bd9Sstevel@tonic-gate 	const char *s;
12287c478bd9Sstevel@tonic-gate 
12297c478bd9Sstevel@tonic-gate 	/*
12307c478bd9Sstevel@tonic-gate 	 * The following values describe the audio data encoding.
12317c478bd9Sstevel@tonic-gate 	 */
12327c478bd9Sstevel@tonic-gate 
12337c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1234019c3c43Sraf 	    pri->pname, mode,
1235019c3c43Sraf 	    au_pr->sample_rate,
1236019c3c43Sraf 	    au_pr->channels,
1237019c3c43Sraf 	    au_pr->precision);
12387c478bd9Sstevel@tonic-gate 
12397c478bd9Sstevel@tonic-gate 	s = NULL;
12407c478bd9Sstevel@tonic-gate 	switch (au_pr->encoding) {
12417c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_NONE:	s = "NONE";	break;
12427c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ULAW:	s = "ULAW";	break;
12437c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_ALAW:	s = "ALAW";	break;
12447c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR:	s = "LINEAR";	break;
12457c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_DVI:	s = "DVI";	break;
12467c478bd9Sstevel@tonic-gate 	case AUDIO_ENCODING_LINEAR8:	s = "LINEAR8";	break;
12477c478bd9Sstevel@tonic-gate 	}
12487c478bd9Sstevel@tonic-gate 	if (s)
12497c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s);
12507c478bd9Sstevel@tonic-gate 	else {
12517c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s\tencoding=%u\n",
1252019c3c43Sraf 		    pri->pname, mode, au_pr->encoding);
12537c478bd9Sstevel@tonic-gate 	}
12547c478bd9Sstevel@tonic-gate 
12557c478bd9Sstevel@tonic-gate 	/*
12567c478bd9Sstevel@tonic-gate 	 * The following values control audio device configuration
12577c478bd9Sstevel@tonic-gate 	 */
12587c478bd9Sstevel@tonic-gate 
12597c478bd9Sstevel@tonic-gate 	(void) printf(
1260019c3c43Sraf 	    "%s\t%s\tgain=%u buffer_size=%u\n",
1261019c3c43Sraf 	    pri->pname, mode,
1262019c3c43Sraf 	    au_pr->gain,
1263019c3c43Sraf 	    au_pr->buffer_size);
12647c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "port", au_pr->port);
12657c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports);
12667c478bd9Sstevel@tonic-gate 	show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports);
12677c478bd9Sstevel@tonic-gate 
12687c478bd9Sstevel@tonic-gate 	/*
12697c478bd9Sstevel@tonic-gate 	 * The following values describe driver state
12707c478bd9Sstevel@tonic-gate 	 */
12717c478bd9Sstevel@tonic-gate 
12727c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1273019c3c43Sraf 	    pri->pname, mode,
1274019c3c43Sraf 	    au_pr->samples,
1275019c3c43Sraf 	    au_pr->eof,
1276019c3c43Sraf 	    au_pr->pause,
1277019c3c43Sraf 	    au_pr->error);
12787c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1279019c3c43Sraf 	    pri->pname, mode,
1280019c3c43Sraf 	    au_pr->waiting,
1281019c3c43Sraf 	    au_pr->balance,
1282019c3c43Sraf 	    au_pr->minordev);
12837c478bd9Sstevel@tonic-gate 
12847c478bd9Sstevel@tonic-gate 	/*
12857c478bd9Sstevel@tonic-gate 	 * The following values are read-only state flags
12867c478bd9Sstevel@tonic-gate 	 */
12877c478bd9Sstevel@tonic-gate 	(void) printf("%s\t%s\topen=%u active=%u\n",
1288019c3c43Sraf 	    pri->pname, mode,
1289019c3c43Sraf 	    au_pr->open,
1290019c3c43Sraf 	    au_pr->active);
12917c478bd9Sstevel@tonic-gate }
12927c478bd9Sstevel@tonic-gate 
12937c478bd9Sstevel@tonic-gate void
12947c478bd9Sstevel@tonic-gate show_audio_info(private_t *pri, long offset)
12957c478bd9Sstevel@tonic-gate {
12967c478bd9Sstevel@tonic-gate 	struct audio_info au;
12977c478bd9Sstevel@tonic-gate 
12987c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) {
12997c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "play", &au.play);
13007c478bd9Sstevel@tonic-gate 		show_audio_prinfo(pri, "record", &au.record);
13017c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1302019c3c43Sraf 		    pri->pname, au.monitor_gain, au.output_muted);
13037c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_hw_features, au.hw_features,
13047c478bd9Sstevel@tonic-gate 		    "hw_features");
13057c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features, au.sw_features,
13067c478bd9Sstevel@tonic-gate 		    "sw_features");
13077c478bd9Sstevel@tonic-gate 		show_audio_features(pri, audio_sw_features,
13087c478bd9Sstevel@tonic-gate 		    au.sw_features_enabled, "sw_features_enabled");
13097c478bd9Sstevel@tonic-gate 	}
13107c478bd9Sstevel@tonic-gate }
13117c478bd9Sstevel@tonic-gate 
13127c478bd9Sstevel@tonic-gate void
13137c478bd9Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset)
13147c478bd9Sstevel@tonic-gate {
13157c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
13167c478bd9Sstevel@tonic-gate 	int err = pri->Errno;	/* don't display output parameters */
13177c478bd9Sstevel@tonic-gate 				/* for a failed system call */
13187c478bd9Sstevel@tonic-gate #ifndef _LP64
13197c478bd9Sstevel@tonic-gate 	if (lp64)
13207c478bd9Sstevel@tonic-gate 		return;
13217c478bd9Sstevel@tonic-gate #endif
13223b862e9aSRoger A. Faulkner 	if (offset == 0)
13237c478bd9Sstevel@tonic-gate 		return;
13247c478bd9Sstevel@tonic-gate 
13257c478bd9Sstevel@tonic-gate 	switch (code) {
13267c478bd9Sstevel@tonic-gate 	case TCGETA:
13277c478bd9Sstevel@tonic-gate 		if (err)
13287c478bd9Sstevel@tonic-gate 			break;
13297c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13307c478bd9Sstevel@tonic-gate 	case TCSETA:
13317c478bd9Sstevel@tonic-gate 	case TCSETAW:
13327c478bd9Sstevel@tonic-gate 	case TCSETAF:
13337c478bd9Sstevel@tonic-gate 		show_termio(pri, offset);
13347c478bd9Sstevel@tonic-gate 		break;
13357c478bd9Sstevel@tonic-gate 	case TCGETS:
13367c478bd9Sstevel@tonic-gate 		if (err)
13377c478bd9Sstevel@tonic-gate 			break;
13387c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13397c478bd9Sstevel@tonic-gate 	case TCSETS:
13407c478bd9Sstevel@tonic-gate 	case TCSETSW:
13417c478bd9Sstevel@tonic-gate 	case TCSETSF:
13427c478bd9Sstevel@tonic-gate 		show_termios(pri, offset);
13437c478bd9Sstevel@tonic-gate 		break;
13447c478bd9Sstevel@tonic-gate 	case TCGETX:
13457c478bd9Sstevel@tonic-gate 		if (err)
13467c478bd9Sstevel@tonic-gate 			break;
13477c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13487c478bd9Sstevel@tonic-gate 	case TCSETX:
13497c478bd9Sstevel@tonic-gate 	case TCSETXW:
13507c478bd9Sstevel@tonic-gate 	case TCSETXF:
13517c478bd9Sstevel@tonic-gate 		show_termiox(pri, offset);
13527c478bd9Sstevel@tonic-gate 		break;
13537c478bd9Sstevel@tonic-gate 	case TIOCGETP:
13547c478bd9Sstevel@tonic-gate 		if (err)
13557c478bd9Sstevel@tonic-gate 			break;
13567c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13577c478bd9Sstevel@tonic-gate 	case TIOCSETN:
13587c478bd9Sstevel@tonic-gate 	case TIOCSETP:
13597c478bd9Sstevel@tonic-gate 		show_sgttyb(pri, offset);
13607c478bd9Sstevel@tonic-gate 		break;
13617c478bd9Sstevel@tonic-gate 	case TIOCGLTC:
13627c478bd9Sstevel@tonic-gate 		if (err)
13637c478bd9Sstevel@tonic-gate 			break;
13647c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13657c478bd9Sstevel@tonic-gate 	case TIOCSLTC:
13667c478bd9Sstevel@tonic-gate 		show_ltchars(pri, offset);
13677c478bd9Sstevel@tonic-gate 		break;
13687c478bd9Sstevel@tonic-gate 	case TIOCGETC:
13697c478bd9Sstevel@tonic-gate 		if (err)
13707c478bd9Sstevel@tonic-gate 			break;
13717c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13727c478bd9Sstevel@tonic-gate 	case TIOCSETC:
13737c478bd9Sstevel@tonic-gate 		show_tchars(pri, offset);
13747c478bd9Sstevel@tonic-gate 		break;
13757c478bd9Sstevel@tonic-gate 	case LDGETT:
13767c478bd9Sstevel@tonic-gate 		if (err)
13777c478bd9Sstevel@tonic-gate 			break;
13787c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
13797c478bd9Sstevel@tonic-gate 	case LDSETT:
13807c478bd9Sstevel@tonic-gate 		show_termcb(pri, offset);
13817c478bd9Sstevel@tonic-gate 		break;
13827c478bd9Sstevel@tonic-gate 	/* streams ioctl()s */
13837c478bd9Sstevel@tonic-gate #if 0
13847c478bd9Sstevel@tonic-gate 		/* these are displayed as strings in the arg list */
13857c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13867c478bd9Sstevel@tonic-gate 	case I_PUSH:
13877c478bd9Sstevel@tonic-gate 	case I_LOOK:
13887c478bd9Sstevel@tonic-gate 	case I_FIND:
13897c478bd9Sstevel@tonic-gate 		/* these are displayed as decimal in the arg list */
13907c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13917c478bd9Sstevel@tonic-gate 	case I_LINK:
13927c478bd9Sstevel@tonic-gate 	case I_UNLINK:
13937c478bd9Sstevel@tonic-gate 	case I_SENDFD:
13947c478bd9Sstevel@tonic-gate 		/* these are displayed symbolically in the arg list */
13957c478bd9Sstevel@tonic-gate 		/* by prt_ioa().  don't display them again here */
13967c478bd9Sstevel@tonic-gate 	case I_SRDOPT:
13977c478bd9Sstevel@tonic-gate 	case I_SETSIG:
13987c478bd9Sstevel@tonic-gate 	case I_FLUSH:
13997c478bd9Sstevel@tonic-gate 		break;
14007c478bd9Sstevel@tonic-gate 		/* this one just ignores the argument */
14017c478bd9Sstevel@tonic-gate 	case I_POP:
14027c478bd9Sstevel@tonic-gate 		break;
14037c478bd9Sstevel@tonic-gate #endif
14047c478bd9Sstevel@tonic-gate 		/* these return something in an int pointed to by arg */
14057c478bd9Sstevel@tonic-gate 	case I_NREAD:
14067c478bd9Sstevel@tonic-gate 	case I_GRDOPT:
14077c478bd9Sstevel@tonic-gate 	case I_GETSIG:
14087c478bd9Sstevel@tonic-gate 	case TIOCGSID:
14097c478bd9Sstevel@tonic-gate 	case TIOCGPGRP:
14107c478bd9Sstevel@tonic-gate 	case TIOCLGET:
14117c478bd9Sstevel@tonic-gate 	case FIONREAD:
14127c478bd9Sstevel@tonic-gate 	case FIORDCHK:
14137c478bd9Sstevel@tonic-gate 		if (err)
14147c478bd9Sstevel@tonic-gate 			break;
14157c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
14167c478bd9Sstevel@tonic-gate 		/* these pass something in an int pointed to by arg */
14177c478bd9Sstevel@tonic-gate 	case TIOCSPGRP:
14187c478bd9Sstevel@tonic-gate 	case TIOCFLUSH:
14197c478bd9Sstevel@tonic-gate 	case TIOCLBIS:
14207c478bd9Sstevel@tonic-gate 	case TIOCLBIC:
14217c478bd9Sstevel@tonic-gate 	case TIOCLSET:
14227c478bd9Sstevel@tonic-gate 		show_strint(pri, code, offset);
14237c478bd9Sstevel@tonic-gate 		break;
14247c478bd9Sstevel@tonic-gate 		/* these all point to structures */
14257c478bd9Sstevel@tonic-gate 	case I_STR:
14267c478bd9Sstevel@tonic-gate #ifdef _LP64
14277c478bd9Sstevel@tonic-gate 		if (lp64)
14287c478bd9Sstevel@tonic-gate 			show_strioctl(pri, offset);
14297c478bd9Sstevel@tonic-gate 		else
14307c478bd9Sstevel@tonic-gate 			show_strioctl32(pri, offset);
14317c478bd9Sstevel@tonic-gate #else
14327c478bd9Sstevel@tonic-gate 		show_strioctl(pri, offset);
14337c478bd9Sstevel@tonic-gate #endif
14347c478bd9Sstevel@tonic-gate 		break;
14357c478bd9Sstevel@tonic-gate 	case I_PEEK:
14367c478bd9Sstevel@tonic-gate #ifdef _LP64
14377c478bd9Sstevel@tonic-gate 		if (lp64)
14387c478bd9Sstevel@tonic-gate 			show_strpeek(pri, offset);
14397c478bd9Sstevel@tonic-gate 		else
14407c478bd9Sstevel@tonic-gate 			show_strpeek32(pri, offset);
14417c478bd9Sstevel@tonic-gate #else
14427c478bd9Sstevel@tonic-gate 		show_strpeek(pri, offset);
14437c478bd9Sstevel@tonic-gate #endif
14447c478bd9Sstevel@tonic-gate 		break;
14457c478bd9Sstevel@tonic-gate 	case I_FDINSERT:
14467c478bd9Sstevel@tonic-gate #ifdef _LP64
14477c478bd9Sstevel@tonic-gate 		if (lp64)
14487c478bd9Sstevel@tonic-gate 			show_strfdinsert(pri, offset);
14497c478bd9Sstevel@tonic-gate 		else
14507c478bd9Sstevel@tonic-gate 			show_strfdinsert32(pri, offset);
14517c478bd9Sstevel@tonic-gate #else
14527c478bd9Sstevel@tonic-gate 		show_strfdinsert(pri, offset);
14537c478bd9Sstevel@tonic-gate #endif
14547c478bd9Sstevel@tonic-gate 		break;
14557c478bd9Sstevel@tonic-gate 	case I_RECVFD:
14567c478bd9Sstevel@tonic-gate 		if (err)
14577c478bd9Sstevel@tonic-gate 			break;
14587c478bd9Sstevel@tonic-gate 		show_strrecvfd(pri, offset);
14597c478bd9Sstevel@tonic-gate 		break;
14607c478bd9Sstevel@tonic-gate 	case I_LIST:
14617c478bd9Sstevel@tonic-gate 		if (err)
14627c478bd9Sstevel@tonic-gate 			break;
14637c478bd9Sstevel@tonic-gate #ifdef _LP64
14647c478bd9Sstevel@tonic-gate 		if (lp64)
14657c478bd9Sstevel@tonic-gate 			show_strlist(pri, offset);
14667c478bd9Sstevel@tonic-gate 		else
14677c478bd9Sstevel@tonic-gate 			show_strlist32(pri, offset);
14687c478bd9Sstevel@tonic-gate #else
14697c478bd9Sstevel@tonic-gate 		show_strlist(pri, offset);
14707c478bd9Sstevel@tonic-gate #endif
14717c478bd9Sstevel@tonic-gate 		break;
14727c478bd9Sstevel@tonic-gate 	case JWINSIZE:
14737c478bd9Sstevel@tonic-gate 		if (err)
14747c478bd9Sstevel@tonic-gate 			break;
14757c478bd9Sstevel@tonic-gate 		show_jwinsize(pri, offset);
14767c478bd9Sstevel@tonic-gate 		break;
14777c478bd9Sstevel@tonic-gate 	case TIOCGWINSZ:
14787c478bd9Sstevel@tonic-gate 		if (err)
14797c478bd9Sstevel@tonic-gate 			break;
14807c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
14817c478bd9Sstevel@tonic-gate 	case TIOCSWINSZ:
14827c478bd9Sstevel@tonic-gate 		show_winsize(pri, offset);
14837c478bd9Sstevel@tonic-gate 		break;
14847c478bd9Sstevel@tonic-gate 	case AUDIO_GETINFO:
14857c478bd9Sstevel@tonic-gate 	case (int)AUDIO_SETINFO:
14867c478bd9Sstevel@tonic-gate 		show_audio_info(pri, offset);
14877c478bd9Sstevel@tonic-gate 		break;
14887c478bd9Sstevel@tonic-gate 
14897c478bd9Sstevel@tonic-gate 	default:
1490a803cc21SGordon Ross 		if ((code & ~0xff) == ZFS_IOC) {
1491a803cc21SGordon Ross 			show_zfs_ioc(pri, offset);
1492a803cc21SGordon Ross 			break;
1493a803cc21SGordon Ross 		}
1494a803cc21SGordon Ross 
14957c478bd9Sstevel@tonic-gate 		if (code & IOC_INOUT) {
14967c478bd9Sstevel@tonic-gate 			const char *str = ioctldatastruct(code);
14977c478bd9Sstevel@tonic-gate 
14987c478bd9Sstevel@tonic-gate 			(void) printf("\t\t%s",
14997c478bd9Sstevel@tonic-gate 			    (code & IOC_INOUT) == IOC_INOUT ? "write/read" :
15007c478bd9Sstevel@tonic-gate 			    code & IOC_IN ? "write" : "read");
15017c478bd9Sstevel@tonic-gate 			if (str != NULL) {
15027c478bd9Sstevel@tonic-gate 				(void) printf(" (struct %s)\n", str);
15037c478bd9Sstevel@tonic-gate 			} else {
15047c478bd9Sstevel@tonic-gate 				(void) printf(" %d bytes\n",
15057c478bd9Sstevel@tonic-gate 				    (code >> 16) & IOCPARM_MASK);
15067c478bd9Sstevel@tonic-gate 			}
15077c478bd9Sstevel@tonic-gate 		}
15087c478bd9Sstevel@tonic-gate 	}
15097c478bd9Sstevel@tonic-gate }
15107c478bd9Sstevel@tonic-gate 
15117c478bd9Sstevel@tonic-gate void
15127c478bd9Sstevel@tonic-gate show_statvfs(private_t *pri)
15137c478bd9Sstevel@tonic-gate {
15147c478bd9Sstevel@tonic-gate 	long offset;
15157c478bd9Sstevel@tonic-gate 	struct statvfs statvfs;
15167c478bd9Sstevel@tonic-gate 	char *cp;
15177c478bd9Sstevel@tonic-gate 
1518*27aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15197c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
15207c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
15217c478bd9Sstevel@tonic-gate 		(void) printf(
15227c478bd9Sstevel@tonic-gate 		"%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1523019c3c43Sraf 		    pri->pname,
1524019c3c43Sraf 		    statvfs.f_bsize,
1525019c3c43Sraf 		    statvfs.f_frsize,
1526019c3c43Sraf 		    (u_longlong_t)statvfs.f_blocks,
1527019c3c43Sraf 		    (u_longlong_t)statvfs.f_bfree);
15287c478bd9Sstevel@tonic-gate 		(void) printf(
15297c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1530019c3c43Sraf 		    pri->pname,
1531019c3c43Sraf 		    (u_longlong_t)statvfs.f_bavail,
1532019c3c43Sraf 		    (u_longlong_t)statvfs.f_files,
1533019c3c43Sraf 		    (u_longlong_t)statvfs.f_ffree,
1534019c3c43Sraf 		    (u_longlong_t)statvfs.f_favail);
15357c478bd9Sstevel@tonic-gate 		(void) printf(
1536019c3c43Sraf 		    "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1537019c3c43Sraf 		    pri->pname,
1538019c3c43Sraf 		    statvfs.f_fsid,
1539019c3c43Sraf 		    statvfs.f_basetype,
1540019c3c43Sraf 		    (long)statvfs.f_namemax);
15417c478bd9Sstevel@tonic-gate 		(void) printf(
1542019c3c43Sraf 		    "%s\tflag=%s\n",
1543019c3c43Sraf 		    pri->pname,
1544019c3c43Sraf 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
15457c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15467c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15477c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
15487c478bd9Sstevel@tonic-gate 			*cp = ' ';
15497c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1550019c3c43Sraf 		    pri->pname,
1551019c3c43Sraf 		    (int)sizeof (statvfs.f_fstr),
1552019c3c43Sraf 		    statvfs.f_fstr);
15537c478bd9Sstevel@tonic-gate 	}
15547c478bd9Sstevel@tonic-gate }
15557c478bd9Sstevel@tonic-gate 
15567c478bd9Sstevel@tonic-gate #ifdef _LP64
15577c478bd9Sstevel@tonic-gate void
15587c478bd9Sstevel@tonic-gate show_statvfs32(private_t *pri)
15597c478bd9Sstevel@tonic-gate {
15607c478bd9Sstevel@tonic-gate 	long offset;
15617c478bd9Sstevel@tonic-gate 	struct statvfs32 statvfs;
15627c478bd9Sstevel@tonic-gate 	char *cp;
15637c478bd9Sstevel@tonic-gate 
1564*27aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15657c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
15667c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
15677c478bd9Sstevel@tonic-gate 		(void) printf(
1568019c3c43Sraf 		    "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1569019c3c43Sraf 		    pri->pname,
1570019c3c43Sraf 		    statvfs.f_bsize,
1571019c3c43Sraf 		    statvfs.f_frsize,
1572019c3c43Sraf 		    statvfs.f_blocks,
1573019c3c43Sraf 		    statvfs.f_bfree);
15747c478bd9Sstevel@tonic-gate 		(void) printf(
1575019c3c43Sraf 		    "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1576019c3c43Sraf 		    pri->pname,
1577019c3c43Sraf 		    statvfs.f_bavail,
1578019c3c43Sraf 		    statvfs.f_files,
1579019c3c43Sraf 		    statvfs.f_ffree,
1580019c3c43Sraf 		    statvfs.f_favail);
15817c478bd9Sstevel@tonic-gate 		(void) printf(
1582019c3c43Sraf 		    "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1583019c3c43Sraf 		    pri->pname,
1584019c3c43Sraf 		    statvfs.f_fsid,
1585019c3c43Sraf 		    statvfs.f_basetype,
1586019c3c43Sraf 		    (int)statvfs.f_namemax);
15877c478bd9Sstevel@tonic-gate 		(void) printf(
1588019c3c43Sraf 		    "%s\tflag=%s\n",
1589019c3c43Sraf 		    pri->pname,
1590019c3c43Sraf 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
15917c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15927c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15937c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
15947c478bd9Sstevel@tonic-gate 			*cp = ' ';
15957c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1596019c3c43Sraf 		    pri->pname,
1597019c3c43Sraf 		    (int)sizeof (statvfs.f_fstr),
1598019c3c43Sraf 		    statvfs.f_fstr);
15997c478bd9Sstevel@tonic-gate 	}
16007c478bd9Sstevel@tonic-gate }
16017c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
16027c478bd9Sstevel@tonic-gate 
16037c478bd9Sstevel@tonic-gate void
16047c478bd9Sstevel@tonic-gate show_statvfs64(private_t *pri)
16057c478bd9Sstevel@tonic-gate {
16067c478bd9Sstevel@tonic-gate 	long offset;
16077c478bd9Sstevel@tonic-gate 	struct statvfs64_32 statvfs;
16087c478bd9Sstevel@tonic-gate 	char *cp;
16097c478bd9Sstevel@tonic-gate 
1610*27aa4812SToomas Soome 	if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
16117c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statvfs, sizeof (statvfs), offset)
16127c478bd9Sstevel@tonic-gate 	    == sizeof (statvfs)) {
16137c478bd9Sstevel@tonic-gate 		(void) printf(
1614019c3c43Sraf 		    "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1615019c3c43Sraf 		    pri->pname,
1616019c3c43Sraf 		    statvfs.f_bsize,
1617019c3c43Sraf 		    statvfs.f_frsize,
1618019c3c43Sraf 		    (u_longlong_t)statvfs.f_blocks,
1619019c3c43Sraf 		    (u_longlong_t)statvfs.f_bfree);
16207c478bd9Sstevel@tonic-gate 		(void) printf(
16217c478bd9Sstevel@tonic-gate 		"%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1622019c3c43Sraf 		    pri->pname,
1623019c3c43Sraf 		    (u_longlong_t)statvfs.f_bavail,
1624019c3c43Sraf 		    (u_longlong_t)statvfs.f_files,
1625019c3c43Sraf 		    (u_longlong_t)statvfs.f_ffree,
1626019c3c43Sraf 		    (u_longlong_t)statvfs.f_favail);
16277c478bd9Sstevel@tonic-gate 		(void) printf(
1628019c3c43Sraf 		    "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1629019c3c43Sraf 		    pri->pname,
1630019c3c43Sraf 		    statvfs.f_fsid,
1631019c3c43Sraf 		    statvfs.f_basetype,
1632019c3c43Sraf 		    (int)statvfs.f_namemax);
16337c478bd9Sstevel@tonic-gate 		(void) printf(
1634019c3c43Sraf 		    "%s\tflag=%s\n",
1635019c3c43Sraf 		    pri->pname,
1636019c3c43Sraf 		    svfsflags(pri, (ulong_t)statvfs.f_flag));
16377c478bd9Sstevel@tonic-gate 		cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
16387c478bd9Sstevel@tonic-gate 		if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
16397c478bd9Sstevel@tonic-gate 		    *(cp+1) != '\0')
16407c478bd9Sstevel@tonic-gate 			*cp = ' ';
16417c478bd9Sstevel@tonic-gate 		(void) printf("%s\tfstr=\"%.*s\"\n",
1642019c3c43Sraf 		    pri->pname,
1643019c3c43Sraf 		    (int)sizeof (statvfs.f_fstr),
1644019c3c43Sraf 		    statvfs.f_fstr);
16457c478bd9Sstevel@tonic-gate 	}
16467c478bd9Sstevel@tonic-gate }
16477c478bd9Sstevel@tonic-gate 
16487c478bd9Sstevel@tonic-gate void
16497c478bd9Sstevel@tonic-gate show_statfs(private_t *pri)
16507c478bd9Sstevel@tonic-gate {
16517c478bd9Sstevel@tonic-gate 	long offset;
16527c478bd9Sstevel@tonic-gate 	struct statfs statfs;
16537c478bd9Sstevel@tonic-gate 
1654*27aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16557c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16567c478bd9Sstevel@tonic-gate 		(void) printf(
16577c478bd9Sstevel@tonic-gate 		"%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1658019c3c43Sraf 		    pri->pname,
1659019c3c43Sraf 		    statfs.f_fstyp,
1660019c3c43Sraf 		    statfs.f_bsize,
1661019c3c43Sraf 		    statfs.f_frsize,
1662019c3c43Sraf 		    statfs.f_blocks,
1663019c3c43Sraf 		    statfs.f_bfree,
1664019c3c43Sraf 		    statfs.f_files,
1665019c3c43Sraf 		    statfs.f_ffree);
16667c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
1667019c3c43Sraf 		    pri->pname,
1668019c3c43Sraf 		    statfs.f_fname,
1669019c3c43Sraf 		    statfs.f_fpack);
16707c478bd9Sstevel@tonic-gate 	}
16717c478bd9Sstevel@tonic-gate }
16727c478bd9Sstevel@tonic-gate 
16737c478bd9Sstevel@tonic-gate #ifdef _LP64
16747c478bd9Sstevel@tonic-gate void
16757c478bd9Sstevel@tonic-gate show_statfs32(private_t *pri)
16767c478bd9Sstevel@tonic-gate {
16777c478bd9Sstevel@tonic-gate 	long offset;
16787c478bd9Sstevel@tonic-gate 	struct statfs32 statfs;
16797c478bd9Sstevel@tonic-gate 
1680*27aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16817c478bd9Sstevel@tonic-gate 	    Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16827c478bd9Sstevel@tonic-gate 		(void) printf(
1683019c3c43Sraf 		    "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1684019c3c43Sraf 		    pri->pname,
1685019c3c43Sraf 		    statfs.f_fstyp,
1686019c3c43Sraf 		    statfs.f_bsize,
1687019c3c43Sraf 		    statfs.f_frsize,
1688019c3c43Sraf 		    statfs.f_blocks,
1689019c3c43Sraf 		    statfs.f_bfree,
1690019c3c43Sraf 		    statfs.f_files,
1691019c3c43Sraf 		    statfs.f_ffree);
16927c478bd9Sstevel@tonic-gate 		(void) printf("%s\t    fname=%.6s fpack=%.6s\n",
1693019c3c43Sraf 		    pri->pname,
1694019c3c43Sraf 		    statfs.f_fname,
1695019c3c43Sraf 		    statfs.f_fpack);
16967c478bd9Sstevel@tonic-gate 	}
16977c478bd9Sstevel@tonic-gate }
16987c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
16997c478bd9Sstevel@tonic-gate 
17007c478bd9Sstevel@tonic-gate void
17017c478bd9Sstevel@tonic-gate show_flock32(private_t *pri, long offset)
17027c478bd9Sstevel@tonic-gate {
17037c478bd9Sstevel@tonic-gate 	struct flock32 flock;
17047c478bd9Sstevel@tonic-gate 
17057c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
17067c478bd9Sstevel@tonic-gate 		const char *str = NULL;
17077c478bd9Sstevel@tonic-gate 
17087c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
17097c478bd9Sstevel@tonic-gate 
17107c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
17117c478bd9Sstevel@tonic-gate 		case F_RDLCK:
17127c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
17137c478bd9Sstevel@tonic-gate 			break;
17147c478bd9Sstevel@tonic-gate 		case F_WRLCK:
17157c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
17167c478bd9Sstevel@tonic-gate 			break;
17177c478bd9Sstevel@tonic-gate 		case F_UNLCK:
17187c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
17197c478bd9Sstevel@tonic-gate 			break;
17207c478bd9Sstevel@tonic-gate 		}
17217c478bd9Sstevel@tonic-gate 		if (str != NULL)
17227c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
17237c478bd9Sstevel@tonic-gate 		else
17247c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
17257c478bd9Sstevel@tonic-gate 
17267c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
17277c478bd9Sstevel@tonic-gate 		if (str != NULL)
17287c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
17297c478bd9Sstevel@tonic-gate 		else
17307c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
17317c478bd9Sstevel@tonic-gate 
17327c478bd9Sstevel@tonic-gate 		(void) printf(
1733019c3c43Sraf 		    " start=%-5d len=%-5d sys=%-2u pid=%d\n",
1734019c3c43Sraf 		    flock.l_start,
1735019c3c43Sraf 		    flock.l_len,
1736019c3c43Sraf 		    flock.l_sysid,
1737019c3c43Sraf 		    flock.l_pid);
17387c478bd9Sstevel@tonic-gate 	}
17397c478bd9Sstevel@tonic-gate }
17407c478bd9Sstevel@tonic-gate 
17417c478bd9Sstevel@tonic-gate void
17427c478bd9Sstevel@tonic-gate show_flock64(private_t *pri, long offset)
17437c478bd9Sstevel@tonic-gate {
17447c478bd9Sstevel@tonic-gate 	struct flock64 flock;
17457c478bd9Sstevel@tonic-gate 
17467c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
17477c478bd9Sstevel@tonic-gate 		const char *str = NULL;
17487c478bd9Sstevel@tonic-gate 
17497c478bd9Sstevel@tonic-gate 		(void) printf("%s\ttyp=", pri->pname);
17507c478bd9Sstevel@tonic-gate 
17517c478bd9Sstevel@tonic-gate 		switch (flock.l_type) {
17527c478bd9Sstevel@tonic-gate 		case F_RDLCK:
17537c478bd9Sstevel@tonic-gate 			str = "F_RDLCK";
17547c478bd9Sstevel@tonic-gate 			break;
17557c478bd9Sstevel@tonic-gate 		case F_WRLCK:
17567c478bd9Sstevel@tonic-gate 			str = "F_WRLCK";
17577c478bd9Sstevel@tonic-gate 			break;
17587c478bd9Sstevel@tonic-gate 		case F_UNLCK:
17597c478bd9Sstevel@tonic-gate 			str = "F_UNLCK";
17607c478bd9Sstevel@tonic-gate 			break;
17617c478bd9Sstevel@tonic-gate 		}
17627c478bd9Sstevel@tonic-gate 		if (str != NULL)
17637c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
17647c478bd9Sstevel@tonic-gate 		else
17657c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", flock.l_type);
17667c478bd9Sstevel@tonic-gate 
17677c478bd9Sstevel@tonic-gate 		str = whencearg(flock.l_whence);
17687c478bd9Sstevel@tonic-gate 		if (str != NULL)
17697c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%s", str);
17707c478bd9Sstevel@tonic-gate 		else
17717c478bd9Sstevel@tonic-gate 			(void) printf("  whence=%-8u", flock.l_whence);
17727c478bd9Sstevel@tonic-gate 
17737c478bd9Sstevel@tonic-gate 		(void) printf(
1774019c3c43Sraf 		    " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1775019c3c43Sraf 		    (long long)flock.l_start,
1776019c3c43Sraf 		    (long long)flock.l_len,
1777019c3c43Sraf 		    flock.l_sysid,
1778019c3c43Sraf 		    (int)flock.l_pid);
17797c478bd9Sstevel@tonic-gate 	}
17807c478bd9Sstevel@tonic-gate }
17817c478bd9Sstevel@tonic-gate 
17827c478bd9Sstevel@tonic-gate void
17837c478bd9Sstevel@tonic-gate show_share(private_t *pri, long offset)
17847c478bd9Sstevel@tonic-gate {
17857c478bd9Sstevel@tonic-gate 	struct fshare fshare;
17867c478bd9Sstevel@tonic-gate 
17877c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) {
17887c478bd9Sstevel@tonic-gate 		const char *str = NULL;
17897c478bd9Sstevel@tonic-gate 		int manddny = 0;
17907c478bd9Sstevel@tonic-gate 
17917c478bd9Sstevel@tonic-gate 		(void) printf("%s\taccess=", pri->pname);
17927c478bd9Sstevel@tonic-gate 
17937c478bd9Sstevel@tonic-gate 		switch (fshare.f_access) {
17947c478bd9Sstevel@tonic-gate 		case F_RDACC:
17957c478bd9Sstevel@tonic-gate 			str = "F_RDACC";
17967c478bd9Sstevel@tonic-gate 			break;
17977c478bd9Sstevel@tonic-gate 		case F_WRACC:
17987c478bd9Sstevel@tonic-gate 			str = "F_WRACC";
17997c478bd9Sstevel@tonic-gate 			break;
18007c478bd9Sstevel@tonic-gate 		case F_RWACC:
18017c478bd9Sstevel@tonic-gate 			str = "F_RWACC";
18027c478bd9Sstevel@tonic-gate 			break;
18037c478bd9Sstevel@tonic-gate 		}
18047c478bd9Sstevel@tonic-gate 		if (str != NULL)
18057c478bd9Sstevel@tonic-gate 			(void) printf("%s", str);
18067c478bd9Sstevel@tonic-gate 		else
18077c478bd9Sstevel@tonic-gate 			(void) printf("%-7d", fshare.f_access);
18087c478bd9Sstevel@tonic-gate 
18097c478bd9Sstevel@tonic-gate 		str = NULL;
18107c478bd9Sstevel@tonic-gate 		if (fshare.f_deny & F_MANDDNY) {
18117c478bd9Sstevel@tonic-gate 			fshare.f_deny &= ~F_MANDDNY;
18127c478bd9Sstevel@tonic-gate 			manddny = 1;
18137c478bd9Sstevel@tonic-gate 		}
18147c478bd9Sstevel@tonic-gate 		switch (fshare.f_deny) {
18157c478bd9Sstevel@tonic-gate 		case F_NODNY:
18167c478bd9Sstevel@tonic-gate 			str = "F_NODNY";
18177c478bd9Sstevel@tonic-gate 			break;
18187c478bd9Sstevel@tonic-gate 		case F_RDDNY:
18197c478bd9Sstevel@tonic-gate 			str = "F_RDDNY";
18207c478bd9Sstevel@tonic-gate 			break;
18217c478bd9Sstevel@tonic-gate 		case F_WRDNY:
18227c478bd9Sstevel@tonic-gate 			str = "F_WRDNY";
18237c478bd9Sstevel@tonic-gate 			break;
18247c478bd9Sstevel@tonic-gate 		case F_RWDNY:
18257c478bd9Sstevel@tonic-gate 			str = "F_RWDNY";
18267c478bd9Sstevel@tonic-gate 			break;
18277c478bd9Sstevel@tonic-gate 		case F_COMPAT:
18287c478bd9Sstevel@tonic-gate 			str = "F_COMPAT";
18297c478bd9Sstevel@tonic-gate 			break;
18307c478bd9Sstevel@tonic-gate 		}
18317c478bd9Sstevel@tonic-gate 		if (str != NULL) {
18327c478bd9Sstevel@tonic-gate 			if (manddny)
18337c478bd9Sstevel@tonic-gate 				(void) printf("  deny=F_MANDDNY|%s", str);
18347c478bd9Sstevel@tonic-gate 			else
18357c478bd9Sstevel@tonic-gate 				(void) printf("  deny=%s", str);
18367c478bd9Sstevel@tonic-gate 		} else {
18377c478bd9Sstevel@tonic-gate 			(void) printf("  deny=0x%x", manddny?
1838019c3c43Sraf 			    fshare.f_deny | F_MANDDNY : fshare.f_deny);
18397c478bd9Sstevel@tonic-gate 		}
18407c478bd9Sstevel@tonic-gate 
18417c478bd9Sstevel@tonic-gate 		(void) printf("  id=%x\n", fshare.f_id);
18427c478bd9Sstevel@tonic-gate 	}
18437c478bd9Sstevel@tonic-gate }
18447c478bd9Sstevel@tonic-gate 
18457c478bd9Sstevel@tonic-gate void
18467c478bd9Sstevel@tonic-gate show_ffg(private_t *pri)
18477c478bd9Sstevel@tonic-gate {
18487c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
18497c478bd9Sstevel@tonic-gate 	(void) putchar('\t');
18507c478bd9Sstevel@tonic-gate 	prt_ffg(pri, 0, pri->Rval1);
18517c478bd9Sstevel@tonic-gate 	(void) puts(pri->sys_string);
18527c478bd9Sstevel@tonic-gate }
18537c478bd9Sstevel@tonic-gate 
18547c478bd9Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */
18557c478bd9Sstevel@tonic-gate void
18567c478bd9Sstevel@tonic-gate show_fcntl(private_t *pri)
18577c478bd9Sstevel@tonic-gate {
18587c478bd9Sstevel@tonic-gate 	long offset;
18597c478bd9Sstevel@tonic-gate 
18607c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) {
18617c478bd9Sstevel@tonic-gate 		show_ffg(pri);
18627c478bd9Sstevel@tonic-gate 		return;
18637c478bd9Sstevel@tonic-gate 	}
18647c478bd9Sstevel@tonic-gate 
1865*27aa4812SToomas Soome 	if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == 0)
18667c478bd9Sstevel@tonic-gate 		return;
18677c478bd9Sstevel@tonic-gate 
18687c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[1]) {
18697c478bd9Sstevel@tonic-gate #ifdef _LP64
18707c478bd9Sstevel@tonic-gate 	case F_GETLK:
18717c478bd9Sstevel@tonic-gate 	case F_SETLK:
18727c478bd9Sstevel@tonic-gate 	case F_SETLKW:
18737c478bd9Sstevel@tonic-gate 	case F_FREESP:
18747c478bd9Sstevel@tonic-gate 	case F_ALLOCSP:
18757c478bd9Sstevel@tonic-gate 	case F_SETLK_NBMAND:
18767a5aac98SJerry Jelinek 	case F_OFD_GETLK:
18777a5aac98SJerry Jelinek 	case F_OFD_SETLK:
18787a5aac98SJerry Jelinek 	case F_OFD_SETLKW:
18797a5aac98SJerry Jelinek 	case F_FLOCK:
18807a5aac98SJerry Jelinek 	case F_FLOCKW:
18817c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
18827c478bd9Sstevel@tonic-gate 			show_flock64(pri, offset);
18837c478bd9Sstevel@tonic-gate 		else
18847c478bd9Sstevel@tonic-gate 			show_flock32(pri, offset);
18857c478bd9Sstevel@tonic-gate 		break;
18867c478bd9Sstevel@tonic-gate 	case 33:	/* F_GETLK64 */
18877c478bd9Sstevel@tonic-gate 	case 34:	/* F_SETLK64 */
18887c478bd9Sstevel@tonic-gate 	case 35:	/* F_SETLKW64 */
18897c478bd9Sstevel@tonic-gate 	case 27:	/* F_FREESP64 */
1890019c3c43Sraf 	case 28:	/* F_ALLOCSP64 */
18917c478bd9Sstevel@tonic-gate 	case 44:	/* F_SETLK64_NBMAND */
18927a5aac98SJerry Jelinek 	case 50:	/* F_OFD_GETLK64 */
18937a5aac98SJerry Jelinek 	case 51:	/* F_OFD_SETLK64 */
18947a5aac98SJerry Jelinek 	case 52:	/* F_OFD_SETLKW64 */
18957a5aac98SJerry Jelinek 	case 55:	/* F_FLOCK64 */
18967a5aac98SJerry Jelinek 	case 56:	/* F_FLOCKW64 */
18977c478bd9Sstevel@tonic-gate 		show_flock64(pri, offset);
18987c478bd9Sstevel@tonic-gate 		break;
18997c478bd9Sstevel@tonic-gate #else	/* _LP64 */
19007c478bd9Sstevel@tonic-gate 	case F_GETLK:
19017c478bd9Sstevel@tonic-gate 	case F_SETLK:
19027c478bd9Sstevel@tonic-gate 	case F_SETLKW:
19037c478bd9Sstevel@tonic-gate 	case F_FREESP:
19047c478bd9Sstevel@tonic-gate 	case F_ALLOCSP:
19057c478bd9Sstevel@tonic-gate 	case F_SETLK_NBMAND:
19067c478bd9Sstevel@tonic-gate 		show_flock32(pri, offset);
19077c478bd9Sstevel@tonic-gate 		break;
19087c478bd9Sstevel@tonic-gate 	case F_GETLK64:
19097c478bd9Sstevel@tonic-gate 	case F_SETLK64:
19107c478bd9Sstevel@tonic-gate 	case F_SETLKW64:
19117c478bd9Sstevel@tonic-gate 	case F_FREESP64:
1912019c3c43Sraf 	case F_ALLOCSP64:
19137c478bd9Sstevel@tonic-gate 	case F_SETLK64_NBMAND:
19147a5aac98SJerry Jelinek 	case F_OFD_GETLK64:
19157a5aac98SJerry Jelinek 	case F_OFD_SETLK64:
19167a5aac98SJerry Jelinek 	case F_OFD_SETLKW64:
19177a5aac98SJerry Jelinek 	case F_FLOCK64:
19187a5aac98SJerry Jelinek 	case F_FLOCKW64:
19197c478bd9Sstevel@tonic-gate 		show_flock64(pri, offset);
19207c478bd9Sstevel@tonic-gate 		break;
19217c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
19227c478bd9Sstevel@tonic-gate 	case F_SHARE:
19237c478bd9Sstevel@tonic-gate 	case F_UNSHARE:
19247c478bd9Sstevel@tonic-gate 		show_share(pri, offset);
19257c478bd9Sstevel@tonic-gate 		break;
19267c478bd9Sstevel@tonic-gate 	}
19277c478bd9Sstevel@tonic-gate }
19287c478bd9Sstevel@tonic-gate 
19297c478bd9Sstevel@tonic-gate void
19307c478bd9Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump)
19317c478bd9Sstevel@tonic-gate {
19327c478bd9Sstevel@tonic-gate 	struct strbuf strbuf;
19337c478bd9Sstevel@tonic-gate 
19347c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
19357c478bd9Sstevel@tonic-gate 		print_strbuf(pri, &strbuf, name, dump);
19367c478bd9Sstevel@tonic-gate }
19377c478bd9Sstevel@tonic-gate 
19387c478bd9Sstevel@tonic-gate #ifdef _LP64
19397c478bd9Sstevel@tonic-gate void
19407c478bd9Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump)
19417c478bd9Sstevel@tonic-gate {
19427c478bd9Sstevel@tonic-gate 	struct strbuf32 strbuf;
19437c478bd9Sstevel@tonic-gate 
19447c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
19457c478bd9Sstevel@tonic-gate 		print_strbuf32(pri, &strbuf, name, dump);
19467c478bd9Sstevel@tonic-gate }
19477c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
19487c478bd9Sstevel@tonic-gate 
19497c478bd9Sstevel@tonic-gate void
19507c478bd9Sstevel@tonic-gate show_gp_msg(private_t *pri, int what)
19517c478bd9Sstevel@tonic-gate {
19527c478bd9Sstevel@tonic-gate 	long offset;
19537c478bd9Sstevel@tonic-gate 	int dump = FALSE;
19547c478bd9Sstevel@tonic-gate 	int fdp1 = pri->sys_args[0] + 1;
19557c478bd9Sstevel@tonic-gate 
19567c478bd9Sstevel@tonic-gate 	switch (what) {
19577c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
19587c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
19597c478bd9Sstevel@tonic-gate 		if (pri->Errno == 0 && prismember(&readfd, fdp1))
19607c478bd9Sstevel@tonic-gate 			dump = TRUE;
19617c478bd9Sstevel@tonic-gate 		break;
19627c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
19637c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
19647c478bd9Sstevel@tonic-gate 		if (prismember(&writefd, fdp1))
19657c478bd9Sstevel@tonic-gate 			dump = TRUE;
19667c478bd9Sstevel@tonic-gate 		break;
19677c478bd9Sstevel@tonic-gate 	}
19687c478bd9Sstevel@tonic-gate 
19697c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
19707c478bd9Sstevel@tonic-gate 	if (dump)
19717c478bd9Sstevel@tonic-gate 		Eserialize();
19727c478bd9Sstevel@tonic-gate 
19737c478bd9Sstevel@tonic-gate #ifdef _LP64
1974*27aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0) {
19757c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
19767c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "ctl", dump);
19777c478bd9Sstevel@tonic-gate 		else
19787c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "ctl", dump);
19797c478bd9Sstevel@tonic-gate 	}
1980*27aa4812SToomas Soome 	if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != 0) {
19817c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
19827c478bd9Sstevel@tonic-gate 			show_strbuf(pri, offset, "dat", dump);
19837c478bd9Sstevel@tonic-gate 		else
19847c478bd9Sstevel@tonic-gate 			show_strbuf32(pri, offset, "dat", dump);
19857c478bd9Sstevel@tonic-gate 	}
19867c478bd9Sstevel@tonic-gate #else	/* _LP64 */
1987*27aa4812SToomas Soome 	if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0)
19887c478bd9Sstevel@tonic-gate 		show_strbuf(pri, offset, "ctl", dump);
1989*27aa4812SToomas Soome 	if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != 0)
19907c478bd9Sstevel@tonic-gate 		show_strbuf(pri, offset, "dat", dump);
19917c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
19927c478bd9Sstevel@tonic-gate 
19937c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
19947c478bd9Sstevel@tonic-gate 	if (dump)
19957c478bd9Sstevel@tonic-gate 		Xserialize();
19967c478bd9Sstevel@tonic-gate }
19977c478bd9Sstevel@tonic-gate 
19987c478bd9Sstevel@tonic-gate void
19997c478bd9Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name)
20007c478bd9Sstevel@tonic-gate {
20017c478bd9Sstevel@tonic-gate 	int value;
20027c478bd9Sstevel@tonic-gate 
20037c478bd9Sstevel@tonic-gate 	if (offset != 0 &&
20047c478bd9Sstevel@tonic-gate 	    Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
20057c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t%d\n",
2006019c3c43Sraf 		    pri->pname,
2007019c3c43Sraf 		    name,
2008019c3c43Sraf 		    value);
20097c478bd9Sstevel@tonic-gate }
20107c478bd9Sstevel@tonic-gate 
20117c478bd9Sstevel@tonic-gate void
20127c478bd9Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name)
20137c478bd9Sstevel@tonic-gate {
20147c478bd9Sstevel@tonic-gate 	int value;
20157c478bd9Sstevel@tonic-gate 
20167c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
20177c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s:\t0x%.4X\n",
2018019c3c43Sraf 		    pri->pname,
2019019c3c43Sraf 		    name,
2020019c3c43Sraf 		    value);
20217c478bd9Sstevel@tonic-gate }
20227c478bd9Sstevel@tonic-gate 
20237c478bd9Sstevel@tonic-gate #define	ALL_POLL_FLAGS	(POLLIN|POLLPRI|POLLOUT| \
20247c478bd9Sstevel@tonic-gate 	POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
20257c478bd9Sstevel@tonic-gate 
20267c478bd9Sstevel@tonic-gate const char *
20277c478bd9Sstevel@tonic-gate pollevent(private_t *pri, int arg)
20287c478bd9Sstevel@tonic-gate {
20297c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
20307c478bd9Sstevel@tonic-gate 
20317c478bd9Sstevel@tonic-gate 	if (arg == 0)
20327c478bd9Sstevel@tonic-gate 		return ("0");
20337c478bd9Sstevel@tonic-gate 	if (arg & ~ALL_POLL_FLAGS) {
20347c478bd9Sstevel@tonic-gate 		(void) sprintf(str, "0x%-5X", arg);
20357c478bd9Sstevel@tonic-gate 		return ((const char *)str);
20367c478bd9Sstevel@tonic-gate 	}
20377c478bd9Sstevel@tonic-gate 
20387c478bd9Sstevel@tonic-gate 	*str = '\0';
20397c478bd9Sstevel@tonic-gate 	if (arg & POLLIN)
20407c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLIN");
20417c478bd9Sstevel@tonic-gate 	if (arg & POLLPRI)
20427c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLPRI");
20437c478bd9Sstevel@tonic-gate 	if (arg & POLLOUT)
20447c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLOUT");
20457c478bd9Sstevel@tonic-gate 	if (arg & POLLRDNORM)
20467c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDNORM");
20477c478bd9Sstevel@tonic-gate 	if (arg & POLLRDBAND)
20487c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLRDBAND");
20497c478bd9Sstevel@tonic-gate 	if (arg & POLLWRBAND)
20507c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLWRBAND");
20517c478bd9Sstevel@tonic-gate 	if (arg & POLLERR)
20527c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLERR");
20537c478bd9Sstevel@tonic-gate 	if (arg & POLLHUP)
20547c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLHUP");
20557c478bd9Sstevel@tonic-gate 	if (arg & POLLNVAL)
20567c478bd9Sstevel@tonic-gate 		(void) strcat(str, "|POLLNVAL");
20577c478bd9Sstevel@tonic-gate 
20587c478bd9Sstevel@tonic-gate 	return ((const char *)(str+1));
20597c478bd9Sstevel@tonic-gate }
20607c478bd9Sstevel@tonic-gate 
20617c478bd9Sstevel@tonic-gate static void
20627c478bd9Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd)
20637c478bd9Sstevel@tonic-gate {
20647c478bd9Sstevel@tonic-gate 	/*
20657c478bd9Sstevel@tonic-gate 	 * can't print both events and revents in same printf.
20667c478bd9Sstevel@tonic-gate 	 * pollevent() returns a pointer to a TSD location.
20677c478bd9Sstevel@tonic-gate 	 */
20687c478bd9Sstevel@tonic-gate 	(void) printf("%s\tfd=%-2d ev=%s",
20697c478bd9Sstevel@tonic-gate 	    pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events));
20707c478bd9Sstevel@tonic-gate 	(void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents));
20717c478bd9Sstevel@tonic-gate }
20727c478bd9Sstevel@tonic-gate 
20737c478bd9Sstevel@tonic-gate static void
20747c478bd9Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds)
20757c478bd9Sstevel@tonic-gate {
20767c478bd9Sstevel@tonic-gate 	struct pollfd pollfd[2];
20777c478bd9Sstevel@tonic-gate 	int skip = -1;
20787c478bd9Sstevel@tonic-gate 
20797c478bd9Sstevel@tonic-gate 	for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) {
20807c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) !=
20817c478bd9Sstevel@tonic-gate 		    sizeof (struct pollfd))
20827c478bd9Sstevel@tonic-gate 			continue;
20837c478bd9Sstevel@tonic-gate 
20847c478bd9Sstevel@tonic-gate 		if (skip >= 0 && pollfd[0].fd == pollfd[1].fd &&
20857c478bd9Sstevel@tonic-gate 		    pollfd[0].events == pollfd[1].events &&
20867c478bd9Sstevel@tonic-gate 		    pollfd[0].revents == pollfd[1].revents) {
20877c478bd9Sstevel@tonic-gate 			skip++;
20887c478bd9Sstevel@tonic-gate 			continue;
20897c478bd9Sstevel@tonic-gate 		}
20907c478bd9Sstevel@tonic-gate 
20917c478bd9Sstevel@tonic-gate 		if (skip > 0)
20927c478bd9Sstevel@tonic-gate 			(void) printf("%s\t...last pollfd structure"
20937c478bd9Sstevel@tonic-gate 			    " repeated %d time%s...\n",
20947c478bd9Sstevel@tonic-gate 			    pri->pname, skip, (skip == 1 ? "" : "s"));
20957c478bd9Sstevel@tonic-gate 
20967c478bd9Sstevel@tonic-gate 		skip = 0;
20977c478bd9Sstevel@tonic-gate 		show_one_pollfd(pri, &pollfd[0]);
20987c478bd9Sstevel@tonic-gate 		pollfd[1] = pollfd[0];
20997c478bd9Sstevel@tonic-gate 	}
21007c478bd9Sstevel@tonic-gate 
21017c478bd9Sstevel@tonic-gate 	if (skip > 0)
21027c478bd9Sstevel@tonic-gate 		(void) printf(
21037c478bd9Sstevel@tonic-gate 		    "%s\t...last pollfd structure repeated %d time%s...\n",
21047c478bd9Sstevel@tonic-gate 		    pri->pname, skip, (skip == 1 ? "" : "s"));
21057c478bd9Sstevel@tonic-gate }
21067c478bd9Sstevel@tonic-gate 
21077c478bd9Sstevel@tonic-gate void
21087c478bd9Sstevel@tonic-gate show_pollsys(private_t *pri)
21097c478bd9Sstevel@tonic-gate {
21107c478bd9Sstevel@tonic-gate 	long offset;
21117c478bd9Sstevel@tonic-gate 	int nfds;
21127c478bd9Sstevel@tonic-gate 	int serial = 0;
21137c478bd9Sstevel@tonic-gate 
21147c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs < 2)
21157c478bd9Sstevel@tonic-gate 		return;
21167c478bd9Sstevel@tonic-gate 
21177c478bd9Sstevel@tonic-gate 	offset = pri->sys_args[0];
21187c478bd9Sstevel@tonic-gate 	nfds = pri->sys_args[1];
21197c478bd9Sstevel@tonic-gate 
21207c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
2121*27aa4812SToomas Soome 	if (offset != 0 && nfds > 32) {
21227c478bd9Sstevel@tonic-gate 		Eserialize();
21237c478bd9Sstevel@tonic-gate 		serial = 1;
21247c478bd9Sstevel@tonic-gate 	}
21257c478bd9Sstevel@tonic-gate 
2126*27aa4812SToomas Soome 	if (offset != 0 && nfds > 0)
21277c478bd9Sstevel@tonic-gate 		show_all_pollfds(pri, offset, nfds);
21287c478bd9Sstevel@tonic-gate 
21297c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 2)
21307c478bd9Sstevel@tonic-gate 		show_timestruc(pri, (long)pri->sys_args[2], "timeout");
21317c478bd9Sstevel@tonic-gate 
21327c478bd9Sstevel@tonic-gate 	if (pri->sys_nargs > 3)
21337c478bd9Sstevel@tonic-gate 		show_sigset(pri, (long)pri->sys_args[3], "sigmask");
21347c478bd9Sstevel@tonic-gate 
21357c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
21367c478bd9Sstevel@tonic-gate 	if (serial)
21377c478bd9Sstevel@tonic-gate 		Xserialize();
21387c478bd9Sstevel@tonic-gate }
21397c478bd9Sstevel@tonic-gate 
21407c478bd9Sstevel@tonic-gate static void
21417c478bd9Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip)
21427c478bd9Sstevel@tonic-gate {
2143f48205beScasper 	(void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
21447c478bd9Sstevel@tonic-gate 	    "m=0%.6o key=%d projid=%-5d\n",
21457c478bd9Sstevel@tonic-gate 	    pri->pname,
2146f48205beScasper 	    ip->ipcx_uid,
2147f48205beScasper 	    ip->ipcx_gid,
2148f48205beScasper 	    ip->ipcx_cuid,
2149f48205beScasper 	    ip->ipcx_cgid,
21507c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_zoneid,
21517c478bd9Sstevel@tonic-gate 	    (unsigned int)ip->ipcx_mode,
21527c478bd9Sstevel@tonic-gate 	    ip->ipcx_key,
21537c478bd9Sstevel@tonic-gate 	    (int)ip->ipcx_projid);
21547c478bd9Sstevel@tonic-gate }
21557c478bd9Sstevel@tonic-gate 
21567c478bd9Sstevel@tonic-gate void
21577c478bd9Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip)
21587c478bd9Sstevel@tonic-gate {
21597c478bd9Sstevel@tonic-gate 	(void) printf(
2160019c3c43Sraf 	    "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2161019c3c43Sraf 	    pri->pname,
2162019c3c43Sraf 	    ip->uid,
2163019c3c43Sraf 	    ip->gid,
2164019c3c43Sraf 	    ip->cuid,
2165019c3c43Sraf 	    ip->cgid,
2166019c3c43Sraf 	    (int)ip->mode,
2167019c3c43Sraf 	    ip->seq,
2168019c3c43Sraf 	    ip->key);
21697c478bd9Sstevel@tonic-gate }
21707c478bd9Sstevel@tonic-gate 
21717c478bd9Sstevel@tonic-gate #ifdef _LP64
21727c478bd9Sstevel@tonic-gate void
21737c478bd9Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip)
21747c478bd9Sstevel@tonic-gate {
21757c478bd9Sstevel@tonic-gate 	(void) printf(
2176019c3c43Sraf 	    "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2177019c3c43Sraf 	    pri->pname,
2178019c3c43Sraf 	    ip->uid,
2179019c3c43Sraf 	    ip->gid,
2180019c3c43Sraf 	    ip->cuid,
2181019c3c43Sraf 	    ip->cgid,
2182019c3c43Sraf 	    ip->mode,
2183019c3c43Sraf 	    ip->seq,
2184019c3c43Sraf 	    ip->key);
21857c478bd9Sstevel@tonic-gate }
21867c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
21877c478bd9Sstevel@tonic-gate 
21887c478bd9Sstevel@tonic-gate static void
21897c478bd9Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset)
21907c478bd9Sstevel@tonic-gate {
21917c478bd9Sstevel@tonic-gate 	struct msqid_ds64 msgq;
21927c478bd9Sstevel@tonic-gate 
2193*27aa4812SToomas Soome 	if (offset != 0 &&
21947c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21957c478bd9Sstevel@tonic-gate 		show_perm64(pri, &msgq.msgx_perm);
21967c478bd9Sstevel@tonic-gate 
21977c478bd9Sstevel@tonic-gate 		(void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
21987c478bd9Sstevel@tonic-gate 		    "lspid=%-5d lrpid=%-5d\n", pri->pname,
21997c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_cbytes,
22007c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qnum,
22017c478bd9Sstevel@tonic-gate 		    (unsigned long long)msgq.msgx_qbytes,
22027c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lspid,
22037c478bd9Sstevel@tonic-gate 		    (int)msgq.msgx_lrpid);
22047c478bd9Sstevel@tonic-gate 
22057c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", (time_t)msgq.msgx_stime);
22067c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", (time_t)msgq.msgx_rtime);
22077c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)msgq.msgx_ctime);
22087c478bd9Sstevel@tonic-gate 	}
22097c478bd9Sstevel@tonic-gate }
22107c478bd9Sstevel@tonic-gate 
22117c478bd9Sstevel@tonic-gate void
22127c478bd9Sstevel@tonic-gate show_msgctl(private_t *pri, long offset)
22137c478bd9Sstevel@tonic-gate {
22147c478bd9Sstevel@tonic-gate 	struct msqid_ds msgq;
22157c478bd9Sstevel@tonic-gate 
2216*27aa4812SToomas Soome 	if (offset != 0 &&
22177c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
22187c478bd9Sstevel@tonic-gate 		show_perm(pri, &msgq.msg_perm);
22197c478bd9Sstevel@tonic-gate 
22207c478bd9Sstevel@tonic-gate 		(void) printf(
22217c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2222019c3c43Sraf 		    pri->pname,
2223019c3c43Sraf 		    msgq.msg_cbytes,
2224019c3c43Sraf 		    msgq.msg_qnum,
2225019c3c43Sraf 		    msgq.msg_qbytes,
2226019c3c43Sraf 		    (int)msgq.msg_lspid,
2227019c3c43Sraf 		    (int)msgq.msg_lrpid);
22287c478bd9Sstevel@tonic-gate 
22297c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
22307c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
22317c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
22327c478bd9Sstevel@tonic-gate 	}
22337c478bd9Sstevel@tonic-gate }
22347c478bd9Sstevel@tonic-gate 
22357c478bd9Sstevel@tonic-gate #ifdef _LP64
22367c478bd9Sstevel@tonic-gate void
22377c478bd9Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset)
22387c478bd9Sstevel@tonic-gate {
22397c478bd9Sstevel@tonic-gate 	struct msqid_ds32 msgq;
22407c478bd9Sstevel@tonic-gate 
2241*27aa4812SToomas Soome 	if (offset != 0 &&
22427c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
22437c478bd9Sstevel@tonic-gate 		show_perm32(pri, &msgq.msg_perm);
22447c478bd9Sstevel@tonic-gate 
22457c478bd9Sstevel@tonic-gate 		(void) printf(
22467c478bd9Sstevel@tonic-gate 	"%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2247019c3c43Sraf 		    pri->pname,
2248019c3c43Sraf 		    msgq.msg_cbytes,
2249019c3c43Sraf 		    msgq.msg_qnum,
2250019c3c43Sraf 		    msgq.msg_qbytes,
2251019c3c43Sraf 		    msgq.msg_lspid,
2252019c3c43Sraf 		    msgq.msg_lrpid);
22537c478bd9Sstevel@tonic-gate 
22547c478bd9Sstevel@tonic-gate 		prtime(pri, "    st = ", msgq.msg_stime);
22557c478bd9Sstevel@tonic-gate 		prtime(pri, "    rt = ", msgq.msg_rtime);
22567c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", msgq.msg_ctime);
22577c478bd9Sstevel@tonic-gate 	}
22587c478bd9Sstevel@tonic-gate }
22597c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
22607c478bd9Sstevel@tonic-gate 
22617c478bd9Sstevel@tonic-gate void
22627c478bd9Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz)
22637c478bd9Sstevel@tonic-gate {
22647c478bd9Sstevel@tonic-gate 	struct msgbuf msgb;
22657c478bd9Sstevel@tonic-gate 
2266*27aa4812SToomas Soome 	if (offset != 0 &&
22677c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
22687c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
22697c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
22707c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22717c478bd9Sstevel@tonic-gate 			Eserialize();
22727c478bd9Sstevel@tonic-gate 
22737c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%lu  mtext[]=\n",
2274019c3c43Sraf 		    pri->pname,
2275019c3c43Sraf 		    msgb.mtype);
22767c478bd9Sstevel@tonic-gate 		showbuffer(pri,
2277019c3c43Sraf 		    (long)(offset + sizeof (msgb.mtype)), msgsz);
22787c478bd9Sstevel@tonic-gate 
22797c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
22807c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22817c478bd9Sstevel@tonic-gate 			Xserialize();
22827c478bd9Sstevel@tonic-gate 	}
22837c478bd9Sstevel@tonic-gate }
22847c478bd9Sstevel@tonic-gate 
22857c478bd9Sstevel@tonic-gate #ifdef _LP64
22867c478bd9Sstevel@tonic-gate void
22877c478bd9Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz)
22887c478bd9Sstevel@tonic-gate {
22897c478bd9Sstevel@tonic-gate 	struct ipcmsgbuf32 msgb;
22907c478bd9Sstevel@tonic-gate 
2291*27aa4812SToomas Soome 	if (offset != 0 &&
22927c478bd9Sstevel@tonic-gate 	    Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
22937c478bd9Sstevel@tonic-gate 	    sizeof (msgb.mtype)) {
22947c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
22957c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
22967c478bd9Sstevel@tonic-gate 			Eserialize();
22977c478bd9Sstevel@tonic-gate 
22987c478bd9Sstevel@tonic-gate 		(void) printf("%s\tmtype=%u  mtext[]=\n",
2299019c3c43Sraf 		    pri->pname,
2300019c3c43Sraf 		    msgb.mtype);
23017c478bd9Sstevel@tonic-gate 		showbuffer(pri,
2302019c3c43Sraf 		    (long)(offset + sizeof (msgb.mtype)), msgsz);
23037c478bd9Sstevel@tonic-gate 
23047c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
23057c478bd9Sstevel@tonic-gate 		if (msgsz > MYBUFSIZ / 4)
23067c478bd9Sstevel@tonic-gate 			Xserialize();
23077c478bd9Sstevel@tonic-gate 	}
23087c478bd9Sstevel@tonic-gate }
23097c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
23107c478bd9Sstevel@tonic-gate 
23117c478bd9Sstevel@tonic-gate #ifdef _LP64
23127c478bd9Sstevel@tonic-gate void
23137c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
23147c478bd9Sstevel@tonic-gate {
23157c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
23167c478bd9Sstevel@tonic-gate 	case 0:			/* msgget() */
23177c478bd9Sstevel@tonic-gate 		break;
23187c478bd9Sstevel@tonic-gate 	case 1:			/* msgctl() */
23197c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
23207c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
23217c478bd9Sstevel@tonic-gate 			case IPC_STAT:
23227c478bd9Sstevel@tonic-gate 				if (pri->Errno)
23237c478bd9Sstevel@tonic-gate 					break;
23247c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
23257c478bd9Sstevel@tonic-gate 			case IPC_SET:
23267c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
23277c478bd9Sstevel@tonic-gate 					show_msgctl(pri,
2328019c3c43Sraf 					    (long)pri->sys_args[3]);
23297c478bd9Sstevel@tonic-gate 				else
23307c478bd9Sstevel@tonic-gate 					show_msgctl32(pri,
2331019c3c43Sraf 					    (long)pri->sys_args[3]);
23327c478bd9Sstevel@tonic-gate 				break;
23337c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
23347c478bd9Sstevel@tonic-gate 				if (pri->Errno)
23357c478bd9Sstevel@tonic-gate 					break;
23367c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
23377c478bd9Sstevel@tonic-gate 			case IPC_SET64:
23387c478bd9Sstevel@tonic-gate 				show_msgctl64(pri, (long)pri->sys_args[3]);
23397c478bd9Sstevel@tonic-gate 				break;
23407c478bd9Sstevel@tonic-gate 			}
23417c478bd9Sstevel@tonic-gate 		}
23427c478bd9Sstevel@tonic-gate 		break;
23437c478bd9Sstevel@tonic-gate 	case 2:			/* msgrcv() */
23447c478bd9Sstevel@tonic-gate 		if (!pri->Errno && pri->sys_nargs > 2) {
23457c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
23467c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2], msgsz);
23477c478bd9Sstevel@tonic-gate 			else
23487c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2], msgsz);
23497c478bd9Sstevel@tonic-gate 		}
23507c478bd9Sstevel@tonic-gate 		break;
23517c478bd9Sstevel@tonic-gate 	case 3:			/* msgsnd() */
23527c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
23537c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
23547c478bd9Sstevel@tonic-gate 				show_msgbuf(pri, pri->sys_args[2],
2355019c3c43Sraf 				    pri->sys_args[3]);
23567c478bd9Sstevel@tonic-gate 			else
23577c478bd9Sstevel@tonic-gate 				show_msgbuf32(pri, pri->sys_args[2],
2358019c3c43Sraf 				    pri->sys_args[3]);
23597c478bd9Sstevel@tonic-gate 		}
23607c478bd9Sstevel@tonic-gate 		break;
23617c478bd9Sstevel@tonic-gate 	case 4:			/* msgids() */
23627c478bd9Sstevel@tonic-gate 	case 5:			/* msgsnap() */
23637c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
23647c478bd9Sstevel@tonic-gate 		break;
23657c478bd9Sstevel@tonic-gate 	}
23667c478bd9Sstevel@tonic-gate }
23677c478bd9Sstevel@tonic-gate #else	/* _LP64 */
23687c478bd9Sstevel@tonic-gate void
23697c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
23707c478bd9Sstevel@tonic-gate {
23717c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
23727c478bd9Sstevel@tonic-gate 	case 0:			/* msgget() */
23737c478bd9Sstevel@tonic-gate 		break;
23747c478bd9Sstevel@tonic-gate 	case 1:			/* msgctl() */
23757c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
23767c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
23777c478bd9Sstevel@tonic-gate 			case IPC_STAT:
23787c478bd9Sstevel@tonic-gate 				if (pri->Errno)
23797c478bd9Sstevel@tonic-gate 					break;
23807c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
23817c478bd9Sstevel@tonic-gate 			case IPC_SET:
23827c478bd9Sstevel@tonic-gate 				show_msgctl(pri, (long)pri->sys_args[3]);
23837c478bd9Sstevel@tonic-gate 				break;
23847c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
23857c478bd9Sstevel@tonic-gate 				if (pri->Errno)
23867c478bd9Sstevel@tonic-gate 					break;
23877c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
23887c478bd9Sstevel@tonic-gate 			case IPC_SET64:
23897c478bd9Sstevel@tonic-gate 				show_msgctl64(pri, (long)pri->sys_args[3]);
23907c478bd9Sstevel@tonic-gate 				break;
23917c478bd9Sstevel@tonic-gate 			}
23927c478bd9Sstevel@tonic-gate 		}
23937c478bd9Sstevel@tonic-gate 		break;
23947c478bd9Sstevel@tonic-gate 	case 2:			/* msgrcv() */
23957c478bd9Sstevel@tonic-gate 		if (!pri->Errno && pri->sys_nargs > 2)
23967c478bd9Sstevel@tonic-gate 			show_msgbuf(pri, pri->sys_args[2], msgsz);
23977c478bd9Sstevel@tonic-gate 		break;
23987c478bd9Sstevel@tonic-gate 	case 3:			/* msgsnd() */
23997c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
24007c478bd9Sstevel@tonic-gate 			show_msgbuf(pri, pri->sys_args[2],
2401019c3c43Sraf 			    pri->sys_args[3]);
24027c478bd9Sstevel@tonic-gate 		break;
24037c478bd9Sstevel@tonic-gate 	case 4:			/* msgids() */
24047c478bd9Sstevel@tonic-gate 	case 5:			/* msgsnap() */
24057c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
24067c478bd9Sstevel@tonic-gate 		break;
24077c478bd9Sstevel@tonic-gate 	}
24087c478bd9Sstevel@tonic-gate }
24097c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
24107c478bd9Sstevel@tonic-gate 
24117c478bd9Sstevel@tonic-gate static void
24127c478bd9Sstevel@tonic-gate show_semctl64(private_t *pri, long offset)
24137c478bd9Sstevel@tonic-gate {
24147c478bd9Sstevel@tonic-gate 	struct semid_ds64 semds;
24157c478bd9Sstevel@tonic-gate 
2416*27aa4812SToomas Soome 	if (offset != 0 &&
24177c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
24187c478bd9Sstevel@tonic-gate 		show_perm64(pri, &semds.semx_perm);
24197c478bd9Sstevel@tonic-gate 
24207c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems);
24217c478bd9Sstevel@tonic-gate 
24227c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", (time_t)semds.semx_otime);
24237c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)semds.semx_ctime);
24247c478bd9Sstevel@tonic-gate 	}
24257c478bd9Sstevel@tonic-gate }
24267c478bd9Sstevel@tonic-gate 
24277c478bd9Sstevel@tonic-gate void
24287c478bd9Sstevel@tonic-gate show_semctl(private_t *pri, long offset)
24297c478bd9Sstevel@tonic-gate {
24307c478bd9Sstevel@tonic-gate 	struct semid_ds semds;
24317c478bd9Sstevel@tonic-gate 
2432*27aa4812SToomas Soome 	if (offset != 0 &&
24337c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
24347c478bd9Sstevel@tonic-gate 		show_perm(pri, &semds.sem_perm);
24357c478bd9Sstevel@tonic-gate 
24367c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
2437019c3c43Sraf 		    pri->pname,
2438019c3c43Sraf 		    semds.sem_nsems);
24397c478bd9Sstevel@tonic-gate 
24407c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
24417c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
24427c478bd9Sstevel@tonic-gate 	}
24437c478bd9Sstevel@tonic-gate }
24447c478bd9Sstevel@tonic-gate 
24457c478bd9Sstevel@tonic-gate #ifdef _LP64
24467c478bd9Sstevel@tonic-gate void
24477c478bd9Sstevel@tonic-gate show_semctl32(private_t *pri, long offset)
24487c478bd9Sstevel@tonic-gate {
24497c478bd9Sstevel@tonic-gate 	struct semid_ds32 semds;
24507c478bd9Sstevel@tonic-gate 
2451*27aa4812SToomas Soome 	if (offset != 0 &&
24527c478bd9Sstevel@tonic-gate 	    Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
24537c478bd9Sstevel@tonic-gate 		show_perm32(pri, &semds.sem_perm);
24547c478bd9Sstevel@tonic-gate 
24557c478bd9Sstevel@tonic-gate 		(void) printf("%s\tnsems=%u\n",
2456019c3c43Sraf 		    pri->pname,
2457019c3c43Sraf 		    semds.sem_nsems);
24587c478bd9Sstevel@tonic-gate 
24597c478bd9Sstevel@tonic-gate 		prtime(pri, "    ot = ", semds.sem_otime);
24607c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", semds.sem_ctime);
24617c478bd9Sstevel@tonic-gate 	}
24627c478bd9Sstevel@tonic-gate }
24637c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
24647c478bd9Sstevel@tonic-gate 
24657c478bd9Sstevel@tonic-gate void
24667c478bd9Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout)
24677c478bd9Sstevel@tonic-gate {
24687c478bd9Sstevel@tonic-gate 	struct sembuf sembuf;
24697c478bd9Sstevel@tonic-gate 	const char *str;
24707c478bd9Sstevel@tonic-gate 
24713b862e9aSRoger A. Faulkner 	if (offset == 0)
24727c478bd9Sstevel@tonic-gate 		return;
24737c478bd9Sstevel@tonic-gate 
24747c478bd9Sstevel@tonic-gate 	if (nsops > 40)		/* let's not be ridiculous */
24757c478bd9Sstevel@tonic-gate 		nsops = 40;
24767c478bd9Sstevel@tonic-gate 
24777c478bd9Sstevel@tonic-gate 	for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) {
24787c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &sembuf, sizeof (sembuf), offset) !=
24797c478bd9Sstevel@tonic-gate 		    sizeof (sembuf))
24807c478bd9Sstevel@tonic-gate 			break;
24817c478bd9Sstevel@tonic-gate 
24827c478bd9Sstevel@tonic-gate 		(void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2483019c3c43Sraf 		    pri->pname,
2484019c3c43Sraf 		    sembuf.sem_num,
2485019c3c43Sraf 		    sembuf.sem_op);
24867c478bd9Sstevel@tonic-gate 
24877c478bd9Sstevel@tonic-gate 		if (sembuf.sem_flg == 0)
24887c478bd9Sstevel@tonic-gate 			(void) printf("0\n");
24897c478bd9Sstevel@tonic-gate 		else if ((str = semflags(pri, sembuf.sem_flg)) != NULL)
24907c478bd9Sstevel@tonic-gate 			(void) printf("%s\n", str);
24917c478bd9Sstevel@tonic-gate 		else
24927c478bd9Sstevel@tonic-gate 			(void) printf("0%.6o\n", sembuf.sem_flg);
24937c478bd9Sstevel@tonic-gate 	}
24947c478bd9Sstevel@tonic-gate 	if (timeout)
24957c478bd9Sstevel@tonic-gate 		show_timestruc(pri, timeout, "timeout");
24967c478bd9Sstevel@tonic-gate }
24977c478bd9Sstevel@tonic-gate 
24987c478bd9Sstevel@tonic-gate void
24997c478bd9Sstevel@tonic-gate show_semsys(private_t *pri)
25007c478bd9Sstevel@tonic-gate {
25017c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
25027c478bd9Sstevel@tonic-gate 	case 0:			/* semctl() */
25037c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4) {
25047c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[3]) {
25057c478bd9Sstevel@tonic-gate 			case IPC_STAT:
25067c478bd9Sstevel@tonic-gate 				if (pri->Errno)
25077c478bd9Sstevel@tonic-gate 					break;
25087c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
25097c478bd9Sstevel@tonic-gate 			case IPC_SET:
25107c478bd9Sstevel@tonic-gate #ifdef _LP64
25117c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
25127c478bd9Sstevel@tonic-gate 					show_semctl(pri,
2513019c3c43Sraf 					    (long)pri->sys_args[4]);
25147c478bd9Sstevel@tonic-gate 				else
25157c478bd9Sstevel@tonic-gate 					show_semctl32(pri,
2516019c3c43Sraf 					    (long)pri->sys_args[4]);
25177c478bd9Sstevel@tonic-gate #else
25187c478bd9Sstevel@tonic-gate 				show_semctl(pri, (long)pri->sys_args[4]);
25197c478bd9Sstevel@tonic-gate #endif
25207c478bd9Sstevel@tonic-gate 				break;
25217c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
25227c478bd9Sstevel@tonic-gate 				if (pri->Errno)
25237c478bd9Sstevel@tonic-gate 					break;
25247c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
25257c478bd9Sstevel@tonic-gate 			case IPC_SET64:
25267c478bd9Sstevel@tonic-gate 				show_semctl64(pri, (long)pri->sys_args[4]);
25277c478bd9Sstevel@tonic-gate 				break;
25287c478bd9Sstevel@tonic-gate 			}
25297c478bd9Sstevel@tonic-gate 		}
25307c478bd9Sstevel@tonic-gate 		break;
25317c478bd9Sstevel@tonic-gate 	case 1:			/* semget() */
25327c478bd9Sstevel@tonic-gate 		break;
25337c478bd9Sstevel@tonic-gate 	case 2:			/* semop() */
25347c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
25357c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
2536019c3c43Sraf 			    pri->sys_args[3], 0);
25377c478bd9Sstevel@tonic-gate 		break;
25387c478bd9Sstevel@tonic-gate 	case 3:			/* semids() */
25397c478bd9Sstevel@tonic-gate 		break;
25407c478bd9Sstevel@tonic-gate 	case 4:			/* semtimedop() */
25417c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
25427c478bd9Sstevel@tonic-gate 			show_semop(pri, (long)pri->sys_args[2],
2543019c3c43Sraf 			    pri->sys_args[3], pri->sys_args[4]);
25447c478bd9Sstevel@tonic-gate 		break;
25457c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
25467c478bd9Sstevel@tonic-gate 		break;
25477c478bd9Sstevel@tonic-gate 	}
25487c478bd9Sstevel@tonic-gate }
25497c478bd9Sstevel@tonic-gate 
25507c478bd9Sstevel@tonic-gate static void
25517c478bd9Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset)
25527c478bd9Sstevel@tonic-gate {
25537c478bd9Sstevel@tonic-gate 	struct shmid_ds64 shmds;
25547c478bd9Sstevel@tonic-gate 
2555*27aa4812SToomas Soome 	if (offset != 0 &&
25567c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
25577c478bd9Sstevel@tonic-gate 		show_perm64(pri, &shmds.shmx_perm);
25587c478bd9Sstevel@tonic-gate 
25597c478bd9Sstevel@tonic-gate 		(void) printf(
25607c478bd9Sstevel@tonic-gate 		    "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
25617c478bd9Sstevel@tonic-gate 		    pri->pname,
25627c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_segsz,
25637c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_lpid,
25647c478bd9Sstevel@tonic-gate 		    (int)shmds.shmx_cpid,
25657c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_nattch,
25667c478bd9Sstevel@tonic-gate 		    (unsigned long long)shmds.shmx_cnattch);
25677c478bd9Sstevel@tonic-gate 
25687c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", (time_t)shmds.shmx_atime);
25697c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", (time_t)shmds.shmx_dtime);
25707c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", (time_t)shmds.shmx_ctime);
25717c478bd9Sstevel@tonic-gate 	}
25727c478bd9Sstevel@tonic-gate }
25737c478bd9Sstevel@tonic-gate 
25747c478bd9Sstevel@tonic-gate void
25757c478bd9Sstevel@tonic-gate show_shmctl(private_t *pri, long offset)
25767c478bd9Sstevel@tonic-gate {
25777c478bd9Sstevel@tonic-gate 	struct shmid_ds shmds;
25787c478bd9Sstevel@tonic-gate 
2579*27aa4812SToomas Soome 	if (offset != 0 &&
25807c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
25817c478bd9Sstevel@tonic-gate 		show_perm(pri, &shmds.shm_perm);
25827c478bd9Sstevel@tonic-gate 
25837c478bd9Sstevel@tonic-gate 		(void) printf(
2584019c3c43Sraf 		    "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2585019c3c43Sraf 		    pri->pname,
2586019c3c43Sraf 		    (ulong_t)shmds.shm_segsz,
2587019c3c43Sraf 		    (int)shmds.shm_lpid,
2588019c3c43Sraf 		    (int)shmds.shm_cpid,
2589019c3c43Sraf 		    shmds.shm_nattch,
2590019c3c43Sraf 		    shmds.shm_cnattch);
25917c478bd9Sstevel@tonic-gate 
25927c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
25937c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
25947c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
25957c478bd9Sstevel@tonic-gate 	}
25967c478bd9Sstevel@tonic-gate }
25977c478bd9Sstevel@tonic-gate 
25987c478bd9Sstevel@tonic-gate #ifdef _LP64
25997c478bd9Sstevel@tonic-gate void
26007c478bd9Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset)
26017c478bd9Sstevel@tonic-gate {
26027c478bd9Sstevel@tonic-gate 	struct shmid_ds32 shmds;
26037c478bd9Sstevel@tonic-gate 
2604*27aa4812SToomas Soome 	if (offset != 0 &&
26057c478bd9Sstevel@tonic-gate 	    Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
26067c478bd9Sstevel@tonic-gate 		show_perm32(pri, &shmds.shm_perm);
26077c478bd9Sstevel@tonic-gate 
26087c478bd9Sstevel@tonic-gate 		(void) printf(
2609019c3c43Sraf 		    "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2610019c3c43Sraf 		    pri->pname,
2611019c3c43Sraf 		    shmds.shm_segsz,
2612019c3c43Sraf 		    shmds.shm_lpid,
2613019c3c43Sraf 		    shmds.shm_cpid,
2614019c3c43Sraf 		    shmds.shm_nattch,
2615019c3c43Sraf 		    shmds.shm_cnattch);
26167c478bd9Sstevel@tonic-gate 
26177c478bd9Sstevel@tonic-gate 		prtime(pri, "    at = ", shmds.shm_atime);
26187c478bd9Sstevel@tonic-gate 		prtime(pri, "    dt = ", shmds.shm_dtime);
26197c478bd9Sstevel@tonic-gate 		prtime(pri, "    ct = ", shmds.shm_ctime);
26207c478bd9Sstevel@tonic-gate 	}
26217c478bd9Sstevel@tonic-gate }
26227c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
26237c478bd9Sstevel@tonic-gate 
26247c478bd9Sstevel@tonic-gate void
26257c478bd9Sstevel@tonic-gate show_shmsys(private_t *pri)
26267c478bd9Sstevel@tonic-gate {
26277c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
26287c478bd9Sstevel@tonic-gate 	case 0:			/* shmat() */
26297c478bd9Sstevel@tonic-gate 		break;
26307c478bd9Sstevel@tonic-gate 	case 1:			/* shmctl() */
26317c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3) {
26327c478bd9Sstevel@tonic-gate 			switch (pri->sys_args[2]) {
26337c478bd9Sstevel@tonic-gate 			case IPC_STAT:
26347c478bd9Sstevel@tonic-gate 				if (pri->Errno)
26357c478bd9Sstevel@tonic-gate 					break;
26367c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
26377c478bd9Sstevel@tonic-gate 			case IPC_SET:
26387c478bd9Sstevel@tonic-gate #ifdef _LP64
26397c478bd9Sstevel@tonic-gate 				if (data_model == PR_MODEL_LP64)
26407c478bd9Sstevel@tonic-gate 					show_shmctl(pri,
2641019c3c43Sraf 					    (long)pri->sys_args[3]);
26427c478bd9Sstevel@tonic-gate 				else
26437c478bd9Sstevel@tonic-gate 					show_shmctl32(pri,
2644019c3c43Sraf 					    (long)pri->sys_args[3]);
26457c478bd9Sstevel@tonic-gate #else
26467c478bd9Sstevel@tonic-gate 				show_shmctl(pri, (long)pri->sys_args[3]);
26477c478bd9Sstevel@tonic-gate #endif
26487c478bd9Sstevel@tonic-gate 				break;
26497c478bd9Sstevel@tonic-gate 			case IPC_STAT64:
26507c478bd9Sstevel@tonic-gate 				if (pri->Errno)
26517c478bd9Sstevel@tonic-gate 					break;
26527c478bd9Sstevel@tonic-gate 				/*FALLTHROUGH*/
26537c478bd9Sstevel@tonic-gate 			case IPC_SET64:
26547c478bd9Sstevel@tonic-gate 				show_shmctl64(pri, (long)pri->sys_args[3]);
26557c478bd9Sstevel@tonic-gate 				break;
26567c478bd9Sstevel@tonic-gate 			}
26577c478bd9Sstevel@tonic-gate 		}
26587c478bd9Sstevel@tonic-gate 		break;
26597c478bd9Sstevel@tonic-gate 	case 2:			/* shmdt() */
26607c478bd9Sstevel@tonic-gate 	case 3:			/* shmget() */
26617c478bd9Sstevel@tonic-gate 	case 4:			/* shmids() */
26627c478bd9Sstevel@tonic-gate 	default:		/* unexpected subcode */
26637c478bd9Sstevel@tonic-gate 		break;
26647c478bd9Sstevel@tonic-gate 	}
26657c478bd9Sstevel@tonic-gate }
26667c478bd9Sstevel@tonic-gate 
26677c478bd9Sstevel@tonic-gate void
26687c478bd9Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count)
26697c478bd9Sstevel@tonic-gate {
26707c478bd9Sstevel@tonic-gate 	int groups[100];
26717c478bd9Sstevel@tonic-gate 
26727c478bd9Sstevel@tonic-gate 	if (count > 100)
26737c478bd9Sstevel@tonic-gate 		count = 100;
26747c478bd9Sstevel@tonic-gate 
2675*27aa4812SToomas Soome 	if (count > 0 && offset != 0 &&
26767c478bd9Sstevel@tonic-gate 	    Pread(Proc, &groups[0], count*sizeof (int), offset) ==
26777c478bd9Sstevel@tonic-gate 	    count*sizeof (int)) {
26787c478bd9Sstevel@tonic-gate 		int n;
26797c478bd9Sstevel@tonic-gate 
26807c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
26817c478bd9Sstevel@tonic-gate 		for (n = 0; !interrupt && n < count; n++) {
26827c478bd9Sstevel@tonic-gate 			if (n != 0 && n%10 == 0)
26837c478bd9Sstevel@tonic-gate 				(void) printf("\n%s\t", pri->pname);
26847c478bd9Sstevel@tonic-gate 			(void) printf(" %5d", groups[n]);
26857c478bd9Sstevel@tonic-gate 		}
26867c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
26877c478bd9Sstevel@tonic-gate 	}
26887c478bd9Sstevel@tonic-gate }
26897c478bd9Sstevel@tonic-gate 
26907c478bd9Sstevel@tonic-gate /*
26917c478bd9Sstevel@tonic-gate  * This assumes that a sigset_t is simply an array of ints.
26927c478bd9Sstevel@tonic-gate  */
26937c478bd9Sstevel@tonic-gate char *
26947c478bd9Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp)
26957c478bd9Sstevel@tonic-gate {
26967c478bd9Sstevel@tonic-gate 	char *s = pri->code_buf;
26977c478bd9Sstevel@tonic-gate 	int n = sizeof (*sp) / sizeof (int32_t);
26987c478bd9Sstevel@tonic-gate 	int32_t *lp = (int32_t *)sp;
26997c478bd9Sstevel@tonic-gate 
27007c478bd9Sstevel@tonic-gate 	while (--n >= 0) {
27017c478bd9Sstevel@tonic-gate 		int32_t val = *lp++;
27027c478bd9Sstevel@tonic-gate 
27037c478bd9Sstevel@tonic-gate 		if (val == 0)
27047c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0");
27057c478bd9Sstevel@tonic-gate 		else
27067c478bd9Sstevel@tonic-gate 			s += sprintf(s, " 0x%.8X", val);
27077c478bd9Sstevel@tonic-gate 	}
27087c478bd9Sstevel@tonic-gate 
27097c478bd9Sstevel@tonic-gate 	return (pri->code_buf);
27107c478bd9Sstevel@tonic-gate }
27117c478bd9Sstevel@tonic-gate 
27127c478bd9Sstevel@tonic-gate void
27137c478bd9Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name)
27147c478bd9Sstevel@tonic-gate {
27157c478bd9Sstevel@tonic-gate 	sigset_t sigset;
27167c478bd9Sstevel@tonic-gate 
2717*27aa4812SToomas Soome 	if (offset != 0 &&
27187c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) {
27197c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s =%s\n",
2720019c3c43Sraf 		    pri->pname, name, sigset_string(pri, &sigset));
27217c478bd9Sstevel@tonic-gate 	}
27227c478bd9Sstevel@tonic-gate }
27237c478bd9Sstevel@tonic-gate 
27247c478bd9Sstevel@tonic-gate #ifdef _LP64
27257c478bd9Sstevel@tonic-gate void
27267c478bd9Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name)
27277c478bd9Sstevel@tonic-gate {
27287c478bd9Sstevel@tonic-gate 	struct sigaltstack32 altstack;
27297c478bd9Sstevel@tonic-gate 
2730*27aa4812SToomas Soome 	if (offset != 0 &&
27317c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
27327c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
27337c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2734019c3c43Sraf 		    pri->pname,
2735019c3c43Sraf 		    name,
2736019c3c43Sraf 		    altstack.ss_sp,
2737019c3c43Sraf 		    altstack.ss_size,
2738019c3c43Sraf 		    altstack.ss_flags);
27397c478bd9Sstevel@tonic-gate 	}
27407c478bd9Sstevel@tonic-gate }
27417c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
27427c478bd9Sstevel@tonic-gate 
27437c478bd9Sstevel@tonic-gate void
27447c478bd9Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name)
27457c478bd9Sstevel@tonic-gate {
27467c478bd9Sstevel@tonic-gate 	struct sigaltstack altstack;
27477c478bd9Sstevel@tonic-gate 
27487c478bd9Sstevel@tonic-gate #ifdef _LP64
27497c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
27507c478bd9Sstevel@tonic-gate 		show_sigaltstack32(pri, offset, name);
27517c478bd9Sstevel@tonic-gate 		return;
27527c478bd9Sstevel@tonic-gate 	}
27537c478bd9Sstevel@tonic-gate #endif
2754*27aa4812SToomas Soome 	if (offset != 0 &&
27557c478bd9Sstevel@tonic-gate 	    Pread(Proc, &altstack, sizeof (altstack), offset) ==
27567c478bd9Sstevel@tonic-gate 	    sizeof (altstack)) {
27577c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2758019c3c43Sraf 		    pri->pname,
2759019c3c43Sraf 		    name,
2760019c3c43Sraf 		    (ulong_t)altstack.ss_sp,
2761019c3c43Sraf 		    (ulong_t)altstack.ss_size,
2762019c3c43Sraf 		    altstack.ss_flags);
27637c478bd9Sstevel@tonic-gate 	}
27647c478bd9Sstevel@tonic-gate }
27657c478bd9Sstevel@tonic-gate 
27667c478bd9Sstevel@tonic-gate #ifdef _LP64
27677c478bd9Sstevel@tonic-gate void
27687c478bd9Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp)
27697c478bd9Sstevel@tonic-gate {
27707c478bd9Sstevel@tonic-gate 	struct sigaction32 sigaction;
27717c478bd9Sstevel@tonic-gate 
2772*27aa4812SToomas Soome 	if (offset != 0 &&
27737c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
27747c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
27757c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
2776*27aa4812SToomas Soome 		if (odisp != 0)
27777c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (caddr32_t)odisp;
27787c478bd9Sstevel@tonic-gate 		(void) printf(
2779019c3c43Sraf 		    "%s    %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2780019c3c43Sraf 		    pri->pname,
2781019c3c43Sraf 		    name,
2782019c3c43Sraf 		    sigaction.sa_handler,
2783019c3c43Sraf 		    sigset_string(pri, (sigset_t *)&sigaction.sa_mask),
2784019c3c43Sraf 		    sigaction.sa_flags);
27857c478bd9Sstevel@tonic-gate 	}
27867c478bd9Sstevel@tonic-gate }
27877c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
27887c478bd9Sstevel@tonic-gate 
27897c478bd9Sstevel@tonic-gate void
27907c478bd9Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp)
27917c478bd9Sstevel@tonic-gate {
27927c478bd9Sstevel@tonic-gate 	struct sigaction sigaction;
27937c478bd9Sstevel@tonic-gate 
27947c478bd9Sstevel@tonic-gate #ifdef _LP64
27957c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
27967c478bd9Sstevel@tonic-gate 		show_sigaction32(pri, offset, name, odisp);
27977c478bd9Sstevel@tonic-gate 		return;
27987c478bd9Sstevel@tonic-gate 	}
27997c478bd9Sstevel@tonic-gate #endif
2800*27aa4812SToomas Soome 	if (offset != 0 &&
28017c478bd9Sstevel@tonic-gate 	    Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
28027c478bd9Sstevel@tonic-gate 	    sizeof (sigaction)) {
28037c478bd9Sstevel@tonic-gate 		/* This is stupid, we shouldn't have to do this */
2804*27aa4812SToomas Soome 		if (odisp != 0)
28057c478bd9Sstevel@tonic-gate 			sigaction.sa_handler = (void (*)())odisp;
28067c478bd9Sstevel@tonic-gate 		(void) printf(
2807019c3c43Sraf 		    "%s    %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2808019c3c43Sraf 		    pri->pname,
2809019c3c43Sraf 		    name,
2810019c3c43Sraf 		    (long)sigaction.sa_handler,
2811019c3c43Sraf 		    sigset_string(pri, &sigaction.sa_mask),
2812019c3c43Sraf 		    sigaction.sa_flags);
28137c478bd9Sstevel@tonic-gate 	}
28147c478bd9Sstevel@tonic-gate }
28157c478bd9Sstevel@tonic-gate 
28167c478bd9Sstevel@tonic-gate #ifdef _LP64
28177c478bd9Sstevel@tonic-gate void
28187c478bd9Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip)
28197c478bd9Sstevel@tonic-gate {
28207c478bd9Sstevel@tonic-gate 	const char *code = NULL;
28217c478bd9Sstevel@tonic-gate 
28227c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
2823019c3c43Sraf 	    signame(pri, sip->si_signo));
28247c478bd9Sstevel@tonic-gate 
28257c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
28267c478bd9Sstevel@tonic-gate 		(void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid);
28277c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
28287c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
28297c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
28307c478bd9Sstevel@tonic-gate 		return;
28317c478bd9Sstevel@tonic-gate 	}
28327c478bd9Sstevel@tonic-gate 
28337c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
28347c478bd9Sstevel@tonic-gate 	default:
28357c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
28367c478bd9Sstevel@tonic-gate 		return;
28377c478bd9Sstevel@tonic-gate 	case SIGILL:
28387c478bd9Sstevel@tonic-gate 	case SIGTRAP:
28397c478bd9Sstevel@tonic-gate 	case SIGFPE:
28407c478bd9Sstevel@tonic-gate 	case SIGSEGV:
28417c478bd9Sstevel@tonic-gate 	case SIGBUS:
28427c478bd9Sstevel@tonic-gate 	case SIGEMT:
28437c478bd9Sstevel@tonic-gate 	case SIGCLD:
28447c478bd9Sstevel@tonic-gate 	case SIGPOLL:
28457c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
28467c478bd9Sstevel@tonic-gate 		break;
28477c478bd9Sstevel@tonic-gate 	}
28487c478bd9Sstevel@tonic-gate 
28497c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
28507c478bd9Sstevel@tonic-gate 	case SIGILL:
28517c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28527c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
28537c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
28547c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
28557c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
28567c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
28577c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
28587c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
28597c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
28607c478bd9Sstevel@tonic-gate 		}
28617c478bd9Sstevel@tonic-gate 		break;
28627c478bd9Sstevel@tonic-gate 	case SIGTRAP:
28637c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28647c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
28657c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
28667c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
28677c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
28687c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
28697c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
28707c478bd9Sstevel@tonic-gate 		}
28717c478bd9Sstevel@tonic-gate 		break;
28727c478bd9Sstevel@tonic-gate 	case SIGFPE:
28737c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28747c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
28757c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
28767c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
28777c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
28787c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
28797c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
28807c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
28817c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
28827c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
28837c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
28847c478bd9Sstevel@tonic-gate #endif
28857c478bd9Sstevel@tonic-gate 		}
28867c478bd9Sstevel@tonic-gate 		break;
28877c478bd9Sstevel@tonic-gate 	case SIGSEGV:
28887c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28897c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
28907c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
28917c478bd9Sstevel@tonic-gate 		}
28927c478bd9Sstevel@tonic-gate 		break;
28937c478bd9Sstevel@tonic-gate 	case SIGEMT:
28947c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
28957c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
28967c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
28977c478bd9Sstevel@tonic-gate #endif
28987c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
28997c478bd9Sstevel@tonic-gate 		}
29007c478bd9Sstevel@tonic-gate 		break;
29017c478bd9Sstevel@tonic-gate 	case SIGBUS:
29027c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29037c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
29047c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
29057c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
29067c478bd9Sstevel@tonic-gate 		}
29077c478bd9Sstevel@tonic-gate 		break;
29087c478bd9Sstevel@tonic-gate 	case SIGCLD:
29097c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29107c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
29117c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
29127c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
29137c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
29147c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
29157c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
29167c478bd9Sstevel@tonic-gate 		}
29177c478bd9Sstevel@tonic-gate 		break;
29187c478bd9Sstevel@tonic-gate 	case SIGPOLL:
29197c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
29207c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
29217c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
29227c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
29237c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
29247c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
29257c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
29267c478bd9Sstevel@tonic-gate 		}
29277c478bd9Sstevel@tonic-gate 		break;
29287c478bd9Sstevel@tonic-gate 	}
29297c478bd9Sstevel@tonic-gate 
29307c478bd9Sstevel@tonic-gate 	if (code == NULL) {
29317c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
29327c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
29337c478bd9Sstevel@tonic-gate 	}
29347c478bd9Sstevel@tonic-gate 
29357c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
29367c478bd9Sstevel@tonic-gate 	case SIGILL:
29377c478bd9Sstevel@tonic-gate 	case SIGTRAP:
29387c478bd9Sstevel@tonic-gate 	case SIGFPE:
29397c478bd9Sstevel@tonic-gate 	case SIGSEGV:
29407c478bd9Sstevel@tonic-gate 	case SIGBUS:
29417c478bd9Sstevel@tonic-gate 	case SIGEMT:
29427c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8X",
2943019c3c43Sraf 		    code,
2944019c3c43Sraf 		    sip->si_addr);
29457c478bd9Sstevel@tonic-gate 		break;
29467c478bd9Sstevel@tonic-gate 	case SIGCLD:
29477c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
2948019c3c43Sraf 		    code,
2949019c3c43Sraf 		    sip->si_pid,
2950019c3c43Sraf 		    sip->si_status);
29517c478bd9Sstevel@tonic-gate 		break;
29527c478bd9Sstevel@tonic-gate 	case SIGPOLL:
29537c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
29547c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%d",
2955019c3c43Sraf 		    code,
2956019c3c43Sraf 		    sip->si_fd,
2957019c3c43Sraf 		    sip->si_band);
29587c478bd9Sstevel@tonic-gate 		break;
29597c478bd9Sstevel@tonic-gate 	}
29607c478bd9Sstevel@tonic-gate 
29617c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
29627c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
29637c478bd9Sstevel@tonic-gate 
29647c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
29657c478bd9Sstevel@tonic-gate 		if (ename != NULL)
29667c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
29677c478bd9Sstevel@tonic-gate 	}
29687c478bd9Sstevel@tonic-gate 
29697c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
29707c478bd9Sstevel@tonic-gate }
29717c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
29727c478bd9Sstevel@tonic-gate 
29737c478bd9Sstevel@tonic-gate void
29747c478bd9Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip)
29757c478bd9Sstevel@tonic-gate {
29767c478bd9Sstevel@tonic-gate 	const char *code = NULL;
29777c478bd9Sstevel@tonic-gate 
29787c478bd9Sstevel@tonic-gate 	(void) printf("%s      siginfo: %s", pri->pname,
2979019c3c43Sraf 	    signame(pri, sip->si_signo));
29807c478bd9Sstevel@tonic-gate 
29817c478bd9Sstevel@tonic-gate 	if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
2982f48205beScasper 		(void) printf(" pid=%d uid=%u",
29837c478bd9Sstevel@tonic-gate 		    (int)sip->si_pid,
2984f48205beScasper 		    sip->si_uid);
29857c478bd9Sstevel@tonic-gate 		if (sip->si_code != 0)
29867c478bd9Sstevel@tonic-gate 			(void) printf(" code=%d", sip->si_code);
29877c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
29887c478bd9Sstevel@tonic-gate 		return;
29897c478bd9Sstevel@tonic-gate 	}
29907c478bd9Sstevel@tonic-gate 
29917c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
29927c478bd9Sstevel@tonic-gate 	default:
29937c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
29947c478bd9Sstevel@tonic-gate 		return;
29957c478bd9Sstevel@tonic-gate 	case SIGILL:
29967c478bd9Sstevel@tonic-gate 	case SIGTRAP:
29977c478bd9Sstevel@tonic-gate 	case SIGFPE:
29987c478bd9Sstevel@tonic-gate 	case SIGSEGV:
29997c478bd9Sstevel@tonic-gate 	case SIGBUS:
30007c478bd9Sstevel@tonic-gate 	case SIGEMT:
30017c478bd9Sstevel@tonic-gate 	case SIGCLD:
30027c478bd9Sstevel@tonic-gate 	case SIGPOLL:
30037c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
30047c478bd9Sstevel@tonic-gate 		break;
30057c478bd9Sstevel@tonic-gate 	}
30067c478bd9Sstevel@tonic-gate 
30077c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
30087c478bd9Sstevel@tonic-gate 	case SIGILL:
30097c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30107c478bd9Sstevel@tonic-gate 		case ILL_ILLOPC:	code = "ILL_ILLOPC";	break;
30117c478bd9Sstevel@tonic-gate 		case ILL_ILLOPN:	code = "ILL_ILLOPN";	break;
30127c478bd9Sstevel@tonic-gate 		case ILL_ILLADR:	code = "ILL_ILLADR";	break;
30137c478bd9Sstevel@tonic-gate 		case ILL_ILLTRP:	code = "ILL_ILLTRP";	break;
30147c478bd9Sstevel@tonic-gate 		case ILL_PRVOPC:	code = "ILL_PRVOPC";	break;
30157c478bd9Sstevel@tonic-gate 		case ILL_PRVREG:	code = "ILL_PRVREG";	break;
30167c478bd9Sstevel@tonic-gate 		case ILL_COPROC:	code = "ILL_COPROC";	break;
30177c478bd9Sstevel@tonic-gate 		case ILL_BADSTK:	code = "ILL_BADSTK";	break;
30187c478bd9Sstevel@tonic-gate 		}
30197c478bd9Sstevel@tonic-gate 		break;
30207c478bd9Sstevel@tonic-gate 	case SIGTRAP:
30217c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30227c478bd9Sstevel@tonic-gate 		case TRAP_BRKPT:	code = "TRAP_BRKPT";	break;
30237c478bd9Sstevel@tonic-gate 		case TRAP_TRACE:	code = "TRAP_TRACE";	break;
30247c478bd9Sstevel@tonic-gate 		case TRAP_RWATCH:	code = "TRAP_RWATCH";	break;
30257c478bd9Sstevel@tonic-gate 		case TRAP_WWATCH:	code = "TRAP_WWATCH";	break;
30267c478bd9Sstevel@tonic-gate 		case TRAP_XWATCH:	code = "TRAP_XWATCH";	break;
30277c478bd9Sstevel@tonic-gate 		case TRAP_DTRACE:	code = "TRAP_DTRACE";	break;
30287c478bd9Sstevel@tonic-gate 		}
30297c478bd9Sstevel@tonic-gate 		break;
30307c478bd9Sstevel@tonic-gate 	case SIGFPE:
30317c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30327c478bd9Sstevel@tonic-gate 		case FPE_INTDIV:	code = "FPE_INTDIV";	break;
30337c478bd9Sstevel@tonic-gate 		case FPE_INTOVF:	code = "FPE_INTOVF";	break;
30347c478bd9Sstevel@tonic-gate 		case FPE_FLTDIV:	code = "FPE_FLTDIV";	break;
30357c478bd9Sstevel@tonic-gate 		case FPE_FLTOVF:	code = "FPE_FLTOVF";	break;
30367c478bd9Sstevel@tonic-gate 		case FPE_FLTUND:	code = "FPE_FLTUND";	break;
30377c478bd9Sstevel@tonic-gate 		case FPE_FLTRES:	code = "FPE_FLTRES";	break;
30387c478bd9Sstevel@tonic-gate 		case FPE_FLTINV:	code = "FPE_FLTINV";	break;
30397c478bd9Sstevel@tonic-gate 		case FPE_FLTSUB:	code = "FPE_FLTSUB";	break;
30407c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
30417c478bd9Sstevel@tonic-gate 		case FPE_FLTDEN:	code = "FPE_FLTDEN";	break;
30427c478bd9Sstevel@tonic-gate #endif
30437c478bd9Sstevel@tonic-gate 		}
30447c478bd9Sstevel@tonic-gate 		break;
30457c478bd9Sstevel@tonic-gate 	case SIGSEGV:
30467c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30477c478bd9Sstevel@tonic-gate 		case SEGV_MAPERR:	code = "SEGV_MAPERR";	break;
30487c478bd9Sstevel@tonic-gate 		case SEGV_ACCERR:	code = "SEGV_ACCERR";	break;
30497c478bd9Sstevel@tonic-gate 		}
30507c478bd9Sstevel@tonic-gate 		break;
30517c478bd9Sstevel@tonic-gate 	case SIGEMT:
30527c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30537c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
30547c478bd9Sstevel@tonic-gate 		case EMT_TAGOVF:	code = "EMT_TAGOVF";	break;
30557c478bd9Sstevel@tonic-gate #endif
30567c478bd9Sstevel@tonic-gate 		case EMT_CPCOVF:	code = "EMT_CPCOVF";	break;
30577c478bd9Sstevel@tonic-gate 		}
30587c478bd9Sstevel@tonic-gate 		break;
30597c478bd9Sstevel@tonic-gate 	case SIGBUS:
30607c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30617c478bd9Sstevel@tonic-gate 		case BUS_ADRALN:	code = "BUS_ADRALN";	break;
30627c478bd9Sstevel@tonic-gate 		case BUS_ADRERR:	code = "BUS_ADRERR";	break;
30637c478bd9Sstevel@tonic-gate 		case BUS_OBJERR:	code = "BUS_OBJERR";	break;
30647c478bd9Sstevel@tonic-gate 		}
30657c478bd9Sstevel@tonic-gate 		break;
30667c478bd9Sstevel@tonic-gate 	case SIGCLD:
30677c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30687c478bd9Sstevel@tonic-gate 		case CLD_EXITED:	code = "CLD_EXITED";	break;
30697c478bd9Sstevel@tonic-gate 		case CLD_KILLED:	code = "CLD_KILLED";	break;
30707c478bd9Sstevel@tonic-gate 		case CLD_DUMPED:	code = "CLD_DUMPED";	break;
30717c478bd9Sstevel@tonic-gate 		case CLD_TRAPPED:	code = "CLD_TRAPPED";	break;
30727c478bd9Sstevel@tonic-gate 		case CLD_STOPPED:	code = "CLD_STOPPED";	break;
30737c478bd9Sstevel@tonic-gate 		case CLD_CONTINUED:	code = "CLD_CONTINUED";	break;
30747c478bd9Sstevel@tonic-gate 		}
30757c478bd9Sstevel@tonic-gate 		break;
30767c478bd9Sstevel@tonic-gate 	case SIGPOLL:
30777c478bd9Sstevel@tonic-gate 		switch (sip->si_code) {
30787c478bd9Sstevel@tonic-gate 		case POLL_IN:		code = "POLL_IN";	break;
30797c478bd9Sstevel@tonic-gate 		case POLL_OUT:		code = "POLL_OUT";	break;
30807c478bd9Sstevel@tonic-gate 		case POLL_MSG:		code = "POLL_MSG";	break;
30817c478bd9Sstevel@tonic-gate 		case POLL_ERR:		code = "POLL_ERR";	break;
30827c478bd9Sstevel@tonic-gate 		case POLL_PRI:		code = "POLL_PRI";	break;
30837c478bd9Sstevel@tonic-gate 		case POLL_HUP:		code = "POLL_HUP";	break;
30847c478bd9Sstevel@tonic-gate 		}
30857c478bd9Sstevel@tonic-gate 		break;
30867c478bd9Sstevel@tonic-gate 	}
30877c478bd9Sstevel@tonic-gate 
30887c478bd9Sstevel@tonic-gate 	if (code == NULL) {
30897c478bd9Sstevel@tonic-gate 		(void) sprintf(pri->code_buf, "code=%d", sip->si_code);
30907c478bd9Sstevel@tonic-gate 		code = (const char *)pri->code_buf;
30917c478bd9Sstevel@tonic-gate 	}
30927c478bd9Sstevel@tonic-gate 
30937c478bd9Sstevel@tonic-gate 	switch (sip->si_signo) {
30947c478bd9Sstevel@tonic-gate 	case SIGILL:
30957c478bd9Sstevel@tonic-gate 	case SIGTRAP:
30967c478bd9Sstevel@tonic-gate 	case SIGFPE:
30977c478bd9Sstevel@tonic-gate 	case SIGSEGV:
30987c478bd9Sstevel@tonic-gate 	case SIGBUS:
30997c478bd9Sstevel@tonic-gate 	case SIGEMT:
31007c478bd9Sstevel@tonic-gate 		(void) printf(" %s addr=0x%.8lX",
3101019c3c43Sraf 		    code,
3102019c3c43Sraf 		    (long)sip->si_addr);
31037c478bd9Sstevel@tonic-gate 		break;
31047c478bd9Sstevel@tonic-gate 	case SIGCLD:
31057c478bd9Sstevel@tonic-gate 		(void) printf(" %s pid=%d status=0x%.4X",
3106019c3c43Sraf 		    code,
3107019c3c43Sraf 		    (int)sip->si_pid,
3108019c3c43Sraf 		    sip->si_status);
31097c478bd9Sstevel@tonic-gate 		break;
31107c478bd9Sstevel@tonic-gate 	case SIGPOLL:
31117c478bd9Sstevel@tonic-gate 	case SIGXFSZ:
31127c478bd9Sstevel@tonic-gate 		(void) printf(" %s fd=%d band=%ld",
3113019c3c43Sraf 		    code,
3114019c3c43Sraf 		    sip->si_fd,
3115019c3c43Sraf 		    sip->si_band);
31167c478bd9Sstevel@tonic-gate 		break;
31177c478bd9Sstevel@tonic-gate 	}
31187c478bd9Sstevel@tonic-gate 
31197c478bd9Sstevel@tonic-gate 	if (sip->si_errno != 0) {
31207c478bd9Sstevel@tonic-gate 		const char *ename = errname(sip->si_errno);
31217c478bd9Sstevel@tonic-gate 
31227c478bd9Sstevel@tonic-gate 		(void) printf(" errno=%d", sip->si_errno);
31237c478bd9Sstevel@tonic-gate 		if (ename != NULL)
31247c478bd9Sstevel@tonic-gate 			(void) printf("(%s)", ename);
31257c478bd9Sstevel@tonic-gate 	}
31267c478bd9Sstevel@tonic-gate 
31277c478bd9Sstevel@tonic-gate 	(void) fputc('\n', stdout);
31287c478bd9Sstevel@tonic-gate }
31297c478bd9Sstevel@tonic-gate 
31307c478bd9Sstevel@tonic-gate #ifdef _LP64
31317c478bd9Sstevel@tonic-gate void
31327c478bd9Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset)
31337c478bd9Sstevel@tonic-gate {
31347c478bd9Sstevel@tonic-gate 	struct siginfo32 siginfo;
31357c478bd9Sstevel@tonic-gate 
3136*27aa4812SToomas Soome 	if (offset != 0 &&
31377c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
31387c478bd9Sstevel@tonic-gate 		print_siginfo32(pri, &siginfo);
31397c478bd9Sstevel@tonic-gate }
31407c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
31417c478bd9Sstevel@tonic-gate 
31427c478bd9Sstevel@tonic-gate void
31437c478bd9Sstevel@tonic-gate show_siginfo(private_t *pri, long offset)
31447c478bd9Sstevel@tonic-gate {
31457c478bd9Sstevel@tonic-gate 	struct siginfo siginfo;
31467c478bd9Sstevel@tonic-gate 
31477c478bd9Sstevel@tonic-gate #ifdef _LP64
31487c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
31497c478bd9Sstevel@tonic-gate 		show_siginfo32(pri, offset);
31507c478bd9Sstevel@tonic-gate 		return;
31517c478bd9Sstevel@tonic-gate 	}
31527c478bd9Sstevel@tonic-gate #endif
3153*27aa4812SToomas Soome 	if (offset != 0 &&
31547c478bd9Sstevel@tonic-gate 	    Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
31557c478bd9Sstevel@tonic-gate 		print_siginfo(pri, &siginfo);
31567c478bd9Sstevel@tonic-gate }
31577c478bd9Sstevel@tonic-gate 
31587c478bd9Sstevel@tonic-gate void
31597c478bd9Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count)
31607c478bd9Sstevel@tonic-gate {
31617c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4);
31627c478bd9Sstevel@tonic-gate 
31637c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
31647c478bd9Sstevel@tonic-gate 	if (serial)
31657c478bd9Sstevel@tonic-gate 		Eserialize();
31667c478bd9Sstevel@tonic-gate 
31677c478bd9Sstevel@tonic-gate 	while (count > 0) {
31687c478bd9Sstevel@tonic-gate 		char buf[32];
31697c478bd9Sstevel@tonic-gate 		int nb = (count < 32)? count : 32;
31707c478bd9Sstevel@tonic-gate 		int i;
31717c478bd9Sstevel@tonic-gate 
31727c478bd9Sstevel@tonic-gate 		if (Pread(Proc, buf, (size_t)nb, offset) != nb)
31737c478bd9Sstevel@tonic-gate 			break;
31747c478bd9Sstevel@tonic-gate 
31757c478bd9Sstevel@tonic-gate 		(void) printf("%s   ", pri->pname);
31767c478bd9Sstevel@tonic-gate 		for (i = 0; i < nb; i++)
31777c478bd9Sstevel@tonic-gate 			(void) printf(" %d", buf[i]);
31787c478bd9Sstevel@tonic-gate 		(void) fputc('\n', stdout);
31797c478bd9Sstevel@tonic-gate 
31807c478bd9Sstevel@tonic-gate 		count -= nb;
31817c478bd9Sstevel@tonic-gate 		offset += nb;
31827c478bd9Sstevel@tonic-gate 	}
31837c478bd9Sstevel@tonic-gate 
31847c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
31857c478bd9Sstevel@tonic-gate 	if (serial)
31867c478bd9Sstevel@tonic-gate 		Xserialize();
31877c478bd9Sstevel@tonic-gate }
31887c478bd9Sstevel@tonic-gate 
31897c478bd9Sstevel@tonic-gate #ifdef _LP64
31907c478bd9Sstevel@tonic-gate void
31917c478bd9Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count)
31927c478bd9Sstevel@tonic-gate {
31937c478bd9Sstevel@tonic-gate 	iovec32_t iovec[16];
31947c478bd9Sstevel@tonic-gate 	iovec32_t *ip;
31957c478bd9Sstevel@tonic-gate 	long nb;
31967c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
31977c478bd9Sstevel@tonic-gate 
31987c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
31997c478bd9Sstevel@tonic-gate 		niov = 16;
32007c478bd9Sstevel@tonic-gate 
3201*27aa4812SToomas Soome 	if (offset != 0 && niov > 0 &&
32027c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset)
32037c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec32_t)) {
32047c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
32057c478bd9Sstevel@tonic-gate 		if (serial)
32067c478bd9Sstevel@tonic-gate 			Eserialize();
32077c478bd9Sstevel@tonic-gate 
32087c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
32097c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8X  iov_len = %d\n",
3210019c3c43Sraf 			    pri->pname,
3211019c3c43Sraf 			    ip->iov_base,
3212019c3c43Sraf 			    ip->iov_len);
32137c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
32147c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
32157c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
32167c478bd9Sstevel@tonic-gate 				if (nb > 0)
32177c478bd9Sstevel@tonic-gate 					count -= nb;
32187c478bd9Sstevel@tonic-gate 			}
32197c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
32207c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
32217c478bd9Sstevel@tonic-gate 		}
32227c478bd9Sstevel@tonic-gate 
32237c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
32247c478bd9Sstevel@tonic-gate 		if (serial)
32257c478bd9Sstevel@tonic-gate 			Xserialize();
32267c478bd9Sstevel@tonic-gate 	}
32277c478bd9Sstevel@tonic-gate }
32287c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
32297c478bd9Sstevel@tonic-gate 
32307c478bd9Sstevel@tonic-gate void
32317c478bd9Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count)
32327c478bd9Sstevel@tonic-gate {
32337c478bd9Sstevel@tonic-gate 	iovec_t iovec[16];
32347c478bd9Sstevel@tonic-gate 	iovec_t *ip;
32357c478bd9Sstevel@tonic-gate 	long nb;
32367c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 4 && showbuf);
32377c478bd9Sstevel@tonic-gate 
32387c478bd9Sstevel@tonic-gate #ifdef _LP64
32397c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
32407c478bd9Sstevel@tonic-gate 		show_iovec32(pri, offset, niov, showbuf, count);
32417c478bd9Sstevel@tonic-gate 		return;
32427c478bd9Sstevel@tonic-gate 	}
32437c478bd9Sstevel@tonic-gate #endif
32447c478bd9Sstevel@tonic-gate 	if (niov > 16)		/* is this the real limit? */
32457c478bd9Sstevel@tonic-gate 		niov = 16;
32467c478bd9Sstevel@tonic-gate 
3247*27aa4812SToomas Soome 	if (offset != 0 && niov > 0 &&
32487c478bd9Sstevel@tonic-gate 	    Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset)
32497c478bd9Sstevel@tonic-gate 	    == niov*sizeof (iovec_t)) {
32507c478bd9Sstevel@tonic-gate 		/* enter region of lengthy output */
32517c478bd9Sstevel@tonic-gate 		if (serial)
32527c478bd9Sstevel@tonic-gate 			Eserialize();
32537c478bd9Sstevel@tonic-gate 
32547c478bd9Sstevel@tonic-gate 		for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
32557c478bd9Sstevel@tonic-gate 			(void) printf("%s\tiov_base = 0x%.8lX  iov_len = %lu\n",
3256019c3c43Sraf 			    pri->pname,
3257019c3c43Sraf 			    (long)ip->iov_base,
3258019c3c43Sraf 			    ip->iov_len);
32597c478bd9Sstevel@tonic-gate 			if ((nb = count) > 0) {
32607c478bd9Sstevel@tonic-gate 				if (nb > ip->iov_len)
32617c478bd9Sstevel@tonic-gate 					nb = ip->iov_len;
32627c478bd9Sstevel@tonic-gate 				if (nb > 0)
32637c478bd9Sstevel@tonic-gate 					count -= nb;
32647c478bd9Sstevel@tonic-gate 			}
32657c478bd9Sstevel@tonic-gate 			if (showbuf && nb > 0)
32667c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)ip->iov_base, nb);
32677c478bd9Sstevel@tonic-gate 		}
32687c478bd9Sstevel@tonic-gate 
32697c478bd9Sstevel@tonic-gate 		/* exit region of lengthy output */
32707c478bd9Sstevel@tonic-gate 		if (serial)
32717c478bd9Sstevel@tonic-gate 			Xserialize();
32727c478bd9Sstevel@tonic-gate 	}
32737c478bd9Sstevel@tonic-gate }
32747c478bd9Sstevel@tonic-gate 
32757c478bd9Sstevel@tonic-gate void
32767c478bd9Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count)
32777c478bd9Sstevel@tonic-gate {
32787c478bd9Sstevel@tonic-gate 	long buf[MYBUFSIZ / sizeof (long)];
32797c478bd9Sstevel@tonic-gate 	struct dirent32 *dp;
32807c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
32817c478bd9Sstevel@tonic-gate 
32823b862e9aSRoger A. Faulkner 	if (offset == 0)
32837c478bd9Sstevel@tonic-gate 		return;
32847c478bd9Sstevel@tonic-gate 
32857c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
32867c478bd9Sstevel@tonic-gate 	if (serial)
32877c478bd9Sstevel@tonic-gate 		Eserialize();
32887c478bd9Sstevel@tonic-gate 
32897c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
32907c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
32917c478bd9Sstevel@tonic-gate 
32927c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
32937c478bd9Sstevel@tonic-gate 			break;
32947c478bd9Sstevel@tonic-gate 
32957c478bd9Sstevel@tonic-gate 		dp = (struct dirent32 *)&buf[0];
32967c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
32977c478bd9Sstevel@tonic-gate 			break;
32987c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
32997c478bd9Sstevel@tonic-gate 			/* getdents() error? */
33007c478bd9Sstevel@tonic-gate 			(void) printf(
3301019c3c43Sraf 			    "%s    ino=%-5u off=%-4d rlen=%-3d\n",
3302019c3c43Sraf 			    pri->pname,
3303019c3c43Sraf 			    dp->d_ino,
3304019c3c43Sraf 			    dp->d_off,
3305019c3c43Sraf 			    dp->d_reclen);
33067c478bd9Sstevel@tonic-gate 			break;
33077c478bd9Sstevel@tonic-gate 		}
33087c478bd9Sstevel@tonic-gate 
33097c478bd9Sstevel@tonic-gate 		while (!interrupt &&
33107c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
33117c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
33127c478bd9Sstevel@tonic-gate 			(void) printf(
3313019c3c43Sraf 			    "%s    ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3314019c3c43Sraf 			    pri->pname,
3315019c3c43Sraf 			    dp->d_ino,
3316019c3c43Sraf 			    dp->d_off,
3317019c3c43Sraf 			    dp->d_reclen,
3318019c3c43Sraf 			    dp->d_reclen - (int)(dp->d_name - (char *)dp),
3319019c3c43Sraf 			    dp->d_name);
33207c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
33217c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
33227c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
33237c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
33247c478bd9Sstevel@tonic-gate 			dp = (struct dirent32 *)((char *)dp + dp->d_reclen);
33257c478bd9Sstevel@tonic-gate 		}
33267c478bd9Sstevel@tonic-gate 	}
33277c478bd9Sstevel@tonic-gate 
33287c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
33297c478bd9Sstevel@tonic-gate 	if (serial)
33307c478bd9Sstevel@tonic-gate 		Xserialize();
33317c478bd9Sstevel@tonic-gate }
33327c478bd9Sstevel@tonic-gate 
33337c478bd9Sstevel@tonic-gate void
33347c478bd9Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count)
33357c478bd9Sstevel@tonic-gate {
33367c478bd9Sstevel@tonic-gate 	long long buf[MYBUFSIZ / sizeof (long long)];
33377c478bd9Sstevel@tonic-gate 	struct dirent64 *dp;
33387c478bd9Sstevel@tonic-gate 	int serial = (count > 100);
33397c478bd9Sstevel@tonic-gate 
33403b862e9aSRoger A. Faulkner 	if (offset == 0)
33417c478bd9Sstevel@tonic-gate 		return;
33427c478bd9Sstevel@tonic-gate 
33437c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
33447c478bd9Sstevel@tonic-gate 	if (serial)
33457c478bd9Sstevel@tonic-gate 		Eserialize();
33467c478bd9Sstevel@tonic-gate 
33477c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
33487c478bd9Sstevel@tonic-gate 		int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
33497c478bd9Sstevel@tonic-gate 
33507c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
33517c478bd9Sstevel@tonic-gate 			break;
33527c478bd9Sstevel@tonic-gate 
33537c478bd9Sstevel@tonic-gate 		dp = (struct dirent64 *)&buf[0];
33547c478bd9Sstevel@tonic-gate 		if (nb < (int)(dp->d_name - (char *)dp))
33557c478bd9Sstevel@tonic-gate 			break;
33567c478bd9Sstevel@tonic-gate 		if ((unsigned)nb < dp->d_reclen) {
33577c478bd9Sstevel@tonic-gate 			/* getdents() error? */
33587c478bd9Sstevel@tonic-gate 			(void) printf(
3359019c3c43Sraf 			    "%s    ino=%-5llu off=%-4lld rlen=%-3d\n",
3360019c3c43Sraf 			    pri->pname,
3361019c3c43Sraf 			    (long long)dp->d_ino,
3362019c3c43Sraf 			    (long long)dp->d_off,
3363019c3c43Sraf 			    dp->d_reclen);
33647c478bd9Sstevel@tonic-gate 			break;
33657c478bd9Sstevel@tonic-gate 		}
33667c478bd9Sstevel@tonic-gate 
33677c478bd9Sstevel@tonic-gate 		while (!interrupt &&
33687c478bd9Sstevel@tonic-gate 		    nb >= (int)(dp->d_name - (char *)dp) &&
33697c478bd9Sstevel@tonic-gate 		    (unsigned)nb >= dp->d_reclen) {
33707c478bd9Sstevel@tonic-gate 			(void) printf(
3371019c3c43Sraf 			    "%s    ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3372019c3c43Sraf 			    pri->pname,
3373019c3c43Sraf 			    (long long)dp->d_ino,
3374019c3c43Sraf 			    (long long)dp->d_off,
3375019c3c43Sraf 			    dp->d_reclen,
3376019c3c43Sraf 			    dp->d_reclen - (int)(dp->d_name - (char *)dp),
3377019c3c43Sraf 			    dp->d_name);
33787c478bd9Sstevel@tonic-gate 			nb -= dp->d_reclen;
33797c478bd9Sstevel@tonic-gate 			count -= dp->d_reclen;
33807c478bd9Sstevel@tonic-gate 			offset += dp->d_reclen;
33817c478bd9Sstevel@tonic-gate 			/* LINTED improper alignment */
33827c478bd9Sstevel@tonic-gate 			dp = (struct dirent64 *)((char *)dp + dp->d_reclen);
33837c478bd9Sstevel@tonic-gate 		}
33847c478bd9Sstevel@tonic-gate 	}
33857c478bd9Sstevel@tonic-gate 
33867c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
33877c478bd9Sstevel@tonic-gate 	if (serial)
33887c478bd9Sstevel@tonic-gate 		Xserialize();
33897c478bd9Sstevel@tonic-gate }
33907c478bd9Sstevel@tonic-gate 
33917c478bd9Sstevel@tonic-gate void
33927c478bd9Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset)
33937c478bd9Sstevel@tonic-gate {
33947c478bd9Sstevel@tonic-gate 	struct rlimit32 rlimit;
33957c478bd9Sstevel@tonic-gate 
3396*27aa4812SToomas Soome 	if (offset != 0 &&
33977c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
33987c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
33997c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
34007c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
34017c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_INFINITY", stdout);
34027c478bd9Sstevel@tonic-gate 			break;
34037c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
34047c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_MAX", stdout);
34057c478bd9Sstevel@tonic-gate 			break;
34067c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
34077c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM_SAVED_CUR", stdout);
34087c478bd9Sstevel@tonic-gate 			break;
34097c478bd9Sstevel@tonic-gate 		default:
34107c478bd9Sstevel@tonic-gate 			(void) printf("cur = %lu", (long)rlimit.rlim_cur);
34117c478bd9Sstevel@tonic-gate 			break;
34127c478bd9Sstevel@tonic-gate 		}
34137c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
34147c478bd9Sstevel@tonic-gate 		case RLIM32_INFINITY:
34157c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_INFINITY\n", stdout);
34167c478bd9Sstevel@tonic-gate 			break;
34177c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_MAX:
34187c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_MAX\n", stdout);
34197c478bd9Sstevel@tonic-gate 			break;
34207c478bd9Sstevel@tonic-gate 		case RLIM32_SAVED_CUR:
34217c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM_SAVED_CUR\n", stdout);
34227c478bd9Sstevel@tonic-gate 			break;
34237c478bd9Sstevel@tonic-gate 		default:
34247c478bd9Sstevel@tonic-gate 			(void) printf("  max = %lu\n", (long)rlimit.rlim_max);
34257c478bd9Sstevel@tonic-gate 			break;
34267c478bd9Sstevel@tonic-gate 		}
34277c478bd9Sstevel@tonic-gate 	}
34287c478bd9Sstevel@tonic-gate }
34297c478bd9Sstevel@tonic-gate 
34307c478bd9Sstevel@tonic-gate void
34317c478bd9Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset)
34327c478bd9Sstevel@tonic-gate {
34337c478bd9Sstevel@tonic-gate 	struct rlimit64 rlimit;
34347c478bd9Sstevel@tonic-gate 
3435*27aa4812SToomas Soome 	if (offset != 0 &&
34367c478bd9Sstevel@tonic-gate 	    Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
34377c478bd9Sstevel@tonic-gate 		(void) printf("%s\t", pri->pname);
34387c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_cur) {
34397c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
34407c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_INFINITY", stdout);
34417c478bd9Sstevel@tonic-gate 			break;
34427c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
34437c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_MAX", stdout);
34447c478bd9Sstevel@tonic-gate 			break;
34457c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
34467c478bd9Sstevel@tonic-gate 			(void) fputs("cur = RLIM64_SAVED_CUR", stdout);
34477c478bd9Sstevel@tonic-gate 			break;
34487c478bd9Sstevel@tonic-gate 		default:
34497c478bd9Sstevel@tonic-gate 			(void) printf("cur = %llu",
34507c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_cur);
34517c478bd9Sstevel@tonic-gate 			break;
34527c478bd9Sstevel@tonic-gate 		}
34537c478bd9Sstevel@tonic-gate 		switch (rlimit.rlim_max) {
34547c478bd9Sstevel@tonic-gate 		case RLIM64_INFINITY:
34557c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_INFINITY\n", stdout);
34567c478bd9Sstevel@tonic-gate 			break;
34577c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_MAX:
34587c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_MAX\n", stdout);
34597c478bd9Sstevel@tonic-gate 			break;
34607c478bd9Sstevel@tonic-gate 		case RLIM64_SAVED_CUR:
34617c478bd9Sstevel@tonic-gate 			(void) fputs("  max = RLIM64_SAVED_CUR\n", stdout);
34627c478bd9Sstevel@tonic-gate 			break;
34637c478bd9Sstevel@tonic-gate 		default:
34647c478bd9Sstevel@tonic-gate 			(void) printf("  max = %llu\n",
34657c478bd9Sstevel@tonic-gate 			    (unsigned long long)rlimit.rlim_max);
34667c478bd9Sstevel@tonic-gate 			break;
34677c478bd9Sstevel@tonic-gate 		}
34687c478bd9Sstevel@tonic-gate 	}
34697c478bd9Sstevel@tonic-gate }
34707c478bd9Sstevel@tonic-gate 
34717c478bd9Sstevel@tonic-gate void
34727c478bd9Sstevel@tonic-gate show_nuname(private_t *pri, long offset)
34737c478bd9Sstevel@tonic-gate {
34747c478bd9Sstevel@tonic-gate 	struct utsname ubuf;
34757c478bd9Sstevel@tonic-gate 
3476*27aa4812SToomas Soome 	if (offset != 0 &&
34777c478bd9Sstevel@tonic-gate 	    Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
34787c478bd9Sstevel@tonic-gate 		(void) printf(
3479019c3c43Sraf 		    "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3480019c3c43Sraf 		    pri->pname,
3481019c3c43Sraf 		    ubuf.sysname,
3482019c3c43Sraf 		    ubuf.nodename,
3483019c3c43Sraf 		    ubuf.release,
3484019c3c43Sraf 		    ubuf.version,
3485019c3c43Sraf 		    ubuf.machine);
34867c478bd9Sstevel@tonic-gate 	}
34877c478bd9Sstevel@tonic-gate }
34887c478bd9Sstevel@tonic-gate 
34897c478bd9Sstevel@tonic-gate void
34907c478bd9Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2)
34917c478bd9Sstevel@tonic-gate {
34927c478bd9Sstevel@tonic-gate 	show_timeval(pri, off1, "   delta");
34937c478bd9Sstevel@tonic-gate 	show_timeval(pri, off2, "olddelta");
34947c478bd9Sstevel@tonic-gate }
34957c478bd9Sstevel@tonic-gate 
34967c478bd9Sstevel@tonic-gate void
34977c478bd9Sstevel@tonic-gate show_sockaddr(private_t *pri,
34980b09d754SToomas Soome     const char *str, long addroff, long lenoff, long len)
34997c478bd9Sstevel@tonic-gate {
35007c478bd9Sstevel@tonic-gate 	/*
35017c478bd9Sstevel@tonic-gate 	 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
35027c478bd9Sstevel@tonic-gate 	 * also large enough to store a sockaddr_in or a sockaddr_in6.
35037c478bd9Sstevel@tonic-gate 	 */
35047c478bd9Sstevel@tonic-gate 	long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1)
3505019c3c43Sraf 	    / sizeof (long)];
35067c478bd9Sstevel@tonic-gate 	struct sockaddr *sa = (struct sockaddr *)buf;
35077c478bd9Sstevel@tonic-gate 	struct sockaddr_in *sin = (struct sockaddr_in *)buf;
35087c478bd9Sstevel@tonic-gate 	struct sockaddr_un *soun = (struct sockaddr_un *)buf;
35097c478bd9Sstevel@tonic-gate 	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf;
35107c478bd9Sstevel@tonic-gate 	char addrbuf[INET6_ADDRSTRLEN];
35117c478bd9Sstevel@tonic-gate 
35127c478bd9Sstevel@tonic-gate 	if (lenoff != 0) {
35137c478bd9Sstevel@tonic-gate 		uint_t ilen;
35147c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen))
35157c478bd9Sstevel@tonic-gate 			return;
35167c478bd9Sstevel@tonic-gate 		len = ilen;
35177c478bd9Sstevel@tonic-gate 	}
35187c478bd9Sstevel@tonic-gate 
35197c478bd9Sstevel@tonic-gate 	if (len >= sizeof (buf))	/* protect against ridiculous length */
35207c478bd9Sstevel@tonic-gate 		len = sizeof (buf) - 1;
35217c478bd9Sstevel@tonic-gate 	if (Pread(Proc, buf, len, addroff) != len)
35227c478bd9Sstevel@tonic-gate 		return;
35237c478bd9Sstevel@tonic-gate 
35247c478bd9Sstevel@tonic-gate 	switch (sa->sa_family) {
35257c478bd9Sstevel@tonic-gate 	case AF_INET6:
35267c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_INET6  %s = %s  port = %u\n",
35277c478bd9Sstevel@tonic-gate 		    pri->pname, str,
35287c478bd9Sstevel@tonic-gate 		    inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf,
3529019c3c43Sraf 		    sizeof (addrbuf)),
35307c478bd9Sstevel@tonic-gate 		    ntohs(sin6->sin6_port));
35317c478bd9Sstevel@tonic-gate 		(void) printf("%s\tscope id = %u  source id = 0x%x\n"
35327c478bd9Sstevel@tonic-gate 		    "%s\tflow class = 0x%02x  flow label = 0x%05x\n",
35337c478bd9Sstevel@tonic-gate 		    pri->pname, ntohl(sin6->sin6_scope_id),
35347c478bd9Sstevel@tonic-gate 		    ntohl(sin6->__sin6_src_id),
35357c478bd9Sstevel@tonic-gate 		    pri->pname,
35367c478bd9Sstevel@tonic-gate 		    ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20),
35377c478bd9Sstevel@tonic-gate 		    ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL));
35387c478bd9Sstevel@tonic-gate 		break;
35397c478bd9Sstevel@tonic-gate 	case AF_INET:
35407c478bd9Sstevel@tonic-gate 		(void) printf("%s\tAF_%s  %s = %s  port = %u\n",
35412caf0dcdSrshoaib 		    pri->pname, "INET",
35427c478bd9Sstevel@tonic-gate 		    str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf,
35437c478bd9Sstevel@tonic-gate 		    sizeof (addrbuf)), ntohs(sin->sin_port));
35447c478bd9Sstevel@tonic-gate 		break;
35457c478bd9Sstevel@tonic-gate 	case AF_UNIX:
35467c478bd9Sstevel@tonic-gate 		len -= sizeof (soun->sun_family);
35477c478bd9Sstevel@tonic-gate 		if (len >= 0) {
35487c478bd9Sstevel@tonic-gate 			/* Null terminate */
3549*27aa4812SToomas Soome 			soun->sun_path[len] = 0;
35507c478bd9Sstevel@tonic-gate 			(void) printf("%s\tAF_UNIX  %s = %s\n", pri->pname,
3551019c3c43Sraf 			    str, soun->sun_path);
35527c478bd9Sstevel@tonic-gate 		}
35537c478bd9Sstevel@tonic-gate 		break;
35547c478bd9Sstevel@tonic-gate 	}
35557c478bd9Sstevel@tonic-gate }
35567c478bd9Sstevel@tonic-gate 
35577c478bd9Sstevel@tonic-gate void
35587c478bd9Sstevel@tonic-gate show_msghdr(private_t *pri, long offset)
35597c478bd9Sstevel@tonic-gate {
356081006e0fSja 	const lwpstatus_t *Lsp = pri->lwpstat;
356181006e0fSja 	int what = Lsp->pr_what;
356281006e0fSja 	int err = pri->Errno;
35637c478bd9Sstevel@tonic-gate 	struct msghdr msg;
356481006e0fSja 	int showbuf = FALSE;
356581006e0fSja 	int i = pri->sys_args[0]+1;
356681006e0fSja 	long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
35677c478bd9Sstevel@tonic-gate 
35687c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
35697c478bd9Sstevel@tonic-gate 		return;
357081006e0fSja 
35717c478bd9Sstevel@tonic-gate 	if (msg.msg_name != NULL && msg.msg_namelen != 0)
35727c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
3573019c3c43Sraf 		    (long)msg.msg_name, 0, (long)msg.msg_namelen);
357481006e0fSja 
357581006e0fSja 	/*
357681006e0fSja 	 * Print the iovec if the syscall was successful and the fd is
357781006e0fSja 	 * part of the set being traced.
357881006e0fSja 	 */
357981006e0fSja 	if ((what == SYS_recvmsg && !err &&
358081006e0fSja 	    prismember(&readfd, i)) ||
358181006e0fSja 	    (what == SYS_sendmsg &&
358281006e0fSja 	    prismember(&writefd, i)))
358381006e0fSja 		showbuf = TRUE;
358481006e0fSja 
358581006e0fSja 	show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
358681006e0fSja 
35877c478bd9Sstevel@tonic-gate }
35887c478bd9Sstevel@tonic-gate 
35897c478bd9Sstevel@tonic-gate #ifdef _LP64
35907c478bd9Sstevel@tonic-gate void
35917c478bd9Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset)
35927c478bd9Sstevel@tonic-gate {
35937c478bd9Sstevel@tonic-gate 	struct msghdr32 {
35947c478bd9Sstevel@tonic-gate 		caddr32_t	msg_name;
359581006e0fSja 		uint32_t	msg_namelen;
3596*27aa4812SToomas Soome 		caddr32_t	msg_iov;
359781006e0fSja 		int32_t		msg_iovlen;
35987c478bd9Sstevel@tonic-gate 	} msg;
359981006e0fSja 	const lwpstatus_t *Lsp = pri->lwpstat;
360081006e0fSja 	int what = Lsp->pr_what;
360181006e0fSja 	int err = pri->Errno;
360281006e0fSja 	int showbuf = FALSE;
360381006e0fSja 	int i = pri->sys_args[0]+1;
360481006e0fSja 	long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
36057c478bd9Sstevel@tonic-gate 
36067c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
36077c478bd9Sstevel@tonic-gate 		return;
360881006e0fSja 
3609*27aa4812SToomas Soome 	if (msg.msg_name != 0 && msg.msg_namelen != 0)
36107c478bd9Sstevel@tonic-gate 		show_sockaddr(pri, "msg_name",
3611019c3c43Sraf 		    (long)msg.msg_name, 0, (long)msg.msg_namelen);
361281006e0fSja 	/*
361381006e0fSja 	 * Print the iovec if the syscall was successful and the fd is
361481006e0fSja 	 * part of the set being traced.
361581006e0fSja 	 */
361681006e0fSja 	if ((what == SYS_recvmsg && !err &&
361781006e0fSja 	    prismember(&readfd, i)) ||
361881006e0fSja 	    (what == SYS_sendmsg &&
361981006e0fSja 	    prismember(&writefd, i)))
362081006e0fSja 		showbuf = TRUE;
362181006e0fSja 
362281006e0fSja 	show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
362381006e0fSja 
36247c478bd9Sstevel@tonic-gate }
36257c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
36267c478bd9Sstevel@tonic-gate 
36277c478bd9Sstevel@tonic-gate static void
36287c478bd9Sstevel@tonic-gate show_doorargs(private_t *pri, long offset)
36297c478bd9Sstevel@tonic-gate {
36307c478bd9Sstevel@tonic-gate 	door_arg_t args;
36317c478bd9Sstevel@tonic-gate 
36327c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36337c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
36347c478bd9Sstevel@tonic-gate 		    pri->pname,
36357c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_ptr,
36367c478bd9Sstevel@tonic-gate 		    (ulong_t)args.data_size);
36377c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
36387c478bd9Sstevel@tonic-gate 		    pri->pname,
36397c478bd9Sstevel@tonic-gate 		    (ulong_t)args.desc_ptr,
36407c478bd9Sstevel@tonic-gate 		    args.desc_num);
36417c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%lX rsize=%lu\n",
36427c478bd9Sstevel@tonic-gate 		    pri->pname,
36437c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rbuf,
36447c478bd9Sstevel@tonic-gate 		    (ulong_t)args.rsize);
36457c478bd9Sstevel@tonic-gate 	}
36467c478bd9Sstevel@tonic-gate }
36477c478bd9Sstevel@tonic-gate 
36487c478bd9Sstevel@tonic-gate static void
36497c478bd9Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc)
36507c478bd9Sstevel@tonic-gate {
36517c478bd9Sstevel@tonic-gate 	int i = 0;
36527c478bd9Sstevel@tonic-gate 	const priv_set_t *s;
36537c478bd9Sstevel@tonic-gate 	priv_ptype_t sn;
36547c478bd9Sstevel@tonic-gate 	char *str;
36557c478bd9Sstevel@tonic-gate 
36567c478bd9Sstevel@tonic-gate 	while ((sn = priv_getsetbynum(i++)) != NULL) {
36577c478bd9Sstevel@tonic-gate 		s = ucred_getprivset(uc, sn);
36587c478bd9Sstevel@tonic-gate 
36597c478bd9Sstevel@tonic-gate 		if (s == NULL)
36607c478bd9Sstevel@tonic-gate 			continue;
36617c478bd9Sstevel@tonic-gate 
36627c478bd9Sstevel@tonic-gate 		(void) printf("%s\t%c: %s\n",
36637c478bd9Sstevel@tonic-gate 		    pri->pname,
36647c478bd9Sstevel@tonic-gate 		    *sn,
36657c478bd9Sstevel@tonic-gate 		    str = priv_set_to_str(s, ',', PRIV_STR_SHORT));
36667c478bd9Sstevel@tonic-gate 
36677c478bd9Sstevel@tonic-gate 		free(str);
36687c478bd9Sstevel@tonic-gate 	}
36697c478bd9Sstevel@tonic-gate }
36707c478bd9Sstevel@tonic-gate 
36717c478bd9Sstevel@tonic-gate static void
36727c478bd9Sstevel@tonic-gate show_ucred(private_t *pri, long offset)
36737c478bd9Sstevel@tonic-gate {
36747c478bd9Sstevel@tonic-gate 	ucred_t *uc = _ucred_alloc();
36757c478bd9Sstevel@tonic-gate 	size_t sz;
36767c478bd9Sstevel@tonic-gate 
36777c478bd9Sstevel@tonic-gate 	if (uc == NULL)
36787c478bd9Sstevel@tonic-gate 		return;
36797c478bd9Sstevel@tonic-gate 
36807c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, uc, uc->uc_size, offset);
36817c478bd9Sstevel@tonic-gate 
36827c478bd9Sstevel@tonic-gate 	/*
36837c478bd9Sstevel@tonic-gate 	 * A new uc_size is read, it could be smaller than the previously
36847c478bd9Sstevel@tonic-gate 	 * value.  We accept short reads that fill the whole header.
36857c478bd9Sstevel@tonic-gate 	 */
36867c478bd9Sstevel@tonic-gate 	if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) {
3687f48205beScasper 		(void) printf("%s\teuid=%u egid=%u\n",
36887c478bd9Sstevel@tonic-gate 		    pri->pname,
3689f48205beScasper 		    ucred_geteuid(uc),
3690f48205beScasper 		    ucred_getegid(uc));
3691f48205beScasper 		(void) printf("%s\truid=%u rgid=%u\n",
36927c478bd9Sstevel@tonic-gate 		    pri->pname,
3693f48205beScasper 		    ucred_getruid(uc),
3694f48205beScasper 		    ucred_getrgid(uc));
36957c478bd9Sstevel@tonic-gate 		(void) printf("%s\tpid=%d zoneid=%d\n",
36967c478bd9Sstevel@tonic-gate 		    pri->pname,
36977c478bd9Sstevel@tonic-gate 		    (int)ucred_getpid(uc),
36987c478bd9Sstevel@tonic-gate 		    (int)ucred_getzoneid(uc));
36997c478bd9Sstevel@tonic-gate 		show_ucred_privsets(pri, uc);
37007c478bd9Sstevel@tonic-gate 	}
37017c478bd9Sstevel@tonic-gate 	ucred_free(uc);
37027c478bd9Sstevel@tonic-gate }
37037c478bd9Sstevel@tonic-gate 
37047c478bd9Sstevel@tonic-gate static void
3705821c4a97Sdp show_privset(private_t *pri, long offset, size_t size, char *label)
37067c478bd9Sstevel@tonic-gate {
37077c478bd9Sstevel@tonic-gate 	priv_set_t *tmp = priv_allocset();
37087c478bd9Sstevel@tonic-gate 	size_t sz;
37097c478bd9Sstevel@tonic-gate 
37107c478bd9Sstevel@tonic-gate 	if (tmp == NULL)
37117c478bd9Sstevel@tonic-gate 		return;
37127c478bd9Sstevel@tonic-gate 
37137c478bd9Sstevel@tonic-gate 	sz = Pread(Proc, tmp, size, offset);
37147c478bd9Sstevel@tonic-gate 
37157c478bd9Sstevel@tonic-gate 	if (sz == size) {
37167c478bd9Sstevel@tonic-gate 		char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT);
37177c478bd9Sstevel@tonic-gate 		if (str != NULL) {
3718821c4a97Sdp 			(void) printf("%s\t%s%s\n", pri->pname, label, str);
37197c478bd9Sstevel@tonic-gate 			free(str);
37207c478bd9Sstevel@tonic-gate 		}
37217c478bd9Sstevel@tonic-gate 	}
37227c478bd9Sstevel@tonic-gate 	priv_freeset(tmp);
37237c478bd9Sstevel@tonic-gate }
37247c478bd9Sstevel@tonic-gate 
37257c478bd9Sstevel@tonic-gate static void
37267c478bd9Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset)
37277c478bd9Sstevel@tonic-gate {
37287c478bd9Sstevel@tonic-gate 	door_info_t info;
37297c478bd9Sstevel@tonic-gate 	door_attr_t attr;
37307c478bd9Sstevel@tonic-gate 
37317c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info))
37327c478bd9Sstevel@tonic-gate 		return;
37337c478bd9Sstevel@tonic-gate 	(void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
37347c478bd9Sstevel@tonic-gate 	    pri->pname,
37357c478bd9Sstevel@tonic-gate 	    (int)info.di_target,
37367c478bd9Sstevel@tonic-gate 	    info.di_proc,
37377c478bd9Sstevel@tonic-gate 	    info.di_data);
37387c478bd9Sstevel@tonic-gate 	attr = info.di_attributes;
37397c478bd9Sstevel@tonic-gate 	(void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr));
37407c478bd9Sstevel@tonic-gate 	(void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier);
37417c478bd9Sstevel@tonic-gate }
37427c478bd9Sstevel@tonic-gate 
37437c478bd9Sstevel@tonic-gate static void
37447c478bd9Sstevel@tonic-gate show_doorparam(private_t *pri, long offset)
37457c478bd9Sstevel@tonic-gate {
37467c478bd9Sstevel@tonic-gate 	ulong_t val;
37477c478bd9Sstevel@tonic-gate 
37487c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
37497c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%lu\n",
37507c478bd9Sstevel@tonic-gate 		    pri->pname,
37517c478bd9Sstevel@tonic-gate 		    val);
37527c478bd9Sstevel@tonic-gate 	}
37537c478bd9Sstevel@tonic-gate }
37547c478bd9Sstevel@tonic-gate 
37557c478bd9Sstevel@tonic-gate #ifdef _LP64
37567c478bd9Sstevel@tonic-gate 
37577c478bd9Sstevel@tonic-gate static void
37587c478bd9Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset)
37597c478bd9Sstevel@tonic-gate {
37607c478bd9Sstevel@tonic-gate 	struct door_arg32 args;
37617c478bd9Sstevel@tonic-gate 
37627c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
37637c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdata_ptr=%X data_size=%u\n",
37647c478bd9Sstevel@tonic-gate 		    pri->pname,
37657c478bd9Sstevel@tonic-gate 		    args.data_ptr,
37667c478bd9Sstevel@tonic-gate 		    args.data_size);
37677c478bd9Sstevel@tonic-gate 		(void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
37687c478bd9Sstevel@tonic-gate 		    pri->pname,
37697c478bd9Sstevel@tonic-gate 		    args.desc_ptr,
37707c478bd9Sstevel@tonic-gate 		    args.desc_num);
37717c478bd9Sstevel@tonic-gate 		(void) printf("%s\trbuf=0x%X rsize=%u\n",
37727c478bd9Sstevel@tonic-gate 		    pri->pname,
37737c478bd9Sstevel@tonic-gate 		    args.rbuf,
37747c478bd9Sstevel@tonic-gate 		    args.rsize);
37757c478bd9Sstevel@tonic-gate 	}
37767c478bd9Sstevel@tonic-gate }
37777c478bd9Sstevel@tonic-gate 
37787c478bd9Sstevel@tonic-gate static void
37797c478bd9Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset)
37807c478bd9Sstevel@tonic-gate {
37817c478bd9Sstevel@tonic-gate 	uint_t val;
37827c478bd9Sstevel@tonic-gate 
37837c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
37847c478bd9Sstevel@tonic-gate 		(void) printf("%s\tvalue=%u\n",
37857c478bd9Sstevel@tonic-gate 		    pri->pname,
37867c478bd9Sstevel@tonic-gate 		    val);
37877c478bd9Sstevel@tonic-gate 	}
37887c478bd9Sstevel@tonic-gate }
37897c478bd9Sstevel@tonic-gate 
37907c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
37917c478bd9Sstevel@tonic-gate 
37927c478bd9Sstevel@tonic-gate static void
37937c478bd9Sstevel@tonic-gate show_doors(private_t *pri)
37947c478bd9Sstevel@tonic-gate {
37957c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[5]) {
37967c478bd9Sstevel@tonic-gate 	case DOOR_CALL:
37977c478bd9Sstevel@tonic-gate #ifdef _LP64
37987c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
37997c478bd9Sstevel@tonic-gate 			show_doorargs(pri, (long)pri->sys_args[1]);
38007c478bd9Sstevel@tonic-gate 		else
38017c478bd9Sstevel@tonic-gate 			show_doorargs32(pri, (long)pri->sys_args[1]);
38027c478bd9Sstevel@tonic-gate #else
38037c478bd9Sstevel@tonic-gate 		show_doorargs(pri, (long)pri->sys_args[1]);
38047c478bd9Sstevel@tonic-gate #endif
38057c478bd9Sstevel@tonic-gate 		break;
38067c478bd9Sstevel@tonic-gate 	case DOOR_UCRED:
38077c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
38087c478bd9Sstevel@tonic-gate 			show_ucred(pri, (long)pri->sys_args[0]);
38097c478bd9Sstevel@tonic-gate 		break;
38107c478bd9Sstevel@tonic-gate 	case DOOR_INFO:
38117c478bd9Sstevel@tonic-gate 		if (!pri->Errno)
38127c478bd9Sstevel@tonic-gate 			show_doorinfo(pri, (long)pri->sys_args[1]);
38137c478bd9Sstevel@tonic-gate 		break;
38147c478bd9Sstevel@tonic-gate 	case DOOR_GETPARAM:
38157c478bd9Sstevel@tonic-gate 		if (!pri->Errno) {
38167c478bd9Sstevel@tonic-gate #ifdef _LP64
38177c478bd9Sstevel@tonic-gate 			if (data_model == PR_MODEL_LP64)
38187c478bd9Sstevel@tonic-gate 				show_doorparam(pri, (long)pri->sys_args[2]);
38197c478bd9Sstevel@tonic-gate 			else
38207c478bd9Sstevel@tonic-gate 				show_doorparam32(pri, (long)pri->sys_args[2]);
38217c478bd9Sstevel@tonic-gate #else
38227c478bd9Sstevel@tonic-gate 			show_doorparam(pri, (long)pri->sys_args[2]);
38237c478bd9Sstevel@tonic-gate #endif
38247c478bd9Sstevel@tonic-gate 		}
38257c478bd9Sstevel@tonic-gate 		break;
38267c478bd9Sstevel@tonic-gate 	}
38277c478bd9Sstevel@tonic-gate }
38287c478bd9Sstevel@tonic-gate 
38297c478bd9Sstevel@tonic-gate static void
38307c478bd9Sstevel@tonic-gate show_portargs(private_t *pri, long offset)
38317c478bd9Sstevel@tonic-gate {
38327c478bd9Sstevel@tonic-gate 	port_event_t args;
38337c478bd9Sstevel@tonic-gate 
38347c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
38357c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
38367c478bd9Sstevel@tonic-gate 		    pri->pname,
38377c478bd9Sstevel@tonic-gate 		    args.portev_events,
38387c478bd9Sstevel@tonic-gate 		    args.portev_source);
38397c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%p user=0x%p\n",
38407c478bd9Sstevel@tonic-gate 		    pri->pname,
38417c478bd9Sstevel@tonic-gate 		    (void *)args.portev_object,
38427c478bd9Sstevel@tonic-gate 		    (void *)args.portev_user);
38437c478bd9Sstevel@tonic-gate 	}
38447c478bd9Sstevel@tonic-gate }
38457c478bd9Sstevel@tonic-gate 
38467c478bd9Sstevel@tonic-gate 
38477c478bd9Sstevel@tonic-gate #ifdef _LP64
38487c478bd9Sstevel@tonic-gate 
38497c478bd9Sstevel@tonic-gate static void
38507c478bd9Sstevel@tonic-gate show_portargs32(private_t *pri, long offset)
38517c478bd9Sstevel@tonic-gate {
38527c478bd9Sstevel@tonic-gate 	port_event32_t args;
38537c478bd9Sstevel@tonic-gate 
38547c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
38557c478bd9Sstevel@tonic-gate 		(void) printf("%s\tevents=0x%x source=%u\n",
38567c478bd9Sstevel@tonic-gate 		    pri->pname,
38577c478bd9Sstevel@tonic-gate 		    args.portev_events,
38587c478bd9Sstevel@tonic-gate 		    args.portev_source);
38597c478bd9Sstevel@tonic-gate 		(void) printf("%s\tobject=0x%x user=0x%x\n",
38607c478bd9Sstevel@tonic-gate 		    pri->pname,
38617c478bd9Sstevel@tonic-gate 		    args.portev_object,
38627c478bd9Sstevel@tonic-gate 		    args.portev_user);
38637c478bd9Sstevel@tonic-gate 	}
38647c478bd9Sstevel@tonic-gate }
38657c478bd9Sstevel@tonic-gate 
38667c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
38677c478bd9Sstevel@tonic-gate 
38687c478bd9Sstevel@tonic-gate static void
38697c478bd9Sstevel@tonic-gate show_ports(private_t *pri)
38707c478bd9Sstevel@tonic-gate {
38717c478bd9Sstevel@tonic-gate 	switch (pri->sys_args[0]) {
38727c478bd9Sstevel@tonic-gate 	case PORT_GET:
38737c478bd9Sstevel@tonic-gate #ifdef _LP64
38747c478bd9Sstevel@tonic-gate 		if (data_model == PR_MODEL_LP64)
38757c478bd9Sstevel@tonic-gate 			show_portargs(pri, (long)pri->sys_args[2]);
38767c478bd9Sstevel@tonic-gate 		else
38777c478bd9Sstevel@tonic-gate 			show_portargs32(pri, (long)pri->sys_args[2]);
38787c478bd9Sstevel@tonic-gate #else
38797c478bd9Sstevel@tonic-gate 		show_portargs(pri, (long)pri->sys_args[2]);
38807c478bd9Sstevel@tonic-gate #endif
38817c478bd9Sstevel@tonic-gate 		break;
38827c478bd9Sstevel@tonic-gate 	}
38837c478bd9Sstevel@tonic-gate }
38847c478bd9Sstevel@tonic-gate 
38857c478bd9Sstevel@tonic-gate #define	MAX_SNDFL_PRD 16
38867c478bd9Sstevel@tonic-gate 
38877c478bd9Sstevel@tonic-gate #ifdef _LP64
38887c478bd9Sstevel@tonic-gate 
38897c478bd9Sstevel@tonic-gate static void
38907c478bd9Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd,
38917c478bd9Sstevel@tonic-gate     ksendfilevec32_t *sndvec, int sfvcnt)
38927c478bd9Sstevel@tonic-gate {
38937c478bd9Sstevel@tonic-gate 	ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD];
38947c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
38957c478bd9Sstevel@tonic-gate 
38967c478bd9Sstevel@tonic-gate 	Eserialize();
38977c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
38987c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
38997c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
39007c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
39017c478bd9Sstevel@tonic-gate 
39027c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
39037c478bd9Sstevel@tonic-gate 			break;
39047c478bd9Sstevel@tonic-gate 
39057c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
39067c478bd9Sstevel@tonic-gate 
39077c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
39087c478bd9Sstevel@tonic-gate 			(void) printf(
39097c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
39107c478bd9Sstevel@tonic-gate 			    "sfv_off=%d\tsfv_len=%u\n",
39117c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
39127c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
39137c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
39147c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
39157c478bd9Sstevel@tonic-gate 
39167c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
39177c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
39187c478bd9Sstevel@tonic-gate 				showbuffer(pri,
39197c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
39207c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
39217c478bd9Sstevel@tonic-gate 			}
39227c478bd9Sstevel@tonic-gate 
39237c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
39247c478bd9Sstevel@tonic-gate 			snd_ptr++;
39257c478bd9Sstevel@tonic-gate 		}
39267c478bd9Sstevel@tonic-gate 
39277c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
39287c478bd9Sstevel@tonic-gate 	}
39297c478bd9Sstevel@tonic-gate 	Xserialize();
39307c478bd9Sstevel@tonic-gate }
39317c478bd9Sstevel@tonic-gate 
39327c478bd9Sstevel@tonic-gate static void
39337c478bd9Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd,
39347c478bd9Sstevel@tonic-gate     ksendfilevec64_t *sndvec, int sfvcnt)
39357c478bd9Sstevel@tonic-gate {
39367c478bd9Sstevel@tonic-gate 	ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
39377c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
39387c478bd9Sstevel@tonic-gate 
39397c478bd9Sstevel@tonic-gate 	Eserialize();
39407c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
39417c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
39427c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
39437c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
39447c478bd9Sstevel@tonic-gate 
39457c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
39467c478bd9Sstevel@tonic-gate 			break;
39477c478bd9Sstevel@tonic-gate 
39487c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
39497c478bd9Sstevel@tonic-gate 
39507c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
39517c478bd9Sstevel@tonic-gate 			(void) printf(
39527c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
39537c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%u\n",
39547c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
39557c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
39567c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
39577c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_len);
39587c478bd9Sstevel@tonic-gate 
39597c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
39607c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
39617c478bd9Sstevel@tonic-gate 				showbuffer(pri,
39627c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_off & 0xffffffff,
39637c478bd9Sstevel@tonic-gate 				    (long)snd_ptr->sfv_len);
39647c478bd9Sstevel@tonic-gate 			}
39657c478bd9Sstevel@tonic-gate 
39667c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
39677c478bd9Sstevel@tonic-gate 			snd_ptr++;
39687c478bd9Sstevel@tonic-gate 		}
39697c478bd9Sstevel@tonic-gate 
39707c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
39717c478bd9Sstevel@tonic-gate 	}
39727c478bd9Sstevel@tonic-gate 	Xserialize();
39737c478bd9Sstevel@tonic-gate }
39747c478bd9Sstevel@tonic-gate 
39757c478bd9Sstevel@tonic-gate #endif /* _LP64 */
39767c478bd9Sstevel@tonic-gate 
39777c478bd9Sstevel@tonic-gate /*ARGSUSED*/
39787c478bd9Sstevel@tonic-gate static void
39797c478bd9Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt)
39807c478bd9Sstevel@tonic-gate {
39817c478bd9Sstevel@tonic-gate 	sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD];
39827c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
39837c478bd9Sstevel@tonic-gate 
39847c478bd9Sstevel@tonic-gate #ifdef _LP64
39857c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
39867c478bd9Sstevel@tonic-gate 		show_ksendfilevec32(pri, fd,
39877c478bd9Sstevel@tonic-gate 		    (ksendfilevec32_t *)sndvec, sfvcnt);
39887c478bd9Sstevel@tonic-gate 		return;
39897c478bd9Sstevel@tonic-gate 	}
39907c478bd9Sstevel@tonic-gate #endif
39917c478bd9Sstevel@tonic-gate 	Eserialize();
39927c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
39937c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
39947c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
39957c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
39967c478bd9Sstevel@tonic-gate 
39977c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
39987c478bd9Sstevel@tonic-gate 			break;
39997c478bd9Sstevel@tonic-gate 
40007c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
40017c478bd9Sstevel@tonic-gate 
40027c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
40037c478bd9Sstevel@tonic-gate 			(void) printf(
40047c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
40057c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
40067c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
40077c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
40087c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
40097c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
40107c478bd9Sstevel@tonic-gate 
40117c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
40127c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
40137c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
4014019c3c43Sraf 				    (long)snd_ptr->sfv_len);
40157c478bd9Sstevel@tonic-gate 			}
40167c478bd9Sstevel@tonic-gate 
40177c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
40187c478bd9Sstevel@tonic-gate 			snd_ptr++;
40197c478bd9Sstevel@tonic-gate 		}
40207c478bd9Sstevel@tonic-gate 
40217c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
40227c478bd9Sstevel@tonic-gate 	}
40237c478bd9Sstevel@tonic-gate 	Xserialize();
40247c478bd9Sstevel@tonic-gate }
40257c478bd9Sstevel@tonic-gate 
40267c478bd9Sstevel@tonic-gate /*ARGSUSED*/
40277c478bd9Sstevel@tonic-gate static void
40287c478bd9Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt)
40297c478bd9Sstevel@tonic-gate {
40307c478bd9Sstevel@tonic-gate 	sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
40317c478bd9Sstevel@tonic-gate 	size_t cpy_rqst;
40327c478bd9Sstevel@tonic-gate 
40337c478bd9Sstevel@tonic-gate #ifdef _LP64
40347c478bd9Sstevel@tonic-gate 	if (data_model != PR_MODEL_LP64) {
40357c478bd9Sstevel@tonic-gate 		show_ksendfilevec64(pri, fd,
40367c478bd9Sstevel@tonic-gate 		    (ksendfilevec64_t *)sndvec, sfvcnt);
40377c478bd9Sstevel@tonic-gate 		return;
40387c478bd9Sstevel@tonic-gate 	}
40397c478bd9Sstevel@tonic-gate #endif
40407c478bd9Sstevel@tonic-gate 
40417c478bd9Sstevel@tonic-gate 	Eserialize();
40427c478bd9Sstevel@tonic-gate 	while (sfvcnt > 0) {
40437c478bd9Sstevel@tonic-gate 		cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
40447c478bd9Sstevel@tonic-gate 		sfvcnt -= cpy_rqst;
40457c478bd9Sstevel@tonic-gate 		cpy_rqst *= sizeof (snd[0]);
40467c478bd9Sstevel@tonic-gate 
40477c478bd9Sstevel@tonic-gate 		if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
40487c478bd9Sstevel@tonic-gate 			break;
40497c478bd9Sstevel@tonic-gate 
40507c478bd9Sstevel@tonic-gate 		snd_ptr = &snd[0];
40517c478bd9Sstevel@tonic-gate 
40527c478bd9Sstevel@tonic-gate 		while (cpy_rqst) {
40537c478bd9Sstevel@tonic-gate 			(void) printf(
40547c478bd9Sstevel@tonic-gate #ifdef _LP64
40557c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
40567c478bd9Sstevel@tonic-gate 			    "sfv_off=%ld\tsfv_len=%lu\n",
40577c478bd9Sstevel@tonic-gate #else
40587c478bd9Sstevel@tonic-gate 			    "sfv_fd=%d\tsfv_flag=0x%x\t"
40597c478bd9Sstevel@tonic-gate 			    "sfv_off=%lld\tsfv_len=%lu\n",
40607c478bd9Sstevel@tonic-gate #endif
40617c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_fd,
40627c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_flag,
40637c478bd9Sstevel@tonic-gate 			    snd_ptr->sfv_off,
40647c478bd9Sstevel@tonic-gate 			    (ulong_t)snd_ptr->sfv_len);
40657c478bd9Sstevel@tonic-gate 
40667c478bd9Sstevel@tonic-gate 			if (snd_ptr->sfv_fd == SFV_FD_SELF &&
40677c478bd9Sstevel@tonic-gate 			    prismember(&writefd, fd)) {
40687c478bd9Sstevel@tonic-gate 				showbuffer(pri, (long)snd_ptr->sfv_off,
4069019c3c43Sraf 				    (long)snd_ptr->sfv_len);
40707c478bd9Sstevel@tonic-gate 			}
40717c478bd9Sstevel@tonic-gate 
40727c478bd9Sstevel@tonic-gate 			cpy_rqst -= sizeof (snd[0]);
40737c478bd9Sstevel@tonic-gate 			snd_ptr++;
40747c478bd9Sstevel@tonic-gate 		}
40757c478bd9Sstevel@tonic-gate 
40767c478bd9Sstevel@tonic-gate 		sndvec += MAX_SNDFL_PRD;
40777c478bd9Sstevel@tonic-gate 	}
40787c478bd9Sstevel@tonic-gate 	Xserialize();
40797c478bd9Sstevel@tonic-gate }
40807c478bd9Sstevel@tonic-gate 
40817c478bd9Sstevel@tonic-gate static void
40827c478bd9Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset)
40837c478bd9Sstevel@tonic-gate {
40847c478bd9Sstevel@tonic-gate 	struct memcntl_mha mha;
40857c478bd9Sstevel@tonic-gate 	const char *s = NULL;
40867c478bd9Sstevel@tonic-gate 
40877c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) {
40887c478bd9Sstevel@tonic-gate 		switch (mha.mha_cmd) {
40897c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
40907c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
40917c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
40927c478bd9Sstevel@tonic-gate 		}
40937c478bd9Sstevel@tonic-gate 		if (s)
40947c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
40957c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
40967c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha.mha_flags,
40977c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
40987c478bd9Sstevel@tonic-gate 		else
40997c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
41007c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%lu\n",
41017c478bd9Sstevel@tonic-gate 			    pri->pname, mha.mha_cmd, mha.mha_flags,
41027c478bd9Sstevel@tonic-gate 			    (ulong_t)mha.mha_pagesize);
41037c478bd9Sstevel@tonic-gate 	}
41047c478bd9Sstevel@tonic-gate }
41057c478bd9Sstevel@tonic-gate 
41067c478bd9Sstevel@tonic-gate #ifdef _LP64
41077c478bd9Sstevel@tonic-gate 
41087c478bd9Sstevel@tonic-gate static void
41097c478bd9Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset)
41107c478bd9Sstevel@tonic-gate {
41117c478bd9Sstevel@tonic-gate 	struct memcntl_mha32 mha32;
41127c478bd9Sstevel@tonic-gate 	const char *s = NULL;
41137c478bd9Sstevel@tonic-gate 
41147c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &mha32, sizeof (mha32), offset) ==
41157c478bd9Sstevel@tonic-gate 	    sizeof (mha32)) {
41167c478bd9Sstevel@tonic-gate 		switch (mha32.mha_cmd) {
41177c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_VA:	    s = "MHA_MAPSIZE_VA";	break;
41187c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_BSSBRK:    s = "MHA_MAPSIZE_BSSBRK";	break;
41197c478bd9Sstevel@tonic-gate 		case MHA_MAPSIZE_STACK:	    s = "MHA_MAPSIZE_STACK";	break;
41207c478bd9Sstevel@tonic-gate 		}
41217c478bd9Sstevel@tonic-gate 		if (s)
41227c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
41237c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
41247c478bd9Sstevel@tonic-gate 			    pri->pname, s, mha32.mha_flags, mha32.mha_pagesize);
41257c478bd9Sstevel@tonic-gate 		else
41267c478bd9Sstevel@tonic-gate 			(void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
41277c478bd9Sstevel@tonic-gate 			    " mha_pagesize=%u\n",
41287c478bd9Sstevel@tonic-gate 			    pri->pname, mha32.mha_cmd, mha32.mha_flags,
41297c478bd9Sstevel@tonic-gate 			    mha32.mha_pagesize);
41307c478bd9Sstevel@tonic-gate 	}
41317c478bd9Sstevel@tonic-gate }
41327c478bd9Sstevel@tonic-gate 
41337c478bd9Sstevel@tonic-gate #endif	/* _LP64 */
41347c478bd9Sstevel@tonic-gate 
41357c478bd9Sstevel@tonic-gate static void
41367c478bd9Sstevel@tonic-gate show_memcntl(private_t *pri)
41377c478bd9Sstevel@tonic-gate {
41387c478bd9Sstevel@tonic-gate 
41397c478bd9Sstevel@tonic-gate 	if ((int)pri->sys_args[2] != MC_HAT_ADVISE)
41407c478bd9Sstevel@tonic-gate 		return;
41417c478bd9Sstevel@tonic-gate #ifdef _LP64
41427c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_LP64)
41437c478bd9Sstevel@tonic-gate 		show_memcntl_mha(pri, (long)pri->sys_args[3]);
41447c478bd9Sstevel@tonic-gate 	else
41457c478bd9Sstevel@tonic-gate 		show_memcntl_mha32(pri, (long)pri->sys_args[3]);
41467c478bd9Sstevel@tonic-gate #else
41477c478bd9Sstevel@tonic-gate 	show_memcntl_mha(pri, (long)pri->sys_args[3]);
41487c478bd9Sstevel@tonic-gate #endif
41497c478bd9Sstevel@tonic-gate }
41507c478bd9Sstevel@tonic-gate 
41517c478bd9Sstevel@tonic-gate void
41527c478bd9Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count)
41537c478bd9Sstevel@tonic-gate {
41547c478bd9Sstevel@tonic-gate 	id_t buf[MYBUFSIZ / sizeof (id_t)];
41557c478bd9Sstevel@tonic-gate 	id_t *idp;
41567c478bd9Sstevel@tonic-gate 	int serial = (count > MYBUFSIZ / 48);
41577c478bd9Sstevel@tonic-gate 
41583b862e9aSRoger A. Faulkner 	if (offset == 0)
41597c478bd9Sstevel@tonic-gate 		return;
41607c478bd9Sstevel@tonic-gate 
41617c478bd9Sstevel@tonic-gate 	/* enter region of lengthy output */
41627c478bd9Sstevel@tonic-gate 	if (serial)
41637c478bd9Sstevel@tonic-gate 		Eserialize();
41647c478bd9Sstevel@tonic-gate 
41657c478bd9Sstevel@tonic-gate 	while (count > 0 && !interrupt) {
41667c478bd9Sstevel@tonic-gate 		ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)?
4167019c3c43Sraf 		    count * sizeof (id_t) : MYBUFSIZ;
41687c478bd9Sstevel@tonic-gate 
41697c478bd9Sstevel@tonic-gate 		if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 ||
41707c478bd9Sstevel@tonic-gate 		    nb < sizeof (id_t))
41717c478bd9Sstevel@tonic-gate 			break;
41727c478bd9Sstevel@tonic-gate 
41737c478bd9Sstevel@tonic-gate 		idp = buf;
41747c478bd9Sstevel@tonic-gate 		while (!interrupt && nb >= sizeof (id_t)) {
41757c478bd9Sstevel@tonic-gate 			(void) printf("%s\t%8d\n", pri->pname, (int)*idp);
41767c478bd9Sstevel@tonic-gate 			offset += sizeof (id_t);
41777c478bd9Sstevel@tonic-gate 			nb -= sizeof (id_t);
41787c478bd9Sstevel@tonic-gate 			idp++;
41797c478bd9Sstevel@tonic-gate 			count--;
41807c478bd9Sstevel@tonic-gate 		}
41817c478bd9Sstevel@tonic-gate 	}
41827c478bd9Sstevel@tonic-gate 
41837c478bd9Sstevel@tonic-gate 	/* exit region of lengthy output */
41847c478bd9Sstevel@tonic-gate 	if (serial)
41857c478bd9Sstevel@tonic-gate 		Xserialize();
41867c478bd9Sstevel@tonic-gate }
41877c478bd9Sstevel@tonic-gate 
41887c478bd9Sstevel@tonic-gate void
41897c478bd9Sstevel@tonic-gate show_ntp_gettime(private_t *pri)
41907c478bd9Sstevel@tonic-gate {
41917c478bd9Sstevel@tonic-gate 	struct ntptimeval ntv;
41927c478bd9Sstevel@tonic-gate 	long offset;
41937c478bd9Sstevel@tonic-gate 
4194*27aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
41957c478bd9Sstevel@tonic-gate 		return;
41967c478bd9Sstevel@tonic-gate 
41977c478bd9Sstevel@tonic-gate 	if (data_model == PR_MODEL_NATIVE) {
41987c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv, sizeof (ntv), offset)
41997c478bd9Sstevel@tonic-gate 		    != sizeof (ntv))
42007c478bd9Sstevel@tonic-gate 			return;
42017c478bd9Sstevel@tonic-gate 	} else {
42027c478bd9Sstevel@tonic-gate 		struct ntptimeval32 ntv32;
42037c478bd9Sstevel@tonic-gate 
42047c478bd9Sstevel@tonic-gate 		if (Pread(Proc, &ntv32, sizeof (ntv32), offset)
42057c478bd9Sstevel@tonic-gate 		    != sizeof (ntv32))
42067c478bd9Sstevel@tonic-gate 			return;
42077c478bd9Sstevel@tonic-gate 
42087c478bd9Sstevel@tonic-gate 		TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time);
42097c478bd9Sstevel@tonic-gate 		ntv.maxerror = ntv32.maxerror;
42107c478bd9Sstevel@tonic-gate 		ntv.esterror = ntv32.esterror;
42117c478bd9Sstevel@tonic-gate 	}
42127c478bd9Sstevel@tonic-gate 
42137c478bd9Sstevel@tonic-gate 	(void) printf("\ttime:     %ld.%6.6ld sec\n",
42147c478bd9Sstevel@tonic-gate 	    ntv.time.tv_sec, ntv.time.tv_usec);
42157c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror: %11d usec\n", ntv.maxerror);
42167c478bd9Sstevel@tonic-gate 	(void) printf("\testerror: %11d usec\n", ntv.esterror);
42177c478bd9Sstevel@tonic-gate }
42187c478bd9Sstevel@tonic-gate 
42197c478bd9Sstevel@tonic-gate static char *
42207c478bd9Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val)
42217c478bd9Sstevel@tonic-gate {
42227c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
42237c478bd9Sstevel@tonic-gate 	size_t used = 0;
42247c478bd9Sstevel@tonic-gate 
42257c478bd9Sstevel@tonic-gate 	*str = '\0';
42267c478bd9Sstevel@tonic-gate 	if (val & MOD_OFFSET)
42277c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf));
42287c478bd9Sstevel@tonic-gate 	if (val & MOD_FREQUENCY)
42297c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf));
42307c478bd9Sstevel@tonic-gate 	if (val & MOD_MAXERROR)
42317c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf));
42327c478bd9Sstevel@tonic-gate 	if (val & MOD_ESTERROR)
42337c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf));
42347c478bd9Sstevel@tonic-gate 	if (val & MOD_STATUS)
42357c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf));
42367c478bd9Sstevel@tonic-gate 	if (val & MOD_TIMECONST)
42377c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf));
42387c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKB)
42397c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf));
42407c478bd9Sstevel@tonic-gate 	if (val & MOD_CLKA)
42417c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf));
42427c478bd9Sstevel@tonic-gate 
42437c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
42447c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
42457c478bd9Sstevel@tonic-gate 
42467c478bd9Sstevel@tonic-gate 	return (str + 1);
42477c478bd9Sstevel@tonic-gate }
42487c478bd9Sstevel@tonic-gate 
42497c478bd9Sstevel@tonic-gate static char *
42507c478bd9Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val)
42517c478bd9Sstevel@tonic-gate {
42527c478bd9Sstevel@tonic-gate 	char *str = pri->code_buf;
42537c478bd9Sstevel@tonic-gate 	size_t used = 0;
42547c478bd9Sstevel@tonic-gate 
42557c478bd9Sstevel@tonic-gate 	*str = '\0';
42567c478bd9Sstevel@tonic-gate 	if (val & STA_PLL)
42577c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf));
42587c478bd9Sstevel@tonic-gate 	if (val & STA_PPSFREQ)
42597c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf));
42607c478bd9Sstevel@tonic-gate 	if (val & STA_PPSTIME)
42617c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf));
42627c478bd9Sstevel@tonic-gate 	if (val & STA_FLL)
42637c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf));
42647c478bd9Sstevel@tonic-gate 
42657c478bd9Sstevel@tonic-gate 	if (val & STA_INS)
42667c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_INS", sizeof (pri->code_buf));
42677c478bd9Sstevel@tonic-gate 	if (val & STA_DEL)
42687c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf));
42697c478bd9Sstevel@tonic-gate 	if (val & STA_UNSYNC)
42707c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf));
42717c478bd9Sstevel@tonic-gate 	if (val & STA_FREQHOLD)
42727c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf));
42737c478bd9Sstevel@tonic-gate 
42747c478bd9Sstevel@tonic-gate 	if (val & STA_PPSSIGNAL)
42757c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf));
42767c478bd9Sstevel@tonic-gate 	if (val & STA_PPSJITTER)
42777c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf));
42787c478bd9Sstevel@tonic-gate 	if (val & STA_PPSWANDER)
42797c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf));
42807c478bd9Sstevel@tonic-gate 	if (val & STA_PPSERROR)
42817c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf));
42827c478bd9Sstevel@tonic-gate 
42837c478bd9Sstevel@tonic-gate 	if (val & STA_CLOCKERR)
42847c478bd9Sstevel@tonic-gate 		used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf));
42857c478bd9Sstevel@tonic-gate 
42867c478bd9Sstevel@tonic-gate 	if (used == 0 || used >= sizeof (pri->code_buf))
42877c478bd9Sstevel@tonic-gate 		(void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
42887c478bd9Sstevel@tonic-gate 
42897c478bd9Sstevel@tonic-gate 	return (str + 1);
42907c478bd9Sstevel@tonic-gate }
42917c478bd9Sstevel@tonic-gate 
42927c478bd9Sstevel@tonic-gate void
42937c478bd9Sstevel@tonic-gate show_ntp_adjtime(private_t *pri)
42947c478bd9Sstevel@tonic-gate {
42957c478bd9Sstevel@tonic-gate 	struct timex timex;
42967c478bd9Sstevel@tonic-gate 	long offset;
42977c478bd9Sstevel@tonic-gate 
4298*27aa4812SToomas Soome 	if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
42997c478bd9Sstevel@tonic-gate 		return;
43007c478bd9Sstevel@tonic-gate 
43017c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex))
43027c478bd9Sstevel@tonic-gate 		return;
43037c478bd9Sstevel@tonic-gate 
43047c478bd9Sstevel@tonic-gate 	(void) printf("\tmodes:     %s\n", get_timex_modes(pri, timex.modes));
43057c478bd9Sstevel@tonic-gate 	(void) printf("\toffset:    %11d usec\n", timex.offset);
43067c478bd9Sstevel@tonic-gate 	(void) printf("\tfreq:      %11d scaled ppm\n", timex.freq);
43077c478bd9Sstevel@tonic-gate 	(void) printf("\tmaxerror:  %11d usec\n", timex.maxerror);
43087c478bd9Sstevel@tonic-gate 	(void) printf("\testerror:  %11d usec\n", timex.esterror);
43097c478bd9Sstevel@tonic-gate 	(void) printf("\tstatus:    %s\n", get_timex_status(pri, timex.status));
43107c478bd9Sstevel@tonic-gate 	(void) printf("\tconstant:  %11d\n", timex.constant);
43117c478bd9Sstevel@tonic-gate 	(void) printf("\tprecision: %11d usec\n", timex.precision);
43127c478bd9Sstevel@tonic-gate 	(void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance);
43137c478bd9Sstevel@tonic-gate 	(void) printf("\tppsfreq:   %11d scaled ppm\n", timex.ppsfreq);
43147c478bd9Sstevel@tonic-gate 	(void) printf("\tjitter:    %11d usec\n", timex.jitter);
43157c478bd9Sstevel@tonic-gate 	(void) printf("\tshift:     %11d sec\n", timex.shift);
43167c478bd9Sstevel@tonic-gate 	(void) printf("\tstabil:    %11d scaled ppm\n", timex.stabil);
43177c478bd9Sstevel@tonic-gate 	(void) printf("\tjitcnt:    %11d\n", timex.jitcnt);
43187c478bd9Sstevel@tonic-gate 	(void) printf("\tcalcnt:    %11d\n", timex.calcnt);
43197c478bd9Sstevel@tonic-gate 	(void) printf("\terrcnt:    %11d\n", timex.errcnt);
43207c478bd9Sstevel@tonic-gate 	(void) printf("\tstbcnt:    %11d\n", timex.stbcnt);
43217c478bd9Sstevel@tonic-gate }
43227c478bd9Sstevel@tonic-gate 
43237c478bd9Sstevel@tonic-gate void
43247c478bd9Sstevel@tonic-gate show_getrusage(long offset)
43257c478bd9Sstevel@tonic-gate {
43267c478bd9Sstevel@tonic-gate 	struct rusage r;
43277c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
43287c478bd9Sstevel@tonic-gate 		return;
43297c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %ld.%6.6ld sec\n",
43307c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
43317c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
43327c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %ld.%6.6ld sec\n",
43337c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
43347c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
43357c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %ld\n",
43367c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
43377c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %ld\n",
43387c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
43397c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %ld\n",
43407c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
43417c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %ld\n",
43427c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
43437c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %ld\n",
43447c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
43457c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %ld\n",
43467c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
43477c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %ld\n",
43487c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
43497c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %ld\n",
43507c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
43517c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %ld\n",
43527c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
43537c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %ld\n",
43547c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
43557c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %ld\n",
43567c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
43577c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %ld\n",
43587c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
43597c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %ld\n",
43607c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
43617c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %ld\n",
43627c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
43637c478bd9Sstevel@tonic-gate }
43647c478bd9Sstevel@tonic-gate 
43657c478bd9Sstevel@tonic-gate #ifdef _LP64
43667c478bd9Sstevel@tonic-gate void
43677c478bd9Sstevel@tonic-gate show_getrusage32(long offset)
43687c478bd9Sstevel@tonic-gate {
43697c478bd9Sstevel@tonic-gate 	struct rusage32 r;
43707c478bd9Sstevel@tonic-gate 	if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
43717c478bd9Sstevel@tonic-gate 		return;
43727c478bd9Sstevel@tonic-gate 	(void) printf("\t       user time: %d.%6.6d sec\n",
43737c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_sec,
43747c478bd9Sstevel@tonic-gate 	    r.ru_utime.tv_usec);
43757c478bd9Sstevel@tonic-gate 	(void) printf("\t     system time: %d.%6.6d sec\n",
43767c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_sec,
43777c478bd9Sstevel@tonic-gate 	    r.ru_stime.tv_usec);
43787c478bd9Sstevel@tonic-gate 	(void) printf("\t         max rss: <unimpl> %d\n",
43797c478bd9Sstevel@tonic-gate 	    r.ru_maxrss);
43807c478bd9Sstevel@tonic-gate 	(void) printf("\t     shared data: <unimpl> %d\n",
43817c478bd9Sstevel@tonic-gate 	    r.ru_ixrss);
43827c478bd9Sstevel@tonic-gate 	(void) printf("\t   unshared data: <unimpl> %d\n",
43837c478bd9Sstevel@tonic-gate 	    r.ru_idrss);
43847c478bd9Sstevel@tonic-gate 	(void) printf("\t  unshared stack: <unimpl> %d\n",
43857c478bd9Sstevel@tonic-gate 	    r.ru_isrss);
43867c478bd9Sstevel@tonic-gate 	(void) printf("\t    minor faults: %d\n",
43877c478bd9Sstevel@tonic-gate 	    r.ru_minflt);
43887c478bd9Sstevel@tonic-gate 	(void) printf("\t    major faults: %d\n",
43897c478bd9Sstevel@tonic-gate 	    r.ru_majflt);
43907c478bd9Sstevel@tonic-gate 	(void) printf("\t      # of swaps: %d\n",
43917c478bd9Sstevel@tonic-gate 	    r.ru_nswap);
43927c478bd9Sstevel@tonic-gate 	(void) printf("\t  blocked inputs: %d\n",
43937c478bd9Sstevel@tonic-gate 	    r.ru_inblock);
43947c478bd9Sstevel@tonic-gate 	(void) printf("\t blocked outputs: %d\n",
43957c478bd9Sstevel@tonic-gate 	    r.ru_oublock);
43967c478bd9Sstevel@tonic-gate 	(void) printf("\t       msgs sent: %d\n",
43977c478bd9Sstevel@tonic-gate 	    r.ru_msgsnd);
43987c478bd9Sstevel@tonic-gate 	(void) printf("\t      msgs rcv'd: %d\n",
43997c478bd9Sstevel@tonic-gate 	    r.ru_msgrcv);
44007c478bd9Sstevel@tonic-gate 	(void) printf("\t   signals rcv'd: %d\n",
44017c478bd9Sstevel@tonic-gate 	    r.ru_nsignals);
44027c478bd9Sstevel@tonic-gate 	(void) printf("\tvol cntxt swtchs: %d\n",
44037c478bd9Sstevel@tonic-gate 	    r.ru_nvcsw);
44047c478bd9Sstevel@tonic-gate 	(void) printf("\tinv cntxt swtchs: %d\n",
44057c478bd9Sstevel@tonic-gate 	    r.ru_nivcsw);
44067c478bd9Sstevel@tonic-gate }
44077c478bd9Sstevel@tonic-gate #endif
44087c478bd9Sstevel@tonic-gate 
4409aa4a4f3bSnf /*
4410aa4a4f3bSnf  * Utility function to print a packed nvlist by unpacking
4411aa4a4f3bSnf  * and calling the libnvpair pretty printer.  Frees all
4412aa4a4f3bSnf  * allocated memory internally.
4413aa4a4f3bSnf  */
4414aa4a4f3bSnf static void
4415aa4a4f3bSnf show_packed_nvlist(private_t *pri, uintptr_t offset, size_t size)
4416aa4a4f3bSnf {
4417aa4a4f3bSnf 	nvlist_t *nvl = NULL;
4418aa4a4f3bSnf 	size_t readsize;
4419aa4a4f3bSnf 	char *buf;
4420aa4a4f3bSnf 
4421aa4a4f3bSnf 	if ((offset == 0) || (size == 0)) {
4422aa4a4f3bSnf 		return;
4423aa4a4f3bSnf 	}
4424aa4a4f3bSnf 
4425aa4a4f3bSnf 	buf = my_malloc(size, "nvlist decode buffer");
4426aa4a4f3bSnf 	readsize = Pread(Proc, buf, size, offset);
4427aa4a4f3bSnf 	if (readsize != size) {
4428aa4a4f3bSnf 		(void) printf("%s\t<?>", pri->pname);
4429aa4a4f3bSnf 	} else {
4430aa4a4f3bSnf 		int result;
4431aa4a4f3bSnf 
4432aa4a4f3bSnf 		result = nvlist_unpack(buf, size, &nvl, 0);
4433aa4a4f3bSnf 		if (result == 0) {
4434a803cc21SGordon Ross 			dump_nvlist(nvl, 8);
4435aa4a4f3bSnf 			nvlist_free(nvl);
4436aa4a4f3bSnf 		} else {
4437aa4a4f3bSnf 			(void) printf("%s\tunpack of nvlist"
4438aa4a4f3bSnf 			    " failed: %d\n", pri->pname, result);
4439aa4a4f3bSnf 		}
4440aa4a4f3bSnf 	}
4441aa4a4f3bSnf 	free(buf);
4442aa4a4f3bSnf }
4443aa4a4f3bSnf 
4444821c4a97Sdp static void
4445821c4a97Sdp show_zone_create_args(private_t *pri, long offset)
4446821c4a97Sdp {
4447821c4a97Sdp 	zone_def args;
4448821c4a97Sdp 	char zone_name[ZONENAME_MAX];
4449821c4a97Sdp 	char zone_root[MAXPATHLEN];
4450821c4a97Sdp 	char *zone_zfs = NULL;
4451821c4a97Sdp 
4452821c4a97Sdp 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4453821c4a97Sdp 
4454821c4a97Sdp 		if (Pread_string(Proc, zone_name, sizeof (zone_name),
4455821c4a97Sdp 		    (uintptr_t)args.zone_name) == -1)
4456821c4a97Sdp 			(void) strcpy(zone_name, "<?>");
4457821c4a97Sdp 
4458821c4a97Sdp 		if (Pread_string(Proc, zone_root, sizeof (zone_root),
4459821c4a97Sdp 		    (uintptr_t)args.zone_root) == -1)
4460821c4a97Sdp 			(void) strcpy(zone_root, "<?>");
4461821c4a97Sdp 
4462821c4a97Sdp 		if (args.zfsbufsz > 0) {
4463821c4a97Sdp 			zone_zfs = malloc(MIN(4, args.zfsbufsz));
4464821c4a97Sdp 			if (zone_zfs != NULL) {
4465821c4a97Sdp 				if (Pread(Proc, zone_zfs, args.zfsbufsz,
4466821c4a97Sdp 				    (uintptr_t)args.zfsbuf) == -1)
4467821c4a97Sdp 					(void) strcpy(zone_zfs, "<?>");
4468821c4a97Sdp 			}
4469821c4a97Sdp 		} else {
4470821c4a97Sdp 			zone_zfs = "";
4471821c4a97Sdp 		}
4472821c4a97Sdp 
4473821c4a97Sdp 		(void) printf("%s\t     zone_name: %s\n", pri->pname,
4474821c4a97Sdp 		    zone_name);
4475821c4a97Sdp 		(void) printf("%s\t     zone_root: %s\n", pri->pname,
4476821c4a97Sdp 		    zone_root);
4477821c4a97Sdp 
4478821c4a97Sdp 		show_privset(pri, (uintptr_t)args.zone_privs,
4479821c4a97Sdp 		    args.zone_privssz, "    zone_privs: ");
4480821c4a97Sdp 
4481821c4a97Sdp 		(void) printf("%s\t       rctlbuf: 0x%p\n", pri->pname,
4482821c4a97Sdp 		    (void *)args.rctlbuf);
4483821c4a97Sdp 		(void) printf("%s\t     rctlbufsz: %lu\n", pri->pname,
4484821c4a97Sdp 		    (ulong_t)args.rctlbufsz);
4485821c4a97Sdp 
4486aa4a4f3bSnf 		show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4487aa4a4f3bSnf 		    args.rctlbufsz);
4488aa4a4f3bSnf 
4489821c4a97Sdp 		(void) printf("%s\t           zfs: %s\n", pri->pname, zone_zfs);
4490821c4a97Sdp 
4491821c4a97Sdp 		(void) printf("%s\textended_error: 0x%p\n", pri->pname,
4492821c4a97Sdp 		    (void *)args.extended_error);
4493821c4a97Sdp 
449445916cd2Sjpk 		if (is_system_labeled()) {
449545916cd2Sjpk 			char		*label_str = NULL;
449645916cd2Sjpk 			bslabel_t	zone_label;
449745916cd2Sjpk 
449845916cd2Sjpk 			(void) printf("%s\t         match: %d\n", pri->pname,
449945916cd2Sjpk 			    args.match);
450045916cd2Sjpk 			(void) printf("%s\t           doi: %d\n", pri->pname,
450145916cd2Sjpk 			    args.doi);
450245916cd2Sjpk 
450345916cd2Sjpk 			if (Pread_string(Proc, (char *)&zone_label,
450445916cd2Sjpk 			    sizeof (zone_label), (uintptr_t)args.label) != -1) {
450545916cd2Sjpk 				/* show the label as string */
450645916cd2Sjpk 				if (label_to_str(&zone_label, &label_str,
450745916cd2Sjpk 				    M_LABEL, SHORT_NAMES) != 0) {
450845916cd2Sjpk 					/* have to dump label as raw string */
450945916cd2Sjpk 					(void) label_to_str(&zone_label,
451045916cd2Sjpk 					    &label_str, M_INTERNAL,
451145916cd2Sjpk 					    SHORT_NAMES);
451245916cd2Sjpk 				}
451345916cd2Sjpk 			}
451445916cd2Sjpk 
451545916cd2Sjpk 			(void) printf("%s\t         label: %s\n",
451645916cd2Sjpk 			    pri->pname, label_str != NULL ? label_str : "<?>");
451745916cd2Sjpk 			if (label_str)
451845916cd2Sjpk 				free(label_str);
451945916cd2Sjpk 		}
452045916cd2Sjpk 
4521821c4a97Sdp 		if (args.zfsbufsz > 0)
4522821c4a97Sdp 			free(zone_zfs);
4523821c4a97Sdp 	}
4524821c4a97Sdp }
4525821c4a97Sdp 
4526821c4a97Sdp 
4527821c4a97Sdp #ifdef _LP64
4528821c4a97Sdp 
4529821c4a97Sdp static void
4530821c4a97Sdp show_zone_create_args32(private_t *pri, long offset)
4531821c4a97Sdp {
4532821c4a97Sdp 	zone_def32 args;
4533821c4a97Sdp 	char zone_name[ZONENAME_MAX];
4534821c4a97Sdp 	char zone_root[MAXPATHLEN];
4535821c4a97Sdp 	char *zone_zfs = NULL;
4536821c4a97Sdp 
4537821c4a97Sdp 	if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4538821c4a97Sdp 
4539821c4a97Sdp 		if (Pread_string(Proc, zone_name, sizeof (zone_name),
4540821c4a97Sdp 		    (uintptr_t)args.zone_name) == -1)
4541821c4a97Sdp 			(void) strcpy(zone_name, "<?>");
4542821c4a97Sdp 
4543821c4a97Sdp 		if (Pread_string(Proc, zone_root, sizeof (zone_root),
4544821c4a97Sdp 		    (uintptr_t)args.zone_root) == -1)
4545821c4a97Sdp 			(void) strcpy(zone_root, "<?>");
4546821c4a97Sdp 
4547821c4a97Sdp 		if (args.zfsbufsz > 0) {
4548821c4a97Sdp 			zone_zfs = malloc(MIN(4, args.zfsbufsz));
4549821c4a97Sdp 			if (zone_zfs != NULL) {
4550821c4a97Sdp 				if (Pread(Proc, zone_zfs, args.zfsbufsz,
4551821c4a97Sdp 				    (uintptr_t)args.zfsbuf) == -1)
4552821c4a97Sdp 					(void) strcpy(zone_zfs, "<?>");
4553821c4a97Sdp 			}
4554821c4a97Sdp 		} else {
4555821c4a97Sdp 			zone_zfs = "";
4556821c4a97Sdp 		}
4557821c4a97Sdp 
4558821c4a97Sdp 		(void) printf("%s\t     zone_name: %s\n", pri->pname,
4559821c4a97Sdp 		    zone_name);
4560821c4a97Sdp 		(void) printf("%s\t     zone_root: %s\n", pri->pname,
4561821c4a97Sdp 		    zone_root);
4562821c4a97Sdp 
4563821c4a97Sdp 		show_privset(pri, (uintptr_t)args.zone_privs,
4564821c4a97Sdp 		    args.zone_privssz, "    zone_privs: ");
4565821c4a97Sdp 
45663246257cSdp 		(void) printf("%s\t       rctlbuf: 0x%x\n", pri->pname,
45673246257cSdp 		    (caddr32_t)args.rctlbuf);
4568821c4a97Sdp 		(void) printf("%s\t     rctlbufsz: %lu\n", pri->pname,
4569821c4a97Sdp 		    (ulong_t)args.rctlbufsz);
4570821c4a97Sdp 
4571aa4a4f3bSnf 		show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4572aa4a4f3bSnf 		    args.rctlbufsz);
4573aa4a4f3bSnf 
4574821c4a97Sdp 		(void) printf("%s\t           zfs: %s\n", pri->pname, zone_zfs);
4575821c4a97Sdp 
45763246257cSdp 		(void) printf("%s\textended_error: 0x%x\n", pri->pname,
45773246257cSdp 		    (caddr32_t)args.extended_error);
4578821c4a97Sdp 
457945916cd2Sjpk 		if (is_system_labeled()) {
458045916cd2Sjpk 			char		*label_str = NULL;
458145916cd2Sjpk 			bslabel_t	zone_label;
458245916cd2Sjpk 
458345916cd2Sjpk 			(void) printf("%s\t         match: %d\n", pri->pname,
458445916cd2Sjpk 			    args.match);
458545916cd2Sjpk 			(void) printf("%s\t           doi: %d\n", pri->pname,
458645916cd2Sjpk 			    args.doi);
458745916cd2Sjpk 
458845916cd2Sjpk 			if (Pread_string(Proc, (char *)&zone_label,
458945916cd2Sjpk 			    sizeof (zone_label), (caddr32_t)args.label) != -1) {
459045916cd2Sjpk 				/* show the label as string */
459145916cd2Sjpk 				if (label_to_str(&zone_label, &label_str,
459245916cd2Sjpk 				    M_LABEL, SHORT_NAMES) != 0) {
459345916cd2Sjpk 					/* have to dump label as raw string */
459445916cd2Sjpk 					(void) label_to_str(&zone_label,
459545916cd2Sjpk 					    &label_str, M_INTERNAL,
459645916cd2Sjpk 					    SHORT_NAMES);
459745916cd2Sjpk 				}
459845916cd2Sjpk 			}
459945916cd2Sjpk 			(void) printf("%s\t         label: %s\n",
460045916cd2Sjpk 			    pri->pname, label_str != NULL ? label_str : "<?>");
460145916cd2Sjpk 			if (label_str)
460245916cd2Sjpk 				free(label_str);
460345916cd2Sjpk 		}
460445916cd2Sjpk 
4605821c4a97Sdp 		if (args.zfsbufsz > 0)
4606821c4a97Sdp 			free(zone_zfs);
4607821c4a97Sdp 	}
4608821c4a97Sdp }
4609821c4a97Sdp 
4610821c4a97Sdp #endif
4611821c4a97Sdp 
4612821c4a97Sdp static void
4613821c4a97Sdp show_zones(private_t *pri)
4614821c4a97Sdp {
4615821c4a97Sdp 	switch (pri->sys_args[0]) {
4616821c4a97Sdp 	case ZONE_CREATE:
4617821c4a97Sdp #ifdef _LP64
4618821c4a97Sdp 		if (data_model == PR_MODEL_LP64)
4619821c4a97Sdp 			show_zone_create_args(pri, (long)pri->sys_args[1]);
4620821c4a97Sdp 		else
4621821c4a97Sdp 			show_zone_create_args32(pri, (long)pri->sys_args[1]);
4622821c4a97Sdp #else
4623821c4a97Sdp 		show_zone_create_args(pri, (long)pri->sys_args[1]);
4624821c4a97Sdp #endif
4625821c4a97Sdp 		break;
4626821c4a97Sdp 	}
4627821c4a97Sdp }
4628821c4a97Sdp 
4629aa4a4f3bSnf static void
4630aa4a4f3bSnf show_rctlblk(private_t *pri, long _rctlblk)
4631aa4a4f3bSnf {
4632aa4a4f3bSnf 	rctlblk_t *blk;
4633aa4a4f3bSnf 	int size = rctlblk_size();
4634aa4a4f3bSnf 	size_t readsize;
4635aa4a4f3bSnf 	const char *s;
4636aa4a4f3bSnf 
4637aa4a4f3bSnf 	blk = my_malloc(size, "rctlblk decode buffer");
4638aa4a4f3bSnf 	readsize = Pread(Proc, blk, size, _rctlblk);
4639aa4a4f3bSnf 	if (readsize != size) {
4640aa4a4f3bSnf 		(void) printf("%s\t\t<?>", pri->pname);
4641aa4a4f3bSnf 	} else {
4642aa4a4f3bSnf 		(void) printf("%s\t\t     Privilege: 0x%x\n",
4643aa4a4f3bSnf 		    pri->pname,
4644aa4a4f3bSnf 		    rctlblk_get_privilege(blk));
4645aa4a4f3bSnf 		(void) printf("%s\t\t         Value: %lld\n",
4646aa4a4f3bSnf 		    pri->pname,
4647aa4a4f3bSnf 		    rctlblk_get_value(blk));
4648aa4a4f3bSnf 		(void) printf("%s\t\tEnforced Value: %lld\n",
4649aa4a4f3bSnf 		    pri->pname,
4650aa4a4f3bSnf 		    rctlblk_get_enforced_value(blk));
4651aa4a4f3bSnf 
4652aa4a4f3bSnf 		{
4653aa4a4f3bSnf 			int sig, act;
4654aa4a4f3bSnf 			act = rctlblk_get_local_action(blk, &sig);
4655aa4a4f3bSnf 
4656aa4a4f3bSnf 			s = rctl_local_action(pri, act);
4657aa4a4f3bSnf 			if (s == NULL) {
4658aa4a4f3bSnf 				(void) printf("%s\t\t  Local action: 0x%x\n",
4659aa4a4f3bSnf 				    pri->pname, act);
4660aa4a4f3bSnf 			} else {
4661aa4a4f3bSnf 				(void) printf("%s\t\t  Local action: %s\n",
4662aa4a4f3bSnf 				    pri->pname, s);
4663aa4a4f3bSnf 			}
4664aa4a4f3bSnf 
4665aa4a4f3bSnf 			if (act & RCTL_LOCAL_SIGNAL) {
4666aa4a4f3bSnf 				(void) printf("%s\t\t                "
4667aa4a4f3bSnf 				    "For signal %s\n",
4668aa4a4f3bSnf 				    pri->pname, signame(pri, sig));
4669aa4a4f3bSnf 			}
4670aa4a4f3bSnf 		}
4671aa4a4f3bSnf 
4672aa4a4f3bSnf 		s = rctl_local_flags(pri, rctlblk_get_local_flags(blk));
4673aa4a4f3bSnf 		if (s == NULL) {
4674aa4a4f3bSnf 			(void) printf("%s\t\t   Local flags: 0x%x\n",
4675aa4a4f3bSnf 			    pri->pname, rctlblk_get_local_flags(blk));
4676aa4a4f3bSnf 		} else {
4677aa4a4f3bSnf 			(void) printf("%s\t\t   Local flags: %s\n",
4678aa4a4f3bSnf 			    pri->pname, s);
4679aa4a4f3bSnf 		}
4680aa4a4f3bSnf 
4681aa4a4f3bSnf #ifdef _LP64
4682aa4a4f3bSnf 		(void) printf("%s\t\t Recipient PID: %d\n",
4683aa4a4f3bSnf 		    pri->pname,
4684aa4a4f3bSnf 		    rctlblk_get_recipient_pid(blk));
4685aa4a4f3bSnf #else
4686aa4a4f3bSnf 		(void) printf("%s\t\t Recipient PID: %ld\n",
4687aa4a4f3bSnf 		    pri->pname,
4688aa4a4f3bSnf 		    rctlblk_get_recipient_pid(blk));
4689aa4a4f3bSnf #endif
4690aa4a4f3bSnf 		(void) printf("%s\t\t   Firing Time: %lld\n",
4691aa4a4f3bSnf 		    pri->pname,
4692aa4a4f3bSnf 		    rctlblk_get_firing_time(blk));
4693aa4a4f3bSnf 	}
4694aa4a4f3bSnf 	free(blk);
4695aa4a4f3bSnf }
4696aa4a4f3bSnf 
4697aa4a4f3bSnf static void
4698aa4a4f3bSnf show_rctls(private_t *pri)
4699aa4a4f3bSnf {
4700532877c4Srd 	int entry;
4701532877c4Srd 
4702aa4a4f3bSnf 	switch (pri->sys_args[0]) {
4703aa4a4f3bSnf 	case 0:	/* getrctl */
4704aa4a4f3bSnf 	case 1: /* setrctl */
4705aa4a4f3bSnf 		/*
4706aa4a4f3bSnf 		 * If these offsets look a little odd, remember that they're
4707aa4a4f3bSnf 		 * into the _raw_ system call
4708aa4a4f3bSnf 		 */
4709aa4a4f3bSnf 		(void) printf("%s\tOld rctlblk: 0x%lx\n", pri->pname,
4710aa4a4f3bSnf 		    pri->sys_args[2]);
4711*27aa4812SToomas Soome 		if (pri->sys_args[2] != 0) {
4712aa4a4f3bSnf 			show_rctlblk(pri, pri->sys_args[2]);
4713aa4a4f3bSnf 		}
4714aa4a4f3bSnf 		(void) printf("%s\tNew rctlblk: 0x%lx\n", pri->pname,
4715aa4a4f3bSnf 		    pri->sys_args[3]);
4716*27aa4812SToomas Soome 		if (pri->sys_args[3] != 0) {
4717aa4a4f3bSnf 			show_rctlblk(pri, pri->sys_args[3]);
4718aa4a4f3bSnf 		}
4719aa4a4f3bSnf 		break;
4720532877c4Srd 	case 4: /* setprojrctl */
4721532877c4Srd 		for (entry = 0; entry < pri->sys_args[4]; entry++) {
4722532877c4Srd 			(void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4723532877c4Srd 			    pri->pname, entry,
4724532877c4Srd 			    (long)RCTLBLK_INC(pri->sys_args[3], entry));
4725532877c4Srd 			if (RCTLBLK_INC(pri->sys_args[3], entry) != NULL) {
4726532877c4Srd 				show_rctlblk(pri,
4727532877c4Srd 				    (long)RCTLBLK_INC(pri->sys_args[3], entry));
4728532877c4Srd 			}
4729532877c4Srd 		}
4730aa4a4f3bSnf 	}
4731aa4a4f3bSnf }
4732821c4a97Sdp 
47333b862e9aSRoger A. Faulkner void
47343b862e9aSRoger A. Faulkner show_utimesys(private_t *pri)
47353b862e9aSRoger A. Faulkner {
47363b862e9aSRoger A. Faulkner 	switch (pri->sys_args[0]) {
47373b862e9aSRoger A. Faulkner 	case 0:			/* futimens() */
47383b862e9aSRoger A. Faulkner 		if (pri->sys_nargs > 2)
47393b862e9aSRoger A. Faulkner 			show_utimens(pri, (long)pri->sys_args[2]);
47403b862e9aSRoger A. Faulkner 		break;
47413b862e9aSRoger A. Faulkner 	case 1:			/* utimensat */
47423b862e9aSRoger A. Faulkner 		if (pri->sys_nargs > 3)
47433b862e9aSRoger A. Faulkner 			show_utimens(pri, (long)pri->sys_args[3]);
47443b862e9aSRoger A. Faulkner 		break;
47453b862e9aSRoger A. Faulkner 	default:		/* unexpected subcode */
47463b862e9aSRoger A. Faulkner 		break;
47473b862e9aSRoger A. Faulkner 	}
47483b862e9aSRoger A. Faulkner }
47493b862e9aSRoger A. Faulkner 
47503e95bd4aSAnders Persson #ifdef _LP64
47513e95bd4aSAnders Persson static void
47523e95bd4aSAnders Persson show_sockconfig_filter_prop32(private_t *pri, long addr)
47533e95bd4aSAnders Persson {
47543e95bd4aSAnders Persson 	struct sockconfig_filter_props32 props;
47553e95bd4aSAnders Persson 	const char *s = NULL;
47563e95bd4aSAnders Persson 	char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
47573e95bd4aSAnders Persson 	sof_socktuple32_t *tup;
47583e95bd4aSAnders Persson 	size_t sz;
47593e95bd4aSAnders Persson 	int i;
47603e95bd4aSAnders Persson 
47613e95bd4aSAnders Persson 	if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
47623e95bd4aSAnders Persson 		if (Pread_string(Proc, buf, sizeof (buf),
47633e95bd4aSAnders Persson 		    (uintptr_t)props.sfp_modname) == -1)
47643e95bd4aSAnders Persson 			(void) strcpy(buf, "<?>");
47653e95bd4aSAnders Persson 		(void) printf("%s\tmodule name: %s\n", pri->pname, buf);
47663e95bd4aSAnders Persson 		(void) printf("%s\tattach semantics: %s", pri->pname,
47673e95bd4aSAnders Persson 		    props.sfp_autoattach ? "automatic" : "progammatic");
47683e95bd4aSAnders Persson 		if (props.sfp_autoattach) {
47693e95bd4aSAnders Persson 			buf[0] = '\0';
47703e95bd4aSAnders Persson 			switch (props.sfp_hint) {
47713e95bd4aSAnders Persson 			case SOF_HINT_TOP:	s = "top"; break;
47723e95bd4aSAnders Persson 			case SOF_HINT_BOTTOM:	s = "bottom"; break;
47733e95bd4aSAnders Persson 			case SOF_HINT_BEFORE:
47743e95bd4aSAnders Persson 			case SOF_HINT_AFTER:
47753e95bd4aSAnders Persson 				s = (props.sfp_hint == SOF_HINT_BEFORE) ?
47763e95bd4aSAnders Persson 				    "before" : "after";
47773e95bd4aSAnders Persson 				if (Pread_string(Proc, buf, sizeof (buf),
47783e95bd4aSAnders Persson 				    (uintptr_t)props.sfp_hintarg) == -1)
47793e95bd4aSAnders Persson 					(void) strcpy(buf, "<?>");
47803e95bd4aSAnders Persson 			}
47813e95bd4aSAnders Persson 			if (s != NULL) {
47823e95bd4aSAnders Persson 				(void) printf(", placement: %s %s", s, buf);
47833e95bd4aSAnders Persson 			}
47843e95bd4aSAnders Persson 		}
47853e95bd4aSAnders Persson 		(void) printf("\n");
47863e95bd4aSAnders Persson 		(void) printf("%s\tsocket tuples:\n", pri->pname);
47873e95bd4aSAnders Persson 		if (props.sfp_socktuple_cnt == 0) {
47883e95bd4aSAnders Persson 			(void) printf("\t\t<empty>\n");
47893e95bd4aSAnders Persson 			return;
47903e95bd4aSAnders Persson 		}
47913e95bd4aSAnders Persson 		sz = props.sfp_socktuple_cnt * sizeof (*tup);
47923e95bd4aSAnders Persson 		tup = my_malloc(sz, "socket tuple buffer");
47933e95bd4aSAnders Persson 		if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
47943e95bd4aSAnders Persson 			for (i = 0; i < props.sfp_socktuple_cnt; i++) {
47953e95bd4aSAnders Persson 				(void) printf(
47963e95bd4aSAnders Persson 				    "\t\tfamily: %d, type: %d, proto: %d\n",
47973e95bd4aSAnders Persson 				    tup[i].sofst_family, tup[i].sofst_type,
47983e95bd4aSAnders Persson 				    tup[i].sofst_protocol);
47993e95bd4aSAnders Persson 			}
48003e95bd4aSAnders Persson 	}
48013e95bd4aSAnders Persson }
48023e95bd4aSAnders Persson #endif	/* _LP64 */
48033e95bd4aSAnders Persson static void
48043e95bd4aSAnders Persson show_sockconfig_filter_prop(private_t *pri, long addr)
48053e95bd4aSAnders Persson {
48063e95bd4aSAnders Persson 	struct sockconfig_filter_props props;
48073e95bd4aSAnders Persson 	const char *s = NULL;
48083e95bd4aSAnders Persson 	char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
48093e95bd4aSAnders Persson 	sof_socktuple_t *tup;
48103e95bd4aSAnders Persson 	size_t sz;
48113e95bd4aSAnders Persson 	int i;
48123e95bd4aSAnders Persson 
48133e95bd4aSAnders Persson 	if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
48143e95bd4aSAnders Persson 		if (Pread_string(Proc, buf, sizeof (buf),
48153e95bd4aSAnders Persson 		    (uintptr_t)props.sfp_modname) == -1)
48163e95bd4aSAnders Persson 			(void) strcpy(buf, "<?>");
48173e95bd4aSAnders Persson 		(void) printf("%s\tmodule name: %s\n", pri->pname, buf);
48183e95bd4aSAnders Persson 		(void) printf("%s\tattach semantics: %s", pri->pname,
48193e95bd4aSAnders Persson 		    props.sfp_autoattach ? "automatic" : "progammatic");
48203e95bd4aSAnders Persson 		if (props.sfp_autoattach) {
48213e95bd4aSAnders Persson 			buf[0] = '\0';
48223e95bd4aSAnders Persson 			switch (props.sfp_hint) {
48233e95bd4aSAnders Persson 			case SOF_HINT_TOP:	s = "top"; break;
48243e95bd4aSAnders Persson 			case SOF_HINT_BOTTOM:	s = "bottom"; break;
48253e95bd4aSAnders Persson 			case SOF_HINT_BEFORE:
48263e95bd4aSAnders Persson 			case SOF_HINT_AFTER:
48273e95bd4aSAnders Persson 				s = (props.sfp_hint == SOF_HINT_BEFORE) ?
48283e95bd4aSAnders Persson 				    "before" : "after";
48293e95bd4aSAnders Persson 				if (Pread_string(Proc, buf, sizeof (buf),
48303e95bd4aSAnders Persson 				    (uintptr_t)props.sfp_hintarg) == -1)
48313e95bd4aSAnders Persson 					(void) strcpy(buf, "<?>");
48323e95bd4aSAnders Persson 			}
48333e95bd4aSAnders Persson 			if (s != NULL) {
48343e95bd4aSAnders Persson 				(void) printf(", placement: %s", s);
48353e95bd4aSAnders Persson 			}
48363e95bd4aSAnders Persson 		}
48373e95bd4aSAnders Persson 		(void) printf("\n");
48383e95bd4aSAnders Persson 		(void) printf("%s\tsocket tuples:\n", pri->pname);
48393e95bd4aSAnders Persson 		if (props.sfp_socktuple_cnt == 0) {
48403e95bd4aSAnders Persson 			(void) printf("\t\t<empty>\n");
48413e95bd4aSAnders Persson 			return;
48423e95bd4aSAnders Persson 		}
48433e95bd4aSAnders Persson 		sz = props.sfp_socktuple_cnt * sizeof (*tup);
48443e95bd4aSAnders Persson 		tup = my_malloc(sz, "socket tuple buffer");
48453e95bd4aSAnders Persson 		if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
48463e95bd4aSAnders Persson 			for (i = 0; i < props.sfp_socktuple_cnt; i++) {
48473e95bd4aSAnders Persson 				(void) printf(
48483e95bd4aSAnders Persson 				    "\t\tfamily: %d, type: %d, proto: %d\n",
48493e95bd4aSAnders Persson 				    tup[i].sofst_family, tup[i].sofst_type,
48503e95bd4aSAnders Persson 				    tup[i].sofst_protocol);
48513e95bd4aSAnders Persson 			}
48523e95bd4aSAnders Persson 	}
48533e95bd4aSAnders Persson }
48543e95bd4aSAnders Persson 
48553e95bd4aSAnders Persson void
48563e95bd4aSAnders Persson show_sockconfig(private_t *pri)
48573e95bd4aSAnders Persson {
48583e95bd4aSAnders Persson 	switch (pri->sys_args[0]) {
48593e95bd4aSAnders Persson 	case SOCKCONFIG_ADD_FILTER:
48603e95bd4aSAnders Persson #ifdef _LP64
48613e95bd4aSAnders Persson 		if (data_model == PR_MODEL_LP64)
48623e95bd4aSAnders Persson 			show_sockconfig_filter_prop(pri,
48633e95bd4aSAnders Persson 			    (long)pri->sys_args[2]);
48643e95bd4aSAnders Persson 		else
48653e95bd4aSAnders Persson 			show_sockconfig_filter_prop32(pri,
48663e95bd4aSAnders Persson 			    (long)pri->sys_args[2]);
48673e95bd4aSAnders Persson #else
48683e95bd4aSAnders Persson 		show_sockconfig_filter_prop(pri, (long)pri->sys_args[2]);
48693e95bd4aSAnders Persson #endif
48703e95bd4aSAnders Persson 		break;
48713e95bd4aSAnders Persson 	default:
48723e95bd4aSAnders Persson 		break;
48733e95bd4aSAnders Persson 	}
48743e95bd4aSAnders Persson }
48753e95bd4aSAnders Persson 
4876a803cc21SGordon Ross void
4877a803cc21SGordon Ross show_zfs_ioc(private_t *pri, long addr)
4878a803cc21SGordon Ross {
4879a803cc21SGordon Ross 	static const zfs_share_t zero_share = {0};
4880a803cc21SGordon Ross 	static const dmu_objset_stats_t zero_objstats = {0};
4881a803cc21SGordon Ross 	static const struct drr_begin zero_drrbegin = {0};
4882a803cc21SGordon Ross 	static const zinject_record_t zero_injectrec = {0};
4883a803cc21SGordon Ross 	static const zfs_stat_t zero_zstat = {0};
4884a803cc21SGordon Ross 	zfs_cmd_t zc;
4885a803cc21SGordon Ross 
4886a803cc21SGordon Ross 	if (Pread(Proc, &zc, sizeof (zc), addr) != sizeof (zc)) {
4887a803cc21SGordon Ross 		(void) printf(" zfs_ioctl read failed\n");
4888a803cc21SGordon Ross 		return;
4889a803cc21SGordon Ross 	}
4890a803cc21SGordon Ross 
4891a803cc21SGordon Ross 	if (zc.zc_name[0])
4892a803cc21SGordon Ross 		(void) printf("    zc_name=%s\n", zc.zc_name);
4893a803cc21SGordon Ross 	if (zc.zc_value[0])
4894a803cc21SGordon Ross 		(void) printf("    zc_value=%s\n", zc.zc_value);
4895a803cc21SGordon Ross 	if (zc.zc_string[0])
48963b2aab18SMatthew Ahrens 		(void) printf("    zc_string=%s\n", zc.zc_string);
4897a803cc21SGordon Ross 	if (zc.zc_guid != 0) {
4898a803cc21SGordon Ross 		(void) printf("    zc_guid=%llu\n",
4899a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_guid);
4900a803cc21SGordon Ross 	}
4901a803cc21SGordon Ross 	if (zc.zc_nvlist_conf_size) {
4902a803cc21SGordon Ross 		(void) printf("    nvlist_conf:\n");
4903a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_conf,
4904a803cc21SGordon Ross 		    zc.zc_nvlist_conf_size);
4905a803cc21SGordon Ross 	}
4906a803cc21SGordon Ross 	if (zc.zc_nvlist_src_size) {
4907a803cc21SGordon Ross 		(void) printf("    nvlist_src:\n");
4908a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_src,
4909a803cc21SGordon Ross 		    zc.zc_nvlist_src_size);
4910a803cc21SGordon Ross 	}
4911a803cc21SGordon Ross 	if (zc.zc_nvlist_dst_size) {
4912a803cc21SGordon Ross 		(void) printf("    nvlist_dst:\n");
4913a803cc21SGordon Ross 		show_packed_nvlist(pri, zc.zc_nvlist_dst,
4914a803cc21SGordon Ross 		    zc.zc_nvlist_dst_size);
4915a803cc21SGordon Ross 	}
4916a803cc21SGordon Ross 	if (zc.zc_cookie != 0) {
4917a803cc21SGordon Ross 		(void) printf("    zc_cookie=%llu\n",
4918a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_cookie);
4919a803cc21SGordon Ross 	}
4920a803cc21SGordon Ross 	if (zc.zc_objset_type != 0) {
4921a803cc21SGordon Ross 		(void) printf("    zc_objset_type=%llu\n",
4922a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_objset_type);
4923a803cc21SGordon Ross 	}
4924a803cc21SGordon Ross 	if (zc.zc_perm_action != 0) {
4925a803cc21SGordon Ross 		(void) printf("    zc_perm_action=%llu\n",
4926a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_perm_action);
4927a803cc21SGordon Ross 	}
4928a803cc21SGordon Ross 	if (zc.zc_history != 0) {
4929a803cc21SGordon Ross 		(void) printf("    zc_history=%llu\n",
4930a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_history);
4931a803cc21SGordon Ross 	}
4932a803cc21SGordon Ross 	if (zc.zc_obj != 0) {
4933a803cc21SGordon Ross 		(void) printf("    zc_obj=%llu\n",
4934a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_obj);
4935a803cc21SGordon Ross 	}
4936a803cc21SGordon Ross 	if (zc.zc_iflags != 0) {
4937a803cc21SGordon Ross 		(void) printf("    zc_obj=0x%llx\n",
4938a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_iflags);
4939a803cc21SGordon Ross 	}
4940a803cc21SGordon Ross 
4941a803cc21SGordon Ross 	if (memcmp(&zc.zc_share, &zero_share, sizeof (zc.zc_share))) {
4942a803cc21SGordon Ross 		zfs_share_t *z = &zc.zc_share;
4943a803cc21SGordon Ross 		(void) printf("    zc_share:\n");
4944a803cc21SGordon Ross 		if (z->z_exportdata) {
4945a803cc21SGordon Ross 			(void) printf("\tz_exportdata=0x%llx\n",
4946a803cc21SGordon Ross 			    (u_longlong_t)z->z_exportdata);
4947a803cc21SGordon Ross 		}
4948a803cc21SGordon Ross 		if (z->z_sharedata) {
4949a803cc21SGordon Ross 			(void) printf("\tz_sharedata=0x%llx\n",
4950a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharedata);
4951a803cc21SGordon Ross 		}
4952a803cc21SGordon Ross 		if (z->z_sharetype) {
4953a803cc21SGordon Ross 			(void) printf("\tz_sharetype=%llu\n",
4954a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharetype);
4955a803cc21SGordon Ross 		}
4956a803cc21SGordon Ross 		if (z->z_sharemax) {
4957a803cc21SGordon Ross 			(void) printf("\tz_sharemax=%llu\n",
4958a803cc21SGordon Ross 			    (u_longlong_t)z->z_sharemax);
4959a803cc21SGordon Ross 		}
4960a803cc21SGordon Ross 	}
4961a803cc21SGordon Ross 
4962a803cc21SGordon Ross 	if (memcmp(&zc.zc_objset_stats, &zero_objstats,
4963a803cc21SGordon Ross 	    sizeof (zc.zc_objset_stats))) {
4964a803cc21SGordon Ross 		dmu_objset_stats_t *dds = &zc.zc_objset_stats;
4965a803cc21SGordon Ross 		(void) printf("    zc_objset_stats:\n");
4966a803cc21SGordon Ross 		if (dds->dds_num_clones) {
4967a803cc21SGordon Ross 			(void) printf("\tdds_num_clones=%llu\n",
4968a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_num_clones);
4969a803cc21SGordon Ross 		}
4970a803cc21SGordon Ross 		if (dds->dds_creation_txg) {
4971a803cc21SGordon Ross 			(void) printf("\tdds_creation_txg=%llu\n",
4972a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_creation_txg);
4973a803cc21SGordon Ross 		}
4974a803cc21SGordon Ross 		if (dds->dds_guid) {
4975a803cc21SGordon Ross 			(void) printf("\tdds_guid=%llu\n",
4976a803cc21SGordon Ross 			    (u_longlong_t)dds->dds_guid);
4977a803cc21SGordon Ross 		}
4978a803cc21SGordon Ross 		if (dds->dds_type)
4979a803cc21SGordon Ross 			(void) printf("\tdds_type=%u\n", dds->dds_type);
4980a803cc21SGordon Ross 		if (dds->dds_is_snapshot) {
4981a803cc21SGordon Ross 			(void) printf("\tdds_is_snapshot=%u\n",
4982a803cc21SGordon Ross 			    dds->dds_is_snapshot);
4983a803cc21SGordon Ross 		}
4984a803cc21SGordon Ross 		if (dds->dds_inconsistent) {
4985a803cc21SGordon Ross 			(void) printf("\tdds_inconsitent=%u\n",
4986a803cc21SGordon Ross 			    dds->dds_inconsistent);
4987a803cc21SGordon Ross 		}
4988a803cc21SGordon Ross 		if (dds->dds_origin[0]) {
4989a803cc21SGordon Ross 			(void) printf("\tdds_origin=%s\n", dds->dds_origin);
4990a803cc21SGordon Ross 		}
4991a803cc21SGordon Ross 	}
4992a803cc21SGordon Ross 
4993a803cc21SGordon Ross 	if (memcmp(&zc.zc_begin_record, &zero_drrbegin,
4994a803cc21SGordon Ross 	    sizeof (zc.zc_begin_record))) {
49959c3fd121SMatthew Ahrens 		struct drr_begin *drr = &zc.zc_begin_record.drr_u.drr_begin;
4996a803cc21SGordon Ross 		(void) printf("    zc_begin_record:\n");
4997a803cc21SGordon Ross 		if (drr->drr_magic) {
4998a803cc21SGordon Ross 			(void) printf("\tdrr_magic=%llu\n",
4999a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_magic);
5000a803cc21SGordon Ross 		}
5001a803cc21SGordon Ross 		if (drr->drr_versioninfo) {
5002a803cc21SGordon Ross 			(void) printf("\tdrr_versioninfo=%llu\n",
5003a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_versioninfo);
5004a803cc21SGordon Ross 		}
5005a803cc21SGordon Ross 		if (drr->drr_creation_time) {
5006a803cc21SGordon Ross 			(void) printf("\tdrr_creation_time=%llu\n",
5007a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_creation_time);
5008a803cc21SGordon Ross 		}
5009a803cc21SGordon Ross 		if (drr->drr_type)
5010a803cc21SGordon Ross 			(void) printf("\tdrr_type=%u\n", drr->drr_type);
5011a803cc21SGordon Ross 		if (drr->drr_flags)
5012a803cc21SGordon Ross 			(void) printf("\tdrr_flags=0x%x\n", drr->drr_flags);
5013a803cc21SGordon Ross 		if (drr->drr_toguid) {
5014a803cc21SGordon Ross 			(void) printf("\tdrr_toguid=%llu\n",
5015a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_toguid);
5016a803cc21SGordon Ross 		}
5017a803cc21SGordon Ross 		if (drr->drr_fromguid) {
5018a803cc21SGordon Ross 			(void) printf("\tdrr_fromguid=%llu\n",
5019a803cc21SGordon Ross 			    (u_longlong_t)drr->drr_fromguid);
5020a803cc21SGordon Ross 		}
5021a803cc21SGordon Ross 		if (drr->drr_toname[0]) {
5022a803cc21SGordon Ross 			(void) printf("\tdrr_toname=%s\n", drr->drr_toname);
5023a803cc21SGordon Ross 		}
5024a803cc21SGordon Ross 	}
5025a803cc21SGordon Ross 
5026a803cc21SGordon Ross 	if (memcmp(&zc.zc_inject_record, &zero_injectrec,
5027a803cc21SGordon Ross 	    sizeof (zc.zc_inject_record))) {
5028a803cc21SGordon Ross 		zinject_record_t *zi = &zc.zc_inject_record;
5029a803cc21SGordon Ross 		(void) printf("    zc_inject_record:\n");
5030a803cc21SGordon Ross 		if (zi->zi_objset) {
5031a803cc21SGordon Ross 			(void) printf("\tzi_objset=%llu\n",
5032a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_objset);
5033a803cc21SGordon Ross 		}
5034a803cc21SGordon Ross 		if (zi->zi_object) {
5035a803cc21SGordon Ross 			(void) printf("\tzi_object=%llu\n",
5036a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_object);
5037a803cc21SGordon Ross 		}
5038a803cc21SGordon Ross 		if (zi->zi_start) {
5039a803cc21SGordon Ross 			(void) printf("\tzi_start=%llu\n",
5040a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_start);
5041a803cc21SGordon Ross 		}
5042a803cc21SGordon Ross 		if (zi->zi_end) {
5043a803cc21SGordon Ross 			(void) printf("\tzi_end=%llu\n",
5044a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_end);
5045a803cc21SGordon Ross 		}
5046a803cc21SGordon Ross 		if (zi->zi_guid) {
5047a803cc21SGordon Ross 			(void) printf("\tzi_guid=%llu\n",
5048a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_guid);
5049a803cc21SGordon Ross 		}
5050a803cc21SGordon Ross 		if (zi->zi_level) {
5051a803cc21SGordon Ross 			(void) printf("\tzi_level=%lu\n",
5052a803cc21SGordon Ross 			    (ulong_t)zi->zi_level);
5053a803cc21SGordon Ross 		}
5054a803cc21SGordon Ross 		if (zi->zi_error) {
5055a803cc21SGordon Ross 			(void) printf("\tzi_error=%lu\n",
5056a803cc21SGordon Ross 			    (ulong_t)zi->zi_error);
5057a803cc21SGordon Ross 		}
5058a803cc21SGordon Ross 		if (zi->zi_type) {
5059a803cc21SGordon Ross 			(void) printf("\tzi_type=%llu\n",
5060a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_type);
5061a803cc21SGordon Ross 		}
5062a803cc21SGordon Ross 		if (zi->zi_freq) {
5063a803cc21SGordon Ross 			(void) printf("\tzi_freq=%lu\n",
5064a803cc21SGordon Ross 			    (ulong_t)zi->zi_freq);
5065a803cc21SGordon Ross 		}
5066a803cc21SGordon Ross 		if (zi->zi_failfast) {
5067a803cc21SGordon Ross 			(void) printf("\tzi_failfast=%lu\n",
5068a803cc21SGordon Ross 			    (ulong_t)zi->zi_failfast);
5069a803cc21SGordon Ross 		}
5070a803cc21SGordon Ross 		if (zi->zi_func[0])
5071a803cc21SGordon Ross 			(void) printf("\tzi_func=%s\n", zi->zi_func);
5072a803cc21SGordon Ross 		if (zi->zi_iotype) {
5073a803cc21SGordon Ross 			(void) printf("\tzi_iotype=%lu\n",
5074a803cc21SGordon Ross 			    (ulong_t)zi->zi_iotype);
5075a803cc21SGordon Ross 		}
5076a803cc21SGordon Ross 		if (zi->zi_duration) {
5077a803cc21SGordon Ross 			(void) printf("\tzi_duration=%ld\n",
5078a803cc21SGordon Ross 			    (long)zi->zi_duration);
5079a803cc21SGordon Ross 		}
5080a803cc21SGordon Ross 		if (zi->zi_timer) {
5081a803cc21SGordon Ross 			(void) printf("\tzi_timer=%llu\n",
5082a803cc21SGordon Ross 			    (u_longlong_t)zi->zi_timer);
5083a803cc21SGordon Ross 		}
5084a803cc21SGordon Ross 	}
5085a803cc21SGordon Ross 
5086a803cc21SGordon Ross 	if (zc.zc_defer_destroy) {
5087a803cc21SGordon Ross 		(void) printf("    zc_defer_destroy=%d\n",
5088a803cc21SGordon Ross 		    (int)zc.zc_defer_destroy);
5089a803cc21SGordon Ross 	}
50905d7b4d43SMatthew Ahrens 	if (zc.zc_flags) {
50915d7b4d43SMatthew Ahrens 		(void) printf("    zc_flags=0x%x\n",
50925d7b4d43SMatthew Ahrens 		    zc.zc_flags);
5093a803cc21SGordon Ross 	}
5094a803cc21SGordon Ross 	if (zc.zc_action_handle) {
5095a803cc21SGordon Ross 		(void) printf("    zc_action_handle=%llu\n",
5096a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_action_handle);
5097a803cc21SGordon Ross 	}
5098a803cc21SGordon Ross 	if (zc.zc_cleanup_fd >= 0)
5099a803cc21SGordon Ross 		(void) printf("    zc_cleanup_fd=%d\n", zc.zc_cleanup_fd);
5100a803cc21SGordon Ross 	if (zc.zc_sendobj) {
5101a803cc21SGordon Ross 		(void) printf("    zc_sendobj=%llu\n",
5102a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_sendobj);
5103a803cc21SGordon Ross 	}
5104a803cc21SGordon Ross 	if (zc.zc_fromobj) {
5105a803cc21SGordon Ross 		(void) printf("    zc_fromobj=%llu\n",
5106a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_fromobj);
5107a803cc21SGordon Ross 	}
5108a803cc21SGordon Ross 	if (zc.zc_createtxg) {
5109a803cc21SGordon Ross 		(void) printf("    zc_createtxg=%llu\n",
5110a803cc21SGordon Ross 		    (u_longlong_t)zc.zc_createtxg);
5111a803cc21SGordon Ross 	}
5112a803cc21SGordon Ross 
5113a803cc21SGordon Ross 	if (memcmp(&zc.zc_stat, &zero_zstat, sizeof (zc.zc_stat))) {
5114a803cc21SGordon Ross 		zfs_stat_t *zs = &zc.zc_stat;
5115a803cc21SGordon Ross 		(void) printf("    zc_stat:\n");
5116a803cc21SGordon Ross 		if (zs->zs_gen) {
5117a803cc21SGordon Ross 			(void) printf("\tzs_gen=%llu\n",
5118a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_gen);
5119a803cc21SGordon Ross 		}
5120a803cc21SGordon Ross 		if (zs->zs_mode) {
5121a803cc21SGordon Ross 			(void) printf("\tzs_mode=%llu\n",
5122a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_mode);
5123a803cc21SGordon Ross 		}
5124a803cc21SGordon Ross 		if (zs->zs_links) {
5125a803cc21SGordon Ross 			(void) printf("\tzs_links=%llu\n",
5126a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_links);
5127a803cc21SGordon Ross 		}
5128a803cc21SGordon Ross 		if (zs->zs_ctime[0]) {
5129a803cc21SGordon Ross 			(void) printf("\tzs_ctime[0]=%llu\n",
5130a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_ctime[0]);
5131a803cc21SGordon Ross 		}
5132a803cc21SGordon Ross 		if (zs->zs_ctime[1]) {
5133a803cc21SGordon Ross 			(void) printf("\tzs_ctime[1]=%llu\n",
5134a803cc21SGordon Ross 			    (u_longlong_t)zs->zs_ctime[1]);
5135a803cc21SGordon Ross 		}
5136a803cc21SGordon Ross 	}
5137a803cc21SGordon Ross }
5138a803cc21SGordon Ross 
51397c478bd9Sstevel@tonic-gate /* expound verbosely upon syscall arguments */
51407c478bd9Sstevel@tonic-gate /*ARGSUSED*/
51417c478bd9Sstevel@tonic-gate void
51427c478bd9Sstevel@tonic-gate expound(private_t *pri, long r0, int raw)
51437c478bd9Sstevel@tonic-gate {
51447c478bd9Sstevel@tonic-gate 	const lwpstatus_t *Lsp = pri->lwpstat;
51457c478bd9Sstevel@tonic-gate 	int lp64 = (data_model == PR_MODEL_LP64);
51467c478bd9Sstevel@tonic-gate 	int what = Lsp->pr_what;
51477c478bd9Sstevel@tonic-gate 	int err = pri->Errno;		/* don't display output parameters */
51487c478bd9Sstevel@tonic-gate 					/* for a failed system call */
51497c478bd9Sstevel@tonic-gate #ifndef _LP64
51507c478bd9Sstevel@tonic-gate 	/* We are a 32-bit truss; we can't grok a 64-bit process */
51517c478bd9Sstevel@tonic-gate 	if (lp64)
51527c478bd9Sstevel@tonic-gate 		return;
51537c478bd9Sstevel@tonic-gate #endif
51547c478bd9Sstevel@tonic-gate 	/* for reporting sleeping system calls */
51557c478bd9Sstevel@tonic-gate 	if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP)))
51567c478bd9Sstevel@tonic-gate 		what = Lsp->pr_syscall;
51577c478bd9Sstevel@tonic-gate 
51587c478bd9Sstevel@tonic-gate 	switch (what) {
51597c478bd9Sstevel@tonic-gate 	case SYS_gettimeofday:
51607c478bd9Sstevel@tonic-gate 		if (!err)
51617c478bd9Sstevel@tonic-gate 			show_timeofday(pri);
51627c478bd9Sstevel@tonic-gate 		break;
51637c478bd9Sstevel@tonic-gate 	case SYS_getitimer:
51647c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
51657c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
5166019c3c43Sraf 			    " value");
51677c478bd9Sstevel@tonic-gate 		break;
51687c478bd9Sstevel@tonic-gate 	case SYS_setitimer:
51697c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
51707c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[1],
5171019c3c43Sraf 			    " value");
51727c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
51737c478bd9Sstevel@tonic-gate 			show_itimerval(pri, (long)pri->sys_args[2],
5174019c3c43Sraf 			    "ovalue");
51757c478bd9Sstevel@tonic-gate 		break;
51767c478bd9Sstevel@tonic-gate 	case SYS_stime:
51777c478bd9Sstevel@tonic-gate 		show_stime(pri);
51787c478bd9Sstevel@tonic-gate 		break;
51797c478bd9Sstevel@tonic-gate 	case SYS_times:
51807c478bd9Sstevel@tonic-gate 		if (!err)
51817c478bd9Sstevel@tonic-gate 			show_times(pri);
51827c478bd9Sstevel@tonic-gate 		break;
51837c478bd9Sstevel@tonic-gate 	case SYS_utssys:
51847c478bd9Sstevel@tonic-gate 		if (err)
51857c478bd9Sstevel@tonic-gate 			break;
51867c478bd9Sstevel@tonic-gate #ifdef _LP64
51877c478bd9Sstevel@tonic-gate 		if (lp64)
51887c478bd9Sstevel@tonic-gate 			show_utssys(pri, r0);
51897c478bd9Sstevel@tonic-gate 		else
51907c478bd9Sstevel@tonic-gate 			show_utssys32(pri, r0);
51917c478bd9Sstevel@tonic-gate #else
51927c478bd9Sstevel@tonic-gate 		show_utssys(pri, r0);
51937c478bd9Sstevel@tonic-gate #endif
51947c478bd9Sstevel@tonic-gate 		break;
51957c478bd9Sstevel@tonic-gate 	case SYS_ioctl:
51967c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs >= 3) /* each case must decide for itself */
51977c478bd9Sstevel@tonic-gate 			show_ioctl(pri, pri->sys_args[1],
5198019c3c43Sraf 			    (long)pri->sys_args[2]);
51997c478bd9Sstevel@tonic-gate 		break;
52008fd04b83SRoger A. Faulkner 	case SYS_fstatat:
52018fd04b83SRoger A. Faulkner 		if (!err && pri->sys_nargs >= 3)
52028fd04b83SRoger A. Faulkner 			show_stat(pri, (long)pri->sys_args[2]);
52038fd04b83SRoger A. Faulkner 		break;
52048fd04b83SRoger A. Faulkner 	case SYS_fstatat64:
52058fd04b83SRoger A. Faulkner 		if (!err && pri->sys_nargs >= 3)
52068fd04b83SRoger A. Faulkner 			show_stat64_32(pri, (long)pri->sys_args[2]);
52078fd04b83SRoger A. Faulkner 		break;
52087c478bd9Sstevel@tonic-gate 	case SYS_stat:
52097c478bd9Sstevel@tonic-gate 	case SYS_fstat:
52107c478bd9Sstevel@tonic-gate 	case SYS_lstat:
52117c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
52127c478bd9Sstevel@tonic-gate 			show_stat(pri, (long)pri->sys_args[1]);
52137c478bd9Sstevel@tonic-gate 		break;
52147c478bd9Sstevel@tonic-gate 	case SYS_stat64:
52157c478bd9Sstevel@tonic-gate 	case SYS_fstat64:
52167c478bd9Sstevel@tonic-gate 	case SYS_lstat64:
52177c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs >= 2)
52187c478bd9Sstevel@tonic-gate 			show_stat64_32(pri, (long)pri->sys_args[1]);
52197c478bd9Sstevel@tonic-gate 		break;
52207c478bd9Sstevel@tonic-gate 	case SYS_statvfs:
52217c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs:
52227c478bd9Sstevel@tonic-gate 		if (err)
52237c478bd9Sstevel@tonic-gate 			break;
52247c478bd9Sstevel@tonic-gate #ifdef _LP64
52257c478bd9Sstevel@tonic-gate 		if (!lp64) {
52267c478bd9Sstevel@tonic-gate 			show_statvfs32(pri);
52277c478bd9Sstevel@tonic-gate 			break;
52287c478bd9Sstevel@tonic-gate 		}
52297c478bd9Sstevel@tonic-gate #endif
52307c478bd9Sstevel@tonic-gate 		show_statvfs(pri);
52317c478bd9Sstevel@tonic-gate 		break;
52327c478bd9Sstevel@tonic-gate 	case SYS_statvfs64:
52337c478bd9Sstevel@tonic-gate 	case SYS_fstatvfs64:
52347c478bd9Sstevel@tonic-gate 		if (err)
52357c478bd9Sstevel@tonic-gate 			break;
52367c478bd9Sstevel@tonic-gate 		show_statvfs64(pri);
52377c478bd9Sstevel@tonic-gate 		break;
52387c478bd9Sstevel@tonic-gate 	case SYS_statfs:
52397c478bd9Sstevel@tonic-gate 	case SYS_fstatfs:
52407c478bd9Sstevel@tonic-gate 		if (err)
52417c478bd9Sstevel@tonic-gate 			break;
52427c478bd9Sstevel@tonic-gate #ifdef _LP64
52437c478bd9Sstevel@tonic-gate 		if (lp64)
52447c478bd9Sstevel@tonic-gate 			show_statfs(pri);
52457c478bd9Sstevel@tonic-gate 		else
52467c478bd9Sstevel@tonic-gate 			show_statfs32(pri);
52477c478bd9Sstevel@tonic-gate #else
52487c478bd9Sstevel@tonic-gate 		show_statfs(pri);
52497c478bd9Sstevel@tonic-gate #endif
52507c478bd9Sstevel@tonic-gate 		break;
52517c478bd9Sstevel@tonic-gate 	case SYS_fcntl:
52527c478bd9Sstevel@tonic-gate 		show_fcntl(pri);
52537c478bd9Sstevel@tonic-gate 		break;
52547c478bd9Sstevel@tonic-gate 	case SYS_msgsys:
52557c478bd9Sstevel@tonic-gate 		show_msgsys(pri, r0); /* each case must decide for itself */
52567c478bd9Sstevel@tonic-gate 		break;
52577c478bd9Sstevel@tonic-gate 	case SYS_semsys:
52587c478bd9Sstevel@tonic-gate 		show_semsys(pri);	/* each case must decide for itself */
52597c478bd9Sstevel@tonic-gate 		break;
52607c478bd9Sstevel@tonic-gate 	case SYS_shmsys:
52617c478bd9Sstevel@tonic-gate 		show_shmsys(pri);	/* each case must decide for itself */
52627c478bd9Sstevel@tonic-gate 		break;
52637c478bd9Sstevel@tonic-gate 	case SYS_getdents:
52647c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
52657c478bd9Sstevel@tonic-gate 			break;
52667c478bd9Sstevel@tonic-gate #ifdef _LP64
52677c478bd9Sstevel@tonic-gate 		if (!lp64) {
52687c478bd9Sstevel@tonic-gate 			show_dents32(pri, (long)pri->sys_args[1], r0);
52697c478bd9Sstevel@tonic-gate 			break;
52707c478bd9Sstevel@tonic-gate 		}
52717c478bd9Sstevel@tonic-gate #else
52727c478bd9Sstevel@tonic-gate 		show_dents32(pri, (long)pri->sys_args[1], r0);
52737c478bd9Sstevel@tonic-gate 		break;
52747c478bd9Sstevel@tonic-gate #endif
52750b09d754SToomas Soome 		/* FALLTHROUGH */
52767c478bd9Sstevel@tonic-gate 	case SYS_getdents64:
52777c478bd9Sstevel@tonic-gate 		if (err || pri->sys_nargs <= 1 || r0 <= 0)
52787c478bd9Sstevel@tonic-gate 			break;
52797c478bd9Sstevel@tonic-gate 		show_dents64(pri, (long)pri->sys_args[1], r0);
52807c478bd9Sstevel@tonic-gate 		break;
52817c478bd9Sstevel@tonic-gate 	case SYS_getmsg:
52827c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
52837c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
52847c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "flags");
52857c478bd9Sstevel@tonic-gate 		break;
52867c478bd9Sstevel@tonic-gate 	case SYS_getpmsg:
52877c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
52887c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 3)
52897c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[3], "band");
52907c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 4)
52917c478bd9Sstevel@tonic-gate 			show_hhex_int(pri, (long)pri->sys_args[4], "flags");
52927c478bd9Sstevel@tonic-gate 		break;
52937c478bd9Sstevel@tonic-gate 	case SYS_putmsg:
52947c478bd9Sstevel@tonic-gate 	case SYS_putpmsg:
52957c478bd9Sstevel@tonic-gate 		show_gp_msg(pri, what);
52967c478bd9Sstevel@tonic-gate 		break;
52977c478bd9Sstevel@tonic-gate 	case SYS_pollsys:
52987c478bd9Sstevel@tonic-gate 		show_pollsys(pri);
52997c478bd9Sstevel@tonic-gate 		break;
53007c478bd9Sstevel@tonic-gate 	case SYS_setgroups:
53017c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0)
53027c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
53037c478bd9Sstevel@tonic-gate 		break;
53047c478bd9Sstevel@tonic-gate 	case SYS_getgroups:
53057c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0)
53067c478bd9Sstevel@tonic-gate 			show_groups(pri, (long)pri->sys_args[1], r0);
53077c478bd9Sstevel@tonic-gate 		break;
53087c478bd9Sstevel@tonic-gate 	case SYS_sigprocmask:
53097c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
53107c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], " set");
53117c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53127c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[2], "oset");
53137c478bd9Sstevel@tonic-gate 		break;
53147c478bd9Sstevel@tonic-gate 	case SYS_sigsuspend:
53157c478bd9Sstevel@tonic-gate 	case SYS_sigtimedwait:
53167c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
53177c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[0], "sigmask");
53187c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
53197c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[1]);
53207c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
53217c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
53227c478bd9Sstevel@tonic-gate 		break;
53237c478bd9Sstevel@tonic-gate 	case SYS_sigaltstack:
53247c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
53257c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[0],
5326019c3c43Sraf 			    "new");
53277c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
53287c478bd9Sstevel@tonic-gate 			show_sigaltstack(pri, (long)pri->sys_args[1],
5329019c3c43Sraf 			    "old");
53307c478bd9Sstevel@tonic-gate 		break;
53317c478bd9Sstevel@tonic-gate 	case SYS_sigaction:
53327c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
53337c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[1],
5334*27aa4812SToomas Soome 			    "new", 0);
53357c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53367c478bd9Sstevel@tonic-gate 			show_sigaction(pri, (long)pri->sys_args[2],
5337019c3c43Sraf 			    "old", r0);
53387c478bd9Sstevel@tonic-gate 		break;
5339f48068adSraf 	case SYS_signotify:
5340f48068adSraf 		if (pri->sys_nargs > 1)
5341f48068adSraf 			show_siginfo(pri, (long)pri->sys_args[1]);
5342f48068adSraf 		break;
5343f48068adSraf 	case SYS_sigresend:
5344f48068adSraf 		if (pri->sys_nargs > 1)
5345f48068adSraf 			show_siginfo(pri, (long)pri->sys_args[1]);
5346f48068adSraf 		if (pri->sys_nargs > 2)
5347f48068adSraf 			show_sigset(pri, (long)pri->sys_args[2], "sigmask");
5348f48068adSraf 		break;
53497c478bd9Sstevel@tonic-gate 	case SYS_sigpending:
53507c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
53517c478bd9Sstevel@tonic-gate 			show_sigset(pri, (long)pri->sys_args[1], "sigmask");
53527c478bd9Sstevel@tonic-gate 		break;
5353a574db85Sraf 	case SYS_waitid:
53547c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53557c478bd9Sstevel@tonic-gate 			show_siginfo(pri, (long)pri->sys_args[2]);
53567c478bd9Sstevel@tonic-gate 		break;
53577c478bd9Sstevel@tonic-gate 	case SYS_sigsendsys:
53587c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
53597c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[0]);
53607c478bd9Sstevel@tonic-gate 		break;
53617c478bd9Sstevel@tonic-gate 	case SYS_priocntlsys:
53627c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
53637c478bd9Sstevel@tonic-gate 			show_procset(pri, (long)pri->sys_args[1]);
53647c478bd9Sstevel@tonic-gate 		break;
53657c478bd9Sstevel@tonic-gate 	case SYS_mincore:
53667c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
53677c478bd9Sstevel@tonic-gate 			show_bool(pri, (long)pri->sys_args[2],
5368019c3c43Sraf 			    (pri->sys_args[1] + pagesize - 1) / pagesize);
53697c478bd9Sstevel@tonic-gate 		break;
53707c478bd9Sstevel@tonic-gate 	case SYS_readv:
53717c478bd9Sstevel@tonic-gate 	case SYS_writev:
53727c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2) {
53737c478bd9Sstevel@tonic-gate 			int i = pri->sys_args[0]+1;
53747c478bd9Sstevel@tonic-gate 			int showbuf = FALSE;
53757c478bd9Sstevel@tonic-gate 			long nb = (what == SYS_readv)? r0 : 32*1024;
53767c478bd9Sstevel@tonic-gate 
53777c478bd9Sstevel@tonic-gate 			if ((what == SYS_readv && !err &&
53787c478bd9Sstevel@tonic-gate 			    prismember(&readfd, i)) ||
53797c478bd9Sstevel@tonic-gate 			    (what == SYS_writev &&
53807c478bd9Sstevel@tonic-gate 			    prismember(&writefd, i)))
53817c478bd9Sstevel@tonic-gate 				showbuf = TRUE;
53827c478bd9Sstevel@tonic-gate 			show_iovec(pri, (long)pri->sys_args[1],
5383019c3c43Sraf 			    pri->sys_args[2], showbuf, nb);
53847c478bd9Sstevel@tonic-gate 		}
53857c478bd9Sstevel@tonic-gate 		break;
53867c478bd9Sstevel@tonic-gate 	case SYS_getrlimit:
53877c478bd9Sstevel@tonic-gate 		if (err)
53887c478bd9Sstevel@tonic-gate 			break;
53897c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
53907c478bd9Sstevel@tonic-gate 	case SYS_setrlimit:
53917c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
53927c478bd9Sstevel@tonic-gate 			break;
53937c478bd9Sstevel@tonic-gate #ifdef _LP64
53947c478bd9Sstevel@tonic-gate 		if (lp64)
53957c478bd9Sstevel@tonic-gate 			show_rlimit64(pri, (long)pri->sys_args[1]);
53967c478bd9Sstevel@tonic-gate 		else
53977c478bd9Sstevel@tonic-gate 			show_rlimit32(pri, (long)pri->sys_args[1]);
53987c478bd9Sstevel@tonic-gate #else
53997c478bd9Sstevel@tonic-gate 		show_rlimit32(pri, (long)pri->sys_args[1]);
54007c478bd9Sstevel@tonic-gate #endif
54017c478bd9Sstevel@tonic-gate 		break;
54027c478bd9Sstevel@tonic-gate 	case SYS_getrlimit64:
54037c478bd9Sstevel@tonic-gate 		if (err)
54047c478bd9Sstevel@tonic-gate 			break;
54057c478bd9Sstevel@tonic-gate 		/*FALLTHROUGH*/
54067c478bd9Sstevel@tonic-gate 	case SYS_setrlimit64:
54077c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs <= 1)
54087c478bd9Sstevel@tonic-gate 			break;
54097c478bd9Sstevel@tonic-gate 		show_rlimit64(pri, (long)pri->sys_args[1]);
54107c478bd9Sstevel@tonic-gate 		break;
54117c478bd9Sstevel@tonic-gate 	case SYS_uname:
54127c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
54137c478bd9Sstevel@tonic-gate 			show_nuname(pri, (long)pri->sys_args[0]);
54147c478bd9Sstevel@tonic-gate 		break;
54157c478bd9Sstevel@tonic-gate 	case SYS_adjtime:
54167c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
54177c478bd9Sstevel@tonic-gate 			show_adjtime(pri, (long)pri->sys_args[0],
5418019c3c43Sraf 			    (long)pri->sys_args[1]);
54197c478bd9Sstevel@tonic-gate 		break;
54207c478bd9Sstevel@tonic-gate 	case SYS_lwp_info:
54217c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 0)
54227c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "cpu time");
54237c478bd9Sstevel@tonic-gate 		break;
54247c478bd9Sstevel@tonic-gate 	case SYS_lwp_wait:
54257c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 1)
54267c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[1], "lwpid");
54277c478bd9Sstevel@tonic-gate 		break;
54287c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_wakeup:
54297c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_unlock:
54307c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_trylock:
5431883492d5Sraf 	case SYS_lwp_mutex_register:
54327c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54337c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
54347c478bd9Sstevel@tonic-gate 		break;
54357c478bd9Sstevel@tonic-gate 	case SYS_lwp_mutex_timedlock:
54367c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54377c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[0]);
54387c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
54397c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
54407c478bd9Sstevel@tonic-gate 		break;
54417c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_wait:
54427c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54437c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
54447c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
54457c478bd9Sstevel@tonic-gate 			show_mutex(pri, (long)pri->sys_args[1]);
54467c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
54477c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
54487c478bd9Sstevel@tonic-gate 		break;
54497c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_signal:
54507c478bd9Sstevel@tonic-gate 	case SYS_lwp_cond_broadcast:
54517c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54527c478bd9Sstevel@tonic-gate 			show_condvar(pri, (long)pri->sys_args[0]);
54537c478bd9Sstevel@tonic-gate 		break;
54547c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_trywait:
54557c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_post:
54567c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54577c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
54587c478bd9Sstevel@tonic-gate 		break;
54597c478bd9Sstevel@tonic-gate 	case SYS_lwp_sema_timedwait:
54607c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54617c478bd9Sstevel@tonic-gate 			show_sema(pri, (long)pri->sys_args[0]);
54627c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
54637c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
54647c478bd9Sstevel@tonic-gate 		break;
54657c478bd9Sstevel@tonic-gate 	case SYS_lwp_rwlock_sys:
54667c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1)
54677c478bd9Sstevel@tonic-gate 			show_rwlock(pri, (long)pri->sys_args[1]);
54687c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 &&
54697c478bd9Sstevel@tonic-gate 		    (pri->sys_args[0] == 0 || pri->sys_args[0] == 1))
54707c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[2], "timeout");
54717c478bd9Sstevel@tonic-gate 		break;
54727c478bd9Sstevel@tonic-gate 	case SYS_lwp_create:
54737c478bd9Sstevel@tonic-gate 		/* XXX print some values in ucontext ??? */
54747c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
54757c478bd9Sstevel@tonic-gate 			show_int(pri, (long)pri->sys_args[2], "lwpid");
54767c478bd9Sstevel@tonic-gate 		break;
54777c478bd9Sstevel@tonic-gate 	case SYS_kaio:
54787c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1)
54797c478bd9Sstevel@tonic-gate 			show_timeval(pri, (long)pri->sys_args[1], "timeout");
54807c478bd9Sstevel@tonic-gate 		break;
54817c478bd9Sstevel@tonic-gate 	case SYS_nanosleep:
54827c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 0)
54837c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[0], "tmout");
54847c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 1 && (err == 0 || err == EINTR))
54857c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "resid");
54867c478bd9Sstevel@tonic-gate 		break;
54877c478bd9Sstevel@tonic-gate 	case SYS_privsys:
54887c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
54897c478bd9Sstevel@tonic-gate 		case PRIVSYS_SETPPRIV:
54907c478bd9Sstevel@tonic-gate 		case PRIVSYS_GETPPRIV:
54917c478bd9Sstevel@tonic-gate 			if (!err)
54927c478bd9Sstevel@tonic-gate 				show_privset(pri, (long)pri->sys_args[3],
5493019c3c43Sraf 				    (size_t)pri->sys_args[4], "");
54947c478bd9Sstevel@tonic-gate 		}
54957c478bd9Sstevel@tonic-gate 		break;
54967c478bd9Sstevel@tonic-gate 	case SYS_ucredsys:
54977c478bd9Sstevel@tonic-gate 		switch (pri->sys_args[0]) {
54987c478bd9Sstevel@tonic-gate 		case UCREDSYS_UCREDGET:
54997c478bd9Sstevel@tonic-gate 		case UCREDSYS_GETPEERUCRED:
55007c478bd9Sstevel@tonic-gate 			if (err == 0)
55017c478bd9Sstevel@tonic-gate 				show_ucred(pri, (long)pri->sys_args[2]);
55027c478bd9Sstevel@tonic-gate 			break;
55037c478bd9Sstevel@tonic-gate 		}
55047c478bd9Sstevel@tonic-gate 		break;
55057c478bd9Sstevel@tonic-gate 	case SYS_bind:
55067c478bd9Sstevel@tonic-gate 	case SYS_connect:
55077c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2)
55087c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
5509019c3c43Sraf 			    0, (long)pri->sys_args[2]);
55107c478bd9Sstevel@tonic-gate 		break;
55117c478bd9Sstevel@tonic-gate 	case SYS_sendto:
55127c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 5)
55137c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "to", (long)pri->sys_args[4], 0,
5514019c3c43Sraf 			    pri->sys_args[5]);
55157c478bd9Sstevel@tonic-gate 		break;
55167c478bd9Sstevel@tonic-gate 	case SYS_accept:
55177c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
55187c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
5519019c3c43Sraf 			    (long)pri->sys_args[2], 0);
55207c478bd9Sstevel@tonic-gate 		break;
55217c478bd9Sstevel@tonic-gate 	case SYS_getsockname:
55227c478bd9Sstevel@tonic-gate 	case SYS_getpeername:
55237c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
55247c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "name", (long)pri->sys_args[1],
5525019c3c43Sraf 			    (long)pri->sys_args[2], 0);
55267c478bd9Sstevel@tonic-gate 		break;
55277c478bd9Sstevel@tonic-gate 	case SYS_cladm:
55287c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 2)
55297c478bd9Sstevel@tonic-gate 			show_cladm(pri, pri->sys_args[0], pri->sys_args[1],
55307c478bd9Sstevel@tonic-gate 			    (long)pri->sys_args[2]);
55317c478bd9Sstevel@tonic-gate 		break;
55327c478bd9Sstevel@tonic-gate 	case SYS_recvfrom:
55337c478bd9Sstevel@tonic-gate 		if (!err && pri->sys_nargs > 5)
55347c478bd9Sstevel@tonic-gate 			show_sockaddr(pri, "from", (long)pri->sys_args[4],
5535019c3c43Sraf 			    (long)pri->sys_args[5], 0);
55367c478bd9Sstevel@tonic-gate 		break;
55377c478bd9Sstevel@tonic-gate 	case SYS_recvmsg:
55387c478bd9Sstevel@tonic-gate 		if (err)
55397c478bd9Sstevel@tonic-gate 			break;
55407c478bd9Sstevel@tonic-gate 		/* FALLTHROUGH */
55417c478bd9Sstevel@tonic-gate 	case SYS_sendmsg:
554281006e0fSja 		if (pri->sys_nargs <= 2)
55437c478bd9Sstevel@tonic-gate 			break;
55447c478bd9Sstevel@tonic-gate #ifdef _LP64
55457c478bd9Sstevel@tonic-gate 		if (lp64)
55467c478bd9Sstevel@tonic-gate 			show_msghdr(pri, pri->sys_args[1]);
55477c478bd9Sstevel@tonic-gate 		else
55487c478bd9Sstevel@tonic-gate 			show_msghdr32(pri, pri->sys_args[1]);
55497c478bd9Sstevel@tonic-gate #else
55507c478bd9Sstevel@tonic-gate 		show_msghdr(pri, pri->sys_args[1]);
55517c478bd9Sstevel@tonic-gate #endif
55527c478bd9Sstevel@tonic-gate 		break;
55537c478bd9Sstevel@tonic-gate 	case SYS_door:
55547c478bd9Sstevel@tonic-gate 		show_doors(pri);
55557c478bd9Sstevel@tonic-gate 		break;
55567c478bd9Sstevel@tonic-gate 	case SYS_sendfilev:
55577c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs != 5)
55587c478bd9Sstevel@tonic-gate 			break;
55597c478bd9Sstevel@tonic-gate 
55607c478bd9Sstevel@tonic-gate 		if (pri->sys_args[0] == SENDFILEV) {
55617c478bd9Sstevel@tonic-gate 			show_sendfilevec(pri, (int)pri->sys_args[1],
5562019c3c43Sraf 			    (sendfilevec_t *)pri->sys_args[2],
5563019c3c43Sraf 			    (int)pri->sys_args[3]);
55647c478bd9Sstevel@tonic-gate 		} else if (pri->sys_args[0] == SENDFILEV64) {
55657c478bd9Sstevel@tonic-gate 			show_sendfilevec64(pri, (int)pri->sys_args[1],
5566019c3c43Sraf 			    (sendfilevec64_t *)pri->sys_args[2],
5567019c3c43Sraf 			    (int)pri->sys_args[3]);
55687c478bd9Sstevel@tonic-gate 		}
55697c478bd9Sstevel@tonic-gate 		break;
55707c478bd9Sstevel@tonic-gate 	case SYS_memcntl:
55717c478bd9Sstevel@tonic-gate 		show_memcntl(pri);
55727c478bd9Sstevel@tonic-gate 		break;
55737c478bd9Sstevel@tonic-gate 	case SYS_lwp_park:
557447eb4d1eSsl 		/*
557547eb4d1eSsl 		 * subcode 0: lwp_park(timespec_t *, id_t)
557647eb4d1eSsl 		 * subcode 4: lwp_set_park(timespec_t *, id_t)
557747eb4d1eSsl 		 */
557847eb4d1eSsl 		if (pri->sys_nargs > 1 &&
557947eb4d1eSsl 		    (pri->sys_args[0] == 0 || pri->sys_args[0] == 4))
55807c478bd9Sstevel@tonic-gate 			show_timestruc(pri, (long)pri->sys_args[1], "timeout");
55817c478bd9Sstevel@tonic-gate 		/* subcode 2: lwp_unpark_all(id_t *, int) */
55827c478bd9Sstevel@tonic-gate 		if (pri->sys_nargs > 2 && pri->sys_args[0] == 2)
55837c478bd9Sstevel@tonic-gate 			show_ids(pri, (long)pri->sys_args[1],
558447eb4d1eSsl 			    (int)pri->sys_args[2]);
55857c478bd9Sstevel@tonic-gate 		break;
55867c478bd9Sstevel@tonic-gate 	case SYS_ntp_gettime:
55877c478bd9Sstevel@tonic-gate 		if (!err)
55887c478bd9Sstevel@tonic-gate 			show_ntp_gettime(pri);
55897c478bd9Sstevel@tonic-gate 		break;
55907c478bd9Sstevel@tonic-gate 	case SYS_ntp_adjtime:
55917c478bd9Sstevel@tonic-gate 		if (!err)
55927c478bd9Sstevel@tonic-gate 			show_ntp_adjtime(pri);
55937c478bd9Sstevel@tonic-gate 		break;
55947c478bd9Sstevel@tonic-gate 	case SYS_rusagesys:
55957c478bd9Sstevel@tonic-gate 		if (!err)
55967c478bd9Sstevel@tonic-gate 			if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) {
55977c478bd9Sstevel@tonic-gate #ifdef _LP64
55987c478bd9Sstevel@tonic-gate 				if (!lp64)
5599019c3c43Sraf 					show_getrusage32(pri->sys_args[1]);
56007c478bd9Sstevel@tonic-gate 				else
56017c478bd9Sstevel@tonic-gate #endif
5602019c3c43Sraf 					show_getrusage(pri->sys_args[1]);
56037c478bd9Sstevel@tonic-gate 			}
56047c478bd9Sstevel@tonic-gate 		break;
56057c478bd9Sstevel@tonic-gate 	case SYS_port:
56067c478bd9Sstevel@tonic-gate 		show_ports(pri);
56077c478bd9Sstevel@tonic-gate 		break;
5608821c4a97Sdp 	case SYS_zone:
5609821c4a97Sdp 		show_zones(pri);
5610821c4a97Sdp 		break;
5611aa4a4f3bSnf 	case SYS_rctlsys:
5612aa4a4f3bSnf 		show_rctls(pri);
5613aa4a4f3bSnf 		break;
56143b862e9aSRoger A. Faulkner 	case SYS_utimesys:
56153b862e9aSRoger A. Faulkner 		show_utimesys(pri);
56163b862e9aSRoger A. Faulkner 		break;
56173e95bd4aSAnders Persson 	case SYS_sockconfig:
56183e95bd4aSAnders Persson 		show_sockconfig(pri);
56193e95bd4aSAnders Persson 		break;
56207c478bd9Sstevel@tonic-gate 	}
56217c478bd9Sstevel@tonic-gate }
5622