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 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 280Sstevel@tonic-gate /* All Rights Reserved */ 290Sstevel@tonic-gate 300Sstevel@tonic-gate 310Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 320Sstevel@tonic-gate 330Sstevel@tonic-gate #define _SYSCALL32 340Sstevel@tonic-gate 350Sstevel@tonic-gate #include <stdio.h> 360Sstevel@tonic-gate #include <stdlib.h> 370Sstevel@tonic-gate #include <unistd.h> 380Sstevel@tonic-gate #include <ctype.h> 390Sstevel@tonic-gate #include <sys/types.h> 400Sstevel@tonic-gate #include <sys/mman.h> 410Sstevel@tonic-gate #include <libproc.h> 420Sstevel@tonic-gate #include <string.h> 430Sstevel@tonic-gate #include <limits.h> 440Sstevel@tonic-gate #include <sys/statfs.h> 450Sstevel@tonic-gate #include <sys/times.h> 460Sstevel@tonic-gate #include <sys/timex.h> 470Sstevel@tonic-gate #include <sys/utssys.h> 480Sstevel@tonic-gate #include <sys/utsname.h> 490Sstevel@tonic-gate #include <sys/ipc.h> 500Sstevel@tonic-gate #include <sys/ipc_impl.h> 510Sstevel@tonic-gate #include <sys/msg.h> 520Sstevel@tonic-gate #include <sys/msg_impl.h> 530Sstevel@tonic-gate #include <sys/sem.h> 540Sstevel@tonic-gate #include <sys/sem_impl.h> 550Sstevel@tonic-gate #include <sys/shm.h> 560Sstevel@tonic-gate #include <sys/shm_impl.h> 570Sstevel@tonic-gate #include <sys/dirent.h> 580Sstevel@tonic-gate #include <sys/utime.h> 590Sstevel@tonic-gate #include <ustat.h> 600Sstevel@tonic-gate #include <fcntl.h> 610Sstevel@tonic-gate #include <time.h> 620Sstevel@tonic-gate #include <sys/termios.h> 630Sstevel@tonic-gate #include <sys/termiox.h> 640Sstevel@tonic-gate #include <sys/termio.h> 650Sstevel@tonic-gate #include <sys/ttold.h> 660Sstevel@tonic-gate #include <sys/jioctl.h> 670Sstevel@tonic-gate #include <sys/filio.h> 680Sstevel@tonic-gate #include <stropts.h> 690Sstevel@tonic-gate #include <poll.h> 700Sstevel@tonic-gate #include <sys/uio.h> 710Sstevel@tonic-gate #include <sys/resource.h> 720Sstevel@tonic-gate #include <sys/statvfs.h> 730Sstevel@tonic-gate #include <sys/time.h> 740Sstevel@tonic-gate #include <sys/aio.h> 750Sstevel@tonic-gate #include <sys/socket.h> 760Sstevel@tonic-gate #include <netinet/in.h> 770Sstevel@tonic-gate #include <sys/un.h> 780Sstevel@tonic-gate #include <sys/byteorder.h> 790Sstevel@tonic-gate #include <arpa/inet.h> 800Sstevel@tonic-gate #include <sys/audioio.h> 810Sstevel@tonic-gate #include <sys/cladm.h> 820Sstevel@tonic-gate #include <sys/synch.h> 830Sstevel@tonic-gate #include <sys/synch32.h> 840Sstevel@tonic-gate #include <sys/sysmacros.h> 850Sstevel@tonic-gate #include <sys/sendfile.h> 860Sstevel@tonic-gate #include <priv.h> 870Sstevel@tonic-gate #include <ucred.h> 880Sstevel@tonic-gate #include <sys/ucred.h> 890Sstevel@tonic-gate #include <sys/port_impl.h> 900Sstevel@tonic-gate 910Sstevel@tonic-gate #include "ramdata.h" 920Sstevel@tonic-gate #include "systable.h" 930Sstevel@tonic-gate #include "proto.h" 940Sstevel@tonic-gate 950Sstevel@tonic-gate void show_sigset(private_t *, long, const char *); 960Sstevel@tonic-gate void show_ioctl(private_t *, int, long); 970Sstevel@tonic-gate 980Sstevel@tonic-gate void 990Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value) 1000Sstevel@tonic-gate { 1010Sstevel@tonic-gate char str[80]; 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate (void) strftime(str, sizeof (str), "%b %e %H:%M:%S %Z %Y", 1040Sstevel@tonic-gate localtime(&value)); 1050Sstevel@tonic-gate (void) printf("%s\t%s%s [ %llu ]\n", 1060Sstevel@tonic-gate pri->pname, 1070Sstevel@tonic-gate name, 1080Sstevel@tonic-gate str, 1090Sstevel@tonic-gate (longlong_t)value); 1100Sstevel@tonic-gate } 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate void 1130Sstevel@tonic-gate prtimestruc(private_t *pri, const char *name, timestruc_t *value) 1140Sstevel@tonic-gate { 1150Sstevel@tonic-gate prtime(pri, name, value->tv_sec); 1160Sstevel@tonic-gate } 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate void 1190Sstevel@tonic-gate show_utime(private_t *pri) 1200Sstevel@tonic-gate { 1210Sstevel@tonic-gate long offset; 1220Sstevel@tonic-gate struct utimbuf utimbuf; 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL) 1250Sstevel@tonic-gate return; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1280Sstevel@tonic-gate if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) 1290Sstevel@tonic-gate != sizeof (utimbuf)) 1300Sstevel@tonic-gate return; 1310Sstevel@tonic-gate } else { 1320Sstevel@tonic-gate struct utimbuf32 utimbuf32; 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) 1350Sstevel@tonic-gate != sizeof (utimbuf32)) 1360Sstevel@tonic-gate return; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate utimbuf.actime = (time_t)utimbuf32.actime; 1390Sstevel@tonic-gate utimbuf.modtime = (time_t)utimbuf32.modtime; 1400Sstevel@tonic-gate } 1410Sstevel@tonic-gate 1420Sstevel@tonic-gate /* print access and modification times */ 1430Sstevel@tonic-gate prtime(pri, "atime: ", utimbuf.actime); 1440Sstevel@tonic-gate prtime(pri, "mtime: ", utimbuf.modtime); 1450Sstevel@tonic-gate } 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate void 1480Sstevel@tonic-gate show_utimes(private_t *pri) 1490Sstevel@tonic-gate { 1500Sstevel@tonic-gate long offset; 1510Sstevel@tonic-gate struct { 1520Sstevel@tonic-gate struct timeval atime; 1530Sstevel@tonic-gate struct timeval mtime; 1540Sstevel@tonic-gate } utimbuf; 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL) 1570Sstevel@tonic-gate return; 1580Sstevel@tonic-gate 1590Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1600Sstevel@tonic-gate if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) 1610Sstevel@tonic-gate != sizeof (utimbuf)) 1620Sstevel@tonic-gate return; 1630Sstevel@tonic-gate } else { 1640Sstevel@tonic-gate struct { 1650Sstevel@tonic-gate struct timeval32 atime; 1660Sstevel@tonic-gate struct timeval32 mtime; 1670Sstevel@tonic-gate } utimbuf32; 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) 1700Sstevel@tonic-gate != sizeof (utimbuf32)) 1710Sstevel@tonic-gate return; 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&utimbuf.atime, &utimbuf32.atime); 1740Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&utimbuf.mtime, &utimbuf32.mtime); 1750Sstevel@tonic-gate } 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate /* print access and modification times */ 1780Sstevel@tonic-gate prtime(pri, "atime: ", utimbuf.atime.tv_sec); 1790Sstevel@tonic-gate prtime(pri, "mtime: ", utimbuf.mtime.tv_sec); 1800Sstevel@tonic-gate } 1810Sstevel@tonic-gate 1820Sstevel@tonic-gate void 1830Sstevel@tonic-gate show_timeofday(private_t *pri) 1840Sstevel@tonic-gate { 1850Sstevel@tonic-gate struct timeval tod; 1860Sstevel@tonic-gate long offset; 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 1890Sstevel@tonic-gate return; 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1920Sstevel@tonic-gate if (Pread(Proc, &tod, sizeof (tod), offset) 1930Sstevel@tonic-gate != sizeof (tod)) 1940Sstevel@tonic-gate return; 1950Sstevel@tonic-gate } else { 1960Sstevel@tonic-gate struct timeval32 tod32; 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate if (Pread(Proc, &tod32, sizeof (tod32), offset) 1990Sstevel@tonic-gate != sizeof (tod32)) 2000Sstevel@tonic-gate return; 2010Sstevel@tonic-gate 2020Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&tod, &tod32); 2030Sstevel@tonic-gate } 2040Sstevel@tonic-gate 2050Sstevel@tonic-gate prtime(pri, "time: ", tod.tv_sec); 2060Sstevel@tonic-gate } 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate void 2090Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name) 2100Sstevel@tonic-gate { 2110Sstevel@tonic-gate struct itimerval itimerval; 2120Sstevel@tonic-gate 2130Sstevel@tonic-gate if (offset == NULL) 2140Sstevel@tonic-gate return; 2150Sstevel@tonic-gate 2160Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2170Sstevel@tonic-gate if (Pread(Proc, &itimerval, sizeof (itimerval), offset) 2180Sstevel@tonic-gate != sizeof (itimerval)) 2190Sstevel@tonic-gate return; 2200Sstevel@tonic-gate } else { 2210Sstevel@tonic-gate struct itimerval32 itimerval32; 2220Sstevel@tonic-gate 2230Sstevel@tonic-gate if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset) 2240Sstevel@tonic-gate != sizeof (itimerval32)) 2250Sstevel@tonic-gate return; 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32); 2280Sstevel@tonic-gate } 2290Sstevel@tonic-gate 2300Sstevel@tonic-gate (void) printf( 2310Sstevel@tonic-gate "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n", 2320Sstevel@tonic-gate pri->pname, 2330Sstevel@tonic-gate name, 2340Sstevel@tonic-gate itimerval.it_interval.tv_sec, 2350Sstevel@tonic-gate itimerval.it_interval.tv_usec, 2360Sstevel@tonic-gate itimerval.it_value.tv_sec, 2370Sstevel@tonic-gate itimerval.it_value.tv_usec); 2380Sstevel@tonic-gate } 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate void 2410Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name) 2420Sstevel@tonic-gate { 2430Sstevel@tonic-gate struct timeval timeval; 2440Sstevel@tonic-gate 2450Sstevel@tonic-gate if (offset == NULL) 2460Sstevel@tonic-gate return; 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2490Sstevel@tonic-gate if (Pread(Proc, &timeval, sizeof (timeval), offset) 2500Sstevel@tonic-gate != sizeof (timeval)) 2510Sstevel@tonic-gate return; 2520Sstevel@tonic-gate } else { 2530Sstevel@tonic-gate struct timeval32 timeval32; 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate if (Pread(Proc, &timeval32, sizeof (timeval32), offset) 2560Sstevel@tonic-gate != sizeof (timeval32)) 2570Sstevel@tonic-gate return; 2580Sstevel@tonic-gate 2590Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32); 2600Sstevel@tonic-gate } 2610Sstevel@tonic-gate 2620Sstevel@tonic-gate (void) printf( 2630Sstevel@tonic-gate "%s\t%s: %ld.%6.6ld sec\n", 2640Sstevel@tonic-gate pri->pname, 2650Sstevel@tonic-gate name, 2660Sstevel@tonic-gate timeval.tv_sec, 2670Sstevel@tonic-gate timeval.tv_usec); 2680Sstevel@tonic-gate } 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate void 2710Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name) 2720Sstevel@tonic-gate { 2730Sstevel@tonic-gate timestruc_t timestruc; 2740Sstevel@tonic-gate 2750Sstevel@tonic-gate if (offset == NULL) 2760Sstevel@tonic-gate return; 2770Sstevel@tonic-gate 2780Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2790Sstevel@tonic-gate if (Pread(Proc, ×truc, sizeof (timestruc), offset) 2800Sstevel@tonic-gate != sizeof (timestruc)) 2810Sstevel@tonic-gate return; 2820Sstevel@tonic-gate } else { 2830Sstevel@tonic-gate timestruc32_t timestruc32; 2840Sstevel@tonic-gate 2850Sstevel@tonic-gate if (Pread(Proc, ×truc32, sizeof (timestruc32), offset) 2860Sstevel@tonic-gate != sizeof (timestruc32)) 2870Sstevel@tonic-gate return; 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate TIMESPEC32_TO_TIMESPEC(×truc, ×truc32); 2900Sstevel@tonic-gate } 2910Sstevel@tonic-gate 2920Sstevel@tonic-gate (void) printf( 2930Sstevel@tonic-gate "%s\t%s: %ld.%9.9ld sec\n", 2940Sstevel@tonic-gate pri->pname, 2950Sstevel@tonic-gate name, 2960Sstevel@tonic-gate timestruc.tv_sec, 2970Sstevel@tonic-gate timestruc.tv_nsec); 2980Sstevel@tonic-gate } 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate void 3010Sstevel@tonic-gate show_stime(private_t *pri) 3020Sstevel@tonic-gate { 3030Sstevel@tonic-gate if (pri->sys_nargs >= 1) { 3040Sstevel@tonic-gate /* print new system time */ 3050Sstevel@tonic-gate prtime(pri, "systime = ", (time_t)pri->sys_args[0]); 3060Sstevel@tonic-gate } 3070Sstevel@tonic-gate } 3080Sstevel@tonic-gate 3090Sstevel@tonic-gate void 3100Sstevel@tonic-gate show_times(private_t *pri) 3110Sstevel@tonic-gate { 3120Sstevel@tonic-gate long hz = sysconf(_SC_CLK_TCK); 3130Sstevel@tonic-gate long offset; 3140Sstevel@tonic-gate struct tms tms; 3150Sstevel@tonic-gate 3160Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 3170Sstevel@tonic-gate return; 3180Sstevel@tonic-gate 3190Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 3200Sstevel@tonic-gate if (Pread(Proc, &tms, sizeof (tms), offset) 3210Sstevel@tonic-gate != sizeof (tms)) 3220Sstevel@tonic-gate return; 3230Sstevel@tonic-gate } else { 3240Sstevel@tonic-gate struct tms32 tms32; 3250Sstevel@tonic-gate 3260Sstevel@tonic-gate if (Pread(Proc, &tms32, sizeof (tms32), offset) 3270Sstevel@tonic-gate != sizeof (tms32)) 3280Sstevel@tonic-gate return; 3290Sstevel@tonic-gate 3300Sstevel@tonic-gate /* 3310Sstevel@tonic-gate * This looks a bit odd (since the values are actually 3320Sstevel@tonic-gate * signed), but we need to suppress sign extension to 3330Sstevel@tonic-gate * preserve compatibility (we've always printed these 3340Sstevel@tonic-gate * numbers as unsigned quantities). 3350Sstevel@tonic-gate */ 3360Sstevel@tonic-gate tms.tms_utime = (unsigned)tms32.tms_utime; 3370Sstevel@tonic-gate tms.tms_stime = (unsigned)tms32.tms_stime; 3380Sstevel@tonic-gate tms.tms_cutime = (unsigned)tms32.tms_cutime; 3390Sstevel@tonic-gate tms.tms_cstime = (unsigned)tms32.tms_cstime; 3400Sstevel@tonic-gate } 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate (void) printf( 3430Sstevel@tonic-gate "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n", 3440Sstevel@tonic-gate pri->pname, 3450Sstevel@tonic-gate tms.tms_utime, 3460Sstevel@tonic-gate tms.tms_stime, 3470Sstevel@tonic-gate tms.tms_cutime, 3480Sstevel@tonic-gate tms.tms_cstime, 3490Sstevel@tonic-gate hz); 3500Sstevel@tonic-gate } 3510Sstevel@tonic-gate 3520Sstevel@tonic-gate void 3530Sstevel@tonic-gate show_uname(private_t *pri, long offset) 3540Sstevel@tonic-gate { 3550Sstevel@tonic-gate /* 3560Sstevel@tonic-gate * Old utsname buffer (no longer accessible in <sys/utsname.h>). 3570Sstevel@tonic-gate */ 3580Sstevel@tonic-gate struct { 3590Sstevel@tonic-gate char sysname[9]; 3600Sstevel@tonic-gate char nodename[9]; 3610Sstevel@tonic-gate char release[9]; 3620Sstevel@tonic-gate char version[9]; 3630Sstevel@tonic-gate char machine[9]; 3640Sstevel@tonic-gate } ubuf; 3650Sstevel@tonic-gate 3660Sstevel@tonic-gate if (offset != NULL && 3670Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3680Sstevel@tonic-gate (void) printf( 3690Sstevel@tonic-gate "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n", 3700Sstevel@tonic-gate pri->pname, 3710Sstevel@tonic-gate ubuf.sysname, 3720Sstevel@tonic-gate ubuf.nodename, 3730Sstevel@tonic-gate ubuf.release, 3740Sstevel@tonic-gate ubuf.version, 3750Sstevel@tonic-gate ubuf.machine); 3760Sstevel@tonic-gate } 3770Sstevel@tonic-gate } 3780Sstevel@tonic-gate 3790Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */ 3800Sstevel@tonic-gate void 3810Sstevel@tonic-gate show_ustat(private_t *pri, long offset) 3820Sstevel@tonic-gate { 3830Sstevel@tonic-gate struct ustat ubuf; 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate if (offset != NULL && 3860Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3870Sstevel@tonic-gate (void) printf( 3880Sstevel@tonic-gate "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n", 3890Sstevel@tonic-gate pri->pname, 3900Sstevel@tonic-gate ubuf.f_tfree, 3910Sstevel@tonic-gate ubuf.f_tinode, 3920Sstevel@tonic-gate ubuf.f_fname, 3930Sstevel@tonic-gate ubuf.f_fpack); 3940Sstevel@tonic-gate } 3950Sstevel@tonic-gate } 3960Sstevel@tonic-gate 3970Sstevel@tonic-gate #ifdef _LP64 3980Sstevel@tonic-gate void 3990Sstevel@tonic-gate show_ustat32(private_t *pri, long offset) 4000Sstevel@tonic-gate { 4010Sstevel@tonic-gate struct ustat32 ubuf; 4020Sstevel@tonic-gate 4030Sstevel@tonic-gate if (offset != NULL && 4040Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 4050Sstevel@tonic-gate (void) printf( 4060Sstevel@tonic-gate "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n", 4070Sstevel@tonic-gate pri->pname, 4080Sstevel@tonic-gate ubuf.f_tfree, 4090Sstevel@tonic-gate ubuf.f_tinode, 4100Sstevel@tonic-gate ubuf.f_fname, 4110Sstevel@tonic-gate ubuf.f_fpack); 4120Sstevel@tonic-gate } 4130Sstevel@tonic-gate } 4140Sstevel@tonic-gate #endif /* _LP64 */ 4150Sstevel@tonic-gate 4160Sstevel@tonic-gate void 4170Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc) 4180Sstevel@tonic-gate { 4190Sstevel@tonic-gate f_user_t fubuf; 4200Sstevel@tonic-gate int serial = (nproc > 4); 4210Sstevel@tonic-gate 4220Sstevel@tonic-gate if (offset == NULL) 4230Sstevel@tonic-gate return; 4240Sstevel@tonic-gate 4250Sstevel@tonic-gate /* enter region of lengthy output */ 4260Sstevel@tonic-gate if (serial) 4270Sstevel@tonic-gate Eserialize(); 4280Sstevel@tonic-gate 4290Sstevel@tonic-gate while (nproc > 0 && 4300Sstevel@tonic-gate Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) { 4310Sstevel@tonic-gate (void) printf("%s\tpid=%-5d uid=%-5d flags=%s\n", 4320Sstevel@tonic-gate pri->pname, 4330Sstevel@tonic-gate (int)fubuf.fu_pid, 4340Sstevel@tonic-gate (int)fubuf.fu_uid, 4350Sstevel@tonic-gate fuflags(pri, fubuf.fu_flags)); 4360Sstevel@tonic-gate nproc--; 4370Sstevel@tonic-gate offset += sizeof (fubuf); 4380Sstevel@tonic-gate } 4390Sstevel@tonic-gate 4400Sstevel@tonic-gate /* exit region of lengthy output */ 4410Sstevel@tonic-gate if (serial) 4420Sstevel@tonic-gate Xserialize(); 4430Sstevel@tonic-gate } 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate void 4460Sstevel@tonic-gate show_utssys(private_t *pri, long r0) 4470Sstevel@tonic-gate { 4480Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4490Sstevel@tonic-gate switch (pri->sys_args[2]) { 4500Sstevel@tonic-gate case UTS_UNAME: 4510Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4520Sstevel@tonic-gate break; 4530Sstevel@tonic-gate case UTS_USTAT: 4540Sstevel@tonic-gate show_ustat(pri, (long)pri->sys_args[0]); 4550Sstevel@tonic-gate break; 4560Sstevel@tonic-gate case UTS_FUSERS: 4570Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4580Sstevel@tonic-gate break; 4590Sstevel@tonic-gate } 4600Sstevel@tonic-gate } 4610Sstevel@tonic-gate } 4620Sstevel@tonic-gate 4630Sstevel@tonic-gate #ifdef _LP64 4640Sstevel@tonic-gate void 4650Sstevel@tonic-gate show_utssys32(private_t *pri, long r0) 4660Sstevel@tonic-gate { 4670Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4680Sstevel@tonic-gate switch (pri->sys_args[2]) { 4690Sstevel@tonic-gate case UTS_UNAME: 4700Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4710Sstevel@tonic-gate break; 4720Sstevel@tonic-gate case UTS_USTAT: 4730Sstevel@tonic-gate show_ustat32(pri, (long)pri->sys_args[0]); 4740Sstevel@tonic-gate break; 4750Sstevel@tonic-gate case UTS_FUSERS: 4760Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4770Sstevel@tonic-gate break; 4780Sstevel@tonic-gate } 4790Sstevel@tonic-gate } 4800Sstevel@tonic-gate } 4810Sstevel@tonic-gate #endif /* _LP64 */ 4820Sstevel@tonic-gate 4830Sstevel@tonic-gate void 4840Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset) 4850Sstevel@tonic-gate { 4860Sstevel@tonic-gate int arg; 4870Sstevel@tonic-gate 4880Sstevel@tonic-gate switch (code) { 4890Sstevel@tonic-gate case CL_INITIALIZE: 4900Sstevel@tonic-gate switch (function) { 4910Sstevel@tonic-gate case CL_GET_BOOTFLAG: 4920Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 4930Sstevel@tonic-gate == sizeof (arg)) { 4940Sstevel@tonic-gate if (arg & CLUSTER_CONFIGURED) 4950Sstevel@tonic-gate (void) printf("%s\tbootflags=" 4960Sstevel@tonic-gate "CLUSTER_CONFIGURED", pri->pname); 4970Sstevel@tonic-gate if (arg & CLUSTER_BOOTED) 4980Sstevel@tonic-gate (void) printf("|CLUSTER_BOOTED\n"); 4990Sstevel@tonic-gate } 5000Sstevel@tonic-gate break; 5010Sstevel@tonic-gate } 5020Sstevel@tonic-gate break; 5030Sstevel@tonic-gate case CL_CONFIG: 5040Sstevel@tonic-gate switch (function) { 5050Sstevel@tonic-gate case CL_NODEID: 5060Sstevel@tonic-gate case CL_HIGHEST_NODEID: 5070Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 5080Sstevel@tonic-gate == sizeof (arg)) 5090Sstevel@tonic-gate (void) printf("%s\tnodeid=%d\n", 5100Sstevel@tonic-gate pri->pname, arg); 5110Sstevel@tonic-gate } 5120Sstevel@tonic-gate break; 5130Sstevel@tonic-gate } 5140Sstevel@tonic-gate } 5150Sstevel@tonic-gate 5160Sstevel@tonic-gate #define ALL_LOCK_TYPES \ 5170Sstevel@tonic-gate (USYNC_PROCESS|LOCK_ERRORCHECK|LOCK_RECURSIVE|USYNC_PROCESS_ROBUST|\ 5180Sstevel@tonic-gate LOCK_PRIO_INHERIT|LOCK_PRIO_PROTECT|LOCK_ROBUST_NP) 5190Sstevel@tonic-gate 5200Sstevel@tonic-gate /* return cv and mutex types */ 5210Sstevel@tonic-gate const char * 5220Sstevel@tonic-gate synch_type(private_t *pri, uint_t type) 5230Sstevel@tonic-gate { 5240Sstevel@tonic-gate char *str = pri->code_buf; 5250Sstevel@tonic-gate 5260Sstevel@tonic-gate if (type & USYNC_PROCESS) 5270Sstevel@tonic-gate (void) strcpy(str, "USYNC_PROCESS"); 5280Sstevel@tonic-gate else 5290Sstevel@tonic-gate (void) strcpy(str, "USYNC_THREAD"); 5300Sstevel@tonic-gate 5310Sstevel@tonic-gate if (type & LOCK_ERRORCHECK) 5320Sstevel@tonic-gate (void) strcat(str, "|LOCK_ERRORCHECK"); 5330Sstevel@tonic-gate if (type & LOCK_RECURSIVE) 5340Sstevel@tonic-gate (void) strcat(str, "|LOCK_RECURSIVE"); 5350Sstevel@tonic-gate if (type & USYNC_PROCESS_ROBUST) 5360Sstevel@tonic-gate (void) strcat(str, "|USYNC_PROCESS_ROBUST"); 5370Sstevel@tonic-gate if (type & LOCK_PRIO_INHERIT) 5380Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_INHERIT"); 5390Sstevel@tonic-gate if (type & LOCK_PRIO_PROTECT) 5400Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_PROTECT"); 5410Sstevel@tonic-gate if (type & LOCK_ROBUST_NP) 5420Sstevel@tonic-gate (void) strcat(str, "|LOCK_ROBUST_NP"); 5430Sstevel@tonic-gate 5440Sstevel@tonic-gate if ((type &= ~ALL_LOCK_TYPES) != 0) 5450Sstevel@tonic-gate (void) sprintf(str + strlen(str), "|0x%.4X", type); 5460Sstevel@tonic-gate 5470Sstevel@tonic-gate return ((const char *)str); 5480Sstevel@tonic-gate } 5490Sstevel@tonic-gate 5500Sstevel@tonic-gate void 5510Sstevel@tonic-gate show_mutex(private_t *pri, long offset) 5520Sstevel@tonic-gate { 5530Sstevel@tonic-gate lwp_mutex_t mutex; 5540Sstevel@tonic-gate 5550Sstevel@tonic-gate if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) { 5560Sstevel@tonic-gate (void) printf("%s\tmutex type: %s\n", 5570Sstevel@tonic-gate pri->pname, 5580Sstevel@tonic-gate synch_type(pri, mutex.mutex_type)); 5590Sstevel@tonic-gate } 5600Sstevel@tonic-gate } 5610Sstevel@tonic-gate 5620Sstevel@tonic-gate void 5630Sstevel@tonic-gate show_condvar(private_t *pri, long offset) 5640Sstevel@tonic-gate { 5650Sstevel@tonic-gate lwp_cond_t condvar; 5660Sstevel@tonic-gate 5670Sstevel@tonic-gate if (Pread(Proc, &condvar, sizeof (condvar), offset) 5680Sstevel@tonic-gate == sizeof (condvar)) { 5690Sstevel@tonic-gate (void) printf("%s\tcondvar type: %s\n", 5700Sstevel@tonic-gate pri->pname, 5710Sstevel@tonic-gate synch_type(pri, condvar.cond_type)); 5720Sstevel@tonic-gate } 5730Sstevel@tonic-gate } 5740Sstevel@tonic-gate 5750Sstevel@tonic-gate void 5760Sstevel@tonic-gate show_sema(private_t *pri, long offset) 5770Sstevel@tonic-gate { 5780Sstevel@tonic-gate lwp_sema_t sema; 5790Sstevel@tonic-gate 5800Sstevel@tonic-gate if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) { 5810Sstevel@tonic-gate (void) printf("%s\tsema type: %s count = %u\n", 5820Sstevel@tonic-gate pri->pname, 5830Sstevel@tonic-gate synch_type(pri, sema.sema_type), 5840Sstevel@tonic-gate sema.sema_count); 5850Sstevel@tonic-gate } 5860Sstevel@tonic-gate } 5870Sstevel@tonic-gate 5880Sstevel@tonic-gate void 5890Sstevel@tonic-gate show_rwlock(private_t *pri, long offset) 5900Sstevel@tonic-gate { 5910Sstevel@tonic-gate lwp_rwlock_t rwlock; 5920Sstevel@tonic-gate 5930Sstevel@tonic-gate if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) { 5940Sstevel@tonic-gate (void) printf("%s\trwlock type: %s readers = %d\n", 5950Sstevel@tonic-gate pri->pname, 5960Sstevel@tonic-gate synch_type(pri, rwlock.rwlock_type), 5970Sstevel@tonic-gate rwlock.rwlock_readers); 5980Sstevel@tonic-gate } 5990Sstevel@tonic-gate } 6000Sstevel@tonic-gate 6010Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */ 6020Sstevel@tonic-gate char * 6030Sstevel@tonic-gate show_char(char *buf, int c) 6040Sstevel@tonic-gate { 6050Sstevel@tonic-gate const char *fmt; 6060Sstevel@tonic-gate 6070Sstevel@tonic-gate if (c >= ' ' && c < 0177) 6080Sstevel@tonic-gate fmt = "'%c'"; 6090Sstevel@tonic-gate else 6100Sstevel@tonic-gate fmt = "%.3o"; 6110Sstevel@tonic-gate 6120Sstevel@tonic-gate (void) sprintf(buf, fmt, c&0xff); 6130Sstevel@tonic-gate return (buf); 6140Sstevel@tonic-gate } 6150Sstevel@tonic-gate 6160Sstevel@tonic-gate void 6170Sstevel@tonic-gate show_termio(private_t *pri, long offset) 6180Sstevel@tonic-gate { 6190Sstevel@tonic-gate struct termio termio; 6200Sstevel@tonic-gate char cbuf[8]; 6210Sstevel@tonic-gate int i; 6220Sstevel@tonic-gate 6230Sstevel@tonic-gate if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) { 6240Sstevel@tonic-gate (void) printf( 6250Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n", 6260Sstevel@tonic-gate pri->pname, 6270Sstevel@tonic-gate termio.c_iflag, 6280Sstevel@tonic-gate termio.c_oflag, 6290Sstevel@tonic-gate termio.c_cflag, 6300Sstevel@tonic-gate termio.c_lflag, 6310Sstevel@tonic-gate termio.c_line); 6320Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6330Sstevel@tonic-gate for (i = 0; i < NCC; i++) 6340Sstevel@tonic-gate (void) printf(" %s", 6350Sstevel@tonic-gate show_char(cbuf, (int)termio.c_cc[i])); 6360Sstevel@tonic-gate (void) fputc('\n', stdout); 6370Sstevel@tonic-gate } 6380Sstevel@tonic-gate } 6390Sstevel@tonic-gate 6400Sstevel@tonic-gate void 6410Sstevel@tonic-gate show_termios(private_t *pri, long offset) 6420Sstevel@tonic-gate { 6430Sstevel@tonic-gate struct termios termios; 6440Sstevel@tonic-gate char cbuf[8]; 6450Sstevel@tonic-gate int i; 6460Sstevel@tonic-gate 6470Sstevel@tonic-gate if (Pread(Proc, &termios, sizeof (termios), offset) 6480Sstevel@tonic-gate == sizeof (termios)) { 6490Sstevel@tonic-gate (void) printf( 6500Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n", 6510Sstevel@tonic-gate pri->pname, 6520Sstevel@tonic-gate termios.c_iflag, 6530Sstevel@tonic-gate termios.c_oflag, 6540Sstevel@tonic-gate termios.c_cflag, 6550Sstevel@tonic-gate termios.c_lflag); 6560Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6570Sstevel@tonic-gate for (i = 0; i < NCCS; i++) { 6580Sstevel@tonic-gate if (i == NCC) /* show new chars on new line */ 6590Sstevel@tonic-gate (void) printf("\n%s\t\t", pri->pname); 6600Sstevel@tonic-gate (void) printf(" %s", 6610Sstevel@tonic-gate show_char(cbuf, (int)termios.c_cc[i])); 6620Sstevel@tonic-gate } 6630Sstevel@tonic-gate (void) fputc('\n', stdout); 6640Sstevel@tonic-gate } 6650Sstevel@tonic-gate } 6660Sstevel@tonic-gate 6670Sstevel@tonic-gate void 6680Sstevel@tonic-gate show_termiox(private_t *pri, long offset) 6690Sstevel@tonic-gate { 6700Sstevel@tonic-gate struct termiox termiox; 6710Sstevel@tonic-gate int i; 6720Sstevel@tonic-gate 6730Sstevel@tonic-gate if (Pread(Proc, &termiox, sizeof (termiox), offset) 6740Sstevel@tonic-gate == sizeof (termiox)) { 6750Sstevel@tonic-gate (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o", 6760Sstevel@tonic-gate pri->pname, 6770Sstevel@tonic-gate termiox.x_hflag, 6780Sstevel@tonic-gate termiox.x_cflag, 6790Sstevel@tonic-gate termiox.x_rflag[0]); 6800Sstevel@tonic-gate for (i = 1; i < NFF; i++) 6810Sstevel@tonic-gate (void) printf(",0%.3o", termiox.x_rflag[i]); 6820Sstevel@tonic-gate (void) printf(" sflag=0%.3o\n", 6830Sstevel@tonic-gate termiox.x_sflag); 6840Sstevel@tonic-gate } 6850Sstevel@tonic-gate } 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate void 6880Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset) 6890Sstevel@tonic-gate { 6900Sstevel@tonic-gate struct sgttyb sgttyb; 6910Sstevel@tonic-gate 6920Sstevel@tonic-gate if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) { 6930Sstevel@tonic-gate char erase[8]; 6940Sstevel@tonic-gate char kill[8]; 6950Sstevel@tonic-gate 6960Sstevel@tonic-gate (void) printf( 6970Sstevel@tonic-gate "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n", 6980Sstevel@tonic-gate pri->pname, 6990Sstevel@tonic-gate sgttyb.sg_ispeed&0xff, 7000Sstevel@tonic-gate sgttyb.sg_ospeed&0xff, 7010Sstevel@tonic-gate show_char(erase, sgttyb.sg_erase), 7020Sstevel@tonic-gate show_char(kill, sgttyb.sg_kill), 7030Sstevel@tonic-gate sgttyb.sg_flags); 7040Sstevel@tonic-gate } 7050Sstevel@tonic-gate } 7060Sstevel@tonic-gate 7070Sstevel@tonic-gate void 7080Sstevel@tonic-gate show_ltchars(private_t *pri, long offset) 7090Sstevel@tonic-gate { 7100Sstevel@tonic-gate struct ltchars ltchars; 7110Sstevel@tonic-gate char *p; 7120Sstevel@tonic-gate char cbuf[8]; 7130Sstevel@tonic-gate int i; 7140Sstevel@tonic-gate 7150Sstevel@tonic-gate if (Pread(Proc, <chars, sizeof (ltchars), offset) 7160Sstevel@tonic-gate == sizeof (ltchars)) { 7170Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7180Sstevel@tonic-gate for (p = (char *)<chars, i = 0; i < sizeof (ltchars); i++) 7190Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7200Sstevel@tonic-gate (void) fputc('\n', stdout); 7210Sstevel@tonic-gate } 7220Sstevel@tonic-gate } 7230Sstevel@tonic-gate 7240Sstevel@tonic-gate void 7250Sstevel@tonic-gate show_tchars(private_t *pri, long offset) 7260Sstevel@tonic-gate { 7270Sstevel@tonic-gate struct tchars tchars; 7280Sstevel@tonic-gate char *p; 7290Sstevel@tonic-gate char cbuf[8]; 7300Sstevel@tonic-gate int i; 7310Sstevel@tonic-gate 7320Sstevel@tonic-gate if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) { 7330Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7340Sstevel@tonic-gate for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++) 7350Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7360Sstevel@tonic-gate (void) fputc('\n', stdout); 7370Sstevel@tonic-gate } 7380Sstevel@tonic-gate } 7390Sstevel@tonic-gate 7400Sstevel@tonic-gate void 7410Sstevel@tonic-gate show_termcb(private_t *pri, long offset) 7420Sstevel@tonic-gate { 7430Sstevel@tonic-gate struct termcb termcb; 7440Sstevel@tonic-gate 7450Sstevel@tonic-gate if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) { 7460Sstevel@tonic-gate (void) printf( 7470Sstevel@tonic-gate "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n", 7480Sstevel@tonic-gate pri->pname, 7490Sstevel@tonic-gate termcb.st_flgs&0xff, 7500Sstevel@tonic-gate termcb.st_termt&0xff, 7510Sstevel@tonic-gate termcb.st_crow&0xff, 7520Sstevel@tonic-gate termcb.st_ccol&0xff, 7530Sstevel@tonic-gate termcb.st_vrow&0xff, 7540Sstevel@tonic-gate termcb.st_lrow&0xff); 7550Sstevel@tonic-gate } 7560Sstevel@tonic-gate } 7570Sstevel@tonic-gate 7580Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */ 7590Sstevel@tonic-gate void 7600Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset) 7610Sstevel@tonic-gate { 7620Sstevel@tonic-gate int val; 7630Sstevel@tonic-gate 7640Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 7650Sstevel@tonic-gate const char *s = NULL; 7660Sstevel@tonic-gate 7670Sstevel@tonic-gate switch (code) { /* interpret these symbolically */ 7680Sstevel@tonic-gate case I_GRDOPT: 7690Sstevel@tonic-gate s = strrdopt(val); 7700Sstevel@tonic-gate break; 7710Sstevel@tonic-gate case I_GETSIG: 7720Sstevel@tonic-gate s = strevents(pri, val); 7730Sstevel@tonic-gate break; 7740Sstevel@tonic-gate case TIOCFLUSH: 7750Sstevel@tonic-gate s = tiocflush(pri, val); 7760Sstevel@tonic-gate break; 7770Sstevel@tonic-gate } 7780Sstevel@tonic-gate 7790Sstevel@tonic-gate if (s == NULL) 7800Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %d\n", 7810Sstevel@tonic-gate pri->pname, offset, val); 7820Sstevel@tonic-gate else 7830Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %s\n", 7840Sstevel@tonic-gate pri->pname, offset, s); 7850Sstevel@tonic-gate } 7860Sstevel@tonic-gate } 7870Sstevel@tonic-gate 7880Sstevel@tonic-gate void 7890Sstevel@tonic-gate show_strioctl(private_t *pri, long offset) 7900Sstevel@tonic-gate { 7910Sstevel@tonic-gate struct strioctl strioctl; 7920Sstevel@tonic-gate 7930Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 7940Sstevel@tonic-gate sizeof (strioctl)) { 7950Sstevel@tonic-gate (void) printf( 7960Sstevel@tonic-gate "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 7970Sstevel@tonic-gate pri->pname, 7980Sstevel@tonic-gate ioctlname(pri, strioctl.ic_cmd), 7990Sstevel@tonic-gate strioctl.ic_timout, 8000Sstevel@tonic-gate strioctl.ic_len, 8010Sstevel@tonic-gate (long)strioctl.ic_dp); 8020Sstevel@tonic-gate 8030Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8040Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8050Sstevel@tonic-gate (long)strioctl.ic_dp); 8060Sstevel@tonic-gate --pri->recur; 8070Sstevel@tonic-gate } 8080Sstevel@tonic-gate } 8090Sstevel@tonic-gate 8100Sstevel@tonic-gate #ifdef _LP64 8110Sstevel@tonic-gate void 8120Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset) 8130Sstevel@tonic-gate { 8140Sstevel@tonic-gate struct strioctl32 strioctl; 8150Sstevel@tonic-gate 8160Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 8170Sstevel@tonic-gate sizeof (strioctl)) { 8180Sstevel@tonic-gate (void) printf( 8190Sstevel@tonic-gate "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 8200Sstevel@tonic-gate pri->pname, 8210Sstevel@tonic-gate ioctlname(pri, strioctl.ic_cmd), 8220Sstevel@tonic-gate strioctl.ic_timout, 8230Sstevel@tonic-gate strioctl.ic_len, 8240Sstevel@tonic-gate (long)strioctl.ic_dp); 8250Sstevel@tonic-gate 8260Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8270Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8280Sstevel@tonic-gate (long)strioctl.ic_dp); 8290Sstevel@tonic-gate --pri->recur; 8300Sstevel@tonic-gate } 8310Sstevel@tonic-gate } 8320Sstevel@tonic-gate #endif /* _LP64 */ 8330Sstevel@tonic-gate 8340Sstevel@tonic-gate void 8350Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump) 8360Sstevel@tonic-gate { 8370Sstevel@tonic-gate (void) printf( 8380Sstevel@tonic-gate "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8390Sstevel@tonic-gate pri->pname, 8400Sstevel@tonic-gate name, 8410Sstevel@tonic-gate sp->maxlen, 8420Sstevel@tonic-gate sp->len, 8430Sstevel@tonic-gate (long)sp->buf); 8440Sstevel@tonic-gate /* 8450Sstevel@tonic-gate * Should we show the buffer contents? 8460Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8470Sstevel@tonic-gate */ 8480Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8490Sstevel@tonic-gate (void) fputc('\n', stdout); 8500Sstevel@tonic-gate else { 8510Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 8520Sstevel@tonic-gate char buffer[8]; 8530Sstevel@tonic-gate char obuf[40]; 8540Sstevel@tonic-gate 8550Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 8560Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 8570Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 8580Sstevel@tonic-gate (void) strcat(obuf, 8590Sstevel@tonic-gate (nb == sp->len)? 8600Sstevel@tonic-gate (const char *)"\"" : (const char *)"\".."); 8610Sstevel@tonic-gate (void) fputs(obuf, stdout); 8620Sstevel@tonic-gate } 8630Sstevel@tonic-gate (void) fputc('\n', stdout); 8640Sstevel@tonic-gate if (dump && sp->len > 8) 8650Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 8660Sstevel@tonic-gate } 8670Sstevel@tonic-gate } 8680Sstevel@tonic-gate 8690Sstevel@tonic-gate #ifdef _LP64 8700Sstevel@tonic-gate void 8710Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump) 8720Sstevel@tonic-gate { 8730Sstevel@tonic-gate (void) printf( 8740Sstevel@tonic-gate "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8750Sstevel@tonic-gate pri->pname, 8760Sstevel@tonic-gate name, 8770Sstevel@tonic-gate sp->maxlen, 8780Sstevel@tonic-gate sp->len, 8790Sstevel@tonic-gate (long)sp->buf); 8800Sstevel@tonic-gate /* 8810Sstevel@tonic-gate * Should we show the buffer contents? 8820Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8830Sstevel@tonic-gate */ 8840Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8850Sstevel@tonic-gate (void) fputc('\n', stdout); 8860Sstevel@tonic-gate else { 8870Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 8880Sstevel@tonic-gate char buffer[8]; 8890Sstevel@tonic-gate char obuf[40]; 8900Sstevel@tonic-gate 8910Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 8920Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 8930Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 8940Sstevel@tonic-gate (void) strcat(obuf, 8950Sstevel@tonic-gate (nb == sp->len)? 8960Sstevel@tonic-gate (const char *)"\"" : (const char *)"\".."); 8970Sstevel@tonic-gate (void) fputs(obuf, stdout); 8980Sstevel@tonic-gate } 8990Sstevel@tonic-gate (void) fputc('\n', stdout); 9000Sstevel@tonic-gate if (dump && sp->len > 8) 9010Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 9020Sstevel@tonic-gate } 9030Sstevel@tonic-gate } 9040Sstevel@tonic-gate #endif /* _LP64 */ 9050Sstevel@tonic-gate 9060Sstevel@tonic-gate /* strpeek and strfdinsert flags word */ 9070Sstevel@tonic-gate const char * 9080Sstevel@tonic-gate strflags(private_t *pri, int flags) 9090Sstevel@tonic-gate { 9100Sstevel@tonic-gate const char *s; 9110Sstevel@tonic-gate 9120Sstevel@tonic-gate switch (flags) { 9130Sstevel@tonic-gate case 0: 9140Sstevel@tonic-gate s = "0"; 9150Sstevel@tonic-gate break; 9160Sstevel@tonic-gate case RS_HIPRI: 9170Sstevel@tonic-gate s = "RS_HIPRI"; 9180Sstevel@tonic-gate break; 9190Sstevel@tonic-gate default: 9200Sstevel@tonic-gate (void) sprintf(pri->code_buf, "0x%.4X", flags); 9210Sstevel@tonic-gate s = pri->code_buf; 9220Sstevel@tonic-gate } 9230Sstevel@tonic-gate 9240Sstevel@tonic-gate return (s); 9250Sstevel@tonic-gate } 9260Sstevel@tonic-gate 9270Sstevel@tonic-gate void 9280Sstevel@tonic-gate show_strpeek(private_t *pri, long offset) 9290Sstevel@tonic-gate { 9300Sstevel@tonic-gate struct strpeek strpeek; 9310Sstevel@tonic-gate 9320Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9330Sstevel@tonic-gate == sizeof (strpeek)) { 9340Sstevel@tonic-gate 9350Sstevel@tonic-gate print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE); 9360Sstevel@tonic-gate print_strbuf(pri, &strpeek.databuf, "dat", FALSE); 9370Sstevel@tonic-gate 9380Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9390Sstevel@tonic-gate pri->pname, 9400Sstevel@tonic-gate strflags(pri, strpeek.flags)); 9410Sstevel@tonic-gate } 9420Sstevel@tonic-gate } 9430Sstevel@tonic-gate 9440Sstevel@tonic-gate #ifdef _LP64 9450Sstevel@tonic-gate void 9460Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset) 9470Sstevel@tonic-gate { 9480Sstevel@tonic-gate struct strpeek32 strpeek; 9490Sstevel@tonic-gate 9500Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9510Sstevel@tonic-gate == sizeof (strpeek)) { 9520Sstevel@tonic-gate 9530Sstevel@tonic-gate print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE); 9540Sstevel@tonic-gate print_strbuf32(pri, &strpeek.databuf, "dat", FALSE); 9550Sstevel@tonic-gate 9560Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9570Sstevel@tonic-gate pri->pname, 9580Sstevel@tonic-gate strflags(pri, strpeek.flags)); 9590Sstevel@tonic-gate } 9600Sstevel@tonic-gate } 9610Sstevel@tonic-gate #endif /* _LP64 */ 9620Sstevel@tonic-gate 9630Sstevel@tonic-gate void 9640Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset) 9650Sstevel@tonic-gate { 9660Sstevel@tonic-gate struct strfdinsert strfdinsert; 9670Sstevel@tonic-gate 9680Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 9690Sstevel@tonic-gate sizeof (strfdinsert)) { 9700Sstevel@tonic-gate 9710Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 9720Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE); 9730Sstevel@tonic-gate 9740Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 9750Sstevel@tonic-gate pri->pname, 9760Sstevel@tonic-gate strflags(pri, strfdinsert.flags), 9770Sstevel@tonic-gate strfdinsert.fildes, 9780Sstevel@tonic-gate strfdinsert.offset); 9790Sstevel@tonic-gate } 9800Sstevel@tonic-gate } 9810Sstevel@tonic-gate 9820Sstevel@tonic-gate #ifdef _LP64 9830Sstevel@tonic-gate void 9840Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset) 9850Sstevel@tonic-gate { 9860Sstevel@tonic-gate struct strfdinsert32 strfdinsert; 9870Sstevel@tonic-gate 9880Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 9890Sstevel@tonic-gate sizeof (strfdinsert)) { 9900Sstevel@tonic-gate 9910Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 9920Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE); 9930Sstevel@tonic-gate 9940Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 9950Sstevel@tonic-gate pri->pname, 9960Sstevel@tonic-gate strflags(pri, strfdinsert.flags), 9970Sstevel@tonic-gate strfdinsert.fildes, 9980Sstevel@tonic-gate strfdinsert.offset); 9990Sstevel@tonic-gate } 10000Sstevel@tonic-gate } 10010Sstevel@tonic-gate #endif /* _LP64 */ 10020Sstevel@tonic-gate 10030Sstevel@tonic-gate void 10040Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset) 10050Sstevel@tonic-gate { 10060Sstevel@tonic-gate struct strrecvfd strrecvfd; 10070Sstevel@tonic-gate 10080Sstevel@tonic-gate if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) == 10090Sstevel@tonic-gate sizeof (strrecvfd)) { 10100Sstevel@tonic-gate (void) printf( 10110Sstevel@tonic-gate "%s\tfd=%-5d uid=%-5d gid=%d\n", 10120Sstevel@tonic-gate pri->pname, 10130Sstevel@tonic-gate strrecvfd.fd, 10140Sstevel@tonic-gate (int)strrecvfd.uid, 10150Sstevel@tonic-gate (int)strrecvfd.gid); 10160Sstevel@tonic-gate } 10170Sstevel@tonic-gate } 10180Sstevel@tonic-gate 10190Sstevel@tonic-gate void 10200Sstevel@tonic-gate show_strlist(private_t *pri, long offset) 10210Sstevel@tonic-gate { 10220Sstevel@tonic-gate struct str_list strlist; 10230Sstevel@tonic-gate struct str_mlist list; 10240Sstevel@tonic-gate int count; 10250Sstevel@tonic-gate 10260Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10270Sstevel@tonic-gate sizeof (strlist)) { 10280Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10290Sstevel@tonic-gate pri->pname, 10300Sstevel@tonic-gate strlist.sl_nmods, 10310Sstevel@tonic-gate (long)strlist.sl_modlist); 10320Sstevel@tonic-gate 10330Sstevel@tonic-gate count = strlist.sl_nmods; 10340Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10350Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10360Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10370Sstevel@tonic-gate sizeof (list)) 10380Sstevel@tonic-gate break; 10390Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10400Sstevel@tonic-gate pri->pname, 10410Sstevel@tonic-gate (int)sizeof (list.l_name), 10420Sstevel@tonic-gate list.l_name); 10430Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10440Sstevel@tonic-gate } 10450Sstevel@tonic-gate } 10460Sstevel@tonic-gate } 10470Sstevel@tonic-gate 10480Sstevel@tonic-gate #ifdef _LP64 10490Sstevel@tonic-gate void 10500Sstevel@tonic-gate show_strlist32(private_t *pri, long offset) 10510Sstevel@tonic-gate { 10520Sstevel@tonic-gate struct str_list32 strlist; 10530Sstevel@tonic-gate struct str_mlist list; 10540Sstevel@tonic-gate int count; 10550Sstevel@tonic-gate 10560Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10570Sstevel@tonic-gate sizeof (strlist)) { 10580Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10590Sstevel@tonic-gate pri->pname, 10600Sstevel@tonic-gate strlist.sl_nmods, 10610Sstevel@tonic-gate (long)strlist.sl_modlist); 10620Sstevel@tonic-gate 10630Sstevel@tonic-gate count = strlist.sl_nmods; 10640Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10650Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10660Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10670Sstevel@tonic-gate sizeof (list)) 10680Sstevel@tonic-gate break; 10690Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10700Sstevel@tonic-gate pri->pname, 10710Sstevel@tonic-gate (int)sizeof (list.l_name), 10720Sstevel@tonic-gate list.l_name); 10730Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10740Sstevel@tonic-gate } 10750Sstevel@tonic-gate } 10760Sstevel@tonic-gate } 10770Sstevel@tonic-gate #endif /* _LP64 */ 10780Sstevel@tonic-gate 10790Sstevel@tonic-gate void 10800Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset) 10810Sstevel@tonic-gate { 10820Sstevel@tonic-gate struct jwinsize jwinsize; 10830Sstevel@tonic-gate 10840Sstevel@tonic-gate if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) == 10850Sstevel@tonic-gate sizeof (jwinsize)) { 10860Sstevel@tonic-gate (void) printf( 10870Sstevel@tonic-gate "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n", 10880Sstevel@tonic-gate pri->pname, 10890Sstevel@tonic-gate (unsigned)jwinsize.bytesx, 10900Sstevel@tonic-gate (unsigned)jwinsize.bytesy, 10910Sstevel@tonic-gate (unsigned)jwinsize.bitsx, 10920Sstevel@tonic-gate (unsigned)jwinsize.bitsy); 10930Sstevel@tonic-gate } 10940Sstevel@tonic-gate } 10950Sstevel@tonic-gate 10960Sstevel@tonic-gate void 10970Sstevel@tonic-gate show_winsize(private_t *pri, long offset) 10980Sstevel@tonic-gate { 10990Sstevel@tonic-gate struct winsize winsize; 11000Sstevel@tonic-gate 11010Sstevel@tonic-gate if (Pread(Proc, &winsize, sizeof (winsize), offset) 11020Sstevel@tonic-gate == sizeof (winsize)) { 11030Sstevel@tonic-gate (void) printf( 11040Sstevel@tonic-gate "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n", 11050Sstevel@tonic-gate pri->pname, 11060Sstevel@tonic-gate winsize.ws_row, 11070Sstevel@tonic-gate winsize.ws_col, 11080Sstevel@tonic-gate winsize.ws_xpixel, 11090Sstevel@tonic-gate winsize.ws_ypixel); 11100Sstevel@tonic-gate } 11110Sstevel@tonic-gate } 11120Sstevel@tonic-gate 11130Sstevel@tonic-gate struct audio_stuff { 11140Sstevel@tonic-gate uint_t bit; 11150Sstevel@tonic-gate const char *str; 11160Sstevel@tonic-gate }; 11170Sstevel@tonic-gate 11180Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = { 11190Sstevel@tonic-gate { AUDIO_SPEAKER, "SPEAKER" }, 11200Sstevel@tonic-gate { AUDIO_HEADPHONE, "HEADPHONE" }, 11210Sstevel@tonic-gate { AUDIO_LINE_OUT, "LINE_OUT" }, 11220Sstevel@tonic-gate { AUDIO_SPDIF_OUT, "SPDIF_OUT" }, 11230Sstevel@tonic-gate { AUDIO_AUX1_OUT, "AUX1_OUT" }, 11240Sstevel@tonic-gate { AUDIO_AUX2_OUT, "AUX2_OUT" }, 11250Sstevel@tonic-gate { 0, NULL } 11260Sstevel@tonic-gate }; 11270Sstevel@tonic-gate 11280Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = { 11290Sstevel@tonic-gate { AUDIO_MICROPHONE, "MICROPHONE" }, 11300Sstevel@tonic-gate { AUDIO_LINE_IN, "LINE_IN" }, 11310Sstevel@tonic-gate { AUDIO_CD, "CD" }, 11320Sstevel@tonic-gate { AUDIO_SPDIF_IN, "SPDIF_IN" }, 11330Sstevel@tonic-gate { AUDIO_AUX1_IN, "AUX1_IN" }, 11340Sstevel@tonic-gate { AUDIO_AUX2_IN, "AUX2_IN" }, 11350Sstevel@tonic-gate { AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" }, 11360Sstevel@tonic-gate { AUDIO_SUNVTS, "SUNVTS" }, 11370Sstevel@tonic-gate { 0, NULL } 11380Sstevel@tonic-gate }; 11390Sstevel@tonic-gate 11400Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = { 11410Sstevel@tonic-gate { AUDIO_HWFEATURE_DUPLEX, "DUPLEX" }, 11420Sstevel@tonic-gate { AUDIO_HWFEATURE_MSCODEC, "MSCODEC" }, 11430Sstevel@tonic-gate { AUDIO_HWFEATURE_IN2OUT, "IN2OUT" }, 11440Sstevel@tonic-gate { AUDIO_HWFEATURE_PLAY, "PLAY" }, 11450Sstevel@tonic-gate { AUDIO_HWFEATURE_RECORD, "RECORD" }, 11460Sstevel@tonic-gate { 0, NULL } 11470Sstevel@tonic-gate }; 11480Sstevel@tonic-gate 11490Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = { 11500Sstevel@tonic-gate { AUDIO_SWFEATURE_MIXER, "MIXER" }, 11510Sstevel@tonic-gate { 0, NULL } 11520Sstevel@tonic-gate }; 11530Sstevel@tonic-gate 11540Sstevel@tonic-gate void 11550Sstevel@tonic-gate show_audio_features(const private_t *pri, 11560Sstevel@tonic-gate const struct audio_stuff *audio_porttab, uint_t features, 11570Sstevel@tonic-gate const char *name) 11580Sstevel@tonic-gate { 11590Sstevel@tonic-gate (void) printf("%s\t%s=", pri->pname, name); 11600Sstevel@tonic-gate if (features == 0) { 11610Sstevel@tonic-gate (void) printf("0\n"); 11620Sstevel@tonic-gate return; 11630Sstevel@tonic-gate } 11640Sstevel@tonic-gate 11650Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 11660Sstevel@tonic-gate if (features & audio_porttab->bit) { 11670Sstevel@tonic-gate (void) printf(audio_porttab->str); 11680Sstevel@tonic-gate features &= ~audio_porttab->bit; 11690Sstevel@tonic-gate if (features) 11700Sstevel@tonic-gate (void) putchar('|'); 11710Sstevel@tonic-gate } 11720Sstevel@tonic-gate } 11730Sstevel@tonic-gate if (features) 11740Sstevel@tonic-gate (void) printf("0x%x", features); 11750Sstevel@tonic-gate (void) putchar('\n'); 11760Sstevel@tonic-gate } 11770Sstevel@tonic-gate 11780Sstevel@tonic-gate void 11790Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode, 11800Sstevel@tonic-gate const char *field, uint_t ports) 11810Sstevel@tonic-gate { 11820Sstevel@tonic-gate const struct audio_stuff *audio_porttab; 11830Sstevel@tonic-gate 11840Sstevel@tonic-gate (void) printf("%s\t%s\t%s=", pri->pname, mode, field); 11850Sstevel@tonic-gate if (ports == 0) { 11860Sstevel@tonic-gate (void) printf("0\n"); 11870Sstevel@tonic-gate return; 11880Sstevel@tonic-gate } 11890Sstevel@tonic-gate if (*mode == 'p') 11900Sstevel@tonic-gate audio_porttab = audio_output_ports; 11910Sstevel@tonic-gate else 11920Sstevel@tonic-gate audio_porttab = audio_input_ports; 11930Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 11940Sstevel@tonic-gate if (ports & audio_porttab->bit) { 11950Sstevel@tonic-gate (void) printf(audio_porttab->str); 11960Sstevel@tonic-gate ports &= ~audio_porttab->bit; 11970Sstevel@tonic-gate if (ports) 11980Sstevel@tonic-gate (void) putchar('|'); 11990Sstevel@tonic-gate } 12000Sstevel@tonic-gate } 12010Sstevel@tonic-gate if (ports) 12020Sstevel@tonic-gate (void) printf("0x%x", ports); 12030Sstevel@tonic-gate (void) putchar('\n'); 12040Sstevel@tonic-gate } 12050Sstevel@tonic-gate 12060Sstevel@tonic-gate void 12070Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr) 12080Sstevel@tonic-gate { 12090Sstevel@tonic-gate const char *s; 12100Sstevel@tonic-gate 12110Sstevel@tonic-gate /* 12120Sstevel@tonic-gate * The following values describe the audio data encoding. 12130Sstevel@tonic-gate */ 12140Sstevel@tonic-gate 12150Sstevel@tonic-gate (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n", 12160Sstevel@tonic-gate pri->pname, mode, 12170Sstevel@tonic-gate au_pr->sample_rate, 12180Sstevel@tonic-gate au_pr->channels, 12190Sstevel@tonic-gate au_pr->precision); 12200Sstevel@tonic-gate 12210Sstevel@tonic-gate s = NULL; 12220Sstevel@tonic-gate switch (au_pr->encoding) { 12230Sstevel@tonic-gate case AUDIO_ENCODING_NONE: s = "NONE"; break; 12240Sstevel@tonic-gate case AUDIO_ENCODING_ULAW: s = "ULAW"; break; 12250Sstevel@tonic-gate case AUDIO_ENCODING_ALAW: s = "ALAW"; break; 12260Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR: s = "LINEAR"; break; 12270Sstevel@tonic-gate case AUDIO_ENCODING_DVI: s = "DVI"; break; 12280Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR8: s = "LINEAR8"; break; 12290Sstevel@tonic-gate } 12300Sstevel@tonic-gate if (s) 12310Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s); 12320Sstevel@tonic-gate else { 12330Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%u\n", 12340Sstevel@tonic-gate pri->pname, mode, au_pr->encoding); 12350Sstevel@tonic-gate } 12360Sstevel@tonic-gate 12370Sstevel@tonic-gate /* 12380Sstevel@tonic-gate * The following values control audio device configuration 12390Sstevel@tonic-gate */ 12400Sstevel@tonic-gate 12410Sstevel@tonic-gate (void) printf( 12420Sstevel@tonic-gate "%s\t%s\tgain=%u buffer_size=%u\n", 12430Sstevel@tonic-gate pri->pname, mode, 12440Sstevel@tonic-gate au_pr->gain, 12450Sstevel@tonic-gate au_pr->buffer_size); 12460Sstevel@tonic-gate show_audio_ports(pri, mode, "port", au_pr->port); 12470Sstevel@tonic-gate show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports); 12480Sstevel@tonic-gate show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports); 12490Sstevel@tonic-gate 12500Sstevel@tonic-gate /* 12510Sstevel@tonic-gate * The following values describe driver state 12520Sstevel@tonic-gate */ 12530Sstevel@tonic-gate 12540Sstevel@tonic-gate (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n", 12550Sstevel@tonic-gate pri->pname, mode, 12560Sstevel@tonic-gate au_pr->samples, 12570Sstevel@tonic-gate au_pr->eof, 12580Sstevel@tonic-gate au_pr->pause, 12590Sstevel@tonic-gate au_pr->error); 12600Sstevel@tonic-gate (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n", 12610Sstevel@tonic-gate pri->pname, mode, 12620Sstevel@tonic-gate au_pr->waiting, 12630Sstevel@tonic-gate au_pr->balance, 12640Sstevel@tonic-gate au_pr->minordev); 12650Sstevel@tonic-gate 12660Sstevel@tonic-gate /* 12670Sstevel@tonic-gate * The following values are read-only state flags 12680Sstevel@tonic-gate */ 12690Sstevel@tonic-gate (void) printf("%s\t%s\topen=%u active=%u\n", 12700Sstevel@tonic-gate pri->pname, mode, 12710Sstevel@tonic-gate au_pr->open, 12720Sstevel@tonic-gate au_pr->active); 12730Sstevel@tonic-gate } 12740Sstevel@tonic-gate 12750Sstevel@tonic-gate void 12760Sstevel@tonic-gate show_audio_info(private_t *pri, long offset) 12770Sstevel@tonic-gate { 12780Sstevel@tonic-gate struct audio_info au; 12790Sstevel@tonic-gate 12800Sstevel@tonic-gate if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) { 12810Sstevel@tonic-gate show_audio_prinfo(pri, "play", &au.play); 12820Sstevel@tonic-gate show_audio_prinfo(pri, "record", &au.record); 12830Sstevel@tonic-gate (void) printf("%s\tmonitor_gain=%u output_muted=%u\n", 12840Sstevel@tonic-gate pri->pname, au.monitor_gain, au.output_muted); 12850Sstevel@tonic-gate show_audio_features(pri, audio_hw_features, au.hw_features, 12860Sstevel@tonic-gate "hw_features"); 12870Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, au.sw_features, 12880Sstevel@tonic-gate "sw_features"); 12890Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, 12900Sstevel@tonic-gate au.sw_features_enabled, "sw_features_enabled"); 12910Sstevel@tonic-gate } 12920Sstevel@tonic-gate } 12930Sstevel@tonic-gate 12940Sstevel@tonic-gate void 12950Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset) 12960Sstevel@tonic-gate { 12970Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 12980Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 12990Sstevel@tonic-gate /* for a failed system call */ 13000Sstevel@tonic-gate #ifndef _LP64 13010Sstevel@tonic-gate if (lp64) 13020Sstevel@tonic-gate return; 13030Sstevel@tonic-gate #endif 13040Sstevel@tonic-gate if (offset == NULL) 13050Sstevel@tonic-gate return; 13060Sstevel@tonic-gate 13070Sstevel@tonic-gate switch (code) { 13080Sstevel@tonic-gate case TCGETA: 13090Sstevel@tonic-gate if (err) 13100Sstevel@tonic-gate break; 13110Sstevel@tonic-gate /*FALLTHROUGH*/ 13120Sstevel@tonic-gate case TCSETA: 13130Sstevel@tonic-gate case TCSETAW: 13140Sstevel@tonic-gate case TCSETAF: 13150Sstevel@tonic-gate show_termio(pri, offset); 13160Sstevel@tonic-gate break; 13170Sstevel@tonic-gate case TCGETS: 13180Sstevel@tonic-gate if (err) 13190Sstevel@tonic-gate break; 13200Sstevel@tonic-gate /*FALLTHROUGH*/ 13210Sstevel@tonic-gate case TCSETS: 13220Sstevel@tonic-gate case TCSETSW: 13230Sstevel@tonic-gate case TCSETSF: 13240Sstevel@tonic-gate show_termios(pri, offset); 13250Sstevel@tonic-gate break; 13260Sstevel@tonic-gate case TCGETX: 13270Sstevel@tonic-gate if (err) 13280Sstevel@tonic-gate break; 13290Sstevel@tonic-gate /*FALLTHROUGH*/ 13300Sstevel@tonic-gate case TCSETX: 13310Sstevel@tonic-gate case TCSETXW: 13320Sstevel@tonic-gate case TCSETXF: 13330Sstevel@tonic-gate show_termiox(pri, offset); 13340Sstevel@tonic-gate break; 13350Sstevel@tonic-gate case TIOCGETP: 13360Sstevel@tonic-gate if (err) 13370Sstevel@tonic-gate break; 13380Sstevel@tonic-gate /*FALLTHROUGH*/ 13390Sstevel@tonic-gate case TIOCSETN: 13400Sstevel@tonic-gate case TIOCSETP: 13410Sstevel@tonic-gate show_sgttyb(pri, offset); 13420Sstevel@tonic-gate break; 13430Sstevel@tonic-gate case TIOCGLTC: 13440Sstevel@tonic-gate if (err) 13450Sstevel@tonic-gate break; 13460Sstevel@tonic-gate /*FALLTHROUGH*/ 13470Sstevel@tonic-gate case TIOCSLTC: 13480Sstevel@tonic-gate show_ltchars(pri, offset); 13490Sstevel@tonic-gate break; 13500Sstevel@tonic-gate case TIOCGETC: 13510Sstevel@tonic-gate if (err) 13520Sstevel@tonic-gate break; 13530Sstevel@tonic-gate /*FALLTHROUGH*/ 13540Sstevel@tonic-gate case TIOCSETC: 13550Sstevel@tonic-gate show_tchars(pri, offset); 13560Sstevel@tonic-gate break; 13570Sstevel@tonic-gate case LDGETT: 13580Sstevel@tonic-gate if (err) 13590Sstevel@tonic-gate break; 13600Sstevel@tonic-gate /*FALLTHROUGH*/ 13610Sstevel@tonic-gate case LDSETT: 13620Sstevel@tonic-gate show_termcb(pri, offset); 13630Sstevel@tonic-gate break; 13640Sstevel@tonic-gate /* streams ioctl()s */ 13650Sstevel@tonic-gate #if 0 13660Sstevel@tonic-gate /* these are displayed as strings in the arg list */ 13670Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13680Sstevel@tonic-gate case I_PUSH: 13690Sstevel@tonic-gate case I_LOOK: 13700Sstevel@tonic-gate case I_FIND: 13710Sstevel@tonic-gate /* these are displayed as decimal in the arg list */ 13720Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13730Sstevel@tonic-gate case I_LINK: 13740Sstevel@tonic-gate case I_UNLINK: 13750Sstevel@tonic-gate case I_SENDFD: 13760Sstevel@tonic-gate /* these are displayed symbolically in the arg list */ 13770Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13780Sstevel@tonic-gate case I_SRDOPT: 13790Sstevel@tonic-gate case I_SETSIG: 13800Sstevel@tonic-gate case I_FLUSH: 13810Sstevel@tonic-gate break; 13820Sstevel@tonic-gate /* this one just ignores the argument */ 13830Sstevel@tonic-gate case I_POP: 13840Sstevel@tonic-gate break; 13850Sstevel@tonic-gate #endif 13860Sstevel@tonic-gate /* these return something in an int pointed to by arg */ 13870Sstevel@tonic-gate case I_NREAD: 13880Sstevel@tonic-gate case I_GRDOPT: 13890Sstevel@tonic-gate case I_GETSIG: 13900Sstevel@tonic-gate case TIOCGSID: 13910Sstevel@tonic-gate case TIOCGPGRP: 13920Sstevel@tonic-gate case TIOCLGET: 13930Sstevel@tonic-gate case FIONREAD: 13940Sstevel@tonic-gate case FIORDCHK: 13950Sstevel@tonic-gate if (err) 13960Sstevel@tonic-gate break; 13970Sstevel@tonic-gate /*FALLTHROUGH*/ 13980Sstevel@tonic-gate /* these pass something in an int pointed to by arg */ 13990Sstevel@tonic-gate case TIOCSPGRP: 14000Sstevel@tonic-gate case TIOCFLUSH: 14010Sstevel@tonic-gate case TIOCLBIS: 14020Sstevel@tonic-gate case TIOCLBIC: 14030Sstevel@tonic-gate case TIOCLSET: 14040Sstevel@tonic-gate show_strint(pri, code, offset); 14050Sstevel@tonic-gate break; 14060Sstevel@tonic-gate /* these all point to structures */ 14070Sstevel@tonic-gate case I_STR: 14080Sstevel@tonic-gate #ifdef _LP64 14090Sstevel@tonic-gate if (lp64) 14100Sstevel@tonic-gate show_strioctl(pri, offset); 14110Sstevel@tonic-gate else 14120Sstevel@tonic-gate show_strioctl32(pri, offset); 14130Sstevel@tonic-gate #else 14140Sstevel@tonic-gate show_strioctl(pri, offset); 14150Sstevel@tonic-gate #endif 14160Sstevel@tonic-gate break; 14170Sstevel@tonic-gate case I_PEEK: 14180Sstevel@tonic-gate #ifdef _LP64 14190Sstevel@tonic-gate if (lp64) 14200Sstevel@tonic-gate show_strpeek(pri, offset); 14210Sstevel@tonic-gate else 14220Sstevel@tonic-gate show_strpeek32(pri, offset); 14230Sstevel@tonic-gate #else 14240Sstevel@tonic-gate show_strpeek(pri, offset); 14250Sstevel@tonic-gate #endif 14260Sstevel@tonic-gate break; 14270Sstevel@tonic-gate case I_FDINSERT: 14280Sstevel@tonic-gate #ifdef _LP64 14290Sstevel@tonic-gate if (lp64) 14300Sstevel@tonic-gate show_strfdinsert(pri, offset); 14310Sstevel@tonic-gate else 14320Sstevel@tonic-gate show_strfdinsert32(pri, offset); 14330Sstevel@tonic-gate #else 14340Sstevel@tonic-gate show_strfdinsert(pri, offset); 14350Sstevel@tonic-gate #endif 14360Sstevel@tonic-gate break; 14370Sstevel@tonic-gate case I_RECVFD: 14380Sstevel@tonic-gate if (err) 14390Sstevel@tonic-gate break; 14400Sstevel@tonic-gate show_strrecvfd(pri, offset); 14410Sstevel@tonic-gate break; 14420Sstevel@tonic-gate case I_LIST: 14430Sstevel@tonic-gate if (err) 14440Sstevel@tonic-gate break; 14450Sstevel@tonic-gate #ifdef _LP64 14460Sstevel@tonic-gate if (lp64) 14470Sstevel@tonic-gate show_strlist(pri, offset); 14480Sstevel@tonic-gate else 14490Sstevel@tonic-gate show_strlist32(pri, offset); 14500Sstevel@tonic-gate #else 14510Sstevel@tonic-gate show_strlist(pri, offset); 14520Sstevel@tonic-gate #endif 14530Sstevel@tonic-gate break; 14540Sstevel@tonic-gate case JWINSIZE: 14550Sstevel@tonic-gate if (err) 14560Sstevel@tonic-gate break; 14570Sstevel@tonic-gate show_jwinsize(pri, offset); 14580Sstevel@tonic-gate break; 14590Sstevel@tonic-gate case TIOCGWINSZ: 14600Sstevel@tonic-gate if (err) 14610Sstevel@tonic-gate break; 14620Sstevel@tonic-gate /*FALLTHROUGH*/ 14630Sstevel@tonic-gate case TIOCSWINSZ: 14640Sstevel@tonic-gate show_winsize(pri, offset); 14650Sstevel@tonic-gate break; 14660Sstevel@tonic-gate case AUDIO_GETINFO: 14670Sstevel@tonic-gate case (int)AUDIO_SETINFO: 14680Sstevel@tonic-gate show_audio_info(pri, offset); 14690Sstevel@tonic-gate break; 14700Sstevel@tonic-gate 14710Sstevel@tonic-gate default: 14720Sstevel@tonic-gate if (code & IOC_INOUT) { 14730Sstevel@tonic-gate const char *str = ioctldatastruct(code); 14740Sstevel@tonic-gate 14750Sstevel@tonic-gate (void) printf("\t\t%s", 14760Sstevel@tonic-gate (code & IOC_INOUT) == IOC_INOUT ? "write/read" : 14770Sstevel@tonic-gate code & IOC_IN ? "write" : "read"); 14780Sstevel@tonic-gate if (str != NULL) { 14790Sstevel@tonic-gate (void) printf(" (struct %s)\n", str); 14800Sstevel@tonic-gate } else { 14810Sstevel@tonic-gate (void) printf(" %d bytes\n", 14820Sstevel@tonic-gate (code >> 16) & IOCPARM_MASK); 14830Sstevel@tonic-gate } 14840Sstevel@tonic-gate } 14850Sstevel@tonic-gate } 14860Sstevel@tonic-gate } 14870Sstevel@tonic-gate 14880Sstevel@tonic-gate void 14890Sstevel@tonic-gate show_statvfs(private_t *pri) 14900Sstevel@tonic-gate { 14910Sstevel@tonic-gate long offset; 14920Sstevel@tonic-gate struct statvfs statvfs; 14930Sstevel@tonic-gate char *cp; 14940Sstevel@tonic-gate 14950Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 14960Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 14970Sstevel@tonic-gate == sizeof (statvfs)) { 14980Sstevel@tonic-gate (void) printf( 14990Sstevel@tonic-gate "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n", 15000Sstevel@tonic-gate pri->pname, 15010Sstevel@tonic-gate statvfs.f_bsize, 15020Sstevel@tonic-gate statvfs.f_frsize, 15030Sstevel@tonic-gate (u_longlong_t)statvfs.f_blocks, 15040Sstevel@tonic-gate (u_longlong_t)statvfs.f_bfree); 15050Sstevel@tonic-gate (void) printf( 15060Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 15070Sstevel@tonic-gate pri->pname, 15080Sstevel@tonic-gate (u_longlong_t)statvfs.f_bavail, 15090Sstevel@tonic-gate (u_longlong_t)statvfs.f_files, 15100Sstevel@tonic-gate (u_longlong_t)statvfs.f_ffree, 15110Sstevel@tonic-gate (u_longlong_t)statvfs.f_favail); 15120Sstevel@tonic-gate (void) printf( 15130Sstevel@tonic-gate "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n", 15140Sstevel@tonic-gate pri->pname, 15150Sstevel@tonic-gate statvfs.f_fsid, 15160Sstevel@tonic-gate statvfs.f_basetype, 15170Sstevel@tonic-gate (long)statvfs.f_namemax); 15180Sstevel@tonic-gate (void) printf( 15190Sstevel@tonic-gate "%s\tflag=%s\n", 15200Sstevel@tonic-gate pri->pname, 15210Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 15220Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15230Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15240Sstevel@tonic-gate *(cp+1) != '\0') 15250Sstevel@tonic-gate *cp = ' '; 15260Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15270Sstevel@tonic-gate pri->pname, 15280Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 15290Sstevel@tonic-gate statvfs.f_fstr); 15300Sstevel@tonic-gate } 15310Sstevel@tonic-gate } 15320Sstevel@tonic-gate 15330Sstevel@tonic-gate #ifdef _LP64 15340Sstevel@tonic-gate void 15350Sstevel@tonic-gate show_statvfs32(private_t *pri) 15360Sstevel@tonic-gate { 15370Sstevel@tonic-gate long offset; 15380Sstevel@tonic-gate struct statvfs32 statvfs; 15390Sstevel@tonic-gate char *cp; 15400Sstevel@tonic-gate 15410Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15420Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15430Sstevel@tonic-gate == sizeof (statvfs)) { 15440Sstevel@tonic-gate (void) printf( 15450Sstevel@tonic-gate "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n", 15460Sstevel@tonic-gate pri->pname, 15470Sstevel@tonic-gate statvfs.f_bsize, 15480Sstevel@tonic-gate statvfs.f_frsize, 15490Sstevel@tonic-gate statvfs.f_blocks, 15500Sstevel@tonic-gate statvfs.f_bfree); 15510Sstevel@tonic-gate (void) printf( 15520Sstevel@tonic-gate "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n", 15530Sstevel@tonic-gate pri->pname, 15540Sstevel@tonic-gate statvfs.f_bavail, 15550Sstevel@tonic-gate statvfs.f_files, 15560Sstevel@tonic-gate statvfs.f_ffree, 15570Sstevel@tonic-gate statvfs.f_favail); 15580Sstevel@tonic-gate (void) printf( 15590Sstevel@tonic-gate "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 15600Sstevel@tonic-gate pri->pname, 15610Sstevel@tonic-gate statvfs.f_fsid, 15620Sstevel@tonic-gate statvfs.f_basetype, 15630Sstevel@tonic-gate (int)statvfs.f_namemax); 15640Sstevel@tonic-gate (void) printf( 15650Sstevel@tonic-gate "%s\tflag=%s\n", 15660Sstevel@tonic-gate pri->pname, 15670Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 15680Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15690Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15700Sstevel@tonic-gate *(cp+1) != '\0') 15710Sstevel@tonic-gate *cp = ' '; 15720Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15730Sstevel@tonic-gate pri->pname, 15740Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 15750Sstevel@tonic-gate statvfs.f_fstr); 15760Sstevel@tonic-gate } 15770Sstevel@tonic-gate } 15780Sstevel@tonic-gate #endif /* _LP64 */ 15790Sstevel@tonic-gate 15800Sstevel@tonic-gate void 15810Sstevel@tonic-gate show_statvfs64(private_t *pri) 15820Sstevel@tonic-gate { 15830Sstevel@tonic-gate long offset; 15840Sstevel@tonic-gate struct statvfs64_32 statvfs; 15850Sstevel@tonic-gate char *cp; 15860Sstevel@tonic-gate 15870Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15880Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15890Sstevel@tonic-gate == sizeof (statvfs)) { 15900Sstevel@tonic-gate (void) printf( 15910Sstevel@tonic-gate "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n", 15920Sstevel@tonic-gate pri->pname, 15930Sstevel@tonic-gate statvfs.f_bsize, 15940Sstevel@tonic-gate statvfs.f_frsize, 15950Sstevel@tonic-gate (u_longlong_t)statvfs.f_blocks, 15960Sstevel@tonic-gate (u_longlong_t)statvfs.f_bfree); 15970Sstevel@tonic-gate (void) printf( 15980Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 15990Sstevel@tonic-gate pri->pname, 16000Sstevel@tonic-gate (u_longlong_t)statvfs.f_bavail, 16010Sstevel@tonic-gate (u_longlong_t)statvfs.f_files, 16020Sstevel@tonic-gate (u_longlong_t)statvfs.f_ffree, 16030Sstevel@tonic-gate (u_longlong_t)statvfs.f_favail); 16040Sstevel@tonic-gate (void) printf( 16050Sstevel@tonic-gate "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 16060Sstevel@tonic-gate pri->pname, 16070Sstevel@tonic-gate statvfs.f_fsid, 16080Sstevel@tonic-gate statvfs.f_basetype, 16090Sstevel@tonic-gate (int)statvfs.f_namemax); 16100Sstevel@tonic-gate (void) printf( 16110Sstevel@tonic-gate "%s\tflag=%s\n", 16120Sstevel@tonic-gate pri->pname, 16130Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 16140Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 16150Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 16160Sstevel@tonic-gate *(cp+1) != '\0') 16170Sstevel@tonic-gate *cp = ' '; 16180Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 16190Sstevel@tonic-gate pri->pname, 16200Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 16210Sstevel@tonic-gate statvfs.f_fstr); 16220Sstevel@tonic-gate } 16230Sstevel@tonic-gate } 16240Sstevel@tonic-gate 16250Sstevel@tonic-gate void 16260Sstevel@tonic-gate show_statfs(private_t *pri) 16270Sstevel@tonic-gate { 16280Sstevel@tonic-gate long offset; 16290Sstevel@tonic-gate struct statfs statfs; 16300Sstevel@tonic-gate 16310Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16320Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16330Sstevel@tonic-gate (void) printf( 16340Sstevel@tonic-gate "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n", 16350Sstevel@tonic-gate pri->pname, 16360Sstevel@tonic-gate statfs.f_fstyp, 16370Sstevel@tonic-gate statfs.f_bsize, 16380Sstevel@tonic-gate statfs.f_frsize, 16390Sstevel@tonic-gate statfs.f_blocks, 16400Sstevel@tonic-gate statfs.f_bfree, 16410Sstevel@tonic-gate statfs.f_files, 16420Sstevel@tonic-gate statfs.f_ffree); 16430Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16440Sstevel@tonic-gate pri->pname, 16450Sstevel@tonic-gate statfs.f_fname, 16460Sstevel@tonic-gate statfs.f_fpack); 16470Sstevel@tonic-gate } 16480Sstevel@tonic-gate } 16490Sstevel@tonic-gate 16500Sstevel@tonic-gate #ifdef _LP64 16510Sstevel@tonic-gate void 16520Sstevel@tonic-gate show_statfs32(private_t *pri) 16530Sstevel@tonic-gate { 16540Sstevel@tonic-gate long offset; 16550Sstevel@tonic-gate struct statfs32 statfs; 16560Sstevel@tonic-gate 16570Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16580Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16590Sstevel@tonic-gate (void) printf( 16600Sstevel@tonic-gate "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n", 16610Sstevel@tonic-gate pri->pname, 16620Sstevel@tonic-gate statfs.f_fstyp, 16630Sstevel@tonic-gate statfs.f_bsize, 16640Sstevel@tonic-gate statfs.f_frsize, 16650Sstevel@tonic-gate statfs.f_blocks, 16660Sstevel@tonic-gate statfs.f_bfree, 16670Sstevel@tonic-gate statfs.f_files, 16680Sstevel@tonic-gate statfs.f_ffree); 16690Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16700Sstevel@tonic-gate pri->pname, 16710Sstevel@tonic-gate statfs.f_fname, 16720Sstevel@tonic-gate statfs.f_fpack); 16730Sstevel@tonic-gate } 16740Sstevel@tonic-gate } 16750Sstevel@tonic-gate #endif /* _LP64 */ 16760Sstevel@tonic-gate 16770Sstevel@tonic-gate void 16780Sstevel@tonic-gate show_flock32(private_t *pri, long offset) 16790Sstevel@tonic-gate { 16800Sstevel@tonic-gate struct flock32 flock; 16810Sstevel@tonic-gate 16820Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 16830Sstevel@tonic-gate const char *str = NULL; 16840Sstevel@tonic-gate 16850Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 16860Sstevel@tonic-gate 16870Sstevel@tonic-gate switch (flock.l_type) { 16880Sstevel@tonic-gate case F_RDLCK: 16890Sstevel@tonic-gate str = "F_RDLCK"; 16900Sstevel@tonic-gate break; 16910Sstevel@tonic-gate case F_WRLCK: 16920Sstevel@tonic-gate str = "F_WRLCK"; 16930Sstevel@tonic-gate break; 16940Sstevel@tonic-gate case F_UNLCK: 16950Sstevel@tonic-gate str = "F_UNLCK"; 16960Sstevel@tonic-gate break; 16970Sstevel@tonic-gate } 16980Sstevel@tonic-gate if (str != NULL) 16990Sstevel@tonic-gate (void) printf("%s", str); 17000Sstevel@tonic-gate else 17010Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17020Sstevel@tonic-gate 17030Sstevel@tonic-gate str = whencearg(flock.l_whence); 17040Sstevel@tonic-gate if (str != NULL) 17050Sstevel@tonic-gate (void) printf(" whence=%s", str); 17060Sstevel@tonic-gate else 17070Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17080Sstevel@tonic-gate 17090Sstevel@tonic-gate (void) printf( 17100Sstevel@tonic-gate " start=%-5d len=%-5d sys=%-2u pid=%d\n", 17110Sstevel@tonic-gate flock.l_start, 17120Sstevel@tonic-gate flock.l_len, 17130Sstevel@tonic-gate flock.l_sysid, 17140Sstevel@tonic-gate flock.l_pid); 17150Sstevel@tonic-gate } 17160Sstevel@tonic-gate } 17170Sstevel@tonic-gate 17180Sstevel@tonic-gate void 17190Sstevel@tonic-gate show_flock64(private_t *pri, long offset) 17200Sstevel@tonic-gate { 17210Sstevel@tonic-gate struct flock64 flock; 17220Sstevel@tonic-gate 17230Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 17240Sstevel@tonic-gate const char *str = NULL; 17250Sstevel@tonic-gate 17260Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 17270Sstevel@tonic-gate 17280Sstevel@tonic-gate switch (flock.l_type) { 17290Sstevel@tonic-gate case F_RDLCK: 17300Sstevel@tonic-gate str = "F_RDLCK"; 17310Sstevel@tonic-gate break; 17320Sstevel@tonic-gate case F_WRLCK: 17330Sstevel@tonic-gate str = "F_WRLCK"; 17340Sstevel@tonic-gate break; 17350Sstevel@tonic-gate case F_UNLCK: 17360Sstevel@tonic-gate str = "F_UNLCK"; 17370Sstevel@tonic-gate break; 17380Sstevel@tonic-gate } 17390Sstevel@tonic-gate if (str != NULL) 17400Sstevel@tonic-gate (void) printf("%s", str); 17410Sstevel@tonic-gate else 17420Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17430Sstevel@tonic-gate 17440Sstevel@tonic-gate str = whencearg(flock.l_whence); 17450Sstevel@tonic-gate if (str != NULL) 17460Sstevel@tonic-gate (void) printf(" whence=%s", str); 17470Sstevel@tonic-gate else 17480Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17490Sstevel@tonic-gate 17500Sstevel@tonic-gate (void) printf( 17510Sstevel@tonic-gate " start=%-5lld len=%-5lld sys=%-2u pid=%d\n", 17520Sstevel@tonic-gate (long long)flock.l_start, 17530Sstevel@tonic-gate (long long)flock.l_len, 17540Sstevel@tonic-gate flock.l_sysid, 17550Sstevel@tonic-gate (int)flock.l_pid); 17560Sstevel@tonic-gate } 17570Sstevel@tonic-gate } 17580Sstevel@tonic-gate 17590Sstevel@tonic-gate void 17600Sstevel@tonic-gate show_share(private_t *pri, long offset) 17610Sstevel@tonic-gate { 17620Sstevel@tonic-gate struct fshare fshare; 17630Sstevel@tonic-gate 17640Sstevel@tonic-gate if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) { 17650Sstevel@tonic-gate const char *str = NULL; 17660Sstevel@tonic-gate int manddny = 0; 17670Sstevel@tonic-gate 17680Sstevel@tonic-gate (void) printf("%s\taccess=", pri->pname); 17690Sstevel@tonic-gate 17700Sstevel@tonic-gate switch (fshare.f_access) { 17710Sstevel@tonic-gate case F_RDACC: 17720Sstevel@tonic-gate str = "F_RDACC"; 17730Sstevel@tonic-gate break; 17740Sstevel@tonic-gate case F_WRACC: 17750Sstevel@tonic-gate str = "F_WRACC"; 17760Sstevel@tonic-gate break; 17770Sstevel@tonic-gate case F_RWACC: 17780Sstevel@tonic-gate str = "F_RWACC"; 17790Sstevel@tonic-gate break; 17800Sstevel@tonic-gate } 17810Sstevel@tonic-gate if (str != NULL) 17820Sstevel@tonic-gate (void) printf("%s", str); 17830Sstevel@tonic-gate else 17840Sstevel@tonic-gate (void) printf("%-7d", fshare.f_access); 17850Sstevel@tonic-gate 17860Sstevel@tonic-gate str = NULL; 17870Sstevel@tonic-gate if (fshare.f_deny & F_MANDDNY) { 17880Sstevel@tonic-gate fshare.f_deny &= ~F_MANDDNY; 17890Sstevel@tonic-gate manddny = 1; 17900Sstevel@tonic-gate } 17910Sstevel@tonic-gate switch (fshare.f_deny) { 17920Sstevel@tonic-gate case F_NODNY: 17930Sstevel@tonic-gate str = "F_NODNY"; 17940Sstevel@tonic-gate break; 17950Sstevel@tonic-gate case F_RDDNY: 17960Sstevel@tonic-gate str = "F_RDDNY"; 17970Sstevel@tonic-gate break; 17980Sstevel@tonic-gate case F_WRDNY: 17990Sstevel@tonic-gate str = "F_WRDNY"; 18000Sstevel@tonic-gate break; 18010Sstevel@tonic-gate case F_RWDNY: 18020Sstevel@tonic-gate str = "F_RWDNY"; 18030Sstevel@tonic-gate break; 18040Sstevel@tonic-gate case F_COMPAT: 18050Sstevel@tonic-gate str = "F_COMPAT"; 18060Sstevel@tonic-gate break; 18070Sstevel@tonic-gate } 18080Sstevel@tonic-gate if (str != NULL) { 18090Sstevel@tonic-gate if (manddny) 18100Sstevel@tonic-gate (void) printf(" deny=F_MANDDNY|%s", str); 18110Sstevel@tonic-gate else 18120Sstevel@tonic-gate (void) printf(" deny=%s", str); 18130Sstevel@tonic-gate } else { 18140Sstevel@tonic-gate (void) printf(" deny=0x%x", manddny? 18150Sstevel@tonic-gate fshare.f_deny | F_MANDDNY : fshare.f_deny); 18160Sstevel@tonic-gate } 18170Sstevel@tonic-gate 18180Sstevel@tonic-gate (void) printf(" id=%x\n", fshare.f_id); 18190Sstevel@tonic-gate } 18200Sstevel@tonic-gate } 18210Sstevel@tonic-gate 18220Sstevel@tonic-gate void 18230Sstevel@tonic-gate show_ffg(private_t *pri) 18240Sstevel@tonic-gate { 18250Sstevel@tonic-gate (void) putchar('\t'); 18260Sstevel@tonic-gate (void) putchar('\t'); 18270Sstevel@tonic-gate prt_ffg(pri, 0, pri->Rval1); 18280Sstevel@tonic-gate (void) puts(pri->sys_string); 18290Sstevel@tonic-gate } 18300Sstevel@tonic-gate 18310Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */ 18320Sstevel@tonic-gate void 18330Sstevel@tonic-gate show_fcntl(private_t *pri) 18340Sstevel@tonic-gate { 18350Sstevel@tonic-gate long offset; 18360Sstevel@tonic-gate 18370Sstevel@tonic-gate if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) { 18380Sstevel@tonic-gate show_ffg(pri); 18390Sstevel@tonic-gate return; 18400Sstevel@tonic-gate } 18410Sstevel@tonic-gate 18420Sstevel@tonic-gate if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == NULL) 18430Sstevel@tonic-gate return; 18440Sstevel@tonic-gate 18450Sstevel@tonic-gate switch (pri->sys_args[1]) { 18460Sstevel@tonic-gate #ifdef _LP64 18470Sstevel@tonic-gate case F_GETLK: 18480Sstevel@tonic-gate case F_SETLK: 18490Sstevel@tonic-gate case F_SETLKW: 18500Sstevel@tonic-gate case F_FREESP: 18510Sstevel@tonic-gate case F_ALLOCSP: 18520Sstevel@tonic-gate case F_SETLK_NBMAND: 18530Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 18540Sstevel@tonic-gate show_flock64(pri, offset); 18550Sstevel@tonic-gate else 18560Sstevel@tonic-gate show_flock32(pri, offset); 18570Sstevel@tonic-gate break; 18580Sstevel@tonic-gate case 33: /* F_GETLK64 */ 18590Sstevel@tonic-gate case 34: /* F_SETLK64 */ 18600Sstevel@tonic-gate case 35: /* F_SETLKW64 */ 18610Sstevel@tonic-gate case 27: /* F_FREESP64 */ 18620Sstevel@tonic-gate case 44: /* F_SETLK64_NBMAND */ 18630Sstevel@tonic-gate show_flock64(pri, offset); 18640Sstevel@tonic-gate break; 18650Sstevel@tonic-gate #else /* _LP64 */ 18660Sstevel@tonic-gate case F_GETLK: 18670Sstevel@tonic-gate case F_SETLK: 18680Sstevel@tonic-gate case F_SETLKW: 18690Sstevel@tonic-gate case F_FREESP: 18700Sstevel@tonic-gate case F_ALLOCSP: 18710Sstevel@tonic-gate case F_SETLK_NBMAND: 18720Sstevel@tonic-gate show_flock32(pri, offset); 18730Sstevel@tonic-gate break; 18740Sstevel@tonic-gate case F_GETLK64: 18750Sstevel@tonic-gate case F_SETLK64: 18760Sstevel@tonic-gate case F_SETLKW64: 18770Sstevel@tonic-gate case F_FREESP64: 18780Sstevel@tonic-gate case F_SETLK64_NBMAND: 18790Sstevel@tonic-gate show_flock64(pri, offset); 18800Sstevel@tonic-gate break; 18810Sstevel@tonic-gate #endif /* _LP64 */ 18820Sstevel@tonic-gate case F_SHARE: 18830Sstevel@tonic-gate case F_UNSHARE: 18840Sstevel@tonic-gate show_share(pri, offset); 18850Sstevel@tonic-gate break; 18860Sstevel@tonic-gate } 18870Sstevel@tonic-gate } 18880Sstevel@tonic-gate 18890Sstevel@tonic-gate void 18900Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump) 18910Sstevel@tonic-gate { 18920Sstevel@tonic-gate struct strbuf strbuf; 18930Sstevel@tonic-gate 18940Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 18950Sstevel@tonic-gate print_strbuf(pri, &strbuf, name, dump); 18960Sstevel@tonic-gate } 18970Sstevel@tonic-gate 18980Sstevel@tonic-gate #ifdef _LP64 18990Sstevel@tonic-gate void 19000Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump) 19010Sstevel@tonic-gate { 19020Sstevel@tonic-gate struct strbuf32 strbuf; 19030Sstevel@tonic-gate 19040Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 19050Sstevel@tonic-gate print_strbuf32(pri, &strbuf, name, dump); 19060Sstevel@tonic-gate } 19070Sstevel@tonic-gate #endif /* _LP64 */ 19080Sstevel@tonic-gate 19090Sstevel@tonic-gate void 19100Sstevel@tonic-gate show_gp_msg(private_t *pri, int what) 19110Sstevel@tonic-gate { 19120Sstevel@tonic-gate long offset; 19130Sstevel@tonic-gate int dump = FALSE; 19140Sstevel@tonic-gate int fdp1 = pri->sys_args[0] + 1; 19150Sstevel@tonic-gate 19160Sstevel@tonic-gate switch (what) { 19170Sstevel@tonic-gate case SYS_getmsg: 19180Sstevel@tonic-gate case SYS_getpmsg: 19190Sstevel@tonic-gate if (pri->Errno == 0 && prismember(&readfd, fdp1)) 19200Sstevel@tonic-gate dump = TRUE; 19210Sstevel@tonic-gate break; 19220Sstevel@tonic-gate case SYS_putmsg: 19230Sstevel@tonic-gate case SYS_putpmsg: 19240Sstevel@tonic-gate if (prismember(&writefd, fdp1)) 19250Sstevel@tonic-gate dump = TRUE; 19260Sstevel@tonic-gate break; 19270Sstevel@tonic-gate } 19280Sstevel@tonic-gate 19290Sstevel@tonic-gate /* enter region of lengthy output */ 19300Sstevel@tonic-gate if (dump) 19310Sstevel@tonic-gate Eserialize(); 19320Sstevel@tonic-gate 19330Sstevel@tonic-gate #ifdef _LP64 19340Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) { 19350Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19360Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19370Sstevel@tonic-gate else 19380Sstevel@tonic-gate show_strbuf32(pri, offset, "ctl", dump); 19390Sstevel@tonic-gate } 19400Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) { 19410Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19420Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19430Sstevel@tonic-gate else 19440Sstevel@tonic-gate show_strbuf32(pri, offset, "dat", dump); 19450Sstevel@tonic-gate } 19460Sstevel@tonic-gate #else /* _LP64 */ 19470Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) 19480Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19490Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) 19500Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19510Sstevel@tonic-gate #endif /* _LP64 */ 19520Sstevel@tonic-gate 19530Sstevel@tonic-gate /* exit region of lengthy output */ 19540Sstevel@tonic-gate if (dump) 19550Sstevel@tonic-gate Xserialize(); 19560Sstevel@tonic-gate } 19570Sstevel@tonic-gate 19580Sstevel@tonic-gate void 19590Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name) 19600Sstevel@tonic-gate { 19610Sstevel@tonic-gate int value; 19620Sstevel@tonic-gate 19630Sstevel@tonic-gate if (offset != 0 && 19640Sstevel@tonic-gate Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19650Sstevel@tonic-gate (void) printf("%s\t%s:\t%d\n", 19660Sstevel@tonic-gate pri->pname, 19670Sstevel@tonic-gate name, 19680Sstevel@tonic-gate value); 19690Sstevel@tonic-gate } 19700Sstevel@tonic-gate 19710Sstevel@tonic-gate void 19720Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name) 19730Sstevel@tonic-gate { 19740Sstevel@tonic-gate int value; 19750Sstevel@tonic-gate 19760Sstevel@tonic-gate if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19770Sstevel@tonic-gate (void) printf("%s\t%s:\t0x%.4X\n", 19780Sstevel@tonic-gate pri->pname, 19790Sstevel@tonic-gate name, 19800Sstevel@tonic-gate value); 19810Sstevel@tonic-gate } 19820Sstevel@tonic-gate 19830Sstevel@tonic-gate #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \ 19840Sstevel@tonic-gate POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) 19850Sstevel@tonic-gate 19860Sstevel@tonic-gate const char * 19870Sstevel@tonic-gate pollevent(private_t *pri, int arg) 19880Sstevel@tonic-gate { 19890Sstevel@tonic-gate char *str = pri->code_buf; 19900Sstevel@tonic-gate 19910Sstevel@tonic-gate if (arg == 0) 19920Sstevel@tonic-gate return ("0"); 19930Sstevel@tonic-gate if (arg & ~ALL_POLL_FLAGS) { 19940Sstevel@tonic-gate (void) sprintf(str, "0x%-5X", arg); 19950Sstevel@tonic-gate return ((const char *)str); 19960Sstevel@tonic-gate } 19970Sstevel@tonic-gate 19980Sstevel@tonic-gate *str = '\0'; 19990Sstevel@tonic-gate if (arg & POLLIN) 20000Sstevel@tonic-gate (void) strcat(str, "|POLLIN"); 20010Sstevel@tonic-gate if (arg & POLLPRI) 20020Sstevel@tonic-gate (void) strcat(str, "|POLLPRI"); 20030Sstevel@tonic-gate if (arg & POLLOUT) 20040Sstevel@tonic-gate (void) strcat(str, "|POLLOUT"); 20050Sstevel@tonic-gate if (arg & POLLRDNORM) 20060Sstevel@tonic-gate (void) strcat(str, "|POLLRDNORM"); 20070Sstevel@tonic-gate if (arg & POLLRDBAND) 20080Sstevel@tonic-gate (void) strcat(str, "|POLLRDBAND"); 20090Sstevel@tonic-gate if (arg & POLLWRBAND) 20100Sstevel@tonic-gate (void) strcat(str, "|POLLWRBAND"); 20110Sstevel@tonic-gate if (arg & POLLERR) 20120Sstevel@tonic-gate (void) strcat(str, "|POLLERR"); 20130Sstevel@tonic-gate if (arg & POLLHUP) 20140Sstevel@tonic-gate (void) strcat(str, "|POLLHUP"); 20150Sstevel@tonic-gate if (arg & POLLNVAL) 20160Sstevel@tonic-gate (void) strcat(str, "|POLLNVAL"); 20170Sstevel@tonic-gate 20180Sstevel@tonic-gate return ((const char *)(str+1)); 20190Sstevel@tonic-gate } 20200Sstevel@tonic-gate 20210Sstevel@tonic-gate static void 20220Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd) 20230Sstevel@tonic-gate { 20240Sstevel@tonic-gate /* 20250Sstevel@tonic-gate * can't print both events and revents in same printf. 20260Sstevel@tonic-gate * pollevent() returns a pointer to a TSD location. 20270Sstevel@tonic-gate */ 20280Sstevel@tonic-gate (void) printf("%s\tfd=%-2d ev=%s", 20290Sstevel@tonic-gate pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events)); 20300Sstevel@tonic-gate (void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents)); 20310Sstevel@tonic-gate } 20320Sstevel@tonic-gate 20330Sstevel@tonic-gate static void 20340Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds) 20350Sstevel@tonic-gate { 20360Sstevel@tonic-gate struct pollfd pollfd[2]; 20370Sstevel@tonic-gate int skip = -1; 20380Sstevel@tonic-gate 20390Sstevel@tonic-gate for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) { 20400Sstevel@tonic-gate if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) != 20410Sstevel@tonic-gate sizeof (struct pollfd)) 20420Sstevel@tonic-gate continue; 20430Sstevel@tonic-gate 20440Sstevel@tonic-gate if (skip >= 0 && pollfd[0].fd == pollfd[1].fd && 20450Sstevel@tonic-gate pollfd[0].events == pollfd[1].events && 20460Sstevel@tonic-gate pollfd[0].revents == pollfd[1].revents) { 20470Sstevel@tonic-gate skip++; 20480Sstevel@tonic-gate continue; 20490Sstevel@tonic-gate } 20500Sstevel@tonic-gate 20510Sstevel@tonic-gate if (skip > 0) 20520Sstevel@tonic-gate (void) printf("%s\t...last pollfd structure" 20530Sstevel@tonic-gate " repeated %d time%s...\n", 20540Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20550Sstevel@tonic-gate 20560Sstevel@tonic-gate skip = 0; 20570Sstevel@tonic-gate show_one_pollfd(pri, &pollfd[0]); 20580Sstevel@tonic-gate pollfd[1] = pollfd[0]; 20590Sstevel@tonic-gate } 20600Sstevel@tonic-gate 20610Sstevel@tonic-gate if (skip > 0) 20620Sstevel@tonic-gate (void) printf( 20630Sstevel@tonic-gate "%s\t...last pollfd structure repeated %d time%s...\n", 20640Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20650Sstevel@tonic-gate } 20660Sstevel@tonic-gate 20670Sstevel@tonic-gate void 20680Sstevel@tonic-gate show_poll(private_t *pri) 20690Sstevel@tonic-gate { 20700Sstevel@tonic-gate long offset; 20710Sstevel@tonic-gate int nfds; 20720Sstevel@tonic-gate int serial = 0; 20730Sstevel@tonic-gate 20740Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[0]) == NULL || 20750Sstevel@tonic-gate (nfds = pri->sys_args[1]) <= 0) 20760Sstevel@tonic-gate return; 20770Sstevel@tonic-gate 20780Sstevel@tonic-gate /* enter region of lengthy output */ 20790Sstevel@tonic-gate if (nfds > 32) { 20800Sstevel@tonic-gate Eserialize(); 20810Sstevel@tonic-gate serial = 1; 20820Sstevel@tonic-gate } 20830Sstevel@tonic-gate 20840Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds); 20850Sstevel@tonic-gate 20860Sstevel@tonic-gate /* exit region of lengthy output */ 20870Sstevel@tonic-gate if (serial) 20880Sstevel@tonic-gate Xserialize(); 20890Sstevel@tonic-gate } 20900Sstevel@tonic-gate 20910Sstevel@tonic-gate void 20920Sstevel@tonic-gate show_pollsys(private_t *pri) 20930Sstevel@tonic-gate { 20940Sstevel@tonic-gate long offset; 20950Sstevel@tonic-gate int nfds; 20960Sstevel@tonic-gate int serial = 0; 20970Sstevel@tonic-gate 20980Sstevel@tonic-gate if (pri->sys_nargs < 2) 20990Sstevel@tonic-gate return; 21000Sstevel@tonic-gate 21010Sstevel@tonic-gate offset = pri->sys_args[0]; 21020Sstevel@tonic-gate nfds = pri->sys_args[1]; 21030Sstevel@tonic-gate 21040Sstevel@tonic-gate /* enter region of lengthy output */ 21050Sstevel@tonic-gate if (offset != NULL && nfds > 32) { 21060Sstevel@tonic-gate Eserialize(); 21070Sstevel@tonic-gate serial = 1; 21080Sstevel@tonic-gate } 21090Sstevel@tonic-gate 21100Sstevel@tonic-gate if (offset != NULL && nfds > 0) 21110Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds); 21120Sstevel@tonic-gate 21130Sstevel@tonic-gate if (pri->sys_nargs > 2) 21140Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 21150Sstevel@tonic-gate 21160Sstevel@tonic-gate if (pri->sys_nargs > 3) 21170Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[3], "sigmask"); 21180Sstevel@tonic-gate 21190Sstevel@tonic-gate /* exit region of lengthy output */ 21200Sstevel@tonic-gate if (serial) 21210Sstevel@tonic-gate Xserialize(); 21220Sstevel@tonic-gate } 21230Sstevel@tonic-gate 21240Sstevel@tonic-gate static void 21250Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip) 21260Sstevel@tonic-gate { 21270Sstevel@tonic-gate (void) printf("%s\tu=%-5d g=%-5d cu=%-5d cg=%-5d z=%-5d " 21280Sstevel@tonic-gate "m=0%.6o key=%d projid=%-5d\n", 21290Sstevel@tonic-gate pri->pname, 21300Sstevel@tonic-gate (int)ip->ipcx_uid, 21310Sstevel@tonic-gate (int)ip->ipcx_gid, 21320Sstevel@tonic-gate (int)ip->ipcx_cuid, 21330Sstevel@tonic-gate (int)ip->ipcx_cgid, 21340Sstevel@tonic-gate (int)ip->ipcx_zoneid, 21350Sstevel@tonic-gate (unsigned int)ip->ipcx_mode, 21360Sstevel@tonic-gate ip->ipcx_key, 21370Sstevel@tonic-gate (int)ip->ipcx_projid); 21380Sstevel@tonic-gate } 21390Sstevel@tonic-gate 21400Sstevel@tonic-gate void 21410Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip) 21420Sstevel@tonic-gate { 21430Sstevel@tonic-gate (void) printf( 21440Sstevel@tonic-gate "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21450Sstevel@tonic-gate pri->pname, 21460Sstevel@tonic-gate (int)ip->uid, 21470Sstevel@tonic-gate (int)ip->gid, 21480Sstevel@tonic-gate (int)ip->cuid, 21490Sstevel@tonic-gate (int)ip->cgid, 21500Sstevel@tonic-gate (int)ip->mode, 21510Sstevel@tonic-gate ip->seq, 21520Sstevel@tonic-gate ip->key); 21530Sstevel@tonic-gate } 21540Sstevel@tonic-gate 21550Sstevel@tonic-gate #ifdef _LP64 21560Sstevel@tonic-gate void 21570Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip) 21580Sstevel@tonic-gate { 21590Sstevel@tonic-gate (void) printf( 21600Sstevel@tonic-gate "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21610Sstevel@tonic-gate pri->pname, 21620Sstevel@tonic-gate ip->uid, 21630Sstevel@tonic-gate ip->gid, 21640Sstevel@tonic-gate ip->cuid, 21650Sstevel@tonic-gate ip->cgid, 21660Sstevel@tonic-gate ip->mode, 21670Sstevel@tonic-gate ip->seq, 21680Sstevel@tonic-gate ip->key); 21690Sstevel@tonic-gate } 21700Sstevel@tonic-gate #endif /* _LP64 */ 21710Sstevel@tonic-gate 21720Sstevel@tonic-gate static void 21730Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset) 21740Sstevel@tonic-gate { 21750Sstevel@tonic-gate struct msqid_ds64 msgq; 21760Sstevel@tonic-gate 21770Sstevel@tonic-gate if (offset != NULL && 21780Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 21790Sstevel@tonic-gate show_perm64(pri, &msgq.msgx_perm); 21800Sstevel@tonic-gate 21810Sstevel@tonic-gate (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu " 21820Sstevel@tonic-gate "lspid=%-5d lrpid=%-5d\n", pri->pname, 21830Sstevel@tonic-gate (unsigned long long)msgq.msgx_cbytes, 21840Sstevel@tonic-gate (unsigned long long)msgq.msgx_qnum, 21850Sstevel@tonic-gate (unsigned long long)msgq.msgx_qbytes, 21860Sstevel@tonic-gate (int)msgq.msgx_lspid, 21870Sstevel@tonic-gate (int)msgq.msgx_lrpid); 21880Sstevel@tonic-gate 21890Sstevel@tonic-gate prtime(pri, " st = ", (time_t)msgq.msgx_stime); 21900Sstevel@tonic-gate prtime(pri, " rt = ", (time_t)msgq.msgx_rtime); 21910Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)msgq.msgx_ctime); 21920Sstevel@tonic-gate } 21930Sstevel@tonic-gate } 21940Sstevel@tonic-gate 21950Sstevel@tonic-gate void 21960Sstevel@tonic-gate show_msgctl(private_t *pri, long offset) 21970Sstevel@tonic-gate { 21980Sstevel@tonic-gate struct msqid_ds msgq; 21990Sstevel@tonic-gate 22000Sstevel@tonic-gate if (offset != NULL && 22010Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 22020Sstevel@tonic-gate show_perm(pri, &msgq.msg_perm); 22030Sstevel@tonic-gate 22040Sstevel@tonic-gate (void) printf( 22050Sstevel@tonic-gate "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n", 22060Sstevel@tonic-gate pri->pname, 22070Sstevel@tonic-gate msgq.msg_cbytes, 22080Sstevel@tonic-gate msgq.msg_qnum, 22090Sstevel@tonic-gate msgq.msg_qbytes, 22100Sstevel@tonic-gate (int)msgq.msg_lspid, 22110Sstevel@tonic-gate (int)msgq.msg_lrpid); 22120Sstevel@tonic-gate 22130Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22140Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22150Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22160Sstevel@tonic-gate } 22170Sstevel@tonic-gate } 22180Sstevel@tonic-gate 22190Sstevel@tonic-gate #ifdef _LP64 22200Sstevel@tonic-gate void 22210Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset) 22220Sstevel@tonic-gate { 22230Sstevel@tonic-gate struct msqid_ds32 msgq; 22240Sstevel@tonic-gate 22250Sstevel@tonic-gate if (offset != NULL && 22260Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 22270Sstevel@tonic-gate show_perm32(pri, &msgq.msg_perm); 22280Sstevel@tonic-gate 22290Sstevel@tonic-gate (void) printf( 22300Sstevel@tonic-gate "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n", 22310Sstevel@tonic-gate pri->pname, 22320Sstevel@tonic-gate msgq.msg_cbytes, 22330Sstevel@tonic-gate msgq.msg_qnum, 22340Sstevel@tonic-gate msgq.msg_qbytes, 22350Sstevel@tonic-gate msgq.msg_lspid, 22360Sstevel@tonic-gate msgq.msg_lrpid); 22370Sstevel@tonic-gate 22380Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22390Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22400Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22410Sstevel@tonic-gate } 22420Sstevel@tonic-gate } 22430Sstevel@tonic-gate #endif /* _LP64 */ 22440Sstevel@tonic-gate 22450Sstevel@tonic-gate void 22460Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz) 22470Sstevel@tonic-gate { 22480Sstevel@tonic-gate struct msgbuf msgb; 22490Sstevel@tonic-gate 22500Sstevel@tonic-gate if (offset != NULL && 22510Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22520Sstevel@tonic-gate sizeof (msgb.mtype)) { 22530Sstevel@tonic-gate /* enter region of lengthy output */ 22540Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22550Sstevel@tonic-gate Eserialize(); 22560Sstevel@tonic-gate 22570Sstevel@tonic-gate (void) printf("%s\tmtype=%lu mtext[]=\n", 22580Sstevel@tonic-gate pri->pname, 22590Sstevel@tonic-gate msgb.mtype); 22600Sstevel@tonic-gate showbuffer(pri, 22610Sstevel@tonic-gate (long)(offset + sizeof (msgb.mtype)), msgsz); 22620Sstevel@tonic-gate 22630Sstevel@tonic-gate /* exit region of lengthy output */ 22640Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22650Sstevel@tonic-gate Xserialize(); 22660Sstevel@tonic-gate } 22670Sstevel@tonic-gate } 22680Sstevel@tonic-gate 22690Sstevel@tonic-gate #ifdef _LP64 22700Sstevel@tonic-gate void 22710Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz) 22720Sstevel@tonic-gate { 22730Sstevel@tonic-gate struct ipcmsgbuf32 msgb; 22740Sstevel@tonic-gate 22750Sstevel@tonic-gate if (offset != NULL && 22760Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22770Sstevel@tonic-gate sizeof (msgb.mtype)) { 22780Sstevel@tonic-gate /* enter region of lengthy output */ 22790Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22800Sstevel@tonic-gate Eserialize(); 22810Sstevel@tonic-gate 22820Sstevel@tonic-gate (void) printf("%s\tmtype=%u mtext[]=\n", 22830Sstevel@tonic-gate pri->pname, 22840Sstevel@tonic-gate msgb.mtype); 22850Sstevel@tonic-gate showbuffer(pri, 22860Sstevel@tonic-gate (long)(offset + sizeof (msgb.mtype)), msgsz); 22870Sstevel@tonic-gate 22880Sstevel@tonic-gate /* exit region of lengthy output */ 22890Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22900Sstevel@tonic-gate Xserialize(); 22910Sstevel@tonic-gate } 22920Sstevel@tonic-gate } 22930Sstevel@tonic-gate #endif /* _LP64 */ 22940Sstevel@tonic-gate 22950Sstevel@tonic-gate #ifdef _LP64 22960Sstevel@tonic-gate void 22970Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 22980Sstevel@tonic-gate { 22990Sstevel@tonic-gate switch (pri->sys_args[0]) { 23000Sstevel@tonic-gate case 0: /* msgget() */ 23010Sstevel@tonic-gate break; 23020Sstevel@tonic-gate case 1: /* msgctl() */ 23030Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23040Sstevel@tonic-gate switch (pri->sys_args[2]) { 23050Sstevel@tonic-gate case IPC_STAT: 23060Sstevel@tonic-gate if (pri->Errno) 23070Sstevel@tonic-gate break; 23080Sstevel@tonic-gate /*FALLTHROUGH*/ 23090Sstevel@tonic-gate case IPC_SET: 23100Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23110Sstevel@tonic-gate show_msgctl(pri, 23120Sstevel@tonic-gate (long)pri->sys_args[3]); 23130Sstevel@tonic-gate else 23140Sstevel@tonic-gate show_msgctl32(pri, 23150Sstevel@tonic-gate (long)pri->sys_args[3]); 23160Sstevel@tonic-gate break; 23170Sstevel@tonic-gate case IPC_STAT64: 23180Sstevel@tonic-gate if (pri->Errno) 23190Sstevel@tonic-gate break; 23200Sstevel@tonic-gate /*FALLTHROUGH*/ 23210Sstevel@tonic-gate case IPC_SET64: 23220Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23230Sstevel@tonic-gate break; 23240Sstevel@tonic-gate } 23250Sstevel@tonic-gate } 23260Sstevel@tonic-gate break; 23270Sstevel@tonic-gate case 2: /* msgrcv() */ 23280Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) { 23290Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23300Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23310Sstevel@tonic-gate else 23320Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], msgsz); 23330Sstevel@tonic-gate } 23340Sstevel@tonic-gate break; 23350Sstevel@tonic-gate case 3: /* msgsnd() */ 23360Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23370Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23380Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23390Sstevel@tonic-gate pri->sys_args[3]); 23400Sstevel@tonic-gate else 23410Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], 23420Sstevel@tonic-gate pri->sys_args[3]); 23430Sstevel@tonic-gate } 23440Sstevel@tonic-gate break; 23450Sstevel@tonic-gate case 4: /* msgids() */ 23460Sstevel@tonic-gate case 5: /* msgsnap() */ 23470Sstevel@tonic-gate default: /* unexpected subcode */ 23480Sstevel@tonic-gate break; 23490Sstevel@tonic-gate } 23500Sstevel@tonic-gate } 23510Sstevel@tonic-gate #else /* _LP64 */ 23520Sstevel@tonic-gate void 23530Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 23540Sstevel@tonic-gate { 23550Sstevel@tonic-gate switch (pri->sys_args[0]) { 23560Sstevel@tonic-gate case 0: /* msgget() */ 23570Sstevel@tonic-gate break; 23580Sstevel@tonic-gate case 1: /* msgctl() */ 23590Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23600Sstevel@tonic-gate switch (pri->sys_args[2]) { 23610Sstevel@tonic-gate case IPC_STAT: 23620Sstevel@tonic-gate if (pri->Errno) 23630Sstevel@tonic-gate break; 23640Sstevel@tonic-gate /*FALLTHROUGH*/ 23650Sstevel@tonic-gate case IPC_SET: 23660Sstevel@tonic-gate show_msgctl(pri, (long)pri->sys_args[3]); 23670Sstevel@tonic-gate break; 23680Sstevel@tonic-gate case IPC_STAT64: 23690Sstevel@tonic-gate if (pri->Errno) 23700Sstevel@tonic-gate break; 23710Sstevel@tonic-gate /*FALLTHROUGH*/ 23720Sstevel@tonic-gate case IPC_SET64: 23730Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23740Sstevel@tonic-gate break; 23750Sstevel@tonic-gate } 23760Sstevel@tonic-gate } 23770Sstevel@tonic-gate break; 23780Sstevel@tonic-gate case 2: /* msgrcv() */ 23790Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) 23800Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23810Sstevel@tonic-gate break; 23820Sstevel@tonic-gate case 3: /* msgsnd() */ 23830Sstevel@tonic-gate if (pri->sys_nargs > 3) 23840Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23850Sstevel@tonic-gate pri->sys_args[3]); 23860Sstevel@tonic-gate break; 23870Sstevel@tonic-gate case 4: /* msgids() */ 23880Sstevel@tonic-gate case 5: /* msgsnap() */ 23890Sstevel@tonic-gate default: /* unexpected subcode */ 23900Sstevel@tonic-gate break; 23910Sstevel@tonic-gate } 23920Sstevel@tonic-gate } 23930Sstevel@tonic-gate #endif /* _LP64 */ 23940Sstevel@tonic-gate 23950Sstevel@tonic-gate static void 23960Sstevel@tonic-gate show_semctl64(private_t *pri, long offset) 23970Sstevel@tonic-gate { 23980Sstevel@tonic-gate struct semid_ds64 semds; 23990Sstevel@tonic-gate 24000Sstevel@tonic-gate if (offset != NULL && 24010Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24020Sstevel@tonic-gate show_perm64(pri, &semds.semx_perm); 24030Sstevel@tonic-gate 24040Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems); 24050Sstevel@tonic-gate 24060Sstevel@tonic-gate prtime(pri, " ot = ", (time_t)semds.semx_otime); 24070Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)semds.semx_ctime); 24080Sstevel@tonic-gate } 24090Sstevel@tonic-gate } 24100Sstevel@tonic-gate 24110Sstevel@tonic-gate void 24120Sstevel@tonic-gate show_semctl(private_t *pri, long offset) 24130Sstevel@tonic-gate { 24140Sstevel@tonic-gate struct semid_ds semds; 24150Sstevel@tonic-gate 24160Sstevel@tonic-gate if (offset != NULL && 24170Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24180Sstevel@tonic-gate show_perm(pri, &semds.sem_perm); 24190Sstevel@tonic-gate 24200Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24210Sstevel@tonic-gate pri->pname, 24220Sstevel@tonic-gate semds.sem_nsems); 24230Sstevel@tonic-gate 24240Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24250Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24260Sstevel@tonic-gate } 24270Sstevel@tonic-gate } 24280Sstevel@tonic-gate 24290Sstevel@tonic-gate #ifdef _LP64 24300Sstevel@tonic-gate void 24310Sstevel@tonic-gate show_semctl32(private_t *pri, long offset) 24320Sstevel@tonic-gate { 24330Sstevel@tonic-gate struct semid_ds32 semds; 24340Sstevel@tonic-gate 24350Sstevel@tonic-gate if (offset != NULL && 24360Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24370Sstevel@tonic-gate show_perm32(pri, &semds.sem_perm); 24380Sstevel@tonic-gate 24390Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24400Sstevel@tonic-gate pri->pname, 24410Sstevel@tonic-gate semds.sem_nsems); 24420Sstevel@tonic-gate 24430Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24440Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24450Sstevel@tonic-gate } 24460Sstevel@tonic-gate } 24470Sstevel@tonic-gate #endif /* _LP64 */ 24480Sstevel@tonic-gate 24490Sstevel@tonic-gate void 24500Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout) 24510Sstevel@tonic-gate { 24520Sstevel@tonic-gate struct sembuf sembuf; 24530Sstevel@tonic-gate const char *str; 24540Sstevel@tonic-gate 24550Sstevel@tonic-gate if (offset == NULL) 24560Sstevel@tonic-gate return; 24570Sstevel@tonic-gate 24580Sstevel@tonic-gate if (nsops > 40) /* let's not be ridiculous */ 24590Sstevel@tonic-gate nsops = 40; 24600Sstevel@tonic-gate 24610Sstevel@tonic-gate for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) { 24620Sstevel@tonic-gate if (Pread(Proc, &sembuf, sizeof (sembuf), offset) != 24630Sstevel@tonic-gate sizeof (sembuf)) 24640Sstevel@tonic-gate break; 24650Sstevel@tonic-gate 24660Sstevel@tonic-gate (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=", 24670Sstevel@tonic-gate pri->pname, 24680Sstevel@tonic-gate sembuf.sem_num, 24690Sstevel@tonic-gate sembuf.sem_op); 24700Sstevel@tonic-gate 24710Sstevel@tonic-gate if (sembuf.sem_flg == 0) 24720Sstevel@tonic-gate (void) printf("0\n"); 24730Sstevel@tonic-gate else if ((str = semflags(pri, sembuf.sem_flg)) != NULL) 24740Sstevel@tonic-gate (void) printf("%s\n", str); 24750Sstevel@tonic-gate else 24760Sstevel@tonic-gate (void) printf("0%.6o\n", sembuf.sem_flg); 24770Sstevel@tonic-gate } 24780Sstevel@tonic-gate if (timeout) 24790Sstevel@tonic-gate show_timestruc(pri, timeout, "timeout"); 24800Sstevel@tonic-gate } 24810Sstevel@tonic-gate 24820Sstevel@tonic-gate void 24830Sstevel@tonic-gate show_semsys(private_t *pri) 24840Sstevel@tonic-gate { 24850Sstevel@tonic-gate switch (pri->sys_args[0]) { 24860Sstevel@tonic-gate case 0: /* semctl() */ 24870Sstevel@tonic-gate if (pri->sys_nargs > 4) { 24880Sstevel@tonic-gate switch (pri->sys_args[3]) { 24890Sstevel@tonic-gate case IPC_STAT: 24900Sstevel@tonic-gate if (pri->Errno) 24910Sstevel@tonic-gate break; 24920Sstevel@tonic-gate /*FALLTHROUGH*/ 24930Sstevel@tonic-gate case IPC_SET: 24940Sstevel@tonic-gate #ifdef _LP64 24950Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 24960Sstevel@tonic-gate show_semctl(pri, 24970Sstevel@tonic-gate (long)pri->sys_args[4]); 24980Sstevel@tonic-gate else 24990Sstevel@tonic-gate show_semctl32(pri, 25000Sstevel@tonic-gate (long)pri->sys_args[4]); 25010Sstevel@tonic-gate #else 25020Sstevel@tonic-gate show_semctl(pri, (long)pri->sys_args[4]); 25030Sstevel@tonic-gate #endif 25040Sstevel@tonic-gate break; 25050Sstevel@tonic-gate case IPC_STAT64: 25060Sstevel@tonic-gate if (pri->Errno) 25070Sstevel@tonic-gate break; 25080Sstevel@tonic-gate /*FALLTHROUGH*/ 25090Sstevel@tonic-gate case IPC_SET64: 25100Sstevel@tonic-gate show_semctl64(pri, (long)pri->sys_args[4]); 25110Sstevel@tonic-gate break; 25120Sstevel@tonic-gate } 25130Sstevel@tonic-gate } 25140Sstevel@tonic-gate break; 25150Sstevel@tonic-gate case 1: /* semget() */ 25160Sstevel@tonic-gate break; 25170Sstevel@tonic-gate case 2: /* semop() */ 25180Sstevel@tonic-gate if (pri->sys_nargs > 3) 25190Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25200Sstevel@tonic-gate pri->sys_args[3], 0); 25210Sstevel@tonic-gate break; 25220Sstevel@tonic-gate case 3: /* semids() */ 25230Sstevel@tonic-gate break; 25240Sstevel@tonic-gate case 4: /* semtimedop() */ 25250Sstevel@tonic-gate if (pri->sys_nargs > 4) 25260Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25270Sstevel@tonic-gate pri->sys_args[3], pri->sys_args[4]); 25280Sstevel@tonic-gate break; 25290Sstevel@tonic-gate default: /* unexpected subcode */ 25300Sstevel@tonic-gate break; 25310Sstevel@tonic-gate } 25320Sstevel@tonic-gate } 25330Sstevel@tonic-gate 25340Sstevel@tonic-gate static void 25350Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset) 25360Sstevel@tonic-gate { 25370Sstevel@tonic-gate struct shmid_ds64 shmds; 25380Sstevel@tonic-gate 25390Sstevel@tonic-gate if (offset != NULL && 25400Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25410Sstevel@tonic-gate show_perm64(pri, &shmds.shmx_perm); 25420Sstevel@tonic-gate 25430Sstevel@tonic-gate (void) printf( 25440Sstevel@tonic-gate "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n", 25450Sstevel@tonic-gate pri->pname, 25460Sstevel@tonic-gate (unsigned long long)shmds.shmx_segsz, 25470Sstevel@tonic-gate (int)shmds.shmx_lpid, 25480Sstevel@tonic-gate (int)shmds.shmx_cpid, 25490Sstevel@tonic-gate (unsigned long long)shmds.shmx_nattch, 25500Sstevel@tonic-gate (unsigned long long)shmds.shmx_cnattch); 25510Sstevel@tonic-gate 25520Sstevel@tonic-gate prtime(pri, " at = ", (time_t)shmds.shmx_atime); 25530Sstevel@tonic-gate prtime(pri, " dt = ", (time_t)shmds.shmx_dtime); 25540Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)shmds.shmx_ctime); 25550Sstevel@tonic-gate } 25560Sstevel@tonic-gate } 25570Sstevel@tonic-gate 25580Sstevel@tonic-gate void 25590Sstevel@tonic-gate show_shmctl(private_t *pri, long offset) 25600Sstevel@tonic-gate { 25610Sstevel@tonic-gate struct shmid_ds shmds; 25620Sstevel@tonic-gate 25630Sstevel@tonic-gate if (offset != NULL && 25640Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25650Sstevel@tonic-gate show_perm(pri, &shmds.shm_perm); 25660Sstevel@tonic-gate 25670Sstevel@tonic-gate (void) printf( 25680Sstevel@tonic-gate "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n", 25690Sstevel@tonic-gate pri->pname, 25700Sstevel@tonic-gate (ulong_t)shmds.shm_segsz, 25710Sstevel@tonic-gate (int)shmds.shm_lpid, 25720Sstevel@tonic-gate (int)shmds.shm_cpid, 25730Sstevel@tonic-gate shmds.shm_nattch, 25740Sstevel@tonic-gate shmds.shm_cnattch); 25750Sstevel@tonic-gate 25760Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 25770Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 25780Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 25790Sstevel@tonic-gate } 25800Sstevel@tonic-gate } 25810Sstevel@tonic-gate 25820Sstevel@tonic-gate #ifdef _LP64 25830Sstevel@tonic-gate void 25840Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset) 25850Sstevel@tonic-gate { 25860Sstevel@tonic-gate struct shmid_ds32 shmds; 25870Sstevel@tonic-gate 25880Sstevel@tonic-gate if (offset != NULL && 25890Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25900Sstevel@tonic-gate show_perm32(pri, &shmds.shm_perm); 25910Sstevel@tonic-gate 25920Sstevel@tonic-gate (void) printf( 25930Sstevel@tonic-gate "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n", 25940Sstevel@tonic-gate pri->pname, 25950Sstevel@tonic-gate shmds.shm_segsz, 25960Sstevel@tonic-gate shmds.shm_lpid, 25970Sstevel@tonic-gate shmds.shm_cpid, 25980Sstevel@tonic-gate shmds.shm_nattch, 25990Sstevel@tonic-gate shmds.shm_cnattch); 26000Sstevel@tonic-gate 26010Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 26020Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 26030Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 26040Sstevel@tonic-gate } 26050Sstevel@tonic-gate } 26060Sstevel@tonic-gate #endif /* _LP64 */ 26070Sstevel@tonic-gate 26080Sstevel@tonic-gate void 26090Sstevel@tonic-gate show_shmsys(private_t *pri) 26100Sstevel@tonic-gate { 26110Sstevel@tonic-gate switch (pri->sys_args[0]) { 26120Sstevel@tonic-gate case 0: /* shmat() */ 26130Sstevel@tonic-gate break; 26140Sstevel@tonic-gate case 1: /* shmctl() */ 26150Sstevel@tonic-gate if (pri->sys_nargs > 3) { 26160Sstevel@tonic-gate switch (pri->sys_args[2]) { 26170Sstevel@tonic-gate case IPC_STAT: 26180Sstevel@tonic-gate if (pri->Errno) 26190Sstevel@tonic-gate break; 26200Sstevel@tonic-gate /*FALLTHROUGH*/ 26210Sstevel@tonic-gate case IPC_SET: 26220Sstevel@tonic-gate #ifdef _LP64 26230Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 26240Sstevel@tonic-gate show_shmctl(pri, 26250Sstevel@tonic-gate (long)pri->sys_args[3]); 26260Sstevel@tonic-gate else 26270Sstevel@tonic-gate show_shmctl32(pri, 26280Sstevel@tonic-gate (long)pri->sys_args[3]); 26290Sstevel@tonic-gate #else 26300Sstevel@tonic-gate show_shmctl(pri, (long)pri->sys_args[3]); 26310Sstevel@tonic-gate #endif 26320Sstevel@tonic-gate break; 26330Sstevel@tonic-gate case IPC_STAT64: 26340Sstevel@tonic-gate if (pri->Errno) 26350Sstevel@tonic-gate break; 26360Sstevel@tonic-gate /*FALLTHROUGH*/ 26370Sstevel@tonic-gate case IPC_SET64: 26380Sstevel@tonic-gate show_shmctl64(pri, (long)pri->sys_args[3]); 26390Sstevel@tonic-gate break; 26400Sstevel@tonic-gate } 26410Sstevel@tonic-gate } 26420Sstevel@tonic-gate break; 26430Sstevel@tonic-gate case 2: /* shmdt() */ 26440Sstevel@tonic-gate case 3: /* shmget() */ 26450Sstevel@tonic-gate case 4: /* shmids() */ 26460Sstevel@tonic-gate default: /* unexpected subcode */ 26470Sstevel@tonic-gate break; 26480Sstevel@tonic-gate } 26490Sstevel@tonic-gate } 26500Sstevel@tonic-gate 26510Sstevel@tonic-gate void 26520Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count) 26530Sstevel@tonic-gate { 26540Sstevel@tonic-gate int groups[100]; 26550Sstevel@tonic-gate 26560Sstevel@tonic-gate if (count > 100) 26570Sstevel@tonic-gate count = 100; 26580Sstevel@tonic-gate 26590Sstevel@tonic-gate if (count > 0 && offset != NULL && 26600Sstevel@tonic-gate Pread(Proc, &groups[0], count*sizeof (int), offset) == 26610Sstevel@tonic-gate count*sizeof (int)) { 26620Sstevel@tonic-gate int n; 26630Sstevel@tonic-gate 26640Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 26650Sstevel@tonic-gate for (n = 0; !interrupt && n < count; n++) { 26660Sstevel@tonic-gate if (n != 0 && n%10 == 0) 26670Sstevel@tonic-gate (void) printf("\n%s\t", pri->pname); 26680Sstevel@tonic-gate (void) printf(" %5d", groups[n]); 26690Sstevel@tonic-gate } 26700Sstevel@tonic-gate (void) fputc('\n', stdout); 26710Sstevel@tonic-gate } 26720Sstevel@tonic-gate } 26730Sstevel@tonic-gate 26740Sstevel@tonic-gate /* 26750Sstevel@tonic-gate * This assumes that a sigset_t is simply an array of ints. 26760Sstevel@tonic-gate */ 26770Sstevel@tonic-gate char * 26780Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp) 26790Sstevel@tonic-gate { 26800Sstevel@tonic-gate char *s = pri->code_buf; 26810Sstevel@tonic-gate int n = sizeof (*sp) / sizeof (int32_t); 26820Sstevel@tonic-gate int32_t *lp = (int32_t *)sp; 26830Sstevel@tonic-gate 26840Sstevel@tonic-gate while (--n >= 0) { 26850Sstevel@tonic-gate int32_t val = *lp++; 26860Sstevel@tonic-gate 26870Sstevel@tonic-gate if (val == 0) 26880Sstevel@tonic-gate s += sprintf(s, " 0"); 26890Sstevel@tonic-gate else 26900Sstevel@tonic-gate s += sprintf(s, " 0x%.8X", val); 26910Sstevel@tonic-gate } 26920Sstevel@tonic-gate 26930Sstevel@tonic-gate return (pri->code_buf); 26940Sstevel@tonic-gate } 26950Sstevel@tonic-gate 26960Sstevel@tonic-gate void 26970Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name) 26980Sstevel@tonic-gate { 26990Sstevel@tonic-gate sigset_t sigset; 27000Sstevel@tonic-gate 27010Sstevel@tonic-gate if (offset != NULL && 27020Sstevel@tonic-gate Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) { 27030Sstevel@tonic-gate (void) printf("%s\t%s =%s\n", 27040Sstevel@tonic-gate pri->pname, name, sigset_string(pri, &sigset)); 27050Sstevel@tonic-gate } 27060Sstevel@tonic-gate } 27070Sstevel@tonic-gate 27080Sstevel@tonic-gate #ifdef _LP64 27090Sstevel@tonic-gate void 27100Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name) 27110Sstevel@tonic-gate { 27120Sstevel@tonic-gate struct sigaltstack32 altstack; 27130Sstevel@tonic-gate 27140Sstevel@tonic-gate if (offset != NULL && 27150Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27160Sstevel@tonic-gate sizeof (altstack)) { 27170Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n", 27180Sstevel@tonic-gate pri->pname, 27190Sstevel@tonic-gate name, 27200Sstevel@tonic-gate altstack.ss_sp, 27210Sstevel@tonic-gate altstack.ss_size, 27220Sstevel@tonic-gate altstack.ss_flags); 27230Sstevel@tonic-gate } 27240Sstevel@tonic-gate } 27250Sstevel@tonic-gate #endif /* _LP64 */ 27260Sstevel@tonic-gate 27270Sstevel@tonic-gate void 27280Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name) 27290Sstevel@tonic-gate { 27300Sstevel@tonic-gate struct sigaltstack altstack; 27310Sstevel@tonic-gate 27320Sstevel@tonic-gate #ifdef _LP64 27330Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27340Sstevel@tonic-gate show_sigaltstack32(pri, offset, name); 27350Sstevel@tonic-gate return; 27360Sstevel@tonic-gate } 27370Sstevel@tonic-gate #endif 27380Sstevel@tonic-gate if (offset != NULL && 27390Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27400Sstevel@tonic-gate sizeof (altstack)) { 27410Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n", 27420Sstevel@tonic-gate pri->pname, 27430Sstevel@tonic-gate name, 27440Sstevel@tonic-gate (ulong_t)altstack.ss_sp, 27450Sstevel@tonic-gate (ulong_t)altstack.ss_size, 27460Sstevel@tonic-gate altstack.ss_flags); 27470Sstevel@tonic-gate } 27480Sstevel@tonic-gate } 27490Sstevel@tonic-gate 27500Sstevel@tonic-gate #ifdef _LP64 27510Sstevel@tonic-gate void 27520Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp) 27530Sstevel@tonic-gate { 27540Sstevel@tonic-gate struct sigaction32 sigaction; 27550Sstevel@tonic-gate 27560Sstevel@tonic-gate if (offset != NULL && 27570Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27580Sstevel@tonic-gate sizeof (sigaction)) { 27590Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27600Sstevel@tonic-gate if (odisp != NULL) 27610Sstevel@tonic-gate sigaction.sa_handler = (caddr32_t)odisp; 27620Sstevel@tonic-gate (void) printf( 27630Sstevel@tonic-gate "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n", 27640Sstevel@tonic-gate pri->pname, 27650Sstevel@tonic-gate name, 27660Sstevel@tonic-gate sigaction.sa_handler, 27670Sstevel@tonic-gate sigset_string(pri, (sigset_t *)&sigaction.sa_mask), 27680Sstevel@tonic-gate sigaction.sa_flags); 27690Sstevel@tonic-gate } 27700Sstevel@tonic-gate } 27710Sstevel@tonic-gate #endif /* _LP64 */ 27720Sstevel@tonic-gate 27730Sstevel@tonic-gate void 27740Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp) 27750Sstevel@tonic-gate { 27760Sstevel@tonic-gate struct sigaction sigaction; 27770Sstevel@tonic-gate 27780Sstevel@tonic-gate #ifdef _LP64 27790Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27800Sstevel@tonic-gate show_sigaction32(pri, offset, name, odisp); 27810Sstevel@tonic-gate return; 27820Sstevel@tonic-gate } 27830Sstevel@tonic-gate #endif 27840Sstevel@tonic-gate if (offset != NULL && 27850Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27860Sstevel@tonic-gate sizeof (sigaction)) { 27870Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27880Sstevel@tonic-gate if (odisp != NULL) 27890Sstevel@tonic-gate sigaction.sa_handler = (void (*)())odisp; 27900Sstevel@tonic-gate (void) printf( 27910Sstevel@tonic-gate "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n", 27920Sstevel@tonic-gate pri->pname, 27930Sstevel@tonic-gate name, 27940Sstevel@tonic-gate (long)sigaction.sa_handler, 27950Sstevel@tonic-gate sigset_string(pri, &sigaction.sa_mask), 27960Sstevel@tonic-gate sigaction.sa_flags); 27970Sstevel@tonic-gate } 27980Sstevel@tonic-gate } 27990Sstevel@tonic-gate 28000Sstevel@tonic-gate #ifdef _LP64 28010Sstevel@tonic-gate void 28020Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip) 28030Sstevel@tonic-gate { 28040Sstevel@tonic-gate const char *code = NULL; 28050Sstevel@tonic-gate 28060Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 28070Sstevel@tonic-gate signame(pri, sip->si_signo)); 28080Sstevel@tonic-gate 28090Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 28100Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid); 28110Sstevel@tonic-gate if (sip->si_code != 0) 28120Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 28130Sstevel@tonic-gate (void) fputc('\n', stdout); 28140Sstevel@tonic-gate return; 28150Sstevel@tonic-gate } 28160Sstevel@tonic-gate 28170Sstevel@tonic-gate switch (sip->si_signo) { 28180Sstevel@tonic-gate default: 28190Sstevel@tonic-gate (void) fputc('\n', stdout); 28200Sstevel@tonic-gate return; 28210Sstevel@tonic-gate case SIGILL: 28220Sstevel@tonic-gate case SIGTRAP: 28230Sstevel@tonic-gate case SIGFPE: 28240Sstevel@tonic-gate case SIGSEGV: 28250Sstevel@tonic-gate case SIGBUS: 28260Sstevel@tonic-gate case SIGEMT: 28270Sstevel@tonic-gate case SIGCLD: 28280Sstevel@tonic-gate case SIGPOLL: 28290Sstevel@tonic-gate case SIGXFSZ: 28300Sstevel@tonic-gate break; 28310Sstevel@tonic-gate } 28320Sstevel@tonic-gate 28330Sstevel@tonic-gate switch (sip->si_signo) { 28340Sstevel@tonic-gate case SIGILL: 28350Sstevel@tonic-gate switch (sip->si_code) { 28360Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 28370Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 28380Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 28390Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 28400Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 28410Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 28420Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 28430Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 28440Sstevel@tonic-gate } 28450Sstevel@tonic-gate break; 28460Sstevel@tonic-gate case SIGTRAP: 28470Sstevel@tonic-gate switch (sip->si_code) { 28480Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 28490Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 28500Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 28510Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 28520Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 28530Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 28540Sstevel@tonic-gate } 28550Sstevel@tonic-gate break; 28560Sstevel@tonic-gate case SIGFPE: 28570Sstevel@tonic-gate switch (sip->si_code) { 28580Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 28590Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 28600Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 28610Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 28620Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 28630Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 28640Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 28650Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 28660Sstevel@tonic-gate #if defined(FPE_FLTDEN) 28670Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 28680Sstevel@tonic-gate #endif 28690Sstevel@tonic-gate } 28700Sstevel@tonic-gate break; 28710Sstevel@tonic-gate case SIGSEGV: 28720Sstevel@tonic-gate switch (sip->si_code) { 28730Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 28740Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 28750Sstevel@tonic-gate } 28760Sstevel@tonic-gate break; 28770Sstevel@tonic-gate case SIGEMT: 28780Sstevel@tonic-gate switch (sip->si_code) { 28790Sstevel@tonic-gate #ifdef EMT_TAGOVF 28800Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 28810Sstevel@tonic-gate #endif 28820Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 28830Sstevel@tonic-gate } 28840Sstevel@tonic-gate break; 28850Sstevel@tonic-gate case SIGBUS: 28860Sstevel@tonic-gate switch (sip->si_code) { 28870Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 28880Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 28890Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 28900Sstevel@tonic-gate } 28910Sstevel@tonic-gate break; 28920Sstevel@tonic-gate case SIGCLD: 28930Sstevel@tonic-gate switch (sip->si_code) { 28940Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 28950Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 28960Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 28970Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 28980Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 28990Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 29000Sstevel@tonic-gate } 29010Sstevel@tonic-gate break; 29020Sstevel@tonic-gate case SIGPOLL: 29030Sstevel@tonic-gate switch (sip->si_code) { 29040Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 29050Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 29060Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 29070Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 29080Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 29090Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 29100Sstevel@tonic-gate } 29110Sstevel@tonic-gate break; 29120Sstevel@tonic-gate } 29130Sstevel@tonic-gate 29140Sstevel@tonic-gate if (code == NULL) { 29150Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 29160Sstevel@tonic-gate code = (const char *)pri->code_buf; 29170Sstevel@tonic-gate } 29180Sstevel@tonic-gate 29190Sstevel@tonic-gate switch (sip->si_signo) { 29200Sstevel@tonic-gate case SIGILL: 29210Sstevel@tonic-gate case SIGTRAP: 29220Sstevel@tonic-gate case SIGFPE: 29230Sstevel@tonic-gate case SIGSEGV: 29240Sstevel@tonic-gate case SIGBUS: 29250Sstevel@tonic-gate case SIGEMT: 29260Sstevel@tonic-gate (void) printf(" %s addr=0x%.8X", 29270Sstevel@tonic-gate code, 29280Sstevel@tonic-gate sip->si_addr); 29290Sstevel@tonic-gate break; 29300Sstevel@tonic-gate case SIGCLD: 29310Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 29320Sstevel@tonic-gate code, 29330Sstevel@tonic-gate sip->si_pid, 29340Sstevel@tonic-gate sip->si_status); 29350Sstevel@tonic-gate break; 29360Sstevel@tonic-gate case SIGPOLL: 29370Sstevel@tonic-gate case SIGXFSZ: 29380Sstevel@tonic-gate (void) printf(" %s fd=%d band=%d", 29390Sstevel@tonic-gate code, 29400Sstevel@tonic-gate sip->si_fd, 29410Sstevel@tonic-gate sip->si_band); 29420Sstevel@tonic-gate break; 29430Sstevel@tonic-gate } 29440Sstevel@tonic-gate 29450Sstevel@tonic-gate if (sip->si_errno != 0) { 29460Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 29470Sstevel@tonic-gate 29480Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 29490Sstevel@tonic-gate if (ename != NULL) 29500Sstevel@tonic-gate (void) printf("(%s)", ename); 29510Sstevel@tonic-gate } 29520Sstevel@tonic-gate 29530Sstevel@tonic-gate (void) fputc('\n', stdout); 29540Sstevel@tonic-gate } 29550Sstevel@tonic-gate #endif /* _LP64 */ 29560Sstevel@tonic-gate 29570Sstevel@tonic-gate void 29580Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip) 29590Sstevel@tonic-gate { 29600Sstevel@tonic-gate const char *code = NULL; 29610Sstevel@tonic-gate 29620Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 29630Sstevel@tonic-gate signame(pri, sip->si_signo)); 29640Sstevel@tonic-gate 29650Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 29660Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", 29670Sstevel@tonic-gate (int)sip->si_pid, 29680Sstevel@tonic-gate (int)sip->si_uid); 29690Sstevel@tonic-gate if (sip->si_code != 0) 29700Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 29710Sstevel@tonic-gate (void) fputc('\n', stdout); 29720Sstevel@tonic-gate return; 29730Sstevel@tonic-gate } 29740Sstevel@tonic-gate 29750Sstevel@tonic-gate switch (sip->si_signo) { 29760Sstevel@tonic-gate default: 29770Sstevel@tonic-gate (void) fputc('\n', stdout); 29780Sstevel@tonic-gate return; 29790Sstevel@tonic-gate case SIGILL: 29800Sstevel@tonic-gate case SIGTRAP: 29810Sstevel@tonic-gate case SIGFPE: 29820Sstevel@tonic-gate case SIGSEGV: 29830Sstevel@tonic-gate case SIGBUS: 29840Sstevel@tonic-gate case SIGEMT: 29850Sstevel@tonic-gate case SIGCLD: 29860Sstevel@tonic-gate case SIGPOLL: 29870Sstevel@tonic-gate case SIGXFSZ: 29880Sstevel@tonic-gate break; 29890Sstevel@tonic-gate } 29900Sstevel@tonic-gate 29910Sstevel@tonic-gate switch (sip->si_signo) { 29920Sstevel@tonic-gate case SIGILL: 29930Sstevel@tonic-gate switch (sip->si_code) { 29940Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 29950Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 29960Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 29970Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 29980Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 29990Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 30000Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 30010Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 30020Sstevel@tonic-gate } 30030Sstevel@tonic-gate break; 30040Sstevel@tonic-gate case SIGTRAP: 30050Sstevel@tonic-gate switch (sip->si_code) { 30060Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 30070Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 30080Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 30090Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 30100Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 30110Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 30120Sstevel@tonic-gate } 30130Sstevel@tonic-gate break; 30140Sstevel@tonic-gate case SIGFPE: 30150Sstevel@tonic-gate switch (sip->si_code) { 30160Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 30170Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 30180Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 30190Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 30200Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 30210Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 30220Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 30230Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 30240Sstevel@tonic-gate #if defined(FPE_FLTDEN) 30250Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 30260Sstevel@tonic-gate #endif 30270Sstevel@tonic-gate } 30280Sstevel@tonic-gate break; 30290Sstevel@tonic-gate case SIGSEGV: 30300Sstevel@tonic-gate switch (sip->si_code) { 30310Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 30320Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 30330Sstevel@tonic-gate } 30340Sstevel@tonic-gate break; 30350Sstevel@tonic-gate case SIGEMT: 30360Sstevel@tonic-gate switch (sip->si_code) { 30370Sstevel@tonic-gate #ifdef EMT_TAGOVF 30380Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 30390Sstevel@tonic-gate #endif 30400Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 30410Sstevel@tonic-gate } 30420Sstevel@tonic-gate break; 30430Sstevel@tonic-gate case SIGBUS: 30440Sstevel@tonic-gate switch (sip->si_code) { 30450Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 30460Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 30470Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 30480Sstevel@tonic-gate } 30490Sstevel@tonic-gate break; 30500Sstevel@tonic-gate case SIGCLD: 30510Sstevel@tonic-gate switch (sip->si_code) { 30520Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 30530Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 30540Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 30550Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 30560Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 30570Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 30580Sstevel@tonic-gate } 30590Sstevel@tonic-gate break; 30600Sstevel@tonic-gate case SIGPOLL: 30610Sstevel@tonic-gate switch (sip->si_code) { 30620Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 30630Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 30640Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 30650Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 30660Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 30670Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 30680Sstevel@tonic-gate } 30690Sstevel@tonic-gate break; 30700Sstevel@tonic-gate } 30710Sstevel@tonic-gate 30720Sstevel@tonic-gate if (code == NULL) { 30730Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 30740Sstevel@tonic-gate code = (const char *)pri->code_buf; 30750Sstevel@tonic-gate } 30760Sstevel@tonic-gate 30770Sstevel@tonic-gate switch (sip->si_signo) { 30780Sstevel@tonic-gate case SIGILL: 30790Sstevel@tonic-gate case SIGTRAP: 30800Sstevel@tonic-gate case SIGFPE: 30810Sstevel@tonic-gate case SIGSEGV: 30820Sstevel@tonic-gate case SIGBUS: 30830Sstevel@tonic-gate case SIGEMT: 30840Sstevel@tonic-gate (void) printf(" %s addr=0x%.8lX", 30850Sstevel@tonic-gate code, 30860Sstevel@tonic-gate (long)sip->si_addr); 30870Sstevel@tonic-gate break; 30880Sstevel@tonic-gate case SIGCLD: 30890Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 30900Sstevel@tonic-gate code, 30910Sstevel@tonic-gate (int)sip->si_pid, 30920Sstevel@tonic-gate sip->si_status); 30930Sstevel@tonic-gate break; 30940Sstevel@tonic-gate case SIGPOLL: 30950Sstevel@tonic-gate case SIGXFSZ: 30960Sstevel@tonic-gate (void) printf(" %s fd=%d band=%ld", 30970Sstevel@tonic-gate code, 30980Sstevel@tonic-gate sip->si_fd, 30990Sstevel@tonic-gate sip->si_band); 31000Sstevel@tonic-gate break; 31010Sstevel@tonic-gate } 31020Sstevel@tonic-gate 31030Sstevel@tonic-gate if (sip->si_errno != 0) { 31040Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 31050Sstevel@tonic-gate 31060Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 31070Sstevel@tonic-gate if (ename != NULL) 31080Sstevel@tonic-gate (void) printf("(%s)", ename); 31090Sstevel@tonic-gate } 31100Sstevel@tonic-gate 31110Sstevel@tonic-gate (void) fputc('\n', stdout); 31120Sstevel@tonic-gate } 31130Sstevel@tonic-gate 31140Sstevel@tonic-gate #ifdef _LP64 31150Sstevel@tonic-gate void 31160Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset) 31170Sstevel@tonic-gate { 31180Sstevel@tonic-gate struct siginfo32 siginfo; 31190Sstevel@tonic-gate 31200Sstevel@tonic-gate if (offset != NULL && 31210Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31220Sstevel@tonic-gate print_siginfo32(pri, &siginfo); 31230Sstevel@tonic-gate } 31240Sstevel@tonic-gate #endif /* _LP64 */ 31250Sstevel@tonic-gate 31260Sstevel@tonic-gate void 31270Sstevel@tonic-gate show_siginfo(private_t *pri, long offset) 31280Sstevel@tonic-gate { 31290Sstevel@tonic-gate struct siginfo siginfo; 31300Sstevel@tonic-gate 31310Sstevel@tonic-gate #ifdef _LP64 31320Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 31330Sstevel@tonic-gate show_siginfo32(pri, offset); 31340Sstevel@tonic-gate return; 31350Sstevel@tonic-gate } 31360Sstevel@tonic-gate #endif 31370Sstevel@tonic-gate if (offset != NULL && 31380Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31390Sstevel@tonic-gate print_siginfo(pri, &siginfo); 31400Sstevel@tonic-gate } 31410Sstevel@tonic-gate 31420Sstevel@tonic-gate void 31430Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count) 31440Sstevel@tonic-gate { 31450Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4); 31460Sstevel@tonic-gate 31470Sstevel@tonic-gate /* enter region of lengthy output */ 31480Sstevel@tonic-gate if (serial) 31490Sstevel@tonic-gate Eserialize(); 31500Sstevel@tonic-gate 31510Sstevel@tonic-gate while (count > 0) { 31520Sstevel@tonic-gate char buf[32]; 31530Sstevel@tonic-gate int nb = (count < 32)? count : 32; 31540Sstevel@tonic-gate int i; 31550Sstevel@tonic-gate 31560Sstevel@tonic-gate if (Pread(Proc, buf, (size_t)nb, offset) != nb) 31570Sstevel@tonic-gate break; 31580Sstevel@tonic-gate 31590Sstevel@tonic-gate (void) printf("%s ", pri->pname); 31600Sstevel@tonic-gate for (i = 0; i < nb; i++) 31610Sstevel@tonic-gate (void) printf(" %d", buf[i]); 31620Sstevel@tonic-gate (void) fputc('\n', stdout); 31630Sstevel@tonic-gate 31640Sstevel@tonic-gate count -= nb; 31650Sstevel@tonic-gate offset += nb; 31660Sstevel@tonic-gate } 31670Sstevel@tonic-gate 31680Sstevel@tonic-gate /* exit region of lengthy output */ 31690Sstevel@tonic-gate if (serial) 31700Sstevel@tonic-gate Xserialize(); 31710Sstevel@tonic-gate } 31720Sstevel@tonic-gate 31730Sstevel@tonic-gate #ifdef _LP64 31740Sstevel@tonic-gate void 31750Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count) 31760Sstevel@tonic-gate { 31770Sstevel@tonic-gate iovec32_t iovec[16]; 31780Sstevel@tonic-gate iovec32_t *ip; 31790Sstevel@tonic-gate long nb; 31800Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 31810Sstevel@tonic-gate 31820Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 31830Sstevel@tonic-gate niov = 16; 31840Sstevel@tonic-gate 31850Sstevel@tonic-gate if (offset != NULL && niov > 0 && 31860Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset) 31870Sstevel@tonic-gate == niov*sizeof (iovec32_t)) { 31880Sstevel@tonic-gate /* enter region of lengthy output */ 31890Sstevel@tonic-gate if (serial) 31900Sstevel@tonic-gate Eserialize(); 31910Sstevel@tonic-gate 31920Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 31930Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n", 31940Sstevel@tonic-gate pri->pname, 31950Sstevel@tonic-gate ip->iov_base, 31960Sstevel@tonic-gate ip->iov_len); 31970Sstevel@tonic-gate if ((nb = count) > 0) { 31980Sstevel@tonic-gate if (nb > ip->iov_len) 31990Sstevel@tonic-gate nb = ip->iov_len; 32000Sstevel@tonic-gate if (nb > 0) 32010Sstevel@tonic-gate count -= nb; 32020Sstevel@tonic-gate } 32030Sstevel@tonic-gate if (showbuf && nb > 0) 32040Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 32050Sstevel@tonic-gate } 32060Sstevel@tonic-gate 32070Sstevel@tonic-gate /* exit region of lengthy output */ 32080Sstevel@tonic-gate if (serial) 32090Sstevel@tonic-gate Xserialize(); 32100Sstevel@tonic-gate } 32110Sstevel@tonic-gate } 32120Sstevel@tonic-gate #endif /* _LP64 */ 32130Sstevel@tonic-gate 32140Sstevel@tonic-gate void 32150Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count) 32160Sstevel@tonic-gate { 32170Sstevel@tonic-gate iovec_t iovec[16]; 32180Sstevel@tonic-gate iovec_t *ip; 32190Sstevel@tonic-gate long nb; 32200Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 32210Sstevel@tonic-gate 32220Sstevel@tonic-gate #ifdef _LP64 32230Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 32240Sstevel@tonic-gate show_iovec32(pri, offset, niov, showbuf, count); 32250Sstevel@tonic-gate return; 32260Sstevel@tonic-gate } 32270Sstevel@tonic-gate #endif 32280Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 32290Sstevel@tonic-gate niov = 16; 32300Sstevel@tonic-gate 32310Sstevel@tonic-gate if (offset != NULL && niov > 0 && 32320Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset) 32330Sstevel@tonic-gate == niov*sizeof (iovec_t)) { 32340Sstevel@tonic-gate /* enter region of lengthy output */ 32350Sstevel@tonic-gate if (serial) 32360Sstevel@tonic-gate Eserialize(); 32370Sstevel@tonic-gate 32380Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 32390Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n", 32400Sstevel@tonic-gate pri->pname, 32410Sstevel@tonic-gate (long)ip->iov_base, 32420Sstevel@tonic-gate ip->iov_len); 32430Sstevel@tonic-gate if ((nb = count) > 0) { 32440Sstevel@tonic-gate if (nb > ip->iov_len) 32450Sstevel@tonic-gate nb = ip->iov_len; 32460Sstevel@tonic-gate if (nb > 0) 32470Sstevel@tonic-gate count -= nb; 32480Sstevel@tonic-gate } 32490Sstevel@tonic-gate if (showbuf && nb > 0) 32500Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 32510Sstevel@tonic-gate } 32520Sstevel@tonic-gate 32530Sstevel@tonic-gate /* exit region of lengthy output */ 32540Sstevel@tonic-gate if (serial) 32550Sstevel@tonic-gate Xserialize(); 32560Sstevel@tonic-gate } 32570Sstevel@tonic-gate } 32580Sstevel@tonic-gate 32590Sstevel@tonic-gate void 32600Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count) 32610Sstevel@tonic-gate { 32620Sstevel@tonic-gate long buf[MYBUFSIZ / sizeof (long)]; 32630Sstevel@tonic-gate struct dirent32 *dp; 32640Sstevel@tonic-gate int serial = (count > 100); 32650Sstevel@tonic-gate 32660Sstevel@tonic-gate if (offset == NULL) 32670Sstevel@tonic-gate return; 32680Sstevel@tonic-gate 32690Sstevel@tonic-gate /* enter region of lengthy output */ 32700Sstevel@tonic-gate if (serial) 32710Sstevel@tonic-gate Eserialize(); 32720Sstevel@tonic-gate 32730Sstevel@tonic-gate while (count > 0 && !interrupt) { 32740Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 32750Sstevel@tonic-gate 32760Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 32770Sstevel@tonic-gate break; 32780Sstevel@tonic-gate 32790Sstevel@tonic-gate dp = (struct dirent32 *)&buf[0]; 32800Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 32810Sstevel@tonic-gate break; 32820Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 32830Sstevel@tonic-gate /* getdents() error? */ 32840Sstevel@tonic-gate (void) printf( 32850Sstevel@tonic-gate "%s ino=%-5u off=%-4d rlen=%-3d\n", 32860Sstevel@tonic-gate pri->pname, 32870Sstevel@tonic-gate dp->d_ino, 32880Sstevel@tonic-gate dp->d_off, 32890Sstevel@tonic-gate dp->d_reclen); 32900Sstevel@tonic-gate break; 32910Sstevel@tonic-gate } 32920Sstevel@tonic-gate 32930Sstevel@tonic-gate while (!interrupt && 32940Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 32950Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 32960Sstevel@tonic-gate (void) printf( 32970Sstevel@tonic-gate "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n", 32980Sstevel@tonic-gate pri->pname, 32990Sstevel@tonic-gate dp->d_ino, 33000Sstevel@tonic-gate dp->d_off, 33010Sstevel@tonic-gate dp->d_reclen, 33020Sstevel@tonic-gate dp->d_reclen - (int)(dp->d_name - (char *)dp), 33030Sstevel@tonic-gate dp->d_name); 33040Sstevel@tonic-gate nb -= dp->d_reclen; 33050Sstevel@tonic-gate count -= dp->d_reclen; 33060Sstevel@tonic-gate offset += dp->d_reclen; 33070Sstevel@tonic-gate /* LINTED improper alignment */ 33080Sstevel@tonic-gate dp = (struct dirent32 *)((char *)dp + dp->d_reclen); 33090Sstevel@tonic-gate } 33100Sstevel@tonic-gate } 33110Sstevel@tonic-gate 33120Sstevel@tonic-gate /* exit region of lengthy output */ 33130Sstevel@tonic-gate if (serial) 33140Sstevel@tonic-gate Xserialize(); 33150Sstevel@tonic-gate } 33160Sstevel@tonic-gate 33170Sstevel@tonic-gate void 33180Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count) 33190Sstevel@tonic-gate { 33200Sstevel@tonic-gate long long buf[MYBUFSIZ / sizeof (long long)]; 33210Sstevel@tonic-gate struct dirent64 *dp; 33220Sstevel@tonic-gate int serial = (count > 100); 33230Sstevel@tonic-gate 33240Sstevel@tonic-gate if (offset == NULL) 33250Sstevel@tonic-gate return; 33260Sstevel@tonic-gate 33270Sstevel@tonic-gate /* enter region of lengthy output */ 33280Sstevel@tonic-gate if (serial) 33290Sstevel@tonic-gate Eserialize(); 33300Sstevel@tonic-gate 33310Sstevel@tonic-gate while (count > 0 && !interrupt) { 33320Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 33330Sstevel@tonic-gate 33340Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 33350Sstevel@tonic-gate break; 33360Sstevel@tonic-gate 33370Sstevel@tonic-gate dp = (struct dirent64 *)&buf[0]; 33380Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 33390Sstevel@tonic-gate break; 33400Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 33410Sstevel@tonic-gate /* getdents() error? */ 33420Sstevel@tonic-gate (void) printf( 33430Sstevel@tonic-gate "%s ino=%-5llu off=%-4lld rlen=%-3d\n", 33440Sstevel@tonic-gate pri->pname, 33450Sstevel@tonic-gate (long long)dp->d_ino, 33460Sstevel@tonic-gate (long long)dp->d_off, 33470Sstevel@tonic-gate dp->d_reclen); 33480Sstevel@tonic-gate break; 33490Sstevel@tonic-gate } 33500Sstevel@tonic-gate 33510Sstevel@tonic-gate while (!interrupt && 33520Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 33530Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 33540Sstevel@tonic-gate (void) printf( 33550Sstevel@tonic-gate "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n", 33560Sstevel@tonic-gate pri->pname, 33570Sstevel@tonic-gate (long long)dp->d_ino, 33580Sstevel@tonic-gate (long long)dp->d_off, 33590Sstevel@tonic-gate dp->d_reclen, 33600Sstevel@tonic-gate dp->d_reclen - (int)(dp->d_name - (char *)dp), 33610Sstevel@tonic-gate dp->d_name); 33620Sstevel@tonic-gate nb -= dp->d_reclen; 33630Sstevel@tonic-gate count -= dp->d_reclen; 33640Sstevel@tonic-gate offset += dp->d_reclen; 33650Sstevel@tonic-gate /* LINTED improper alignment */ 33660Sstevel@tonic-gate dp = (struct dirent64 *)((char *)dp + dp->d_reclen); 33670Sstevel@tonic-gate } 33680Sstevel@tonic-gate } 33690Sstevel@tonic-gate 33700Sstevel@tonic-gate /* exit region of lengthy output */ 33710Sstevel@tonic-gate if (serial) 33720Sstevel@tonic-gate Xserialize(); 33730Sstevel@tonic-gate } 33740Sstevel@tonic-gate 33750Sstevel@tonic-gate void 33760Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset) 33770Sstevel@tonic-gate { 33780Sstevel@tonic-gate struct rlimit32 rlimit; 33790Sstevel@tonic-gate 33800Sstevel@tonic-gate if (offset != NULL && 33810Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 33820Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 33830Sstevel@tonic-gate switch (rlimit.rlim_cur) { 33840Sstevel@tonic-gate case RLIM32_INFINITY: 33850Sstevel@tonic-gate (void) fputs("cur = RLIM_INFINITY", stdout); 33860Sstevel@tonic-gate break; 33870Sstevel@tonic-gate case RLIM32_SAVED_MAX: 33880Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_MAX", stdout); 33890Sstevel@tonic-gate break; 33900Sstevel@tonic-gate case RLIM32_SAVED_CUR: 33910Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_CUR", stdout); 33920Sstevel@tonic-gate break; 33930Sstevel@tonic-gate default: 33940Sstevel@tonic-gate (void) printf("cur = %lu", (long)rlimit.rlim_cur); 33950Sstevel@tonic-gate break; 33960Sstevel@tonic-gate } 33970Sstevel@tonic-gate switch (rlimit.rlim_max) { 33980Sstevel@tonic-gate case RLIM32_INFINITY: 33990Sstevel@tonic-gate (void) fputs(" max = RLIM_INFINITY\n", stdout); 34000Sstevel@tonic-gate break; 34010Sstevel@tonic-gate case RLIM32_SAVED_MAX: 34020Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_MAX\n", stdout); 34030Sstevel@tonic-gate break; 34040Sstevel@tonic-gate case RLIM32_SAVED_CUR: 34050Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_CUR\n", stdout); 34060Sstevel@tonic-gate break; 34070Sstevel@tonic-gate default: 34080Sstevel@tonic-gate (void) printf(" max = %lu\n", (long)rlimit.rlim_max); 34090Sstevel@tonic-gate break; 34100Sstevel@tonic-gate } 34110Sstevel@tonic-gate } 34120Sstevel@tonic-gate } 34130Sstevel@tonic-gate 34140Sstevel@tonic-gate void 34150Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset) 34160Sstevel@tonic-gate { 34170Sstevel@tonic-gate struct rlimit64 rlimit; 34180Sstevel@tonic-gate 34190Sstevel@tonic-gate if (offset != NULL && 34200Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 34210Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 34220Sstevel@tonic-gate switch (rlimit.rlim_cur) { 34230Sstevel@tonic-gate case RLIM64_INFINITY: 34240Sstevel@tonic-gate (void) fputs("cur = RLIM64_INFINITY", stdout); 34250Sstevel@tonic-gate break; 34260Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34270Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_MAX", stdout); 34280Sstevel@tonic-gate break; 34290Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34300Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_CUR", stdout); 34310Sstevel@tonic-gate break; 34320Sstevel@tonic-gate default: 34330Sstevel@tonic-gate (void) printf("cur = %llu", 34340Sstevel@tonic-gate (unsigned long long)rlimit.rlim_cur); 34350Sstevel@tonic-gate break; 34360Sstevel@tonic-gate } 34370Sstevel@tonic-gate switch (rlimit.rlim_max) { 34380Sstevel@tonic-gate case RLIM64_INFINITY: 34390Sstevel@tonic-gate (void) fputs(" max = RLIM64_INFINITY\n", stdout); 34400Sstevel@tonic-gate break; 34410Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34420Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout); 34430Sstevel@tonic-gate break; 34440Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34450Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout); 34460Sstevel@tonic-gate break; 34470Sstevel@tonic-gate default: 34480Sstevel@tonic-gate (void) printf(" max = %llu\n", 34490Sstevel@tonic-gate (unsigned long long)rlimit.rlim_max); 34500Sstevel@tonic-gate break; 34510Sstevel@tonic-gate } 34520Sstevel@tonic-gate } 34530Sstevel@tonic-gate } 34540Sstevel@tonic-gate 34550Sstevel@tonic-gate void 34560Sstevel@tonic-gate show_nuname(private_t *pri, long offset) 34570Sstevel@tonic-gate { 34580Sstevel@tonic-gate struct utsname ubuf; 34590Sstevel@tonic-gate 34600Sstevel@tonic-gate if (offset != NULL && 34610Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 34620Sstevel@tonic-gate (void) printf( 34630Sstevel@tonic-gate "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n", 34640Sstevel@tonic-gate pri->pname, 34650Sstevel@tonic-gate ubuf.sysname, 34660Sstevel@tonic-gate ubuf.nodename, 34670Sstevel@tonic-gate ubuf.release, 34680Sstevel@tonic-gate ubuf.version, 34690Sstevel@tonic-gate ubuf.machine); 34700Sstevel@tonic-gate } 34710Sstevel@tonic-gate } 34720Sstevel@tonic-gate 34730Sstevel@tonic-gate void 34740Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2) 34750Sstevel@tonic-gate { 34760Sstevel@tonic-gate show_timeval(pri, off1, " delta"); 34770Sstevel@tonic-gate show_timeval(pri, off2, "olddelta"); 34780Sstevel@tonic-gate } 34790Sstevel@tonic-gate 34800Sstevel@tonic-gate void 34810Sstevel@tonic-gate show_sockaddr(private_t *pri, 34820Sstevel@tonic-gate const char *str, long addroff, long lenoff, long len) 34830Sstevel@tonic-gate { 34840Sstevel@tonic-gate /* 34850Sstevel@tonic-gate * A buffer large enough for PATH_MAX size AF_UNIX address, which is 34860Sstevel@tonic-gate * also large enough to store a sockaddr_in or a sockaddr_in6. 34870Sstevel@tonic-gate */ 34880Sstevel@tonic-gate long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1) 34890Sstevel@tonic-gate / sizeof (long)]; 34900Sstevel@tonic-gate struct sockaddr *sa = (struct sockaddr *)buf; 34910Sstevel@tonic-gate struct sockaddr_in *sin = (struct sockaddr_in *)buf; 34920Sstevel@tonic-gate struct sockaddr_un *soun = (struct sockaddr_un *)buf; 34930Sstevel@tonic-gate struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf; 34940Sstevel@tonic-gate char addrbuf[INET6_ADDRSTRLEN]; 34950Sstevel@tonic-gate 34960Sstevel@tonic-gate if (lenoff != 0) { 34970Sstevel@tonic-gate uint_t ilen; 34980Sstevel@tonic-gate if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen)) 34990Sstevel@tonic-gate return; 35000Sstevel@tonic-gate len = ilen; 35010Sstevel@tonic-gate } 35020Sstevel@tonic-gate 35030Sstevel@tonic-gate if (len >= sizeof (buf)) /* protect against ridiculous length */ 35040Sstevel@tonic-gate len = sizeof (buf) - 1; 35050Sstevel@tonic-gate if (Pread(Proc, buf, len, addroff) != len) 35060Sstevel@tonic-gate return; 35070Sstevel@tonic-gate 35080Sstevel@tonic-gate switch (sa->sa_family) { 35090Sstevel@tonic-gate case AF_INET6: 35100Sstevel@tonic-gate (void) printf("%s\tAF_INET6 %s = %s port = %u\n", 35110Sstevel@tonic-gate pri->pname, str, 35120Sstevel@tonic-gate inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, 35130Sstevel@tonic-gate sizeof (addrbuf)), 35140Sstevel@tonic-gate ntohs(sin6->sin6_port)); 35150Sstevel@tonic-gate (void) printf("%s\tscope id = %u source id = 0x%x\n" 35160Sstevel@tonic-gate "%s\tflow class = 0x%02x flow label = 0x%05x\n", 35170Sstevel@tonic-gate pri->pname, ntohl(sin6->sin6_scope_id), 35180Sstevel@tonic-gate ntohl(sin6->__sin6_src_id), 35190Sstevel@tonic-gate pri->pname, 35200Sstevel@tonic-gate ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20), 35210Sstevel@tonic-gate ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL)); 35220Sstevel@tonic-gate break; 35230Sstevel@tonic-gate case AF_INET: 35240Sstevel@tonic-gate case AF_NCA: 35250Sstevel@tonic-gate (void) printf("%s\tAF_%s %s = %s port = %u\n", 35260Sstevel@tonic-gate pri->pname, sa->sa_family == AF_INET ? "INET" : "NCA", 35270Sstevel@tonic-gate str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf, 35280Sstevel@tonic-gate sizeof (addrbuf)), ntohs(sin->sin_port)); 35290Sstevel@tonic-gate break; 35300Sstevel@tonic-gate case AF_UNIX: 35310Sstevel@tonic-gate len -= sizeof (soun->sun_family); 35320Sstevel@tonic-gate if (len >= 0) { 35330Sstevel@tonic-gate /* Null terminate */ 35340Sstevel@tonic-gate soun->sun_path[len] = NULL; 35350Sstevel@tonic-gate (void) printf("%s\tAF_UNIX %s = %s\n", pri->pname, 35360Sstevel@tonic-gate str, soun->sun_path); 35370Sstevel@tonic-gate } 35380Sstevel@tonic-gate break; 35390Sstevel@tonic-gate } 35400Sstevel@tonic-gate } 35410Sstevel@tonic-gate 35420Sstevel@tonic-gate void 35430Sstevel@tonic-gate show_msghdr(private_t *pri, long offset) 35440Sstevel@tonic-gate { 3545*328Sja97890 const lwpstatus_t *Lsp = pri->lwpstat; 3546*328Sja97890 int what = Lsp->pr_what; 3547*328Sja97890 int err = pri->Errno; 35480Sstevel@tonic-gate struct msghdr msg; 3549*328Sja97890 int showbuf = FALSE; 3550*328Sja97890 int i = pri->sys_args[0]+1; 3551*328Sja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35520Sstevel@tonic-gate 35530Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35540Sstevel@tonic-gate return; 3555*328Sja97890 35560Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 35570Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 35580Sstevel@tonic-gate (long)msg.msg_name, 0, (long)msg.msg_namelen); 3559*328Sja97890 3560*328Sja97890 /* 3561*328Sja97890 * Print the iovec if the syscall was successful and the fd is 3562*328Sja97890 * part of the set being traced. 3563*328Sja97890 */ 3564*328Sja97890 if ((what == SYS_recvmsg && !err && 3565*328Sja97890 prismember(&readfd, i)) || 3566*328Sja97890 (what == SYS_sendmsg && 3567*328Sja97890 prismember(&writefd, i))) 3568*328Sja97890 showbuf = TRUE; 3569*328Sja97890 3570*328Sja97890 show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 3571*328Sja97890 35720Sstevel@tonic-gate } 35730Sstevel@tonic-gate 35740Sstevel@tonic-gate #ifdef _LP64 35750Sstevel@tonic-gate void 35760Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset) 35770Sstevel@tonic-gate { 35780Sstevel@tonic-gate struct msghdr32 { 35790Sstevel@tonic-gate caddr32_t msg_name; 3580*328Sja97890 uint32_t msg_namelen; 3581*328Sja97890 caddr32_t msg_iov; 3582*328Sja97890 int32_t msg_iovlen; 35830Sstevel@tonic-gate } msg; 3584*328Sja97890 const lwpstatus_t *Lsp = pri->lwpstat; 3585*328Sja97890 int what = Lsp->pr_what; 3586*328Sja97890 int err = pri->Errno; 3587*328Sja97890 int showbuf = FALSE; 3588*328Sja97890 int i = pri->sys_args[0]+1; 3589*328Sja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35900Sstevel@tonic-gate 35910Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35920Sstevel@tonic-gate return; 3593*328Sja97890 35940Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 35950Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 35960Sstevel@tonic-gate (long)msg.msg_name, 0, (long)msg.msg_namelen); 3597*328Sja97890 /* 3598*328Sja97890 * Print the iovec if the syscall was successful and the fd is 3599*328Sja97890 * part of the set being traced. 3600*328Sja97890 */ 3601*328Sja97890 if ((what == SYS_recvmsg && !err && 3602*328Sja97890 prismember(&readfd, i)) || 3603*328Sja97890 (what == SYS_sendmsg && 3604*328Sja97890 prismember(&writefd, i))) 3605*328Sja97890 showbuf = TRUE; 3606*328Sja97890 3607*328Sja97890 show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 3608*328Sja97890 36090Sstevel@tonic-gate } 36100Sstevel@tonic-gate #endif /* _LP64 */ 36110Sstevel@tonic-gate 36120Sstevel@tonic-gate static void 36130Sstevel@tonic-gate show_doorargs(private_t *pri, long offset) 36140Sstevel@tonic-gate { 36150Sstevel@tonic-gate door_arg_t args; 36160Sstevel@tonic-gate 36170Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 36180Sstevel@tonic-gate (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n", 36190Sstevel@tonic-gate pri->pname, 36200Sstevel@tonic-gate (ulong_t)args.data_ptr, 36210Sstevel@tonic-gate (ulong_t)args.data_size); 36220Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n", 36230Sstevel@tonic-gate pri->pname, 36240Sstevel@tonic-gate (ulong_t)args.desc_ptr, 36250Sstevel@tonic-gate args.desc_num); 36260Sstevel@tonic-gate (void) printf("%s\trbuf=0x%lX rsize=%lu\n", 36270Sstevel@tonic-gate pri->pname, 36280Sstevel@tonic-gate (ulong_t)args.rbuf, 36290Sstevel@tonic-gate (ulong_t)args.rsize); 36300Sstevel@tonic-gate } 36310Sstevel@tonic-gate } 36320Sstevel@tonic-gate 36330Sstevel@tonic-gate static void 36340Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc) 36350Sstevel@tonic-gate { 36360Sstevel@tonic-gate int i = 0; 36370Sstevel@tonic-gate const priv_set_t *s; 36380Sstevel@tonic-gate priv_ptype_t sn; 36390Sstevel@tonic-gate char *str; 36400Sstevel@tonic-gate 36410Sstevel@tonic-gate while ((sn = priv_getsetbynum(i++)) != NULL) { 36420Sstevel@tonic-gate s = ucred_getprivset(uc, sn); 36430Sstevel@tonic-gate 36440Sstevel@tonic-gate if (s == NULL) 36450Sstevel@tonic-gate continue; 36460Sstevel@tonic-gate 36470Sstevel@tonic-gate (void) printf("%s\t%c: %s\n", 36480Sstevel@tonic-gate pri->pname, 36490Sstevel@tonic-gate *sn, 36500Sstevel@tonic-gate str = priv_set_to_str(s, ',', PRIV_STR_SHORT)); 36510Sstevel@tonic-gate 36520Sstevel@tonic-gate free(str); 36530Sstevel@tonic-gate } 36540Sstevel@tonic-gate } 36550Sstevel@tonic-gate 36560Sstevel@tonic-gate static void 36570Sstevel@tonic-gate show_ucred(private_t *pri, long offset) 36580Sstevel@tonic-gate { 36590Sstevel@tonic-gate ucred_t *uc = _ucred_alloc(); 36600Sstevel@tonic-gate size_t sz; 36610Sstevel@tonic-gate 36620Sstevel@tonic-gate if (uc == NULL) 36630Sstevel@tonic-gate return; 36640Sstevel@tonic-gate 36650Sstevel@tonic-gate sz = Pread(Proc, uc, uc->uc_size, offset); 36660Sstevel@tonic-gate 36670Sstevel@tonic-gate /* 36680Sstevel@tonic-gate * A new uc_size is read, it could be smaller than the previously 36690Sstevel@tonic-gate * value. We accept short reads that fill the whole header. 36700Sstevel@tonic-gate */ 36710Sstevel@tonic-gate if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) { 36720Sstevel@tonic-gate (void) printf("%s\teuid=%d egid=%d\n", 36730Sstevel@tonic-gate pri->pname, 36740Sstevel@tonic-gate (int)ucred_geteuid(uc), 36750Sstevel@tonic-gate (int)ucred_getegid(uc)); 36760Sstevel@tonic-gate (void) printf("%s\truid=%d rgid=%d\n", 36770Sstevel@tonic-gate pri->pname, 36780Sstevel@tonic-gate (int)ucred_getruid(uc), 36790Sstevel@tonic-gate (int)ucred_getrgid(uc)); 36800Sstevel@tonic-gate (void) printf("%s\tpid=%d zoneid=%d\n", 36810Sstevel@tonic-gate pri->pname, 36820Sstevel@tonic-gate (int)ucred_getpid(uc), 36830Sstevel@tonic-gate (int)ucred_getzoneid(uc)); 36840Sstevel@tonic-gate show_ucred_privsets(pri, uc); 36850Sstevel@tonic-gate } 36860Sstevel@tonic-gate ucred_free(uc); 36870Sstevel@tonic-gate } 36880Sstevel@tonic-gate 36890Sstevel@tonic-gate static void 36900Sstevel@tonic-gate show_privset(private_t *pri, long offset, size_t size) 36910Sstevel@tonic-gate { 36920Sstevel@tonic-gate priv_set_t *tmp = priv_allocset(); 36930Sstevel@tonic-gate size_t sz; 36940Sstevel@tonic-gate 36950Sstevel@tonic-gate if (tmp == NULL) 36960Sstevel@tonic-gate return; 36970Sstevel@tonic-gate 36980Sstevel@tonic-gate sz = Pread(Proc, tmp, size, offset); 36990Sstevel@tonic-gate 37000Sstevel@tonic-gate if (sz == size) { 37010Sstevel@tonic-gate char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT); 37020Sstevel@tonic-gate if (str != NULL) { 37030Sstevel@tonic-gate (void) printf("%s\t%s\n", pri->pname, str); 37040Sstevel@tonic-gate free(str); 37050Sstevel@tonic-gate } 37060Sstevel@tonic-gate } 37070Sstevel@tonic-gate priv_freeset(tmp); 37080Sstevel@tonic-gate } 37090Sstevel@tonic-gate 37100Sstevel@tonic-gate static void 37110Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset) 37120Sstevel@tonic-gate { 37130Sstevel@tonic-gate door_info_t info; 37140Sstevel@tonic-gate door_attr_t attr; 37150Sstevel@tonic-gate 37160Sstevel@tonic-gate if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info)) 37170Sstevel@tonic-gate return; 37180Sstevel@tonic-gate (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n", 37190Sstevel@tonic-gate pri->pname, 37200Sstevel@tonic-gate (int)info.di_target, 37210Sstevel@tonic-gate info.di_proc, 37220Sstevel@tonic-gate info.di_data); 37230Sstevel@tonic-gate attr = info.di_attributes; 37240Sstevel@tonic-gate (void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr)); 37250Sstevel@tonic-gate (void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier); 37260Sstevel@tonic-gate } 37270Sstevel@tonic-gate 37280Sstevel@tonic-gate static void 37290Sstevel@tonic-gate show_doorparam(private_t *pri, long offset) 37300Sstevel@tonic-gate { 37310Sstevel@tonic-gate ulong_t val; 37320Sstevel@tonic-gate 37330Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37340Sstevel@tonic-gate (void) printf("%s\tvalue=%lu\n", 37350Sstevel@tonic-gate pri->pname, 37360Sstevel@tonic-gate val); 37370Sstevel@tonic-gate } 37380Sstevel@tonic-gate } 37390Sstevel@tonic-gate 37400Sstevel@tonic-gate #ifdef _LP64 37410Sstevel@tonic-gate 37420Sstevel@tonic-gate static void 37430Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset) 37440Sstevel@tonic-gate { 37450Sstevel@tonic-gate struct door_arg32 args; 37460Sstevel@tonic-gate 37470Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 37480Sstevel@tonic-gate (void) printf("%s\tdata_ptr=%X data_size=%u\n", 37490Sstevel@tonic-gate pri->pname, 37500Sstevel@tonic-gate args.data_ptr, 37510Sstevel@tonic-gate args.data_size); 37520Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n", 37530Sstevel@tonic-gate pri->pname, 37540Sstevel@tonic-gate args.desc_ptr, 37550Sstevel@tonic-gate args.desc_num); 37560Sstevel@tonic-gate (void) printf("%s\trbuf=0x%X rsize=%u\n", 37570Sstevel@tonic-gate pri->pname, 37580Sstevel@tonic-gate args.rbuf, 37590Sstevel@tonic-gate args.rsize); 37600Sstevel@tonic-gate } 37610Sstevel@tonic-gate } 37620Sstevel@tonic-gate 37630Sstevel@tonic-gate static void 37640Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset) 37650Sstevel@tonic-gate { 37660Sstevel@tonic-gate uint_t val; 37670Sstevel@tonic-gate 37680Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37690Sstevel@tonic-gate (void) printf("%s\tvalue=%u\n", 37700Sstevel@tonic-gate pri->pname, 37710Sstevel@tonic-gate val); 37720Sstevel@tonic-gate } 37730Sstevel@tonic-gate } 37740Sstevel@tonic-gate 37750Sstevel@tonic-gate #endif /* _LP64 */ 37760Sstevel@tonic-gate 37770Sstevel@tonic-gate static void 37780Sstevel@tonic-gate show_doors(private_t *pri) 37790Sstevel@tonic-gate { 37800Sstevel@tonic-gate switch (pri->sys_args[5]) { 37810Sstevel@tonic-gate case DOOR_CALL: 37820Sstevel@tonic-gate #ifdef _LP64 37830Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 37840Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37850Sstevel@tonic-gate else 37860Sstevel@tonic-gate show_doorargs32(pri, (long)pri->sys_args[1]); 37870Sstevel@tonic-gate #else 37880Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37890Sstevel@tonic-gate #endif 37900Sstevel@tonic-gate break; 37910Sstevel@tonic-gate case DOOR_UCRED: 37920Sstevel@tonic-gate if (!pri->Errno) 37930Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[0]); 37940Sstevel@tonic-gate break; 37950Sstevel@tonic-gate case DOOR_INFO: 37960Sstevel@tonic-gate if (!pri->Errno) 37970Sstevel@tonic-gate show_doorinfo(pri, (long)pri->sys_args[1]); 37980Sstevel@tonic-gate break; 37990Sstevel@tonic-gate case DOOR_GETPARAM: 38000Sstevel@tonic-gate if (!pri->Errno) { 38010Sstevel@tonic-gate #ifdef _LP64 38020Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 38030Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 38040Sstevel@tonic-gate else 38050Sstevel@tonic-gate show_doorparam32(pri, (long)pri->sys_args[2]); 38060Sstevel@tonic-gate #else 38070Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 38080Sstevel@tonic-gate #endif 38090Sstevel@tonic-gate } 38100Sstevel@tonic-gate break; 38110Sstevel@tonic-gate } 38120Sstevel@tonic-gate } 38130Sstevel@tonic-gate 38140Sstevel@tonic-gate static void 38150Sstevel@tonic-gate show_portargs(private_t *pri, long offset) 38160Sstevel@tonic-gate { 38170Sstevel@tonic-gate port_event_t args; 38180Sstevel@tonic-gate 38190Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38200Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38210Sstevel@tonic-gate pri->pname, 38220Sstevel@tonic-gate args.portev_events, 38230Sstevel@tonic-gate args.portev_source); 38240Sstevel@tonic-gate (void) printf("%s\tobject=0x%p user=0x%p\n", 38250Sstevel@tonic-gate pri->pname, 38260Sstevel@tonic-gate (void *)args.portev_object, 38270Sstevel@tonic-gate (void *)args.portev_user); 38280Sstevel@tonic-gate } 38290Sstevel@tonic-gate } 38300Sstevel@tonic-gate 38310Sstevel@tonic-gate 38320Sstevel@tonic-gate #ifdef _LP64 38330Sstevel@tonic-gate 38340Sstevel@tonic-gate static void 38350Sstevel@tonic-gate show_portargs32(private_t *pri, long offset) 38360Sstevel@tonic-gate { 38370Sstevel@tonic-gate port_event32_t args; 38380Sstevel@tonic-gate 38390Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38400Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38410Sstevel@tonic-gate pri->pname, 38420Sstevel@tonic-gate args.portev_events, 38430Sstevel@tonic-gate args.portev_source); 38440Sstevel@tonic-gate (void) printf("%s\tobject=0x%x user=0x%x\n", 38450Sstevel@tonic-gate pri->pname, 38460Sstevel@tonic-gate args.portev_object, 38470Sstevel@tonic-gate args.portev_user); 38480Sstevel@tonic-gate } 38490Sstevel@tonic-gate } 38500Sstevel@tonic-gate 38510Sstevel@tonic-gate #endif /* _LP64 */ 38520Sstevel@tonic-gate 38530Sstevel@tonic-gate static void 38540Sstevel@tonic-gate show_ports(private_t *pri) 38550Sstevel@tonic-gate { 38560Sstevel@tonic-gate switch (pri->sys_args[0]) { 38570Sstevel@tonic-gate case PORT_GET: 38580Sstevel@tonic-gate #ifdef _LP64 38590Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 38600Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38610Sstevel@tonic-gate else 38620Sstevel@tonic-gate show_portargs32(pri, (long)pri->sys_args[2]); 38630Sstevel@tonic-gate #else 38640Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38650Sstevel@tonic-gate #endif 38660Sstevel@tonic-gate break; 38670Sstevel@tonic-gate } 38680Sstevel@tonic-gate } 38690Sstevel@tonic-gate 38700Sstevel@tonic-gate #define MAX_SNDFL_PRD 16 38710Sstevel@tonic-gate 38720Sstevel@tonic-gate #ifdef _LP64 38730Sstevel@tonic-gate 38740Sstevel@tonic-gate static void 38750Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd, 38760Sstevel@tonic-gate ksendfilevec32_t *sndvec, int sfvcnt) 38770Sstevel@tonic-gate { 38780Sstevel@tonic-gate ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD]; 38790Sstevel@tonic-gate size_t cpy_rqst; 38800Sstevel@tonic-gate 38810Sstevel@tonic-gate Eserialize(); 38820Sstevel@tonic-gate while (sfvcnt > 0) { 38830Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 38840Sstevel@tonic-gate sfvcnt -= cpy_rqst; 38850Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 38860Sstevel@tonic-gate 38870Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 38880Sstevel@tonic-gate break; 38890Sstevel@tonic-gate 38900Sstevel@tonic-gate snd_ptr = &snd[0]; 38910Sstevel@tonic-gate 38920Sstevel@tonic-gate while (cpy_rqst) { 38930Sstevel@tonic-gate (void) printf( 38940Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 38950Sstevel@tonic-gate "sfv_off=%d\tsfv_len=%u\n", 38960Sstevel@tonic-gate snd_ptr->sfv_fd, 38970Sstevel@tonic-gate snd_ptr->sfv_flag, 38980Sstevel@tonic-gate snd_ptr->sfv_off, 38990Sstevel@tonic-gate snd_ptr->sfv_len); 39000Sstevel@tonic-gate 39010Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39020Sstevel@tonic-gate prismember(&writefd, fd)) { 39030Sstevel@tonic-gate showbuffer(pri, 39040Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 39050Sstevel@tonic-gate (long)snd_ptr->sfv_len); 39060Sstevel@tonic-gate } 39070Sstevel@tonic-gate 39080Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39090Sstevel@tonic-gate snd_ptr++; 39100Sstevel@tonic-gate } 39110Sstevel@tonic-gate 39120Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39130Sstevel@tonic-gate } 39140Sstevel@tonic-gate Xserialize(); 39150Sstevel@tonic-gate } 39160Sstevel@tonic-gate 39170Sstevel@tonic-gate static void 39180Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd, 39190Sstevel@tonic-gate ksendfilevec64_t *sndvec, int sfvcnt) 39200Sstevel@tonic-gate { 39210Sstevel@tonic-gate ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39220Sstevel@tonic-gate size_t cpy_rqst; 39230Sstevel@tonic-gate 39240Sstevel@tonic-gate Eserialize(); 39250Sstevel@tonic-gate while (sfvcnt > 0) { 39260Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39270Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39280Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39290Sstevel@tonic-gate 39300Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39310Sstevel@tonic-gate break; 39320Sstevel@tonic-gate 39330Sstevel@tonic-gate snd_ptr = &snd[0]; 39340Sstevel@tonic-gate 39350Sstevel@tonic-gate while (cpy_rqst) { 39360Sstevel@tonic-gate (void) printf( 39370Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39380Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%u\n", 39390Sstevel@tonic-gate snd_ptr->sfv_fd, 39400Sstevel@tonic-gate snd_ptr->sfv_flag, 39410Sstevel@tonic-gate snd_ptr->sfv_off, 39420Sstevel@tonic-gate snd_ptr->sfv_len); 39430Sstevel@tonic-gate 39440Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39450Sstevel@tonic-gate prismember(&writefd, fd)) { 39460Sstevel@tonic-gate showbuffer(pri, 39470Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 39480Sstevel@tonic-gate (long)snd_ptr->sfv_len); 39490Sstevel@tonic-gate } 39500Sstevel@tonic-gate 39510Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39520Sstevel@tonic-gate snd_ptr++; 39530Sstevel@tonic-gate } 39540Sstevel@tonic-gate 39550Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39560Sstevel@tonic-gate } 39570Sstevel@tonic-gate Xserialize(); 39580Sstevel@tonic-gate } 39590Sstevel@tonic-gate 39600Sstevel@tonic-gate #endif /* _LP64 */ 39610Sstevel@tonic-gate 39620Sstevel@tonic-gate /*ARGSUSED*/ 39630Sstevel@tonic-gate static void 39640Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt) 39650Sstevel@tonic-gate { 39660Sstevel@tonic-gate sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39670Sstevel@tonic-gate size_t cpy_rqst; 39680Sstevel@tonic-gate 39690Sstevel@tonic-gate #ifdef _LP64 39700Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 39710Sstevel@tonic-gate show_ksendfilevec32(pri, fd, 39720Sstevel@tonic-gate (ksendfilevec32_t *)sndvec, sfvcnt); 39730Sstevel@tonic-gate return; 39740Sstevel@tonic-gate } 39750Sstevel@tonic-gate #endif 39760Sstevel@tonic-gate Eserialize(); 39770Sstevel@tonic-gate while (sfvcnt > 0) { 39780Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39790Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39800Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39810Sstevel@tonic-gate 39820Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39830Sstevel@tonic-gate break; 39840Sstevel@tonic-gate 39850Sstevel@tonic-gate snd_ptr = &snd[0]; 39860Sstevel@tonic-gate 39870Sstevel@tonic-gate while (cpy_rqst) { 39880Sstevel@tonic-gate (void) printf( 39890Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39900Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 39910Sstevel@tonic-gate snd_ptr->sfv_fd, 39920Sstevel@tonic-gate snd_ptr->sfv_flag, 39930Sstevel@tonic-gate snd_ptr->sfv_off, 39940Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 39950Sstevel@tonic-gate 39960Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39970Sstevel@tonic-gate prismember(&writefd, fd)) { 39980Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 39990Sstevel@tonic-gate (long)snd_ptr->sfv_len); 40000Sstevel@tonic-gate } 40010Sstevel@tonic-gate 40020Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 40030Sstevel@tonic-gate snd_ptr++; 40040Sstevel@tonic-gate } 40050Sstevel@tonic-gate 40060Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 40070Sstevel@tonic-gate } 40080Sstevel@tonic-gate Xserialize(); 40090Sstevel@tonic-gate } 40100Sstevel@tonic-gate 40110Sstevel@tonic-gate /*ARGSUSED*/ 40120Sstevel@tonic-gate static void 40130Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt) 40140Sstevel@tonic-gate { 40150Sstevel@tonic-gate sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 40160Sstevel@tonic-gate size_t cpy_rqst; 40170Sstevel@tonic-gate 40180Sstevel@tonic-gate #ifdef _LP64 40190Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 40200Sstevel@tonic-gate show_ksendfilevec64(pri, fd, 40210Sstevel@tonic-gate (ksendfilevec64_t *)sndvec, sfvcnt); 40220Sstevel@tonic-gate return; 40230Sstevel@tonic-gate } 40240Sstevel@tonic-gate #endif 40250Sstevel@tonic-gate 40260Sstevel@tonic-gate Eserialize(); 40270Sstevel@tonic-gate while (sfvcnt > 0) { 40280Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 40290Sstevel@tonic-gate sfvcnt -= cpy_rqst; 40300Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 40310Sstevel@tonic-gate 40320Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 40330Sstevel@tonic-gate break; 40340Sstevel@tonic-gate 40350Sstevel@tonic-gate snd_ptr = &snd[0]; 40360Sstevel@tonic-gate 40370Sstevel@tonic-gate while (cpy_rqst) { 40380Sstevel@tonic-gate (void) printf( 40390Sstevel@tonic-gate #ifdef _LP64 40400Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40410Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 40420Sstevel@tonic-gate #else 40430Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40440Sstevel@tonic-gate "sfv_off=%lld\tsfv_len=%lu\n", 40450Sstevel@tonic-gate #endif 40460Sstevel@tonic-gate snd_ptr->sfv_fd, 40470Sstevel@tonic-gate snd_ptr->sfv_flag, 40480Sstevel@tonic-gate snd_ptr->sfv_off, 40490Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 40500Sstevel@tonic-gate 40510Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 40520Sstevel@tonic-gate prismember(&writefd, fd)) { 40530Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 40540Sstevel@tonic-gate (long)snd_ptr->sfv_len); 40550Sstevel@tonic-gate } 40560Sstevel@tonic-gate 40570Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 40580Sstevel@tonic-gate snd_ptr++; 40590Sstevel@tonic-gate } 40600Sstevel@tonic-gate 40610Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 40620Sstevel@tonic-gate } 40630Sstevel@tonic-gate Xserialize(); 40640Sstevel@tonic-gate } 40650Sstevel@tonic-gate 40660Sstevel@tonic-gate static void 40670Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset) 40680Sstevel@tonic-gate { 40690Sstevel@tonic-gate struct memcntl_mha mha; 40700Sstevel@tonic-gate const char *s = NULL; 40710Sstevel@tonic-gate 40720Sstevel@tonic-gate if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) { 40730Sstevel@tonic-gate switch (mha.mha_cmd) { 40740Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 40750Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 40760Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 40770Sstevel@tonic-gate } 40780Sstevel@tonic-gate if (s) 40790Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 40800Sstevel@tonic-gate " mha_pagesize=%lu\n", 40810Sstevel@tonic-gate pri->pname, s, mha.mha_flags, 40820Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40830Sstevel@tonic-gate else 40840Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 40850Sstevel@tonic-gate " mha_pagesize=%lu\n", 40860Sstevel@tonic-gate pri->pname, mha.mha_cmd, mha.mha_flags, 40870Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40880Sstevel@tonic-gate } 40890Sstevel@tonic-gate } 40900Sstevel@tonic-gate 40910Sstevel@tonic-gate #ifdef _LP64 40920Sstevel@tonic-gate 40930Sstevel@tonic-gate static void 40940Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset) 40950Sstevel@tonic-gate { 40960Sstevel@tonic-gate struct memcntl_mha32 mha32; 40970Sstevel@tonic-gate const char *s = NULL; 40980Sstevel@tonic-gate 40990Sstevel@tonic-gate if (Pread(Proc, &mha32, sizeof (mha32), offset) == 41000Sstevel@tonic-gate sizeof (mha32)) { 41010Sstevel@tonic-gate switch (mha32.mha_cmd) { 41020Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 41030Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 41040Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 41050Sstevel@tonic-gate } 41060Sstevel@tonic-gate if (s) 41070Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 41080Sstevel@tonic-gate " mha_pagesize=%u\n", 41090Sstevel@tonic-gate pri->pname, s, mha32.mha_flags, mha32.mha_pagesize); 41100Sstevel@tonic-gate else 41110Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 41120Sstevel@tonic-gate " mha_pagesize=%u\n", 41130Sstevel@tonic-gate pri->pname, mha32.mha_cmd, mha32.mha_flags, 41140Sstevel@tonic-gate mha32.mha_pagesize); 41150Sstevel@tonic-gate } 41160Sstevel@tonic-gate } 41170Sstevel@tonic-gate 41180Sstevel@tonic-gate #endif /* _LP64 */ 41190Sstevel@tonic-gate 41200Sstevel@tonic-gate static void 41210Sstevel@tonic-gate show_memcntl(private_t *pri) 41220Sstevel@tonic-gate { 41230Sstevel@tonic-gate 41240Sstevel@tonic-gate if ((int)pri->sys_args[2] != MC_HAT_ADVISE) 41250Sstevel@tonic-gate return; 41260Sstevel@tonic-gate #ifdef _LP64 41270Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 41280Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41290Sstevel@tonic-gate else 41300Sstevel@tonic-gate show_memcntl_mha32(pri, (long)pri->sys_args[3]); 41310Sstevel@tonic-gate #else 41320Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41330Sstevel@tonic-gate #endif 41340Sstevel@tonic-gate } 41350Sstevel@tonic-gate 41360Sstevel@tonic-gate void 41370Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count) 41380Sstevel@tonic-gate { 41390Sstevel@tonic-gate id_t buf[MYBUFSIZ / sizeof (id_t)]; 41400Sstevel@tonic-gate id_t *idp; 41410Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 48); 41420Sstevel@tonic-gate 41430Sstevel@tonic-gate if (offset == NULL) 41440Sstevel@tonic-gate return; 41450Sstevel@tonic-gate 41460Sstevel@tonic-gate /* enter region of lengthy output */ 41470Sstevel@tonic-gate if (serial) 41480Sstevel@tonic-gate Eserialize(); 41490Sstevel@tonic-gate 41500Sstevel@tonic-gate while (count > 0 && !interrupt) { 41510Sstevel@tonic-gate ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)? 41520Sstevel@tonic-gate count * sizeof (id_t) : MYBUFSIZ; 41530Sstevel@tonic-gate 41540Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 || 41550Sstevel@tonic-gate nb < sizeof (id_t)) 41560Sstevel@tonic-gate break; 41570Sstevel@tonic-gate 41580Sstevel@tonic-gate idp = buf; 41590Sstevel@tonic-gate while (!interrupt && nb >= sizeof (id_t)) { 41600Sstevel@tonic-gate (void) printf("%s\t%8d\n", pri->pname, (int)*idp); 41610Sstevel@tonic-gate offset += sizeof (id_t); 41620Sstevel@tonic-gate nb -= sizeof (id_t); 41630Sstevel@tonic-gate idp++; 41640Sstevel@tonic-gate count--; 41650Sstevel@tonic-gate } 41660Sstevel@tonic-gate } 41670Sstevel@tonic-gate 41680Sstevel@tonic-gate /* exit region of lengthy output */ 41690Sstevel@tonic-gate if (serial) 41700Sstevel@tonic-gate Xserialize(); 41710Sstevel@tonic-gate } 41720Sstevel@tonic-gate 41730Sstevel@tonic-gate void 41740Sstevel@tonic-gate show_ntp_gettime(private_t *pri) 41750Sstevel@tonic-gate { 41760Sstevel@tonic-gate struct ntptimeval ntv; 41770Sstevel@tonic-gate long offset; 41780Sstevel@tonic-gate 41790Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 41800Sstevel@tonic-gate return; 41810Sstevel@tonic-gate 41820Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 41830Sstevel@tonic-gate if (Pread(Proc, &ntv, sizeof (ntv), offset) 41840Sstevel@tonic-gate != sizeof (ntv)) 41850Sstevel@tonic-gate return; 41860Sstevel@tonic-gate } else { 41870Sstevel@tonic-gate struct ntptimeval32 ntv32; 41880Sstevel@tonic-gate 41890Sstevel@tonic-gate if (Pread(Proc, &ntv32, sizeof (ntv32), offset) 41900Sstevel@tonic-gate != sizeof (ntv32)) 41910Sstevel@tonic-gate return; 41920Sstevel@tonic-gate 41930Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time); 41940Sstevel@tonic-gate ntv.maxerror = ntv32.maxerror; 41950Sstevel@tonic-gate ntv.esterror = ntv32.esterror; 41960Sstevel@tonic-gate } 41970Sstevel@tonic-gate 41980Sstevel@tonic-gate (void) printf("\ttime: %ld.%6.6ld sec\n", 41990Sstevel@tonic-gate ntv.time.tv_sec, ntv.time.tv_usec); 42000Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", ntv.maxerror); 42010Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", ntv.esterror); 42020Sstevel@tonic-gate } 42030Sstevel@tonic-gate 42040Sstevel@tonic-gate static char * 42050Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val) 42060Sstevel@tonic-gate { 42070Sstevel@tonic-gate char *str = pri->code_buf; 42080Sstevel@tonic-gate size_t used = 0; 42090Sstevel@tonic-gate 42100Sstevel@tonic-gate *str = '\0'; 42110Sstevel@tonic-gate if (val & MOD_OFFSET) 42120Sstevel@tonic-gate used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf)); 42130Sstevel@tonic-gate if (val & MOD_FREQUENCY) 42140Sstevel@tonic-gate used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf)); 42150Sstevel@tonic-gate if (val & MOD_MAXERROR) 42160Sstevel@tonic-gate used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf)); 42170Sstevel@tonic-gate if (val & MOD_ESTERROR) 42180Sstevel@tonic-gate used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf)); 42190Sstevel@tonic-gate if (val & MOD_STATUS) 42200Sstevel@tonic-gate used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf)); 42210Sstevel@tonic-gate if (val & MOD_TIMECONST) 42220Sstevel@tonic-gate used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf)); 42230Sstevel@tonic-gate if (val & MOD_CLKB) 42240Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf)); 42250Sstevel@tonic-gate if (val & MOD_CLKA) 42260Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf)); 42270Sstevel@tonic-gate 42280Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42290Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42300Sstevel@tonic-gate 42310Sstevel@tonic-gate return (str + 1); 42320Sstevel@tonic-gate } 42330Sstevel@tonic-gate 42340Sstevel@tonic-gate static char * 42350Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val) 42360Sstevel@tonic-gate { 42370Sstevel@tonic-gate char *str = pri->code_buf; 42380Sstevel@tonic-gate size_t used = 0; 42390Sstevel@tonic-gate 42400Sstevel@tonic-gate *str = '\0'; 42410Sstevel@tonic-gate if (val & STA_PLL) 42420Sstevel@tonic-gate used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf)); 42430Sstevel@tonic-gate if (val & STA_PPSFREQ) 42440Sstevel@tonic-gate used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf)); 42450Sstevel@tonic-gate if (val & STA_PPSTIME) 42460Sstevel@tonic-gate used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf)); 42470Sstevel@tonic-gate if (val & STA_FLL) 42480Sstevel@tonic-gate used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf)); 42490Sstevel@tonic-gate 42500Sstevel@tonic-gate if (val & STA_INS) 42510Sstevel@tonic-gate used = strlcat(str, "|STA_INS", sizeof (pri->code_buf)); 42520Sstevel@tonic-gate if (val & STA_DEL) 42530Sstevel@tonic-gate used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf)); 42540Sstevel@tonic-gate if (val & STA_UNSYNC) 42550Sstevel@tonic-gate used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf)); 42560Sstevel@tonic-gate if (val & STA_FREQHOLD) 42570Sstevel@tonic-gate used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf)); 42580Sstevel@tonic-gate 42590Sstevel@tonic-gate if (val & STA_PPSSIGNAL) 42600Sstevel@tonic-gate used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf)); 42610Sstevel@tonic-gate if (val & STA_PPSJITTER) 42620Sstevel@tonic-gate used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf)); 42630Sstevel@tonic-gate if (val & STA_PPSWANDER) 42640Sstevel@tonic-gate used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf)); 42650Sstevel@tonic-gate if (val & STA_PPSERROR) 42660Sstevel@tonic-gate used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf)); 42670Sstevel@tonic-gate 42680Sstevel@tonic-gate if (val & STA_CLOCKERR) 42690Sstevel@tonic-gate used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf)); 42700Sstevel@tonic-gate 42710Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42720Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42730Sstevel@tonic-gate 42740Sstevel@tonic-gate return (str + 1); 42750Sstevel@tonic-gate } 42760Sstevel@tonic-gate 42770Sstevel@tonic-gate void 42780Sstevel@tonic-gate show_ntp_adjtime(private_t *pri) 42790Sstevel@tonic-gate { 42800Sstevel@tonic-gate struct timex timex; 42810Sstevel@tonic-gate long offset; 42820Sstevel@tonic-gate 42830Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 42840Sstevel@tonic-gate return; 42850Sstevel@tonic-gate 42860Sstevel@tonic-gate if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex)) 42870Sstevel@tonic-gate return; 42880Sstevel@tonic-gate 42890Sstevel@tonic-gate (void) printf("\tmodes: %s\n", get_timex_modes(pri, timex.modes)); 42900Sstevel@tonic-gate (void) printf("\toffset: %11d usec\n", timex.offset); 42910Sstevel@tonic-gate (void) printf("\tfreq: %11d scaled ppm\n", timex.freq); 42920Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", timex.maxerror); 42930Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", timex.esterror); 42940Sstevel@tonic-gate (void) printf("\tstatus: %s\n", get_timex_status(pri, timex.status)); 42950Sstevel@tonic-gate (void) printf("\tconstant: %11d\n", timex.constant); 42960Sstevel@tonic-gate (void) printf("\tprecision: %11d usec\n", timex.precision); 42970Sstevel@tonic-gate (void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance); 42980Sstevel@tonic-gate (void) printf("\tppsfreq: %11d scaled ppm\n", timex.ppsfreq); 42990Sstevel@tonic-gate (void) printf("\tjitter: %11d usec\n", timex.jitter); 43000Sstevel@tonic-gate (void) printf("\tshift: %11d sec\n", timex.shift); 43010Sstevel@tonic-gate (void) printf("\tstabil: %11d scaled ppm\n", timex.stabil); 43020Sstevel@tonic-gate (void) printf("\tjitcnt: %11d\n", timex.jitcnt); 43030Sstevel@tonic-gate (void) printf("\tcalcnt: %11d\n", timex.calcnt); 43040Sstevel@tonic-gate (void) printf("\terrcnt: %11d\n", timex.errcnt); 43050Sstevel@tonic-gate (void) printf("\tstbcnt: %11d\n", timex.stbcnt); 43060Sstevel@tonic-gate } 43070Sstevel@tonic-gate 43080Sstevel@tonic-gate void 43090Sstevel@tonic-gate show_getrusage(long offset) 43100Sstevel@tonic-gate { 43110Sstevel@tonic-gate struct rusage r; 43120Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43130Sstevel@tonic-gate return; 43140Sstevel@tonic-gate (void) printf("\t user time: %ld.%6.6ld sec\n", 43150Sstevel@tonic-gate r.ru_utime.tv_sec, 43160Sstevel@tonic-gate r.ru_utime.tv_usec); 43170Sstevel@tonic-gate (void) printf("\t system time: %ld.%6.6ld sec\n", 43180Sstevel@tonic-gate r.ru_stime.tv_sec, 43190Sstevel@tonic-gate r.ru_stime.tv_usec); 43200Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %ld\n", 43210Sstevel@tonic-gate r.ru_maxrss); 43220Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %ld\n", 43230Sstevel@tonic-gate r.ru_ixrss); 43240Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %ld\n", 43250Sstevel@tonic-gate r.ru_idrss); 43260Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %ld\n", 43270Sstevel@tonic-gate r.ru_isrss); 43280Sstevel@tonic-gate (void) printf("\t minor faults: %ld\n", 43290Sstevel@tonic-gate r.ru_minflt); 43300Sstevel@tonic-gate (void) printf("\t major faults: %ld\n", 43310Sstevel@tonic-gate r.ru_majflt); 43320Sstevel@tonic-gate (void) printf("\t # of swaps: %ld\n", 43330Sstevel@tonic-gate r.ru_nswap); 43340Sstevel@tonic-gate (void) printf("\t blocked inputs: %ld\n", 43350Sstevel@tonic-gate r.ru_inblock); 43360Sstevel@tonic-gate (void) printf("\t blocked outputs: %ld\n", 43370Sstevel@tonic-gate r.ru_oublock); 43380Sstevel@tonic-gate (void) printf("\t msgs sent: %ld\n", 43390Sstevel@tonic-gate r.ru_msgsnd); 43400Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %ld\n", 43410Sstevel@tonic-gate r.ru_msgrcv); 43420Sstevel@tonic-gate (void) printf("\t signals rcv'd: %ld\n", 43430Sstevel@tonic-gate r.ru_nsignals); 43440Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %ld\n", 43450Sstevel@tonic-gate r.ru_nvcsw); 43460Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %ld\n", 43470Sstevel@tonic-gate r.ru_nivcsw); 43480Sstevel@tonic-gate } 43490Sstevel@tonic-gate 43500Sstevel@tonic-gate #ifdef _LP64 43510Sstevel@tonic-gate void 43520Sstevel@tonic-gate show_getrusage32(long offset) 43530Sstevel@tonic-gate { 43540Sstevel@tonic-gate struct rusage32 r; 43550Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43560Sstevel@tonic-gate return; 43570Sstevel@tonic-gate (void) printf("\t user time: %d.%6.6d sec\n", 43580Sstevel@tonic-gate r.ru_utime.tv_sec, 43590Sstevel@tonic-gate r.ru_utime.tv_usec); 43600Sstevel@tonic-gate (void) printf("\t system time: %d.%6.6d sec\n", 43610Sstevel@tonic-gate r.ru_stime.tv_sec, 43620Sstevel@tonic-gate r.ru_stime.tv_usec); 43630Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %d\n", 43640Sstevel@tonic-gate r.ru_maxrss); 43650Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %d\n", 43660Sstevel@tonic-gate r.ru_ixrss); 43670Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %d\n", 43680Sstevel@tonic-gate r.ru_idrss); 43690Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %d\n", 43700Sstevel@tonic-gate r.ru_isrss); 43710Sstevel@tonic-gate (void) printf("\t minor faults: %d\n", 43720Sstevel@tonic-gate r.ru_minflt); 43730Sstevel@tonic-gate (void) printf("\t major faults: %d\n", 43740Sstevel@tonic-gate r.ru_majflt); 43750Sstevel@tonic-gate (void) printf("\t # of swaps: %d\n", 43760Sstevel@tonic-gate r.ru_nswap); 43770Sstevel@tonic-gate (void) printf("\t blocked inputs: %d\n", 43780Sstevel@tonic-gate r.ru_inblock); 43790Sstevel@tonic-gate (void) printf("\t blocked outputs: %d\n", 43800Sstevel@tonic-gate r.ru_oublock); 43810Sstevel@tonic-gate (void) printf("\t msgs sent: %d\n", 43820Sstevel@tonic-gate r.ru_msgsnd); 43830Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %d\n", 43840Sstevel@tonic-gate r.ru_msgrcv); 43850Sstevel@tonic-gate (void) printf("\t signals rcv'd: %d\n", 43860Sstevel@tonic-gate r.ru_nsignals); 43870Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %d\n", 43880Sstevel@tonic-gate r.ru_nvcsw); 43890Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %d\n", 43900Sstevel@tonic-gate r.ru_nivcsw); 43910Sstevel@tonic-gate } 43920Sstevel@tonic-gate #endif 43930Sstevel@tonic-gate 43940Sstevel@tonic-gate /* expound verbosely upon syscall arguments */ 43950Sstevel@tonic-gate /*ARGSUSED*/ 43960Sstevel@tonic-gate void 43970Sstevel@tonic-gate expound(private_t *pri, long r0, int raw) 43980Sstevel@tonic-gate { 43990Sstevel@tonic-gate const lwpstatus_t *Lsp = pri->lwpstat; 44000Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 44010Sstevel@tonic-gate int what = Lsp->pr_what; 44020Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 44030Sstevel@tonic-gate /* for a failed system call */ 44040Sstevel@tonic-gate #ifndef _LP64 44050Sstevel@tonic-gate /* We are a 32-bit truss; we can't grok a 64-bit process */ 44060Sstevel@tonic-gate if (lp64) 44070Sstevel@tonic-gate return; 44080Sstevel@tonic-gate #endif 44090Sstevel@tonic-gate /* for reporting sleeping system calls */ 44100Sstevel@tonic-gate if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP))) 44110Sstevel@tonic-gate what = Lsp->pr_syscall; 44120Sstevel@tonic-gate 44130Sstevel@tonic-gate switch (what) { 44140Sstevel@tonic-gate case SYS_utime: 44150Sstevel@tonic-gate show_utime(pri); 44160Sstevel@tonic-gate break; 44170Sstevel@tonic-gate case SYS_utimes: 44180Sstevel@tonic-gate show_utimes(pri); 44190Sstevel@tonic-gate break; 44200Sstevel@tonic-gate case SYS_gettimeofday: 44210Sstevel@tonic-gate if (!err) 44220Sstevel@tonic-gate show_timeofday(pri); 44230Sstevel@tonic-gate break; 44240Sstevel@tonic-gate case SYS_getitimer: 44250Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 44260Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 44270Sstevel@tonic-gate " value"); 44280Sstevel@tonic-gate break; 44290Sstevel@tonic-gate case SYS_setitimer: 44300Sstevel@tonic-gate if (pri->sys_nargs > 1) 44310Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 44320Sstevel@tonic-gate " value"); 44330Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 44340Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[2], 44350Sstevel@tonic-gate "ovalue"); 44360Sstevel@tonic-gate break; 44370Sstevel@tonic-gate case SYS_stime: 44380Sstevel@tonic-gate show_stime(pri); 44390Sstevel@tonic-gate break; 44400Sstevel@tonic-gate case SYS_times: 44410Sstevel@tonic-gate if (!err) 44420Sstevel@tonic-gate show_times(pri); 44430Sstevel@tonic-gate break; 44440Sstevel@tonic-gate case SYS_utssys: 44450Sstevel@tonic-gate if (err) 44460Sstevel@tonic-gate break; 44470Sstevel@tonic-gate #ifdef _LP64 44480Sstevel@tonic-gate if (lp64) 44490Sstevel@tonic-gate show_utssys(pri, r0); 44500Sstevel@tonic-gate else 44510Sstevel@tonic-gate show_utssys32(pri, r0); 44520Sstevel@tonic-gate #else 44530Sstevel@tonic-gate show_utssys(pri, r0); 44540Sstevel@tonic-gate #endif 44550Sstevel@tonic-gate break; 44560Sstevel@tonic-gate case SYS_ioctl: 44570Sstevel@tonic-gate if (pri->sys_nargs >= 3) /* each case must decide for itself */ 44580Sstevel@tonic-gate show_ioctl(pri, pri->sys_args[1], 44590Sstevel@tonic-gate (long)pri->sys_args[2]); 44600Sstevel@tonic-gate break; 44610Sstevel@tonic-gate case SYS_stat: 44620Sstevel@tonic-gate case SYS_fstat: 44630Sstevel@tonic-gate case SYS_lstat: 44640Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 44650Sstevel@tonic-gate show_stat(pri, (long)pri->sys_args[1]); 44660Sstevel@tonic-gate break; 44670Sstevel@tonic-gate case SYS_stat64: 44680Sstevel@tonic-gate case SYS_fstat64: 44690Sstevel@tonic-gate case SYS_lstat64: 44700Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 44710Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[1]); 44720Sstevel@tonic-gate break; 44730Sstevel@tonic-gate case SYS_fsat: 44740Sstevel@tonic-gate /* 44750Sstevel@tonic-gate * subcodes for fstatat() and fstatat64(). 44760Sstevel@tonic-gate */ 44770Sstevel@tonic-gate if (!err && pri->sys_nargs >= 4) { 44780Sstevel@tonic-gate if (pri->sys_args[0] == 3) 44790Sstevel@tonic-gate show_statat(pri, (long)pri->sys_args[3]); 44800Sstevel@tonic-gate else if (pri->sys_args[0] == 2) 44810Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[3]); 44820Sstevel@tonic-gate } 44830Sstevel@tonic-gate break; 44840Sstevel@tonic-gate case SYS_xstat: 44850Sstevel@tonic-gate case SYS_fxstat: 44860Sstevel@tonic-gate case SYS_lxstat: 44870Sstevel@tonic-gate if (!err && pri->sys_nargs >= 3) 44880Sstevel@tonic-gate show_xstat(pri, (int)pri->sys_args[0], 44890Sstevel@tonic-gate (long)pri->sys_args[2]); 44900Sstevel@tonic-gate break; 44910Sstevel@tonic-gate case SYS_statvfs: 44920Sstevel@tonic-gate case SYS_fstatvfs: 44930Sstevel@tonic-gate if (err) 44940Sstevel@tonic-gate break; 44950Sstevel@tonic-gate #ifdef _LP64 44960Sstevel@tonic-gate if (!lp64) { 44970Sstevel@tonic-gate show_statvfs32(pri); 44980Sstevel@tonic-gate break; 44990Sstevel@tonic-gate } 45000Sstevel@tonic-gate #endif 45010Sstevel@tonic-gate show_statvfs(pri); 45020Sstevel@tonic-gate break; 45030Sstevel@tonic-gate case SYS_statvfs64: 45040Sstevel@tonic-gate case SYS_fstatvfs64: 45050Sstevel@tonic-gate if (err) 45060Sstevel@tonic-gate break; 45070Sstevel@tonic-gate show_statvfs64(pri); 45080Sstevel@tonic-gate break; 45090Sstevel@tonic-gate case SYS_statfs: 45100Sstevel@tonic-gate case SYS_fstatfs: 45110Sstevel@tonic-gate if (err) 45120Sstevel@tonic-gate break; 45130Sstevel@tonic-gate #ifdef _LP64 45140Sstevel@tonic-gate if (lp64) 45150Sstevel@tonic-gate show_statfs(pri); 45160Sstevel@tonic-gate else 45170Sstevel@tonic-gate show_statfs32(pri); 45180Sstevel@tonic-gate #else 45190Sstevel@tonic-gate show_statfs(pri); 45200Sstevel@tonic-gate #endif 45210Sstevel@tonic-gate break; 45220Sstevel@tonic-gate case SYS_fcntl: 45230Sstevel@tonic-gate show_fcntl(pri); 45240Sstevel@tonic-gate break; 45250Sstevel@tonic-gate case SYS_msgsys: 45260Sstevel@tonic-gate show_msgsys(pri, r0); /* each case must decide for itself */ 45270Sstevel@tonic-gate break; 45280Sstevel@tonic-gate case SYS_semsys: 45290Sstevel@tonic-gate show_semsys(pri); /* each case must decide for itself */ 45300Sstevel@tonic-gate break; 45310Sstevel@tonic-gate case SYS_shmsys: 45320Sstevel@tonic-gate show_shmsys(pri); /* each case must decide for itself */ 45330Sstevel@tonic-gate break; 45340Sstevel@tonic-gate case SYS_getdents: 45350Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 45360Sstevel@tonic-gate break; 45370Sstevel@tonic-gate #ifdef _LP64 45380Sstevel@tonic-gate if (!lp64) { 45390Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 45400Sstevel@tonic-gate break; 45410Sstevel@tonic-gate } 45420Sstevel@tonic-gate /* FALLTHROUGH */ 45430Sstevel@tonic-gate #else 45440Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 45450Sstevel@tonic-gate break; 45460Sstevel@tonic-gate #endif 45470Sstevel@tonic-gate case SYS_getdents64: 45480Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 45490Sstevel@tonic-gate break; 45500Sstevel@tonic-gate show_dents64(pri, (long)pri->sys_args[1], r0); 45510Sstevel@tonic-gate break; 45520Sstevel@tonic-gate case SYS_getmsg: 45530Sstevel@tonic-gate show_gp_msg(pri, what); 45540Sstevel@tonic-gate if (pri->sys_nargs > 3) 45550Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "flags"); 45560Sstevel@tonic-gate break; 45570Sstevel@tonic-gate case SYS_getpmsg: 45580Sstevel@tonic-gate show_gp_msg(pri, what); 45590Sstevel@tonic-gate if (pri->sys_nargs > 3) 45600Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "band"); 45610Sstevel@tonic-gate if (pri->sys_nargs > 4) 45620Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[4], "flags"); 45630Sstevel@tonic-gate break; 45640Sstevel@tonic-gate case SYS_putmsg: 45650Sstevel@tonic-gate case SYS_putpmsg: 45660Sstevel@tonic-gate show_gp_msg(pri, what); 45670Sstevel@tonic-gate break; 45680Sstevel@tonic-gate case SYS_poll: 45690Sstevel@tonic-gate show_poll(pri); 45700Sstevel@tonic-gate break; 45710Sstevel@tonic-gate case SYS_pollsys: 45720Sstevel@tonic-gate show_pollsys(pri); 45730Sstevel@tonic-gate break; 45740Sstevel@tonic-gate case SYS_setgroups: 45750Sstevel@tonic-gate if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0) 45760Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 45770Sstevel@tonic-gate break; 45780Sstevel@tonic-gate case SYS_getgroups: 45790Sstevel@tonic-gate if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0) 45800Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 45810Sstevel@tonic-gate break; 45820Sstevel@tonic-gate case SYS_sigprocmask: 45830Sstevel@tonic-gate if (pri->sys_nargs > 1) 45840Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], " set"); 45850Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 45860Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[2], "oset"); 45870Sstevel@tonic-gate break; 45880Sstevel@tonic-gate case SYS_sigsuspend: 45890Sstevel@tonic-gate case SYS_sigtimedwait: 45900Sstevel@tonic-gate if (pri->sys_nargs > 0) 45910Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[0], "sigmask"); 45920Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 45930Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[1]); 45940Sstevel@tonic-gate if (pri->sys_nargs > 2) 45950Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 45960Sstevel@tonic-gate break; 45970Sstevel@tonic-gate case SYS_sigaltstack: 45980Sstevel@tonic-gate if (pri->sys_nargs > 0) 45990Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[0], 46000Sstevel@tonic-gate "new"); 46010Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 46020Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[1], 46030Sstevel@tonic-gate "old"); 46040Sstevel@tonic-gate break; 46050Sstevel@tonic-gate case SYS_sigaction: 46060Sstevel@tonic-gate if (pri->sys_nargs > 1) 46070Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[1], 46080Sstevel@tonic-gate "new", NULL); 46090Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 46100Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[2], 46110Sstevel@tonic-gate "old", r0); 46120Sstevel@tonic-gate break; 46130Sstevel@tonic-gate case SYS_sigpending: 46140Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 46150Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], "sigmask"); 46160Sstevel@tonic-gate break; 46170Sstevel@tonic-gate case SYS_waitsys: 46180Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 46190Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[2]); 46200Sstevel@tonic-gate break; 46210Sstevel@tonic-gate case SYS_sigsendsys: 46220Sstevel@tonic-gate if (pri->sys_nargs > 0) 46230Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[0]); 46240Sstevel@tonic-gate break; 46250Sstevel@tonic-gate case SYS_priocntlsys: 46260Sstevel@tonic-gate if (pri->sys_nargs > 1) 46270Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[1]); 46280Sstevel@tonic-gate break; 46290Sstevel@tonic-gate case SYS_mincore: 46300Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 46310Sstevel@tonic-gate show_bool(pri, (long)pri->sys_args[2], 46320Sstevel@tonic-gate (pri->sys_args[1] + pagesize - 1) / pagesize); 46330Sstevel@tonic-gate break; 46340Sstevel@tonic-gate case SYS_readv: 46350Sstevel@tonic-gate case SYS_writev: 46360Sstevel@tonic-gate if (pri->sys_nargs > 2) { 46370Sstevel@tonic-gate int i = pri->sys_args[0]+1; 46380Sstevel@tonic-gate int showbuf = FALSE; 46390Sstevel@tonic-gate long nb = (what == SYS_readv)? r0 : 32*1024; 46400Sstevel@tonic-gate 46410Sstevel@tonic-gate if ((what == SYS_readv && !err && 46420Sstevel@tonic-gate prismember(&readfd, i)) || 46430Sstevel@tonic-gate (what == SYS_writev && 46440Sstevel@tonic-gate prismember(&writefd, i))) 46450Sstevel@tonic-gate showbuf = TRUE; 46460Sstevel@tonic-gate show_iovec(pri, (long)pri->sys_args[1], 46470Sstevel@tonic-gate pri->sys_args[2], showbuf, nb); 46480Sstevel@tonic-gate } 46490Sstevel@tonic-gate break; 46500Sstevel@tonic-gate case SYS_getrlimit: 46510Sstevel@tonic-gate if (err) 46520Sstevel@tonic-gate break; 46530Sstevel@tonic-gate /*FALLTHROUGH*/ 46540Sstevel@tonic-gate case SYS_setrlimit: 46550Sstevel@tonic-gate if (pri->sys_nargs <= 1) 46560Sstevel@tonic-gate break; 46570Sstevel@tonic-gate #ifdef _LP64 46580Sstevel@tonic-gate if (lp64) 46590Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 46600Sstevel@tonic-gate else 46610Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 46620Sstevel@tonic-gate #else 46630Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 46640Sstevel@tonic-gate #endif 46650Sstevel@tonic-gate break; 46660Sstevel@tonic-gate case SYS_getrlimit64: 46670Sstevel@tonic-gate if (err) 46680Sstevel@tonic-gate break; 46690Sstevel@tonic-gate /*FALLTHROUGH*/ 46700Sstevel@tonic-gate case SYS_setrlimit64: 46710Sstevel@tonic-gate if (pri->sys_nargs <= 1) 46720Sstevel@tonic-gate break; 46730Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 46740Sstevel@tonic-gate break; 46750Sstevel@tonic-gate case SYS_uname: 46760Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 46770Sstevel@tonic-gate show_nuname(pri, (long)pri->sys_args[0]); 46780Sstevel@tonic-gate break; 46790Sstevel@tonic-gate case SYS_adjtime: 46800Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 46810Sstevel@tonic-gate show_adjtime(pri, (long)pri->sys_args[0], 46820Sstevel@tonic-gate (long)pri->sys_args[1]); 46830Sstevel@tonic-gate break; 46840Sstevel@tonic-gate case SYS_lwp_info: 46850Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 46860Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "cpu time"); 46870Sstevel@tonic-gate break; 46880Sstevel@tonic-gate case SYS_lwp_wait: 46890Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 46900Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[1], "lwpid"); 46910Sstevel@tonic-gate break; 46920Sstevel@tonic-gate case SYS_lwp_mutex_wakeup: 46930Sstevel@tonic-gate case SYS_lwp_mutex_lock: 46940Sstevel@tonic-gate case SYS_lwp_mutex_unlock: 46950Sstevel@tonic-gate case SYS_lwp_mutex_trylock: 46960Sstevel@tonic-gate case SYS_lwp_mutex_init: 46970Sstevel@tonic-gate if (pri->sys_nargs > 0) 46980Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 46990Sstevel@tonic-gate break; 47000Sstevel@tonic-gate case SYS_lwp_mutex_timedlock: 47010Sstevel@tonic-gate if (pri->sys_nargs > 0) 47020Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 47030Sstevel@tonic-gate if (pri->sys_nargs > 1) 47040Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 47050Sstevel@tonic-gate break; 47060Sstevel@tonic-gate case SYS_lwp_cond_wait: 47070Sstevel@tonic-gate if (pri->sys_nargs > 0) 47080Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 47090Sstevel@tonic-gate if (pri->sys_nargs > 1) 47100Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[1]); 47110Sstevel@tonic-gate if (pri->sys_nargs > 2) 47120Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 47130Sstevel@tonic-gate break; 47140Sstevel@tonic-gate case SYS_lwp_cond_signal: 47150Sstevel@tonic-gate case SYS_lwp_cond_broadcast: 47160Sstevel@tonic-gate if (pri->sys_nargs > 0) 47170Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 47180Sstevel@tonic-gate break; 47190Sstevel@tonic-gate case SYS_lwp_sema_wait: 47200Sstevel@tonic-gate case SYS_lwp_sema_trywait: 47210Sstevel@tonic-gate case SYS_lwp_sema_post: 47220Sstevel@tonic-gate if (pri->sys_nargs > 0) 47230Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 47240Sstevel@tonic-gate break; 47250Sstevel@tonic-gate case SYS_lwp_sema_timedwait: 47260Sstevel@tonic-gate if (pri->sys_nargs > 0) 47270Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 47280Sstevel@tonic-gate if (pri->sys_nargs > 1) 47290Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 47300Sstevel@tonic-gate break; 47310Sstevel@tonic-gate case SYS_lwp_rwlock_sys: 47320Sstevel@tonic-gate if (pri->sys_nargs > 1) 47330Sstevel@tonic-gate show_rwlock(pri, (long)pri->sys_args[1]); 47340Sstevel@tonic-gate if (pri->sys_nargs > 2 && 47350Sstevel@tonic-gate (pri->sys_args[0] == 0 || pri->sys_args[0] == 1)) 47360Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 47370Sstevel@tonic-gate break; 47380Sstevel@tonic-gate case SYS_lwp_create: 47390Sstevel@tonic-gate /* XXX print some values in ucontext ??? */ 47400Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 47410Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[2], "lwpid"); 47420Sstevel@tonic-gate break; 47430Sstevel@tonic-gate case SYS_kaio: 47440Sstevel@tonic-gate if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1) 47450Sstevel@tonic-gate show_timeval(pri, (long)pri->sys_args[1], "timeout"); 47460Sstevel@tonic-gate break; 47470Sstevel@tonic-gate case SYS_nanosleep: 47480Sstevel@tonic-gate if (pri->sys_nargs > 0) 47490Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "tmout"); 47500Sstevel@tonic-gate if (pri->sys_nargs > 1 && (err == 0 || err == EINTR)) 47510Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "resid"); 47520Sstevel@tonic-gate break; 47530Sstevel@tonic-gate case SYS_privsys: 47540Sstevel@tonic-gate switch (pri->sys_args[0]) { 47550Sstevel@tonic-gate case PRIVSYS_SETPPRIV: 47560Sstevel@tonic-gate case PRIVSYS_GETPPRIV: 47570Sstevel@tonic-gate if (!err) 47580Sstevel@tonic-gate show_privset(pri, (long)pri->sys_args[3], 47590Sstevel@tonic-gate (size_t)pri->sys_args[4]); 47600Sstevel@tonic-gate } 47610Sstevel@tonic-gate break; 47620Sstevel@tonic-gate case SYS_ucredsys: 47630Sstevel@tonic-gate switch (pri->sys_args[0]) { 47640Sstevel@tonic-gate case UCREDSYS_UCREDGET: 47650Sstevel@tonic-gate case UCREDSYS_GETPEERUCRED: 47660Sstevel@tonic-gate if (err == 0) 47670Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[2]); 47680Sstevel@tonic-gate break; 47690Sstevel@tonic-gate } 47700Sstevel@tonic-gate break; 47710Sstevel@tonic-gate case SYS_bind: 47720Sstevel@tonic-gate case SYS_connect: 47730Sstevel@tonic-gate if (pri->sys_nargs > 2) 47740Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 47750Sstevel@tonic-gate 0, (long)pri->sys_args[2]); 47760Sstevel@tonic-gate break; 47770Sstevel@tonic-gate case SYS_sendto: 47780Sstevel@tonic-gate if (pri->sys_nargs > 5) 47790Sstevel@tonic-gate show_sockaddr(pri, "to", (long)pri->sys_args[4], 0, 47800Sstevel@tonic-gate pri->sys_args[5]); 47810Sstevel@tonic-gate break; 47820Sstevel@tonic-gate case SYS_accept: 47830Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 47840Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 47850Sstevel@tonic-gate (long)pri->sys_args[2], 0); 47860Sstevel@tonic-gate break; 47870Sstevel@tonic-gate case SYS_getsockname: 47880Sstevel@tonic-gate case SYS_getpeername: 47890Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 47900Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 47910Sstevel@tonic-gate (long)pri->sys_args[2], 0); 47920Sstevel@tonic-gate break; 47930Sstevel@tonic-gate case SYS_cladm: 47940Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 47950Sstevel@tonic-gate show_cladm(pri, pri->sys_args[0], pri->sys_args[1], 47960Sstevel@tonic-gate (long)pri->sys_args[2]); 47970Sstevel@tonic-gate break; 47980Sstevel@tonic-gate case SYS_recvfrom: 47990Sstevel@tonic-gate if (!err && pri->sys_nargs > 5) 48000Sstevel@tonic-gate show_sockaddr(pri, "from", (long)pri->sys_args[4], 48010Sstevel@tonic-gate (long)pri->sys_args[5], 0); 48020Sstevel@tonic-gate break; 48030Sstevel@tonic-gate case SYS_recvmsg: 48040Sstevel@tonic-gate if (err) 48050Sstevel@tonic-gate break; 48060Sstevel@tonic-gate /* FALLTHROUGH */ 48070Sstevel@tonic-gate case SYS_sendmsg: 4808*328Sja97890 if (pri->sys_nargs <= 2) 48090Sstevel@tonic-gate break; 48100Sstevel@tonic-gate #ifdef _LP64 48110Sstevel@tonic-gate if (lp64) 48120Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 48130Sstevel@tonic-gate else 48140Sstevel@tonic-gate show_msghdr32(pri, pri->sys_args[1]); 48150Sstevel@tonic-gate #else 48160Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 48170Sstevel@tonic-gate #endif 48180Sstevel@tonic-gate break; 48190Sstevel@tonic-gate case SYS_door: 48200Sstevel@tonic-gate show_doors(pri); 48210Sstevel@tonic-gate break; 48220Sstevel@tonic-gate case SYS_sendfilev: 48230Sstevel@tonic-gate if (pri->sys_nargs != 5) 48240Sstevel@tonic-gate break; 48250Sstevel@tonic-gate 48260Sstevel@tonic-gate if (pri->sys_args[0] == SENDFILEV) { 48270Sstevel@tonic-gate show_sendfilevec(pri, (int)pri->sys_args[1], 48280Sstevel@tonic-gate (sendfilevec_t *)pri->sys_args[2], 48290Sstevel@tonic-gate (int)pri->sys_args[3]); 48300Sstevel@tonic-gate } else if (pri->sys_args[0] == SENDFILEV64) { 48310Sstevel@tonic-gate show_sendfilevec64(pri, (int)pri->sys_args[1], 48320Sstevel@tonic-gate (sendfilevec64_t *)pri->sys_args[2], 48330Sstevel@tonic-gate (int)pri->sys_args[3]); 48340Sstevel@tonic-gate } 48350Sstevel@tonic-gate break; 48360Sstevel@tonic-gate case SYS_memcntl: 48370Sstevel@tonic-gate show_memcntl(pri); 48380Sstevel@tonic-gate break; 48390Sstevel@tonic-gate case SYS_lwp_park: 48400Sstevel@tonic-gate /* subcode 0: lwp_park(timespec_t *, id_t) */ 48410Sstevel@tonic-gate if (pri->sys_nargs > 1 && pri->sys_args[0] == 0) 48420Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 48430Sstevel@tonic-gate /* subcode 2: lwp_unpark_all(id_t *, int) */ 48440Sstevel@tonic-gate if (pri->sys_nargs > 2 && pri->sys_args[0] == 2) 48450Sstevel@tonic-gate show_ids(pri, (long)pri->sys_args[1], 48460Sstevel@tonic-gate (int)pri->sys_args[2]); 48470Sstevel@tonic-gate break; 48480Sstevel@tonic-gate case SYS_ntp_gettime: 48490Sstevel@tonic-gate if (!err) 48500Sstevel@tonic-gate show_ntp_gettime(pri); 48510Sstevel@tonic-gate break; 48520Sstevel@tonic-gate case SYS_ntp_adjtime: 48530Sstevel@tonic-gate if (!err) 48540Sstevel@tonic-gate show_ntp_adjtime(pri); 48550Sstevel@tonic-gate break; 48560Sstevel@tonic-gate case SYS_rusagesys: 48570Sstevel@tonic-gate if (!err) 48580Sstevel@tonic-gate if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) { 48590Sstevel@tonic-gate #ifdef _LP64 48600Sstevel@tonic-gate if (!lp64) 48610Sstevel@tonic-gate show_getrusage32(pri->sys_args[1]); 48620Sstevel@tonic-gate else 48630Sstevel@tonic-gate #endif 48640Sstevel@tonic-gate show_getrusage(pri->sys_args[1]); 48650Sstevel@tonic-gate } 48660Sstevel@tonic-gate break; 48670Sstevel@tonic-gate case SYS_port: 48680Sstevel@tonic-gate show_ports(pri); 48690Sstevel@tonic-gate break; 48700Sstevel@tonic-gate } 48710Sstevel@tonic-gate } 4872