10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51548Srshoaib * Common Development and Distribution License (the "License"). 61548Srshoaib * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211548Srshoaib 220Sstevel@tonic-gate /* 23*12643SAnders.Persson@Sun.COM * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate #define _SYSCALL32 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <stdio.h> 320Sstevel@tonic-gate #include <stdlib.h> 330Sstevel@tonic-gate #include <unistd.h> 340Sstevel@tonic-gate #include <ctype.h> 350Sstevel@tonic-gate #include <sys/types.h> 360Sstevel@tonic-gate #include <sys/mman.h> 370Sstevel@tonic-gate #include <libproc.h> 380Sstevel@tonic-gate #include <string.h> 390Sstevel@tonic-gate #include <limits.h> 400Sstevel@tonic-gate #include <sys/statfs.h> 410Sstevel@tonic-gate #include <sys/times.h> 420Sstevel@tonic-gate #include <sys/timex.h> 430Sstevel@tonic-gate #include <sys/utssys.h> 440Sstevel@tonic-gate #include <sys/utsname.h> 450Sstevel@tonic-gate #include <sys/ipc.h> 460Sstevel@tonic-gate #include <sys/ipc_impl.h> 470Sstevel@tonic-gate #include <sys/msg.h> 480Sstevel@tonic-gate #include <sys/msg_impl.h> 490Sstevel@tonic-gate #include <sys/sem.h> 500Sstevel@tonic-gate #include <sys/sem_impl.h> 510Sstevel@tonic-gate #include <sys/shm.h> 520Sstevel@tonic-gate #include <sys/shm_impl.h> 530Sstevel@tonic-gate #include <sys/dirent.h> 540Sstevel@tonic-gate #include <ustat.h> 550Sstevel@tonic-gate #include <fcntl.h> 560Sstevel@tonic-gate #include <time.h> 570Sstevel@tonic-gate #include <sys/termios.h> 580Sstevel@tonic-gate #include <sys/termiox.h> 590Sstevel@tonic-gate #include <sys/termio.h> 600Sstevel@tonic-gate #include <sys/ttold.h> 610Sstevel@tonic-gate #include <sys/jioctl.h> 620Sstevel@tonic-gate #include <sys/filio.h> 630Sstevel@tonic-gate #include <stropts.h> 640Sstevel@tonic-gate #include <poll.h> 650Sstevel@tonic-gate #include <sys/uio.h> 660Sstevel@tonic-gate #include <sys/resource.h> 670Sstevel@tonic-gate #include <sys/statvfs.h> 680Sstevel@tonic-gate #include <sys/time.h> 690Sstevel@tonic-gate #include <sys/aio.h> 700Sstevel@tonic-gate #include <sys/socket.h> 710Sstevel@tonic-gate #include <netinet/in.h> 720Sstevel@tonic-gate #include <sys/un.h> 730Sstevel@tonic-gate #include <sys/byteorder.h> 740Sstevel@tonic-gate #include <arpa/inet.h> 750Sstevel@tonic-gate #include <sys/audioio.h> 760Sstevel@tonic-gate #include <sys/cladm.h> 770Sstevel@tonic-gate #include <sys/synch.h> 780Sstevel@tonic-gate #include <sys/synch32.h> 790Sstevel@tonic-gate #include <sys/sysmacros.h> 800Sstevel@tonic-gate #include <sys/sendfile.h> 810Sstevel@tonic-gate #include <priv.h> 820Sstevel@tonic-gate #include <ucred.h> 830Sstevel@tonic-gate #include <sys/ucred.h> 840Sstevel@tonic-gate #include <sys/port_impl.h> 85813Sdp #include <sys/zone.h> 86813Sdp #include <sys/priv_impl.h> 87813Sdp #include <sys/priv.h> 881676Sjpk #include <tsol/label.h> 892447Snf202958 #include <sys/nvpair.h> 902447Snf202958 #include <libnvpair.h> 913684Srd117015 #include <sys/rctl_impl.h> 92*12643SAnders.Persson@Sun.COM #include <sys/socketvar.h> 930Sstevel@tonic-gate 940Sstevel@tonic-gate #include "ramdata.h" 950Sstevel@tonic-gate #include "systable.h" 960Sstevel@tonic-gate #include "proto.h" 970Sstevel@tonic-gate 980Sstevel@tonic-gate void show_sigset(private_t *, long, const char *); 990Sstevel@tonic-gate void show_ioctl(private_t *, int, long); 1000Sstevel@tonic-gate 10110440SRoger.Faulkner@Sun.COM static void 10210440SRoger.Faulkner@Sun.COM mk_ctime(char *str, size_t maxsize, time_t value) 10310440SRoger.Faulkner@Sun.COM { 10410440SRoger.Faulkner@Sun.COM (void) strftime(str, maxsize, "%b %e %H:%M:%S %Z %Y", 10510440SRoger.Faulkner@Sun.COM localtime(&value)); 10610440SRoger.Faulkner@Sun.COM } 10710440SRoger.Faulkner@Sun.COM 1080Sstevel@tonic-gate void 1090Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value) 1100Sstevel@tonic-gate { 1110Sstevel@tonic-gate char str[80]; 1120Sstevel@tonic-gate 11310440SRoger.Faulkner@Sun.COM mk_ctime(str, sizeof (str), value); 11410440SRoger.Faulkner@Sun.COM (void) printf("%s\t%s%s [ %lu ]\n", 1150Sstevel@tonic-gate pri->pname, 1160Sstevel@tonic-gate name, 1170Sstevel@tonic-gate str, 11810440SRoger.Faulkner@Sun.COM value); 11910440SRoger.Faulkner@Sun.COM } 12010440SRoger.Faulkner@Sun.COM 12110440SRoger.Faulkner@Sun.COM void 12210440SRoger.Faulkner@Sun.COM prtimeval(private_t *pri, const char *name, struct timeval *value) 12310440SRoger.Faulkner@Sun.COM { 12410440SRoger.Faulkner@Sun.COM char str[80]; 12510440SRoger.Faulkner@Sun.COM 12610440SRoger.Faulkner@Sun.COM mk_ctime(str, sizeof (str), value->tv_sec); 12710440SRoger.Faulkner@Sun.COM (void) printf("%s\t%s%s [ %lu.%6.6lu ]\n", 12810440SRoger.Faulkner@Sun.COM pri->pname, 12910440SRoger.Faulkner@Sun.COM name, 13010440SRoger.Faulkner@Sun.COM str, 13110440SRoger.Faulkner@Sun.COM value->tv_sec, 13210440SRoger.Faulkner@Sun.COM value->tv_usec); 1330Sstevel@tonic-gate } 1340Sstevel@tonic-gate 1350Sstevel@tonic-gate void 1360Sstevel@tonic-gate prtimestruc(private_t *pri, const char *name, timestruc_t *value) 1370Sstevel@tonic-gate { 13810440SRoger.Faulkner@Sun.COM char str[80]; 13910440SRoger.Faulkner@Sun.COM 14010440SRoger.Faulkner@Sun.COM mk_ctime(str, sizeof (str), value->tv_sec); 14110440SRoger.Faulkner@Sun.COM (void) printf("%s\t%s%s [ %lu.%9.9lu ]\n", 14210440SRoger.Faulkner@Sun.COM pri->pname, 14310440SRoger.Faulkner@Sun.COM name, 14410440SRoger.Faulkner@Sun.COM str, 14510440SRoger.Faulkner@Sun.COM value->tv_sec, 14610440SRoger.Faulkner@Sun.COM value->tv_nsec); 1470Sstevel@tonic-gate } 1480Sstevel@tonic-gate 14910440SRoger.Faulkner@Sun.COM static void 15010440SRoger.Faulkner@Sun.COM show_utimens(private_t *pri, long offset) 15110440SRoger.Faulkner@Sun.COM { 15210440SRoger.Faulkner@Sun.COM struct { 15310440SRoger.Faulkner@Sun.COM timespec_t atime; 15410440SRoger.Faulkner@Sun.COM timespec_t mtime; 15510440SRoger.Faulkner@Sun.COM } utimbuf; 15610440SRoger.Faulkner@Sun.COM 15710440SRoger.Faulkner@Sun.COM if (offset == 0) 15810440SRoger.Faulkner@Sun.COM return; 15910440SRoger.Faulkner@Sun.COM 16010440SRoger.Faulkner@Sun.COM if (data_model == PR_MODEL_NATIVE) { 16110440SRoger.Faulkner@Sun.COM if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) 16210440SRoger.Faulkner@Sun.COM != sizeof (utimbuf)) 16310440SRoger.Faulkner@Sun.COM return; 16410440SRoger.Faulkner@Sun.COM } else { 16510440SRoger.Faulkner@Sun.COM struct { 16610440SRoger.Faulkner@Sun.COM timespec32_t atime; 16710440SRoger.Faulkner@Sun.COM timespec32_t mtime; 16810440SRoger.Faulkner@Sun.COM } utimbuf32; 16910440SRoger.Faulkner@Sun.COM 17010440SRoger.Faulkner@Sun.COM if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) 17110440SRoger.Faulkner@Sun.COM != sizeof (utimbuf32)) 17210440SRoger.Faulkner@Sun.COM return; 17310440SRoger.Faulkner@Sun.COM 17410440SRoger.Faulkner@Sun.COM TIMESPEC32_TO_TIMESPEC(&utimbuf.atime, &utimbuf32.atime); 17510440SRoger.Faulkner@Sun.COM TIMESPEC32_TO_TIMESPEC(&utimbuf.mtime, &utimbuf32.mtime); 17610440SRoger.Faulkner@Sun.COM } 17710440SRoger.Faulkner@Sun.COM 17810440SRoger.Faulkner@Sun.COM /* print access and modification times */ 17910440SRoger.Faulkner@Sun.COM if (utimbuf.atime.tv_nsec == UTIME_OMIT) 18010440SRoger.Faulkner@Sun.COM (void) printf("%s\tat = UTIME_OMIT\n", pri->pname); 18110440SRoger.Faulkner@Sun.COM else if (utimbuf.atime.tv_nsec == UTIME_NOW) 18210440SRoger.Faulkner@Sun.COM (void) printf("%s\tat = UTIME_NOW\n", pri->pname); 18310440SRoger.Faulkner@Sun.COM else 18410440SRoger.Faulkner@Sun.COM prtimestruc(pri, "at = ", &utimbuf.atime); 18510440SRoger.Faulkner@Sun.COM if (utimbuf.mtime.tv_nsec == UTIME_OMIT) 18610440SRoger.Faulkner@Sun.COM (void) printf("%s\tmt = UTIME_OMIT\n", pri->pname); 18710440SRoger.Faulkner@Sun.COM else if (utimbuf.mtime.tv_nsec == UTIME_NOW) 18810440SRoger.Faulkner@Sun.COM (void) printf("%s\tmt = UTIME_NOW\n", pri->pname); 18910440SRoger.Faulkner@Sun.COM else 19011695SPavel.Filipensky@Sun.COM prtimestruc(pri, "mt = ", &utimbuf.mtime); 1910Sstevel@tonic-gate } 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate void 1940Sstevel@tonic-gate show_timeofday(private_t *pri) 1950Sstevel@tonic-gate { 1960Sstevel@tonic-gate struct timeval tod; 1970Sstevel@tonic-gate long offset; 1980Sstevel@tonic-gate 1990Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 2000Sstevel@tonic-gate return; 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2030Sstevel@tonic-gate if (Pread(Proc, &tod, sizeof (tod), offset) 2040Sstevel@tonic-gate != sizeof (tod)) 2050Sstevel@tonic-gate return; 2060Sstevel@tonic-gate } else { 2070Sstevel@tonic-gate struct timeval32 tod32; 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate if (Pread(Proc, &tod32, sizeof (tod32), offset) 2100Sstevel@tonic-gate != sizeof (tod32)) 2110Sstevel@tonic-gate return; 2120Sstevel@tonic-gate 2130Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&tod, &tod32); 2140Sstevel@tonic-gate } 2150Sstevel@tonic-gate 21610440SRoger.Faulkner@Sun.COM prtimeval(pri, "time: ", &tod); 2170Sstevel@tonic-gate } 2180Sstevel@tonic-gate 2190Sstevel@tonic-gate void 2200Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name) 2210Sstevel@tonic-gate { 2220Sstevel@tonic-gate struct itimerval itimerval; 2230Sstevel@tonic-gate 22410440SRoger.Faulkner@Sun.COM if (offset == 0) 2250Sstevel@tonic-gate return; 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2280Sstevel@tonic-gate if (Pread(Proc, &itimerval, sizeof (itimerval), offset) 2290Sstevel@tonic-gate != sizeof (itimerval)) 2300Sstevel@tonic-gate return; 2310Sstevel@tonic-gate } else { 2320Sstevel@tonic-gate struct itimerval32 itimerval32; 2330Sstevel@tonic-gate 2340Sstevel@tonic-gate if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset) 2350Sstevel@tonic-gate != sizeof (itimerval32)) 2360Sstevel@tonic-gate return; 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32); 2390Sstevel@tonic-gate } 2400Sstevel@tonic-gate 2410Sstevel@tonic-gate (void) printf( 2420Sstevel@tonic-gate "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n", 2430Sstevel@tonic-gate pri->pname, 2440Sstevel@tonic-gate name, 2450Sstevel@tonic-gate itimerval.it_interval.tv_sec, 2460Sstevel@tonic-gate itimerval.it_interval.tv_usec, 2470Sstevel@tonic-gate itimerval.it_value.tv_sec, 2480Sstevel@tonic-gate itimerval.it_value.tv_usec); 2490Sstevel@tonic-gate } 2500Sstevel@tonic-gate 2510Sstevel@tonic-gate void 2520Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name) 2530Sstevel@tonic-gate { 2540Sstevel@tonic-gate struct timeval timeval; 2550Sstevel@tonic-gate 25610440SRoger.Faulkner@Sun.COM if (offset == 0) 2570Sstevel@tonic-gate return; 2580Sstevel@tonic-gate 2590Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2600Sstevel@tonic-gate if (Pread(Proc, &timeval, sizeof (timeval), offset) 2610Sstevel@tonic-gate != sizeof (timeval)) 2620Sstevel@tonic-gate return; 2630Sstevel@tonic-gate } else { 2640Sstevel@tonic-gate struct timeval32 timeval32; 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate if (Pread(Proc, &timeval32, sizeof (timeval32), offset) 2670Sstevel@tonic-gate != sizeof (timeval32)) 2680Sstevel@tonic-gate return; 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32); 2710Sstevel@tonic-gate } 2720Sstevel@tonic-gate 2730Sstevel@tonic-gate (void) printf( 2740Sstevel@tonic-gate "%s\t%s: %ld.%6.6ld sec\n", 2750Sstevel@tonic-gate pri->pname, 2760Sstevel@tonic-gate name, 2770Sstevel@tonic-gate timeval.tv_sec, 2780Sstevel@tonic-gate timeval.tv_usec); 2790Sstevel@tonic-gate } 2800Sstevel@tonic-gate 2810Sstevel@tonic-gate void 2820Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name) 2830Sstevel@tonic-gate { 2840Sstevel@tonic-gate timestruc_t timestruc; 2850Sstevel@tonic-gate 28610440SRoger.Faulkner@Sun.COM if (offset == 0) 2870Sstevel@tonic-gate return; 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2900Sstevel@tonic-gate if (Pread(Proc, ×truc, sizeof (timestruc), offset) 2910Sstevel@tonic-gate != sizeof (timestruc)) 2920Sstevel@tonic-gate return; 2930Sstevel@tonic-gate } else { 2940Sstevel@tonic-gate timestruc32_t timestruc32; 2950Sstevel@tonic-gate 2960Sstevel@tonic-gate if (Pread(Proc, ×truc32, sizeof (timestruc32), offset) 2970Sstevel@tonic-gate != sizeof (timestruc32)) 2980Sstevel@tonic-gate return; 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate TIMESPEC32_TO_TIMESPEC(×truc, ×truc32); 3010Sstevel@tonic-gate } 3020Sstevel@tonic-gate 3030Sstevel@tonic-gate (void) printf( 3040Sstevel@tonic-gate "%s\t%s: %ld.%9.9ld sec\n", 3050Sstevel@tonic-gate pri->pname, 3060Sstevel@tonic-gate name, 3070Sstevel@tonic-gate timestruc.tv_sec, 3080Sstevel@tonic-gate timestruc.tv_nsec); 3090Sstevel@tonic-gate } 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate void 3120Sstevel@tonic-gate show_stime(private_t *pri) 3130Sstevel@tonic-gate { 3140Sstevel@tonic-gate if (pri->sys_nargs >= 1) { 3150Sstevel@tonic-gate /* print new system time */ 3160Sstevel@tonic-gate prtime(pri, "systime = ", (time_t)pri->sys_args[0]); 3170Sstevel@tonic-gate } 3180Sstevel@tonic-gate } 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate void 3210Sstevel@tonic-gate show_times(private_t *pri) 3220Sstevel@tonic-gate { 3230Sstevel@tonic-gate long hz = sysconf(_SC_CLK_TCK); 3240Sstevel@tonic-gate long offset; 3250Sstevel@tonic-gate struct tms tms; 3260Sstevel@tonic-gate 3270Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 3280Sstevel@tonic-gate return; 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 3310Sstevel@tonic-gate if (Pread(Proc, &tms, sizeof (tms), offset) 3320Sstevel@tonic-gate != sizeof (tms)) 3330Sstevel@tonic-gate return; 3340Sstevel@tonic-gate } else { 3350Sstevel@tonic-gate struct tms32 tms32; 3360Sstevel@tonic-gate 3370Sstevel@tonic-gate if (Pread(Proc, &tms32, sizeof (tms32), offset) 3380Sstevel@tonic-gate != sizeof (tms32)) 3390Sstevel@tonic-gate return; 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate /* 3420Sstevel@tonic-gate * This looks a bit odd (since the values are actually 3430Sstevel@tonic-gate * signed), but we need to suppress sign extension to 3440Sstevel@tonic-gate * preserve compatibility (we've always printed these 3450Sstevel@tonic-gate * numbers as unsigned quantities). 3460Sstevel@tonic-gate */ 3470Sstevel@tonic-gate tms.tms_utime = (unsigned)tms32.tms_utime; 3480Sstevel@tonic-gate tms.tms_stime = (unsigned)tms32.tms_stime; 3490Sstevel@tonic-gate tms.tms_cutime = (unsigned)tms32.tms_cutime; 3500Sstevel@tonic-gate tms.tms_cstime = (unsigned)tms32.tms_cstime; 3510Sstevel@tonic-gate } 3520Sstevel@tonic-gate 3530Sstevel@tonic-gate (void) printf( 3540Sstevel@tonic-gate "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n", 3550Sstevel@tonic-gate pri->pname, 3560Sstevel@tonic-gate tms.tms_utime, 3570Sstevel@tonic-gate tms.tms_stime, 3580Sstevel@tonic-gate tms.tms_cutime, 3590Sstevel@tonic-gate tms.tms_cstime, 3600Sstevel@tonic-gate hz); 3610Sstevel@tonic-gate } 3620Sstevel@tonic-gate 3630Sstevel@tonic-gate void 3640Sstevel@tonic-gate show_uname(private_t *pri, long offset) 3650Sstevel@tonic-gate { 3660Sstevel@tonic-gate /* 3670Sstevel@tonic-gate * Old utsname buffer (no longer accessible in <sys/utsname.h>). 3680Sstevel@tonic-gate */ 3690Sstevel@tonic-gate struct { 3700Sstevel@tonic-gate char sysname[9]; 3710Sstevel@tonic-gate char nodename[9]; 3720Sstevel@tonic-gate char release[9]; 3730Sstevel@tonic-gate char version[9]; 3740Sstevel@tonic-gate char machine[9]; 3750Sstevel@tonic-gate } ubuf; 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate if (offset != NULL && 3780Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3790Sstevel@tonic-gate (void) printf( 3807088Sraf "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n", 3817088Sraf pri->pname, 3827088Sraf ubuf.sysname, 3837088Sraf ubuf.nodename, 3847088Sraf ubuf.release, 3857088Sraf ubuf.version, 3867088Sraf ubuf.machine); 3870Sstevel@tonic-gate } 3880Sstevel@tonic-gate } 3890Sstevel@tonic-gate 3900Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */ 3910Sstevel@tonic-gate void 3920Sstevel@tonic-gate show_ustat(private_t *pri, long offset) 3930Sstevel@tonic-gate { 3940Sstevel@tonic-gate struct ustat ubuf; 3950Sstevel@tonic-gate 3960Sstevel@tonic-gate if (offset != NULL && 3970Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3980Sstevel@tonic-gate (void) printf( 3997088Sraf "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n", 4007088Sraf pri->pname, 4017088Sraf ubuf.f_tfree, 4027088Sraf ubuf.f_tinode, 4037088Sraf ubuf.f_fname, 4047088Sraf ubuf.f_fpack); 4050Sstevel@tonic-gate } 4060Sstevel@tonic-gate } 4070Sstevel@tonic-gate 4080Sstevel@tonic-gate #ifdef _LP64 4090Sstevel@tonic-gate void 4100Sstevel@tonic-gate show_ustat32(private_t *pri, long offset) 4110Sstevel@tonic-gate { 4120Sstevel@tonic-gate struct ustat32 ubuf; 4130Sstevel@tonic-gate 4140Sstevel@tonic-gate if (offset != NULL && 4150Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 4160Sstevel@tonic-gate (void) printf( 4177088Sraf "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n", 4187088Sraf pri->pname, 4197088Sraf ubuf.f_tfree, 4207088Sraf ubuf.f_tinode, 4217088Sraf ubuf.f_fname, 4227088Sraf ubuf.f_fpack); 4230Sstevel@tonic-gate } 4240Sstevel@tonic-gate } 4250Sstevel@tonic-gate #endif /* _LP64 */ 4260Sstevel@tonic-gate 4270Sstevel@tonic-gate void 4280Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc) 4290Sstevel@tonic-gate { 4300Sstevel@tonic-gate f_user_t fubuf; 4310Sstevel@tonic-gate int serial = (nproc > 4); 4320Sstevel@tonic-gate 43310440SRoger.Faulkner@Sun.COM if (offset == 0) 4340Sstevel@tonic-gate return; 4350Sstevel@tonic-gate 4360Sstevel@tonic-gate /* enter region of lengthy output */ 4370Sstevel@tonic-gate if (serial) 4380Sstevel@tonic-gate Eserialize(); 4390Sstevel@tonic-gate 4400Sstevel@tonic-gate while (nproc > 0 && 4410Sstevel@tonic-gate Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) { 4424321Scasper (void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n", 4430Sstevel@tonic-gate pri->pname, 4440Sstevel@tonic-gate (int)fubuf.fu_pid, 4454321Scasper fubuf.fu_uid, 4460Sstevel@tonic-gate fuflags(pri, fubuf.fu_flags)); 4470Sstevel@tonic-gate nproc--; 4480Sstevel@tonic-gate offset += sizeof (fubuf); 4490Sstevel@tonic-gate } 4500Sstevel@tonic-gate 4510Sstevel@tonic-gate /* exit region of lengthy output */ 4520Sstevel@tonic-gate if (serial) 4530Sstevel@tonic-gate Xserialize(); 4540Sstevel@tonic-gate } 4550Sstevel@tonic-gate 4560Sstevel@tonic-gate void 4570Sstevel@tonic-gate show_utssys(private_t *pri, long r0) 4580Sstevel@tonic-gate { 4590Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4600Sstevel@tonic-gate switch (pri->sys_args[2]) { 4610Sstevel@tonic-gate case UTS_UNAME: 4620Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4630Sstevel@tonic-gate break; 4640Sstevel@tonic-gate case UTS_USTAT: 4650Sstevel@tonic-gate show_ustat(pri, (long)pri->sys_args[0]); 4660Sstevel@tonic-gate break; 4670Sstevel@tonic-gate case UTS_FUSERS: 4680Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4690Sstevel@tonic-gate break; 4700Sstevel@tonic-gate } 4710Sstevel@tonic-gate } 4720Sstevel@tonic-gate } 4730Sstevel@tonic-gate 4740Sstevel@tonic-gate #ifdef _LP64 4750Sstevel@tonic-gate void 4760Sstevel@tonic-gate show_utssys32(private_t *pri, long r0) 4770Sstevel@tonic-gate { 4780Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4790Sstevel@tonic-gate switch (pri->sys_args[2]) { 4800Sstevel@tonic-gate case UTS_UNAME: 4810Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4820Sstevel@tonic-gate break; 4830Sstevel@tonic-gate case UTS_USTAT: 4840Sstevel@tonic-gate show_ustat32(pri, (long)pri->sys_args[0]); 4850Sstevel@tonic-gate break; 4860Sstevel@tonic-gate case UTS_FUSERS: 4870Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4880Sstevel@tonic-gate break; 4890Sstevel@tonic-gate } 4900Sstevel@tonic-gate } 4910Sstevel@tonic-gate } 4920Sstevel@tonic-gate #endif /* _LP64 */ 4930Sstevel@tonic-gate 4940Sstevel@tonic-gate void 4950Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset) 4960Sstevel@tonic-gate { 4970Sstevel@tonic-gate int arg; 4980Sstevel@tonic-gate 4990Sstevel@tonic-gate switch (code) { 5000Sstevel@tonic-gate case CL_INITIALIZE: 5010Sstevel@tonic-gate switch (function) { 5020Sstevel@tonic-gate case CL_GET_BOOTFLAG: 5030Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 5040Sstevel@tonic-gate == sizeof (arg)) { 5050Sstevel@tonic-gate if (arg & CLUSTER_CONFIGURED) 5060Sstevel@tonic-gate (void) printf("%s\tbootflags=" 5070Sstevel@tonic-gate "CLUSTER_CONFIGURED", pri->pname); 5080Sstevel@tonic-gate if (arg & CLUSTER_BOOTED) 5090Sstevel@tonic-gate (void) printf("|CLUSTER_BOOTED\n"); 5100Sstevel@tonic-gate } 5110Sstevel@tonic-gate break; 5120Sstevel@tonic-gate } 5130Sstevel@tonic-gate break; 5140Sstevel@tonic-gate case CL_CONFIG: 5150Sstevel@tonic-gate switch (function) { 5160Sstevel@tonic-gate case CL_NODEID: 5170Sstevel@tonic-gate case CL_HIGHEST_NODEID: 5180Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 5190Sstevel@tonic-gate == sizeof (arg)) 5200Sstevel@tonic-gate (void) printf("%s\tnodeid=%d\n", 5217088Sraf pri->pname, arg); 5220Sstevel@tonic-gate } 5230Sstevel@tonic-gate break; 5240Sstevel@tonic-gate } 5250Sstevel@tonic-gate } 5260Sstevel@tonic-gate 5274574Sraf #define ALL_LOCK_TYPES \ 5284574Sraf (USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE | \ 5294574Sraf LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST | \ 5304574Sraf USYNC_PROCESS_ROBUST) 5310Sstevel@tonic-gate 5320Sstevel@tonic-gate /* return cv and mutex types */ 5330Sstevel@tonic-gate const char * 5340Sstevel@tonic-gate synch_type(private_t *pri, uint_t type) 5350Sstevel@tonic-gate { 5360Sstevel@tonic-gate char *str = pri->code_buf; 5370Sstevel@tonic-gate 5380Sstevel@tonic-gate if (type & USYNC_PROCESS) 5390Sstevel@tonic-gate (void) strcpy(str, "USYNC_PROCESS"); 5400Sstevel@tonic-gate else 5410Sstevel@tonic-gate (void) strcpy(str, "USYNC_THREAD"); 5420Sstevel@tonic-gate 5430Sstevel@tonic-gate if (type & LOCK_ERRORCHECK) 5440Sstevel@tonic-gate (void) strcat(str, "|LOCK_ERRORCHECK"); 5450Sstevel@tonic-gate if (type & LOCK_RECURSIVE) 5460Sstevel@tonic-gate (void) strcat(str, "|LOCK_RECURSIVE"); 5470Sstevel@tonic-gate if (type & LOCK_PRIO_INHERIT) 5480Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_INHERIT"); 5490Sstevel@tonic-gate if (type & LOCK_PRIO_PROTECT) 5500Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_PROTECT"); 5514574Sraf if (type & LOCK_ROBUST) 5524574Sraf (void) strcat(str, "|LOCK_ROBUST"); 5534574Sraf if (type & USYNC_PROCESS_ROBUST) 5544574Sraf (void) strcat(str, "|USYNC_PROCESS_ROBUST"); 5550Sstevel@tonic-gate 5560Sstevel@tonic-gate if ((type &= ~ALL_LOCK_TYPES) != 0) 5570Sstevel@tonic-gate (void) sprintf(str + strlen(str), "|0x%.4X", type); 5580Sstevel@tonic-gate 5590Sstevel@tonic-gate return ((const char *)str); 5600Sstevel@tonic-gate } 5610Sstevel@tonic-gate 5620Sstevel@tonic-gate void 5630Sstevel@tonic-gate show_mutex(private_t *pri, long offset) 5640Sstevel@tonic-gate { 5650Sstevel@tonic-gate lwp_mutex_t mutex; 5660Sstevel@tonic-gate 5670Sstevel@tonic-gate if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) { 5680Sstevel@tonic-gate (void) printf("%s\tmutex type: %s\n", 5697088Sraf pri->pname, 5707088Sraf synch_type(pri, mutex.mutex_type)); 5710Sstevel@tonic-gate } 5720Sstevel@tonic-gate } 5730Sstevel@tonic-gate 5740Sstevel@tonic-gate void 5750Sstevel@tonic-gate show_condvar(private_t *pri, long offset) 5760Sstevel@tonic-gate { 5770Sstevel@tonic-gate lwp_cond_t condvar; 5780Sstevel@tonic-gate 5790Sstevel@tonic-gate if (Pread(Proc, &condvar, sizeof (condvar), offset) 5800Sstevel@tonic-gate == sizeof (condvar)) { 5810Sstevel@tonic-gate (void) printf("%s\tcondvar type: %s\n", 5827088Sraf pri->pname, 5837088Sraf synch_type(pri, condvar.cond_type)); 5840Sstevel@tonic-gate } 5850Sstevel@tonic-gate } 5860Sstevel@tonic-gate 5870Sstevel@tonic-gate void 5880Sstevel@tonic-gate show_sema(private_t *pri, long offset) 5890Sstevel@tonic-gate { 5900Sstevel@tonic-gate lwp_sema_t sema; 5910Sstevel@tonic-gate 5920Sstevel@tonic-gate if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) { 5930Sstevel@tonic-gate (void) printf("%s\tsema type: %s count = %u\n", 5947088Sraf pri->pname, 5957088Sraf synch_type(pri, sema.sema_type), 5967088Sraf sema.sema_count); 5970Sstevel@tonic-gate } 5980Sstevel@tonic-gate } 5990Sstevel@tonic-gate 6000Sstevel@tonic-gate void 6010Sstevel@tonic-gate show_rwlock(private_t *pri, long offset) 6020Sstevel@tonic-gate { 6030Sstevel@tonic-gate lwp_rwlock_t rwlock; 6040Sstevel@tonic-gate 6050Sstevel@tonic-gate if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) { 6060Sstevel@tonic-gate (void) printf("%s\trwlock type: %s readers = %d\n", 6077088Sraf pri->pname, 6087088Sraf synch_type(pri, rwlock.rwlock_type), 6097088Sraf rwlock.rwlock_readers); 6100Sstevel@tonic-gate } 6110Sstevel@tonic-gate } 6120Sstevel@tonic-gate 6130Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */ 6140Sstevel@tonic-gate char * 6150Sstevel@tonic-gate show_char(char *buf, int c) 6160Sstevel@tonic-gate { 6170Sstevel@tonic-gate const char *fmt; 6180Sstevel@tonic-gate 6190Sstevel@tonic-gate if (c >= ' ' && c < 0177) 6200Sstevel@tonic-gate fmt = "'%c'"; 6210Sstevel@tonic-gate else 6220Sstevel@tonic-gate fmt = "%.3o"; 6230Sstevel@tonic-gate 6240Sstevel@tonic-gate (void) sprintf(buf, fmt, c&0xff); 6250Sstevel@tonic-gate return (buf); 6260Sstevel@tonic-gate } 6270Sstevel@tonic-gate 6280Sstevel@tonic-gate void 6290Sstevel@tonic-gate show_termio(private_t *pri, long offset) 6300Sstevel@tonic-gate { 6310Sstevel@tonic-gate struct termio termio; 6320Sstevel@tonic-gate char cbuf[8]; 6330Sstevel@tonic-gate int i; 6340Sstevel@tonic-gate 6350Sstevel@tonic-gate if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) { 6360Sstevel@tonic-gate (void) printf( 6370Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n", 6387088Sraf pri->pname, 6397088Sraf termio.c_iflag, 6407088Sraf termio.c_oflag, 6417088Sraf termio.c_cflag, 6427088Sraf termio.c_lflag, 6437088Sraf termio.c_line); 6440Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6450Sstevel@tonic-gate for (i = 0; i < NCC; i++) 6460Sstevel@tonic-gate (void) printf(" %s", 6477088Sraf show_char(cbuf, (int)termio.c_cc[i])); 6480Sstevel@tonic-gate (void) fputc('\n', stdout); 6490Sstevel@tonic-gate } 6500Sstevel@tonic-gate } 6510Sstevel@tonic-gate 6520Sstevel@tonic-gate void 6530Sstevel@tonic-gate show_termios(private_t *pri, long offset) 6540Sstevel@tonic-gate { 6550Sstevel@tonic-gate struct termios termios; 6560Sstevel@tonic-gate char cbuf[8]; 6570Sstevel@tonic-gate int i; 6580Sstevel@tonic-gate 6590Sstevel@tonic-gate if (Pread(Proc, &termios, sizeof (termios), offset) 6600Sstevel@tonic-gate == sizeof (termios)) { 6610Sstevel@tonic-gate (void) printf( 6627088Sraf "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n", 6637088Sraf pri->pname, 6647088Sraf termios.c_iflag, 6657088Sraf termios.c_oflag, 6667088Sraf termios.c_cflag, 6677088Sraf termios.c_lflag); 6680Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6690Sstevel@tonic-gate for (i = 0; i < NCCS; i++) { 6700Sstevel@tonic-gate if (i == NCC) /* show new chars on new line */ 6710Sstevel@tonic-gate (void) printf("\n%s\t\t", pri->pname); 6720Sstevel@tonic-gate (void) printf(" %s", 6737088Sraf show_char(cbuf, (int)termios.c_cc[i])); 6740Sstevel@tonic-gate } 6750Sstevel@tonic-gate (void) fputc('\n', stdout); 6760Sstevel@tonic-gate } 6770Sstevel@tonic-gate } 6780Sstevel@tonic-gate 6790Sstevel@tonic-gate void 6800Sstevel@tonic-gate show_termiox(private_t *pri, long offset) 6810Sstevel@tonic-gate { 6820Sstevel@tonic-gate struct termiox termiox; 6830Sstevel@tonic-gate int i; 6840Sstevel@tonic-gate 6850Sstevel@tonic-gate if (Pread(Proc, &termiox, sizeof (termiox), offset) 6860Sstevel@tonic-gate == sizeof (termiox)) { 6870Sstevel@tonic-gate (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o", 6887088Sraf pri->pname, 6897088Sraf termiox.x_hflag, 6907088Sraf termiox.x_cflag, 6917088Sraf termiox.x_rflag[0]); 6920Sstevel@tonic-gate for (i = 1; i < NFF; i++) 6930Sstevel@tonic-gate (void) printf(",0%.3o", termiox.x_rflag[i]); 6940Sstevel@tonic-gate (void) printf(" sflag=0%.3o\n", 6957088Sraf termiox.x_sflag); 6960Sstevel@tonic-gate } 6970Sstevel@tonic-gate } 6980Sstevel@tonic-gate 6990Sstevel@tonic-gate void 7000Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset) 7010Sstevel@tonic-gate { 7020Sstevel@tonic-gate struct sgttyb sgttyb; 7030Sstevel@tonic-gate 7040Sstevel@tonic-gate if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) { 7050Sstevel@tonic-gate char erase[8]; 7060Sstevel@tonic-gate char kill[8]; 7070Sstevel@tonic-gate 7080Sstevel@tonic-gate (void) printf( 7090Sstevel@tonic-gate "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n", 7107088Sraf pri->pname, 7117088Sraf sgttyb.sg_ispeed&0xff, 7127088Sraf sgttyb.sg_ospeed&0xff, 7137088Sraf show_char(erase, sgttyb.sg_erase), 7147088Sraf show_char(kill, sgttyb.sg_kill), 7157088Sraf sgttyb.sg_flags); 7160Sstevel@tonic-gate } 7170Sstevel@tonic-gate } 7180Sstevel@tonic-gate 7190Sstevel@tonic-gate void 7200Sstevel@tonic-gate show_ltchars(private_t *pri, long offset) 7210Sstevel@tonic-gate { 7220Sstevel@tonic-gate struct ltchars ltchars; 7230Sstevel@tonic-gate char *p; 7240Sstevel@tonic-gate char cbuf[8]; 7250Sstevel@tonic-gate int i; 7260Sstevel@tonic-gate 7270Sstevel@tonic-gate if (Pread(Proc, <chars, sizeof (ltchars), offset) 7280Sstevel@tonic-gate == sizeof (ltchars)) { 7290Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7300Sstevel@tonic-gate for (p = (char *)<chars, i = 0; i < sizeof (ltchars); i++) 7310Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7320Sstevel@tonic-gate (void) fputc('\n', stdout); 7330Sstevel@tonic-gate } 7340Sstevel@tonic-gate } 7350Sstevel@tonic-gate 7360Sstevel@tonic-gate void 7370Sstevel@tonic-gate show_tchars(private_t *pri, long offset) 7380Sstevel@tonic-gate { 7390Sstevel@tonic-gate struct tchars tchars; 7400Sstevel@tonic-gate char *p; 7410Sstevel@tonic-gate char cbuf[8]; 7420Sstevel@tonic-gate int i; 7430Sstevel@tonic-gate 7440Sstevel@tonic-gate if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) { 7450Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7460Sstevel@tonic-gate for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++) 7470Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7480Sstevel@tonic-gate (void) fputc('\n', stdout); 7490Sstevel@tonic-gate } 7500Sstevel@tonic-gate } 7510Sstevel@tonic-gate 7520Sstevel@tonic-gate void 7530Sstevel@tonic-gate show_termcb(private_t *pri, long offset) 7540Sstevel@tonic-gate { 7550Sstevel@tonic-gate struct termcb termcb; 7560Sstevel@tonic-gate 7570Sstevel@tonic-gate if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) { 7580Sstevel@tonic-gate (void) printf( 7597088Sraf "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n", 7607088Sraf pri->pname, 7617088Sraf termcb.st_flgs&0xff, 7627088Sraf termcb.st_termt&0xff, 7637088Sraf termcb.st_crow&0xff, 7647088Sraf termcb.st_ccol&0xff, 7657088Sraf termcb.st_vrow&0xff, 7667088Sraf termcb.st_lrow&0xff); 7670Sstevel@tonic-gate } 7680Sstevel@tonic-gate } 7690Sstevel@tonic-gate 7700Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */ 7710Sstevel@tonic-gate void 7720Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset) 7730Sstevel@tonic-gate { 7740Sstevel@tonic-gate int val; 7750Sstevel@tonic-gate 7760Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 7770Sstevel@tonic-gate const char *s = NULL; 7780Sstevel@tonic-gate 7790Sstevel@tonic-gate switch (code) { /* interpret these symbolically */ 7800Sstevel@tonic-gate case I_GRDOPT: 7810Sstevel@tonic-gate s = strrdopt(val); 7820Sstevel@tonic-gate break; 7830Sstevel@tonic-gate case I_GETSIG: 7840Sstevel@tonic-gate s = strevents(pri, val); 7850Sstevel@tonic-gate break; 7860Sstevel@tonic-gate case TIOCFLUSH: 7870Sstevel@tonic-gate s = tiocflush(pri, val); 7880Sstevel@tonic-gate break; 7890Sstevel@tonic-gate } 7900Sstevel@tonic-gate 7910Sstevel@tonic-gate if (s == NULL) 7920Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %d\n", 7937088Sraf pri->pname, offset, val); 7940Sstevel@tonic-gate else 7950Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %s\n", 7967088Sraf pri->pname, offset, s); 7970Sstevel@tonic-gate } 7980Sstevel@tonic-gate } 7990Sstevel@tonic-gate 8000Sstevel@tonic-gate void 8010Sstevel@tonic-gate show_strioctl(private_t *pri, long offset) 8020Sstevel@tonic-gate { 8030Sstevel@tonic-gate struct strioctl strioctl; 8040Sstevel@tonic-gate 8050Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 8060Sstevel@tonic-gate sizeof (strioctl)) { 8070Sstevel@tonic-gate (void) printf( 8087088Sraf "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 8097088Sraf pri->pname, 8107088Sraf ioctlname(pri, strioctl.ic_cmd), 8117088Sraf strioctl.ic_timout, 8127088Sraf strioctl.ic_len, 8137088Sraf (long)strioctl.ic_dp); 8140Sstevel@tonic-gate 8150Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8160Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8177088Sraf (long)strioctl.ic_dp); 8180Sstevel@tonic-gate --pri->recur; 8190Sstevel@tonic-gate } 8200Sstevel@tonic-gate } 8210Sstevel@tonic-gate 8220Sstevel@tonic-gate #ifdef _LP64 8230Sstevel@tonic-gate void 8240Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset) 8250Sstevel@tonic-gate { 8260Sstevel@tonic-gate struct strioctl32 strioctl; 8270Sstevel@tonic-gate 8280Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 8290Sstevel@tonic-gate sizeof (strioctl)) { 8300Sstevel@tonic-gate (void) printf( 8317088Sraf "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 8327088Sraf pri->pname, 8337088Sraf ioctlname(pri, strioctl.ic_cmd), 8347088Sraf strioctl.ic_timout, 8357088Sraf strioctl.ic_len, 8367088Sraf (long)strioctl.ic_dp); 8370Sstevel@tonic-gate 8380Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8390Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8407088Sraf (long)strioctl.ic_dp); 8410Sstevel@tonic-gate --pri->recur; 8420Sstevel@tonic-gate } 8430Sstevel@tonic-gate } 8440Sstevel@tonic-gate #endif /* _LP64 */ 8450Sstevel@tonic-gate 8460Sstevel@tonic-gate void 8470Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump) 8480Sstevel@tonic-gate { 8490Sstevel@tonic-gate (void) printf( 8507088Sraf "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8517088Sraf pri->pname, 8527088Sraf name, 8537088Sraf sp->maxlen, 8547088Sraf sp->len, 8557088Sraf (long)sp->buf); 8560Sstevel@tonic-gate /* 8570Sstevel@tonic-gate * Should we show the buffer contents? 8580Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8590Sstevel@tonic-gate */ 8600Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8610Sstevel@tonic-gate (void) fputc('\n', stdout); 8620Sstevel@tonic-gate else { 8630Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 8640Sstevel@tonic-gate char buffer[8]; 8650Sstevel@tonic-gate char obuf[40]; 8660Sstevel@tonic-gate 8670Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 8680Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 8690Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 8700Sstevel@tonic-gate (void) strcat(obuf, 8717088Sraf (nb == sp->len)? 8727088Sraf (const char *)"\"" : (const char *)"\".."); 8730Sstevel@tonic-gate (void) fputs(obuf, stdout); 8740Sstevel@tonic-gate } 8750Sstevel@tonic-gate (void) fputc('\n', stdout); 8760Sstevel@tonic-gate if (dump && sp->len > 8) 8770Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 8780Sstevel@tonic-gate } 8790Sstevel@tonic-gate } 8800Sstevel@tonic-gate 8810Sstevel@tonic-gate #ifdef _LP64 8820Sstevel@tonic-gate void 8830Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump) 8840Sstevel@tonic-gate { 8850Sstevel@tonic-gate (void) printf( 8867088Sraf "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8877088Sraf pri->pname, 8887088Sraf name, 8897088Sraf sp->maxlen, 8907088Sraf sp->len, 8917088Sraf (long)sp->buf); 8920Sstevel@tonic-gate /* 8930Sstevel@tonic-gate * Should we show the buffer contents? 8940Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8950Sstevel@tonic-gate */ 8960Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8970Sstevel@tonic-gate (void) fputc('\n', stdout); 8980Sstevel@tonic-gate else { 8990Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 9000Sstevel@tonic-gate char buffer[8]; 9010Sstevel@tonic-gate char obuf[40]; 9020Sstevel@tonic-gate 9030Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 9040Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 9050Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 9060Sstevel@tonic-gate (void) strcat(obuf, 9077088Sraf (nb == sp->len)? 9087088Sraf (const char *)"\"" : (const char *)"\".."); 9090Sstevel@tonic-gate (void) fputs(obuf, stdout); 9100Sstevel@tonic-gate } 9110Sstevel@tonic-gate (void) fputc('\n', stdout); 9120Sstevel@tonic-gate if (dump && sp->len > 8) 9130Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 9140Sstevel@tonic-gate } 9150Sstevel@tonic-gate } 9160Sstevel@tonic-gate #endif /* _LP64 */ 9170Sstevel@tonic-gate 9180Sstevel@tonic-gate /* strpeek and strfdinsert flags word */ 9190Sstevel@tonic-gate const char * 9200Sstevel@tonic-gate strflags(private_t *pri, int flags) 9210Sstevel@tonic-gate { 9220Sstevel@tonic-gate const char *s; 9230Sstevel@tonic-gate 9240Sstevel@tonic-gate switch (flags) { 9250Sstevel@tonic-gate case 0: 9260Sstevel@tonic-gate s = "0"; 9270Sstevel@tonic-gate break; 9280Sstevel@tonic-gate case RS_HIPRI: 9290Sstevel@tonic-gate s = "RS_HIPRI"; 9300Sstevel@tonic-gate break; 9310Sstevel@tonic-gate default: 9320Sstevel@tonic-gate (void) sprintf(pri->code_buf, "0x%.4X", flags); 9330Sstevel@tonic-gate s = pri->code_buf; 9340Sstevel@tonic-gate } 9350Sstevel@tonic-gate 9360Sstevel@tonic-gate return (s); 9370Sstevel@tonic-gate } 9380Sstevel@tonic-gate 9390Sstevel@tonic-gate void 9400Sstevel@tonic-gate show_strpeek(private_t *pri, long offset) 9410Sstevel@tonic-gate { 9420Sstevel@tonic-gate struct strpeek strpeek; 9430Sstevel@tonic-gate 9440Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9450Sstevel@tonic-gate == sizeof (strpeek)) { 9460Sstevel@tonic-gate 9470Sstevel@tonic-gate print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE); 9480Sstevel@tonic-gate print_strbuf(pri, &strpeek.databuf, "dat", FALSE); 9490Sstevel@tonic-gate 9500Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9517088Sraf pri->pname, 9527088Sraf strflags(pri, strpeek.flags)); 9530Sstevel@tonic-gate } 9540Sstevel@tonic-gate } 9550Sstevel@tonic-gate 9560Sstevel@tonic-gate #ifdef _LP64 9570Sstevel@tonic-gate void 9580Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset) 9590Sstevel@tonic-gate { 9600Sstevel@tonic-gate struct strpeek32 strpeek; 9610Sstevel@tonic-gate 9620Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9630Sstevel@tonic-gate == sizeof (strpeek)) { 9640Sstevel@tonic-gate 9650Sstevel@tonic-gate print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE); 9660Sstevel@tonic-gate print_strbuf32(pri, &strpeek.databuf, "dat", FALSE); 9670Sstevel@tonic-gate 9680Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9697088Sraf pri->pname, 9707088Sraf strflags(pri, strpeek.flags)); 9710Sstevel@tonic-gate } 9720Sstevel@tonic-gate } 9730Sstevel@tonic-gate #endif /* _LP64 */ 9740Sstevel@tonic-gate 9750Sstevel@tonic-gate void 9760Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset) 9770Sstevel@tonic-gate { 9780Sstevel@tonic-gate struct strfdinsert strfdinsert; 9790Sstevel@tonic-gate 9800Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 9810Sstevel@tonic-gate sizeof (strfdinsert)) { 9820Sstevel@tonic-gate 9830Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 9840Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE); 9850Sstevel@tonic-gate 9860Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 9877088Sraf pri->pname, 9887088Sraf strflags(pri, strfdinsert.flags), 9897088Sraf strfdinsert.fildes, 9907088Sraf strfdinsert.offset); 9910Sstevel@tonic-gate } 9920Sstevel@tonic-gate } 9930Sstevel@tonic-gate 9940Sstevel@tonic-gate #ifdef _LP64 9950Sstevel@tonic-gate void 9960Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset) 9970Sstevel@tonic-gate { 9980Sstevel@tonic-gate struct strfdinsert32 strfdinsert; 9990Sstevel@tonic-gate 10000Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 10010Sstevel@tonic-gate sizeof (strfdinsert)) { 10020Sstevel@tonic-gate 10030Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 10040Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE); 10050Sstevel@tonic-gate 10060Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 10077088Sraf pri->pname, 10087088Sraf strflags(pri, strfdinsert.flags), 10097088Sraf strfdinsert.fildes, 10107088Sraf strfdinsert.offset); 10110Sstevel@tonic-gate } 10120Sstevel@tonic-gate } 10130Sstevel@tonic-gate #endif /* _LP64 */ 10140Sstevel@tonic-gate 10150Sstevel@tonic-gate void 10160Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset) 10170Sstevel@tonic-gate { 10180Sstevel@tonic-gate struct strrecvfd strrecvfd; 10190Sstevel@tonic-gate 10200Sstevel@tonic-gate if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) == 10210Sstevel@tonic-gate sizeof (strrecvfd)) { 10220Sstevel@tonic-gate (void) printf( 10237088Sraf "%s\tfd=%-5d uid=%-5u gid=%u\n", 10247088Sraf pri->pname, 10257088Sraf strrecvfd.fd, 10267088Sraf strrecvfd.uid, 10277088Sraf strrecvfd.gid); 10280Sstevel@tonic-gate } 10290Sstevel@tonic-gate } 10300Sstevel@tonic-gate 10310Sstevel@tonic-gate void 10320Sstevel@tonic-gate show_strlist(private_t *pri, long offset) 10330Sstevel@tonic-gate { 10340Sstevel@tonic-gate struct str_list strlist; 10350Sstevel@tonic-gate struct str_mlist list; 10360Sstevel@tonic-gate int count; 10370Sstevel@tonic-gate 10380Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10390Sstevel@tonic-gate sizeof (strlist)) { 10400Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10417088Sraf pri->pname, 10427088Sraf strlist.sl_nmods, 10437088Sraf (long)strlist.sl_modlist); 10440Sstevel@tonic-gate 10450Sstevel@tonic-gate count = strlist.sl_nmods; 10460Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10470Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10480Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10490Sstevel@tonic-gate sizeof (list)) 10500Sstevel@tonic-gate break; 10510Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10527088Sraf pri->pname, 10537088Sraf (int)sizeof (list.l_name), 10547088Sraf list.l_name); 10550Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10560Sstevel@tonic-gate } 10570Sstevel@tonic-gate } 10580Sstevel@tonic-gate } 10590Sstevel@tonic-gate 10600Sstevel@tonic-gate #ifdef _LP64 10610Sstevel@tonic-gate void 10620Sstevel@tonic-gate show_strlist32(private_t *pri, long offset) 10630Sstevel@tonic-gate { 10640Sstevel@tonic-gate struct str_list32 strlist; 10650Sstevel@tonic-gate struct str_mlist list; 10660Sstevel@tonic-gate int count; 10670Sstevel@tonic-gate 10680Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10690Sstevel@tonic-gate sizeof (strlist)) { 10700Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10717088Sraf pri->pname, 10727088Sraf strlist.sl_nmods, 10737088Sraf (long)strlist.sl_modlist); 10740Sstevel@tonic-gate 10750Sstevel@tonic-gate count = strlist.sl_nmods; 10760Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10770Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10780Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10790Sstevel@tonic-gate sizeof (list)) 10800Sstevel@tonic-gate break; 10810Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10827088Sraf pri->pname, 10837088Sraf (int)sizeof (list.l_name), 10847088Sraf list.l_name); 10850Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10860Sstevel@tonic-gate } 10870Sstevel@tonic-gate } 10880Sstevel@tonic-gate } 10890Sstevel@tonic-gate #endif /* _LP64 */ 10900Sstevel@tonic-gate 10910Sstevel@tonic-gate void 10920Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset) 10930Sstevel@tonic-gate { 10940Sstevel@tonic-gate struct jwinsize jwinsize; 10950Sstevel@tonic-gate 10960Sstevel@tonic-gate if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) == 10970Sstevel@tonic-gate sizeof (jwinsize)) { 10980Sstevel@tonic-gate (void) printf( 10997088Sraf "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n", 11007088Sraf pri->pname, 11017088Sraf (unsigned)jwinsize.bytesx, 11027088Sraf (unsigned)jwinsize.bytesy, 11037088Sraf (unsigned)jwinsize.bitsx, 11047088Sraf (unsigned)jwinsize.bitsy); 11050Sstevel@tonic-gate } 11060Sstevel@tonic-gate } 11070Sstevel@tonic-gate 11080Sstevel@tonic-gate void 11090Sstevel@tonic-gate show_winsize(private_t *pri, long offset) 11100Sstevel@tonic-gate { 11110Sstevel@tonic-gate struct winsize winsize; 11120Sstevel@tonic-gate 11130Sstevel@tonic-gate if (Pread(Proc, &winsize, sizeof (winsize), offset) 11140Sstevel@tonic-gate == sizeof (winsize)) { 11150Sstevel@tonic-gate (void) printf( 11167088Sraf "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n", 11177088Sraf pri->pname, 11187088Sraf winsize.ws_row, 11197088Sraf winsize.ws_col, 11207088Sraf winsize.ws_xpixel, 11217088Sraf winsize.ws_ypixel); 11220Sstevel@tonic-gate } 11230Sstevel@tonic-gate } 11240Sstevel@tonic-gate 11250Sstevel@tonic-gate struct audio_stuff { 11260Sstevel@tonic-gate uint_t bit; 11270Sstevel@tonic-gate const char *str; 11280Sstevel@tonic-gate }; 11290Sstevel@tonic-gate 11300Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = { 11310Sstevel@tonic-gate { AUDIO_SPEAKER, "SPEAKER" }, 11320Sstevel@tonic-gate { AUDIO_HEADPHONE, "HEADPHONE" }, 11330Sstevel@tonic-gate { AUDIO_LINE_OUT, "LINE_OUT" }, 11340Sstevel@tonic-gate { AUDIO_SPDIF_OUT, "SPDIF_OUT" }, 11350Sstevel@tonic-gate { AUDIO_AUX1_OUT, "AUX1_OUT" }, 11360Sstevel@tonic-gate { AUDIO_AUX2_OUT, "AUX2_OUT" }, 11370Sstevel@tonic-gate { 0, NULL } 11380Sstevel@tonic-gate }; 11390Sstevel@tonic-gate 11400Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = { 11410Sstevel@tonic-gate { AUDIO_MICROPHONE, "MICROPHONE" }, 11420Sstevel@tonic-gate { AUDIO_LINE_IN, "LINE_IN" }, 11430Sstevel@tonic-gate { AUDIO_CD, "CD" }, 11440Sstevel@tonic-gate { AUDIO_SPDIF_IN, "SPDIF_IN" }, 11450Sstevel@tonic-gate { AUDIO_AUX1_IN, "AUX1_IN" }, 11460Sstevel@tonic-gate { AUDIO_AUX2_IN, "AUX2_IN" }, 11470Sstevel@tonic-gate { AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" }, 11480Sstevel@tonic-gate { AUDIO_SUNVTS, "SUNVTS" }, 11490Sstevel@tonic-gate { 0, NULL } 11500Sstevel@tonic-gate }; 11510Sstevel@tonic-gate 11520Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = { 11530Sstevel@tonic-gate { AUDIO_HWFEATURE_DUPLEX, "DUPLEX" }, 11540Sstevel@tonic-gate { AUDIO_HWFEATURE_MSCODEC, "MSCODEC" }, 11550Sstevel@tonic-gate { AUDIO_HWFEATURE_IN2OUT, "IN2OUT" }, 11560Sstevel@tonic-gate { AUDIO_HWFEATURE_PLAY, "PLAY" }, 11570Sstevel@tonic-gate { AUDIO_HWFEATURE_RECORD, "RECORD" }, 11580Sstevel@tonic-gate { 0, NULL } 11590Sstevel@tonic-gate }; 11600Sstevel@tonic-gate 11610Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = { 11620Sstevel@tonic-gate { AUDIO_SWFEATURE_MIXER, "MIXER" }, 11630Sstevel@tonic-gate { 0, NULL } 11640Sstevel@tonic-gate }; 11650Sstevel@tonic-gate 11660Sstevel@tonic-gate void 11670Sstevel@tonic-gate show_audio_features(const private_t *pri, 11680Sstevel@tonic-gate const struct audio_stuff *audio_porttab, uint_t features, 11690Sstevel@tonic-gate const char *name) 11700Sstevel@tonic-gate { 11710Sstevel@tonic-gate (void) printf("%s\t%s=", pri->pname, name); 11720Sstevel@tonic-gate if (features == 0) { 11730Sstevel@tonic-gate (void) printf("0\n"); 11740Sstevel@tonic-gate return; 11750Sstevel@tonic-gate } 11760Sstevel@tonic-gate 11770Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 11780Sstevel@tonic-gate if (features & audio_porttab->bit) { 11790Sstevel@tonic-gate (void) printf(audio_porttab->str); 11800Sstevel@tonic-gate features &= ~audio_porttab->bit; 11810Sstevel@tonic-gate if (features) 11820Sstevel@tonic-gate (void) putchar('|'); 11830Sstevel@tonic-gate } 11840Sstevel@tonic-gate } 11850Sstevel@tonic-gate if (features) 11860Sstevel@tonic-gate (void) printf("0x%x", features); 11870Sstevel@tonic-gate (void) putchar('\n'); 11880Sstevel@tonic-gate } 11890Sstevel@tonic-gate 11900Sstevel@tonic-gate void 11910Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode, 11920Sstevel@tonic-gate const char *field, uint_t ports) 11930Sstevel@tonic-gate { 11940Sstevel@tonic-gate const struct audio_stuff *audio_porttab; 11950Sstevel@tonic-gate 11960Sstevel@tonic-gate (void) printf("%s\t%s\t%s=", pri->pname, mode, field); 11970Sstevel@tonic-gate if (ports == 0) { 11980Sstevel@tonic-gate (void) printf("0\n"); 11990Sstevel@tonic-gate return; 12000Sstevel@tonic-gate } 12010Sstevel@tonic-gate if (*mode == 'p') 12020Sstevel@tonic-gate audio_porttab = audio_output_ports; 12030Sstevel@tonic-gate else 12040Sstevel@tonic-gate audio_porttab = audio_input_ports; 12050Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 12060Sstevel@tonic-gate if (ports & audio_porttab->bit) { 12070Sstevel@tonic-gate (void) printf(audio_porttab->str); 12080Sstevel@tonic-gate ports &= ~audio_porttab->bit; 12090Sstevel@tonic-gate if (ports) 12100Sstevel@tonic-gate (void) putchar('|'); 12110Sstevel@tonic-gate } 12120Sstevel@tonic-gate } 12130Sstevel@tonic-gate if (ports) 12140Sstevel@tonic-gate (void) printf("0x%x", ports); 12150Sstevel@tonic-gate (void) putchar('\n'); 12160Sstevel@tonic-gate } 12170Sstevel@tonic-gate 12180Sstevel@tonic-gate void 12190Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr) 12200Sstevel@tonic-gate { 12210Sstevel@tonic-gate const char *s; 12220Sstevel@tonic-gate 12230Sstevel@tonic-gate /* 12240Sstevel@tonic-gate * The following values describe the audio data encoding. 12250Sstevel@tonic-gate */ 12260Sstevel@tonic-gate 12270Sstevel@tonic-gate (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n", 12287088Sraf pri->pname, mode, 12297088Sraf au_pr->sample_rate, 12307088Sraf au_pr->channels, 12317088Sraf au_pr->precision); 12320Sstevel@tonic-gate 12330Sstevel@tonic-gate s = NULL; 12340Sstevel@tonic-gate switch (au_pr->encoding) { 12350Sstevel@tonic-gate case AUDIO_ENCODING_NONE: s = "NONE"; break; 12360Sstevel@tonic-gate case AUDIO_ENCODING_ULAW: s = "ULAW"; break; 12370Sstevel@tonic-gate case AUDIO_ENCODING_ALAW: s = "ALAW"; break; 12380Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR: s = "LINEAR"; break; 12390Sstevel@tonic-gate case AUDIO_ENCODING_DVI: s = "DVI"; break; 12400Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR8: s = "LINEAR8"; break; 12410Sstevel@tonic-gate } 12420Sstevel@tonic-gate if (s) 12430Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s); 12440Sstevel@tonic-gate else { 12450Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%u\n", 12467088Sraf pri->pname, mode, au_pr->encoding); 12470Sstevel@tonic-gate } 12480Sstevel@tonic-gate 12490Sstevel@tonic-gate /* 12500Sstevel@tonic-gate * The following values control audio device configuration 12510Sstevel@tonic-gate */ 12520Sstevel@tonic-gate 12530Sstevel@tonic-gate (void) printf( 12547088Sraf "%s\t%s\tgain=%u buffer_size=%u\n", 12557088Sraf pri->pname, mode, 12567088Sraf au_pr->gain, 12577088Sraf au_pr->buffer_size); 12580Sstevel@tonic-gate show_audio_ports(pri, mode, "port", au_pr->port); 12590Sstevel@tonic-gate show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports); 12600Sstevel@tonic-gate show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports); 12610Sstevel@tonic-gate 12620Sstevel@tonic-gate /* 12630Sstevel@tonic-gate * The following values describe driver state 12640Sstevel@tonic-gate */ 12650Sstevel@tonic-gate 12660Sstevel@tonic-gate (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n", 12677088Sraf pri->pname, mode, 12687088Sraf au_pr->samples, 12697088Sraf au_pr->eof, 12707088Sraf au_pr->pause, 12717088Sraf au_pr->error); 12720Sstevel@tonic-gate (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n", 12737088Sraf pri->pname, mode, 12747088Sraf au_pr->waiting, 12757088Sraf au_pr->balance, 12767088Sraf au_pr->minordev); 12770Sstevel@tonic-gate 12780Sstevel@tonic-gate /* 12790Sstevel@tonic-gate * The following values are read-only state flags 12800Sstevel@tonic-gate */ 12810Sstevel@tonic-gate (void) printf("%s\t%s\topen=%u active=%u\n", 12827088Sraf pri->pname, mode, 12837088Sraf au_pr->open, 12847088Sraf au_pr->active); 12850Sstevel@tonic-gate } 12860Sstevel@tonic-gate 12870Sstevel@tonic-gate void 12880Sstevel@tonic-gate show_audio_info(private_t *pri, long offset) 12890Sstevel@tonic-gate { 12900Sstevel@tonic-gate struct audio_info au; 12910Sstevel@tonic-gate 12920Sstevel@tonic-gate if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) { 12930Sstevel@tonic-gate show_audio_prinfo(pri, "play", &au.play); 12940Sstevel@tonic-gate show_audio_prinfo(pri, "record", &au.record); 12950Sstevel@tonic-gate (void) printf("%s\tmonitor_gain=%u output_muted=%u\n", 12967088Sraf pri->pname, au.monitor_gain, au.output_muted); 12970Sstevel@tonic-gate show_audio_features(pri, audio_hw_features, au.hw_features, 12980Sstevel@tonic-gate "hw_features"); 12990Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, au.sw_features, 13000Sstevel@tonic-gate "sw_features"); 13010Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, 13020Sstevel@tonic-gate au.sw_features_enabled, "sw_features_enabled"); 13030Sstevel@tonic-gate } 13040Sstevel@tonic-gate } 13050Sstevel@tonic-gate 13060Sstevel@tonic-gate void 13070Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset) 13080Sstevel@tonic-gate { 13090Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 13100Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 13110Sstevel@tonic-gate /* for a failed system call */ 13120Sstevel@tonic-gate #ifndef _LP64 13130Sstevel@tonic-gate if (lp64) 13140Sstevel@tonic-gate return; 13150Sstevel@tonic-gate #endif 131610440SRoger.Faulkner@Sun.COM if (offset == 0) 13170Sstevel@tonic-gate return; 13180Sstevel@tonic-gate 13190Sstevel@tonic-gate switch (code) { 13200Sstevel@tonic-gate case TCGETA: 13210Sstevel@tonic-gate if (err) 13220Sstevel@tonic-gate break; 13230Sstevel@tonic-gate /*FALLTHROUGH*/ 13240Sstevel@tonic-gate case TCSETA: 13250Sstevel@tonic-gate case TCSETAW: 13260Sstevel@tonic-gate case TCSETAF: 13270Sstevel@tonic-gate show_termio(pri, offset); 13280Sstevel@tonic-gate break; 13290Sstevel@tonic-gate case TCGETS: 13300Sstevel@tonic-gate if (err) 13310Sstevel@tonic-gate break; 13320Sstevel@tonic-gate /*FALLTHROUGH*/ 13330Sstevel@tonic-gate case TCSETS: 13340Sstevel@tonic-gate case TCSETSW: 13350Sstevel@tonic-gate case TCSETSF: 13360Sstevel@tonic-gate show_termios(pri, offset); 13370Sstevel@tonic-gate break; 13380Sstevel@tonic-gate case TCGETX: 13390Sstevel@tonic-gate if (err) 13400Sstevel@tonic-gate break; 13410Sstevel@tonic-gate /*FALLTHROUGH*/ 13420Sstevel@tonic-gate case TCSETX: 13430Sstevel@tonic-gate case TCSETXW: 13440Sstevel@tonic-gate case TCSETXF: 13450Sstevel@tonic-gate show_termiox(pri, offset); 13460Sstevel@tonic-gate break; 13470Sstevel@tonic-gate case TIOCGETP: 13480Sstevel@tonic-gate if (err) 13490Sstevel@tonic-gate break; 13500Sstevel@tonic-gate /*FALLTHROUGH*/ 13510Sstevel@tonic-gate case TIOCSETN: 13520Sstevel@tonic-gate case TIOCSETP: 13530Sstevel@tonic-gate show_sgttyb(pri, offset); 13540Sstevel@tonic-gate break; 13550Sstevel@tonic-gate case TIOCGLTC: 13560Sstevel@tonic-gate if (err) 13570Sstevel@tonic-gate break; 13580Sstevel@tonic-gate /*FALLTHROUGH*/ 13590Sstevel@tonic-gate case TIOCSLTC: 13600Sstevel@tonic-gate show_ltchars(pri, offset); 13610Sstevel@tonic-gate break; 13620Sstevel@tonic-gate case TIOCGETC: 13630Sstevel@tonic-gate if (err) 13640Sstevel@tonic-gate break; 13650Sstevel@tonic-gate /*FALLTHROUGH*/ 13660Sstevel@tonic-gate case TIOCSETC: 13670Sstevel@tonic-gate show_tchars(pri, offset); 13680Sstevel@tonic-gate break; 13690Sstevel@tonic-gate case LDGETT: 13700Sstevel@tonic-gate if (err) 13710Sstevel@tonic-gate break; 13720Sstevel@tonic-gate /*FALLTHROUGH*/ 13730Sstevel@tonic-gate case LDSETT: 13740Sstevel@tonic-gate show_termcb(pri, offset); 13750Sstevel@tonic-gate break; 13760Sstevel@tonic-gate /* streams ioctl()s */ 13770Sstevel@tonic-gate #if 0 13780Sstevel@tonic-gate /* these are displayed as strings in the arg list */ 13790Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13800Sstevel@tonic-gate case I_PUSH: 13810Sstevel@tonic-gate case I_LOOK: 13820Sstevel@tonic-gate case I_FIND: 13830Sstevel@tonic-gate /* these are displayed as decimal in the arg list */ 13840Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13850Sstevel@tonic-gate case I_LINK: 13860Sstevel@tonic-gate case I_UNLINK: 13870Sstevel@tonic-gate case I_SENDFD: 13880Sstevel@tonic-gate /* these are displayed symbolically in the arg list */ 13890Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13900Sstevel@tonic-gate case I_SRDOPT: 13910Sstevel@tonic-gate case I_SETSIG: 13920Sstevel@tonic-gate case I_FLUSH: 13930Sstevel@tonic-gate break; 13940Sstevel@tonic-gate /* this one just ignores the argument */ 13950Sstevel@tonic-gate case I_POP: 13960Sstevel@tonic-gate break; 13970Sstevel@tonic-gate #endif 13980Sstevel@tonic-gate /* these return something in an int pointed to by arg */ 13990Sstevel@tonic-gate case I_NREAD: 14000Sstevel@tonic-gate case I_GRDOPT: 14010Sstevel@tonic-gate case I_GETSIG: 14020Sstevel@tonic-gate case TIOCGSID: 14030Sstevel@tonic-gate case TIOCGPGRP: 14040Sstevel@tonic-gate case TIOCLGET: 14050Sstevel@tonic-gate case FIONREAD: 14060Sstevel@tonic-gate case FIORDCHK: 14070Sstevel@tonic-gate if (err) 14080Sstevel@tonic-gate break; 14090Sstevel@tonic-gate /*FALLTHROUGH*/ 14100Sstevel@tonic-gate /* these pass something in an int pointed to by arg */ 14110Sstevel@tonic-gate case TIOCSPGRP: 14120Sstevel@tonic-gate case TIOCFLUSH: 14130Sstevel@tonic-gate case TIOCLBIS: 14140Sstevel@tonic-gate case TIOCLBIC: 14150Sstevel@tonic-gate case TIOCLSET: 14160Sstevel@tonic-gate show_strint(pri, code, offset); 14170Sstevel@tonic-gate break; 14180Sstevel@tonic-gate /* these all point to structures */ 14190Sstevel@tonic-gate case I_STR: 14200Sstevel@tonic-gate #ifdef _LP64 14210Sstevel@tonic-gate if (lp64) 14220Sstevel@tonic-gate show_strioctl(pri, offset); 14230Sstevel@tonic-gate else 14240Sstevel@tonic-gate show_strioctl32(pri, offset); 14250Sstevel@tonic-gate #else 14260Sstevel@tonic-gate show_strioctl(pri, offset); 14270Sstevel@tonic-gate #endif 14280Sstevel@tonic-gate break; 14290Sstevel@tonic-gate case I_PEEK: 14300Sstevel@tonic-gate #ifdef _LP64 14310Sstevel@tonic-gate if (lp64) 14320Sstevel@tonic-gate show_strpeek(pri, offset); 14330Sstevel@tonic-gate else 14340Sstevel@tonic-gate show_strpeek32(pri, offset); 14350Sstevel@tonic-gate #else 14360Sstevel@tonic-gate show_strpeek(pri, offset); 14370Sstevel@tonic-gate #endif 14380Sstevel@tonic-gate break; 14390Sstevel@tonic-gate case I_FDINSERT: 14400Sstevel@tonic-gate #ifdef _LP64 14410Sstevel@tonic-gate if (lp64) 14420Sstevel@tonic-gate show_strfdinsert(pri, offset); 14430Sstevel@tonic-gate else 14440Sstevel@tonic-gate show_strfdinsert32(pri, offset); 14450Sstevel@tonic-gate #else 14460Sstevel@tonic-gate show_strfdinsert(pri, offset); 14470Sstevel@tonic-gate #endif 14480Sstevel@tonic-gate break; 14490Sstevel@tonic-gate case I_RECVFD: 14500Sstevel@tonic-gate if (err) 14510Sstevel@tonic-gate break; 14520Sstevel@tonic-gate show_strrecvfd(pri, offset); 14530Sstevel@tonic-gate break; 14540Sstevel@tonic-gate case I_LIST: 14550Sstevel@tonic-gate if (err) 14560Sstevel@tonic-gate break; 14570Sstevel@tonic-gate #ifdef _LP64 14580Sstevel@tonic-gate if (lp64) 14590Sstevel@tonic-gate show_strlist(pri, offset); 14600Sstevel@tonic-gate else 14610Sstevel@tonic-gate show_strlist32(pri, offset); 14620Sstevel@tonic-gate #else 14630Sstevel@tonic-gate show_strlist(pri, offset); 14640Sstevel@tonic-gate #endif 14650Sstevel@tonic-gate break; 14660Sstevel@tonic-gate case JWINSIZE: 14670Sstevel@tonic-gate if (err) 14680Sstevel@tonic-gate break; 14690Sstevel@tonic-gate show_jwinsize(pri, offset); 14700Sstevel@tonic-gate break; 14710Sstevel@tonic-gate case TIOCGWINSZ: 14720Sstevel@tonic-gate if (err) 14730Sstevel@tonic-gate break; 14740Sstevel@tonic-gate /*FALLTHROUGH*/ 14750Sstevel@tonic-gate case TIOCSWINSZ: 14760Sstevel@tonic-gate show_winsize(pri, offset); 14770Sstevel@tonic-gate break; 14780Sstevel@tonic-gate case AUDIO_GETINFO: 14790Sstevel@tonic-gate case (int)AUDIO_SETINFO: 14800Sstevel@tonic-gate show_audio_info(pri, offset); 14810Sstevel@tonic-gate break; 14820Sstevel@tonic-gate 14830Sstevel@tonic-gate default: 14840Sstevel@tonic-gate if (code & IOC_INOUT) { 14850Sstevel@tonic-gate const char *str = ioctldatastruct(code); 14860Sstevel@tonic-gate 14870Sstevel@tonic-gate (void) printf("\t\t%s", 14880Sstevel@tonic-gate (code & IOC_INOUT) == IOC_INOUT ? "write/read" : 14890Sstevel@tonic-gate code & IOC_IN ? "write" : "read"); 14900Sstevel@tonic-gate if (str != NULL) { 14910Sstevel@tonic-gate (void) printf(" (struct %s)\n", str); 14920Sstevel@tonic-gate } else { 14930Sstevel@tonic-gate (void) printf(" %d bytes\n", 14940Sstevel@tonic-gate (code >> 16) & IOCPARM_MASK); 14950Sstevel@tonic-gate } 14960Sstevel@tonic-gate } 14970Sstevel@tonic-gate } 14980Sstevel@tonic-gate } 14990Sstevel@tonic-gate 15000Sstevel@tonic-gate void 15010Sstevel@tonic-gate show_statvfs(private_t *pri) 15020Sstevel@tonic-gate { 15030Sstevel@tonic-gate long offset; 15040Sstevel@tonic-gate struct statvfs statvfs; 15050Sstevel@tonic-gate char *cp; 15060Sstevel@tonic-gate 15070Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15080Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15090Sstevel@tonic-gate == sizeof (statvfs)) { 15100Sstevel@tonic-gate (void) printf( 15110Sstevel@tonic-gate "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n", 15127088Sraf pri->pname, 15137088Sraf statvfs.f_bsize, 15147088Sraf statvfs.f_frsize, 15157088Sraf (u_longlong_t)statvfs.f_blocks, 15167088Sraf (u_longlong_t)statvfs.f_bfree); 15170Sstevel@tonic-gate (void) printf( 15180Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 15197088Sraf pri->pname, 15207088Sraf (u_longlong_t)statvfs.f_bavail, 15217088Sraf (u_longlong_t)statvfs.f_files, 15227088Sraf (u_longlong_t)statvfs.f_ffree, 15237088Sraf (u_longlong_t)statvfs.f_favail); 15240Sstevel@tonic-gate (void) printf( 15257088Sraf "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n", 15267088Sraf pri->pname, 15277088Sraf statvfs.f_fsid, 15287088Sraf statvfs.f_basetype, 15297088Sraf (long)statvfs.f_namemax); 15300Sstevel@tonic-gate (void) printf( 15317088Sraf "%s\tflag=%s\n", 15327088Sraf pri->pname, 15337088Sraf svfsflags(pri, (ulong_t)statvfs.f_flag)); 15340Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15350Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15360Sstevel@tonic-gate *(cp+1) != '\0') 15370Sstevel@tonic-gate *cp = ' '; 15380Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15397088Sraf pri->pname, 15407088Sraf (int)sizeof (statvfs.f_fstr), 15417088Sraf statvfs.f_fstr); 15420Sstevel@tonic-gate } 15430Sstevel@tonic-gate } 15440Sstevel@tonic-gate 15450Sstevel@tonic-gate #ifdef _LP64 15460Sstevel@tonic-gate void 15470Sstevel@tonic-gate show_statvfs32(private_t *pri) 15480Sstevel@tonic-gate { 15490Sstevel@tonic-gate long offset; 15500Sstevel@tonic-gate struct statvfs32 statvfs; 15510Sstevel@tonic-gate char *cp; 15520Sstevel@tonic-gate 15530Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15540Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15550Sstevel@tonic-gate == sizeof (statvfs)) { 15560Sstevel@tonic-gate (void) printf( 15577088Sraf "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n", 15587088Sraf pri->pname, 15597088Sraf statvfs.f_bsize, 15607088Sraf statvfs.f_frsize, 15617088Sraf statvfs.f_blocks, 15627088Sraf statvfs.f_bfree); 15630Sstevel@tonic-gate (void) printf( 15647088Sraf "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n", 15657088Sraf pri->pname, 15667088Sraf statvfs.f_bavail, 15677088Sraf statvfs.f_files, 15687088Sraf statvfs.f_ffree, 15697088Sraf statvfs.f_favail); 15700Sstevel@tonic-gate (void) printf( 15717088Sraf "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 15727088Sraf pri->pname, 15737088Sraf statvfs.f_fsid, 15747088Sraf statvfs.f_basetype, 15757088Sraf (int)statvfs.f_namemax); 15760Sstevel@tonic-gate (void) printf( 15777088Sraf "%s\tflag=%s\n", 15787088Sraf pri->pname, 15797088Sraf svfsflags(pri, (ulong_t)statvfs.f_flag)); 15800Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15810Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15820Sstevel@tonic-gate *(cp+1) != '\0') 15830Sstevel@tonic-gate *cp = ' '; 15840Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15857088Sraf pri->pname, 15867088Sraf (int)sizeof (statvfs.f_fstr), 15877088Sraf statvfs.f_fstr); 15880Sstevel@tonic-gate } 15890Sstevel@tonic-gate } 15900Sstevel@tonic-gate #endif /* _LP64 */ 15910Sstevel@tonic-gate 15920Sstevel@tonic-gate void 15930Sstevel@tonic-gate show_statvfs64(private_t *pri) 15940Sstevel@tonic-gate { 15950Sstevel@tonic-gate long offset; 15960Sstevel@tonic-gate struct statvfs64_32 statvfs; 15970Sstevel@tonic-gate char *cp; 15980Sstevel@tonic-gate 15990Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 16000Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 16010Sstevel@tonic-gate == sizeof (statvfs)) { 16020Sstevel@tonic-gate (void) printf( 16037088Sraf "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n", 16047088Sraf pri->pname, 16057088Sraf statvfs.f_bsize, 16067088Sraf statvfs.f_frsize, 16077088Sraf (u_longlong_t)statvfs.f_blocks, 16087088Sraf (u_longlong_t)statvfs.f_bfree); 16090Sstevel@tonic-gate (void) printf( 16100Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 16117088Sraf pri->pname, 16127088Sraf (u_longlong_t)statvfs.f_bavail, 16137088Sraf (u_longlong_t)statvfs.f_files, 16147088Sraf (u_longlong_t)statvfs.f_ffree, 16157088Sraf (u_longlong_t)statvfs.f_favail); 16160Sstevel@tonic-gate (void) printf( 16177088Sraf "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 16187088Sraf pri->pname, 16197088Sraf statvfs.f_fsid, 16207088Sraf statvfs.f_basetype, 16217088Sraf (int)statvfs.f_namemax); 16220Sstevel@tonic-gate (void) printf( 16237088Sraf "%s\tflag=%s\n", 16247088Sraf pri->pname, 16257088Sraf svfsflags(pri, (ulong_t)statvfs.f_flag)); 16260Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 16270Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 16280Sstevel@tonic-gate *(cp+1) != '\0') 16290Sstevel@tonic-gate *cp = ' '; 16300Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 16317088Sraf pri->pname, 16327088Sraf (int)sizeof (statvfs.f_fstr), 16337088Sraf statvfs.f_fstr); 16340Sstevel@tonic-gate } 16350Sstevel@tonic-gate } 16360Sstevel@tonic-gate 16370Sstevel@tonic-gate void 16380Sstevel@tonic-gate show_statfs(private_t *pri) 16390Sstevel@tonic-gate { 16400Sstevel@tonic-gate long offset; 16410Sstevel@tonic-gate struct statfs statfs; 16420Sstevel@tonic-gate 16430Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16440Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16450Sstevel@tonic-gate (void) printf( 16460Sstevel@tonic-gate "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n", 16477088Sraf pri->pname, 16487088Sraf statfs.f_fstyp, 16497088Sraf statfs.f_bsize, 16507088Sraf statfs.f_frsize, 16517088Sraf statfs.f_blocks, 16527088Sraf statfs.f_bfree, 16537088Sraf statfs.f_files, 16547088Sraf statfs.f_ffree); 16550Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16567088Sraf pri->pname, 16577088Sraf statfs.f_fname, 16587088Sraf statfs.f_fpack); 16590Sstevel@tonic-gate } 16600Sstevel@tonic-gate } 16610Sstevel@tonic-gate 16620Sstevel@tonic-gate #ifdef _LP64 16630Sstevel@tonic-gate void 16640Sstevel@tonic-gate show_statfs32(private_t *pri) 16650Sstevel@tonic-gate { 16660Sstevel@tonic-gate long offset; 16670Sstevel@tonic-gate struct statfs32 statfs; 16680Sstevel@tonic-gate 16690Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16700Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16710Sstevel@tonic-gate (void) printf( 16727088Sraf "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n", 16737088Sraf pri->pname, 16747088Sraf statfs.f_fstyp, 16757088Sraf statfs.f_bsize, 16767088Sraf statfs.f_frsize, 16777088Sraf statfs.f_blocks, 16787088Sraf statfs.f_bfree, 16797088Sraf statfs.f_files, 16807088Sraf statfs.f_ffree); 16810Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16827088Sraf pri->pname, 16837088Sraf statfs.f_fname, 16847088Sraf statfs.f_fpack); 16850Sstevel@tonic-gate } 16860Sstevel@tonic-gate } 16870Sstevel@tonic-gate #endif /* _LP64 */ 16880Sstevel@tonic-gate 16890Sstevel@tonic-gate void 16900Sstevel@tonic-gate show_flock32(private_t *pri, long offset) 16910Sstevel@tonic-gate { 16920Sstevel@tonic-gate struct flock32 flock; 16930Sstevel@tonic-gate 16940Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 16950Sstevel@tonic-gate const char *str = NULL; 16960Sstevel@tonic-gate 16970Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 16980Sstevel@tonic-gate 16990Sstevel@tonic-gate switch (flock.l_type) { 17000Sstevel@tonic-gate case F_RDLCK: 17010Sstevel@tonic-gate str = "F_RDLCK"; 17020Sstevel@tonic-gate break; 17030Sstevel@tonic-gate case F_WRLCK: 17040Sstevel@tonic-gate str = "F_WRLCK"; 17050Sstevel@tonic-gate break; 17060Sstevel@tonic-gate case F_UNLCK: 17070Sstevel@tonic-gate str = "F_UNLCK"; 17080Sstevel@tonic-gate break; 17090Sstevel@tonic-gate } 17100Sstevel@tonic-gate if (str != NULL) 17110Sstevel@tonic-gate (void) printf("%s", str); 17120Sstevel@tonic-gate else 17130Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17140Sstevel@tonic-gate 17150Sstevel@tonic-gate str = whencearg(flock.l_whence); 17160Sstevel@tonic-gate if (str != NULL) 17170Sstevel@tonic-gate (void) printf(" whence=%s", str); 17180Sstevel@tonic-gate else 17190Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17200Sstevel@tonic-gate 17210Sstevel@tonic-gate (void) printf( 17227088Sraf " start=%-5d len=%-5d sys=%-2u pid=%d\n", 17237088Sraf flock.l_start, 17247088Sraf flock.l_len, 17257088Sraf flock.l_sysid, 17267088Sraf flock.l_pid); 17270Sstevel@tonic-gate } 17280Sstevel@tonic-gate } 17290Sstevel@tonic-gate 17300Sstevel@tonic-gate void 17310Sstevel@tonic-gate show_flock64(private_t *pri, long offset) 17320Sstevel@tonic-gate { 17330Sstevel@tonic-gate struct flock64 flock; 17340Sstevel@tonic-gate 17350Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 17360Sstevel@tonic-gate const char *str = NULL; 17370Sstevel@tonic-gate 17380Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 17390Sstevel@tonic-gate 17400Sstevel@tonic-gate switch (flock.l_type) { 17410Sstevel@tonic-gate case F_RDLCK: 17420Sstevel@tonic-gate str = "F_RDLCK"; 17430Sstevel@tonic-gate break; 17440Sstevel@tonic-gate case F_WRLCK: 17450Sstevel@tonic-gate str = "F_WRLCK"; 17460Sstevel@tonic-gate break; 17470Sstevel@tonic-gate case F_UNLCK: 17480Sstevel@tonic-gate str = "F_UNLCK"; 17490Sstevel@tonic-gate break; 17500Sstevel@tonic-gate } 17510Sstevel@tonic-gate if (str != NULL) 17520Sstevel@tonic-gate (void) printf("%s", str); 17530Sstevel@tonic-gate else 17540Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17550Sstevel@tonic-gate 17560Sstevel@tonic-gate str = whencearg(flock.l_whence); 17570Sstevel@tonic-gate if (str != NULL) 17580Sstevel@tonic-gate (void) printf(" whence=%s", str); 17590Sstevel@tonic-gate else 17600Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17610Sstevel@tonic-gate 17620Sstevel@tonic-gate (void) printf( 17637088Sraf " start=%-5lld len=%-5lld sys=%-2u pid=%d\n", 17647088Sraf (long long)flock.l_start, 17657088Sraf (long long)flock.l_len, 17667088Sraf flock.l_sysid, 17677088Sraf (int)flock.l_pid); 17680Sstevel@tonic-gate } 17690Sstevel@tonic-gate } 17700Sstevel@tonic-gate 17710Sstevel@tonic-gate void 17720Sstevel@tonic-gate show_share(private_t *pri, long offset) 17730Sstevel@tonic-gate { 17740Sstevel@tonic-gate struct fshare fshare; 17750Sstevel@tonic-gate 17760Sstevel@tonic-gate if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) { 17770Sstevel@tonic-gate const char *str = NULL; 17780Sstevel@tonic-gate int manddny = 0; 17790Sstevel@tonic-gate 17800Sstevel@tonic-gate (void) printf("%s\taccess=", pri->pname); 17810Sstevel@tonic-gate 17820Sstevel@tonic-gate switch (fshare.f_access) { 17830Sstevel@tonic-gate case F_RDACC: 17840Sstevel@tonic-gate str = "F_RDACC"; 17850Sstevel@tonic-gate break; 17860Sstevel@tonic-gate case F_WRACC: 17870Sstevel@tonic-gate str = "F_WRACC"; 17880Sstevel@tonic-gate break; 17890Sstevel@tonic-gate case F_RWACC: 17900Sstevel@tonic-gate str = "F_RWACC"; 17910Sstevel@tonic-gate break; 17920Sstevel@tonic-gate } 17930Sstevel@tonic-gate if (str != NULL) 17940Sstevel@tonic-gate (void) printf("%s", str); 17950Sstevel@tonic-gate else 17960Sstevel@tonic-gate (void) printf("%-7d", fshare.f_access); 17970Sstevel@tonic-gate 17980Sstevel@tonic-gate str = NULL; 17990Sstevel@tonic-gate if (fshare.f_deny & F_MANDDNY) { 18000Sstevel@tonic-gate fshare.f_deny &= ~F_MANDDNY; 18010Sstevel@tonic-gate manddny = 1; 18020Sstevel@tonic-gate } 18030Sstevel@tonic-gate switch (fshare.f_deny) { 18040Sstevel@tonic-gate case F_NODNY: 18050Sstevel@tonic-gate str = "F_NODNY"; 18060Sstevel@tonic-gate break; 18070Sstevel@tonic-gate case F_RDDNY: 18080Sstevel@tonic-gate str = "F_RDDNY"; 18090Sstevel@tonic-gate break; 18100Sstevel@tonic-gate case F_WRDNY: 18110Sstevel@tonic-gate str = "F_WRDNY"; 18120Sstevel@tonic-gate break; 18130Sstevel@tonic-gate case F_RWDNY: 18140Sstevel@tonic-gate str = "F_RWDNY"; 18150Sstevel@tonic-gate break; 18160Sstevel@tonic-gate case F_COMPAT: 18170Sstevel@tonic-gate str = "F_COMPAT"; 18180Sstevel@tonic-gate break; 18190Sstevel@tonic-gate } 18200Sstevel@tonic-gate if (str != NULL) { 18210Sstevel@tonic-gate if (manddny) 18220Sstevel@tonic-gate (void) printf(" deny=F_MANDDNY|%s", str); 18230Sstevel@tonic-gate else 18240Sstevel@tonic-gate (void) printf(" deny=%s", str); 18250Sstevel@tonic-gate } else { 18260Sstevel@tonic-gate (void) printf(" deny=0x%x", manddny? 18277088Sraf fshare.f_deny | F_MANDDNY : fshare.f_deny); 18280Sstevel@tonic-gate } 18290Sstevel@tonic-gate 18300Sstevel@tonic-gate (void) printf(" id=%x\n", fshare.f_id); 18310Sstevel@tonic-gate } 18320Sstevel@tonic-gate } 18330Sstevel@tonic-gate 18340Sstevel@tonic-gate void 18350Sstevel@tonic-gate show_ffg(private_t *pri) 18360Sstevel@tonic-gate { 18370Sstevel@tonic-gate (void) putchar('\t'); 18380Sstevel@tonic-gate (void) putchar('\t'); 18390Sstevel@tonic-gate prt_ffg(pri, 0, pri->Rval1); 18400Sstevel@tonic-gate (void) puts(pri->sys_string); 18410Sstevel@tonic-gate } 18420Sstevel@tonic-gate 18430Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */ 18440Sstevel@tonic-gate void 18450Sstevel@tonic-gate show_fcntl(private_t *pri) 18460Sstevel@tonic-gate { 18470Sstevel@tonic-gate long offset; 18480Sstevel@tonic-gate 18490Sstevel@tonic-gate if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) { 18500Sstevel@tonic-gate show_ffg(pri); 18510Sstevel@tonic-gate return; 18520Sstevel@tonic-gate } 18530Sstevel@tonic-gate 18540Sstevel@tonic-gate if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == NULL) 18550Sstevel@tonic-gate return; 18560Sstevel@tonic-gate 18570Sstevel@tonic-gate switch (pri->sys_args[1]) { 18580Sstevel@tonic-gate #ifdef _LP64 18590Sstevel@tonic-gate case F_GETLK: 18600Sstevel@tonic-gate case F_SETLK: 18610Sstevel@tonic-gate case F_SETLKW: 18620Sstevel@tonic-gate case F_FREESP: 18630Sstevel@tonic-gate case F_ALLOCSP: 18640Sstevel@tonic-gate case F_SETLK_NBMAND: 18650Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 18660Sstevel@tonic-gate show_flock64(pri, offset); 18670Sstevel@tonic-gate else 18680Sstevel@tonic-gate show_flock32(pri, offset); 18690Sstevel@tonic-gate break; 18700Sstevel@tonic-gate case 33: /* F_GETLK64 */ 18710Sstevel@tonic-gate case 34: /* F_SETLK64 */ 18720Sstevel@tonic-gate case 35: /* F_SETLKW64 */ 18730Sstevel@tonic-gate case 27: /* F_FREESP64 */ 18747088Sraf case 28: /* F_ALLOCSP64 */ 18750Sstevel@tonic-gate case 44: /* F_SETLK64_NBMAND */ 18760Sstevel@tonic-gate show_flock64(pri, offset); 18770Sstevel@tonic-gate break; 18780Sstevel@tonic-gate #else /* _LP64 */ 18790Sstevel@tonic-gate case F_GETLK: 18800Sstevel@tonic-gate case F_SETLK: 18810Sstevel@tonic-gate case F_SETLKW: 18820Sstevel@tonic-gate case F_FREESP: 18830Sstevel@tonic-gate case F_ALLOCSP: 18840Sstevel@tonic-gate case F_SETLK_NBMAND: 18850Sstevel@tonic-gate show_flock32(pri, offset); 18860Sstevel@tonic-gate break; 18870Sstevel@tonic-gate case F_GETLK64: 18880Sstevel@tonic-gate case F_SETLK64: 18890Sstevel@tonic-gate case F_SETLKW64: 18900Sstevel@tonic-gate case F_FREESP64: 18917088Sraf case F_ALLOCSP64: 18920Sstevel@tonic-gate case F_SETLK64_NBMAND: 18930Sstevel@tonic-gate show_flock64(pri, offset); 18940Sstevel@tonic-gate break; 18950Sstevel@tonic-gate #endif /* _LP64 */ 18960Sstevel@tonic-gate case F_SHARE: 18970Sstevel@tonic-gate case F_UNSHARE: 18980Sstevel@tonic-gate show_share(pri, offset); 18990Sstevel@tonic-gate break; 19000Sstevel@tonic-gate } 19010Sstevel@tonic-gate } 19020Sstevel@tonic-gate 19030Sstevel@tonic-gate void 19040Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump) 19050Sstevel@tonic-gate { 19060Sstevel@tonic-gate struct strbuf strbuf; 19070Sstevel@tonic-gate 19080Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 19090Sstevel@tonic-gate print_strbuf(pri, &strbuf, name, dump); 19100Sstevel@tonic-gate } 19110Sstevel@tonic-gate 19120Sstevel@tonic-gate #ifdef _LP64 19130Sstevel@tonic-gate void 19140Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump) 19150Sstevel@tonic-gate { 19160Sstevel@tonic-gate struct strbuf32 strbuf; 19170Sstevel@tonic-gate 19180Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 19190Sstevel@tonic-gate print_strbuf32(pri, &strbuf, name, dump); 19200Sstevel@tonic-gate } 19210Sstevel@tonic-gate #endif /* _LP64 */ 19220Sstevel@tonic-gate 19230Sstevel@tonic-gate void 19240Sstevel@tonic-gate show_gp_msg(private_t *pri, int what) 19250Sstevel@tonic-gate { 19260Sstevel@tonic-gate long offset; 19270Sstevel@tonic-gate int dump = FALSE; 19280Sstevel@tonic-gate int fdp1 = pri->sys_args[0] + 1; 19290Sstevel@tonic-gate 19300Sstevel@tonic-gate switch (what) { 19310Sstevel@tonic-gate case SYS_getmsg: 19320Sstevel@tonic-gate case SYS_getpmsg: 19330Sstevel@tonic-gate if (pri->Errno == 0 && prismember(&readfd, fdp1)) 19340Sstevel@tonic-gate dump = TRUE; 19350Sstevel@tonic-gate break; 19360Sstevel@tonic-gate case SYS_putmsg: 19370Sstevel@tonic-gate case SYS_putpmsg: 19380Sstevel@tonic-gate if (prismember(&writefd, fdp1)) 19390Sstevel@tonic-gate dump = TRUE; 19400Sstevel@tonic-gate break; 19410Sstevel@tonic-gate } 19420Sstevel@tonic-gate 19430Sstevel@tonic-gate /* enter region of lengthy output */ 19440Sstevel@tonic-gate if (dump) 19450Sstevel@tonic-gate Eserialize(); 19460Sstevel@tonic-gate 19470Sstevel@tonic-gate #ifdef _LP64 19480Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) { 19490Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19500Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19510Sstevel@tonic-gate else 19520Sstevel@tonic-gate show_strbuf32(pri, offset, "ctl", dump); 19530Sstevel@tonic-gate } 19540Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) { 19550Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19560Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19570Sstevel@tonic-gate else 19580Sstevel@tonic-gate show_strbuf32(pri, offset, "dat", dump); 19590Sstevel@tonic-gate } 19600Sstevel@tonic-gate #else /* _LP64 */ 19610Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) 19620Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19630Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) 19640Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19650Sstevel@tonic-gate #endif /* _LP64 */ 19660Sstevel@tonic-gate 19670Sstevel@tonic-gate /* exit region of lengthy output */ 19680Sstevel@tonic-gate if (dump) 19690Sstevel@tonic-gate Xserialize(); 19700Sstevel@tonic-gate } 19710Sstevel@tonic-gate 19720Sstevel@tonic-gate void 19730Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name) 19740Sstevel@tonic-gate { 19750Sstevel@tonic-gate int value; 19760Sstevel@tonic-gate 19770Sstevel@tonic-gate if (offset != 0 && 19780Sstevel@tonic-gate Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19790Sstevel@tonic-gate (void) printf("%s\t%s:\t%d\n", 19807088Sraf pri->pname, 19817088Sraf name, 19827088Sraf value); 19830Sstevel@tonic-gate } 19840Sstevel@tonic-gate 19850Sstevel@tonic-gate void 19860Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name) 19870Sstevel@tonic-gate { 19880Sstevel@tonic-gate int value; 19890Sstevel@tonic-gate 19900Sstevel@tonic-gate if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19910Sstevel@tonic-gate (void) printf("%s\t%s:\t0x%.4X\n", 19927088Sraf pri->pname, 19937088Sraf name, 19947088Sraf value); 19950Sstevel@tonic-gate } 19960Sstevel@tonic-gate 19970Sstevel@tonic-gate #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \ 19980Sstevel@tonic-gate POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) 19990Sstevel@tonic-gate 20000Sstevel@tonic-gate const char * 20010Sstevel@tonic-gate pollevent(private_t *pri, int arg) 20020Sstevel@tonic-gate { 20030Sstevel@tonic-gate char *str = pri->code_buf; 20040Sstevel@tonic-gate 20050Sstevel@tonic-gate if (arg == 0) 20060Sstevel@tonic-gate return ("0"); 20070Sstevel@tonic-gate if (arg & ~ALL_POLL_FLAGS) { 20080Sstevel@tonic-gate (void) sprintf(str, "0x%-5X", arg); 20090Sstevel@tonic-gate return ((const char *)str); 20100Sstevel@tonic-gate } 20110Sstevel@tonic-gate 20120Sstevel@tonic-gate *str = '\0'; 20130Sstevel@tonic-gate if (arg & POLLIN) 20140Sstevel@tonic-gate (void) strcat(str, "|POLLIN"); 20150Sstevel@tonic-gate if (arg & POLLPRI) 20160Sstevel@tonic-gate (void) strcat(str, "|POLLPRI"); 20170Sstevel@tonic-gate if (arg & POLLOUT) 20180Sstevel@tonic-gate (void) strcat(str, "|POLLOUT"); 20190Sstevel@tonic-gate if (arg & POLLRDNORM) 20200Sstevel@tonic-gate (void) strcat(str, "|POLLRDNORM"); 20210Sstevel@tonic-gate if (arg & POLLRDBAND) 20220Sstevel@tonic-gate (void) strcat(str, "|POLLRDBAND"); 20230Sstevel@tonic-gate if (arg & POLLWRBAND) 20240Sstevel@tonic-gate (void) strcat(str, "|POLLWRBAND"); 20250Sstevel@tonic-gate if (arg & POLLERR) 20260Sstevel@tonic-gate (void) strcat(str, "|POLLERR"); 20270Sstevel@tonic-gate if (arg & POLLHUP) 20280Sstevel@tonic-gate (void) strcat(str, "|POLLHUP"); 20290Sstevel@tonic-gate if (arg & POLLNVAL) 20300Sstevel@tonic-gate (void) strcat(str, "|POLLNVAL"); 20310Sstevel@tonic-gate 20320Sstevel@tonic-gate return ((const char *)(str+1)); 20330Sstevel@tonic-gate } 20340Sstevel@tonic-gate 20350Sstevel@tonic-gate static void 20360Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd) 20370Sstevel@tonic-gate { 20380Sstevel@tonic-gate /* 20390Sstevel@tonic-gate * can't print both events and revents in same printf. 20400Sstevel@tonic-gate * pollevent() returns a pointer to a TSD location. 20410Sstevel@tonic-gate */ 20420Sstevel@tonic-gate (void) printf("%s\tfd=%-2d ev=%s", 20430Sstevel@tonic-gate pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events)); 20440Sstevel@tonic-gate (void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents)); 20450Sstevel@tonic-gate } 20460Sstevel@tonic-gate 20470Sstevel@tonic-gate static void 20480Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds) 20490Sstevel@tonic-gate { 20500Sstevel@tonic-gate struct pollfd pollfd[2]; 20510Sstevel@tonic-gate int skip = -1; 20520Sstevel@tonic-gate 20530Sstevel@tonic-gate for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) { 20540Sstevel@tonic-gate if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) != 20550Sstevel@tonic-gate sizeof (struct pollfd)) 20560Sstevel@tonic-gate continue; 20570Sstevel@tonic-gate 20580Sstevel@tonic-gate if (skip >= 0 && pollfd[0].fd == pollfd[1].fd && 20590Sstevel@tonic-gate pollfd[0].events == pollfd[1].events && 20600Sstevel@tonic-gate pollfd[0].revents == pollfd[1].revents) { 20610Sstevel@tonic-gate skip++; 20620Sstevel@tonic-gate continue; 20630Sstevel@tonic-gate } 20640Sstevel@tonic-gate 20650Sstevel@tonic-gate if (skip > 0) 20660Sstevel@tonic-gate (void) printf("%s\t...last pollfd structure" 20670Sstevel@tonic-gate " repeated %d time%s...\n", 20680Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20690Sstevel@tonic-gate 20700Sstevel@tonic-gate skip = 0; 20710Sstevel@tonic-gate show_one_pollfd(pri, &pollfd[0]); 20720Sstevel@tonic-gate pollfd[1] = pollfd[0]; 20730Sstevel@tonic-gate } 20740Sstevel@tonic-gate 20750Sstevel@tonic-gate if (skip > 0) 20760Sstevel@tonic-gate (void) printf( 20770Sstevel@tonic-gate "%s\t...last pollfd structure repeated %d time%s...\n", 20780Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20790Sstevel@tonic-gate } 20800Sstevel@tonic-gate 20810Sstevel@tonic-gate void 20820Sstevel@tonic-gate show_pollsys(private_t *pri) 20830Sstevel@tonic-gate { 20840Sstevel@tonic-gate long offset; 20850Sstevel@tonic-gate int nfds; 20860Sstevel@tonic-gate int serial = 0; 20870Sstevel@tonic-gate 20880Sstevel@tonic-gate if (pri->sys_nargs < 2) 20890Sstevel@tonic-gate return; 20900Sstevel@tonic-gate 20910Sstevel@tonic-gate offset = pri->sys_args[0]; 20920Sstevel@tonic-gate nfds = pri->sys_args[1]; 20930Sstevel@tonic-gate 20940Sstevel@tonic-gate /* enter region of lengthy output */ 20950Sstevel@tonic-gate if (offset != NULL && nfds > 32) { 20960Sstevel@tonic-gate Eserialize(); 20970Sstevel@tonic-gate serial = 1; 20980Sstevel@tonic-gate } 20990Sstevel@tonic-gate 21000Sstevel@tonic-gate if (offset != NULL && nfds > 0) 21010Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds); 21020Sstevel@tonic-gate 21030Sstevel@tonic-gate if (pri->sys_nargs > 2) 21040Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 21050Sstevel@tonic-gate 21060Sstevel@tonic-gate if (pri->sys_nargs > 3) 21070Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[3], "sigmask"); 21080Sstevel@tonic-gate 21090Sstevel@tonic-gate /* exit region of lengthy output */ 21100Sstevel@tonic-gate if (serial) 21110Sstevel@tonic-gate Xserialize(); 21120Sstevel@tonic-gate } 21130Sstevel@tonic-gate 21140Sstevel@tonic-gate static void 21150Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip) 21160Sstevel@tonic-gate { 21174321Scasper (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d " 21180Sstevel@tonic-gate "m=0%.6o key=%d projid=%-5d\n", 21190Sstevel@tonic-gate pri->pname, 21204321Scasper ip->ipcx_uid, 21214321Scasper ip->ipcx_gid, 21224321Scasper ip->ipcx_cuid, 21234321Scasper ip->ipcx_cgid, 21240Sstevel@tonic-gate (int)ip->ipcx_zoneid, 21250Sstevel@tonic-gate (unsigned int)ip->ipcx_mode, 21260Sstevel@tonic-gate ip->ipcx_key, 21270Sstevel@tonic-gate (int)ip->ipcx_projid); 21280Sstevel@tonic-gate } 21290Sstevel@tonic-gate 21300Sstevel@tonic-gate void 21310Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip) 21320Sstevel@tonic-gate { 21330Sstevel@tonic-gate (void) printf( 21347088Sraf "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21357088Sraf pri->pname, 21367088Sraf ip->uid, 21377088Sraf ip->gid, 21387088Sraf ip->cuid, 21397088Sraf ip->cgid, 21407088Sraf (int)ip->mode, 21417088Sraf ip->seq, 21427088Sraf ip->key); 21430Sstevel@tonic-gate } 21440Sstevel@tonic-gate 21450Sstevel@tonic-gate #ifdef _LP64 21460Sstevel@tonic-gate void 21470Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip) 21480Sstevel@tonic-gate { 21490Sstevel@tonic-gate (void) printf( 21507088Sraf "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21517088Sraf pri->pname, 21527088Sraf ip->uid, 21537088Sraf ip->gid, 21547088Sraf ip->cuid, 21557088Sraf ip->cgid, 21567088Sraf ip->mode, 21577088Sraf ip->seq, 21587088Sraf ip->key); 21590Sstevel@tonic-gate } 21600Sstevel@tonic-gate #endif /* _LP64 */ 21610Sstevel@tonic-gate 21620Sstevel@tonic-gate static void 21630Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset) 21640Sstevel@tonic-gate { 21650Sstevel@tonic-gate struct msqid_ds64 msgq; 21660Sstevel@tonic-gate 21670Sstevel@tonic-gate if (offset != NULL && 21680Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 21690Sstevel@tonic-gate show_perm64(pri, &msgq.msgx_perm); 21700Sstevel@tonic-gate 21710Sstevel@tonic-gate (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu " 21720Sstevel@tonic-gate "lspid=%-5d lrpid=%-5d\n", pri->pname, 21730Sstevel@tonic-gate (unsigned long long)msgq.msgx_cbytes, 21740Sstevel@tonic-gate (unsigned long long)msgq.msgx_qnum, 21750Sstevel@tonic-gate (unsigned long long)msgq.msgx_qbytes, 21760Sstevel@tonic-gate (int)msgq.msgx_lspid, 21770Sstevel@tonic-gate (int)msgq.msgx_lrpid); 21780Sstevel@tonic-gate 21790Sstevel@tonic-gate prtime(pri, " st = ", (time_t)msgq.msgx_stime); 21800Sstevel@tonic-gate prtime(pri, " rt = ", (time_t)msgq.msgx_rtime); 21810Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)msgq.msgx_ctime); 21820Sstevel@tonic-gate } 21830Sstevel@tonic-gate } 21840Sstevel@tonic-gate 21850Sstevel@tonic-gate void 21860Sstevel@tonic-gate show_msgctl(private_t *pri, long offset) 21870Sstevel@tonic-gate { 21880Sstevel@tonic-gate struct msqid_ds msgq; 21890Sstevel@tonic-gate 21900Sstevel@tonic-gate if (offset != NULL && 21910Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 21920Sstevel@tonic-gate show_perm(pri, &msgq.msg_perm); 21930Sstevel@tonic-gate 21940Sstevel@tonic-gate (void) printf( 21950Sstevel@tonic-gate "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n", 21967088Sraf pri->pname, 21977088Sraf msgq.msg_cbytes, 21987088Sraf msgq.msg_qnum, 21997088Sraf msgq.msg_qbytes, 22007088Sraf (int)msgq.msg_lspid, 22017088Sraf (int)msgq.msg_lrpid); 22020Sstevel@tonic-gate 22030Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22040Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22050Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22060Sstevel@tonic-gate } 22070Sstevel@tonic-gate } 22080Sstevel@tonic-gate 22090Sstevel@tonic-gate #ifdef _LP64 22100Sstevel@tonic-gate void 22110Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset) 22120Sstevel@tonic-gate { 22130Sstevel@tonic-gate struct msqid_ds32 msgq; 22140Sstevel@tonic-gate 22150Sstevel@tonic-gate if (offset != NULL && 22160Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 22170Sstevel@tonic-gate show_perm32(pri, &msgq.msg_perm); 22180Sstevel@tonic-gate 22190Sstevel@tonic-gate (void) printf( 22200Sstevel@tonic-gate "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n", 22217088Sraf pri->pname, 22227088Sraf msgq.msg_cbytes, 22237088Sraf msgq.msg_qnum, 22247088Sraf msgq.msg_qbytes, 22257088Sraf msgq.msg_lspid, 22267088Sraf msgq.msg_lrpid); 22270Sstevel@tonic-gate 22280Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22290Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22300Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22310Sstevel@tonic-gate } 22320Sstevel@tonic-gate } 22330Sstevel@tonic-gate #endif /* _LP64 */ 22340Sstevel@tonic-gate 22350Sstevel@tonic-gate void 22360Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz) 22370Sstevel@tonic-gate { 22380Sstevel@tonic-gate struct msgbuf msgb; 22390Sstevel@tonic-gate 22400Sstevel@tonic-gate if (offset != NULL && 22410Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22420Sstevel@tonic-gate sizeof (msgb.mtype)) { 22430Sstevel@tonic-gate /* enter region of lengthy output */ 22440Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22450Sstevel@tonic-gate Eserialize(); 22460Sstevel@tonic-gate 22470Sstevel@tonic-gate (void) printf("%s\tmtype=%lu mtext[]=\n", 22487088Sraf pri->pname, 22497088Sraf msgb.mtype); 22500Sstevel@tonic-gate showbuffer(pri, 22517088Sraf (long)(offset + sizeof (msgb.mtype)), msgsz); 22520Sstevel@tonic-gate 22530Sstevel@tonic-gate /* exit region of lengthy output */ 22540Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22550Sstevel@tonic-gate Xserialize(); 22560Sstevel@tonic-gate } 22570Sstevel@tonic-gate } 22580Sstevel@tonic-gate 22590Sstevel@tonic-gate #ifdef _LP64 22600Sstevel@tonic-gate void 22610Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz) 22620Sstevel@tonic-gate { 22630Sstevel@tonic-gate struct ipcmsgbuf32 msgb; 22640Sstevel@tonic-gate 22650Sstevel@tonic-gate if (offset != NULL && 22660Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22670Sstevel@tonic-gate sizeof (msgb.mtype)) { 22680Sstevel@tonic-gate /* enter region of lengthy output */ 22690Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22700Sstevel@tonic-gate Eserialize(); 22710Sstevel@tonic-gate 22720Sstevel@tonic-gate (void) printf("%s\tmtype=%u mtext[]=\n", 22737088Sraf pri->pname, 22747088Sraf msgb.mtype); 22750Sstevel@tonic-gate showbuffer(pri, 22767088Sraf (long)(offset + sizeof (msgb.mtype)), msgsz); 22770Sstevel@tonic-gate 22780Sstevel@tonic-gate /* exit region of lengthy output */ 22790Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22800Sstevel@tonic-gate Xserialize(); 22810Sstevel@tonic-gate } 22820Sstevel@tonic-gate } 22830Sstevel@tonic-gate #endif /* _LP64 */ 22840Sstevel@tonic-gate 22850Sstevel@tonic-gate #ifdef _LP64 22860Sstevel@tonic-gate void 22870Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 22880Sstevel@tonic-gate { 22890Sstevel@tonic-gate switch (pri->sys_args[0]) { 22900Sstevel@tonic-gate case 0: /* msgget() */ 22910Sstevel@tonic-gate break; 22920Sstevel@tonic-gate case 1: /* msgctl() */ 22930Sstevel@tonic-gate if (pri->sys_nargs > 3) { 22940Sstevel@tonic-gate switch (pri->sys_args[2]) { 22950Sstevel@tonic-gate case IPC_STAT: 22960Sstevel@tonic-gate if (pri->Errno) 22970Sstevel@tonic-gate break; 22980Sstevel@tonic-gate /*FALLTHROUGH*/ 22990Sstevel@tonic-gate case IPC_SET: 23000Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23010Sstevel@tonic-gate show_msgctl(pri, 23027088Sraf (long)pri->sys_args[3]); 23030Sstevel@tonic-gate else 23040Sstevel@tonic-gate show_msgctl32(pri, 23057088Sraf (long)pri->sys_args[3]); 23060Sstevel@tonic-gate break; 23070Sstevel@tonic-gate case IPC_STAT64: 23080Sstevel@tonic-gate if (pri->Errno) 23090Sstevel@tonic-gate break; 23100Sstevel@tonic-gate /*FALLTHROUGH*/ 23110Sstevel@tonic-gate case IPC_SET64: 23120Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23130Sstevel@tonic-gate break; 23140Sstevel@tonic-gate } 23150Sstevel@tonic-gate } 23160Sstevel@tonic-gate break; 23170Sstevel@tonic-gate case 2: /* msgrcv() */ 23180Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) { 23190Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23200Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23210Sstevel@tonic-gate else 23220Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], msgsz); 23230Sstevel@tonic-gate } 23240Sstevel@tonic-gate break; 23250Sstevel@tonic-gate case 3: /* msgsnd() */ 23260Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23270Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23280Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23297088Sraf pri->sys_args[3]); 23300Sstevel@tonic-gate else 23310Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], 23327088Sraf pri->sys_args[3]); 23330Sstevel@tonic-gate } 23340Sstevel@tonic-gate break; 23350Sstevel@tonic-gate case 4: /* msgids() */ 23360Sstevel@tonic-gate case 5: /* msgsnap() */ 23370Sstevel@tonic-gate default: /* unexpected subcode */ 23380Sstevel@tonic-gate break; 23390Sstevel@tonic-gate } 23400Sstevel@tonic-gate } 23410Sstevel@tonic-gate #else /* _LP64 */ 23420Sstevel@tonic-gate void 23430Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 23440Sstevel@tonic-gate { 23450Sstevel@tonic-gate switch (pri->sys_args[0]) { 23460Sstevel@tonic-gate case 0: /* msgget() */ 23470Sstevel@tonic-gate break; 23480Sstevel@tonic-gate case 1: /* msgctl() */ 23490Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23500Sstevel@tonic-gate switch (pri->sys_args[2]) { 23510Sstevel@tonic-gate case IPC_STAT: 23520Sstevel@tonic-gate if (pri->Errno) 23530Sstevel@tonic-gate break; 23540Sstevel@tonic-gate /*FALLTHROUGH*/ 23550Sstevel@tonic-gate case IPC_SET: 23560Sstevel@tonic-gate show_msgctl(pri, (long)pri->sys_args[3]); 23570Sstevel@tonic-gate break; 23580Sstevel@tonic-gate case IPC_STAT64: 23590Sstevel@tonic-gate if (pri->Errno) 23600Sstevel@tonic-gate break; 23610Sstevel@tonic-gate /*FALLTHROUGH*/ 23620Sstevel@tonic-gate case IPC_SET64: 23630Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23640Sstevel@tonic-gate break; 23650Sstevel@tonic-gate } 23660Sstevel@tonic-gate } 23670Sstevel@tonic-gate break; 23680Sstevel@tonic-gate case 2: /* msgrcv() */ 23690Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) 23700Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23710Sstevel@tonic-gate break; 23720Sstevel@tonic-gate case 3: /* msgsnd() */ 23730Sstevel@tonic-gate if (pri->sys_nargs > 3) 23740Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23757088Sraf pri->sys_args[3]); 23760Sstevel@tonic-gate break; 23770Sstevel@tonic-gate case 4: /* msgids() */ 23780Sstevel@tonic-gate case 5: /* msgsnap() */ 23790Sstevel@tonic-gate default: /* unexpected subcode */ 23800Sstevel@tonic-gate break; 23810Sstevel@tonic-gate } 23820Sstevel@tonic-gate } 23830Sstevel@tonic-gate #endif /* _LP64 */ 23840Sstevel@tonic-gate 23850Sstevel@tonic-gate static void 23860Sstevel@tonic-gate show_semctl64(private_t *pri, long offset) 23870Sstevel@tonic-gate { 23880Sstevel@tonic-gate struct semid_ds64 semds; 23890Sstevel@tonic-gate 23900Sstevel@tonic-gate if (offset != NULL && 23910Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 23920Sstevel@tonic-gate show_perm64(pri, &semds.semx_perm); 23930Sstevel@tonic-gate 23940Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems); 23950Sstevel@tonic-gate 23960Sstevel@tonic-gate prtime(pri, " ot = ", (time_t)semds.semx_otime); 23970Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)semds.semx_ctime); 23980Sstevel@tonic-gate } 23990Sstevel@tonic-gate } 24000Sstevel@tonic-gate 24010Sstevel@tonic-gate void 24020Sstevel@tonic-gate show_semctl(private_t *pri, long offset) 24030Sstevel@tonic-gate { 24040Sstevel@tonic-gate struct semid_ds semds; 24050Sstevel@tonic-gate 24060Sstevel@tonic-gate if (offset != NULL && 24070Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24080Sstevel@tonic-gate show_perm(pri, &semds.sem_perm); 24090Sstevel@tonic-gate 24100Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24117088Sraf pri->pname, 24127088Sraf semds.sem_nsems); 24130Sstevel@tonic-gate 24140Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24150Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24160Sstevel@tonic-gate } 24170Sstevel@tonic-gate } 24180Sstevel@tonic-gate 24190Sstevel@tonic-gate #ifdef _LP64 24200Sstevel@tonic-gate void 24210Sstevel@tonic-gate show_semctl32(private_t *pri, long offset) 24220Sstevel@tonic-gate { 24230Sstevel@tonic-gate struct semid_ds32 semds; 24240Sstevel@tonic-gate 24250Sstevel@tonic-gate if (offset != NULL && 24260Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24270Sstevel@tonic-gate show_perm32(pri, &semds.sem_perm); 24280Sstevel@tonic-gate 24290Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24307088Sraf pri->pname, 24317088Sraf semds.sem_nsems); 24320Sstevel@tonic-gate 24330Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24340Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24350Sstevel@tonic-gate } 24360Sstevel@tonic-gate } 24370Sstevel@tonic-gate #endif /* _LP64 */ 24380Sstevel@tonic-gate 24390Sstevel@tonic-gate void 24400Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout) 24410Sstevel@tonic-gate { 24420Sstevel@tonic-gate struct sembuf sembuf; 24430Sstevel@tonic-gate const char *str; 24440Sstevel@tonic-gate 244510440SRoger.Faulkner@Sun.COM if (offset == 0) 24460Sstevel@tonic-gate return; 24470Sstevel@tonic-gate 24480Sstevel@tonic-gate if (nsops > 40) /* let's not be ridiculous */ 24490Sstevel@tonic-gate nsops = 40; 24500Sstevel@tonic-gate 24510Sstevel@tonic-gate for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) { 24520Sstevel@tonic-gate if (Pread(Proc, &sembuf, sizeof (sembuf), offset) != 24530Sstevel@tonic-gate sizeof (sembuf)) 24540Sstevel@tonic-gate break; 24550Sstevel@tonic-gate 24560Sstevel@tonic-gate (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=", 24577088Sraf pri->pname, 24587088Sraf sembuf.sem_num, 24597088Sraf sembuf.sem_op); 24600Sstevel@tonic-gate 24610Sstevel@tonic-gate if (sembuf.sem_flg == 0) 24620Sstevel@tonic-gate (void) printf("0\n"); 24630Sstevel@tonic-gate else if ((str = semflags(pri, sembuf.sem_flg)) != NULL) 24640Sstevel@tonic-gate (void) printf("%s\n", str); 24650Sstevel@tonic-gate else 24660Sstevel@tonic-gate (void) printf("0%.6o\n", sembuf.sem_flg); 24670Sstevel@tonic-gate } 24680Sstevel@tonic-gate if (timeout) 24690Sstevel@tonic-gate show_timestruc(pri, timeout, "timeout"); 24700Sstevel@tonic-gate } 24710Sstevel@tonic-gate 24720Sstevel@tonic-gate void 24730Sstevel@tonic-gate show_semsys(private_t *pri) 24740Sstevel@tonic-gate { 24750Sstevel@tonic-gate switch (pri->sys_args[0]) { 24760Sstevel@tonic-gate case 0: /* semctl() */ 24770Sstevel@tonic-gate if (pri->sys_nargs > 4) { 24780Sstevel@tonic-gate switch (pri->sys_args[3]) { 24790Sstevel@tonic-gate case IPC_STAT: 24800Sstevel@tonic-gate if (pri->Errno) 24810Sstevel@tonic-gate break; 24820Sstevel@tonic-gate /*FALLTHROUGH*/ 24830Sstevel@tonic-gate case IPC_SET: 24840Sstevel@tonic-gate #ifdef _LP64 24850Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 24860Sstevel@tonic-gate show_semctl(pri, 24877088Sraf (long)pri->sys_args[4]); 24880Sstevel@tonic-gate else 24890Sstevel@tonic-gate show_semctl32(pri, 24907088Sraf (long)pri->sys_args[4]); 24910Sstevel@tonic-gate #else 24920Sstevel@tonic-gate show_semctl(pri, (long)pri->sys_args[4]); 24930Sstevel@tonic-gate #endif 24940Sstevel@tonic-gate break; 24950Sstevel@tonic-gate case IPC_STAT64: 24960Sstevel@tonic-gate if (pri->Errno) 24970Sstevel@tonic-gate break; 24980Sstevel@tonic-gate /*FALLTHROUGH*/ 24990Sstevel@tonic-gate case IPC_SET64: 25000Sstevel@tonic-gate show_semctl64(pri, (long)pri->sys_args[4]); 25010Sstevel@tonic-gate break; 25020Sstevel@tonic-gate } 25030Sstevel@tonic-gate } 25040Sstevel@tonic-gate break; 25050Sstevel@tonic-gate case 1: /* semget() */ 25060Sstevel@tonic-gate break; 25070Sstevel@tonic-gate case 2: /* semop() */ 25080Sstevel@tonic-gate if (pri->sys_nargs > 3) 25090Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25107088Sraf pri->sys_args[3], 0); 25110Sstevel@tonic-gate break; 25120Sstevel@tonic-gate case 3: /* semids() */ 25130Sstevel@tonic-gate break; 25140Sstevel@tonic-gate case 4: /* semtimedop() */ 25150Sstevel@tonic-gate if (pri->sys_nargs > 4) 25160Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25177088Sraf pri->sys_args[3], pri->sys_args[4]); 25180Sstevel@tonic-gate break; 25190Sstevel@tonic-gate default: /* unexpected subcode */ 25200Sstevel@tonic-gate break; 25210Sstevel@tonic-gate } 25220Sstevel@tonic-gate } 25230Sstevel@tonic-gate 25240Sstevel@tonic-gate static void 25250Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset) 25260Sstevel@tonic-gate { 25270Sstevel@tonic-gate struct shmid_ds64 shmds; 25280Sstevel@tonic-gate 25290Sstevel@tonic-gate if (offset != NULL && 25300Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25310Sstevel@tonic-gate show_perm64(pri, &shmds.shmx_perm); 25320Sstevel@tonic-gate 25330Sstevel@tonic-gate (void) printf( 25340Sstevel@tonic-gate "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n", 25350Sstevel@tonic-gate pri->pname, 25360Sstevel@tonic-gate (unsigned long long)shmds.shmx_segsz, 25370Sstevel@tonic-gate (int)shmds.shmx_lpid, 25380Sstevel@tonic-gate (int)shmds.shmx_cpid, 25390Sstevel@tonic-gate (unsigned long long)shmds.shmx_nattch, 25400Sstevel@tonic-gate (unsigned long long)shmds.shmx_cnattch); 25410Sstevel@tonic-gate 25420Sstevel@tonic-gate prtime(pri, " at = ", (time_t)shmds.shmx_atime); 25430Sstevel@tonic-gate prtime(pri, " dt = ", (time_t)shmds.shmx_dtime); 25440Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)shmds.shmx_ctime); 25450Sstevel@tonic-gate } 25460Sstevel@tonic-gate } 25470Sstevel@tonic-gate 25480Sstevel@tonic-gate void 25490Sstevel@tonic-gate show_shmctl(private_t *pri, long offset) 25500Sstevel@tonic-gate { 25510Sstevel@tonic-gate struct shmid_ds shmds; 25520Sstevel@tonic-gate 25530Sstevel@tonic-gate if (offset != NULL && 25540Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25550Sstevel@tonic-gate show_perm(pri, &shmds.shm_perm); 25560Sstevel@tonic-gate 25570Sstevel@tonic-gate (void) printf( 25587088Sraf "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n", 25597088Sraf pri->pname, 25607088Sraf (ulong_t)shmds.shm_segsz, 25617088Sraf (int)shmds.shm_lpid, 25627088Sraf (int)shmds.shm_cpid, 25637088Sraf shmds.shm_nattch, 25647088Sraf shmds.shm_cnattch); 25650Sstevel@tonic-gate 25660Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 25670Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 25680Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 25690Sstevel@tonic-gate } 25700Sstevel@tonic-gate } 25710Sstevel@tonic-gate 25720Sstevel@tonic-gate #ifdef _LP64 25730Sstevel@tonic-gate void 25740Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset) 25750Sstevel@tonic-gate { 25760Sstevel@tonic-gate struct shmid_ds32 shmds; 25770Sstevel@tonic-gate 25780Sstevel@tonic-gate if (offset != NULL && 25790Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25800Sstevel@tonic-gate show_perm32(pri, &shmds.shm_perm); 25810Sstevel@tonic-gate 25820Sstevel@tonic-gate (void) printf( 25837088Sraf "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n", 25847088Sraf pri->pname, 25857088Sraf shmds.shm_segsz, 25867088Sraf shmds.shm_lpid, 25877088Sraf shmds.shm_cpid, 25887088Sraf shmds.shm_nattch, 25897088Sraf shmds.shm_cnattch); 25900Sstevel@tonic-gate 25910Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 25920Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 25930Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 25940Sstevel@tonic-gate } 25950Sstevel@tonic-gate } 25960Sstevel@tonic-gate #endif /* _LP64 */ 25970Sstevel@tonic-gate 25980Sstevel@tonic-gate void 25990Sstevel@tonic-gate show_shmsys(private_t *pri) 26000Sstevel@tonic-gate { 26010Sstevel@tonic-gate switch (pri->sys_args[0]) { 26020Sstevel@tonic-gate case 0: /* shmat() */ 26030Sstevel@tonic-gate break; 26040Sstevel@tonic-gate case 1: /* shmctl() */ 26050Sstevel@tonic-gate if (pri->sys_nargs > 3) { 26060Sstevel@tonic-gate switch (pri->sys_args[2]) { 26070Sstevel@tonic-gate case IPC_STAT: 26080Sstevel@tonic-gate if (pri->Errno) 26090Sstevel@tonic-gate break; 26100Sstevel@tonic-gate /*FALLTHROUGH*/ 26110Sstevel@tonic-gate case IPC_SET: 26120Sstevel@tonic-gate #ifdef _LP64 26130Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 26140Sstevel@tonic-gate show_shmctl(pri, 26157088Sraf (long)pri->sys_args[3]); 26160Sstevel@tonic-gate else 26170Sstevel@tonic-gate show_shmctl32(pri, 26187088Sraf (long)pri->sys_args[3]); 26190Sstevel@tonic-gate #else 26200Sstevel@tonic-gate show_shmctl(pri, (long)pri->sys_args[3]); 26210Sstevel@tonic-gate #endif 26220Sstevel@tonic-gate break; 26230Sstevel@tonic-gate case IPC_STAT64: 26240Sstevel@tonic-gate if (pri->Errno) 26250Sstevel@tonic-gate break; 26260Sstevel@tonic-gate /*FALLTHROUGH*/ 26270Sstevel@tonic-gate case IPC_SET64: 26280Sstevel@tonic-gate show_shmctl64(pri, (long)pri->sys_args[3]); 26290Sstevel@tonic-gate break; 26300Sstevel@tonic-gate } 26310Sstevel@tonic-gate } 26320Sstevel@tonic-gate break; 26330Sstevel@tonic-gate case 2: /* shmdt() */ 26340Sstevel@tonic-gate case 3: /* shmget() */ 26350Sstevel@tonic-gate case 4: /* shmids() */ 26360Sstevel@tonic-gate default: /* unexpected subcode */ 26370Sstevel@tonic-gate break; 26380Sstevel@tonic-gate } 26390Sstevel@tonic-gate } 26400Sstevel@tonic-gate 26410Sstevel@tonic-gate void 26420Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count) 26430Sstevel@tonic-gate { 26440Sstevel@tonic-gate int groups[100]; 26450Sstevel@tonic-gate 26460Sstevel@tonic-gate if (count > 100) 26470Sstevel@tonic-gate count = 100; 26480Sstevel@tonic-gate 26490Sstevel@tonic-gate if (count > 0 && offset != NULL && 26500Sstevel@tonic-gate Pread(Proc, &groups[0], count*sizeof (int), offset) == 26510Sstevel@tonic-gate count*sizeof (int)) { 26520Sstevel@tonic-gate int n; 26530Sstevel@tonic-gate 26540Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 26550Sstevel@tonic-gate for (n = 0; !interrupt && n < count; n++) { 26560Sstevel@tonic-gate if (n != 0 && n%10 == 0) 26570Sstevel@tonic-gate (void) printf("\n%s\t", pri->pname); 26580Sstevel@tonic-gate (void) printf(" %5d", groups[n]); 26590Sstevel@tonic-gate } 26600Sstevel@tonic-gate (void) fputc('\n', stdout); 26610Sstevel@tonic-gate } 26620Sstevel@tonic-gate } 26630Sstevel@tonic-gate 26640Sstevel@tonic-gate /* 26650Sstevel@tonic-gate * This assumes that a sigset_t is simply an array of ints. 26660Sstevel@tonic-gate */ 26670Sstevel@tonic-gate char * 26680Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp) 26690Sstevel@tonic-gate { 26700Sstevel@tonic-gate char *s = pri->code_buf; 26710Sstevel@tonic-gate int n = sizeof (*sp) / sizeof (int32_t); 26720Sstevel@tonic-gate int32_t *lp = (int32_t *)sp; 26730Sstevel@tonic-gate 26740Sstevel@tonic-gate while (--n >= 0) { 26750Sstevel@tonic-gate int32_t val = *lp++; 26760Sstevel@tonic-gate 26770Sstevel@tonic-gate if (val == 0) 26780Sstevel@tonic-gate s += sprintf(s, " 0"); 26790Sstevel@tonic-gate else 26800Sstevel@tonic-gate s += sprintf(s, " 0x%.8X", val); 26810Sstevel@tonic-gate } 26820Sstevel@tonic-gate 26830Sstevel@tonic-gate return (pri->code_buf); 26840Sstevel@tonic-gate } 26850Sstevel@tonic-gate 26860Sstevel@tonic-gate void 26870Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name) 26880Sstevel@tonic-gate { 26890Sstevel@tonic-gate sigset_t sigset; 26900Sstevel@tonic-gate 26910Sstevel@tonic-gate if (offset != NULL && 26920Sstevel@tonic-gate Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) { 26930Sstevel@tonic-gate (void) printf("%s\t%s =%s\n", 26947088Sraf pri->pname, name, sigset_string(pri, &sigset)); 26950Sstevel@tonic-gate } 26960Sstevel@tonic-gate } 26970Sstevel@tonic-gate 26980Sstevel@tonic-gate #ifdef _LP64 26990Sstevel@tonic-gate void 27000Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name) 27010Sstevel@tonic-gate { 27020Sstevel@tonic-gate struct sigaltstack32 altstack; 27030Sstevel@tonic-gate 27040Sstevel@tonic-gate if (offset != NULL && 27050Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27060Sstevel@tonic-gate sizeof (altstack)) { 27070Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n", 27087088Sraf pri->pname, 27097088Sraf name, 27107088Sraf altstack.ss_sp, 27117088Sraf altstack.ss_size, 27127088Sraf altstack.ss_flags); 27130Sstevel@tonic-gate } 27140Sstevel@tonic-gate } 27150Sstevel@tonic-gate #endif /* _LP64 */ 27160Sstevel@tonic-gate 27170Sstevel@tonic-gate void 27180Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name) 27190Sstevel@tonic-gate { 27200Sstevel@tonic-gate struct sigaltstack altstack; 27210Sstevel@tonic-gate 27220Sstevel@tonic-gate #ifdef _LP64 27230Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27240Sstevel@tonic-gate show_sigaltstack32(pri, offset, name); 27250Sstevel@tonic-gate return; 27260Sstevel@tonic-gate } 27270Sstevel@tonic-gate #endif 27280Sstevel@tonic-gate if (offset != NULL && 27290Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27300Sstevel@tonic-gate sizeof (altstack)) { 27310Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n", 27327088Sraf pri->pname, 27337088Sraf name, 27347088Sraf (ulong_t)altstack.ss_sp, 27357088Sraf (ulong_t)altstack.ss_size, 27367088Sraf altstack.ss_flags); 27370Sstevel@tonic-gate } 27380Sstevel@tonic-gate } 27390Sstevel@tonic-gate 27400Sstevel@tonic-gate #ifdef _LP64 27410Sstevel@tonic-gate void 27420Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp) 27430Sstevel@tonic-gate { 27440Sstevel@tonic-gate struct sigaction32 sigaction; 27450Sstevel@tonic-gate 27460Sstevel@tonic-gate if (offset != NULL && 27470Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27480Sstevel@tonic-gate sizeof (sigaction)) { 27490Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27500Sstevel@tonic-gate if (odisp != NULL) 27510Sstevel@tonic-gate sigaction.sa_handler = (caddr32_t)odisp; 27520Sstevel@tonic-gate (void) printf( 27537088Sraf "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n", 27547088Sraf pri->pname, 27557088Sraf name, 27567088Sraf sigaction.sa_handler, 27577088Sraf sigset_string(pri, (sigset_t *)&sigaction.sa_mask), 27587088Sraf sigaction.sa_flags); 27590Sstevel@tonic-gate } 27600Sstevel@tonic-gate } 27610Sstevel@tonic-gate #endif /* _LP64 */ 27620Sstevel@tonic-gate 27630Sstevel@tonic-gate void 27640Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp) 27650Sstevel@tonic-gate { 27660Sstevel@tonic-gate struct sigaction sigaction; 27670Sstevel@tonic-gate 27680Sstevel@tonic-gate #ifdef _LP64 27690Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27700Sstevel@tonic-gate show_sigaction32(pri, offset, name, odisp); 27710Sstevel@tonic-gate return; 27720Sstevel@tonic-gate } 27730Sstevel@tonic-gate #endif 27740Sstevel@tonic-gate if (offset != NULL && 27750Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27760Sstevel@tonic-gate sizeof (sigaction)) { 27770Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27780Sstevel@tonic-gate if (odisp != NULL) 27790Sstevel@tonic-gate sigaction.sa_handler = (void (*)())odisp; 27800Sstevel@tonic-gate (void) printf( 27817088Sraf "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n", 27827088Sraf pri->pname, 27837088Sraf name, 27847088Sraf (long)sigaction.sa_handler, 27857088Sraf sigset_string(pri, &sigaction.sa_mask), 27867088Sraf sigaction.sa_flags); 27870Sstevel@tonic-gate } 27880Sstevel@tonic-gate } 27890Sstevel@tonic-gate 27900Sstevel@tonic-gate #ifdef _LP64 27910Sstevel@tonic-gate void 27920Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip) 27930Sstevel@tonic-gate { 27940Sstevel@tonic-gate const char *code = NULL; 27950Sstevel@tonic-gate 27960Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 27977088Sraf signame(pri, sip->si_signo)); 27980Sstevel@tonic-gate 27990Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 28000Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid); 28010Sstevel@tonic-gate if (sip->si_code != 0) 28020Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 28030Sstevel@tonic-gate (void) fputc('\n', stdout); 28040Sstevel@tonic-gate return; 28050Sstevel@tonic-gate } 28060Sstevel@tonic-gate 28070Sstevel@tonic-gate switch (sip->si_signo) { 28080Sstevel@tonic-gate default: 28090Sstevel@tonic-gate (void) fputc('\n', stdout); 28100Sstevel@tonic-gate return; 28110Sstevel@tonic-gate case SIGILL: 28120Sstevel@tonic-gate case SIGTRAP: 28130Sstevel@tonic-gate case SIGFPE: 28140Sstevel@tonic-gate case SIGSEGV: 28150Sstevel@tonic-gate case SIGBUS: 28160Sstevel@tonic-gate case SIGEMT: 28170Sstevel@tonic-gate case SIGCLD: 28180Sstevel@tonic-gate case SIGPOLL: 28190Sstevel@tonic-gate case SIGXFSZ: 28200Sstevel@tonic-gate break; 28210Sstevel@tonic-gate } 28220Sstevel@tonic-gate 28230Sstevel@tonic-gate switch (sip->si_signo) { 28240Sstevel@tonic-gate case SIGILL: 28250Sstevel@tonic-gate switch (sip->si_code) { 28260Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 28270Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 28280Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 28290Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 28300Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 28310Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 28320Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 28330Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 28340Sstevel@tonic-gate } 28350Sstevel@tonic-gate break; 28360Sstevel@tonic-gate case SIGTRAP: 28370Sstevel@tonic-gate switch (sip->si_code) { 28380Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 28390Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 28400Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 28410Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 28420Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 28430Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 28440Sstevel@tonic-gate } 28450Sstevel@tonic-gate break; 28460Sstevel@tonic-gate case SIGFPE: 28470Sstevel@tonic-gate switch (sip->si_code) { 28480Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 28490Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 28500Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 28510Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 28520Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 28530Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 28540Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 28550Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 28560Sstevel@tonic-gate #if defined(FPE_FLTDEN) 28570Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 28580Sstevel@tonic-gate #endif 28590Sstevel@tonic-gate } 28600Sstevel@tonic-gate break; 28610Sstevel@tonic-gate case SIGSEGV: 28620Sstevel@tonic-gate switch (sip->si_code) { 28630Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 28640Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 28650Sstevel@tonic-gate } 28660Sstevel@tonic-gate break; 28670Sstevel@tonic-gate case SIGEMT: 28680Sstevel@tonic-gate switch (sip->si_code) { 28690Sstevel@tonic-gate #ifdef EMT_TAGOVF 28700Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 28710Sstevel@tonic-gate #endif 28720Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 28730Sstevel@tonic-gate } 28740Sstevel@tonic-gate break; 28750Sstevel@tonic-gate case SIGBUS: 28760Sstevel@tonic-gate switch (sip->si_code) { 28770Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 28780Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 28790Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 28800Sstevel@tonic-gate } 28810Sstevel@tonic-gate break; 28820Sstevel@tonic-gate case SIGCLD: 28830Sstevel@tonic-gate switch (sip->si_code) { 28840Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 28850Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 28860Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 28870Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 28880Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 28890Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 28900Sstevel@tonic-gate } 28910Sstevel@tonic-gate break; 28920Sstevel@tonic-gate case SIGPOLL: 28930Sstevel@tonic-gate switch (sip->si_code) { 28940Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 28950Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 28960Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 28970Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 28980Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 28990Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 29000Sstevel@tonic-gate } 29010Sstevel@tonic-gate break; 29020Sstevel@tonic-gate } 29030Sstevel@tonic-gate 29040Sstevel@tonic-gate if (code == NULL) { 29050Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 29060Sstevel@tonic-gate code = (const char *)pri->code_buf; 29070Sstevel@tonic-gate } 29080Sstevel@tonic-gate 29090Sstevel@tonic-gate switch (sip->si_signo) { 29100Sstevel@tonic-gate case SIGILL: 29110Sstevel@tonic-gate case SIGTRAP: 29120Sstevel@tonic-gate case SIGFPE: 29130Sstevel@tonic-gate case SIGSEGV: 29140Sstevel@tonic-gate case SIGBUS: 29150Sstevel@tonic-gate case SIGEMT: 29160Sstevel@tonic-gate (void) printf(" %s addr=0x%.8X", 29177088Sraf code, 29187088Sraf sip->si_addr); 29190Sstevel@tonic-gate break; 29200Sstevel@tonic-gate case SIGCLD: 29210Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 29227088Sraf code, 29237088Sraf sip->si_pid, 29247088Sraf sip->si_status); 29250Sstevel@tonic-gate break; 29260Sstevel@tonic-gate case SIGPOLL: 29270Sstevel@tonic-gate case SIGXFSZ: 29280Sstevel@tonic-gate (void) printf(" %s fd=%d band=%d", 29297088Sraf code, 29307088Sraf sip->si_fd, 29317088Sraf sip->si_band); 29320Sstevel@tonic-gate break; 29330Sstevel@tonic-gate } 29340Sstevel@tonic-gate 29350Sstevel@tonic-gate if (sip->si_errno != 0) { 29360Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 29370Sstevel@tonic-gate 29380Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 29390Sstevel@tonic-gate if (ename != NULL) 29400Sstevel@tonic-gate (void) printf("(%s)", ename); 29410Sstevel@tonic-gate } 29420Sstevel@tonic-gate 29430Sstevel@tonic-gate (void) fputc('\n', stdout); 29440Sstevel@tonic-gate } 29450Sstevel@tonic-gate #endif /* _LP64 */ 29460Sstevel@tonic-gate 29470Sstevel@tonic-gate void 29480Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip) 29490Sstevel@tonic-gate { 29500Sstevel@tonic-gate const char *code = NULL; 29510Sstevel@tonic-gate 29520Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 29537088Sraf signame(pri, sip->si_signo)); 29540Sstevel@tonic-gate 29550Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 29564321Scasper (void) printf(" pid=%d uid=%u", 29570Sstevel@tonic-gate (int)sip->si_pid, 29584321Scasper sip->si_uid); 29590Sstevel@tonic-gate if (sip->si_code != 0) 29600Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 29610Sstevel@tonic-gate (void) fputc('\n', stdout); 29620Sstevel@tonic-gate return; 29630Sstevel@tonic-gate } 29640Sstevel@tonic-gate 29650Sstevel@tonic-gate switch (sip->si_signo) { 29660Sstevel@tonic-gate default: 29670Sstevel@tonic-gate (void) fputc('\n', stdout); 29680Sstevel@tonic-gate return; 29690Sstevel@tonic-gate case SIGILL: 29700Sstevel@tonic-gate case SIGTRAP: 29710Sstevel@tonic-gate case SIGFPE: 29720Sstevel@tonic-gate case SIGSEGV: 29730Sstevel@tonic-gate case SIGBUS: 29740Sstevel@tonic-gate case SIGEMT: 29750Sstevel@tonic-gate case SIGCLD: 29760Sstevel@tonic-gate case SIGPOLL: 29770Sstevel@tonic-gate case SIGXFSZ: 29780Sstevel@tonic-gate break; 29790Sstevel@tonic-gate } 29800Sstevel@tonic-gate 29810Sstevel@tonic-gate switch (sip->si_signo) { 29820Sstevel@tonic-gate case SIGILL: 29830Sstevel@tonic-gate switch (sip->si_code) { 29840Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 29850Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 29860Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 29870Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 29880Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 29890Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 29900Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 29910Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 29920Sstevel@tonic-gate } 29930Sstevel@tonic-gate break; 29940Sstevel@tonic-gate case SIGTRAP: 29950Sstevel@tonic-gate switch (sip->si_code) { 29960Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 29970Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 29980Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 29990Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 30000Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 30010Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 30020Sstevel@tonic-gate } 30030Sstevel@tonic-gate break; 30040Sstevel@tonic-gate case SIGFPE: 30050Sstevel@tonic-gate switch (sip->si_code) { 30060Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 30070Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 30080Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 30090Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 30100Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 30110Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 30120Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 30130Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 30140Sstevel@tonic-gate #if defined(FPE_FLTDEN) 30150Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 30160Sstevel@tonic-gate #endif 30170Sstevel@tonic-gate } 30180Sstevel@tonic-gate break; 30190Sstevel@tonic-gate case SIGSEGV: 30200Sstevel@tonic-gate switch (sip->si_code) { 30210Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 30220Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 30230Sstevel@tonic-gate } 30240Sstevel@tonic-gate break; 30250Sstevel@tonic-gate case SIGEMT: 30260Sstevel@tonic-gate switch (sip->si_code) { 30270Sstevel@tonic-gate #ifdef EMT_TAGOVF 30280Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 30290Sstevel@tonic-gate #endif 30300Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 30310Sstevel@tonic-gate } 30320Sstevel@tonic-gate break; 30330Sstevel@tonic-gate case SIGBUS: 30340Sstevel@tonic-gate switch (sip->si_code) { 30350Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 30360Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 30370Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 30380Sstevel@tonic-gate } 30390Sstevel@tonic-gate break; 30400Sstevel@tonic-gate case SIGCLD: 30410Sstevel@tonic-gate switch (sip->si_code) { 30420Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 30430Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 30440Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 30450Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 30460Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 30470Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 30480Sstevel@tonic-gate } 30490Sstevel@tonic-gate break; 30500Sstevel@tonic-gate case SIGPOLL: 30510Sstevel@tonic-gate switch (sip->si_code) { 30520Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 30530Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 30540Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 30550Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 30560Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 30570Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 30580Sstevel@tonic-gate } 30590Sstevel@tonic-gate break; 30600Sstevel@tonic-gate } 30610Sstevel@tonic-gate 30620Sstevel@tonic-gate if (code == NULL) { 30630Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 30640Sstevel@tonic-gate code = (const char *)pri->code_buf; 30650Sstevel@tonic-gate } 30660Sstevel@tonic-gate 30670Sstevel@tonic-gate switch (sip->si_signo) { 30680Sstevel@tonic-gate case SIGILL: 30690Sstevel@tonic-gate case SIGTRAP: 30700Sstevel@tonic-gate case SIGFPE: 30710Sstevel@tonic-gate case SIGSEGV: 30720Sstevel@tonic-gate case SIGBUS: 30730Sstevel@tonic-gate case SIGEMT: 30740Sstevel@tonic-gate (void) printf(" %s addr=0x%.8lX", 30757088Sraf code, 30767088Sraf (long)sip->si_addr); 30770Sstevel@tonic-gate break; 30780Sstevel@tonic-gate case SIGCLD: 30790Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 30807088Sraf code, 30817088Sraf (int)sip->si_pid, 30827088Sraf sip->si_status); 30830Sstevel@tonic-gate break; 30840Sstevel@tonic-gate case SIGPOLL: 30850Sstevel@tonic-gate case SIGXFSZ: 30860Sstevel@tonic-gate (void) printf(" %s fd=%d band=%ld", 30877088Sraf code, 30887088Sraf sip->si_fd, 30897088Sraf sip->si_band); 30900Sstevel@tonic-gate break; 30910Sstevel@tonic-gate } 30920Sstevel@tonic-gate 30930Sstevel@tonic-gate if (sip->si_errno != 0) { 30940Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 30950Sstevel@tonic-gate 30960Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 30970Sstevel@tonic-gate if (ename != NULL) 30980Sstevel@tonic-gate (void) printf("(%s)", ename); 30990Sstevel@tonic-gate } 31000Sstevel@tonic-gate 31010Sstevel@tonic-gate (void) fputc('\n', stdout); 31020Sstevel@tonic-gate } 31030Sstevel@tonic-gate 31040Sstevel@tonic-gate #ifdef _LP64 31050Sstevel@tonic-gate void 31060Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset) 31070Sstevel@tonic-gate { 31080Sstevel@tonic-gate struct siginfo32 siginfo; 31090Sstevel@tonic-gate 31100Sstevel@tonic-gate if (offset != NULL && 31110Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31120Sstevel@tonic-gate print_siginfo32(pri, &siginfo); 31130Sstevel@tonic-gate } 31140Sstevel@tonic-gate #endif /* _LP64 */ 31150Sstevel@tonic-gate 31160Sstevel@tonic-gate void 31170Sstevel@tonic-gate show_siginfo(private_t *pri, long offset) 31180Sstevel@tonic-gate { 31190Sstevel@tonic-gate struct siginfo siginfo; 31200Sstevel@tonic-gate 31210Sstevel@tonic-gate #ifdef _LP64 31220Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 31230Sstevel@tonic-gate show_siginfo32(pri, offset); 31240Sstevel@tonic-gate return; 31250Sstevel@tonic-gate } 31260Sstevel@tonic-gate #endif 31270Sstevel@tonic-gate if (offset != NULL && 31280Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31290Sstevel@tonic-gate print_siginfo(pri, &siginfo); 31300Sstevel@tonic-gate } 31310Sstevel@tonic-gate 31320Sstevel@tonic-gate void 31330Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count) 31340Sstevel@tonic-gate { 31350Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4); 31360Sstevel@tonic-gate 31370Sstevel@tonic-gate /* enter region of lengthy output */ 31380Sstevel@tonic-gate if (serial) 31390Sstevel@tonic-gate Eserialize(); 31400Sstevel@tonic-gate 31410Sstevel@tonic-gate while (count > 0) { 31420Sstevel@tonic-gate char buf[32]; 31430Sstevel@tonic-gate int nb = (count < 32)? count : 32; 31440Sstevel@tonic-gate int i; 31450Sstevel@tonic-gate 31460Sstevel@tonic-gate if (Pread(Proc, buf, (size_t)nb, offset) != nb) 31470Sstevel@tonic-gate break; 31480Sstevel@tonic-gate 31490Sstevel@tonic-gate (void) printf("%s ", pri->pname); 31500Sstevel@tonic-gate for (i = 0; i < nb; i++) 31510Sstevel@tonic-gate (void) printf(" %d", buf[i]); 31520Sstevel@tonic-gate (void) fputc('\n', stdout); 31530Sstevel@tonic-gate 31540Sstevel@tonic-gate count -= nb; 31550Sstevel@tonic-gate offset += nb; 31560Sstevel@tonic-gate } 31570Sstevel@tonic-gate 31580Sstevel@tonic-gate /* exit region of lengthy output */ 31590Sstevel@tonic-gate if (serial) 31600Sstevel@tonic-gate Xserialize(); 31610Sstevel@tonic-gate } 31620Sstevel@tonic-gate 31630Sstevel@tonic-gate #ifdef _LP64 31640Sstevel@tonic-gate void 31650Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count) 31660Sstevel@tonic-gate { 31670Sstevel@tonic-gate iovec32_t iovec[16]; 31680Sstevel@tonic-gate iovec32_t *ip; 31690Sstevel@tonic-gate long nb; 31700Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 31710Sstevel@tonic-gate 31720Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 31730Sstevel@tonic-gate niov = 16; 31740Sstevel@tonic-gate 31750Sstevel@tonic-gate if (offset != NULL && niov > 0 && 31760Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset) 31770Sstevel@tonic-gate == niov*sizeof (iovec32_t)) { 31780Sstevel@tonic-gate /* enter region of lengthy output */ 31790Sstevel@tonic-gate if (serial) 31800Sstevel@tonic-gate Eserialize(); 31810Sstevel@tonic-gate 31820Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 31830Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n", 31847088Sraf pri->pname, 31857088Sraf ip->iov_base, 31867088Sraf ip->iov_len); 31870Sstevel@tonic-gate if ((nb = count) > 0) { 31880Sstevel@tonic-gate if (nb > ip->iov_len) 31890Sstevel@tonic-gate nb = ip->iov_len; 31900Sstevel@tonic-gate if (nb > 0) 31910Sstevel@tonic-gate count -= nb; 31920Sstevel@tonic-gate } 31930Sstevel@tonic-gate if (showbuf && nb > 0) 31940Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 31950Sstevel@tonic-gate } 31960Sstevel@tonic-gate 31970Sstevel@tonic-gate /* exit region of lengthy output */ 31980Sstevel@tonic-gate if (serial) 31990Sstevel@tonic-gate Xserialize(); 32000Sstevel@tonic-gate } 32010Sstevel@tonic-gate } 32020Sstevel@tonic-gate #endif /* _LP64 */ 32030Sstevel@tonic-gate 32040Sstevel@tonic-gate void 32050Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count) 32060Sstevel@tonic-gate { 32070Sstevel@tonic-gate iovec_t iovec[16]; 32080Sstevel@tonic-gate iovec_t *ip; 32090Sstevel@tonic-gate long nb; 32100Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 32110Sstevel@tonic-gate 32120Sstevel@tonic-gate #ifdef _LP64 32130Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 32140Sstevel@tonic-gate show_iovec32(pri, offset, niov, showbuf, count); 32150Sstevel@tonic-gate return; 32160Sstevel@tonic-gate } 32170Sstevel@tonic-gate #endif 32180Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 32190Sstevel@tonic-gate niov = 16; 32200Sstevel@tonic-gate 32210Sstevel@tonic-gate if (offset != NULL && niov > 0 && 32220Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset) 32230Sstevel@tonic-gate == niov*sizeof (iovec_t)) { 32240Sstevel@tonic-gate /* enter region of lengthy output */ 32250Sstevel@tonic-gate if (serial) 32260Sstevel@tonic-gate Eserialize(); 32270Sstevel@tonic-gate 32280Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 32290Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n", 32307088Sraf pri->pname, 32317088Sraf (long)ip->iov_base, 32327088Sraf ip->iov_len); 32330Sstevel@tonic-gate if ((nb = count) > 0) { 32340Sstevel@tonic-gate if (nb > ip->iov_len) 32350Sstevel@tonic-gate nb = ip->iov_len; 32360Sstevel@tonic-gate if (nb > 0) 32370Sstevel@tonic-gate count -= nb; 32380Sstevel@tonic-gate } 32390Sstevel@tonic-gate if (showbuf && nb > 0) 32400Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 32410Sstevel@tonic-gate } 32420Sstevel@tonic-gate 32430Sstevel@tonic-gate /* exit region of lengthy output */ 32440Sstevel@tonic-gate if (serial) 32450Sstevel@tonic-gate Xserialize(); 32460Sstevel@tonic-gate } 32470Sstevel@tonic-gate } 32480Sstevel@tonic-gate 32490Sstevel@tonic-gate void 32500Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count) 32510Sstevel@tonic-gate { 32520Sstevel@tonic-gate long buf[MYBUFSIZ / sizeof (long)]; 32530Sstevel@tonic-gate struct dirent32 *dp; 32540Sstevel@tonic-gate int serial = (count > 100); 32550Sstevel@tonic-gate 325610440SRoger.Faulkner@Sun.COM if (offset == 0) 32570Sstevel@tonic-gate return; 32580Sstevel@tonic-gate 32590Sstevel@tonic-gate /* enter region of lengthy output */ 32600Sstevel@tonic-gate if (serial) 32610Sstevel@tonic-gate Eserialize(); 32620Sstevel@tonic-gate 32630Sstevel@tonic-gate while (count > 0 && !interrupt) { 32640Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 32650Sstevel@tonic-gate 32660Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 32670Sstevel@tonic-gate break; 32680Sstevel@tonic-gate 32690Sstevel@tonic-gate dp = (struct dirent32 *)&buf[0]; 32700Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 32710Sstevel@tonic-gate break; 32720Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 32730Sstevel@tonic-gate /* getdents() error? */ 32740Sstevel@tonic-gate (void) printf( 32757088Sraf "%s ino=%-5u off=%-4d rlen=%-3d\n", 32767088Sraf pri->pname, 32777088Sraf dp->d_ino, 32787088Sraf dp->d_off, 32797088Sraf dp->d_reclen); 32800Sstevel@tonic-gate break; 32810Sstevel@tonic-gate } 32820Sstevel@tonic-gate 32830Sstevel@tonic-gate while (!interrupt && 32840Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 32850Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 32860Sstevel@tonic-gate (void) printf( 32877088Sraf "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n", 32887088Sraf pri->pname, 32897088Sraf dp->d_ino, 32907088Sraf dp->d_off, 32917088Sraf dp->d_reclen, 32927088Sraf dp->d_reclen - (int)(dp->d_name - (char *)dp), 32937088Sraf dp->d_name); 32940Sstevel@tonic-gate nb -= dp->d_reclen; 32950Sstevel@tonic-gate count -= dp->d_reclen; 32960Sstevel@tonic-gate offset += dp->d_reclen; 32970Sstevel@tonic-gate /* LINTED improper alignment */ 32980Sstevel@tonic-gate dp = (struct dirent32 *)((char *)dp + dp->d_reclen); 32990Sstevel@tonic-gate } 33000Sstevel@tonic-gate } 33010Sstevel@tonic-gate 33020Sstevel@tonic-gate /* exit region of lengthy output */ 33030Sstevel@tonic-gate if (serial) 33040Sstevel@tonic-gate Xserialize(); 33050Sstevel@tonic-gate } 33060Sstevel@tonic-gate 33070Sstevel@tonic-gate void 33080Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count) 33090Sstevel@tonic-gate { 33100Sstevel@tonic-gate long long buf[MYBUFSIZ / sizeof (long long)]; 33110Sstevel@tonic-gate struct dirent64 *dp; 33120Sstevel@tonic-gate int serial = (count > 100); 33130Sstevel@tonic-gate 331410440SRoger.Faulkner@Sun.COM if (offset == 0) 33150Sstevel@tonic-gate return; 33160Sstevel@tonic-gate 33170Sstevel@tonic-gate /* enter region of lengthy output */ 33180Sstevel@tonic-gate if (serial) 33190Sstevel@tonic-gate Eserialize(); 33200Sstevel@tonic-gate 33210Sstevel@tonic-gate while (count > 0 && !interrupt) { 33220Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 33230Sstevel@tonic-gate 33240Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 33250Sstevel@tonic-gate break; 33260Sstevel@tonic-gate 33270Sstevel@tonic-gate dp = (struct dirent64 *)&buf[0]; 33280Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 33290Sstevel@tonic-gate break; 33300Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 33310Sstevel@tonic-gate /* getdents() error? */ 33320Sstevel@tonic-gate (void) printf( 33337088Sraf "%s ino=%-5llu off=%-4lld rlen=%-3d\n", 33347088Sraf pri->pname, 33357088Sraf (long long)dp->d_ino, 33367088Sraf (long long)dp->d_off, 33377088Sraf dp->d_reclen); 33380Sstevel@tonic-gate break; 33390Sstevel@tonic-gate } 33400Sstevel@tonic-gate 33410Sstevel@tonic-gate while (!interrupt && 33420Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 33430Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 33440Sstevel@tonic-gate (void) printf( 33457088Sraf "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n", 33467088Sraf pri->pname, 33477088Sraf (long long)dp->d_ino, 33487088Sraf (long long)dp->d_off, 33497088Sraf dp->d_reclen, 33507088Sraf dp->d_reclen - (int)(dp->d_name - (char *)dp), 33517088Sraf dp->d_name); 33520Sstevel@tonic-gate nb -= dp->d_reclen; 33530Sstevel@tonic-gate count -= dp->d_reclen; 33540Sstevel@tonic-gate offset += dp->d_reclen; 33550Sstevel@tonic-gate /* LINTED improper alignment */ 33560Sstevel@tonic-gate dp = (struct dirent64 *)((char *)dp + dp->d_reclen); 33570Sstevel@tonic-gate } 33580Sstevel@tonic-gate } 33590Sstevel@tonic-gate 33600Sstevel@tonic-gate /* exit region of lengthy output */ 33610Sstevel@tonic-gate if (serial) 33620Sstevel@tonic-gate Xserialize(); 33630Sstevel@tonic-gate } 33640Sstevel@tonic-gate 33650Sstevel@tonic-gate void 33660Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset) 33670Sstevel@tonic-gate { 33680Sstevel@tonic-gate struct rlimit32 rlimit; 33690Sstevel@tonic-gate 33700Sstevel@tonic-gate if (offset != NULL && 33710Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 33720Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 33730Sstevel@tonic-gate switch (rlimit.rlim_cur) { 33740Sstevel@tonic-gate case RLIM32_INFINITY: 33750Sstevel@tonic-gate (void) fputs("cur = RLIM_INFINITY", stdout); 33760Sstevel@tonic-gate break; 33770Sstevel@tonic-gate case RLIM32_SAVED_MAX: 33780Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_MAX", stdout); 33790Sstevel@tonic-gate break; 33800Sstevel@tonic-gate case RLIM32_SAVED_CUR: 33810Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_CUR", stdout); 33820Sstevel@tonic-gate break; 33830Sstevel@tonic-gate default: 33840Sstevel@tonic-gate (void) printf("cur = %lu", (long)rlimit.rlim_cur); 33850Sstevel@tonic-gate break; 33860Sstevel@tonic-gate } 33870Sstevel@tonic-gate switch (rlimit.rlim_max) { 33880Sstevel@tonic-gate case RLIM32_INFINITY: 33890Sstevel@tonic-gate (void) fputs(" max = RLIM_INFINITY\n", stdout); 33900Sstevel@tonic-gate break; 33910Sstevel@tonic-gate case RLIM32_SAVED_MAX: 33920Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_MAX\n", stdout); 33930Sstevel@tonic-gate break; 33940Sstevel@tonic-gate case RLIM32_SAVED_CUR: 33950Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_CUR\n", stdout); 33960Sstevel@tonic-gate break; 33970Sstevel@tonic-gate default: 33980Sstevel@tonic-gate (void) printf(" max = %lu\n", (long)rlimit.rlim_max); 33990Sstevel@tonic-gate break; 34000Sstevel@tonic-gate } 34010Sstevel@tonic-gate } 34020Sstevel@tonic-gate } 34030Sstevel@tonic-gate 34040Sstevel@tonic-gate void 34050Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset) 34060Sstevel@tonic-gate { 34070Sstevel@tonic-gate struct rlimit64 rlimit; 34080Sstevel@tonic-gate 34090Sstevel@tonic-gate if (offset != NULL && 34100Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 34110Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 34120Sstevel@tonic-gate switch (rlimit.rlim_cur) { 34130Sstevel@tonic-gate case RLIM64_INFINITY: 34140Sstevel@tonic-gate (void) fputs("cur = RLIM64_INFINITY", stdout); 34150Sstevel@tonic-gate break; 34160Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34170Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_MAX", stdout); 34180Sstevel@tonic-gate break; 34190Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34200Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_CUR", stdout); 34210Sstevel@tonic-gate break; 34220Sstevel@tonic-gate default: 34230Sstevel@tonic-gate (void) printf("cur = %llu", 34240Sstevel@tonic-gate (unsigned long long)rlimit.rlim_cur); 34250Sstevel@tonic-gate break; 34260Sstevel@tonic-gate } 34270Sstevel@tonic-gate switch (rlimit.rlim_max) { 34280Sstevel@tonic-gate case RLIM64_INFINITY: 34290Sstevel@tonic-gate (void) fputs(" max = RLIM64_INFINITY\n", stdout); 34300Sstevel@tonic-gate break; 34310Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34320Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout); 34330Sstevel@tonic-gate break; 34340Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34350Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout); 34360Sstevel@tonic-gate break; 34370Sstevel@tonic-gate default: 34380Sstevel@tonic-gate (void) printf(" max = %llu\n", 34390Sstevel@tonic-gate (unsigned long long)rlimit.rlim_max); 34400Sstevel@tonic-gate break; 34410Sstevel@tonic-gate } 34420Sstevel@tonic-gate } 34430Sstevel@tonic-gate } 34440Sstevel@tonic-gate 34450Sstevel@tonic-gate void 34460Sstevel@tonic-gate show_nuname(private_t *pri, long offset) 34470Sstevel@tonic-gate { 34480Sstevel@tonic-gate struct utsname ubuf; 34490Sstevel@tonic-gate 34500Sstevel@tonic-gate if (offset != NULL && 34510Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 34520Sstevel@tonic-gate (void) printf( 34537088Sraf "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n", 34547088Sraf pri->pname, 34557088Sraf ubuf.sysname, 34567088Sraf ubuf.nodename, 34577088Sraf ubuf.release, 34587088Sraf ubuf.version, 34597088Sraf ubuf.machine); 34600Sstevel@tonic-gate } 34610Sstevel@tonic-gate } 34620Sstevel@tonic-gate 34630Sstevel@tonic-gate void 34640Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2) 34650Sstevel@tonic-gate { 34660Sstevel@tonic-gate show_timeval(pri, off1, " delta"); 34670Sstevel@tonic-gate show_timeval(pri, off2, "olddelta"); 34680Sstevel@tonic-gate } 34690Sstevel@tonic-gate 34700Sstevel@tonic-gate void 34710Sstevel@tonic-gate show_sockaddr(private_t *pri, 34720Sstevel@tonic-gate const char *str, long addroff, long lenoff, long len) 34730Sstevel@tonic-gate { 34740Sstevel@tonic-gate /* 34750Sstevel@tonic-gate * A buffer large enough for PATH_MAX size AF_UNIX address, which is 34760Sstevel@tonic-gate * also large enough to store a sockaddr_in or a sockaddr_in6. 34770Sstevel@tonic-gate */ 34780Sstevel@tonic-gate long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1) 34797088Sraf / sizeof (long)]; 34800Sstevel@tonic-gate struct sockaddr *sa = (struct sockaddr *)buf; 34810Sstevel@tonic-gate struct sockaddr_in *sin = (struct sockaddr_in *)buf; 34820Sstevel@tonic-gate struct sockaddr_un *soun = (struct sockaddr_un *)buf; 34830Sstevel@tonic-gate struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf; 34840Sstevel@tonic-gate char addrbuf[INET6_ADDRSTRLEN]; 34850Sstevel@tonic-gate 34860Sstevel@tonic-gate if (lenoff != 0) { 34870Sstevel@tonic-gate uint_t ilen; 34880Sstevel@tonic-gate if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen)) 34890Sstevel@tonic-gate return; 34900Sstevel@tonic-gate len = ilen; 34910Sstevel@tonic-gate } 34920Sstevel@tonic-gate 34930Sstevel@tonic-gate if (len >= sizeof (buf)) /* protect against ridiculous length */ 34940Sstevel@tonic-gate len = sizeof (buf) - 1; 34950Sstevel@tonic-gate if (Pread(Proc, buf, len, addroff) != len) 34960Sstevel@tonic-gate return; 34970Sstevel@tonic-gate 34980Sstevel@tonic-gate switch (sa->sa_family) { 34990Sstevel@tonic-gate case AF_INET6: 35000Sstevel@tonic-gate (void) printf("%s\tAF_INET6 %s = %s port = %u\n", 35010Sstevel@tonic-gate pri->pname, str, 35020Sstevel@tonic-gate inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, 35037088Sraf sizeof (addrbuf)), 35040Sstevel@tonic-gate ntohs(sin6->sin6_port)); 35050Sstevel@tonic-gate (void) printf("%s\tscope id = %u source id = 0x%x\n" 35060Sstevel@tonic-gate "%s\tflow class = 0x%02x flow label = 0x%05x\n", 35070Sstevel@tonic-gate pri->pname, ntohl(sin6->sin6_scope_id), 35080Sstevel@tonic-gate ntohl(sin6->__sin6_src_id), 35090Sstevel@tonic-gate pri->pname, 35100Sstevel@tonic-gate ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20), 35110Sstevel@tonic-gate ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL)); 35120Sstevel@tonic-gate break; 35130Sstevel@tonic-gate case AF_INET: 35140Sstevel@tonic-gate (void) printf("%s\tAF_%s %s = %s port = %u\n", 35151548Srshoaib pri->pname, "INET", 35160Sstevel@tonic-gate str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf, 35170Sstevel@tonic-gate sizeof (addrbuf)), ntohs(sin->sin_port)); 35180Sstevel@tonic-gate break; 35190Sstevel@tonic-gate case AF_UNIX: 35200Sstevel@tonic-gate len -= sizeof (soun->sun_family); 35210Sstevel@tonic-gate if (len >= 0) { 35220Sstevel@tonic-gate /* Null terminate */ 35230Sstevel@tonic-gate soun->sun_path[len] = NULL; 35240Sstevel@tonic-gate (void) printf("%s\tAF_UNIX %s = %s\n", pri->pname, 35257088Sraf str, soun->sun_path); 35260Sstevel@tonic-gate } 35270Sstevel@tonic-gate break; 35280Sstevel@tonic-gate } 35290Sstevel@tonic-gate } 35300Sstevel@tonic-gate 35310Sstevel@tonic-gate void 35320Sstevel@tonic-gate show_msghdr(private_t *pri, long offset) 35330Sstevel@tonic-gate { 3534328Sja97890 const lwpstatus_t *Lsp = pri->lwpstat; 3535328Sja97890 int what = Lsp->pr_what; 3536328Sja97890 int err = pri->Errno; 35370Sstevel@tonic-gate struct msghdr msg; 3538328Sja97890 int showbuf = FALSE; 3539328Sja97890 int i = pri->sys_args[0]+1; 3540328Sja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35410Sstevel@tonic-gate 35420Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35430Sstevel@tonic-gate return; 3544328Sja97890 35450Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 35460Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 35477088Sraf (long)msg.msg_name, 0, (long)msg.msg_namelen); 3548328Sja97890 3549328Sja97890 /* 3550328Sja97890 * Print the iovec if the syscall was successful and the fd is 3551328Sja97890 * part of the set being traced. 3552328Sja97890 */ 3553328Sja97890 if ((what == SYS_recvmsg && !err && 3554328Sja97890 prismember(&readfd, i)) || 3555328Sja97890 (what == SYS_sendmsg && 3556328Sja97890 prismember(&writefd, i))) 3557328Sja97890 showbuf = TRUE; 3558328Sja97890 3559328Sja97890 show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 3560328Sja97890 35610Sstevel@tonic-gate } 35620Sstevel@tonic-gate 35630Sstevel@tonic-gate #ifdef _LP64 35640Sstevel@tonic-gate void 35650Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset) 35660Sstevel@tonic-gate { 35670Sstevel@tonic-gate struct msghdr32 { 35680Sstevel@tonic-gate caddr32_t msg_name; 3569328Sja97890 uint32_t msg_namelen; 3570328Sja97890 caddr32_t msg_iov; 3571328Sja97890 int32_t msg_iovlen; 35720Sstevel@tonic-gate } msg; 3573328Sja97890 const lwpstatus_t *Lsp = pri->lwpstat; 3574328Sja97890 int what = Lsp->pr_what; 3575328Sja97890 int err = pri->Errno; 3576328Sja97890 int showbuf = FALSE; 3577328Sja97890 int i = pri->sys_args[0]+1; 3578328Sja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35790Sstevel@tonic-gate 35800Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35810Sstevel@tonic-gate return; 3582328Sja97890 35830Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 35840Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 35857088Sraf (long)msg.msg_name, 0, (long)msg.msg_namelen); 3586328Sja97890 /* 3587328Sja97890 * Print the iovec if the syscall was successful and the fd is 3588328Sja97890 * part of the set being traced. 3589328Sja97890 */ 3590328Sja97890 if ((what == SYS_recvmsg && !err && 3591328Sja97890 prismember(&readfd, i)) || 3592328Sja97890 (what == SYS_sendmsg && 3593328Sja97890 prismember(&writefd, i))) 3594328Sja97890 showbuf = TRUE; 3595328Sja97890 3596328Sja97890 show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 3597328Sja97890 35980Sstevel@tonic-gate } 35990Sstevel@tonic-gate #endif /* _LP64 */ 36000Sstevel@tonic-gate 36010Sstevel@tonic-gate static void 36020Sstevel@tonic-gate show_doorargs(private_t *pri, long offset) 36030Sstevel@tonic-gate { 36040Sstevel@tonic-gate door_arg_t args; 36050Sstevel@tonic-gate 36060Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 36070Sstevel@tonic-gate (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n", 36080Sstevel@tonic-gate pri->pname, 36090Sstevel@tonic-gate (ulong_t)args.data_ptr, 36100Sstevel@tonic-gate (ulong_t)args.data_size); 36110Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n", 36120Sstevel@tonic-gate pri->pname, 36130Sstevel@tonic-gate (ulong_t)args.desc_ptr, 36140Sstevel@tonic-gate args.desc_num); 36150Sstevel@tonic-gate (void) printf("%s\trbuf=0x%lX rsize=%lu\n", 36160Sstevel@tonic-gate pri->pname, 36170Sstevel@tonic-gate (ulong_t)args.rbuf, 36180Sstevel@tonic-gate (ulong_t)args.rsize); 36190Sstevel@tonic-gate } 36200Sstevel@tonic-gate } 36210Sstevel@tonic-gate 36220Sstevel@tonic-gate static void 36230Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc) 36240Sstevel@tonic-gate { 36250Sstevel@tonic-gate int i = 0; 36260Sstevel@tonic-gate const priv_set_t *s; 36270Sstevel@tonic-gate priv_ptype_t sn; 36280Sstevel@tonic-gate char *str; 36290Sstevel@tonic-gate 36300Sstevel@tonic-gate while ((sn = priv_getsetbynum(i++)) != NULL) { 36310Sstevel@tonic-gate s = ucred_getprivset(uc, sn); 36320Sstevel@tonic-gate 36330Sstevel@tonic-gate if (s == NULL) 36340Sstevel@tonic-gate continue; 36350Sstevel@tonic-gate 36360Sstevel@tonic-gate (void) printf("%s\t%c: %s\n", 36370Sstevel@tonic-gate pri->pname, 36380Sstevel@tonic-gate *sn, 36390Sstevel@tonic-gate str = priv_set_to_str(s, ',', PRIV_STR_SHORT)); 36400Sstevel@tonic-gate 36410Sstevel@tonic-gate free(str); 36420Sstevel@tonic-gate } 36430Sstevel@tonic-gate } 36440Sstevel@tonic-gate 36450Sstevel@tonic-gate static void 36460Sstevel@tonic-gate show_ucred(private_t *pri, long offset) 36470Sstevel@tonic-gate { 36480Sstevel@tonic-gate ucred_t *uc = _ucred_alloc(); 36490Sstevel@tonic-gate size_t sz; 36500Sstevel@tonic-gate 36510Sstevel@tonic-gate if (uc == NULL) 36520Sstevel@tonic-gate return; 36530Sstevel@tonic-gate 36540Sstevel@tonic-gate sz = Pread(Proc, uc, uc->uc_size, offset); 36550Sstevel@tonic-gate 36560Sstevel@tonic-gate /* 36570Sstevel@tonic-gate * A new uc_size is read, it could be smaller than the previously 36580Sstevel@tonic-gate * value. We accept short reads that fill the whole header. 36590Sstevel@tonic-gate */ 36600Sstevel@tonic-gate if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) { 36614321Scasper (void) printf("%s\teuid=%u egid=%u\n", 36620Sstevel@tonic-gate pri->pname, 36634321Scasper ucred_geteuid(uc), 36644321Scasper ucred_getegid(uc)); 36654321Scasper (void) printf("%s\truid=%u rgid=%u\n", 36660Sstevel@tonic-gate pri->pname, 36674321Scasper ucred_getruid(uc), 36684321Scasper ucred_getrgid(uc)); 36690Sstevel@tonic-gate (void) printf("%s\tpid=%d zoneid=%d\n", 36700Sstevel@tonic-gate pri->pname, 36710Sstevel@tonic-gate (int)ucred_getpid(uc), 36720Sstevel@tonic-gate (int)ucred_getzoneid(uc)); 36730Sstevel@tonic-gate show_ucred_privsets(pri, uc); 36740Sstevel@tonic-gate } 36750Sstevel@tonic-gate ucred_free(uc); 36760Sstevel@tonic-gate } 36770Sstevel@tonic-gate 36780Sstevel@tonic-gate static void 3679813Sdp show_privset(private_t *pri, long offset, size_t size, char *label) 36800Sstevel@tonic-gate { 36810Sstevel@tonic-gate priv_set_t *tmp = priv_allocset(); 36820Sstevel@tonic-gate size_t sz; 36830Sstevel@tonic-gate 36840Sstevel@tonic-gate if (tmp == NULL) 36850Sstevel@tonic-gate return; 36860Sstevel@tonic-gate 36870Sstevel@tonic-gate sz = Pread(Proc, tmp, size, offset); 36880Sstevel@tonic-gate 36890Sstevel@tonic-gate if (sz == size) { 36900Sstevel@tonic-gate char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT); 36910Sstevel@tonic-gate if (str != NULL) { 3692813Sdp (void) printf("%s\t%s%s\n", pri->pname, label, str); 36930Sstevel@tonic-gate free(str); 36940Sstevel@tonic-gate } 36950Sstevel@tonic-gate } 36960Sstevel@tonic-gate priv_freeset(tmp); 36970Sstevel@tonic-gate } 36980Sstevel@tonic-gate 36990Sstevel@tonic-gate static void 37000Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset) 37010Sstevel@tonic-gate { 37020Sstevel@tonic-gate door_info_t info; 37030Sstevel@tonic-gate door_attr_t attr; 37040Sstevel@tonic-gate 37050Sstevel@tonic-gate if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info)) 37060Sstevel@tonic-gate return; 37070Sstevel@tonic-gate (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n", 37080Sstevel@tonic-gate pri->pname, 37090Sstevel@tonic-gate (int)info.di_target, 37100Sstevel@tonic-gate info.di_proc, 37110Sstevel@tonic-gate info.di_data); 37120Sstevel@tonic-gate attr = info.di_attributes; 37130Sstevel@tonic-gate (void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr)); 37140Sstevel@tonic-gate (void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier); 37150Sstevel@tonic-gate } 37160Sstevel@tonic-gate 37170Sstevel@tonic-gate static void 37180Sstevel@tonic-gate show_doorparam(private_t *pri, long offset) 37190Sstevel@tonic-gate { 37200Sstevel@tonic-gate ulong_t val; 37210Sstevel@tonic-gate 37220Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37230Sstevel@tonic-gate (void) printf("%s\tvalue=%lu\n", 37240Sstevel@tonic-gate pri->pname, 37250Sstevel@tonic-gate val); 37260Sstevel@tonic-gate } 37270Sstevel@tonic-gate } 37280Sstevel@tonic-gate 37290Sstevel@tonic-gate #ifdef _LP64 37300Sstevel@tonic-gate 37310Sstevel@tonic-gate static void 37320Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset) 37330Sstevel@tonic-gate { 37340Sstevel@tonic-gate struct door_arg32 args; 37350Sstevel@tonic-gate 37360Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 37370Sstevel@tonic-gate (void) printf("%s\tdata_ptr=%X data_size=%u\n", 37380Sstevel@tonic-gate pri->pname, 37390Sstevel@tonic-gate args.data_ptr, 37400Sstevel@tonic-gate args.data_size); 37410Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n", 37420Sstevel@tonic-gate pri->pname, 37430Sstevel@tonic-gate args.desc_ptr, 37440Sstevel@tonic-gate args.desc_num); 37450Sstevel@tonic-gate (void) printf("%s\trbuf=0x%X rsize=%u\n", 37460Sstevel@tonic-gate pri->pname, 37470Sstevel@tonic-gate args.rbuf, 37480Sstevel@tonic-gate args.rsize); 37490Sstevel@tonic-gate } 37500Sstevel@tonic-gate } 37510Sstevel@tonic-gate 37520Sstevel@tonic-gate static void 37530Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset) 37540Sstevel@tonic-gate { 37550Sstevel@tonic-gate uint_t val; 37560Sstevel@tonic-gate 37570Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37580Sstevel@tonic-gate (void) printf("%s\tvalue=%u\n", 37590Sstevel@tonic-gate pri->pname, 37600Sstevel@tonic-gate val); 37610Sstevel@tonic-gate } 37620Sstevel@tonic-gate } 37630Sstevel@tonic-gate 37640Sstevel@tonic-gate #endif /* _LP64 */ 37650Sstevel@tonic-gate 37660Sstevel@tonic-gate static void 37670Sstevel@tonic-gate show_doors(private_t *pri) 37680Sstevel@tonic-gate { 37690Sstevel@tonic-gate switch (pri->sys_args[5]) { 37700Sstevel@tonic-gate case DOOR_CALL: 37710Sstevel@tonic-gate #ifdef _LP64 37720Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 37730Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37740Sstevel@tonic-gate else 37750Sstevel@tonic-gate show_doorargs32(pri, (long)pri->sys_args[1]); 37760Sstevel@tonic-gate #else 37770Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37780Sstevel@tonic-gate #endif 37790Sstevel@tonic-gate break; 37800Sstevel@tonic-gate case DOOR_UCRED: 37810Sstevel@tonic-gate if (!pri->Errno) 37820Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[0]); 37830Sstevel@tonic-gate break; 37840Sstevel@tonic-gate case DOOR_INFO: 37850Sstevel@tonic-gate if (!pri->Errno) 37860Sstevel@tonic-gate show_doorinfo(pri, (long)pri->sys_args[1]); 37870Sstevel@tonic-gate break; 37880Sstevel@tonic-gate case DOOR_GETPARAM: 37890Sstevel@tonic-gate if (!pri->Errno) { 37900Sstevel@tonic-gate #ifdef _LP64 37910Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 37920Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 37930Sstevel@tonic-gate else 37940Sstevel@tonic-gate show_doorparam32(pri, (long)pri->sys_args[2]); 37950Sstevel@tonic-gate #else 37960Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 37970Sstevel@tonic-gate #endif 37980Sstevel@tonic-gate } 37990Sstevel@tonic-gate break; 38000Sstevel@tonic-gate } 38010Sstevel@tonic-gate } 38020Sstevel@tonic-gate 38030Sstevel@tonic-gate static void 38040Sstevel@tonic-gate show_portargs(private_t *pri, long offset) 38050Sstevel@tonic-gate { 38060Sstevel@tonic-gate port_event_t args; 38070Sstevel@tonic-gate 38080Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38090Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38100Sstevel@tonic-gate pri->pname, 38110Sstevel@tonic-gate args.portev_events, 38120Sstevel@tonic-gate args.portev_source); 38130Sstevel@tonic-gate (void) printf("%s\tobject=0x%p user=0x%p\n", 38140Sstevel@tonic-gate pri->pname, 38150Sstevel@tonic-gate (void *)args.portev_object, 38160Sstevel@tonic-gate (void *)args.portev_user); 38170Sstevel@tonic-gate } 38180Sstevel@tonic-gate } 38190Sstevel@tonic-gate 38200Sstevel@tonic-gate 38210Sstevel@tonic-gate #ifdef _LP64 38220Sstevel@tonic-gate 38230Sstevel@tonic-gate static void 38240Sstevel@tonic-gate show_portargs32(private_t *pri, long offset) 38250Sstevel@tonic-gate { 38260Sstevel@tonic-gate port_event32_t args; 38270Sstevel@tonic-gate 38280Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38290Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38300Sstevel@tonic-gate pri->pname, 38310Sstevel@tonic-gate args.portev_events, 38320Sstevel@tonic-gate args.portev_source); 38330Sstevel@tonic-gate (void) printf("%s\tobject=0x%x user=0x%x\n", 38340Sstevel@tonic-gate pri->pname, 38350Sstevel@tonic-gate args.portev_object, 38360Sstevel@tonic-gate args.portev_user); 38370Sstevel@tonic-gate } 38380Sstevel@tonic-gate } 38390Sstevel@tonic-gate 38400Sstevel@tonic-gate #endif /* _LP64 */ 38410Sstevel@tonic-gate 38420Sstevel@tonic-gate static void 38430Sstevel@tonic-gate show_ports(private_t *pri) 38440Sstevel@tonic-gate { 38450Sstevel@tonic-gate switch (pri->sys_args[0]) { 38460Sstevel@tonic-gate case PORT_GET: 38470Sstevel@tonic-gate #ifdef _LP64 38480Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 38490Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38500Sstevel@tonic-gate else 38510Sstevel@tonic-gate show_portargs32(pri, (long)pri->sys_args[2]); 38520Sstevel@tonic-gate #else 38530Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38540Sstevel@tonic-gate #endif 38550Sstevel@tonic-gate break; 38560Sstevel@tonic-gate } 38570Sstevel@tonic-gate } 38580Sstevel@tonic-gate 38590Sstevel@tonic-gate #define MAX_SNDFL_PRD 16 38600Sstevel@tonic-gate 38610Sstevel@tonic-gate #ifdef _LP64 38620Sstevel@tonic-gate 38630Sstevel@tonic-gate static void 38640Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd, 38650Sstevel@tonic-gate ksendfilevec32_t *sndvec, int sfvcnt) 38660Sstevel@tonic-gate { 38670Sstevel@tonic-gate ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD]; 38680Sstevel@tonic-gate size_t cpy_rqst; 38690Sstevel@tonic-gate 38700Sstevel@tonic-gate Eserialize(); 38710Sstevel@tonic-gate while (sfvcnt > 0) { 38720Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 38730Sstevel@tonic-gate sfvcnt -= cpy_rqst; 38740Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 38750Sstevel@tonic-gate 38760Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 38770Sstevel@tonic-gate break; 38780Sstevel@tonic-gate 38790Sstevel@tonic-gate snd_ptr = &snd[0]; 38800Sstevel@tonic-gate 38810Sstevel@tonic-gate while (cpy_rqst) { 38820Sstevel@tonic-gate (void) printf( 38830Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 38840Sstevel@tonic-gate "sfv_off=%d\tsfv_len=%u\n", 38850Sstevel@tonic-gate snd_ptr->sfv_fd, 38860Sstevel@tonic-gate snd_ptr->sfv_flag, 38870Sstevel@tonic-gate snd_ptr->sfv_off, 38880Sstevel@tonic-gate snd_ptr->sfv_len); 38890Sstevel@tonic-gate 38900Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 38910Sstevel@tonic-gate prismember(&writefd, fd)) { 38920Sstevel@tonic-gate showbuffer(pri, 38930Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 38940Sstevel@tonic-gate (long)snd_ptr->sfv_len); 38950Sstevel@tonic-gate } 38960Sstevel@tonic-gate 38970Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 38980Sstevel@tonic-gate snd_ptr++; 38990Sstevel@tonic-gate } 39000Sstevel@tonic-gate 39010Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39020Sstevel@tonic-gate } 39030Sstevel@tonic-gate Xserialize(); 39040Sstevel@tonic-gate } 39050Sstevel@tonic-gate 39060Sstevel@tonic-gate static void 39070Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd, 39080Sstevel@tonic-gate ksendfilevec64_t *sndvec, int sfvcnt) 39090Sstevel@tonic-gate { 39100Sstevel@tonic-gate ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39110Sstevel@tonic-gate size_t cpy_rqst; 39120Sstevel@tonic-gate 39130Sstevel@tonic-gate Eserialize(); 39140Sstevel@tonic-gate while (sfvcnt > 0) { 39150Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39160Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39170Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39180Sstevel@tonic-gate 39190Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39200Sstevel@tonic-gate break; 39210Sstevel@tonic-gate 39220Sstevel@tonic-gate snd_ptr = &snd[0]; 39230Sstevel@tonic-gate 39240Sstevel@tonic-gate while (cpy_rqst) { 39250Sstevel@tonic-gate (void) printf( 39260Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39270Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%u\n", 39280Sstevel@tonic-gate snd_ptr->sfv_fd, 39290Sstevel@tonic-gate snd_ptr->sfv_flag, 39300Sstevel@tonic-gate snd_ptr->sfv_off, 39310Sstevel@tonic-gate snd_ptr->sfv_len); 39320Sstevel@tonic-gate 39330Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39340Sstevel@tonic-gate prismember(&writefd, fd)) { 39350Sstevel@tonic-gate showbuffer(pri, 39360Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 39370Sstevel@tonic-gate (long)snd_ptr->sfv_len); 39380Sstevel@tonic-gate } 39390Sstevel@tonic-gate 39400Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39410Sstevel@tonic-gate snd_ptr++; 39420Sstevel@tonic-gate } 39430Sstevel@tonic-gate 39440Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39450Sstevel@tonic-gate } 39460Sstevel@tonic-gate Xserialize(); 39470Sstevel@tonic-gate } 39480Sstevel@tonic-gate 39490Sstevel@tonic-gate #endif /* _LP64 */ 39500Sstevel@tonic-gate 39510Sstevel@tonic-gate /*ARGSUSED*/ 39520Sstevel@tonic-gate static void 39530Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt) 39540Sstevel@tonic-gate { 39550Sstevel@tonic-gate sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39560Sstevel@tonic-gate size_t cpy_rqst; 39570Sstevel@tonic-gate 39580Sstevel@tonic-gate #ifdef _LP64 39590Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 39600Sstevel@tonic-gate show_ksendfilevec32(pri, fd, 39610Sstevel@tonic-gate (ksendfilevec32_t *)sndvec, sfvcnt); 39620Sstevel@tonic-gate return; 39630Sstevel@tonic-gate } 39640Sstevel@tonic-gate #endif 39650Sstevel@tonic-gate Eserialize(); 39660Sstevel@tonic-gate while (sfvcnt > 0) { 39670Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39680Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39690Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39700Sstevel@tonic-gate 39710Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39720Sstevel@tonic-gate break; 39730Sstevel@tonic-gate 39740Sstevel@tonic-gate snd_ptr = &snd[0]; 39750Sstevel@tonic-gate 39760Sstevel@tonic-gate while (cpy_rqst) { 39770Sstevel@tonic-gate (void) printf( 39780Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39790Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 39800Sstevel@tonic-gate snd_ptr->sfv_fd, 39810Sstevel@tonic-gate snd_ptr->sfv_flag, 39820Sstevel@tonic-gate snd_ptr->sfv_off, 39830Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 39840Sstevel@tonic-gate 39850Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39860Sstevel@tonic-gate prismember(&writefd, fd)) { 39870Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 39887088Sraf (long)snd_ptr->sfv_len); 39890Sstevel@tonic-gate } 39900Sstevel@tonic-gate 39910Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39920Sstevel@tonic-gate snd_ptr++; 39930Sstevel@tonic-gate } 39940Sstevel@tonic-gate 39950Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39960Sstevel@tonic-gate } 39970Sstevel@tonic-gate Xserialize(); 39980Sstevel@tonic-gate } 39990Sstevel@tonic-gate 40000Sstevel@tonic-gate /*ARGSUSED*/ 40010Sstevel@tonic-gate static void 40020Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt) 40030Sstevel@tonic-gate { 40040Sstevel@tonic-gate sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 40050Sstevel@tonic-gate size_t cpy_rqst; 40060Sstevel@tonic-gate 40070Sstevel@tonic-gate #ifdef _LP64 40080Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 40090Sstevel@tonic-gate show_ksendfilevec64(pri, fd, 40100Sstevel@tonic-gate (ksendfilevec64_t *)sndvec, sfvcnt); 40110Sstevel@tonic-gate return; 40120Sstevel@tonic-gate } 40130Sstevel@tonic-gate #endif 40140Sstevel@tonic-gate 40150Sstevel@tonic-gate Eserialize(); 40160Sstevel@tonic-gate while (sfvcnt > 0) { 40170Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 40180Sstevel@tonic-gate sfvcnt -= cpy_rqst; 40190Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 40200Sstevel@tonic-gate 40210Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 40220Sstevel@tonic-gate break; 40230Sstevel@tonic-gate 40240Sstevel@tonic-gate snd_ptr = &snd[0]; 40250Sstevel@tonic-gate 40260Sstevel@tonic-gate while (cpy_rqst) { 40270Sstevel@tonic-gate (void) printf( 40280Sstevel@tonic-gate #ifdef _LP64 40290Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40300Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 40310Sstevel@tonic-gate #else 40320Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40330Sstevel@tonic-gate "sfv_off=%lld\tsfv_len=%lu\n", 40340Sstevel@tonic-gate #endif 40350Sstevel@tonic-gate snd_ptr->sfv_fd, 40360Sstevel@tonic-gate snd_ptr->sfv_flag, 40370Sstevel@tonic-gate snd_ptr->sfv_off, 40380Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 40390Sstevel@tonic-gate 40400Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 40410Sstevel@tonic-gate prismember(&writefd, fd)) { 40420Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 40437088Sraf (long)snd_ptr->sfv_len); 40440Sstevel@tonic-gate } 40450Sstevel@tonic-gate 40460Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 40470Sstevel@tonic-gate snd_ptr++; 40480Sstevel@tonic-gate } 40490Sstevel@tonic-gate 40500Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 40510Sstevel@tonic-gate } 40520Sstevel@tonic-gate Xserialize(); 40530Sstevel@tonic-gate } 40540Sstevel@tonic-gate 40550Sstevel@tonic-gate static void 40560Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset) 40570Sstevel@tonic-gate { 40580Sstevel@tonic-gate struct memcntl_mha mha; 40590Sstevel@tonic-gate const char *s = NULL; 40600Sstevel@tonic-gate 40610Sstevel@tonic-gate if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) { 40620Sstevel@tonic-gate switch (mha.mha_cmd) { 40630Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 40640Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 40650Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 40660Sstevel@tonic-gate } 40670Sstevel@tonic-gate if (s) 40680Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 40690Sstevel@tonic-gate " mha_pagesize=%lu\n", 40700Sstevel@tonic-gate pri->pname, s, mha.mha_flags, 40710Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40720Sstevel@tonic-gate else 40730Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 40740Sstevel@tonic-gate " mha_pagesize=%lu\n", 40750Sstevel@tonic-gate pri->pname, mha.mha_cmd, mha.mha_flags, 40760Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40770Sstevel@tonic-gate } 40780Sstevel@tonic-gate } 40790Sstevel@tonic-gate 40800Sstevel@tonic-gate #ifdef _LP64 40810Sstevel@tonic-gate 40820Sstevel@tonic-gate static void 40830Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset) 40840Sstevel@tonic-gate { 40850Sstevel@tonic-gate struct memcntl_mha32 mha32; 40860Sstevel@tonic-gate const char *s = NULL; 40870Sstevel@tonic-gate 40880Sstevel@tonic-gate if (Pread(Proc, &mha32, sizeof (mha32), offset) == 40890Sstevel@tonic-gate sizeof (mha32)) { 40900Sstevel@tonic-gate switch (mha32.mha_cmd) { 40910Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 40920Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 40930Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 40940Sstevel@tonic-gate } 40950Sstevel@tonic-gate if (s) 40960Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 40970Sstevel@tonic-gate " mha_pagesize=%u\n", 40980Sstevel@tonic-gate pri->pname, s, mha32.mha_flags, mha32.mha_pagesize); 40990Sstevel@tonic-gate else 41000Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 41010Sstevel@tonic-gate " mha_pagesize=%u\n", 41020Sstevel@tonic-gate pri->pname, mha32.mha_cmd, mha32.mha_flags, 41030Sstevel@tonic-gate mha32.mha_pagesize); 41040Sstevel@tonic-gate } 41050Sstevel@tonic-gate } 41060Sstevel@tonic-gate 41070Sstevel@tonic-gate #endif /* _LP64 */ 41080Sstevel@tonic-gate 41090Sstevel@tonic-gate static void 41100Sstevel@tonic-gate show_memcntl(private_t *pri) 41110Sstevel@tonic-gate { 41120Sstevel@tonic-gate 41130Sstevel@tonic-gate if ((int)pri->sys_args[2] != MC_HAT_ADVISE) 41140Sstevel@tonic-gate return; 41150Sstevel@tonic-gate #ifdef _LP64 41160Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 41170Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41180Sstevel@tonic-gate else 41190Sstevel@tonic-gate show_memcntl_mha32(pri, (long)pri->sys_args[3]); 41200Sstevel@tonic-gate #else 41210Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41220Sstevel@tonic-gate #endif 41230Sstevel@tonic-gate } 41240Sstevel@tonic-gate 41250Sstevel@tonic-gate void 41260Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count) 41270Sstevel@tonic-gate { 41280Sstevel@tonic-gate id_t buf[MYBUFSIZ / sizeof (id_t)]; 41290Sstevel@tonic-gate id_t *idp; 41300Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 48); 41310Sstevel@tonic-gate 413210440SRoger.Faulkner@Sun.COM if (offset == 0) 41330Sstevel@tonic-gate return; 41340Sstevel@tonic-gate 41350Sstevel@tonic-gate /* enter region of lengthy output */ 41360Sstevel@tonic-gate if (serial) 41370Sstevel@tonic-gate Eserialize(); 41380Sstevel@tonic-gate 41390Sstevel@tonic-gate while (count > 0 && !interrupt) { 41400Sstevel@tonic-gate ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)? 41417088Sraf count * sizeof (id_t) : MYBUFSIZ; 41420Sstevel@tonic-gate 41430Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 || 41440Sstevel@tonic-gate nb < sizeof (id_t)) 41450Sstevel@tonic-gate break; 41460Sstevel@tonic-gate 41470Sstevel@tonic-gate idp = buf; 41480Sstevel@tonic-gate while (!interrupt && nb >= sizeof (id_t)) { 41490Sstevel@tonic-gate (void) printf("%s\t%8d\n", pri->pname, (int)*idp); 41500Sstevel@tonic-gate offset += sizeof (id_t); 41510Sstevel@tonic-gate nb -= sizeof (id_t); 41520Sstevel@tonic-gate idp++; 41530Sstevel@tonic-gate count--; 41540Sstevel@tonic-gate } 41550Sstevel@tonic-gate } 41560Sstevel@tonic-gate 41570Sstevel@tonic-gate /* exit region of lengthy output */ 41580Sstevel@tonic-gate if (serial) 41590Sstevel@tonic-gate Xserialize(); 41600Sstevel@tonic-gate } 41610Sstevel@tonic-gate 41620Sstevel@tonic-gate void 41630Sstevel@tonic-gate show_ntp_gettime(private_t *pri) 41640Sstevel@tonic-gate { 41650Sstevel@tonic-gate struct ntptimeval ntv; 41660Sstevel@tonic-gate long offset; 41670Sstevel@tonic-gate 41680Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 41690Sstevel@tonic-gate return; 41700Sstevel@tonic-gate 41710Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 41720Sstevel@tonic-gate if (Pread(Proc, &ntv, sizeof (ntv), offset) 41730Sstevel@tonic-gate != sizeof (ntv)) 41740Sstevel@tonic-gate return; 41750Sstevel@tonic-gate } else { 41760Sstevel@tonic-gate struct ntptimeval32 ntv32; 41770Sstevel@tonic-gate 41780Sstevel@tonic-gate if (Pread(Proc, &ntv32, sizeof (ntv32), offset) 41790Sstevel@tonic-gate != sizeof (ntv32)) 41800Sstevel@tonic-gate return; 41810Sstevel@tonic-gate 41820Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time); 41830Sstevel@tonic-gate ntv.maxerror = ntv32.maxerror; 41840Sstevel@tonic-gate ntv.esterror = ntv32.esterror; 41850Sstevel@tonic-gate } 41860Sstevel@tonic-gate 41870Sstevel@tonic-gate (void) printf("\ttime: %ld.%6.6ld sec\n", 41880Sstevel@tonic-gate ntv.time.tv_sec, ntv.time.tv_usec); 41890Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", ntv.maxerror); 41900Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", ntv.esterror); 41910Sstevel@tonic-gate } 41920Sstevel@tonic-gate 41930Sstevel@tonic-gate static char * 41940Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val) 41950Sstevel@tonic-gate { 41960Sstevel@tonic-gate char *str = pri->code_buf; 41970Sstevel@tonic-gate size_t used = 0; 41980Sstevel@tonic-gate 41990Sstevel@tonic-gate *str = '\0'; 42000Sstevel@tonic-gate if (val & MOD_OFFSET) 42010Sstevel@tonic-gate used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf)); 42020Sstevel@tonic-gate if (val & MOD_FREQUENCY) 42030Sstevel@tonic-gate used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf)); 42040Sstevel@tonic-gate if (val & MOD_MAXERROR) 42050Sstevel@tonic-gate used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf)); 42060Sstevel@tonic-gate if (val & MOD_ESTERROR) 42070Sstevel@tonic-gate used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf)); 42080Sstevel@tonic-gate if (val & MOD_STATUS) 42090Sstevel@tonic-gate used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf)); 42100Sstevel@tonic-gate if (val & MOD_TIMECONST) 42110Sstevel@tonic-gate used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf)); 42120Sstevel@tonic-gate if (val & MOD_CLKB) 42130Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf)); 42140Sstevel@tonic-gate if (val & MOD_CLKA) 42150Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf)); 42160Sstevel@tonic-gate 42170Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42180Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42190Sstevel@tonic-gate 42200Sstevel@tonic-gate return (str + 1); 42210Sstevel@tonic-gate } 42220Sstevel@tonic-gate 42230Sstevel@tonic-gate static char * 42240Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val) 42250Sstevel@tonic-gate { 42260Sstevel@tonic-gate char *str = pri->code_buf; 42270Sstevel@tonic-gate size_t used = 0; 42280Sstevel@tonic-gate 42290Sstevel@tonic-gate *str = '\0'; 42300Sstevel@tonic-gate if (val & STA_PLL) 42310Sstevel@tonic-gate used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf)); 42320Sstevel@tonic-gate if (val & STA_PPSFREQ) 42330Sstevel@tonic-gate used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf)); 42340Sstevel@tonic-gate if (val & STA_PPSTIME) 42350Sstevel@tonic-gate used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf)); 42360Sstevel@tonic-gate if (val & STA_FLL) 42370Sstevel@tonic-gate used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf)); 42380Sstevel@tonic-gate 42390Sstevel@tonic-gate if (val & STA_INS) 42400Sstevel@tonic-gate used = strlcat(str, "|STA_INS", sizeof (pri->code_buf)); 42410Sstevel@tonic-gate if (val & STA_DEL) 42420Sstevel@tonic-gate used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf)); 42430Sstevel@tonic-gate if (val & STA_UNSYNC) 42440Sstevel@tonic-gate used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf)); 42450Sstevel@tonic-gate if (val & STA_FREQHOLD) 42460Sstevel@tonic-gate used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf)); 42470Sstevel@tonic-gate 42480Sstevel@tonic-gate if (val & STA_PPSSIGNAL) 42490Sstevel@tonic-gate used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf)); 42500Sstevel@tonic-gate if (val & STA_PPSJITTER) 42510Sstevel@tonic-gate used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf)); 42520Sstevel@tonic-gate if (val & STA_PPSWANDER) 42530Sstevel@tonic-gate used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf)); 42540Sstevel@tonic-gate if (val & STA_PPSERROR) 42550Sstevel@tonic-gate used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf)); 42560Sstevel@tonic-gate 42570Sstevel@tonic-gate if (val & STA_CLOCKERR) 42580Sstevel@tonic-gate used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf)); 42590Sstevel@tonic-gate 42600Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42610Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42620Sstevel@tonic-gate 42630Sstevel@tonic-gate return (str + 1); 42640Sstevel@tonic-gate } 42650Sstevel@tonic-gate 42660Sstevel@tonic-gate void 42670Sstevel@tonic-gate show_ntp_adjtime(private_t *pri) 42680Sstevel@tonic-gate { 42690Sstevel@tonic-gate struct timex timex; 42700Sstevel@tonic-gate long offset; 42710Sstevel@tonic-gate 42720Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 42730Sstevel@tonic-gate return; 42740Sstevel@tonic-gate 42750Sstevel@tonic-gate if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex)) 42760Sstevel@tonic-gate return; 42770Sstevel@tonic-gate 42780Sstevel@tonic-gate (void) printf("\tmodes: %s\n", get_timex_modes(pri, timex.modes)); 42790Sstevel@tonic-gate (void) printf("\toffset: %11d usec\n", timex.offset); 42800Sstevel@tonic-gate (void) printf("\tfreq: %11d scaled ppm\n", timex.freq); 42810Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", timex.maxerror); 42820Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", timex.esterror); 42830Sstevel@tonic-gate (void) printf("\tstatus: %s\n", get_timex_status(pri, timex.status)); 42840Sstevel@tonic-gate (void) printf("\tconstant: %11d\n", timex.constant); 42850Sstevel@tonic-gate (void) printf("\tprecision: %11d usec\n", timex.precision); 42860Sstevel@tonic-gate (void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance); 42870Sstevel@tonic-gate (void) printf("\tppsfreq: %11d scaled ppm\n", timex.ppsfreq); 42880Sstevel@tonic-gate (void) printf("\tjitter: %11d usec\n", timex.jitter); 42890Sstevel@tonic-gate (void) printf("\tshift: %11d sec\n", timex.shift); 42900Sstevel@tonic-gate (void) printf("\tstabil: %11d scaled ppm\n", timex.stabil); 42910Sstevel@tonic-gate (void) printf("\tjitcnt: %11d\n", timex.jitcnt); 42920Sstevel@tonic-gate (void) printf("\tcalcnt: %11d\n", timex.calcnt); 42930Sstevel@tonic-gate (void) printf("\terrcnt: %11d\n", timex.errcnt); 42940Sstevel@tonic-gate (void) printf("\tstbcnt: %11d\n", timex.stbcnt); 42950Sstevel@tonic-gate } 42960Sstevel@tonic-gate 42970Sstevel@tonic-gate void 42980Sstevel@tonic-gate show_getrusage(long offset) 42990Sstevel@tonic-gate { 43000Sstevel@tonic-gate struct rusage r; 43010Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43020Sstevel@tonic-gate return; 43030Sstevel@tonic-gate (void) printf("\t user time: %ld.%6.6ld sec\n", 43040Sstevel@tonic-gate r.ru_utime.tv_sec, 43050Sstevel@tonic-gate r.ru_utime.tv_usec); 43060Sstevel@tonic-gate (void) printf("\t system time: %ld.%6.6ld sec\n", 43070Sstevel@tonic-gate r.ru_stime.tv_sec, 43080Sstevel@tonic-gate r.ru_stime.tv_usec); 43090Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %ld\n", 43100Sstevel@tonic-gate r.ru_maxrss); 43110Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %ld\n", 43120Sstevel@tonic-gate r.ru_ixrss); 43130Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %ld\n", 43140Sstevel@tonic-gate r.ru_idrss); 43150Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %ld\n", 43160Sstevel@tonic-gate r.ru_isrss); 43170Sstevel@tonic-gate (void) printf("\t minor faults: %ld\n", 43180Sstevel@tonic-gate r.ru_minflt); 43190Sstevel@tonic-gate (void) printf("\t major faults: %ld\n", 43200Sstevel@tonic-gate r.ru_majflt); 43210Sstevel@tonic-gate (void) printf("\t # of swaps: %ld\n", 43220Sstevel@tonic-gate r.ru_nswap); 43230Sstevel@tonic-gate (void) printf("\t blocked inputs: %ld\n", 43240Sstevel@tonic-gate r.ru_inblock); 43250Sstevel@tonic-gate (void) printf("\t blocked outputs: %ld\n", 43260Sstevel@tonic-gate r.ru_oublock); 43270Sstevel@tonic-gate (void) printf("\t msgs sent: %ld\n", 43280Sstevel@tonic-gate r.ru_msgsnd); 43290Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %ld\n", 43300Sstevel@tonic-gate r.ru_msgrcv); 43310Sstevel@tonic-gate (void) printf("\t signals rcv'd: %ld\n", 43320Sstevel@tonic-gate r.ru_nsignals); 43330Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %ld\n", 43340Sstevel@tonic-gate r.ru_nvcsw); 43350Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %ld\n", 43360Sstevel@tonic-gate r.ru_nivcsw); 43370Sstevel@tonic-gate } 43380Sstevel@tonic-gate 43390Sstevel@tonic-gate #ifdef _LP64 43400Sstevel@tonic-gate void 43410Sstevel@tonic-gate show_getrusage32(long offset) 43420Sstevel@tonic-gate { 43430Sstevel@tonic-gate struct rusage32 r; 43440Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43450Sstevel@tonic-gate return; 43460Sstevel@tonic-gate (void) printf("\t user time: %d.%6.6d sec\n", 43470Sstevel@tonic-gate r.ru_utime.tv_sec, 43480Sstevel@tonic-gate r.ru_utime.tv_usec); 43490Sstevel@tonic-gate (void) printf("\t system time: %d.%6.6d sec\n", 43500Sstevel@tonic-gate r.ru_stime.tv_sec, 43510Sstevel@tonic-gate r.ru_stime.tv_usec); 43520Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %d\n", 43530Sstevel@tonic-gate r.ru_maxrss); 43540Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %d\n", 43550Sstevel@tonic-gate r.ru_ixrss); 43560Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %d\n", 43570Sstevel@tonic-gate r.ru_idrss); 43580Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %d\n", 43590Sstevel@tonic-gate r.ru_isrss); 43600Sstevel@tonic-gate (void) printf("\t minor faults: %d\n", 43610Sstevel@tonic-gate r.ru_minflt); 43620Sstevel@tonic-gate (void) printf("\t major faults: %d\n", 43630Sstevel@tonic-gate r.ru_majflt); 43640Sstevel@tonic-gate (void) printf("\t # of swaps: %d\n", 43650Sstevel@tonic-gate r.ru_nswap); 43660Sstevel@tonic-gate (void) printf("\t blocked inputs: %d\n", 43670Sstevel@tonic-gate r.ru_inblock); 43680Sstevel@tonic-gate (void) printf("\t blocked outputs: %d\n", 43690Sstevel@tonic-gate r.ru_oublock); 43700Sstevel@tonic-gate (void) printf("\t msgs sent: %d\n", 43710Sstevel@tonic-gate r.ru_msgsnd); 43720Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %d\n", 43730Sstevel@tonic-gate r.ru_msgrcv); 43740Sstevel@tonic-gate (void) printf("\t signals rcv'd: %d\n", 43750Sstevel@tonic-gate r.ru_nsignals); 43760Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %d\n", 43770Sstevel@tonic-gate r.ru_nvcsw); 43780Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %d\n", 43790Sstevel@tonic-gate r.ru_nivcsw); 43800Sstevel@tonic-gate } 43810Sstevel@tonic-gate #endif 43820Sstevel@tonic-gate 43832447Snf202958 /* 43842447Snf202958 * Utility function to print a packed nvlist by unpacking 43852447Snf202958 * and calling the libnvpair pretty printer. Frees all 43862447Snf202958 * allocated memory internally. 43872447Snf202958 */ 43882447Snf202958 static void 43892447Snf202958 show_packed_nvlist(private_t *pri, uintptr_t offset, size_t size) 43902447Snf202958 { 43912447Snf202958 nvlist_t *nvl = NULL; 43922447Snf202958 size_t readsize; 43932447Snf202958 char *buf; 43942447Snf202958 43952447Snf202958 if ((offset == 0) || (size == 0)) { 43962447Snf202958 return; 43972447Snf202958 } 43982447Snf202958 43992447Snf202958 buf = my_malloc(size, "nvlist decode buffer"); 44002447Snf202958 readsize = Pread(Proc, buf, size, offset); 44012447Snf202958 if (readsize != size) { 44022447Snf202958 (void) printf("%s\t<?>", pri->pname); 44032447Snf202958 } else { 44042447Snf202958 int result; 44052447Snf202958 44062447Snf202958 result = nvlist_unpack(buf, size, &nvl, 0); 44072447Snf202958 if (result == 0) { 44082447Snf202958 nvlist_print(stdout, nvl); 44092447Snf202958 nvlist_free(nvl); 44102447Snf202958 } else { 44112447Snf202958 (void) printf("%s\tunpack of nvlist" 44122447Snf202958 " failed: %d\n", pri->pname, result); 44132447Snf202958 } 44142447Snf202958 } 44152447Snf202958 free(buf); 44162447Snf202958 } 44172447Snf202958 4418813Sdp static void 4419813Sdp show_zone_create_args(private_t *pri, long offset) 4420813Sdp { 4421813Sdp zone_def args; 4422813Sdp char zone_name[ZONENAME_MAX]; 4423813Sdp char zone_root[MAXPATHLEN]; 4424813Sdp char *zone_zfs = NULL; 4425813Sdp 4426813Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 4427813Sdp 4428813Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name), 4429813Sdp (uintptr_t)args.zone_name) == -1) 4430813Sdp (void) strcpy(zone_name, "<?>"); 4431813Sdp 4432813Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root), 4433813Sdp (uintptr_t)args.zone_root) == -1) 4434813Sdp (void) strcpy(zone_root, "<?>"); 4435813Sdp 4436813Sdp if (args.zfsbufsz > 0) { 4437813Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz)); 4438813Sdp if (zone_zfs != NULL) { 4439813Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz, 4440813Sdp (uintptr_t)args.zfsbuf) == -1) 4441813Sdp (void) strcpy(zone_zfs, "<?>"); 4442813Sdp } 4443813Sdp } else { 4444813Sdp zone_zfs = ""; 4445813Sdp } 4446813Sdp 4447813Sdp (void) printf("%s\t zone_name: %s\n", pri->pname, 4448813Sdp zone_name); 4449813Sdp (void) printf("%s\t zone_root: %s\n", pri->pname, 4450813Sdp zone_root); 4451813Sdp 4452813Sdp show_privset(pri, (uintptr_t)args.zone_privs, 4453813Sdp args.zone_privssz, " zone_privs: "); 4454813Sdp 4455813Sdp (void) printf("%s\t rctlbuf: 0x%p\n", pri->pname, 4456813Sdp (void *)args.rctlbuf); 4457813Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname, 4458813Sdp (ulong_t)args.rctlbufsz); 4459813Sdp 44602447Snf202958 show_packed_nvlist(pri, (uintptr_t)args.rctlbuf, 44612447Snf202958 args.rctlbufsz); 44622447Snf202958 4463813Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs); 4464813Sdp 4465813Sdp (void) printf("%s\textended_error: 0x%p\n", pri->pname, 4466813Sdp (void *)args.extended_error); 4467813Sdp 44681676Sjpk if (is_system_labeled()) { 44691676Sjpk char *label_str = NULL; 44701676Sjpk bslabel_t zone_label; 44711676Sjpk 44721676Sjpk (void) printf("%s\t match: %d\n", pri->pname, 44731676Sjpk args.match); 44741676Sjpk (void) printf("%s\t doi: %d\n", pri->pname, 44751676Sjpk args.doi); 44761676Sjpk 44771676Sjpk if (Pread_string(Proc, (char *)&zone_label, 44781676Sjpk sizeof (zone_label), (uintptr_t)args.label) != -1) { 44791676Sjpk /* show the label as string */ 44801676Sjpk if (label_to_str(&zone_label, &label_str, 44811676Sjpk M_LABEL, SHORT_NAMES) != 0) { 44821676Sjpk /* have to dump label as raw string */ 44831676Sjpk (void) label_to_str(&zone_label, 44841676Sjpk &label_str, M_INTERNAL, 44851676Sjpk SHORT_NAMES); 44861676Sjpk } 44871676Sjpk } 44881676Sjpk 44891676Sjpk (void) printf("%s\t label: %s\n", 44901676Sjpk pri->pname, label_str != NULL ? label_str : "<?>"); 44911676Sjpk if (label_str) 44921676Sjpk free(label_str); 44931676Sjpk } 44941676Sjpk 4495813Sdp if (args.zfsbufsz > 0) 4496813Sdp free(zone_zfs); 4497813Sdp } 4498813Sdp } 4499813Sdp 4500813Sdp 4501813Sdp #ifdef _LP64 4502813Sdp 4503813Sdp static void 4504813Sdp show_zone_create_args32(private_t *pri, long offset) 4505813Sdp { 4506813Sdp zone_def32 args; 4507813Sdp char zone_name[ZONENAME_MAX]; 4508813Sdp char zone_root[MAXPATHLEN]; 4509813Sdp char *zone_zfs = NULL; 4510813Sdp 4511813Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 4512813Sdp 4513813Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name), 4514813Sdp (uintptr_t)args.zone_name) == -1) 4515813Sdp (void) strcpy(zone_name, "<?>"); 4516813Sdp 4517813Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root), 4518813Sdp (uintptr_t)args.zone_root) == -1) 4519813Sdp (void) strcpy(zone_root, "<?>"); 4520813Sdp 4521813Sdp if (args.zfsbufsz > 0) { 4522813Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz)); 4523813Sdp if (zone_zfs != NULL) { 4524813Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz, 4525813Sdp (uintptr_t)args.zfsbuf) == -1) 4526813Sdp (void) strcpy(zone_zfs, "<?>"); 4527813Sdp } 4528813Sdp } else { 4529813Sdp zone_zfs = ""; 4530813Sdp } 4531813Sdp 4532813Sdp (void) printf("%s\t zone_name: %s\n", pri->pname, 4533813Sdp zone_name); 4534813Sdp (void) printf("%s\t zone_root: %s\n", pri->pname, 4535813Sdp zone_root); 4536813Sdp 4537813Sdp show_privset(pri, (uintptr_t)args.zone_privs, 4538813Sdp args.zone_privssz, " zone_privs: "); 4539813Sdp 4540835Sdp (void) printf("%s\t rctlbuf: 0x%x\n", pri->pname, 4541835Sdp (caddr32_t)args.rctlbuf); 4542813Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname, 4543813Sdp (ulong_t)args.rctlbufsz); 4544813Sdp 45452447Snf202958 show_packed_nvlist(pri, (uintptr_t)args.rctlbuf, 45462447Snf202958 args.rctlbufsz); 45472447Snf202958 4548813Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs); 4549813Sdp 4550835Sdp (void) printf("%s\textended_error: 0x%x\n", pri->pname, 4551835Sdp (caddr32_t)args.extended_error); 4552813Sdp 45531676Sjpk if (is_system_labeled()) { 45541676Sjpk char *label_str = NULL; 45551676Sjpk bslabel_t zone_label; 45561676Sjpk 45571676Sjpk (void) printf("%s\t match: %d\n", pri->pname, 45581676Sjpk args.match); 45591676Sjpk (void) printf("%s\t doi: %d\n", pri->pname, 45601676Sjpk args.doi); 45611676Sjpk 45621676Sjpk if (Pread_string(Proc, (char *)&zone_label, 45631676Sjpk sizeof (zone_label), (caddr32_t)args.label) != -1) { 45641676Sjpk /* show the label as string */ 45651676Sjpk if (label_to_str(&zone_label, &label_str, 45661676Sjpk M_LABEL, SHORT_NAMES) != 0) { 45671676Sjpk /* have to dump label as raw string */ 45681676Sjpk (void) label_to_str(&zone_label, 45691676Sjpk &label_str, M_INTERNAL, 45701676Sjpk SHORT_NAMES); 45711676Sjpk } 45721676Sjpk } 45731676Sjpk (void) printf("%s\t label: %s\n", 45741676Sjpk pri->pname, label_str != NULL ? label_str : "<?>"); 45751676Sjpk if (label_str) 45761676Sjpk free(label_str); 45771676Sjpk } 45781676Sjpk 4579813Sdp if (args.zfsbufsz > 0) 4580813Sdp free(zone_zfs); 4581813Sdp } 4582813Sdp } 4583813Sdp 4584813Sdp #endif 4585813Sdp 4586813Sdp static void 4587813Sdp show_zones(private_t *pri) 4588813Sdp { 4589813Sdp switch (pri->sys_args[0]) { 4590813Sdp case ZONE_CREATE: 4591813Sdp #ifdef _LP64 4592813Sdp if (data_model == PR_MODEL_LP64) 4593813Sdp show_zone_create_args(pri, (long)pri->sys_args[1]); 4594813Sdp else 4595813Sdp show_zone_create_args32(pri, (long)pri->sys_args[1]); 4596813Sdp #else 4597813Sdp show_zone_create_args(pri, (long)pri->sys_args[1]); 4598813Sdp #endif 4599813Sdp break; 4600813Sdp } 4601813Sdp } 4602813Sdp 46032447Snf202958 static void 46042447Snf202958 show_rctlblk(private_t *pri, long _rctlblk) 46052447Snf202958 { 46062447Snf202958 rctlblk_t *blk; 46072447Snf202958 int size = rctlblk_size(); 46082447Snf202958 size_t readsize; 46092447Snf202958 const char *s; 46102447Snf202958 46112447Snf202958 blk = my_malloc(size, "rctlblk decode buffer"); 46122447Snf202958 readsize = Pread(Proc, blk, size, _rctlblk); 46132447Snf202958 if (readsize != size) { 46142447Snf202958 (void) printf("%s\t\t<?>", pri->pname); 46152447Snf202958 } else { 46162447Snf202958 (void) printf("%s\t\t Privilege: 0x%x\n", 46172447Snf202958 pri->pname, 46182447Snf202958 rctlblk_get_privilege(blk)); 46192447Snf202958 (void) printf("%s\t\t Value: %lld\n", 46202447Snf202958 pri->pname, 46212447Snf202958 rctlblk_get_value(blk)); 46222447Snf202958 (void) printf("%s\t\tEnforced Value: %lld\n", 46232447Snf202958 pri->pname, 46242447Snf202958 rctlblk_get_enforced_value(blk)); 46252447Snf202958 46262447Snf202958 { 46272447Snf202958 int sig, act; 46282447Snf202958 act = rctlblk_get_local_action(blk, &sig); 46292447Snf202958 46302447Snf202958 s = rctl_local_action(pri, act); 46312447Snf202958 if (s == NULL) { 46322447Snf202958 (void) printf("%s\t\t Local action: 0x%x\n", 46332447Snf202958 pri->pname, act); 46342447Snf202958 } else { 46352447Snf202958 (void) printf("%s\t\t Local action: %s\n", 46362447Snf202958 pri->pname, s); 46372447Snf202958 } 46382447Snf202958 46392447Snf202958 if (act & RCTL_LOCAL_SIGNAL) { 46402447Snf202958 (void) printf("%s\t\t " 46412447Snf202958 "For signal %s\n", 46422447Snf202958 pri->pname, signame(pri, sig)); 46432447Snf202958 } 46442447Snf202958 } 46452447Snf202958 46462447Snf202958 s = rctl_local_flags(pri, rctlblk_get_local_flags(blk)); 46472447Snf202958 if (s == NULL) { 46482447Snf202958 (void) printf("%s\t\t Local flags: 0x%x\n", 46492447Snf202958 pri->pname, rctlblk_get_local_flags(blk)); 46502447Snf202958 } else { 46512447Snf202958 (void) printf("%s\t\t Local flags: %s\n", 46522447Snf202958 pri->pname, s); 46532447Snf202958 } 46542447Snf202958 46552447Snf202958 #ifdef _LP64 46562447Snf202958 (void) printf("%s\t\t Recipient PID: %d\n", 46572447Snf202958 pri->pname, 46582447Snf202958 rctlblk_get_recipient_pid(blk)); 46592447Snf202958 #else 46602447Snf202958 (void) printf("%s\t\t Recipient PID: %ld\n", 46612447Snf202958 pri->pname, 46622447Snf202958 rctlblk_get_recipient_pid(blk)); 46632447Snf202958 #endif 46642447Snf202958 (void) printf("%s\t\t Firing Time: %lld\n", 46652447Snf202958 pri->pname, 46662447Snf202958 rctlblk_get_firing_time(blk)); 46672447Snf202958 } 46682447Snf202958 free(blk); 46692447Snf202958 } 46702447Snf202958 46712447Snf202958 static void 46722447Snf202958 show_rctls(private_t *pri) 46732447Snf202958 { 46743684Srd117015 int entry; 46753684Srd117015 46762447Snf202958 switch (pri->sys_args[0]) { 46772447Snf202958 case 0: /* getrctl */ 46782447Snf202958 case 1: /* setrctl */ 46792447Snf202958 /* 46802447Snf202958 * If these offsets look a little odd, remember that they're 46812447Snf202958 * into the _raw_ system call 46822447Snf202958 */ 46832447Snf202958 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri->pname, 46842447Snf202958 pri->sys_args[2]); 46852447Snf202958 if (pri->sys_args[2] != NULL) { 46862447Snf202958 show_rctlblk(pri, pri->sys_args[2]); 46872447Snf202958 } 46882447Snf202958 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri->pname, 46892447Snf202958 pri->sys_args[3]); 46902447Snf202958 if (pri->sys_args[3] != NULL) { 46912447Snf202958 show_rctlblk(pri, pri->sys_args[3]); 46922447Snf202958 } 46932447Snf202958 break; 46943684Srd117015 case 4: /* setprojrctl */ 46953684Srd117015 for (entry = 0; entry < pri->sys_args[4]; entry++) { 46963684Srd117015 (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n", 46973684Srd117015 pri->pname, entry, 46983684Srd117015 (long)RCTLBLK_INC(pri->sys_args[3], entry)); 46993684Srd117015 if (RCTLBLK_INC(pri->sys_args[3], entry) != NULL) { 47003684Srd117015 show_rctlblk(pri, 47013684Srd117015 (long)RCTLBLK_INC(pri->sys_args[3], entry)); 47023684Srd117015 } 47033684Srd117015 } 47042447Snf202958 } 47052447Snf202958 } 4706813Sdp 470710440SRoger.Faulkner@Sun.COM void 470810440SRoger.Faulkner@Sun.COM show_utimesys(private_t *pri) 470910440SRoger.Faulkner@Sun.COM { 471010440SRoger.Faulkner@Sun.COM switch (pri->sys_args[0]) { 471110440SRoger.Faulkner@Sun.COM case 0: /* futimens() */ 471210440SRoger.Faulkner@Sun.COM if (pri->sys_nargs > 2) 471310440SRoger.Faulkner@Sun.COM show_utimens(pri, (long)pri->sys_args[2]); 471410440SRoger.Faulkner@Sun.COM break; 471510440SRoger.Faulkner@Sun.COM case 1: /* utimensat */ 471610440SRoger.Faulkner@Sun.COM if (pri->sys_nargs > 3) 471710440SRoger.Faulkner@Sun.COM show_utimens(pri, (long)pri->sys_args[3]); 471810440SRoger.Faulkner@Sun.COM break; 471910440SRoger.Faulkner@Sun.COM default: /* unexpected subcode */ 472010440SRoger.Faulkner@Sun.COM break; 472110440SRoger.Faulkner@Sun.COM } 472210440SRoger.Faulkner@Sun.COM } 472310440SRoger.Faulkner@Sun.COM 4724*12643SAnders.Persson@Sun.COM #ifdef _LP64 4725*12643SAnders.Persson@Sun.COM static void 4726*12643SAnders.Persson@Sun.COM show_sockconfig_filter_prop32(private_t *pri, long addr) 4727*12643SAnders.Persson@Sun.COM { 4728*12643SAnders.Persson@Sun.COM struct sockconfig_filter_props32 props; 4729*12643SAnders.Persson@Sun.COM const char *s = NULL; 4730*12643SAnders.Persson@Sun.COM char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)]; 4731*12643SAnders.Persson@Sun.COM sof_socktuple32_t *tup; 4732*12643SAnders.Persson@Sun.COM size_t sz; 4733*12643SAnders.Persson@Sun.COM int i; 4734*12643SAnders.Persson@Sun.COM 4735*12643SAnders.Persson@Sun.COM if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) { 4736*12643SAnders.Persson@Sun.COM if (Pread_string(Proc, buf, sizeof (buf), 4737*12643SAnders.Persson@Sun.COM (uintptr_t)props.sfp_modname) == -1) 4738*12643SAnders.Persson@Sun.COM (void) strcpy(buf, "<?>"); 4739*12643SAnders.Persson@Sun.COM (void) printf("%s\tmodule name: %s\n", pri->pname, buf); 4740*12643SAnders.Persson@Sun.COM (void) printf("%s\tattach semantics: %s", pri->pname, 4741*12643SAnders.Persson@Sun.COM props.sfp_autoattach ? "automatic" : "progammatic"); 4742*12643SAnders.Persson@Sun.COM if (props.sfp_autoattach) { 4743*12643SAnders.Persson@Sun.COM buf[0] = '\0'; 4744*12643SAnders.Persson@Sun.COM switch (props.sfp_hint) { 4745*12643SAnders.Persson@Sun.COM case SOF_HINT_TOP: s = "top"; break; 4746*12643SAnders.Persson@Sun.COM case SOF_HINT_BOTTOM: s = "bottom"; break; 4747*12643SAnders.Persson@Sun.COM case SOF_HINT_BEFORE: 4748*12643SAnders.Persson@Sun.COM case SOF_HINT_AFTER: 4749*12643SAnders.Persson@Sun.COM s = (props.sfp_hint == SOF_HINT_BEFORE) ? 4750*12643SAnders.Persson@Sun.COM "before" : "after"; 4751*12643SAnders.Persson@Sun.COM if (Pread_string(Proc, buf, sizeof (buf), 4752*12643SAnders.Persson@Sun.COM (uintptr_t)props.sfp_hintarg) == -1) 4753*12643SAnders.Persson@Sun.COM (void) strcpy(buf, "<?>"); 4754*12643SAnders.Persson@Sun.COM } 4755*12643SAnders.Persson@Sun.COM if (s != NULL) { 4756*12643SAnders.Persson@Sun.COM (void) printf(", placement: %s %s", s, buf); 4757*12643SAnders.Persson@Sun.COM } 4758*12643SAnders.Persson@Sun.COM } 4759*12643SAnders.Persson@Sun.COM (void) printf("\n"); 4760*12643SAnders.Persson@Sun.COM (void) printf("%s\tsocket tuples:\n", pri->pname); 4761*12643SAnders.Persson@Sun.COM if (props.sfp_socktuple_cnt == 0) { 4762*12643SAnders.Persson@Sun.COM (void) printf("\t\t<empty>\n"); 4763*12643SAnders.Persson@Sun.COM return; 4764*12643SAnders.Persson@Sun.COM } 4765*12643SAnders.Persson@Sun.COM sz = props.sfp_socktuple_cnt * sizeof (*tup); 4766*12643SAnders.Persson@Sun.COM tup = my_malloc(sz, "socket tuple buffer"); 4767*12643SAnders.Persson@Sun.COM if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz) 4768*12643SAnders.Persson@Sun.COM for (i = 0; i < props.sfp_socktuple_cnt; i++) { 4769*12643SAnders.Persson@Sun.COM (void) printf( 4770*12643SAnders.Persson@Sun.COM "\t\tfamily: %d, type: %d, proto: %d\n", 4771*12643SAnders.Persson@Sun.COM tup[i].sofst_family, tup[i].sofst_type, 4772*12643SAnders.Persson@Sun.COM tup[i].sofst_protocol); 4773*12643SAnders.Persson@Sun.COM } 4774*12643SAnders.Persson@Sun.COM } 4775*12643SAnders.Persson@Sun.COM } 4776*12643SAnders.Persson@Sun.COM #endif /* _LP64 */ 4777*12643SAnders.Persson@Sun.COM static void 4778*12643SAnders.Persson@Sun.COM show_sockconfig_filter_prop(private_t *pri, long addr) 4779*12643SAnders.Persson@Sun.COM { 4780*12643SAnders.Persson@Sun.COM struct sockconfig_filter_props props; 4781*12643SAnders.Persson@Sun.COM const char *s = NULL; 4782*12643SAnders.Persson@Sun.COM char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)]; 4783*12643SAnders.Persson@Sun.COM sof_socktuple_t *tup; 4784*12643SAnders.Persson@Sun.COM size_t sz; 4785*12643SAnders.Persson@Sun.COM int i; 4786*12643SAnders.Persson@Sun.COM 4787*12643SAnders.Persson@Sun.COM if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) { 4788*12643SAnders.Persson@Sun.COM if (Pread_string(Proc, buf, sizeof (buf), 4789*12643SAnders.Persson@Sun.COM (uintptr_t)props.sfp_modname) == -1) 4790*12643SAnders.Persson@Sun.COM (void) strcpy(buf, "<?>"); 4791*12643SAnders.Persson@Sun.COM (void) printf("%s\tmodule name: %s\n", pri->pname, buf); 4792*12643SAnders.Persson@Sun.COM (void) printf("%s\tattach semantics: %s", pri->pname, 4793*12643SAnders.Persson@Sun.COM props.sfp_autoattach ? "automatic" : "progammatic"); 4794*12643SAnders.Persson@Sun.COM if (props.sfp_autoattach) { 4795*12643SAnders.Persson@Sun.COM buf[0] = '\0'; 4796*12643SAnders.Persson@Sun.COM switch (props.sfp_hint) { 4797*12643SAnders.Persson@Sun.COM case SOF_HINT_TOP: s = "top"; break; 4798*12643SAnders.Persson@Sun.COM case SOF_HINT_BOTTOM: s = "bottom"; break; 4799*12643SAnders.Persson@Sun.COM case SOF_HINT_BEFORE: 4800*12643SAnders.Persson@Sun.COM case SOF_HINT_AFTER: 4801*12643SAnders.Persson@Sun.COM s = (props.sfp_hint == SOF_HINT_BEFORE) ? 4802*12643SAnders.Persson@Sun.COM "before" : "after"; 4803*12643SAnders.Persson@Sun.COM if (Pread_string(Proc, buf, sizeof (buf), 4804*12643SAnders.Persson@Sun.COM (uintptr_t)props.sfp_hintarg) == -1) 4805*12643SAnders.Persson@Sun.COM (void) strcpy(buf, "<?>"); 4806*12643SAnders.Persson@Sun.COM } 4807*12643SAnders.Persson@Sun.COM if (s != NULL) { 4808*12643SAnders.Persson@Sun.COM (void) printf(", placement: %s", s); 4809*12643SAnders.Persson@Sun.COM } 4810*12643SAnders.Persson@Sun.COM } 4811*12643SAnders.Persson@Sun.COM (void) printf("\n"); 4812*12643SAnders.Persson@Sun.COM (void) printf("%s\tsocket tuples:\n", pri->pname); 4813*12643SAnders.Persson@Sun.COM if (props.sfp_socktuple_cnt == 0) { 4814*12643SAnders.Persson@Sun.COM (void) printf("\t\t<empty>\n"); 4815*12643SAnders.Persson@Sun.COM return; 4816*12643SAnders.Persson@Sun.COM } 4817*12643SAnders.Persson@Sun.COM sz = props.sfp_socktuple_cnt * sizeof (*tup); 4818*12643SAnders.Persson@Sun.COM tup = my_malloc(sz, "socket tuple buffer"); 4819*12643SAnders.Persson@Sun.COM if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz) 4820*12643SAnders.Persson@Sun.COM for (i = 0; i < props.sfp_socktuple_cnt; i++) { 4821*12643SAnders.Persson@Sun.COM (void) printf( 4822*12643SAnders.Persson@Sun.COM "\t\tfamily: %d, type: %d, proto: %d\n", 4823*12643SAnders.Persson@Sun.COM tup[i].sofst_family, tup[i].sofst_type, 4824*12643SAnders.Persson@Sun.COM tup[i].sofst_protocol); 4825*12643SAnders.Persson@Sun.COM } 4826*12643SAnders.Persson@Sun.COM } 4827*12643SAnders.Persson@Sun.COM } 4828*12643SAnders.Persson@Sun.COM 4829*12643SAnders.Persson@Sun.COM void 4830*12643SAnders.Persson@Sun.COM show_sockconfig(private_t *pri) 4831*12643SAnders.Persson@Sun.COM { 4832*12643SAnders.Persson@Sun.COM switch (pri->sys_args[0]) { 4833*12643SAnders.Persson@Sun.COM case SOCKCONFIG_ADD_FILTER: 4834*12643SAnders.Persson@Sun.COM #ifdef _LP64 4835*12643SAnders.Persson@Sun.COM if (data_model == PR_MODEL_LP64) 4836*12643SAnders.Persson@Sun.COM show_sockconfig_filter_prop(pri, 4837*12643SAnders.Persson@Sun.COM (long)pri->sys_args[2]); 4838*12643SAnders.Persson@Sun.COM else 4839*12643SAnders.Persson@Sun.COM show_sockconfig_filter_prop32(pri, 4840*12643SAnders.Persson@Sun.COM (long)pri->sys_args[2]); 4841*12643SAnders.Persson@Sun.COM #else 4842*12643SAnders.Persson@Sun.COM show_sockconfig_filter_prop(pri, (long)pri->sys_args[2]); 4843*12643SAnders.Persson@Sun.COM #endif 4844*12643SAnders.Persson@Sun.COM break; 4845*12643SAnders.Persson@Sun.COM default: 4846*12643SAnders.Persson@Sun.COM break; 4847*12643SAnders.Persson@Sun.COM } 4848*12643SAnders.Persson@Sun.COM } 4849*12643SAnders.Persson@Sun.COM 48500Sstevel@tonic-gate /* expound verbosely upon syscall arguments */ 48510Sstevel@tonic-gate /*ARGSUSED*/ 48520Sstevel@tonic-gate void 48530Sstevel@tonic-gate expound(private_t *pri, long r0, int raw) 48540Sstevel@tonic-gate { 48550Sstevel@tonic-gate const lwpstatus_t *Lsp = pri->lwpstat; 48560Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 48570Sstevel@tonic-gate int what = Lsp->pr_what; 48580Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 48590Sstevel@tonic-gate /* for a failed system call */ 48600Sstevel@tonic-gate #ifndef _LP64 48610Sstevel@tonic-gate /* We are a 32-bit truss; we can't grok a 64-bit process */ 48620Sstevel@tonic-gate if (lp64) 48630Sstevel@tonic-gate return; 48640Sstevel@tonic-gate #endif 48650Sstevel@tonic-gate /* for reporting sleeping system calls */ 48660Sstevel@tonic-gate if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP))) 48670Sstevel@tonic-gate what = Lsp->pr_syscall; 48680Sstevel@tonic-gate 48690Sstevel@tonic-gate switch (what) { 48700Sstevel@tonic-gate case SYS_gettimeofday: 48710Sstevel@tonic-gate if (!err) 48720Sstevel@tonic-gate show_timeofday(pri); 48730Sstevel@tonic-gate break; 48740Sstevel@tonic-gate case SYS_getitimer: 48750Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 48760Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 48777088Sraf " value"); 48780Sstevel@tonic-gate break; 48790Sstevel@tonic-gate case SYS_setitimer: 48800Sstevel@tonic-gate if (pri->sys_nargs > 1) 48810Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 48827088Sraf " value"); 48830Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 48840Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[2], 48857088Sraf "ovalue"); 48860Sstevel@tonic-gate break; 48870Sstevel@tonic-gate case SYS_stime: 48880Sstevel@tonic-gate show_stime(pri); 48890Sstevel@tonic-gate break; 48900Sstevel@tonic-gate case SYS_times: 48910Sstevel@tonic-gate if (!err) 48920Sstevel@tonic-gate show_times(pri); 48930Sstevel@tonic-gate break; 48940Sstevel@tonic-gate case SYS_utssys: 48950Sstevel@tonic-gate if (err) 48960Sstevel@tonic-gate break; 48970Sstevel@tonic-gate #ifdef _LP64 48980Sstevel@tonic-gate if (lp64) 48990Sstevel@tonic-gate show_utssys(pri, r0); 49000Sstevel@tonic-gate else 49010Sstevel@tonic-gate show_utssys32(pri, r0); 49020Sstevel@tonic-gate #else 49030Sstevel@tonic-gate show_utssys(pri, r0); 49040Sstevel@tonic-gate #endif 49050Sstevel@tonic-gate break; 49060Sstevel@tonic-gate case SYS_ioctl: 49070Sstevel@tonic-gate if (pri->sys_nargs >= 3) /* each case must decide for itself */ 49080Sstevel@tonic-gate show_ioctl(pri, pri->sys_args[1], 49097088Sraf (long)pri->sys_args[2]); 49100Sstevel@tonic-gate break; 491111798SRoger.Faulkner@Sun.COM case SYS_fstatat: 491211798SRoger.Faulkner@Sun.COM if (!err && pri->sys_nargs >= 3) 491311798SRoger.Faulkner@Sun.COM show_stat(pri, (long)pri->sys_args[2]); 491411798SRoger.Faulkner@Sun.COM break; 491511798SRoger.Faulkner@Sun.COM case SYS_fstatat64: 491611798SRoger.Faulkner@Sun.COM if (!err && pri->sys_nargs >= 3) 491711798SRoger.Faulkner@Sun.COM show_stat64_32(pri, (long)pri->sys_args[2]); 491811798SRoger.Faulkner@Sun.COM break; 49190Sstevel@tonic-gate case SYS_stat: 49200Sstevel@tonic-gate case SYS_fstat: 49210Sstevel@tonic-gate case SYS_lstat: 49220Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 49230Sstevel@tonic-gate show_stat(pri, (long)pri->sys_args[1]); 49240Sstevel@tonic-gate break; 49250Sstevel@tonic-gate case SYS_stat64: 49260Sstevel@tonic-gate case SYS_fstat64: 49270Sstevel@tonic-gate case SYS_lstat64: 49280Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 49290Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[1]); 49300Sstevel@tonic-gate break; 49310Sstevel@tonic-gate case SYS_statvfs: 49320Sstevel@tonic-gate case SYS_fstatvfs: 49330Sstevel@tonic-gate if (err) 49340Sstevel@tonic-gate break; 49350Sstevel@tonic-gate #ifdef _LP64 49360Sstevel@tonic-gate if (!lp64) { 49370Sstevel@tonic-gate show_statvfs32(pri); 49380Sstevel@tonic-gate break; 49390Sstevel@tonic-gate } 49400Sstevel@tonic-gate #endif 49410Sstevel@tonic-gate show_statvfs(pri); 49420Sstevel@tonic-gate break; 49430Sstevel@tonic-gate case SYS_statvfs64: 49440Sstevel@tonic-gate case SYS_fstatvfs64: 49450Sstevel@tonic-gate if (err) 49460Sstevel@tonic-gate break; 49470Sstevel@tonic-gate show_statvfs64(pri); 49480Sstevel@tonic-gate break; 49490Sstevel@tonic-gate case SYS_statfs: 49500Sstevel@tonic-gate case SYS_fstatfs: 49510Sstevel@tonic-gate if (err) 49520Sstevel@tonic-gate break; 49530Sstevel@tonic-gate #ifdef _LP64 49540Sstevel@tonic-gate if (lp64) 49550Sstevel@tonic-gate show_statfs(pri); 49560Sstevel@tonic-gate else 49570Sstevel@tonic-gate show_statfs32(pri); 49580Sstevel@tonic-gate #else 49590Sstevel@tonic-gate show_statfs(pri); 49600Sstevel@tonic-gate #endif 49610Sstevel@tonic-gate break; 49620Sstevel@tonic-gate case SYS_fcntl: 49630Sstevel@tonic-gate show_fcntl(pri); 49640Sstevel@tonic-gate break; 49650Sstevel@tonic-gate case SYS_msgsys: 49660Sstevel@tonic-gate show_msgsys(pri, r0); /* each case must decide for itself */ 49670Sstevel@tonic-gate break; 49680Sstevel@tonic-gate case SYS_semsys: 49690Sstevel@tonic-gate show_semsys(pri); /* each case must decide for itself */ 49700Sstevel@tonic-gate break; 49710Sstevel@tonic-gate case SYS_shmsys: 49720Sstevel@tonic-gate show_shmsys(pri); /* each case must decide for itself */ 49730Sstevel@tonic-gate break; 49740Sstevel@tonic-gate case SYS_getdents: 49750Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 49760Sstevel@tonic-gate break; 49770Sstevel@tonic-gate #ifdef _LP64 49780Sstevel@tonic-gate if (!lp64) { 49790Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 49800Sstevel@tonic-gate break; 49810Sstevel@tonic-gate } 49820Sstevel@tonic-gate /* FALLTHROUGH */ 49830Sstevel@tonic-gate #else 49840Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 49850Sstevel@tonic-gate break; 49860Sstevel@tonic-gate #endif 49870Sstevel@tonic-gate case SYS_getdents64: 49880Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 49890Sstevel@tonic-gate break; 49900Sstevel@tonic-gate show_dents64(pri, (long)pri->sys_args[1], r0); 49910Sstevel@tonic-gate break; 49920Sstevel@tonic-gate case SYS_getmsg: 49930Sstevel@tonic-gate show_gp_msg(pri, what); 49940Sstevel@tonic-gate if (pri->sys_nargs > 3) 49950Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "flags"); 49960Sstevel@tonic-gate break; 49970Sstevel@tonic-gate case SYS_getpmsg: 49980Sstevel@tonic-gate show_gp_msg(pri, what); 49990Sstevel@tonic-gate if (pri->sys_nargs > 3) 50000Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "band"); 50010Sstevel@tonic-gate if (pri->sys_nargs > 4) 50020Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[4], "flags"); 50030Sstevel@tonic-gate break; 50040Sstevel@tonic-gate case SYS_putmsg: 50050Sstevel@tonic-gate case SYS_putpmsg: 50060Sstevel@tonic-gate show_gp_msg(pri, what); 50070Sstevel@tonic-gate break; 50080Sstevel@tonic-gate case SYS_pollsys: 50090Sstevel@tonic-gate show_pollsys(pri); 50100Sstevel@tonic-gate break; 50110Sstevel@tonic-gate case SYS_setgroups: 50120Sstevel@tonic-gate if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0) 50130Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 50140Sstevel@tonic-gate break; 50150Sstevel@tonic-gate case SYS_getgroups: 50160Sstevel@tonic-gate if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0) 50170Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 50180Sstevel@tonic-gate break; 50190Sstevel@tonic-gate case SYS_sigprocmask: 50200Sstevel@tonic-gate if (pri->sys_nargs > 1) 50210Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], " set"); 50220Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 50230Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[2], "oset"); 50240Sstevel@tonic-gate break; 50250Sstevel@tonic-gate case SYS_sigsuspend: 50260Sstevel@tonic-gate case SYS_sigtimedwait: 50270Sstevel@tonic-gate if (pri->sys_nargs > 0) 50280Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[0], "sigmask"); 50290Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 50300Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[1]); 50310Sstevel@tonic-gate if (pri->sys_nargs > 2) 50320Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 50330Sstevel@tonic-gate break; 50340Sstevel@tonic-gate case SYS_sigaltstack: 50350Sstevel@tonic-gate if (pri->sys_nargs > 0) 50360Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[0], 50377088Sraf "new"); 50380Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 50390Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[1], 50407088Sraf "old"); 50410Sstevel@tonic-gate break; 50420Sstevel@tonic-gate case SYS_sigaction: 50430Sstevel@tonic-gate if (pri->sys_nargs > 1) 50440Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[1], 50457088Sraf "new", NULL); 50460Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 50470Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[2], 50487088Sraf "old", r0); 50490Sstevel@tonic-gate break; 50504806Sraf case SYS_signotify: 50514806Sraf if (pri->sys_nargs > 1) 50524806Sraf show_siginfo(pri, (long)pri->sys_args[1]); 50534806Sraf break; 50544806Sraf case SYS_sigresend: 50554806Sraf if (pri->sys_nargs > 1) 50564806Sraf show_siginfo(pri, (long)pri->sys_args[1]); 50574806Sraf if (pri->sys_nargs > 2) 50584806Sraf show_sigset(pri, (long)pri->sys_args[2], "sigmask"); 50594806Sraf break; 50600Sstevel@tonic-gate case SYS_sigpending: 50610Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 50620Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], "sigmask"); 50630Sstevel@tonic-gate break; 50645891Sraf case SYS_waitid: 50650Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 50660Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[2]); 50670Sstevel@tonic-gate break; 50680Sstevel@tonic-gate case SYS_sigsendsys: 50690Sstevel@tonic-gate if (pri->sys_nargs > 0) 50700Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[0]); 50710Sstevel@tonic-gate break; 50720Sstevel@tonic-gate case SYS_priocntlsys: 50730Sstevel@tonic-gate if (pri->sys_nargs > 1) 50740Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[1]); 50750Sstevel@tonic-gate break; 50760Sstevel@tonic-gate case SYS_mincore: 50770Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 50780Sstevel@tonic-gate show_bool(pri, (long)pri->sys_args[2], 50797088Sraf (pri->sys_args[1] + pagesize - 1) / pagesize); 50800Sstevel@tonic-gate break; 50810Sstevel@tonic-gate case SYS_readv: 50820Sstevel@tonic-gate case SYS_writev: 50830Sstevel@tonic-gate if (pri->sys_nargs > 2) { 50840Sstevel@tonic-gate int i = pri->sys_args[0]+1; 50850Sstevel@tonic-gate int showbuf = FALSE; 50860Sstevel@tonic-gate long nb = (what == SYS_readv)? r0 : 32*1024; 50870Sstevel@tonic-gate 50880Sstevel@tonic-gate if ((what == SYS_readv && !err && 50890Sstevel@tonic-gate prismember(&readfd, i)) || 50900Sstevel@tonic-gate (what == SYS_writev && 50910Sstevel@tonic-gate prismember(&writefd, i))) 50920Sstevel@tonic-gate showbuf = TRUE; 50930Sstevel@tonic-gate show_iovec(pri, (long)pri->sys_args[1], 50947088Sraf pri->sys_args[2], showbuf, nb); 50950Sstevel@tonic-gate } 50960Sstevel@tonic-gate break; 50970Sstevel@tonic-gate case SYS_getrlimit: 50980Sstevel@tonic-gate if (err) 50990Sstevel@tonic-gate break; 51000Sstevel@tonic-gate /*FALLTHROUGH*/ 51010Sstevel@tonic-gate case SYS_setrlimit: 51020Sstevel@tonic-gate if (pri->sys_nargs <= 1) 51030Sstevel@tonic-gate break; 51040Sstevel@tonic-gate #ifdef _LP64 51050Sstevel@tonic-gate if (lp64) 51060Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 51070Sstevel@tonic-gate else 51080Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 51090Sstevel@tonic-gate #else 51100Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 51110Sstevel@tonic-gate #endif 51120Sstevel@tonic-gate break; 51130Sstevel@tonic-gate case SYS_getrlimit64: 51140Sstevel@tonic-gate if (err) 51150Sstevel@tonic-gate break; 51160Sstevel@tonic-gate /*FALLTHROUGH*/ 51170Sstevel@tonic-gate case SYS_setrlimit64: 51180Sstevel@tonic-gate if (pri->sys_nargs <= 1) 51190Sstevel@tonic-gate break; 51200Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 51210Sstevel@tonic-gate break; 51220Sstevel@tonic-gate case SYS_uname: 51230Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 51240Sstevel@tonic-gate show_nuname(pri, (long)pri->sys_args[0]); 51250Sstevel@tonic-gate break; 51260Sstevel@tonic-gate case SYS_adjtime: 51270Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 51280Sstevel@tonic-gate show_adjtime(pri, (long)pri->sys_args[0], 51297088Sraf (long)pri->sys_args[1]); 51300Sstevel@tonic-gate break; 51310Sstevel@tonic-gate case SYS_lwp_info: 51320Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 51330Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "cpu time"); 51340Sstevel@tonic-gate break; 51350Sstevel@tonic-gate case SYS_lwp_wait: 51360Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 51370Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[1], "lwpid"); 51380Sstevel@tonic-gate break; 51390Sstevel@tonic-gate case SYS_lwp_mutex_wakeup: 51400Sstevel@tonic-gate case SYS_lwp_mutex_unlock: 51410Sstevel@tonic-gate case SYS_lwp_mutex_trylock: 51424574Sraf case SYS_lwp_mutex_register: 51430Sstevel@tonic-gate if (pri->sys_nargs > 0) 51440Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 51450Sstevel@tonic-gate break; 51460Sstevel@tonic-gate case SYS_lwp_mutex_timedlock: 51470Sstevel@tonic-gate if (pri->sys_nargs > 0) 51480Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 51490Sstevel@tonic-gate if (pri->sys_nargs > 1) 51500Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 51510Sstevel@tonic-gate break; 51520Sstevel@tonic-gate case SYS_lwp_cond_wait: 51530Sstevel@tonic-gate if (pri->sys_nargs > 0) 51540Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 51550Sstevel@tonic-gate if (pri->sys_nargs > 1) 51560Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[1]); 51570Sstevel@tonic-gate if (pri->sys_nargs > 2) 51580Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 51590Sstevel@tonic-gate break; 51600Sstevel@tonic-gate case SYS_lwp_cond_signal: 51610Sstevel@tonic-gate case SYS_lwp_cond_broadcast: 51620Sstevel@tonic-gate if (pri->sys_nargs > 0) 51630Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 51640Sstevel@tonic-gate break; 51650Sstevel@tonic-gate case SYS_lwp_sema_trywait: 51660Sstevel@tonic-gate case SYS_lwp_sema_post: 51670Sstevel@tonic-gate if (pri->sys_nargs > 0) 51680Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 51690Sstevel@tonic-gate break; 51700Sstevel@tonic-gate case SYS_lwp_sema_timedwait: 51710Sstevel@tonic-gate if (pri->sys_nargs > 0) 51720Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 51730Sstevel@tonic-gate if (pri->sys_nargs > 1) 51740Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 51750Sstevel@tonic-gate break; 51760Sstevel@tonic-gate case SYS_lwp_rwlock_sys: 51770Sstevel@tonic-gate if (pri->sys_nargs > 1) 51780Sstevel@tonic-gate show_rwlock(pri, (long)pri->sys_args[1]); 51790Sstevel@tonic-gate if (pri->sys_nargs > 2 && 51800Sstevel@tonic-gate (pri->sys_args[0] == 0 || pri->sys_args[0] == 1)) 51810Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 51820Sstevel@tonic-gate break; 51830Sstevel@tonic-gate case SYS_lwp_create: 51840Sstevel@tonic-gate /* XXX print some values in ucontext ??? */ 51850Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 51860Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[2], "lwpid"); 51870Sstevel@tonic-gate break; 51880Sstevel@tonic-gate case SYS_kaio: 51890Sstevel@tonic-gate if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1) 51900Sstevel@tonic-gate show_timeval(pri, (long)pri->sys_args[1], "timeout"); 51910Sstevel@tonic-gate break; 51920Sstevel@tonic-gate case SYS_nanosleep: 51930Sstevel@tonic-gate if (pri->sys_nargs > 0) 51940Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "tmout"); 51950Sstevel@tonic-gate if (pri->sys_nargs > 1 && (err == 0 || err == EINTR)) 51960Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "resid"); 51970Sstevel@tonic-gate break; 51980Sstevel@tonic-gate case SYS_privsys: 51990Sstevel@tonic-gate switch (pri->sys_args[0]) { 52000Sstevel@tonic-gate case PRIVSYS_SETPPRIV: 52010Sstevel@tonic-gate case PRIVSYS_GETPPRIV: 52020Sstevel@tonic-gate if (!err) 52030Sstevel@tonic-gate show_privset(pri, (long)pri->sys_args[3], 52047088Sraf (size_t)pri->sys_args[4], ""); 52050Sstevel@tonic-gate } 52060Sstevel@tonic-gate break; 52070Sstevel@tonic-gate case SYS_ucredsys: 52080Sstevel@tonic-gate switch (pri->sys_args[0]) { 52090Sstevel@tonic-gate case UCREDSYS_UCREDGET: 52100Sstevel@tonic-gate case UCREDSYS_GETPEERUCRED: 52110Sstevel@tonic-gate if (err == 0) 52120Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[2]); 52130Sstevel@tonic-gate break; 52140Sstevel@tonic-gate } 52150Sstevel@tonic-gate break; 52160Sstevel@tonic-gate case SYS_bind: 52170Sstevel@tonic-gate case SYS_connect: 52180Sstevel@tonic-gate if (pri->sys_nargs > 2) 52190Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 52207088Sraf 0, (long)pri->sys_args[2]); 52210Sstevel@tonic-gate break; 52220Sstevel@tonic-gate case SYS_sendto: 52230Sstevel@tonic-gate if (pri->sys_nargs > 5) 52240Sstevel@tonic-gate show_sockaddr(pri, "to", (long)pri->sys_args[4], 0, 52257088Sraf pri->sys_args[5]); 52260Sstevel@tonic-gate break; 52270Sstevel@tonic-gate case SYS_accept: 52280Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 52290Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 52307088Sraf (long)pri->sys_args[2], 0); 52310Sstevel@tonic-gate break; 52320Sstevel@tonic-gate case SYS_getsockname: 52330Sstevel@tonic-gate case SYS_getpeername: 52340Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 52350Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 52367088Sraf (long)pri->sys_args[2], 0); 52370Sstevel@tonic-gate break; 52380Sstevel@tonic-gate case SYS_cladm: 52390Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 52400Sstevel@tonic-gate show_cladm(pri, pri->sys_args[0], pri->sys_args[1], 52410Sstevel@tonic-gate (long)pri->sys_args[2]); 52420Sstevel@tonic-gate break; 52430Sstevel@tonic-gate case SYS_recvfrom: 52440Sstevel@tonic-gate if (!err && pri->sys_nargs > 5) 52450Sstevel@tonic-gate show_sockaddr(pri, "from", (long)pri->sys_args[4], 52467088Sraf (long)pri->sys_args[5], 0); 52470Sstevel@tonic-gate break; 52480Sstevel@tonic-gate case SYS_recvmsg: 52490Sstevel@tonic-gate if (err) 52500Sstevel@tonic-gate break; 52510Sstevel@tonic-gate /* FALLTHROUGH */ 52520Sstevel@tonic-gate case SYS_sendmsg: 5253328Sja97890 if (pri->sys_nargs <= 2) 52540Sstevel@tonic-gate break; 52550Sstevel@tonic-gate #ifdef _LP64 52560Sstevel@tonic-gate if (lp64) 52570Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 52580Sstevel@tonic-gate else 52590Sstevel@tonic-gate show_msghdr32(pri, pri->sys_args[1]); 52600Sstevel@tonic-gate #else 52610Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 52620Sstevel@tonic-gate #endif 52630Sstevel@tonic-gate break; 52640Sstevel@tonic-gate case SYS_door: 52650Sstevel@tonic-gate show_doors(pri); 52660Sstevel@tonic-gate break; 52670Sstevel@tonic-gate case SYS_sendfilev: 52680Sstevel@tonic-gate if (pri->sys_nargs != 5) 52690Sstevel@tonic-gate break; 52700Sstevel@tonic-gate 52710Sstevel@tonic-gate if (pri->sys_args[0] == SENDFILEV) { 52720Sstevel@tonic-gate show_sendfilevec(pri, (int)pri->sys_args[1], 52737088Sraf (sendfilevec_t *)pri->sys_args[2], 52747088Sraf (int)pri->sys_args[3]); 52750Sstevel@tonic-gate } else if (pri->sys_args[0] == SENDFILEV64) { 52760Sstevel@tonic-gate show_sendfilevec64(pri, (int)pri->sys_args[1], 52777088Sraf (sendfilevec64_t *)pri->sys_args[2], 52787088Sraf (int)pri->sys_args[3]); 52790Sstevel@tonic-gate } 52800Sstevel@tonic-gate break; 52810Sstevel@tonic-gate case SYS_memcntl: 52820Sstevel@tonic-gate show_memcntl(pri); 52830Sstevel@tonic-gate break; 52840Sstevel@tonic-gate case SYS_lwp_park: 52854389Ssl108498 /* 52864389Ssl108498 * subcode 0: lwp_park(timespec_t *, id_t) 52874389Ssl108498 * subcode 4: lwp_set_park(timespec_t *, id_t) 52884389Ssl108498 */ 52894389Ssl108498 if (pri->sys_nargs > 1 && 52904389Ssl108498 (pri->sys_args[0] == 0 || pri->sys_args[0] == 4)) 52910Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 52920Sstevel@tonic-gate /* subcode 2: lwp_unpark_all(id_t *, int) */ 52930Sstevel@tonic-gate if (pri->sys_nargs > 2 && pri->sys_args[0] == 2) 52940Sstevel@tonic-gate show_ids(pri, (long)pri->sys_args[1], 52954389Ssl108498 (int)pri->sys_args[2]); 52960Sstevel@tonic-gate break; 52970Sstevel@tonic-gate case SYS_ntp_gettime: 52980Sstevel@tonic-gate if (!err) 52990Sstevel@tonic-gate show_ntp_gettime(pri); 53000Sstevel@tonic-gate break; 53010Sstevel@tonic-gate case SYS_ntp_adjtime: 53020Sstevel@tonic-gate if (!err) 53030Sstevel@tonic-gate show_ntp_adjtime(pri); 53040Sstevel@tonic-gate break; 53050Sstevel@tonic-gate case SYS_rusagesys: 53060Sstevel@tonic-gate if (!err) 53070Sstevel@tonic-gate if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) { 53080Sstevel@tonic-gate #ifdef _LP64 53090Sstevel@tonic-gate if (!lp64) 53107088Sraf show_getrusage32(pri->sys_args[1]); 53110Sstevel@tonic-gate else 53120Sstevel@tonic-gate #endif 53137088Sraf show_getrusage(pri->sys_args[1]); 53140Sstevel@tonic-gate } 53150Sstevel@tonic-gate break; 53160Sstevel@tonic-gate case SYS_port: 53170Sstevel@tonic-gate show_ports(pri); 53180Sstevel@tonic-gate break; 5319813Sdp case SYS_zone: 5320813Sdp show_zones(pri); 5321813Sdp break; 53222447Snf202958 case SYS_rctlsys: 53232447Snf202958 show_rctls(pri); 53242447Snf202958 break; 532510440SRoger.Faulkner@Sun.COM case SYS_utimesys: 532610440SRoger.Faulkner@Sun.COM show_utimesys(pri); 532710440SRoger.Faulkner@Sun.COM break; 5328*12643SAnders.Persson@Sun.COM case SYS_sockconfig: 5329*12643SAnders.Persson@Sun.COM show_sockconfig(pri); 5330*12643SAnders.Persson@Sun.COM break; 53310Sstevel@tonic-gate } 53320Sstevel@tonic-gate } 5333