17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52caf0dcdSrshoaib * Common Development and Distribution License (the "License"). 62caf0dcdSrshoaib * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 212caf0dcdSrshoaib 227c478bd9Sstevel@tonic-gate /* 232caf0dcdSrshoaib * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #define _SYSCALL32 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <stdio.h> 367c478bd9Sstevel@tonic-gate #include <stdlib.h> 377c478bd9Sstevel@tonic-gate #include <unistd.h> 387c478bd9Sstevel@tonic-gate #include <ctype.h> 397c478bd9Sstevel@tonic-gate #include <sys/types.h> 407c478bd9Sstevel@tonic-gate #include <sys/mman.h> 417c478bd9Sstevel@tonic-gate #include <libproc.h> 427c478bd9Sstevel@tonic-gate #include <string.h> 437c478bd9Sstevel@tonic-gate #include <limits.h> 447c478bd9Sstevel@tonic-gate #include <sys/statfs.h> 457c478bd9Sstevel@tonic-gate #include <sys/times.h> 467c478bd9Sstevel@tonic-gate #include <sys/timex.h> 477c478bd9Sstevel@tonic-gate #include <sys/utssys.h> 487c478bd9Sstevel@tonic-gate #include <sys/utsname.h> 497c478bd9Sstevel@tonic-gate #include <sys/ipc.h> 507c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h> 517c478bd9Sstevel@tonic-gate #include <sys/msg.h> 527c478bd9Sstevel@tonic-gate #include <sys/msg_impl.h> 537c478bd9Sstevel@tonic-gate #include <sys/sem.h> 547c478bd9Sstevel@tonic-gate #include <sys/sem_impl.h> 557c478bd9Sstevel@tonic-gate #include <sys/shm.h> 567c478bd9Sstevel@tonic-gate #include <sys/shm_impl.h> 577c478bd9Sstevel@tonic-gate #include <sys/dirent.h> 587c478bd9Sstevel@tonic-gate #include <sys/utime.h> 597c478bd9Sstevel@tonic-gate #include <ustat.h> 607c478bd9Sstevel@tonic-gate #include <fcntl.h> 617c478bd9Sstevel@tonic-gate #include <time.h> 627c478bd9Sstevel@tonic-gate #include <sys/termios.h> 637c478bd9Sstevel@tonic-gate #include <sys/termiox.h> 647c478bd9Sstevel@tonic-gate #include <sys/termio.h> 657c478bd9Sstevel@tonic-gate #include <sys/ttold.h> 667c478bd9Sstevel@tonic-gate #include <sys/jioctl.h> 677c478bd9Sstevel@tonic-gate #include <sys/filio.h> 687c478bd9Sstevel@tonic-gate #include <stropts.h> 697c478bd9Sstevel@tonic-gate #include <poll.h> 707c478bd9Sstevel@tonic-gate #include <sys/uio.h> 717c478bd9Sstevel@tonic-gate #include <sys/resource.h> 727c478bd9Sstevel@tonic-gate #include <sys/statvfs.h> 737c478bd9Sstevel@tonic-gate #include <sys/time.h> 747c478bd9Sstevel@tonic-gate #include <sys/aio.h> 757c478bd9Sstevel@tonic-gate #include <sys/socket.h> 767c478bd9Sstevel@tonic-gate #include <netinet/in.h> 777c478bd9Sstevel@tonic-gate #include <sys/un.h> 787c478bd9Sstevel@tonic-gate #include <sys/byteorder.h> 797c478bd9Sstevel@tonic-gate #include <arpa/inet.h> 807c478bd9Sstevel@tonic-gate #include <sys/audioio.h> 817c478bd9Sstevel@tonic-gate #include <sys/cladm.h> 827c478bd9Sstevel@tonic-gate #include <sys/synch.h> 837c478bd9Sstevel@tonic-gate #include <sys/synch32.h> 847c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 857c478bd9Sstevel@tonic-gate #include <sys/sendfile.h> 867c478bd9Sstevel@tonic-gate #include <priv.h> 877c478bd9Sstevel@tonic-gate #include <ucred.h> 887c478bd9Sstevel@tonic-gate #include <sys/ucred.h> 897c478bd9Sstevel@tonic-gate #include <sys/port_impl.h> 90821c4a97Sdp #include <sys/zone.h> 91821c4a97Sdp #include <sys/priv_impl.h> 92821c4a97Sdp #include <sys/priv.h> 9345916cd2Sjpk #include <tsol/label.h> 94*aa4a4f3bSnf202958 #include <sys/nvpair.h> 95*aa4a4f3bSnf202958 #include <libnvpair.h> 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate #include "ramdata.h" 987c478bd9Sstevel@tonic-gate #include "systable.h" 997c478bd9Sstevel@tonic-gate #include "proto.h" 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate void show_sigset(private_t *, long, const char *); 1027c478bd9Sstevel@tonic-gate void show_ioctl(private_t *, int, long); 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate void 1057c478bd9Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value) 1067c478bd9Sstevel@tonic-gate { 1077c478bd9Sstevel@tonic-gate char str[80]; 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate (void) strftime(str, sizeof (str), "%b %e %H:%M:%S %Z %Y", 1107c478bd9Sstevel@tonic-gate localtime(&value)); 1117c478bd9Sstevel@tonic-gate (void) printf("%s\t%s%s [ %llu ]\n", 1127c478bd9Sstevel@tonic-gate pri->pname, 1137c478bd9Sstevel@tonic-gate name, 1147c478bd9Sstevel@tonic-gate str, 1157c478bd9Sstevel@tonic-gate (longlong_t)value); 1167c478bd9Sstevel@tonic-gate } 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate void 1197c478bd9Sstevel@tonic-gate prtimestruc(private_t *pri, const char *name, timestruc_t *value) 1207c478bd9Sstevel@tonic-gate { 1217c478bd9Sstevel@tonic-gate prtime(pri, name, value->tv_sec); 1227c478bd9Sstevel@tonic-gate } 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate void 1257c478bd9Sstevel@tonic-gate show_utime(private_t *pri) 1267c478bd9Sstevel@tonic-gate { 1277c478bd9Sstevel@tonic-gate long offset; 1287c478bd9Sstevel@tonic-gate struct utimbuf utimbuf; 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL) 1317c478bd9Sstevel@tonic-gate return; 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1347c478bd9Sstevel@tonic-gate if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) 1357c478bd9Sstevel@tonic-gate != sizeof (utimbuf)) 1367c478bd9Sstevel@tonic-gate return; 1377c478bd9Sstevel@tonic-gate } else { 1387c478bd9Sstevel@tonic-gate struct utimbuf32 utimbuf32; 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) 1417c478bd9Sstevel@tonic-gate != sizeof (utimbuf32)) 1427c478bd9Sstevel@tonic-gate return; 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate utimbuf.actime = (time_t)utimbuf32.actime; 1457c478bd9Sstevel@tonic-gate utimbuf.modtime = (time_t)utimbuf32.modtime; 1467c478bd9Sstevel@tonic-gate } 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* print access and modification times */ 1497c478bd9Sstevel@tonic-gate prtime(pri, "atime: ", utimbuf.actime); 1507c478bd9Sstevel@tonic-gate prtime(pri, "mtime: ", utimbuf.modtime); 1517c478bd9Sstevel@tonic-gate } 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate void 1547c478bd9Sstevel@tonic-gate show_utimes(private_t *pri) 1557c478bd9Sstevel@tonic-gate { 1567c478bd9Sstevel@tonic-gate long offset; 1577c478bd9Sstevel@tonic-gate struct { 1587c478bd9Sstevel@tonic-gate struct timeval atime; 1597c478bd9Sstevel@tonic-gate struct timeval mtime; 1607c478bd9Sstevel@tonic-gate } utimbuf; 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[1]) == NULL) 1637c478bd9Sstevel@tonic-gate return; 1647c478bd9Sstevel@tonic-gate 1657c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1667c478bd9Sstevel@tonic-gate if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset) 1677c478bd9Sstevel@tonic-gate != sizeof (utimbuf)) 1687c478bd9Sstevel@tonic-gate return; 1697c478bd9Sstevel@tonic-gate } else { 1707c478bd9Sstevel@tonic-gate struct { 1717c478bd9Sstevel@tonic-gate struct timeval32 atime; 1727c478bd9Sstevel@tonic-gate struct timeval32 mtime; 1737c478bd9Sstevel@tonic-gate } utimbuf32; 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset) 1767c478bd9Sstevel@tonic-gate != sizeof (utimbuf32)) 1777c478bd9Sstevel@tonic-gate return; 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&utimbuf.atime, &utimbuf32.atime); 1807c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&utimbuf.mtime, &utimbuf32.mtime); 1817c478bd9Sstevel@tonic-gate } 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate /* print access and modification times */ 1847c478bd9Sstevel@tonic-gate prtime(pri, "atime: ", utimbuf.atime.tv_sec); 1857c478bd9Sstevel@tonic-gate prtime(pri, "mtime: ", utimbuf.mtime.tv_sec); 1867c478bd9Sstevel@tonic-gate } 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate void 1897c478bd9Sstevel@tonic-gate show_timeofday(private_t *pri) 1907c478bd9Sstevel@tonic-gate { 1917c478bd9Sstevel@tonic-gate struct timeval tod; 1927c478bd9Sstevel@tonic-gate long offset; 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 1957c478bd9Sstevel@tonic-gate return; 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 1987c478bd9Sstevel@tonic-gate if (Pread(Proc, &tod, sizeof (tod), offset) 1997c478bd9Sstevel@tonic-gate != sizeof (tod)) 2007c478bd9Sstevel@tonic-gate return; 2017c478bd9Sstevel@tonic-gate } else { 2027c478bd9Sstevel@tonic-gate struct timeval32 tod32; 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate if (Pread(Proc, &tod32, sizeof (tod32), offset) 2057c478bd9Sstevel@tonic-gate != sizeof (tod32)) 2067c478bd9Sstevel@tonic-gate return; 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&tod, &tod32); 2097c478bd9Sstevel@tonic-gate } 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate prtime(pri, "time: ", tod.tv_sec); 2127c478bd9Sstevel@tonic-gate } 2137c478bd9Sstevel@tonic-gate 2147c478bd9Sstevel@tonic-gate void 2157c478bd9Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name) 2167c478bd9Sstevel@tonic-gate { 2177c478bd9Sstevel@tonic-gate struct itimerval itimerval; 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate if (offset == NULL) 2207c478bd9Sstevel@tonic-gate return; 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2237c478bd9Sstevel@tonic-gate if (Pread(Proc, &itimerval, sizeof (itimerval), offset) 2247c478bd9Sstevel@tonic-gate != sizeof (itimerval)) 2257c478bd9Sstevel@tonic-gate return; 2267c478bd9Sstevel@tonic-gate } else { 2277c478bd9Sstevel@tonic-gate struct itimerval32 itimerval32; 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset) 2307c478bd9Sstevel@tonic-gate != sizeof (itimerval32)) 2317c478bd9Sstevel@tonic-gate return; 2327c478bd9Sstevel@tonic-gate 2337c478bd9Sstevel@tonic-gate ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32); 2347c478bd9Sstevel@tonic-gate } 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate (void) printf( 2377c478bd9Sstevel@tonic-gate "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n", 2387c478bd9Sstevel@tonic-gate pri->pname, 2397c478bd9Sstevel@tonic-gate name, 2407c478bd9Sstevel@tonic-gate itimerval.it_interval.tv_sec, 2417c478bd9Sstevel@tonic-gate itimerval.it_interval.tv_usec, 2427c478bd9Sstevel@tonic-gate itimerval.it_value.tv_sec, 2437c478bd9Sstevel@tonic-gate itimerval.it_value.tv_usec); 2447c478bd9Sstevel@tonic-gate } 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate void 2477c478bd9Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name) 2487c478bd9Sstevel@tonic-gate { 2497c478bd9Sstevel@tonic-gate struct timeval timeval; 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate if (offset == NULL) 2527c478bd9Sstevel@tonic-gate return; 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2557c478bd9Sstevel@tonic-gate if (Pread(Proc, &timeval, sizeof (timeval), offset) 2567c478bd9Sstevel@tonic-gate != sizeof (timeval)) 2577c478bd9Sstevel@tonic-gate return; 2587c478bd9Sstevel@tonic-gate } else { 2597c478bd9Sstevel@tonic-gate struct timeval32 timeval32; 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate if (Pread(Proc, &timeval32, sizeof (timeval32), offset) 2627c478bd9Sstevel@tonic-gate != sizeof (timeval32)) 2637c478bd9Sstevel@tonic-gate return; 2647c478bd9Sstevel@tonic-gate 2657c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32); 2667c478bd9Sstevel@tonic-gate } 2677c478bd9Sstevel@tonic-gate 2687c478bd9Sstevel@tonic-gate (void) printf( 2697c478bd9Sstevel@tonic-gate "%s\t%s: %ld.%6.6ld sec\n", 2707c478bd9Sstevel@tonic-gate pri->pname, 2717c478bd9Sstevel@tonic-gate name, 2727c478bd9Sstevel@tonic-gate timeval.tv_sec, 2737c478bd9Sstevel@tonic-gate timeval.tv_usec); 2747c478bd9Sstevel@tonic-gate } 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate void 2777c478bd9Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name) 2787c478bd9Sstevel@tonic-gate { 2797c478bd9Sstevel@tonic-gate timestruc_t timestruc; 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate if (offset == NULL) 2827c478bd9Sstevel@tonic-gate return; 2837c478bd9Sstevel@tonic-gate 2847c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 2857c478bd9Sstevel@tonic-gate if (Pread(Proc, ×truc, sizeof (timestruc), offset) 2867c478bd9Sstevel@tonic-gate != sizeof (timestruc)) 2877c478bd9Sstevel@tonic-gate return; 2887c478bd9Sstevel@tonic-gate } else { 2897c478bd9Sstevel@tonic-gate timestruc32_t timestruc32; 2907c478bd9Sstevel@tonic-gate 2917c478bd9Sstevel@tonic-gate if (Pread(Proc, ×truc32, sizeof (timestruc32), offset) 2927c478bd9Sstevel@tonic-gate != sizeof (timestruc32)) 2937c478bd9Sstevel@tonic-gate return; 2947c478bd9Sstevel@tonic-gate 2957c478bd9Sstevel@tonic-gate TIMESPEC32_TO_TIMESPEC(×truc, ×truc32); 2967c478bd9Sstevel@tonic-gate } 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate (void) printf( 2997c478bd9Sstevel@tonic-gate "%s\t%s: %ld.%9.9ld sec\n", 3007c478bd9Sstevel@tonic-gate pri->pname, 3017c478bd9Sstevel@tonic-gate name, 3027c478bd9Sstevel@tonic-gate timestruc.tv_sec, 3037c478bd9Sstevel@tonic-gate timestruc.tv_nsec); 3047c478bd9Sstevel@tonic-gate } 3057c478bd9Sstevel@tonic-gate 3067c478bd9Sstevel@tonic-gate void 3077c478bd9Sstevel@tonic-gate show_stime(private_t *pri) 3087c478bd9Sstevel@tonic-gate { 3097c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 1) { 3107c478bd9Sstevel@tonic-gate /* print new system time */ 3117c478bd9Sstevel@tonic-gate prtime(pri, "systime = ", (time_t)pri->sys_args[0]); 3127c478bd9Sstevel@tonic-gate } 3137c478bd9Sstevel@tonic-gate } 3147c478bd9Sstevel@tonic-gate 3157c478bd9Sstevel@tonic-gate void 3167c478bd9Sstevel@tonic-gate show_times(private_t *pri) 3177c478bd9Sstevel@tonic-gate { 3187c478bd9Sstevel@tonic-gate long hz = sysconf(_SC_CLK_TCK); 3197c478bd9Sstevel@tonic-gate long offset; 3207c478bd9Sstevel@tonic-gate struct tms tms; 3217c478bd9Sstevel@tonic-gate 3227c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 3237c478bd9Sstevel@tonic-gate return; 3247c478bd9Sstevel@tonic-gate 3257c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 3267c478bd9Sstevel@tonic-gate if (Pread(Proc, &tms, sizeof (tms), offset) 3277c478bd9Sstevel@tonic-gate != sizeof (tms)) 3287c478bd9Sstevel@tonic-gate return; 3297c478bd9Sstevel@tonic-gate } else { 3307c478bd9Sstevel@tonic-gate struct tms32 tms32; 3317c478bd9Sstevel@tonic-gate 3327c478bd9Sstevel@tonic-gate if (Pread(Proc, &tms32, sizeof (tms32), offset) 3337c478bd9Sstevel@tonic-gate != sizeof (tms32)) 3347c478bd9Sstevel@tonic-gate return; 3357c478bd9Sstevel@tonic-gate 3367c478bd9Sstevel@tonic-gate /* 3377c478bd9Sstevel@tonic-gate * This looks a bit odd (since the values are actually 3387c478bd9Sstevel@tonic-gate * signed), but we need to suppress sign extension to 3397c478bd9Sstevel@tonic-gate * preserve compatibility (we've always printed these 3407c478bd9Sstevel@tonic-gate * numbers as unsigned quantities). 3417c478bd9Sstevel@tonic-gate */ 3427c478bd9Sstevel@tonic-gate tms.tms_utime = (unsigned)tms32.tms_utime; 3437c478bd9Sstevel@tonic-gate tms.tms_stime = (unsigned)tms32.tms_stime; 3447c478bd9Sstevel@tonic-gate tms.tms_cutime = (unsigned)tms32.tms_cutime; 3457c478bd9Sstevel@tonic-gate tms.tms_cstime = (unsigned)tms32.tms_cstime; 3467c478bd9Sstevel@tonic-gate } 3477c478bd9Sstevel@tonic-gate 3487c478bd9Sstevel@tonic-gate (void) printf( 3497c478bd9Sstevel@tonic-gate "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n", 3507c478bd9Sstevel@tonic-gate pri->pname, 3517c478bd9Sstevel@tonic-gate tms.tms_utime, 3527c478bd9Sstevel@tonic-gate tms.tms_stime, 3537c478bd9Sstevel@tonic-gate tms.tms_cutime, 3547c478bd9Sstevel@tonic-gate tms.tms_cstime, 3557c478bd9Sstevel@tonic-gate hz); 3567c478bd9Sstevel@tonic-gate } 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate void 3597c478bd9Sstevel@tonic-gate show_uname(private_t *pri, long offset) 3607c478bd9Sstevel@tonic-gate { 3617c478bd9Sstevel@tonic-gate /* 3627c478bd9Sstevel@tonic-gate * Old utsname buffer (no longer accessible in <sys/utsname.h>). 3637c478bd9Sstevel@tonic-gate */ 3647c478bd9Sstevel@tonic-gate struct { 3657c478bd9Sstevel@tonic-gate char sysname[9]; 3667c478bd9Sstevel@tonic-gate char nodename[9]; 3677c478bd9Sstevel@tonic-gate char release[9]; 3687c478bd9Sstevel@tonic-gate char version[9]; 3697c478bd9Sstevel@tonic-gate char machine[9]; 3707c478bd9Sstevel@tonic-gate } ubuf; 3717c478bd9Sstevel@tonic-gate 3727c478bd9Sstevel@tonic-gate if (offset != NULL && 3737c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3747c478bd9Sstevel@tonic-gate (void) printf( 3757c478bd9Sstevel@tonic-gate "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n", 3767c478bd9Sstevel@tonic-gate pri->pname, 3777c478bd9Sstevel@tonic-gate ubuf.sysname, 3787c478bd9Sstevel@tonic-gate ubuf.nodename, 3797c478bd9Sstevel@tonic-gate ubuf.release, 3807c478bd9Sstevel@tonic-gate ubuf.version, 3817c478bd9Sstevel@tonic-gate ubuf.machine); 3827c478bd9Sstevel@tonic-gate } 3837c478bd9Sstevel@tonic-gate } 3847c478bd9Sstevel@tonic-gate 3857c478bd9Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */ 3867c478bd9Sstevel@tonic-gate void 3877c478bd9Sstevel@tonic-gate show_ustat(private_t *pri, long offset) 3887c478bd9Sstevel@tonic-gate { 3897c478bd9Sstevel@tonic-gate struct ustat ubuf; 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate if (offset != NULL && 3927c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 3937c478bd9Sstevel@tonic-gate (void) printf( 3947c478bd9Sstevel@tonic-gate "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n", 3957c478bd9Sstevel@tonic-gate pri->pname, 3967c478bd9Sstevel@tonic-gate ubuf.f_tfree, 3977c478bd9Sstevel@tonic-gate ubuf.f_tinode, 3987c478bd9Sstevel@tonic-gate ubuf.f_fname, 3997c478bd9Sstevel@tonic-gate ubuf.f_fpack); 4007c478bd9Sstevel@tonic-gate } 4017c478bd9Sstevel@tonic-gate } 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate #ifdef _LP64 4047c478bd9Sstevel@tonic-gate void 4057c478bd9Sstevel@tonic-gate show_ustat32(private_t *pri, long offset) 4067c478bd9Sstevel@tonic-gate { 4077c478bd9Sstevel@tonic-gate struct ustat32 ubuf; 4087c478bd9Sstevel@tonic-gate 4097c478bd9Sstevel@tonic-gate if (offset != NULL && 4107c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 4117c478bd9Sstevel@tonic-gate (void) printf( 4127c478bd9Sstevel@tonic-gate "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n", 4137c478bd9Sstevel@tonic-gate pri->pname, 4147c478bd9Sstevel@tonic-gate ubuf.f_tfree, 4157c478bd9Sstevel@tonic-gate ubuf.f_tinode, 4167c478bd9Sstevel@tonic-gate ubuf.f_fname, 4177c478bd9Sstevel@tonic-gate ubuf.f_fpack); 4187c478bd9Sstevel@tonic-gate } 4197c478bd9Sstevel@tonic-gate } 4207c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4217c478bd9Sstevel@tonic-gate 4227c478bd9Sstevel@tonic-gate void 4237c478bd9Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc) 4247c478bd9Sstevel@tonic-gate { 4257c478bd9Sstevel@tonic-gate f_user_t fubuf; 4267c478bd9Sstevel@tonic-gate int serial = (nproc > 4); 4277c478bd9Sstevel@tonic-gate 4287c478bd9Sstevel@tonic-gate if (offset == NULL) 4297c478bd9Sstevel@tonic-gate return; 4307c478bd9Sstevel@tonic-gate 4317c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 4327c478bd9Sstevel@tonic-gate if (serial) 4337c478bd9Sstevel@tonic-gate Eserialize(); 4347c478bd9Sstevel@tonic-gate 4357c478bd9Sstevel@tonic-gate while (nproc > 0 && 4367c478bd9Sstevel@tonic-gate Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) { 4377c478bd9Sstevel@tonic-gate (void) printf("%s\tpid=%-5d uid=%-5d flags=%s\n", 4387c478bd9Sstevel@tonic-gate pri->pname, 4397c478bd9Sstevel@tonic-gate (int)fubuf.fu_pid, 4407c478bd9Sstevel@tonic-gate (int)fubuf.fu_uid, 4417c478bd9Sstevel@tonic-gate fuflags(pri, fubuf.fu_flags)); 4427c478bd9Sstevel@tonic-gate nproc--; 4437c478bd9Sstevel@tonic-gate offset += sizeof (fubuf); 4447c478bd9Sstevel@tonic-gate } 4457c478bd9Sstevel@tonic-gate 4467c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 4477c478bd9Sstevel@tonic-gate if (serial) 4487c478bd9Sstevel@tonic-gate Xserialize(); 4497c478bd9Sstevel@tonic-gate } 4507c478bd9Sstevel@tonic-gate 4517c478bd9Sstevel@tonic-gate void 4527c478bd9Sstevel@tonic-gate show_utssys(private_t *pri, long r0) 4537c478bd9Sstevel@tonic-gate { 4547c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4557c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) { 4567c478bd9Sstevel@tonic-gate case UTS_UNAME: 4577c478bd9Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4587c478bd9Sstevel@tonic-gate break; 4597c478bd9Sstevel@tonic-gate case UTS_USTAT: 4607c478bd9Sstevel@tonic-gate show_ustat(pri, (long)pri->sys_args[0]); 4617c478bd9Sstevel@tonic-gate break; 4627c478bd9Sstevel@tonic-gate case UTS_FUSERS: 4637c478bd9Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4647c478bd9Sstevel@tonic-gate break; 4657c478bd9Sstevel@tonic-gate } 4667c478bd9Sstevel@tonic-gate } 4677c478bd9Sstevel@tonic-gate } 4687c478bd9Sstevel@tonic-gate 4697c478bd9Sstevel@tonic-gate #ifdef _LP64 4707c478bd9Sstevel@tonic-gate void 4717c478bd9Sstevel@tonic-gate show_utssys32(private_t *pri, long r0) 4727c478bd9Sstevel@tonic-gate { 4737c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) { 4747c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) { 4757c478bd9Sstevel@tonic-gate case UTS_UNAME: 4767c478bd9Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]); 4777c478bd9Sstevel@tonic-gate break; 4787c478bd9Sstevel@tonic-gate case UTS_USTAT: 4797c478bd9Sstevel@tonic-gate show_ustat32(pri, (long)pri->sys_args[0]); 4807c478bd9Sstevel@tonic-gate break; 4817c478bd9Sstevel@tonic-gate case UTS_FUSERS: 4827c478bd9Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0); 4837c478bd9Sstevel@tonic-gate break; 4847c478bd9Sstevel@tonic-gate } 4857c478bd9Sstevel@tonic-gate } 4867c478bd9Sstevel@tonic-gate } 4877c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 4887c478bd9Sstevel@tonic-gate 4897c478bd9Sstevel@tonic-gate void 4907c478bd9Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset) 4917c478bd9Sstevel@tonic-gate { 4927c478bd9Sstevel@tonic-gate int arg; 4937c478bd9Sstevel@tonic-gate 4947c478bd9Sstevel@tonic-gate switch (code) { 4957c478bd9Sstevel@tonic-gate case CL_INITIALIZE: 4967c478bd9Sstevel@tonic-gate switch (function) { 4977c478bd9Sstevel@tonic-gate case CL_GET_BOOTFLAG: 4987c478bd9Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 4997c478bd9Sstevel@tonic-gate == sizeof (arg)) { 5007c478bd9Sstevel@tonic-gate if (arg & CLUSTER_CONFIGURED) 5017c478bd9Sstevel@tonic-gate (void) printf("%s\tbootflags=" 5027c478bd9Sstevel@tonic-gate "CLUSTER_CONFIGURED", pri->pname); 5037c478bd9Sstevel@tonic-gate if (arg & CLUSTER_BOOTED) 5047c478bd9Sstevel@tonic-gate (void) printf("|CLUSTER_BOOTED\n"); 5057c478bd9Sstevel@tonic-gate } 5067c478bd9Sstevel@tonic-gate break; 5077c478bd9Sstevel@tonic-gate } 5087c478bd9Sstevel@tonic-gate break; 5097c478bd9Sstevel@tonic-gate case CL_CONFIG: 5107c478bd9Sstevel@tonic-gate switch (function) { 5117c478bd9Sstevel@tonic-gate case CL_NODEID: 5127c478bd9Sstevel@tonic-gate case CL_HIGHEST_NODEID: 5137c478bd9Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset) 5147c478bd9Sstevel@tonic-gate == sizeof (arg)) 5157c478bd9Sstevel@tonic-gate (void) printf("%s\tnodeid=%d\n", 5167c478bd9Sstevel@tonic-gate pri->pname, arg); 5177c478bd9Sstevel@tonic-gate } 5187c478bd9Sstevel@tonic-gate break; 5197c478bd9Sstevel@tonic-gate } 5207c478bd9Sstevel@tonic-gate } 5217c478bd9Sstevel@tonic-gate 5227c478bd9Sstevel@tonic-gate #define ALL_LOCK_TYPES \ 5237c478bd9Sstevel@tonic-gate (USYNC_PROCESS|LOCK_ERRORCHECK|LOCK_RECURSIVE|USYNC_PROCESS_ROBUST|\ 5247c478bd9Sstevel@tonic-gate LOCK_PRIO_INHERIT|LOCK_PRIO_PROTECT|LOCK_ROBUST_NP) 5257c478bd9Sstevel@tonic-gate 5267c478bd9Sstevel@tonic-gate /* return cv and mutex types */ 5277c478bd9Sstevel@tonic-gate const char * 5287c478bd9Sstevel@tonic-gate synch_type(private_t *pri, uint_t type) 5297c478bd9Sstevel@tonic-gate { 5307c478bd9Sstevel@tonic-gate char *str = pri->code_buf; 5317c478bd9Sstevel@tonic-gate 5327c478bd9Sstevel@tonic-gate if (type & USYNC_PROCESS) 5337c478bd9Sstevel@tonic-gate (void) strcpy(str, "USYNC_PROCESS"); 5347c478bd9Sstevel@tonic-gate else 5357c478bd9Sstevel@tonic-gate (void) strcpy(str, "USYNC_THREAD"); 5367c478bd9Sstevel@tonic-gate 5377c478bd9Sstevel@tonic-gate if (type & LOCK_ERRORCHECK) 5387c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_ERRORCHECK"); 5397c478bd9Sstevel@tonic-gate if (type & LOCK_RECURSIVE) 5407c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_RECURSIVE"); 5417c478bd9Sstevel@tonic-gate if (type & USYNC_PROCESS_ROBUST) 5427c478bd9Sstevel@tonic-gate (void) strcat(str, "|USYNC_PROCESS_ROBUST"); 5437c478bd9Sstevel@tonic-gate if (type & LOCK_PRIO_INHERIT) 5447c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_INHERIT"); 5457c478bd9Sstevel@tonic-gate if (type & LOCK_PRIO_PROTECT) 5467c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_PROTECT"); 5477c478bd9Sstevel@tonic-gate if (type & LOCK_ROBUST_NP) 5487c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_ROBUST_NP"); 5497c478bd9Sstevel@tonic-gate 5507c478bd9Sstevel@tonic-gate if ((type &= ~ALL_LOCK_TYPES) != 0) 5517c478bd9Sstevel@tonic-gate (void) sprintf(str + strlen(str), "|0x%.4X", type); 5527c478bd9Sstevel@tonic-gate 5537c478bd9Sstevel@tonic-gate return ((const char *)str); 5547c478bd9Sstevel@tonic-gate } 5557c478bd9Sstevel@tonic-gate 5567c478bd9Sstevel@tonic-gate void 5577c478bd9Sstevel@tonic-gate show_mutex(private_t *pri, long offset) 5587c478bd9Sstevel@tonic-gate { 5597c478bd9Sstevel@tonic-gate lwp_mutex_t mutex; 5607c478bd9Sstevel@tonic-gate 5617c478bd9Sstevel@tonic-gate if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) { 5627c478bd9Sstevel@tonic-gate (void) printf("%s\tmutex type: %s\n", 5637c478bd9Sstevel@tonic-gate pri->pname, 5647c478bd9Sstevel@tonic-gate synch_type(pri, mutex.mutex_type)); 5657c478bd9Sstevel@tonic-gate } 5667c478bd9Sstevel@tonic-gate } 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate void 5697c478bd9Sstevel@tonic-gate show_condvar(private_t *pri, long offset) 5707c478bd9Sstevel@tonic-gate { 5717c478bd9Sstevel@tonic-gate lwp_cond_t condvar; 5727c478bd9Sstevel@tonic-gate 5737c478bd9Sstevel@tonic-gate if (Pread(Proc, &condvar, sizeof (condvar), offset) 5747c478bd9Sstevel@tonic-gate == sizeof (condvar)) { 5757c478bd9Sstevel@tonic-gate (void) printf("%s\tcondvar type: %s\n", 5767c478bd9Sstevel@tonic-gate pri->pname, 5777c478bd9Sstevel@tonic-gate synch_type(pri, condvar.cond_type)); 5787c478bd9Sstevel@tonic-gate } 5797c478bd9Sstevel@tonic-gate } 5807c478bd9Sstevel@tonic-gate 5817c478bd9Sstevel@tonic-gate void 5827c478bd9Sstevel@tonic-gate show_sema(private_t *pri, long offset) 5837c478bd9Sstevel@tonic-gate { 5847c478bd9Sstevel@tonic-gate lwp_sema_t sema; 5857c478bd9Sstevel@tonic-gate 5867c478bd9Sstevel@tonic-gate if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) { 5877c478bd9Sstevel@tonic-gate (void) printf("%s\tsema type: %s count = %u\n", 5887c478bd9Sstevel@tonic-gate pri->pname, 5897c478bd9Sstevel@tonic-gate synch_type(pri, sema.sema_type), 5907c478bd9Sstevel@tonic-gate sema.sema_count); 5917c478bd9Sstevel@tonic-gate } 5927c478bd9Sstevel@tonic-gate } 5937c478bd9Sstevel@tonic-gate 5947c478bd9Sstevel@tonic-gate void 5957c478bd9Sstevel@tonic-gate show_rwlock(private_t *pri, long offset) 5967c478bd9Sstevel@tonic-gate { 5977c478bd9Sstevel@tonic-gate lwp_rwlock_t rwlock; 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) { 6007c478bd9Sstevel@tonic-gate (void) printf("%s\trwlock type: %s readers = %d\n", 6017c478bd9Sstevel@tonic-gate pri->pname, 6027c478bd9Sstevel@tonic-gate synch_type(pri, rwlock.rwlock_type), 6037c478bd9Sstevel@tonic-gate rwlock.rwlock_readers); 6047c478bd9Sstevel@tonic-gate } 6057c478bd9Sstevel@tonic-gate } 6067c478bd9Sstevel@tonic-gate 6077c478bd9Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */ 6087c478bd9Sstevel@tonic-gate char * 6097c478bd9Sstevel@tonic-gate show_char(char *buf, int c) 6107c478bd9Sstevel@tonic-gate { 6117c478bd9Sstevel@tonic-gate const char *fmt; 6127c478bd9Sstevel@tonic-gate 6137c478bd9Sstevel@tonic-gate if (c >= ' ' && c < 0177) 6147c478bd9Sstevel@tonic-gate fmt = "'%c'"; 6157c478bd9Sstevel@tonic-gate else 6167c478bd9Sstevel@tonic-gate fmt = "%.3o"; 6177c478bd9Sstevel@tonic-gate 6187c478bd9Sstevel@tonic-gate (void) sprintf(buf, fmt, c&0xff); 6197c478bd9Sstevel@tonic-gate return (buf); 6207c478bd9Sstevel@tonic-gate } 6217c478bd9Sstevel@tonic-gate 6227c478bd9Sstevel@tonic-gate void 6237c478bd9Sstevel@tonic-gate show_termio(private_t *pri, long offset) 6247c478bd9Sstevel@tonic-gate { 6257c478bd9Sstevel@tonic-gate struct termio termio; 6267c478bd9Sstevel@tonic-gate char cbuf[8]; 6277c478bd9Sstevel@tonic-gate int i; 6287c478bd9Sstevel@tonic-gate 6297c478bd9Sstevel@tonic-gate if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) { 6307c478bd9Sstevel@tonic-gate (void) printf( 6317c478bd9Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n", 6327c478bd9Sstevel@tonic-gate pri->pname, 6337c478bd9Sstevel@tonic-gate termio.c_iflag, 6347c478bd9Sstevel@tonic-gate termio.c_oflag, 6357c478bd9Sstevel@tonic-gate termio.c_cflag, 6367c478bd9Sstevel@tonic-gate termio.c_lflag, 6377c478bd9Sstevel@tonic-gate termio.c_line); 6387c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6397c478bd9Sstevel@tonic-gate for (i = 0; i < NCC; i++) 6407c478bd9Sstevel@tonic-gate (void) printf(" %s", 6417c478bd9Sstevel@tonic-gate show_char(cbuf, (int)termio.c_cc[i])); 6427c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 6437c478bd9Sstevel@tonic-gate } 6447c478bd9Sstevel@tonic-gate } 6457c478bd9Sstevel@tonic-gate 6467c478bd9Sstevel@tonic-gate void 6477c478bd9Sstevel@tonic-gate show_termios(private_t *pri, long offset) 6487c478bd9Sstevel@tonic-gate { 6497c478bd9Sstevel@tonic-gate struct termios termios; 6507c478bd9Sstevel@tonic-gate char cbuf[8]; 6517c478bd9Sstevel@tonic-gate int i; 6527c478bd9Sstevel@tonic-gate 6537c478bd9Sstevel@tonic-gate if (Pread(Proc, &termios, sizeof (termios), offset) 6547c478bd9Sstevel@tonic-gate == sizeof (termios)) { 6557c478bd9Sstevel@tonic-gate (void) printf( 6567c478bd9Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n", 6577c478bd9Sstevel@tonic-gate pri->pname, 6587c478bd9Sstevel@tonic-gate termios.c_iflag, 6597c478bd9Sstevel@tonic-gate termios.c_oflag, 6607c478bd9Sstevel@tonic-gate termios.c_cflag, 6617c478bd9Sstevel@tonic-gate termios.c_lflag); 6627c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 6637c478bd9Sstevel@tonic-gate for (i = 0; i < NCCS; i++) { 6647c478bd9Sstevel@tonic-gate if (i == NCC) /* show new chars on new line */ 6657c478bd9Sstevel@tonic-gate (void) printf("\n%s\t\t", pri->pname); 6667c478bd9Sstevel@tonic-gate (void) printf(" %s", 6677c478bd9Sstevel@tonic-gate show_char(cbuf, (int)termios.c_cc[i])); 6687c478bd9Sstevel@tonic-gate } 6697c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 6707c478bd9Sstevel@tonic-gate } 6717c478bd9Sstevel@tonic-gate } 6727c478bd9Sstevel@tonic-gate 6737c478bd9Sstevel@tonic-gate void 6747c478bd9Sstevel@tonic-gate show_termiox(private_t *pri, long offset) 6757c478bd9Sstevel@tonic-gate { 6767c478bd9Sstevel@tonic-gate struct termiox termiox; 6777c478bd9Sstevel@tonic-gate int i; 6787c478bd9Sstevel@tonic-gate 6797c478bd9Sstevel@tonic-gate if (Pread(Proc, &termiox, sizeof (termiox), offset) 6807c478bd9Sstevel@tonic-gate == sizeof (termiox)) { 6817c478bd9Sstevel@tonic-gate (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o", 6827c478bd9Sstevel@tonic-gate pri->pname, 6837c478bd9Sstevel@tonic-gate termiox.x_hflag, 6847c478bd9Sstevel@tonic-gate termiox.x_cflag, 6857c478bd9Sstevel@tonic-gate termiox.x_rflag[0]); 6867c478bd9Sstevel@tonic-gate for (i = 1; i < NFF; i++) 6877c478bd9Sstevel@tonic-gate (void) printf(",0%.3o", termiox.x_rflag[i]); 6887c478bd9Sstevel@tonic-gate (void) printf(" sflag=0%.3o\n", 6897c478bd9Sstevel@tonic-gate termiox.x_sflag); 6907c478bd9Sstevel@tonic-gate } 6917c478bd9Sstevel@tonic-gate } 6927c478bd9Sstevel@tonic-gate 6937c478bd9Sstevel@tonic-gate void 6947c478bd9Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset) 6957c478bd9Sstevel@tonic-gate { 6967c478bd9Sstevel@tonic-gate struct sgttyb sgttyb; 6977c478bd9Sstevel@tonic-gate 6987c478bd9Sstevel@tonic-gate if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) { 6997c478bd9Sstevel@tonic-gate char erase[8]; 7007c478bd9Sstevel@tonic-gate char kill[8]; 7017c478bd9Sstevel@tonic-gate 7027c478bd9Sstevel@tonic-gate (void) printf( 7037c478bd9Sstevel@tonic-gate "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n", 7047c478bd9Sstevel@tonic-gate pri->pname, 7057c478bd9Sstevel@tonic-gate sgttyb.sg_ispeed&0xff, 7067c478bd9Sstevel@tonic-gate sgttyb.sg_ospeed&0xff, 7077c478bd9Sstevel@tonic-gate show_char(erase, sgttyb.sg_erase), 7087c478bd9Sstevel@tonic-gate show_char(kill, sgttyb.sg_kill), 7097c478bd9Sstevel@tonic-gate sgttyb.sg_flags); 7107c478bd9Sstevel@tonic-gate } 7117c478bd9Sstevel@tonic-gate } 7127c478bd9Sstevel@tonic-gate 7137c478bd9Sstevel@tonic-gate void 7147c478bd9Sstevel@tonic-gate show_ltchars(private_t *pri, long offset) 7157c478bd9Sstevel@tonic-gate { 7167c478bd9Sstevel@tonic-gate struct ltchars ltchars; 7177c478bd9Sstevel@tonic-gate char *p; 7187c478bd9Sstevel@tonic-gate char cbuf[8]; 7197c478bd9Sstevel@tonic-gate int i; 7207c478bd9Sstevel@tonic-gate 7217c478bd9Sstevel@tonic-gate if (Pread(Proc, <chars, sizeof (ltchars), offset) 7227c478bd9Sstevel@tonic-gate == sizeof (ltchars)) { 7237c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7247c478bd9Sstevel@tonic-gate for (p = (char *)<chars, i = 0; i < sizeof (ltchars); i++) 7257c478bd9Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7267c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 7277c478bd9Sstevel@tonic-gate } 7287c478bd9Sstevel@tonic-gate } 7297c478bd9Sstevel@tonic-gate 7307c478bd9Sstevel@tonic-gate void 7317c478bd9Sstevel@tonic-gate show_tchars(private_t *pri, long offset) 7327c478bd9Sstevel@tonic-gate { 7337c478bd9Sstevel@tonic-gate struct tchars tchars; 7347c478bd9Sstevel@tonic-gate char *p; 7357c478bd9Sstevel@tonic-gate char cbuf[8]; 7367c478bd9Sstevel@tonic-gate int i; 7377c478bd9Sstevel@tonic-gate 7387c478bd9Sstevel@tonic-gate if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) { 7397c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname); 7407c478bd9Sstevel@tonic-gate for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++) 7417c478bd9Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++)); 7427c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 7437c478bd9Sstevel@tonic-gate } 7447c478bd9Sstevel@tonic-gate } 7457c478bd9Sstevel@tonic-gate 7467c478bd9Sstevel@tonic-gate void 7477c478bd9Sstevel@tonic-gate show_termcb(private_t *pri, long offset) 7487c478bd9Sstevel@tonic-gate { 7497c478bd9Sstevel@tonic-gate struct termcb termcb; 7507c478bd9Sstevel@tonic-gate 7517c478bd9Sstevel@tonic-gate if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) { 7527c478bd9Sstevel@tonic-gate (void) printf( 7537c478bd9Sstevel@tonic-gate "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n", 7547c478bd9Sstevel@tonic-gate pri->pname, 7557c478bd9Sstevel@tonic-gate termcb.st_flgs&0xff, 7567c478bd9Sstevel@tonic-gate termcb.st_termt&0xff, 7577c478bd9Sstevel@tonic-gate termcb.st_crow&0xff, 7587c478bd9Sstevel@tonic-gate termcb.st_ccol&0xff, 7597c478bd9Sstevel@tonic-gate termcb.st_vrow&0xff, 7607c478bd9Sstevel@tonic-gate termcb.st_lrow&0xff); 7617c478bd9Sstevel@tonic-gate } 7627c478bd9Sstevel@tonic-gate } 7637c478bd9Sstevel@tonic-gate 7647c478bd9Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */ 7657c478bd9Sstevel@tonic-gate void 7667c478bd9Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset) 7677c478bd9Sstevel@tonic-gate { 7687c478bd9Sstevel@tonic-gate int val; 7697c478bd9Sstevel@tonic-gate 7707c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 7717c478bd9Sstevel@tonic-gate const char *s = NULL; 7727c478bd9Sstevel@tonic-gate 7737c478bd9Sstevel@tonic-gate switch (code) { /* interpret these symbolically */ 7747c478bd9Sstevel@tonic-gate case I_GRDOPT: 7757c478bd9Sstevel@tonic-gate s = strrdopt(val); 7767c478bd9Sstevel@tonic-gate break; 7777c478bd9Sstevel@tonic-gate case I_GETSIG: 7787c478bd9Sstevel@tonic-gate s = strevents(pri, val); 7797c478bd9Sstevel@tonic-gate break; 7807c478bd9Sstevel@tonic-gate case TIOCFLUSH: 7817c478bd9Sstevel@tonic-gate s = tiocflush(pri, val); 7827c478bd9Sstevel@tonic-gate break; 7837c478bd9Sstevel@tonic-gate } 7847c478bd9Sstevel@tonic-gate 7857c478bd9Sstevel@tonic-gate if (s == NULL) 7867c478bd9Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %d\n", 7877c478bd9Sstevel@tonic-gate pri->pname, offset, val); 7887c478bd9Sstevel@tonic-gate else 7897c478bd9Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %s\n", 7907c478bd9Sstevel@tonic-gate pri->pname, offset, s); 7917c478bd9Sstevel@tonic-gate } 7927c478bd9Sstevel@tonic-gate } 7937c478bd9Sstevel@tonic-gate 7947c478bd9Sstevel@tonic-gate void 7957c478bd9Sstevel@tonic-gate show_strioctl(private_t *pri, long offset) 7967c478bd9Sstevel@tonic-gate { 7977c478bd9Sstevel@tonic-gate struct strioctl strioctl; 7987c478bd9Sstevel@tonic-gate 7997c478bd9Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 8007c478bd9Sstevel@tonic-gate sizeof (strioctl)) { 8017c478bd9Sstevel@tonic-gate (void) printf( 8027c478bd9Sstevel@tonic-gate "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 8037c478bd9Sstevel@tonic-gate pri->pname, 8047c478bd9Sstevel@tonic-gate ioctlname(pri, strioctl.ic_cmd), 8057c478bd9Sstevel@tonic-gate strioctl.ic_timout, 8067c478bd9Sstevel@tonic-gate strioctl.ic_len, 8077c478bd9Sstevel@tonic-gate (long)strioctl.ic_dp); 8087c478bd9Sstevel@tonic-gate 8097c478bd9Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8107c478bd9Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8117c478bd9Sstevel@tonic-gate (long)strioctl.ic_dp); 8127c478bd9Sstevel@tonic-gate --pri->recur; 8137c478bd9Sstevel@tonic-gate } 8147c478bd9Sstevel@tonic-gate } 8157c478bd9Sstevel@tonic-gate 8167c478bd9Sstevel@tonic-gate #ifdef _LP64 8177c478bd9Sstevel@tonic-gate void 8187c478bd9Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset) 8197c478bd9Sstevel@tonic-gate { 8207c478bd9Sstevel@tonic-gate struct strioctl32 strioctl; 8217c478bd9Sstevel@tonic-gate 8227c478bd9Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) == 8237c478bd9Sstevel@tonic-gate sizeof (strioctl)) { 8247c478bd9Sstevel@tonic-gate (void) printf( 8257c478bd9Sstevel@tonic-gate "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n", 8267c478bd9Sstevel@tonic-gate pri->pname, 8277c478bd9Sstevel@tonic-gate ioctlname(pri, strioctl.ic_cmd), 8287c478bd9Sstevel@tonic-gate strioctl.ic_timout, 8297c478bd9Sstevel@tonic-gate strioctl.ic_len, 8307c478bd9Sstevel@tonic-gate (long)strioctl.ic_dp); 8317c478bd9Sstevel@tonic-gate 8327c478bd9Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */ 8337c478bd9Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd, 8347c478bd9Sstevel@tonic-gate (long)strioctl.ic_dp); 8357c478bd9Sstevel@tonic-gate --pri->recur; 8367c478bd9Sstevel@tonic-gate } 8377c478bd9Sstevel@tonic-gate } 8387c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 8397c478bd9Sstevel@tonic-gate 8407c478bd9Sstevel@tonic-gate void 8417c478bd9Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump) 8427c478bd9Sstevel@tonic-gate { 8437c478bd9Sstevel@tonic-gate (void) printf( 8447c478bd9Sstevel@tonic-gate "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8457c478bd9Sstevel@tonic-gate pri->pname, 8467c478bd9Sstevel@tonic-gate name, 8477c478bd9Sstevel@tonic-gate sp->maxlen, 8487c478bd9Sstevel@tonic-gate sp->len, 8497c478bd9Sstevel@tonic-gate (long)sp->buf); 8507c478bd9Sstevel@tonic-gate /* 8517c478bd9Sstevel@tonic-gate * Should we show the buffer contents? 8527c478bd9Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8537c478bd9Sstevel@tonic-gate */ 8547c478bd9Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8557c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 8567c478bd9Sstevel@tonic-gate else { 8577c478bd9Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 8587c478bd9Sstevel@tonic-gate char buffer[8]; 8597c478bd9Sstevel@tonic-gate char obuf[40]; 8607c478bd9Sstevel@tonic-gate 8617c478bd9Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 8627c478bd9Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 8637c478bd9Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 8647c478bd9Sstevel@tonic-gate (void) strcat(obuf, 8657c478bd9Sstevel@tonic-gate (nb == sp->len)? 8667c478bd9Sstevel@tonic-gate (const char *)"\"" : (const char *)"\".."); 8677c478bd9Sstevel@tonic-gate (void) fputs(obuf, stdout); 8687c478bd9Sstevel@tonic-gate } 8697c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 8707c478bd9Sstevel@tonic-gate if (dump && sp->len > 8) 8717c478bd9Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 8727c478bd9Sstevel@tonic-gate } 8737c478bd9Sstevel@tonic-gate } 8747c478bd9Sstevel@tonic-gate 8757c478bd9Sstevel@tonic-gate #ifdef _LP64 8767c478bd9Sstevel@tonic-gate void 8777c478bd9Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump) 8787c478bd9Sstevel@tonic-gate { 8797c478bd9Sstevel@tonic-gate (void) printf( 8807c478bd9Sstevel@tonic-gate "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX", 8817c478bd9Sstevel@tonic-gate pri->pname, 8827c478bd9Sstevel@tonic-gate name, 8837c478bd9Sstevel@tonic-gate sp->maxlen, 8847c478bd9Sstevel@tonic-gate sp->len, 8857c478bd9Sstevel@tonic-gate (long)sp->buf); 8867c478bd9Sstevel@tonic-gate /* 8877c478bd9Sstevel@tonic-gate * Should we show the buffer contents? 8887c478bd9Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options? 8897c478bd9Sstevel@tonic-gate */ 8907c478bd9Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0) 8917c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 8927c478bd9Sstevel@tonic-gate else { 8937c478bd9Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len; 8947c478bd9Sstevel@tonic-gate char buffer[8]; 8957c478bd9Sstevel@tonic-gate char obuf[40]; 8967c478bd9Sstevel@tonic-gate 8977c478bd9Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) { 8987c478bd9Sstevel@tonic-gate (void) strcpy(obuf, ": \""); 8997c478bd9Sstevel@tonic-gate showbytes(buffer, nb, obuf+3); 9007c478bd9Sstevel@tonic-gate (void) strcat(obuf, 9017c478bd9Sstevel@tonic-gate (nb == sp->len)? 9027c478bd9Sstevel@tonic-gate (const char *)"\"" : (const char *)"\".."); 9037c478bd9Sstevel@tonic-gate (void) fputs(obuf, stdout); 9047c478bd9Sstevel@tonic-gate } 9057c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 9067c478bd9Sstevel@tonic-gate if (dump && sp->len > 8) 9077c478bd9Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len); 9087c478bd9Sstevel@tonic-gate } 9097c478bd9Sstevel@tonic-gate } 9107c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 9117c478bd9Sstevel@tonic-gate 9127c478bd9Sstevel@tonic-gate /* strpeek and strfdinsert flags word */ 9137c478bd9Sstevel@tonic-gate const char * 9147c478bd9Sstevel@tonic-gate strflags(private_t *pri, int flags) 9157c478bd9Sstevel@tonic-gate { 9167c478bd9Sstevel@tonic-gate const char *s; 9177c478bd9Sstevel@tonic-gate 9187c478bd9Sstevel@tonic-gate switch (flags) { 9197c478bd9Sstevel@tonic-gate case 0: 9207c478bd9Sstevel@tonic-gate s = "0"; 9217c478bd9Sstevel@tonic-gate break; 9227c478bd9Sstevel@tonic-gate case RS_HIPRI: 9237c478bd9Sstevel@tonic-gate s = "RS_HIPRI"; 9247c478bd9Sstevel@tonic-gate break; 9257c478bd9Sstevel@tonic-gate default: 9267c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "0x%.4X", flags); 9277c478bd9Sstevel@tonic-gate s = pri->code_buf; 9287c478bd9Sstevel@tonic-gate } 9297c478bd9Sstevel@tonic-gate 9307c478bd9Sstevel@tonic-gate return (s); 9317c478bd9Sstevel@tonic-gate } 9327c478bd9Sstevel@tonic-gate 9337c478bd9Sstevel@tonic-gate void 9347c478bd9Sstevel@tonic-gate show_strpeek(private_t *pri, long offset) 9357c478bd9Sstevel@tonic-gate { 9367c478bd9Sstevel@tonic-gate struct strpeek strpeek; 9377c478bd9Sstevel@tonic-gate 9387c478bd9Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9397c478bd9Sstevel@tonic-gate == sizeof (strpeek)) { 9407c478bd9Sstevel@tonic-gate 9417c478bd9Sstevel@tonic-gate print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE); 9427c478bd9Sstevel@tonic-gate print_strbuf(pri, &strpeek.databuf, "dat", FALSE); 9437c478bd9Sstevel@tonic-gate 9447c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9457c478bd9Sstevel@tonic-gate pri->pname, 9467c478bd9Sstevel@tonic-gate strflags(pri, strpeek.flags)); 9477c478bd9Sstevel@tonic-gate } 9487c478bd9Sstevel@tonic-gate } 9497c478bd9Sstevel@tonic-gate 9507c478bd9Sstevel@tonic-gate #ifdef _LP64 9517c478bd9Sstevel@tonic-gate void 9527c478bd9Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset) 9537c478bd9Sstevel@tonic-gate { 9547c478bd9Sstevel@tonic-gate struct strpeek32 strpeek; 9557c478bd9Sstevel@tonic-gate 9567c478bd9Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset) 9577c478bd9Sstevel@tonic-gate == sizeof (strpeek)) { 9587c478bd9Sstevel@tonic-gate 9597c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE); 9607c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strpeek.databuf, "dat", FALSE); 9617c478bd9Sstevel@tonic-gate 9627c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s\n", 9637c478bd9Sstevel@tonic-gate pri->pname, 9647c478bd9Sstevel@tonic-gate strflags(pri, strpeek.flags)); 9657c478bd9Sstevel@tonic-gate } 9667c478bd9Sstevel@tonic-gate } 9677c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 9687c478bd9Sstevel@tonic-gate 9697c478bd9Sstevel@tonic-gate void 9707c478bd9Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset) 9717c478bd9Sstevel@tonic-gate { 9727c478bd9Sstevel@tonic-gate struct strfdinsert strfdinsert; 9737c478bd9Sstevel@tonic-gate 9747c478bd9Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 9757c478bd9Sstevel@tonic-gate sizeof (strfdinsert)) { 9767c478bd9Sstevel@tonic-gate 9777c478bd9Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 9787c478bd9Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE); 9797c478bd9Sstevel@tonic-gate 9807c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 9817c478bd9Sstevel@tonic-gate pri->pname, 9827c478bd9Sstevel@tonic-gate strflags(pri, strfdinsert.flags), 9837c478bd9Sstevel@tonic-gate strfdinsert.fildes, 9847c478bd9Sstevel@tonic-gate strfdinsert.offset); 9857c478bd9Sstevel@tonic-gate } 9867c478bd9Sstevel@tonic-gate } 9877c478bd9Sstevel@tonic-gate 9887c478bd9Sstevel@tonic-gate #ifdef _LP64 9897c478bd9Sstevel@tonic-gate void 9907c478bd9Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset) 9917c478bd9Sstevel@tonic-gate { 9927c478bd9Sstevel@tonic-gate struct strfdinsert32 strfdinsert; 9937c478bd9Sstevel@tonic-gate 9947c478bd9Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) == 9957c478bd9Sstevel@tonic-gate sizeof (strfdinsert)) { 9967c478bd9Sstevel@tonic-gate 9977c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE); 9987c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE); 9997c478bd9Sstevel@tonic-gate 10007c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n", 10017c478bd9Sstevel@tonic-gate pri->pname, 10027c478bd9Sstevel@tonic-gate strflags(pri, strfdinsert.flags), 10037c478bd9Sstevel@tonic-gate strfdinsert.fildes, 10047c478bd9Sstevel@tonic-gate strfdinsert.offset); 10057c478bd9Sstevel@tonic-gate } 10067c478bd9Sstevel@tonic-gate } 10077c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 10087c478bd9Sstevel@tonic-gate 10097c478bd9Sstevel@tonic-gate void 10107c478bd9Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset) 10117c478bd9Sstevel@tonic-gate { 10127c478bd9Sstevel@tonic-gate struct strrecvfd strrecvfd; 10137c478bd9Sstevel@tonic-gate 10147c478bd9Sstevel@tonic-gate if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) == 10157c478bd9Sstevel@tonic-gate sizeof (strrecvfd)) { 10167c478bd9Sstevel@tonic-gate (void) printf( 10177c478bd9Sstevel@tonic-gate "%s\tfd=%-5d uid=%-5d gid=%d\n", 10187c478bd9Sstevel@tonic-gate pri->pname, 10197c478bd9Sstevel@tonic-gate strrecvfd.fd, 10207c478bd9Sstevel@tonic-gate (int)strrecvfd.uid, 10217c478bd9Sstevel@tonic-gate (int)strrecvfd.gid); 10227c478bd9Sstevel@tonic-gate } 10237c478bd9Sstevel@tonic-gate } 10247c478bd9Sstevel@tonic-gate 10257c478bd9Sstevel@tonic-gate void 10267c478bd9Sstevel@tonic-gate show_strlist(private_t *pri, long offset) 10277c478bd9Sstevel@tonic-gate { 10287c478bd9Sstevel@tonic-gate struct str_list strlist; 10297c478bd9Sstevel@tonic-gate struct str_mlist list; 10307c478bd9Sstevel@tonic-gate int count; 10317c478bd9Sstevel@tonic-gate 10327c478bd9Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10337c478bd9Sstevel@tonic-gate sizeof (strlist)) { 10347c478bd9Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10357c478bd9Sstevel@tonic-gate pri->pname, 10367c478bd9Sstevel@tonic-gate strlist.sl_nmods, 10377c478bd9Sstevel@tonic-gate (long)strlist.sl_modlist); 10387c478bd9Sstevel@tonic-gate 10397c478bd9Sstevel@tonic-gate count = strlist.sl_nmods; 10407c478bd9Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10417c478bd9Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10427c478bd9Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10437c478bd9Sstevel@tonic-gate sizeof (list)) 10447c478bd9Sstevel@tonic-gate break; 10457c478bd9Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10467c478bd9Sstevel@tonic-gate pri->pname, 10477c478bd9Sstevel@tonic-gate (int)sizeof (list.l_name), 10487c478bd9Sstevel@tonic-gate list.l_name); 10497c478bd9Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10507c478bd9Sstevel@tonic-gate } 10517c478bd9Sstevel@tonic-gate } 10527c478bd9Sstevel@tonic-gate } 10537c478bd9Sstevel@tonic-gate 10547c478bd9Sstevel@tonic-gate #ifdef _LP64 10557c478bd9Sstevel@tonic-gate void 10567c478bd9Sstevel@tonic-gate show_strlist32(private_t *pri, long offset) 10577c478bd9Sstevel@tonic-gate { 10587c478bd9Sstevel@tonic-gate struct str_list32 strlist; 10597c478bd9Sstevel@tonic-gate struct str_mlist list; 10607c478bd9Sstevel@tonic-gate int count; 10617c478bd9Sstevel@tonic-gate 10627c478bd9Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) == 10637c478bd9Sstevel@tonic-gate sizeof (strlist)) { 10647c478bd9Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n", 10657c478bd9Sstevel@tonic-gate pri->pname, 10667c478bd9Sstevel@tonic-gate strlist.sl_nmods, 10677c478bd9Sstevel@tonic-gate (long)strlist.sl_modlist); 10687c478bd9Sstevel@tonic-gate 10697c478bd9Sstevel@tonic-gate count = strlist.sl_nmods; 10707c478bd9Sstevel@tonic-gate offset = (long)strlist.sl_modlist; 10717c478bd9Sstevel@tonic-gate while (!interrupt && --count >= 0) { 10727c478bd9Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) != 10737c478bd9Sstevel@tonic-gate sizeof (list)) 10747c478bd9Sstevel@tonic-gate break; 10757c478bd9Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n", 10767c478bd9Sstevel@tonic-gate pri->pname, 10777c478bd9Sstevel@tonic-gate (int)sizeof (list.l_name), 10787c478bd9Sstevel@tonic-gate list.l_name); 10797c478bd9Sstevel@tonic-gate offset += sizeof (struct str_mlist); 10807c478bd9Sstevel@tonic-gate } 10817c478bd9Sstevel@tonic-gate } 10827c478bd9Sstevel@tonic-gate } 10837c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 10847c478bd9Sstevel@tonic-gate 10857c478bd9Sstevel@tonic-gate void 10867c478bd9Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset) 10877c478bd9Sstevel@tonic-gate { 10887c478bd9Sstevel@tonic-gate struct jwinsize jwinsize; 10897c478bd9Sstevel@tonic-gate 10907c478bd9Sstevel@tonic-gate if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) == 10917c478bd9Sstevel@tonic-gate sizeof (jwinsize)) { 10927c478bd9Sstevel@tonic-gate (void) printf( 10937c478bd9Sstevel@tonic-gate "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n", 10947c478bd9Sstevel@tonic-gate pri->pname, 10957c478bd9Sstevel@tonic-gate (unsigned)jwinsize.bytesx, 10967c478bd9Sstevel@tonic-gate (unsigned)jwinsize.bytesy, 10977c478bd9Sstevel@tonic-gate (unsigned)jwinsize.bitsx, 10987c478bd9Sstevel@tonic-gate (unsigned)jwinsize.bitsy); 10997c478bd9Sstevel@tonic-gate } 11007c478bd9Sstevel@tonic-gate } 11017c478bd9Sstevel@tonic-gate 11027c478bd9Sstevel@tonic-gate void 11037c478bd9Sstevel@tonic-gate show_winsize(private_t *pri, long offset) 11047c478bd9Sstevel@tonic-gate { 11057c478bd9Sstevel@tonic-gate struct winsize winsize; 11067c478bd9Sstevel@tonic-gate 11077c478bd9Sstevel@tonic-gate if (Pread(Proc, &winsize, sizeof (winsize), offset) 11087c478bd9Sstevel@tonic-gate == sizeof (winsize)) { 11097c478bd9Sstevel@tonic-gate (void) printf( 11107c478bd9Sstevel@tonic-gate "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n", 11117c478bd9Sstevel@tonic-gate pri->pname, 11127c478bd9Sstevel@tonic-gate winsize.ws_row, 11137c478bd9Sstevel@tonic-gate winsize.ws_col, 11147c478bd9Sstevel@tonic-gate winsize.ws_xpixel, 11157c478bd9Sstevel@tonic-gate winsize.ws_ypixel); 11167c478bd9Sstevel@tonic-gate } 11177c478bd9Sstevel@tonic-gate } 11187c478bd9Sstevel@tonic-gate 11197c478bd9Sstevel@tonic-gate struct audio_stuff { 11207c478bd9Sstevel@tonic-gate uint_t bit; 11217c478bd9Sstevel@tonic-gate const char *str; 11227c478bd9Sstevel@tonic-gate }; 11237c478bd9Sstevel@tonic-gate 11247c478bd9Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = { 11257c478bd9Sstevel@tonic-gate { AUDIO_SPEAKER, "SPEAKER" }, 11267c478bd9Sstevel@tonic-gate { AUDIO_HEADPHONE, "HEADPHONE" }, 11277c478bd9Sstevel@tonic-gate { AUDIO_LINE_OUT, "LINE_OUT" }, 11287c478bd9Sstevel@tonic-gate { AUDIO_SPDIF_OUT, "SPDIF_OUT" }, 11297c478bd9Sstevel@tonic-gate { AUDIO_AUX1_OUT, "AUX1_OUT" }, 11307c478bd9Sstevel@tonic-gate { AUDIO_AUX2_OUT, "AUX2_OUT" }, 11317c478bd9Sstevel@tonic-gate { 0, NULL } 11327c478bd9Sstevel@tonic-gate }; 11337c478bd9Sstevel@tonic-gate 11347c478bd9Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = { 11357c478bd9Sstevel@tonic-gate { AUDIO_MICROPHONE, "MICROPHONE" }, 11367c478bd9Sstevel@tonic-gate { AUDIO_LINE_IN, "LINE_IN" }, 11377c478bd9Sstevel@tonic-gate { AUDIO_CD, "CD" }, 11387c478bd9Sstevel@tonic-gate { AUDIO_SPDIF_IN, "SPDIF_IN" }, 11397c478bd9Sstevel@tonic-gate { AUDIO_AUX1_IN, "AUX1_IN" }, 11407c478bd9Sstevel@tonic-gate { AUDIO_AUX2_IN, "AUX2_IN" }, 11417c478bd9Sstevel@tonic-gate { AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" }, 11427c478bd9Sstevel@tonic-gate { AUDIO_SUNVTS, "SUNVTS" }, 11437c478bd9Sstevel@tonic-gate { 0, NULL } 11447c478bd9Sstevel@tonic-gate }; 11457c478bd9Sstevel@tonic-gate 11467c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = { 11477c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_DUPLEX, "DUPLEX" }, 11487c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_MSCODEC, "MSCODEC" }, 11497c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_IN2OUT, "IN2OUT" }, 11507c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_PLAY, "PLAY" }, 11517c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_RECORD, "RECORD" }, 11527c478bd9Sstevel@tonic-gate { 0, NULL } 11537c478bd9Sstevel@tonic-gate }; 11547c478bd9Sstevel@tonic-gate 11557c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = { 11567c478bd9Sstevel@tonic-gate { AUDIO_SWFEATURE_MIXER, "MIXER" }, 11577c478bd9Sstevel@tonic-gate { 0, NULL } 11587c478bd9Sstevel@tonic-gate }; 11597c478bd9Sstevel@tonic-gate 11607c478bd9Sstevel@tonic-gate void 11617c478bd9Sstevel@tonic-gate show_audio_features(const private_t *pri, 11627c478bd9Sstevel@tonic-gate const struct audio_stuff *audio_porttab, uint_t features, 11637c478bd9Sstevel@tonic-gate const char *name) 11647c478bd9Sstevel@tonic-gate { 11657c478bd9Sstevel@tonic-gate (void) printf("%s\t%s=", pri->pname, name); 11667c478bd9Sstevel@tonic-gate if (features == 0) { 11677c478bd9Sstevel@tonic-gate (void) printf("0\n"); 11687c478bd9Sstevel@tonic-gate return; 11697c478bd9Sstevel@tonic-gate } 11707c478bd9Sstevel@tonic-gate 11717c478bd9Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 11727c478bd9Sstevel@tonic-gate if (features & audio_porttab->bit) { 11737c478bd9Sstevel@tonic-gate (void) printf(audio_porttab->str); 11747c478bd9Sstevel@tonic-gate features &= ~audio_porttab->bit; 11757c478bd9Sstevel@tonic-gate if (features) 11767c478bd9Sstevel@tonic-gate (void) putchar('|'); 11777c478bd9Sstevel@tonic-gate } 11787c478bd9Sstevel@tonic-gate } 11797c478bd9Sstevel@tonic-gate if (features) 11807c478bd9Sstevel@tonic-gate (void) printf("0x%x", features); 11817c478bd9Sstevel@tonic-gate (void) putchar('\n'); 11827c478bd9Sstevel@tonic-gate } 11837c478bd9Sstevel@tonic-gate 11847c478bd9Sstevel@tonic-gate void 11857c478bd9Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode, 11867c478bd9Sstevel@tonic-gate const char *field, uint_t ports) 11877c478bd9Sstevel@tonic-gate { 11887c478bd9Sstevel@tonic-gate const struct audio_stuff *audio_porttab; 11897c478bd9Sstevel@tonic-gate 11907c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\t%s=", pri->pname, mode, field); 11917c478bd9Sstevel@tonic-gate if (ports == 0) { 11927c478bd9Sstevel@tonic-gate (void) printf("0\n"); 11937c478bd9Sstevel@tonic-gate return; 11947c478bd9Sstevel@tonic-gate } 11957c478bd9Sstevel@tonic-gate if (*mode == 'p') 11967c478bd9Sstevel@tonic-gate audio_porttab = audio_output_ports; 11977c478bd9Sstevel@tonic-gate else 11987c478bd9Sstevel@tonic-gate audio_porttab = audio_input_ports; 11997c478bd9Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) { 12007c478bd9Sstevel@tonic-gate if (ports & audio_porttab->bit) { 12017c478bd9Sstevel@tonic-gate (void) printf(audio_porttab->str); 12027c478bd9Sstevel@tonic-gate ports &= ~audio_porttab->bit; 12037c478bd9Sstevel@tonic-gate if (ports) 12047c478bd9Sstevel@tonic-gate (void) putchar('|'); 12057c478bd9Sstevel@tonic-gate } 12067c478bd9Sstevel@tonic-gate } 12077c478bd9Sstevel@tonic-gate if (ports) 12087c478bd9Sstevel@tonic-gate (void) printf("0x%x", ports); 12097c478bd9Sstevel@tonic-gate (void) putchar('\n'); 12107c478bd9Sstevel@tonic-gate } 12117c478bd9Sstevel@tonic-gate 12127c478bd9Sstevel@tonic-gate void 12137c478bd9Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr) 12147c478bd9Sstevel@tonic-gate { 12157c478bd9Sstevel@tonic-gate const char *s; 12167c478bd9Sstevel@tonic-gate 12177c478bd9Sstevel@tonic-gate /* 12187c478bd9Sstevel@tonic-gate * The following values describe the audio data encoding. 12197c478bd9Sstevel@tonic-gate */ 12207c478bd9Sstevel@tonic-gate 12217c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n", 12227c478bd9Sstevel@tonic-gate pri->pname, mode, 12237c478bd9Sstevel@tonic-gate au_pr->sample_rate, 12247c478bd9Sstevel@tonic-gate au_pr->channels, 12257c478bd9Sstevel@tonic-gate au_pr->precision); 12267c478bd9Sstevel@tonic-gate 12277c478bd9Sstevel@tonic-gate s = NULL; 12287c478bd9Sstevel@tonic-gate switch (au_pr->encoding) { 12297c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_NONE: s = "NONE"; break; 12307c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_ULAW: s = "ULAW"; break; 12317c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_ALAW: s = "ALAW"; break; 12327c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR: s = "LINEAR"; break; 12337c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_DVI: s = "DVI"; break; 12347c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR8: s = "LINEAR8"; break; 12357c478bd9Sstevel@tonic-gate } 12367c478bd9Sstevel@tonic-gate if (s) 12377c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s); 12387c478bd9Sstevel@tonic-gate else { 12397c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%u\n", 12407c478bd9Sstevel@tonic-gate pri->pname, mode, au_pr->encoding); 12417c478bd9Sstevel@tonic-gate } 12427c478bd9Sstevel@tonic-gate 12437c478bd9Sstevel@tonic-gate /* 12447c478bd9Sstevel@tonic-gate * The following values control audio device configuration 12457c478bd9Sstevel@tonic-gate */ 12467c478bd9Sstevel@tonic-gate 12477c478bd9Sstevel@tonic-gate (void) printf( 12487c478bd9Sstevel@tonic-gate "%s\t%s\tgain=%u buffer_size=%u\n", 12497c478bd9Sstevel@tonic-gate pri->pname, mode, 12507c478bd9Sstevel@tonic-gate au_pr->gain, 12517c478bd9Sstevel@tonic-gate au_pr->buffer_size); 12527c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "port", au_pr->port); 12537c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports); 12547c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports); 12557c478bd9Sstevel@tonic-gate 12567c478bd9Sstevel@tonic-gate /* 12577c478bd9Sstevel@tonic-gate * The following values describe driver state 12587c478bd9Sstevel@tonic-gate */ 12597c478bd9Sstevel@tonic-gate 12607c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n", 12617c478bd9Sstevel@tonic-gate pri->pname, mode, 12627c478bd9Sstevel@tonic-gate au_pr->samples, 12637c478bd9Sstevel@tonic-gate au_pr->eof, 12647c478bd9Sstevel@tonic-gate au_pr->pause, 12657c478bd9Sstevel@tonic-gate au_pr->error); 12667c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n", 12677c478bd9Sstevel@tonic-gate pri->pname, mode, 12687c478bd9Sstevel@tonic-gate au_pr->waiting, 12697c478bd9Sstevel@tonic-gate au_pr->balance, 12707c478bd9Sstevel@tonic-gate au_pr->minordev); 12717c478bd9Sstevel@tonic-gate 12727c478bd9Sstevel@tonic-gate /* 12737c478bd9Sstevel@tonic-gate * The following values are read-only state flags 12747c478bd9Sstevel@tonic-gate */ 12757c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\topen=%u active=%u\n", 12767c478bd9Sstevel@tonic-gate pri->pname, mode, 12777c478bd9Sstevel@tonic-gate au_pr->open, 12787c478bd9Sstevel@tonic-gate au_pr->active); 12797c478bd9Sstevel@tonic-gate } 12807c478bd9Sstevel@tonic-gate 12817c478bd9Sstevel@tonic-gate void 12827c478bd9Sstevel@tonic-gate show_audio_info(private_t *pri, long offset) 12837c478bd9Sstevel@tonic-gate { 12847c478bd9Sstevel@tonic-gate struct audio_info au; 12857c478bd9Sstevel@tonic-gate 12867c478bd9Sstevel@tonic-gate if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) { 12877c478bd9Sstevel@tonic-gate show_audio_prinfo(pri, "play", &au.play); 12887c478bd9Sstevel@tonic-gate show_audio_prinfo(pri, "record", &au.record); 12897c478bd9Sstevel@tonic-gate (void) printf("%s\tmonitor_gain=%u output_muted=%u\n", 12907c478bd9Sstevel@tonic-gate pri->pname, au.monitor_gain, au.output_muted); 12917c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_hw_features, au.hw_features, 12927c478bd9Sstevel@tonic-gate "hw_features"); 12937c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, au.sw_features, 12947c478bd9Sstevel@tonic-gate "sw_features"); 12957c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, 12967c478bd9Sstevel@tonic-gate au.sw_features_enabled, "sw_features_enabled"); 12977c478bd9Sstevel@tonic-gate } 12987c478bd9Sstevel@tonic-gate } 12997c478bd9Sstevel@tonic-gate 13007c478bd9Sstevel@tonic-gate void 13017c478bd9Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset) 13027c478bd9Sstevel@tonic-gate { 13037c478bd9Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 13047c478bd9Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 13057c478bd9Sstevel@tonic-gate /* for a failed system call */ 13067c478bd9Sstevel@tonic-gate #ifndef _LP64 13077c478bd9Sstevel@tonic-gate if (lp64) 13087c478bd9Sstevel@tonic-gate return; 13097c478bd9Sstevel@tonic-gate #endif 13107c478bd9Sstevel@tonic-gate if (offset == NULL) 13117c478bd9Sstevel@tonic-gate return; 13127c478bd9Sstevel@tonic-gate 13137c478bd9Sstevel@tonic-gate switch (code) { 13147c478bd9Sstevel@tonic-gate case TCGETA: 13157c478bd9Sstevel@tonic-gate if (err) 13167c478bd9Sstevel@tonic-gate break; 13177c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13187c478bd9Sstevel@tonic-gate case TCSETA: 13197c478bd9Sstevel@tonic-gate case TCSETAW: 13207c478bd9Sstevel@tonic-gate case TCSETAF: 13217c478bd9Sstevel@tonic-gate show_termio(pri, offset); 13227c478bd9Sstevel@tonic-gate break; 13237c478bd9Sstevel@tonic-gate case TCGETS: 13247c478bd9Sstevel@tonic-gate if (err) 13257c478bd9Sstevel@tonic-gate break; 13267c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13277c478bd9Sstevel@tonic-gate case TCSETS: 13287c478bd9Sstevel@tonic-gate case TCSETSW: 13297c478bd9Sstevel@tonic-gate case TCSETSF: 13307c478bd9Sstevel@tonic-gate show_termios(pri, offset); 13317c478bd9Sstevel@tonic-gate break; 13327c478bd9Sstevel@tonic-gate case TCGETX: 13337c478bd9Sstevel@tonic-gate if (err) 13347c478bd9Sstevel@tonic-gate break; 13357c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13367c478bd9Sstevel@tonic-gate case TCSETX: 13377c478bd9Sstevel@tonic-gate case TCSETXW: 13387c478bd9Sstevel@tonic-gate case TCSETXF: 13397c478bd9Sstevel@tonic-gate show_termiox(pri, offset); 13407c478bd9Sstevel@tonic-gate break; 13417c478bd9Sstevel@tonic-gate case TIOCGETP: 13427c478bd9Sstevel@tonic-gate if (err) 13437c478bd9Sstevel@tonic-gate break; 13447c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13457c478bd9Sstevel@tonic-gate case TIOCSETN: 13467c478bd9Sstevel@tonic-gate case TIOCSETP: 13477c478bd9Sstevel@tonic-gate show_sgttyb(pri, offset); 13487c478bd9Sstevel@tonic-gate break; 13497c478bd9Sstevel@tonic-gate case TIOCGLTC: 13507c478bd9Sstevel@tonic-gate if (err) 13517c478bd9Sstevel@tonic-gate break; 13527c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13537c478bd9Sstevel@tonic-gate case TIOCSLTC: 13547c478bd9Sstevel@tonic-gate show_ltchars(pri, offset); 13557c478bd9Sstevel@tonic-gate break; 13567c478bd9Sstevel@tonic-gate case TIOCGETC: 13577c478bd9Sstevel@tonic-gate if (err) 13587c478bd9Sstevel@tonic-gate break; 13597c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13607c478bd9Sstevel@tonic-gate case TIOCSETC: 13617c478bd9Sstevel@tonic-gate show_tchars(pri, offset); 13627c478bd9Sstevel@tonic-gate break; 13637c478bd9Sstevel@tonic-gate case LDGETT: 13647c478bd9Sstevel@tonic-gate if (err) 13657c478bd9Sstevel@tonic-gate break; 13667c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 13677c478bd9Sstevel@tonic-gate case LDSETT: 13687c478bd9Sstevel@tonic-gate show_termcb(pri, offset); 13697c478bd9Sstevel@tonic-gate break; 13707c478bd9Sstevel@tonic-gate /* streams ioctl()s */ 13717c478bd9Sstevel@tonic-gate #if 0 13727c478bd9Sstevel@tonic-gate /* these are displayed as strings in the arg list */ 13737c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13747c478bd9Sstevel@tonic-gate case I_PUSH: 13757c478bd9Sstevel@tonic-gate case I_LOOK: 13767c478bd9Sstevel@tonic-gate case I_FIND: 13777c478bd9Sstevel@tonic-gate /* these are displayed as decimal in the arg list */ 13787c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13797c478bd9Sstevel@tonic-gate case I_LINK: 13807c478bd9Sstevel@tonic-gate case I_UNLINK: 13817c478bd9Sstevel@tonic-gate case I_SENDFD: 13827c478bd9Sstevel@tonic-gate /* these are displayed symbolically in the arg list */ 13837c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */ 13847c478bd9Sstevel@tonic-gate case I_SRDOPT: 13857c478bd9Sstevel@tonic-gate case I_SETSIG: 13867c478bd9Sstevel@tonic-gate case I_FLUSH: 13877c478bd9Sstevel@tonic-gate break; 13887c478bd9Sstevel@tonic-gate /* this one just ignores the argument */ 13897c478bd9Sstevel@tonic-gate case I_POP: 13907c478bd9Sstevel@tonic-gate break; 13917c478bd9Sstevel@tonic-gate #endif 13927c478bd9Sstevel@tonic-gate /* these return something in an int pointed to by arg */ 13937c478bd9Sstevel@tonic-gate case I_NREAD: 13947c478bd9Sstevel@tonic-gate case I_GRDOPT: 13957c478bd9Sstevel@tonic-gate case I_GETSIG: 13967c478bd9Sstevel@tonic-gate case TIOCGSID: 13977c478bd9Sstevel@tonic-gate case TIOCGPGRP: 13987c478bd9Sstevel@tonic-gate case TIOCLGET: 13997c478bd9Sstevel@tonic-gate case FIONREAD: 14007c478bd9Sstevel@tonic-gate case FIORDCHK: 14017c478bd9Sstevel@tonic-gate if (err) 14027c478bd9Sstevel@tonic-gate break; 14037c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 14047c478bd9Sstevel@tonic-gate /* these pass something in an int pointed to by arg */ 14057c478bd9Sstevel@tonic-gate case TIOCSPGRP: 14067c478bd9Sstevel@tonic-gate case TIOCFLUSH: 14077c478bd9Sstevel@tonic-gate case TIOCLBIS: 14087c478bd9Sstevel@tonic-gate case TIOCLBIC: 14097c478bd9Sstevel@tonic-gate case TIOCLSET: 14107c478bd9Sstevel@tonic-gate show_strint(pri, code, offset); 14117c478bd9Sstevel@tonic-gate break; 14127c478bd9Sstevel@tonic-gate /* these all point to structures */ 14137c478bd9Sstevel@tonic-gate case I_STR: 14147c478bd9Sstevel@tonic-gate #ifdef _LP64 14157c478bd9Sstevel@tonic-gate if (lp64) 14167c478bd9Sstevel@tonic-gate show_strioctl(pri, offset); 14177c478bd9Sstevel@tonic-gate else 14187c478bd9Sstevel@tonic-gate show_strioctl32(pri, offset); 14197c478bd9Sstevel@tonic-gate #else 14207c478bd9Sstevel@tonic-gate show_strioctl(pri, offset); 14217c478bd9Sstevel@tonic-gate #endif 14227c478bd9Sstevel@tonic-gate break; 14237c478bd9Sstevel@tonic-gate case I_PEEK: 14247c478bd9Sstevel@tonic-gate #ifdef _LP64 14257c478bd9Sstevel@tonic-gate if (lp64) 14267c478bd9Sstevel@tonic-gate show_strpeek(pri, offset); 14277c478bd9Sstevel@tonic-gate else 14287c478bd9Sstevel@tonic-gate show_strpeek32(pri, offset); 14297c478bd9Sstevel@tonic-gate #else 14307c478bd9Sstevel@tonic-gate show_strpeek(pri, offset); 14317c478bd9Sstevel@tonic-gate #endif 14327c478bd9Sstevel@tonic-gate break; 14337c478bd9Sstevel@tonic-gate case I_FDINSERT: 14347c478bd9Sstevel@tonic-gate #ifdef _LP64 14357c478bd9Sstevel@tonic-gate if (lp64) 14367c478bd9Sstevel@tonic-gate show_strfdinsert(pri, offset); 14377c478bd9Sstevel@tonic-gate else 14387c478bd9Sstevel@tonic-gate show_strfdinsert32(pri, offset); 14397c478bd9Sstevel@tonic-gate #else 14407c478bd9Sstevel@tonic-gate show_strfdinsert(pri, offset); 14417c478bd9Sstevel@tonic-gate #endif 14427c478bd9Sstevel@tonic-gate break; 14437c478bd9Sstevel@tonic-gate case I_RECVFD: 14447c478bd9Sstevel@tonic-gate if (err) 14457c478bd9Sstevel@tonic-gate break; 14467c478bd9Sstevel@tonic-gate show_strrecvfd(pri, offset); 14477c478bd9Sstevel@tonic-gate break; 14487c478bd9Sstevel@tonic-gate case I_LIST: 14497c478bd9Sstevel@tonic-gate if (err) 14507c478bd9Sstevel@tonic-gate break; 14517c478bd9Sstevel@tonic-gate #ifdef _LP64 14527c478bd9Sstevel@tonic-gate if (lp64) 14537c478bd9Sstevel@tonic-gate show_strlist(pri, offset); 14547c478bd9Sstevel@tonic-gate else 14557c478bd9Sstevel@tonic-gate show_strlist32(pri, offset); 14567c478bd9Sstevel@tonic-gate #else 14577c478bd9Sstevel@tonic-gate show_strlist(pri, offset); 14587c478bd9Sstevel@tonic-gate #endif 14597c478bd9Sstevel@tonic-gate break; 14607c478bd9Sstevel@tonic-gate case JWINSIZE: 14617c478bd9Sstevel@tonic-gate if (err) 14627c478bd9Sstevel@tonic-gate break; 14637c478bd9Sstevel@tonic-gate show_jwinsize(pri, offset); 14647c478bd9Sstevel@tonic-gate break; 14657c478bd9Sstevel@tonic-gate case TIOCGWINSZ: 14667c478bd9Sstevel@tonic-gate if (err) 14677c478bd9Sstevel@tonic-gate break; 14687c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 14697c478bd9Sstevel@tonic-gate case TIOCSWINSZ: 14707c478bd9Sstevel@tonic-gate show_winsize(pri, offset); 14717c478bd9Sstevel@tonic-gate break; 14727c478bd9Sstevel@tonic-gate case AUDIO_GETINFO: 14737c478bd9Sstevel@tonic-gate case (int)AUDIO_SETINFO: 14747c478bd9Sstevel@tonic-gate show_audio_info(pri, offset); 14757c478bd9Sstevel@tonic-gate break; 14767c478bd9Sstevel@tonic-gate 14777c478bd9Sstevel@tonic-gate default: 14787c478bd9Sstevel@tonic-gate if (code & IOC_INOUT) { 14797c478bd9Sstevel@tonic-gate const char *str = ioctldatastruct(code); 14807c478bd9Sstevel@tonic-gate 14817c478bd9Sstevel@tonic-gate (void) printf("\t\t%s", 14827c478bd9Sstevel@tonic-gate (code & IOC_INOUT) == IOC_INOUT ? "write/read" : 14837c478bd9Sstevel@tonic-gate code & IOC_IN ? "write" : "read"); 14847c478bd9Sstevel@tonic-gate if (str != NULL) { 14857c478bd9Sstevel@tonic-gate (void) printf(" (struct %s)\n", str); 14867c478bd9Sstevel@tonic-gate } else { 14877c478bd9Sstevel@tonic-gate (void) printf(" %d bytes\n", 14887c478bd9Sstevel@tonic-gate (code >> 16) & IOCPARM_MASK); 14897c478bd9Sstevel@tonic-gate } 14907c478bd9Sstevel@tonic-gate } 14917c478bd9Sstevel@tonic-gate } 14927c478bd9Sstevel@tonic-gate } 14937c478bd9Sstevel@tonic-gate 14947c478bd9Sstevel@tonic-gate void 14957c478bd9Sstevel@tonic-gate show_statvfs(private_t *pri) 14967c478bd9Sstevel@tonic-gate { 14977c478bd9Sstevel@tonic-gate long offset; 14987c478bd9Sstevel@tonic-gate struct statvfs statvfs; 14997c478bd9Sstevel@tonic-gate char *cp; 15007c478bd9Sstevel@tonic-gate 15017c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15027c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15037c478bd9Sstevel@tonic-gate == sizeof (statvfs)) { 15047c478bd9Sstevel@tonic-gate (void) printf( 15057c478bd9Sstevel@tonic-gate "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n", 15067c478bd9Sstevel@tonic-gate pri->pname, 15077c478bd9Sstevel@tonic-gate statvfs.f_bsize, 15087c478bd9Sstevel@tonic-gate statvfs.f_frsize, 15097c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_blocks, 15107c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_bfree); 15117c478bd9Sstevel@tonic-gate (void) printf( 15127c478bd9Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 15137c478bd9Sstevel@tonic-gate pri->pname, 15147c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_bavail, 15157c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_files, 15167c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_ffree, 15177c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_favail); 15187c478bd9Sstevel@tonic-gate (void) printf( 15197c478bd9Sstevel@tonic-gate "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n", 15207c478bd9Sstevel@tonic-gate pri->pname, 15217c478bd9Sstevel@tonic-gate statvfs.f_fsid, 15227c478bd9Sstevel@tonic-gate statvfs.f_basetype, 15237c478bd9Sstevel@tonic-gate (long)statvfs.f_namemax); 15247c478bd9Sstevel@tonic-gate (void) printf( 15257c478bd9Sstevel@tonic-gate "%s\tflag=%s\n", 15267c478bd9Sstevel@tonic-gate pri->pname, 15277c478bd9Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 15287c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15297c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15307c478bd9Sstevel@tonic-gate *(cp+1) != '\0') 15317c478bd9Sstevel@tonic-gate *cp = ' '; 15327c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15337c478bd9Sstevel@tonic-gate pri->pname, 15347c478bd9Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 15357c478bd9Sstevel@tonic-gate statvfs.f_fstr); 15367c478bd9Sstevel@tonic-gate } 15377c478bd9Sstevel@tonic-gate } 15387c478bd9Sstevel@tonic-gate 15397c478bd9Sstevel@tonic-gate #ifdef _LP64 15407c478bd9Sstevel@tonic-gate void 15417c478bd9Sstevel@tonic-gate show_statvfs32(private_t *pri) 15427c478bd9Sstevel@tonic-gate { 15437c478bd9Sstevel@tonic-gate long offset; 15447c478bd9Sstevel@tonic-gate struct statvfs32 statvfs; 15457c478bd9Sstevel@tonic-gate char *cp; 15467c478bd9Sstevel@tonic-gate 15477c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15487c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15497c478bd9Sstevel@tonic-gate == sizeof (statvfs)) { 15507c478bd9Sstevel@tonic-gate (void) printf( 15517c478bd9Sstevel@tonic-gate "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n", 15527c478bd9Sstevel@tonic-gate pri->pname, 15537c478bd9Sstevel@tonic-gate statvfs.f_bsize, 15547c478bd9Sstevel@tonic-gate statvfs.f_frsize, 15557c478bd9Sstevel@tonic-gate statvfs.f_blocks, 15567c478bd9Sstevel@tonic-gate statvfs.f_bfree); 15577c478bd9Sstevel@tonic-gate (void) printf( 15587c478bd9Sstevel@tonic-gate "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n", 15597c478bd9Sstevel@tonic-gate pri->pname, 15607c478bd9Sstevel@tonic-gate statvfs.f_bavail, 15617c478bd9Sstevel@tonic-gate statvfs.f_files, 15627c478bd9Sstevel@tonic-gate statvfs.f_ffree, 15637c478bd9Sstevel@tonic-gate statvfs.f_favail); 15647c478bd9Sstevel@tonic-gate (void) printf( 15657c478bd9Sstevel@tonic-gate "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 15667c478bd9Sstevel@tonic-gate pri->pname, 15677c478bd9Sstevel@tonic-gate statvfs.f_fsid, 15687c478bd9Sstevel@tonic-gate statvfs.f_basetype, 15697c478bd9Sstevel@tonic-gate (int)statvfs.f_namemax); 15707c478bd9Sstevel@tonic-gate (void) printf( 15717c478bd9Sstevel@tonic-gate "%s\tflag=%s\n", 15727c478bd9Sstevel@tonic-gate pri->pname, 15737c478bd9Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 15747c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 15757c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 15767c478bd9Sstevel@tonic-gate *(cp+1) != '\0') 15777c478bd9Sstevel@tonic-gate *cp = ' '; 15787c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 15797c478bd9Sstevel@tonic-gate pri->pname, 15807c478bd9Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 15817c478bd9Sstevel@tonic-gate statvfs.f_fstr); 15827c478bd9Sstevel@tonic-gate } 15837c478bd9Sstevel@tonic-gate } 15847c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 15857c478bd9Sstevel@tonic-gate 15867c478bd9Sstevel@tonic-gate void 15877c478bd9Sstevel@tonic-gate show_statvfs64(private_t *pri) 15887c478bd9Sstevel@tonic-gate { 15897c478bd9Sstevel@tonic-gate long offset; 15907c478bd9Sstevel@tonic-gate struct statvfs64_32 statvfs; 15917c478bd9Sstevel@tonic-gate char *cp; 15927c478bd9Sstevel@tonic-gate 15937c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != NULL && 15947c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset) 15957c478bd9Sstevel@tonic-gate == sizeof (statvfs)) { 15967c478bd9Sstevel@tonic-gate (void) printf( 15977c478bd9Sstevel@tonic-gate "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n", 15987c478bd9Sstevel@tonic-gate pri->pname, 15997c478bd9Sstevel@tonic-gate statvfs.f_bsize, 16007c478bd9Sstevel@tonic-gate statvfs.f_frsize, 16017c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_blocks, 16027c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_bfree); 16037c478bd9Sstevel@tonic-gate (void) printf( 16047c478bd9Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n", 16057c478bd9Sstevel@tonic-gate pri->pname, 16067c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_bavail, 16077c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_files, 16087c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_ffree, 16097c478bd9Sstevel@tonic-gate (u_longlong_t)statvfs.f_favail); 16107c478bd9Sstevel@tonic-gate (void) printf( 16117c478bd9Sstevel@tonic-gate "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n", 16127c478bd9Sstevel@tonic-gate pri->pname, 16137c478bd9Sstevel@tonic-gate statvfs.f_fsid, 16147c478bd9Sstevel@tonic-gate statvfs.f_basetype, 16157c478bd9Sstevel@tonic-gate (int)statvfs.f_namemax); 16167c478bd9Sstevel@tonic-gate (void) printf( 16177c478bd9Sstevel@tonic-gate "%s\tflag=%s\n", 16187c478bd9Sstevel@tonic-gate pri->pname, 16197c478bd9Sstevel@tonic-gate svfsflags(pri, (ulong_t)statvfs.f_flag)); 16207c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr); 16217c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 && 16227c478bd9Sstevel@tonic-gate *(cp+1) != '\0') 16237c478bd9Sstevel@tonic-gate *cp = ' '; 16247c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n", 16257c478bd9Sstevel@tonic-gate pri->pname, 16267c478bd9Sstevel@tonic-gate (int)sizeof (statvfs.f_fstr), 16277c478bd9Sstevel@tonic-gate statvfs.f_fstr); 16287c478bd9Sstevel@tonic-gate } 16297c478bd9Sstevel@tonic-gate } 16307c478bd9Sstevel@tonic-gate 16317c478bd9Sstevel@tonic-gate void 16327c478bd9Sstevel@tonic-gate show_statfs(private_t *pri) 16337c478bd9Sstevel@tonic-gate { 16347c478bd9Sstevel@tonic-gate long offset; 16357c478bd9Sstevel@tonic-gate struct statfs statfs; 16367c478bd9Sstevel@tonic-gate 16377c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16387c478bd9Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16397c478bd9Sstevel@tonic-gate (void) printf( 16407c478bd9Sstevel@tonic-gate "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n", 16417c478bd9Sstevel@tonic-gate pri->pname, 16427c478bd9Sstevel@tonic-gate statfs.f_fstyp, 16437c478bd9Sstevel@tonic-gate statfs.f_bsize, 16447c478bd9Sstevel@tonic-gate statfs.f_frsize, 16457c478bd9Sstevel@tonic-gate statfs.f_blocks, 16467c478bd9Sstevel@tonic-gate statfs.f_bfree, 16477c478bd9Sstevel@tonic-gate statfs.f_files, 16487c478bd9Sstevel@tonic-gate statfs.f_ffree); 16497c478bd9Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16507c478bd9Sstevel@tonic-gate pri->pname, 16517c478bd9Sstevel@tonic-gate statfs.f_fname, 16527c478bd9Sstevel@tonic-gate statfs.f_fpack); 16537c478bd9Sstevel@tonic-gate } 16547c478bd9Sstevel@tonic-gate } 16557c478bd9Sstevel@tonic-gate 16567c478bd9Sstevel@tonic-gate #ifdef _LP64 16577c478bd9Sstevel@tonic-gate void 16587c478bd9Sstevel@tonic-gate show_statfs32(private_t *pri) 16597c478bd9Sstevel@tonic-gate { 16607c478bd9Sstevel@tonic-gate long offset; 16617c478bd9Sstevel@tonic-gate struct statfs32 statfs; 16627c478bd9Sstevel@tonic-gate 16637c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL && 16647c478bd9Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) { 16657c478bd9Sstevel@tonic-gate (void) printf( 16667c478bd9Sstevel@tonic-gate "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n", 16677c478bd9Sstevel@tonic-gate pri->pname, 16687c478bd9Sstevel@tonic-gate statfs.f_fstyp, 16697c478bd9Sstevel@tonic-gate statfs.f_bsize, 16707c478bd9Sstevel@tonic-gate statfs.f_frsize, 16717c478bd9Sstevel@tonic-gate statfs.f_blocks, 16727c478bd9Sstevel@tonic-gate statfs.f_bfree, 16737c478bd9Sstevel@tonic-gate statfs.f_files, 16747c478bd9Sstevel@tonic-gate statfs.f_ffree); 16757c478bd9Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n", 16767c478bd9Sstevel@tonic-gate pri->pname, 16777c478bd9Sstevel@tonic-gate statfs.f_fname, 16787c478bd9Sstevel@tonic-gate statfs.f_fpack); 16797c478bd9Sstevel@tonic-gate } 16807c478bd9Sstevel@tonic-gate } 16817c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 16827c478bd9Sstevel@tonic-gate 16837c478bd9Sstevel@tonic-gate void 16847c478bd9Sstevel@tonic-gate show_flock32(private_t *pri, long offset) 16857c478bd9Sstevel@tonic-gate { 16867c478bd9Sstevel@tonic-gate struct flock32 flock; 16877c478bd9Sstevel@tonic-gate 16887c478bd9Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 16897c478bd9Sstevel@tonic-gate const char *str = NULL; 16907c478bd9Sstevel@tonic-gate 16917c478bd9Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 16927c478bd9Sstevel@tonic-gate 16937c478bd9Sstevel@tonic-gate switch (flock.l_type) { 16947c478bd9Sstevel@tonic-gate case F_RDLCK: 16957c478bd9Sstevel@tonic-gate str = "F_RDLCK"; 16967c478bd9Sstevel@tonic-gate break; 16977c478bd9Sstevel@tonic-gate case F_WRLCK: 16987c478bd9Sstevel@tonic-gate str = "F_WRLCK"; 16997c478bd9Sstevel@tonic-gate break; 17007c478bd9Sstevel@tonic-gate case F_UNLCK: 17017c478bd9Sstevel@tonic-gate str = "F_UNLCK"; 17027c478bd9Sstevel@tonic-gate break; 17037c478bd9Sstevel@tonic-gate } 17047c478bd9Sstevel@tonic-gate if (str != NULL) 17057c478bd9Sstevel@tonic-gate (void) printf("%s", str); 17067c478bd9Sstevel@tonic-gate else 17077c478bd9Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17087c478bd9Sstevel@tonic-gate 17097c478bd9Sstevel@tonic-gate str = whencearg(flock.l_whence); 17107c478bd9Sstevel@tonic-gate if (str != NULL) 17117c478bd9Sstevel@tonic-gate (void) printf(" whence=%s", str); 17127c478bd9Sstevel@tonic-gate else 17137c478bd9Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17147c478bd9Sstevel@tonic-gate 17157c478bd9Sstevel@tonic-gate (void) printf( 17167c478bd9Sstevel@tonic-gate " start=%-5d len=%-5d sys=%-2u pid=%d\n", 17177c478bd9Sstevel@tonic-gate flock.l_start, 17187c478bd9Sstevel@tonic-gate flock.l_len, 17197c478bd9Sstevel@tonic-gate flock.l_sysid, 17207c478bd9Sstevel@tonic-gate flock.l_pid); 17217c478bd9Sstevel@tonic-gate } 17227c478bd9Sstevel@tonic-gate } 17237c478bd9Sstevel@tonic-gate 17247c478bd9Sstevel@tonic-gate void 17257c478bd9Sstevel@tonic-gate show_flock64(private_t *pri, long offset) 17267c478bd9Sstevel@tonic-gate { 17277c478bd9Sstevel@tonic-gate struct flock64 flock; 17287c478bd9Sstevel@tonic-gate 17297c478bd9Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) { 17307c478bd9Sstevel@tonic-gate const char *str = NULL; 17317c478bd9Sstevel@tonic-gate 17327c478bd9Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname); 17337c478bd9Sstevel@tonic-gate 17347c478bd9Sstevel@tonic-gate switch (flock.l_type) { 17357c478bd9Sstevel@tonic-gate case F_RDLCK: 17367c478bd9Sstevel@tonic-gate str = "F_RDLCK"; 17377c478bd9Sstevel@tonic-gate break; 17387c478bd9Sstevel@tonic-gate case F_WRLCK: 17397c478bd9Sstevel@tonic-gate str = "F_WRLCK"; 17407c478bd9Sstevel@tonic-gate break; 17417c478bd9Sstevel@tonic-gate case F_UNLCK: 17427c478bd9Sstevel@tonic-gate str = "F_UNLCK"; 17437c478bd9Sstevel@tonic-gate break; 17447c478bd9Sstevel@tonic-gate } 17457c478bd9Sstevel@tonic-gate if (str != NULL) 17467c478bd9Sstevel@tonic-gate (void) printf("%s", str); 17477c478bd9Sstevel@tonic-gate else 17487c478bd9Sstevel@tonic-gate (void) printf("%-7d", flock.l_type); 17497c478bd9Sstevel@tonic-gate 17507c478bd9Sstevel@tonic-gate str = whencearg(flock.l_whence); 17517c478bd9Sstevel@tonic-gate if (str != NULL) 17527c478bd9Sstevel@tonic-gate (void) printf(" whence=%s", str); 17537c478bd9Sstevel@tonic-gate else 17547c478bd9Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence); 17557c478bd9Sstevel@tonic-gate 17567c478bd9Sstevel@tonic-gate (void) printf( 17577c478bd9Sstevel@tonic-gate " start=%-5lld len=%-5lld sys=%-2u pid=%d\n", 17587c478bd9Sstevel@tonic-gate (long long)flock.l_start, 17597c478bd9Sstevel@tonic-gate (long long)flock.l_len, 17607c478bd9Sstevel@tonic-gate flock.l_sysid, 17617c478bd9Sstevel@tonic-gate (int)flock.l_pid); 17627c478bd9Sstevel@tonic-gate } 17637c478bd9Sstevel@tonic-gate } 17647c478bd9Sstevel@tonic-gate 17657c478bd9Sstevel@tonic-gate void 17667c478bd9Sstevel@tonic-gate show_share(private_t *pri, long offset) 17677c478bd9Sstevel@tonic-gate { 17687c478bd9Sstevel@tonic-gate struct fshare fshare; 17697c478bd9Sstevel@tonic-gate 17707c478bd9Sstevel@tonic-gate if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) { 17717c478bd9Sstevel@tonic-gate const char *str = NULL; 17727c478bd9Sstevel@tonic-gate int manddny = 0; 17737c478bd9Sstevel@tonic-gate 17747c478bd9Sstevel@tonic-gate (void) printf("%s\taccess=", pri->pname); 17757c478bd9Sstevel@tonic-gate 17767c478bd9Sstevel@tonic-gate switch (fshare.f_access) { 17777c478bd9Sstevel@tonic-gate case F_RDACC: 17787c478bd9Sstevel@tonic-gate str = "F_RDACC"; 17797c478bd9Sstevel@tonic-gate break; 17807c478bd9Sstevel@tonic-gate case F_WRACC: 17817c478bd9Sstevel@tonic-gate str = "F_WRACC"; 17827c478bd9Sstevel@tonic-gate break; 17837c478bd9Sstevel@tonic-gate case F_RWACC: 17847c478bd9Sstevel@tonic-gate str = "F_RWACC"; 17857c478bd9Sstevel@tonic-gate break; 17867c478bd9Sstevel@tonic-gate } 17877c478bd9Sstevel@tonic-gate if (str != NULL) 17887c478bd9Sstevel@tonic-gate (void) printf("%s", str); 17897c478bd9Sstevel@tonic-gate else 17907c478bd9Sstevel@tonic-gate (void) printf("%-7d", fshare.f_access); 17917c478bd9Sstevel@tonic-gate 17927c478bd9Sstevel@tonic-gate str = NULL; 17937c478bd9Sstevel@tonic-gate if (fshare.f_deny & F_MANDDNY) { 17947c478bd9Sstevel@tonic-gate fshare.f_deny &= ~F_MANDDNY; 17957c478bd9Sstevel@tonic-gate manddny = 1; 17967c478bd9Sstevel@tonic-gate } 17977c478bd9Sstevel@tonic-gate switch (fshare.f_deny) { 17987c478bd9Sstevel@tonic-gate case F_NODNY: 17997c478bd9Sstevel@tonic-gate str = "F_NODNY"; 18007c478bd9Sstevel@tonic-gate break; 18017c478bd9Sstevel@tonic-gate case F_RDDNY: 18027c478bd9Sstevel@tonic-gate str = "F_RDDNY"; 18037c478bd9Sstevel@tonic-gate break; 18047c478bd9Sstevel@tonic-gate case F_WRDNY: 18057c478bd9Sstevel@tonic-gate str = "F_WRDNY"; 18067c478bd9Sstevel@tonic-gate break; 18077c478bd9Sstevel@tonic-gate case F_RWDNY: 18087c478bd9Sstevel@tonic-gate str = "F_RWDNY"; 18097c478bd9Sstevel@tonic-gate break; 18107c478bd9Sstevel@tonic-gate case F_COMPAT: 18117c478bd9Sstevel@tonic-gate str = "F_COMPAT"; 18127c478bd9Sstevel@tonic-gate break; 18137c478bd9Sstevel@tonic-gate } 18147c478bd9Sstevel@tonic-gate if (str != NULL) { 18157c478bd9Sstevel@tonic-gate if (manddny) 18167c478bd9Sstevel@tonic-gate (void) printf(" deny=F_MANDDNY|%s", str); 18177c478bd9Sstevel@tonic-gate else 18187c478bd9Sstevel@tonic-gate (void) printf(" deny=%s", str); 18197c478bd9Sstevel@tonic-gate } else { 18207c478bd9Sstevel@tonic-gate (void) printf(" deny=0x%x", manddny? 18217c478bd9Sstevel@tonic-gate fshare.f_deny | F_MANDDNY : fshare.f_deny); 18227c478bd9Sstevel@tonic-gate } 18237c478bd9Sstevel@tonic-gate 18247c478bd9Sstevel@tonic-gate (void) printf(" id=%x\n", fshare.f_id); 18257c478bd9Sstevel@tonic-gate } 18267c478bd9Sstevel@tonic-gate } 18277c478bd9Sstevel@tonic-gate 18287c478bd9Sstevel@tonic-gate void 18297c478bd9Sstevel@tonic-gate show_ffg(private_t *pri) 18307c478bd9Sstevel@tonic-gate { 18317c478bd9Sstevel@tonic-gate (void) putchar('\t'); 18327c478bd9Sstevel@tonic-gate (void) putchar('\t'); 18337c478bd9Sstevel@tonic-gate prt_ffg(pri, 0, pri->Rval1); 18347c478bd9Sstevel@tonic-gate (void) puts(pri->sys_string); 18357c478bd9Sstevel@tonic-gate } 18367c478bd9Sstevel@tonic-gate 18377c478bd9Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */ 18387c478bd9Sstevel@tonic-gate void 18397c478bd9Sstevel@tonic-gate show_fcntl(private_t *pri) 18407c478bd9Sstevel@tonic-gate { 18417c478bd9Sstevel@tonic-gate long offset; 18427c478bd9Sstevel@tonic-gate 18437c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) { 18447c478bd9Sstevel@tonic-gate show_ffg(pri); 18457c478bd9Sstevel@tonic-gate return; 18467c478bd9Sstevel@tonic-gate } 18477c478bd9Sstevel@tonic-gate 18487c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == NULL) 18497c478bd9Sstevel@tonic-gate return; 18507c478bd9Sstevel@tonic-gate 18517c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) { 18527c478bd9Sstevel@tonic-gate #ifdef _LP64 18537c478bd9Sstevel@tonic-gate case F_GETLK: 18547c478bd9Sstevel@tonic-gate case F_SETLK: 18557c478bd9Sstevel@tonic-gate case F_SETLKW: 18567c478bd9Sstevel@tonic-gate case F_FREESP: 18577c478bd9Sstevel@tonic-gate case F_ALLOCSP: 18587c478bd9Sstevel@tonic-gate case F_SETLK_NBMAND: 18597c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 18607c478bd9Sstevel@tonic-gate show_flock64(pri, offset); 18617c478bd9Sstevel@tonic-gate else 18627c478bd9Sstevel@tonic-gate show_flock32(pri, offset); 18637c478bd9Sstevel@tonic-gate break; 18647c478bd9Sstevel@tonic-gate case 33: /* F_GETLK64 */ 18657c478bd9Sstevel@tonic-gate case 34: /* F_SETLK64 */ 18667c478bd9Sstevel@tonic-gate case 35: /* F_SETLKW64 */ 18677c478bd9Sstevel@tonic-gate case 27: /* F_FREESP64 */ 18687c478bd9Sstevel@tonic-gate case 44: /* F_SETLK64_NBMAND */ 18697c478bd9Sstevel@tonic-gate show_flock64(pri, offset); 18707c478bd9Sstevel@tonic-gate break; 18717c478bd9Sstevel@tonic-gate #else /* _LP64 */ 18727c478bd9Sstevel@tonic-gate case F_GETLK: 18737c478bd9Sstevel@tonic-gate case F_SETLK: 18747c478bd9Sstevel@tonic-gate case F_SETLKW: 18757c478bd9Sstevel@tonic-gate case F_FREESP: 18767c478bd9Sstevel@tonic-gate case F_ALLOCSP: 18777c478bd9Sstevel@tonic-gate case F_SETLK_NBMAND: 18787c478bd9Sstevel@tonic-gate show_flock32(pri, offset); 18797c478bd9Sstevel@tonic-gate break; 18807c478bd9Sstevel@tonic-gate case F_GETLK64: 18817c478bd9Sstevel@tonic-gate case F_SETLK64: 18827c478bd9Sstevel@tonic-gate case F_SETLKW64: 18837c478bd9Sstevel@tonic-gate case F_FREESP64: 18847c478bd9Sstevel@tonic-gate case F_SETLK64_NBMAND: 18857c478bd9Sstevel@tonic-gate show_flock64(pri, offset); 18867c478bd9Sstevel@tonic-gate break; 18877c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 18887c478bd9Sstevel@tonic-gate case F_SHARE: 18897c478bd9Sstevel@tonic-gate case F_UNSHARE: 18907c478bd9Sstevel@tonic-gate show_share(pri, offset); 18917c478bd9Sstevel@tonic-gate break; 18927c478bd9Sstevel@tonic-gate } 18937c478bd9Sstevel@tonic-gate } 18947c478bd9Sstevel@tonic-gate 18957c478bd9Sstevel@tonic-gate void 18967c478bd9Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump) 18977c478bd9Sstevel@tonic-gate { 18987c478bd9Sstevel@tonic-gate struct strbuf strbuf; 18997c478bd9Sstevel@tonic-gate 19007c478bd9Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 19017c478bd9Sstevel@tonic-gate print_strbuf(pri, &strbuf, name, dump); 19027c478bd9Sstevel@tonic-gate } 19037c478bd9Sstevel@tonic-gate 19047c478bd9Sstevel@tonic-gate #ifdef _LP64 19057c478bd9Sstevel@tonic-gate void 19067c478bd9Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump) 19077c478bd9Sstevel@tonic-gate { 19087c478bd9Sstevel@tonic-gate struct strbuf32 strbuf; 19097c478bd9Sstevel@tonic-gate 19107c478bd9Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf)) 19117c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strbuf, name, dump); 19127c478bd9Sstevel@tonic-gate } 19137c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 19147c478bd9Sstevel@tonic-gate 19157c478bd9Sstevel@tonic-gate void 19167c478bd9Sstevel@tonic-gate show_gp_msg(private_t *pri, int what) 19177c478bd9Sstevel@tonic-gate { 19187c478bd9Sstevel@tonic-gate long offset; 19197c478bd9Sstevel@tonic-gate int dump = FALSE; 19207c478bd9Sstevel@tonic-gate int fdp1 = pri->sys_args[0] + 1; 19217c478bd9Sstevel@tonic-gate 19227c478bd9Sstevel@tonic-gate switch (what) { 19237c478bd9Sstevel@tonic-gate case SYS_getmsg: 19247c478bd9Sstevel@tonic-gate case SYS_getpmsg: 19257c478bd9Sstevel@tonic-gate if (pri->Errno == 0 && prismember(&readfd, fdp1)) 19267c478bd9Sstevel@tonic-gate dump = TRUE; 19277c478bd9Sstevel@tonic-gate break; 19287c478bd9Sstevel@tonic-gate case SYS_putmsg: 19297c478bd9Sstevel@tonic-gate case SYS_putpmsg: 19307c478bd9Sstevel@tonic-gate if (prismember(&writefd, fdp1)) 19317c478bd9Sstevel@tonic-gate dump = TRUE; 19327c478bd9Sstevel@tonic-gate break; 19337c478bd9Sstevel@tonic-gate } 19347c478bd9Sstevel@tonic-gate 19357c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 19367c478bd9Sstevel@tonic-gate if (dump) 19377c478bd9Sstevel@tonic-gate Eserialize(); 19387c478bd9Sstevel@tonic-gate 19397c478bd9Sstevel@tonic-gate #ifdef _LP64 19407c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) { 19417c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19427c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19437c478bd9Sstevel@tonic-gate else 19447c478bd9Sstevel@tonic-gate show_strbuf32(pri, offset, "ctl", dump); 19457c478bd9Sstevel@tonic-gate } 19467c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) { 19477c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 19487c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19497c478bd9Sstevel@tonic-gate else 19507c478bd9Sstevel@tonic-gate show_strbuf32(pri, offset, "dat", dump); 19517c478bd9Sstevel@tonic-gate } 19527c478bd9Sstevel@tonic-gate #else /* _LP64 */ 19537c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != NULL) 19547c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump); 19557c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != NULL) 19567c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump); 19577c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 19587c478bd9Sstevel@tonic-gate 19597c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 19607c478bd9Sstevel@tonic-gate if (dump) 19617c478bd9Sstevel@tonic-gate Xserialize(); 19627c478bd9Sstevel@tonic-gate } 19637c478bd9Sstevel@tonic-gate 19647c478bd9Sstevel@tonic-gate void 19657c478bd9Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name) 19667c478bd9Sstevel@tonic-gate { 19677c478bd9Sstevel@tonic-gate int value; 19687c478bd9Sstevel@tonic-gate 19697c478bd9Sstevel@tonic-gate if (offset != 0 && 19707c478bd9Sstevel@tonic-gate Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19717c478bd9Sstevel@tonic-gate (void) printf("%s\t%s:\t%d\n", 19727c478bd9Sstevel@tonic-gate pri->pname, 19737c478bd9Sstevel@tonic-gate name, 19747c478bd9Sstevel@tonic-gate value); 19757c478bd9Sstevel@tonic-gate } 19767c478bd9Sstevel@tonic-gate 19777c478bd9Sstevel@tonic-gate void 19787c478bd9Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name) 19797c478bd9Sstevel@tonic-gate { 19807c478bd9Sstevel@tonic-gate int value; 19817c478bd9Sstevel@tonic-gate 19827c478bd9Sstevel@tonic-gate if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value)) 19837c478bd9Sstevel@tonic-gate (void) printf("%s\t%s:\t0x%.4X\n", 19847c478bd9Sstevel@tonic-gate pri->pname, 19857c478bd9Sstevel@tonic-gate name, 19867c478bd9Sstevel@tonic-gate value); 19877c478bd9Sstevel@tonic-gate } 19887c478bd9Sstevel@tonic-gate 19897c478bd9Sstevel@tonic-gate #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \ 19907c478bd9Sstevel@tonic-gate POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL) 19917c478bd9Sstevel@tonic-gate 19927c478bd9Sstevel@tonic-gate const char * 19937c478bd9Sstevel@tonic-gate pollevent(private_t *pri, int arg) 19947c478bd9Sstevel@tonic-gate { 19957c478bd9Sstevel@tonic-gate char *str = pri->code_buf; 19967c478bd9Sstevel@tonic-gate 19977c478bd9Sstevel@tonic-gate if (arg == 0) 19987c478bd9Sstevel@tonic-gate return ("0"); 19997c478bd9Sstevel@tonic-gate if (arg & ~ALL_POLL_FLAGS) { 20007c478bd9Sstevel@tonic-gate (void) sprintf(str, "0x%-5X", arg); 20017c478bd9Sstevel@tonic-gate return ((const char *)str); 20027c478bd9Sstevel@tonic-gate } 20037c478bd9Sstevel@tonic-gate 20047c478bd9Sstevel@tonic-gate *str = '\0'; 20057c478bd9Sstevel@tonic-gate if (arg & POLLIN) 20067c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLIN"); 20077c478bd9Sstevel@tonic-gate if (arg & POLLPRI) 20087c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLPRI"); 20097c478bd9Sstevel@tonic-gate if (arg & POLLOUT) 20107c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLOUT"); 20117c478bd9Sstevel@tonic-gate if (arg & POLLRDNORM) 20127c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLRDNORM"); 20137c478bd9Sstevel@tonic-gate if (arg & POLLRDBAND) 20147c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLRDBAND"); 20157c478bd9Sstevel@tonic-gate if (arg & POLLWRBAND) 20167c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLWRBAND"); 20177c478bd9Sstevel@tonic-gate if (arg & POLLERR) 20187c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLERR"); 20197c478bd9Sstevel@tonic-gate if (arg & POLLHUP) 20207c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLHUP"); 20217c478bd9Sstevel@tonic-gate if (arg & POLLNVAL) 20227c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLNVAL"); 20237c478bd9Sstevel@tonic-gate 20247c478bd9Sstevel@tonic-gate return ((const char *)(str+1)); 20257c478bd9Sstevel@tonic-gate } 20267c478bd9Sstevel@tonic-gate 20277c478bd9Sstevel@tonic-gate static void 20287c478bd9Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd) 20297c478bd9Sstevel@tonic-gate { 20307c478bd9Sstevel@tonic-gate /* 20317c478bd9Sstevel@tonic-gate * can't print both events and revents in same printf. 20327c478bd9Sstevel@tonic-gate * pollevent() returns a pointer to a TSD location. 20337c478bd9Sstevel@tonic-gate */ 20347c478bd9Sstevel@tonic-gate (void) printf("%s\tfd=%-2d ev=%s", 20357c478bd9Sstevel@tonic-gate pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events)); 20367c478bd9Sstevel@tonic-gate (void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents)); 20377c478bd9Sstevel@tonic-gate } 20387c478bd9Sstevel@tonic-gate 20397c478bd9Sstevel@tonic-gate static void 20407c478bd9Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds) 20417c478bd9Sstevel@tonic-gate { 20427c478bd9Sstevel@tonic-gate struct pollfd pollfd[2]; 20437c478bd9Sstevel@tonic-gate int skip = -1; 20447c478bd9Sstevel@tonic-gate 20457c478bd9Sstevel@tonic-gate for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) { 20467c478bd9Sstevel@tonic-gate if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) != 20477c478bd9Sstevel@tonic-gate sizeof (struct pollfd)) 20487c478bd9Sstevel@tonic-gate continue; 20497c478bd9Sstevel@tonic-gate 20507c478bd9Sstevel@tonic-gate if (skip >= 0 && pollfd[0].fd == pollfd[1].fd && 20517c478bd9Sstevel@tonic-gate pollfd[0].events == pollfd[1].events && 20527c478bd9Sstevel@tonic-gate pollfd[0].revents == pollfd[1].revents) { 20537c478bd9Sstevel@tonic-gate skip++; 20547c478bd9Sstevel@tonic-gate continue; 20557c478bd9Sstevel@tonic-gate } 20567c478bd9Sstevel@tonic-gate 20577c478bd9Sstevel@tonic-gate if (skip > 0) 20587c478bd9Sstevel@tonic-gate (void) printf("%s\t...last pollfd structure" 20597c478bd9Sstevel@tonic-gate " repeated %d time%s...\n", 20607c478bd9Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20617c478bd9Sstevel@tonic-gate 20627c478bd9Sstevel@tonic-gate skip = 0; 20637c478bd9Sstevel@tonic-gate show_one_pollfd(pri, &pollfd[0]); 20647c478bd9Sstevel@tonic-gate pollfd[1] = pollfd[0]; 20657c478bd9Sstevel@tonic-gate } 20667c478bd9Sstevel@tonic-gate 20677c478bd9Sstevel@tonic-gate if (skip > 0) 20687c478bd9Sstevel@tonic-gate (void) printf( 20697c478bd9Sstevel@tonic-gate "%s\t...last pollfd structure repeated %d time%s...\n", 20707c478bd9Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s")); 20717c478bd9Sstevel@tonic-gate } 20727c478bd9Sstevel@tonic-gate 20737c478bd9Sstevel@tonic-gate void 20747c478bd9Sstevel@tonic-gate show_poll(private_t *pri) 20757c478bd9Sstevel@tonic-gate { 20767c478bd9Sstevel@tonic-gate long offset; 20777c478bd9Sstevel@tonic-gate int nfds; 20787c478bd9Sstevel@tonic-gate int serial = 0; 20797c478bd9Sstevel@tonic-gate 20807c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 2 || (offset = pri->sys_args[0]) == NULL || 20817c478bd9Sstevel@tonic-gate (nfds = pri->sys_args[1]) <= 0) 20827c478bd9Sstevel@tonic-gate return; 20837c478bd9Sstevel@tonic-gate 20847c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 20857c478bd9Sstevel@tonic-gate if (nfds > 32) { 20867c478bd9Sstevel@tonic-gate Eserialize(); 20877c478bd9Sstevel@tonic-gate serial = 1; 20887c478bd9Sstevel@tonic-gate } 20897c478bd9Sstevel@tonic-gate 20907c478bd9Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds); 20917c478bd9Sstevel@tonic-gate 20927c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 20937c478bd9Sstevel@tonic-gate if (serial) 20947c478bd9Sstevel@tonic-gate Xserialize(); 20957c478bd9Sstevel@tonic-gate } 20967c478bd9Sstevel@tonic-gate 20977c478bd9Sstevel@tonic-gate void 20987c478bd9Sstevel@tonic-gate show_pollsys(private_t *pri) 20997c478bd9Sstevel@tonic-gate { 21007c478bd9Sstevel@tonic-gate long offset; 21017c478bd9Sstevel@tonic-gate int nfds; 21027c478bd9Sstevel@tonic-gate int serial = 0; 21037c478bd9Sstevel@tonic-gate 21047c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 2) 21057c478bd9Sstevel@tonic-gate return; 21067c478bd9Sstevel@tonic-gate 21077c478bd9Sstevel@tonic-gate offset = pri->sys_args[0]; 21087c478bd9Sstevel@tonic-gate nfds = pri->sys_args[1]; 21097c478bd9Sstevel@tonic-gate 21107c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 21117c478bd9Sstevel@tonic-gate if (offset != NULL && nfds > 32) { 21127c478bd9Sstevel@tonic-gate Eserialize(); 21137c478bd9Sstevel@tonic-gate serial = 1; 21147c478bd9Sstevel@tonic-gate } 21157c478bd9Sstevel@tonic-gate 21167c478bd9Sstevel@tonic-gate if (offset != NULL && nfds > 0) 21177c478bd9Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds); 21187c478bd9Sstevel@tonic-gate 21197c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) 21207c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 21217c478bd9Sstevel@tonic-gate 21227c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) 21237c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[3], "sigmask"); 21247c478bd9Sstevel@tonic-gate 21257c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 21267c478bd9Sstevel@tonic-gate if (serial) 21277c478bd9Sstevel@tonic-gate Xserialize(); 21287c478bd9Sstevel@tonic-gate } 21297c478bd9Sstevel@tonic-gate 21307c478bd9Sstevel@tonic-gate static void 21317c478bd9Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip) 21327c478bd9Sstevel@tonic-gate { 21337c478bd9Sstevel@tonic-gate (void) printf("%s\tu=%-5d g=%-5d cu=%-5d cg=%-5d z=%-5d " 21347c478bd9Sstevel@tonic-gate "m=0%.6o key=%d projid=%-5d\n", 21357c478bd9Sstevel@tonic-gate pri->pname, 21367c478bd9Sstevel@tonic-gate (int)ip->ipcx_uid, 21377c478bd9Sstevel@tonic-gate (int)ip->ipcx_gid, 21387c478bd9Sstevel@tonic-gate (int)ip->ipcx_cuid, 21397c478bd9Sstevel@tonic-gate (int)ip->ipcx_cgid, 21407c478bd9Sstevel@tonic-gate (int)ip->ipcx_zoneid, 21417c478bd9Sstevel@tonic-gate (unsigned int)ip->ipcx_mode, 21427c478bd9Sstevel@tonic-gate ip->ipcx_key, 21437c478bd9Sstevel@tonic-gate (int)ip->ipcx_projid); 21447c478bd9Sstevel@tonic-gate } 21457c478bd9Sstevel@tonic-gate 21467c478bd9Sstevel@tonic-gate void 21477c478bd9Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip) 21487c478bd9Sstevel@tonic-gate { 21497c478bd9Sstevel@tonic-gate (void) printf( 21507c478bd9Sstevel@tonic-gate "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21517c478bd9Sstevel@tonic-gate pri->pname, 21527c478bd9Sstevel@tonic-gate (int)ip->uid, 21537c478bd9Sstevel@tonic-gate (int)ip->gid, 21547c478bd9Sstevel@tonic-gate (int)ip->cuid, 21557c478bd9Sstevel@tonic-gate (int)ip->cgid, 21567c478bd9Sstevel@tonic-gate (int)ip->mode, 21577c478bd9Sstevel@tonic-gate ip->seq, 21587c478bd9Sstevel@tonic-gate ip->key); 21597c478bd9Sstevel@tonic-gate } 21607c478bd9Sstevel@tonic-gate 21617c478bd9Sstevel@tonic-gate #ifdef _LP64 21627c478bd9Sstevel@tonic-gate void 21637c478bd9Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip) 21647c478bd9Sstevel@tonic-gate { 21657c478bd9Sstevel@tonic-gate (void) printf( 21667c478bd9Sstevel@tonic-gate "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n", 21677c478bd9Sstevel@tonic-gate pri->pname, 21687c478bd9Sstevel@tonic-gate ip->uid, 21697c478bd9Sstevel@tonic-gate ip->gid, 21707c478bd9Sstevel@tonic-gate ip->cuid, 21717c478bd9Sstevel@tonic-gate ip->cgid, 21727c478bd9Sstevel@tonic-gate ip->mode, 21737c478bd9Sstevel@tonic-gate ip->seq, 21747c478bd9Sstevel@tonic-gate ip->key); 21757c478bd9Sstevel@tonic-gate } 21767c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 21777c478bd9Sstevel@tonic-gate 21787c478bd9Sstevel@tonic-gate static void 21797c478bd9Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset) 21807c478bd9Sstevel@tonic-gate { 21817c478bd9Sstevel@tonic-gate struct msqid_ds64 msgq; 21827c478bd9Sstevel@tonic-gate 21837c478bd9Sstevel@tonic-gate if (offset != NULL && 21847c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 21857c478bd9Sstevel@tonic-gate show_perm64(pri, &msgq.msgx_perm); 21867c478bd9Sstevel@tonic-gate 21877c478bd9Sstevel@tonic-gate (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu " 21887c478bd9Sstevel@tonic-gate "lspid=%-5d lrpid=%-5d\n", pri->pname, 21897c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_cbytes, 21907c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_qnum, 21917c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_qbytes, 21927c478bd9Sstevel@tonic-gate (int)msgq.msgx_lspid, 21937c478bd9Sstevel@tonic-gate (int)msgq.msgx_lrpid); 21947c478bd9Sstevel@tonic-gate 21957c478bd9Sstevel@tonic-gate prtime(pri, " st = ", (time_t)msgq.msgx_stime); 21967c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", (time_t)msgq.msgx_rtime); 21977c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)msgq.msgx_ctime); 21987c478bd9Sstevel@tonic-gate } 21997c478bd9Sstevel@tonic-gate } 22007c478bd9Sstevel@tonic-gate 22017c478bd9Sstevel@tonic-gate void 22027c478bd9Sstevel@tonic-gate show_msgctl(private_t *pri, long offset) 22037c478bd9Sstevel@tonic-gate { 22047c478bd9Sstevel@tonic-gate struct msqid_ds msgq; 22057c478bd9Sstevel@tonic-gate 22067c478bd9Sstevel@tonic-gate if (offset != NULL && 22077c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 22087c478bd9Sstevel@tonic-gate show_perm(pri, &msgq.msg_perm); 22097c478bd9Sstevel@tonic-gate 22107c478bd9Sstevel@tonic-gate (void) printf( 22117c478bd9Sstevel@tonic-gate "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n", 22127c478bd9Sstevel@tonic-gate pri->pname, 22137c478bd9Sstevel@tonic-gate msgq.msg_cbytes, 22147c478bd9Sstevel@tonic-gate msgq.msg_qnum, 22157c478bd9Sstevel@tonic-gate msgq.msg_qbytes, 22167c478bd9Sstevel@tonic-gate (int)msgq.msg_lspid, 22177c478bd9Sstevel@tonic-gate (int)msgq.msg_lrpid); 22187c478bd9Sstevel@tonic-gate 22197c478bd9Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22207c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22217c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22227c478bd9Sstevel@tonic-gate } 22237c478bd9Sstevel@tonic-gate } 22247c478bd9Sstevel@tonic-gate 22257c478bd9Sstevel@tonic-gate #ifdef _LP64 22267c478bd9Sstevel@tonic-gate void 22277c478bd9Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset) 22287c478bd9Sstevel@tonic-gate { 22297c478bd9Sstevel@tonic-gate struct msqid_ds32 msgq; 22307c478bd9Sstevel@tonic-gate 22317c478bd9Sstevel@tonic-gate if (offset != NULL && 22327c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) { 22337c478bd9Sstevel@tonic-gate show_perm32(pri, &msgq.msg_perm); 22347c478bd9Sstevel@tonic-gate 22357c478bd9Sstevel@tonic-gate (void) printf( 22367c478bd9Sstevel@tonic-gate "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n", 22377c478bd9Sstevel@tonic-gate pri->pname, 22387c478bd9Sstevel@tonic-gate msgq.msg_cbytes, 22397c478bd9Sstevel@tonic-gate msgq.msg_qnum, 22407c478bd9Sstevel@tonic-gate msgq.msg_qbytes, 22417c478bd9Sstevel@tonic-gate msgq.msg_lspid, 22427c478bd9Sstevel@tonic-gate msgq.msg_lrpid); 22437c478bd9Sstevel@tonic-gate 22447c478bd9Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime); 22457c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime); 22467c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime); 22477c478bd9Sstevel@tonic-gate } 22487c478bd9Sstevel@tonic-gate } 22497c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 22507c478bd9Sstevel@tonic-gate 22517c478bd9Sstevel@tonic-gate void 22527c478bd9Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz) 22537c478bd9Sstevel@tonic-gate { 22547c478bd9Sstevel@tonic-gate struct msgbuf msgb; 22557c478bd9Sstevel@tonic-gate 22567c478bd9Sstevel@tonic-gate if (offset != NULL && 22577c478bd9Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22587c478bd9Sstevel@tonic-gate sizeof (msgb.mtype)) { 22597c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 22607c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22617c478bd9Sstevel@tonic-gate Eserialize(); 22627c478bd9Sstevel@tonic-gate 22637c478bd9Sstevel@tonic-gate (void) printf("%s\tmtype=%lu mtext[]=\n", 22647c478bd9Sstevel@tonic-gate pri->pname, 22657c478bd9Sstevel@tonic-gate msgb.mtype); 22667c478bd9Sstevel@tonic-gate showbuffer(pri, 22677c478bd9Sstevel@tonic-gate (long)(offset + sizeof (msgb.mtype)), msgsz); 22687c478bd9Sstevel@tonic-gate 22697c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 22707c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22717c478bd9Sstevel@tonic-gate Xserialize(); 22727c478bd9Sstevel@tonic-gate } 22737c478bd9Sstevel@tonic-gate } 22747c478bd9Sstevel@tonic-gate 22757c478bd9Sstevel@tonic-gate #ifdef _LP64 22767c478bd9Sstevel@tonic-gate void 22777c478bd9Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz) 22787c478bd9Sstevel@tonic-gate { 22797c478bd9Sstevel@tonic-gate struct ipcmsgbuf32 msgb; 22807c478bd9Sstevel@tonic-gate 22817c478bd9Sstevel@tonic-gate if (offset != NULL && 22827c478bd9Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) == 22837c478bd9Sstevel@tonic-gate sizeof (msgb.mtype)) { 22847c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 22857c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22867c478bd9Sstevel@tonic-gate Eserialize(); 22877c478bd9Sstevel@tonic-gate 22887c478bd9Sstevel@tonic-gate (void) printf("%s\tmtype=%u mtext[]=\n", 22897c478bd9Sstevel@tonic-gate pri->pname, 22907c478bd9Sstevel@tonic-gate msgb.mtype); 22917c478bd9Sstevel@tonic-gate showbuffer(pri, 22927c478bd9Sstevel@tonic-gate (long)(offset + sizeof (msgb.mtype)), msgsz); 22937c478bd9Sstevel@tonic-gate 22947c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 22957c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4) 22967c478bd9Sstevel@tonic-gate Xserialize(); 22977c478bd9Sstevel@tonic-gate } 22987c478bd9Sstevel@tonic-gate } 22997c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 23007c478bd9Sstevel@tonic-gate 23017c478bd9Sstevel@tonic-gate #ifdef _LP64 23027c478bd9Sstevel@tonic-gate void 23037c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 23047c478bd9Sstevel@tonic-gate { 23057c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 23067c478bd9Sstevel@tonic-gate case 0: /* msgget() */ 23077c478bd9Sstevel@tonic-gate break; 23087c478bd9Sstevel@tonic-gate case 1: /* msgctl() */ 23097c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23107c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) { 23117c478bd9Sstevel@tonic-gate case IPC_STAT: 23127c478bd9Sstevel@tonic-gate if (pri->Errno) 23137c478bd9Sstevel@tonic-gate break; 23147c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 23157c478bd9Sstevel@tonic-gate case IPC_SET: 23167c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23177c478bd9Sstevel@tonic-gate show_msgctl(pri, 23187c478bd9Sstevel@tonic-gate (long)pri->sys_args[3]); 23197c478bd9Sstevel@tonic-gate else 23207c478bd9Sstevel@tonic-gate show_msgctl32(pri, 23217c478bd9Sstevel@tonic-gate (long)pri->sys_args[3]); 23227c478bd9Sstevel@tonic-gate break; 23237c478bd9Sstevel@tonic-gate case IPC_STAT64: 23247c478bd9Sstevel@tonic-gate if (pri->Errno) 23257c478bd9Sstevel@tonic-gate break; 23267c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 23277c478bd9Sstevel@tonic-gate case IPC_SET64: 23287c478bd9Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23297c478bd9Sstevel@tonic-gate break; 23307c478bd9Sstevel@tonic-gate } 23317c478bd9Sstevel@tonic-gate } 23327c478bd9Sstevel@tonic-gate break; 23337c478bd9Sstevel@tonic-gate case 2: /* msgrcv() */ 23347c478bd9Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) { 23357c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23367c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23377c478bd9Sstevel@tonic-gate else 23387c478bd9Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], msgsz); 23397c478bd9Sstevel@tonic-gate } 23407c478bd9Sstevel@tonic-gate break; 23417c478bd9Sstevel@tonic-gate case 3: /* msgsnd() */ 23427c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23437c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 23447c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23457c478bd9Sstevel@tonic-gate pri->sys_args[3]); 23467c478bd9Sstevel@tonic-gate else 23477c478bd9Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], 23487c478bd9Sstevel@tonic-gate pri->sys_args[3]); 23497c478bd9Sstevel@tonic-gate } 23507c478bd9Sstevel@tonic-gate break; 23517c478bd9Sstevel@tonic-gate case 4: /* msgids() */ 23527c478bd9Sstevel@tonic-gate case 5: /* msgsnap() */ 23537c478bd9Sstevel@tonic-gate default: /* unexpected subcode */ 23547c478bd9Sstevel@tonic-gate break; 23557c478bd9Sstevel@tonic-gate } 23567c478bd9Sstevel@tonic-gate } 23577c478bd9Sstevel@tonic-gate #else /* _LP64 */ 23587c478bd9Sstevel@tonic-gate void 23597c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz) 23607c478bd9Sstevel@tonic-gate { 23617c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 23627c478bd9Sstevel@tonic-gate case 0: /* msgget() */ 23637c478bd9Sstevel@tonic-gate break; 23647c478bd9Sstevel@tonic-gate case 1: /* msgctl() */ 23657c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) { 23667c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) { 23677c478bd9Sstevel@tonic-gate case IPC_STAT: 23687c478bd9Sstevel@tonic-gate if (pri->Errno) 23697c478bd9Sstevel@tonic-gate break; 23707c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 23717c478bd9Sstevel@tonic-gate case IPC_SET: 23727c478bd9Sstevel@tonic-gate show_msgctl(pri, (long)pri->sys_args[3]); 23737c478bd9Sstevel@tonic-gate break; 23747c478bd9Sstevel@tonic-gate case IPC_STAT64: 23757c478bd9Sstevel@tonic-gate if (pri->Errno) 23767c478bd9Sstevel@tonic-gate break; 23777c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 23787c478bd9Sstevel@tonic-gate case IPC_SET64: 23797c478bd9Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]); 23807c478bd9Sstevel@tonic-gate break; 23817c478bd9Sstevel@tonic-gate } 23827c478bd9Sstevel@tonic-gate } 23837c478bd9Sstevel@tonic-gate break; 23847c478bd9Sstevel@tonic-gate case 2: /* msgrcv() */ 23857c478bd9Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) 23867c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz); 23877c478bd9Sstevel@tonic-gate break; 23887c478bd9Sstevel@tonic-gate case 3: /* msgsnd() */ 23897c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) 23907c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], 23917c478bd9Sstevel@tonic-gate pri->sys_args[3]); 23927c478bd9Sstevel@tonic-gate break; 23937c478bd9Sstevel@tonic-gate case 4: /* msgids() */ 23947c478bd9Sstevel@tonic-gate case 5: /* msgsnap() */ 23957c478bd9Sstevel@tonic-gate default: /* unexpected subcode */ 23967c478bd9Sstevel@tonic-gate break; 23977c478bd9Sstevel@tonic-gate } 23987c478bd9Sstevel@tonic-gate } 23997c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 24007c478bd9Sstevel@tonic-gate 24017c478bd9Sstevel@tonic-gate static void 24027c478bd9Sstevel@tonic-gate show_semctl64(private_t *pri, long offset) 24037c478bd9Sstevel@tonic-gate { 24047c478bd9Sstevel@tonic-gate struct semid_ds64 semds; 24057c478bd9Sstevel@tonic-gate 24067c478bd9Sstevel@tonic-gate if (offset != NULL && 24077c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24087c478bd9Sstevel@tonic-gate show_perm64(pri, &semds.semx_perm); 24097c478bd9Sstevel@tonic-gate 24107c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems); 24117c478bd9Sstevel@tonic-gate 24127c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", (time_t)semds.semx_otime); 24137c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)semds.semx_ctime); 24147c478bd9Sstevel@tonic-gate } 24157c478bd9Sstevel@tonic-gate } 24167c478bd9Sstevel@tonic-gate 24177c478bd9Sstevel@tonic-gate void 24187c478bd9Sstevel@tonic-gate show_semctl(private_t *pri, long offset) 24197c478bd9Sstevel@tonic-gate { 24207c478bd9Sstevel@tonic-gate struct semid_ds semds; 24217c478bd9Sstevel@tonic-gate 24227c478bd9Sstevel@tonic-gate if (offset != NULL && 24237c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24247c478bd9Sstevel@tonic-gate show_perm(pri, &semds.sem_perm); 24257c478bd9Sstevel@tonic-gate 24267c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24277c478bd9Sstevel@tonic-gate pri->pname, 24287c478bd9Sstevel@tonic-gate semds.sem_nsems); 24297c478bd9Sstevel@tonic-gate 24307c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24317c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24327c478bd9Sstevel@tonic-gate } 24337c478bd9Sstevel@tonic-gate } 24347c478bd9Sstevel@tonic-gate 24357c478bd9Sstevel@tonic-gate #ifdef _LP64 24367c478bd9Sstevel@tonic-gate void 24377c478bd9Sstevel@tonic-gate show_semctl32(private_t *pri, long offset) 24387c478bd9Sstevel@tonic-gate { 24397c478bd9Sstevel@tonic-gate struct semid_ds32 semds; 24407c478bd9Sstevel@tonic-gate 24417c478bd9Sstevel@tonic-gate if (offset != NULL && 24427c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) { 24437c478bd9Sstevel@tonic-gate show_perm32(pri, &semds.sem_perm); 24447c478bd9Sstevel@tonic-gate 24457c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", 24467c478bd9Sstevel@tonic-gate pri->pname, 24477c478bd9Sstevel@tonic-gate semds.sem_nsems); 24487c478bd9Sstevel@tonic-gate 24497c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime); 24507c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime); 24517c478bd9Sstevel@tonic-gate } 24527c478bd9Sstevel@tonic-gate } 24537c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 24547c478bd9Sstevel@tonic-gate 24557c478bd9Sstevel@tonic-gate void 24567c478bd9Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout) 24577c478bd9Sstevel@tonic-gate { 24587c478bd9Sstevel@tonic-gate struct sembuf sembuf; 24597c478bd9Sstevel@tonic-gate const char *str; 24607c478bd9Sstevel@tonic-gate 24617c478bd9Sstevel@tonic-gate if (offset == NULL) 24627c478bd9Sstevel@tonic-gate return; 24637c478bd9Sstevel@tonic-gate 24647c478bd9Sstevel@tonic-gate if (nsops > 40) /* let's not be ridiculous */ 24657c478bd9Sstevel@tonic-gate nsops = 40; 24667c478bd9Sstevel@tonic-gate 24677c478bd9Sstevel@tonic-gate for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) { 24687c478bd9Sstevel@tonic-gate if (Pread(Proc, &sembuf, sizeof (sembuf), offset) != 24697c478bd9Sstevel@tonic-gate sizeof (sembuf)) 24707c478bd9Sstevel@tonic-gate break; 24717c478bd9Sstevel@tonic-gate 24727c478bd9Sstevel@tonic-gate (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=", 24737c478bd9Sstevel@tonic-gate pri->pname, 24747c478bd9Sstevel@tonic-gate sembuf.sem_num, 24757c478bd9Sstevel@tonic-gate sembuf.sem_op); 24767c478bd9Sstevel@tonic-gate 24777c478bd9Sstevel@tonic-gate if (sembuf.sem_flg == 0) 24787c478bd9Sstevel@tonic-gate (void) printf("0\n"); 24797c478bd9Sstevel@tonic-gate else if ((str = semflags(pri, sembuf.sem_flg)) != NULL) 24807c478bd9Sstevel@tonic-gate (void) printf("%s\n", str); 24817c478bd9Sstevel@tonic-gate else 24827c478bd9Sstevel@tonic-gate (void) printf("0%.6o\n", sembuf.sem_flg); 24837c478bd9Sstevel@tonic-gate } 24847c478bd9Sstevel@tonic-gate if (timeout) 24857c478bd9Sstevel@tonic-gate show_timestruc(pri, timeout, "timeout"); 24867c478bd9Sstevel@tonic-gate } 24877c478bd9Sstevel@tonic-gate 24887c478bd9Sstevel@tonic-gate void 24897c478bd9Sstevel@tonic-gate show_semsys(private_t *pri) 24907c478bd9Sstevel@tonic-gate { 24917c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 24927c478bd9Sstevel@tonic-gate case 0: /* semctl() */ 24937c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4) { 24947c478bd9Sstevel@tonic-gate switch (pri->sys_args[3]) { 24957c478bd9Sstevel@tonic-gate case IPC_STAT: 24967c478bd9Sstevel@tonic-gate if (pri->Errno) 24977c478bd9Sstevel@tonic-gate break; 24987c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 24997c478bd9Sstevel@tonic-gate case IPC_SET: 25007c478bd9Sstevel@tonic-gate #ifdef _LP64 25017c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 25027c478bd9Sstevel@tonic-gate show_semctl(pri, 25037c478bd9Sstevel@tonic-gate (long)pri->sys_args[4]); 25047c478bd9Sstevel@tonic-gate else 25057c478bd9Sstevel@tonic-gate show_semctl32(pri, 25067c478bd9Sstevel@tonic-gate (long)pri->sys_args[4]); 25077c478bd9Sstevel@tonic-gate #else 25087c478bd9Sstevel@tonic-gate show_semctl(pri, (long)pri->sys_args[4]); 25097c478bd9Sstevel@tonic-gate #endif 25107c478bd9Sstevel@tonic-gate break; 25117c478bd9Sstevel@tonic-gate case IPC_STAT64: 25127c478bd9Sstevel@tonic-gate if (pri->Errno) 25137c478bd9Sstevel@tonic-gate break; 25147c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 25157c478bd9Sstevel@tonic-gate case IPC_SET64: 25167c478bd9Sstevel@tonic-gate show_semctl64(pri, (long)pri->sys_args[4]); 25177c478bd9Sstevel@tonic-gate break; 25187c478bd9Sstevel@tonic-gate } 25197c478bd9Sstevel@tonic-gate } 25207c478bd9Sstevel@tonic-gate break; 25217c478bd9Sstevel@tonic-gate case 1: /* semget() */ 25227c478bd9Sstevel@tonic-gate break; 25237c478bd9Sstevel@tonic-gate case 2: /* semop() */ 25247c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) 25257c478bd9Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25267c478bd9Sstevel@tonic-gate pri->sys_args[3], 0); 25277c478bd9Sstevel@tonic-gate break; 25287c478bd9Sstevel@tonic-gate case 3: /* semids() */ 25297c478bd9Sstevel@tonic-gate break; 25307c478bd9Sstevel@tonic-gate case 4: /* semtimedop() */ 25317c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4) 25327c478bd9Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2], 25337c478bd9Sstevel@tonic-gate pri->sys_args[3], pri->sys_args[4]); 25347c478bd9Sstevel@tonic-gate break; 25357c478bd9Sstevel@tonic-gate default: /* unexpected subcode */ 25367c478bd9Sstevel@tonic-gate break; 25377c478bd9Sstevel@tonic-gate } 25387c478bd9Sstevel@tonic-gate } 25397c478bd9Sstevel@tonic-gate 25407c478bd9Sstevel@tonic-gate static void 25417c478bd9Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset) 25427c478bd9Sstevel@tonic-gate { 25437c478bd9Sstevel@tonic-gate struct shmid_ds64 shmds; 25447c478bd9Sstevel@tonic-gate 25457c478bd9Sstevel@tonic-gate if (offset != NULL && 25467c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25477c478bd9Sstevel@tonic-gate show_perm64(pri, &shmds.shmx_perm); 25487c478bd9Sstevel@tonic-gate 25497c478bd9Sstevel@tonic-gate (void) printf( 25507c478bd9Sstevel@tonic-gate "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n", 25517c478bd9Sstevel@tonic-gate pri->pname, 25527c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_segsz, 25537c478bd9Sstevel@tonic-gate (int)shmds.shmx_lpid, 25547c478bd9Sstevel@tonic-gate (int)shmds.shmx_cpid, 25557c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_nattch, 25567c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_cnattch); 25577c478bd9Sstevel@tonic-gate 25587c478bd9Sstevel@tonic-gate prtime(pri, " at = ", (time_t)shmds.shmx_atime); 25597c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", (time_t)shmds.shmx_dtime); 25607c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)shmds.shmx_ctime); 25617c478bd9Sstevel@tonic-gate } 25627c478bd9Sstevel@tonic-gate } 25637c478bd9Sstevel@tonic-gate 25647c478bd9Sstevel@tonic-gate void 25657c478bd9Sstevel@tonic-gate show_shmctl(private_t *pri, long offset) 25667c478bd9Sstevel@tonic-gate { 25677c478bd9Sstevel@tonic-gate struct shmid_ds shmds; 25687c478bd9Sstevel@tonic-gate 25697c478bd9Sstevel@tonic-gate if (offset != NULL && 25707c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25717c478bd9Sstevel@tonic-gate show_perm(pri, &shmds.shm_perm); 25727c478bd9Sstevel@tonic-gate 25737c478bd9Sstevel@tonic-gate (void) printf( 25747c478bd9Sstevel@tonic-gate "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n", 25757c478bd9Sstevel@tonic-gate pri->pname, 25767c478bd9Sstevel@tonic-gate (ulong_t)shmds.shm_segsz, 25777c478bd9Sstevel@tonic-gate (int)shmds.shm_lpid, 25787c478bd9Sstevel@tonic-gate (int)shmds.shm_cpid, 25797c478bd9Sstevel@tonic-gate shmds.shm_nattch, 25807c478bd9Sstevel@tonic-gate shmds.shm_cnattch); 25817c478bd9Sstevel@tonic-gate 25827c478bd9Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 25837c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 25847c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 25857c478bd9Sstevel@tonic-gate } 25867c478bd9Sstevel@tonic-gate } 25877c478bd9Sstevel@tonic-gate 25887c478bd9Sstevel@tonic-gate #ifdef _LP64 25897c478bd9Sstevel@tonic-gate void 25907c478bd9Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset) 25917c478bd9Sstevel@tonic-gate { 25927c478bd9Sstevel@tonic-gate struct shmid_ds32 shmds; 25937c478bd9Sstevel@tonic-gate 25947c478bd9Sstevel@tonic-gate if (offset != NULL && 25957c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) { 25967c478bd9Sstevel@tonic-gate show_perm32(pri, &shmds.shm_perm); 25977c478bd9Sstevel@tonic-gate 25987c478bd9Sstevel@tonic-gate (void) printf( 25997c478bd9Sstevel@tonic-gate "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n", 26007c478bd9Sstevel@tonic-gate pri->pname, 26017c478bd9Sstevel@tonic-gate shmds.shm_segsz, 26027c478bd9Sstevel@tonic-gate shmds.shm_lpid, 26037c478bd9Sstevel@tonic-gate shmds.shm_cpid, 26047c478bd9Sstevel@tonic-gate shmds.shm_nattch, 26057c478bd9Sstevel@tonic-gate shmds.shm_cnattch); 26067c478bd9Sstevel@tonic-gate 26077c478bd9Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime); 26087c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime); 26097c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime); 26107c478bd9Sstevel@tonic-gate } 26117c478bd9Sstevel@tonic-gate } 26127c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 26137c478bd9Sstevel@tonic-gate 26147c478bd9Sstevel@tonic-gate void 26157c478bd9Sstevel@tonic-gate show_shmsys(private_t *pri) 26167c478bd9Sstevel@tonic-gate { 26177c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 26187c478bd9Sstevel@tonic-gate case 0: /* shmat() */ 26197c478bd9Sstevel@tonic-gate break; 26207c478bd9Sstevel@tonic-gate case 1: /* shmctl() */ 26217c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) { 26227c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) { 26237c478bd9Sstevel@tonic-gate case IPC_STAT: 26247c478bd9Sstevel@tonic-gate if (pri->Errno) 26257c478bd9Sstevel@tonic-gate break; 26267c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 26277c478bd9Sstevel@tonic-gate case IPC_SET: 26287c478bd9Sstevel@tonic-gate #ifdef _LP64 26297c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 26307c478bd9Sstevel@tonic-gate show_shmctl(pri, 26317c478bd9Sstevel@tonic-gate (long)pri->sys_args[3]); 26327c478bd9Sstevel@tonic-gate else 26337c478bd9Sstevel@tonic-gate show_shmctl32(pri, 26347c478bd9Sstevel@tonic-gate (long)pri->sys_args[3]); 26357c478bd9Sstevel@tonic-gate #else 26367c478bd9Sstevel@tonic-gate show_shmctl(pri, (long)pri->sys_args[3]); 26377c478bd9Sstevel@tonic-gate #endif 26387c478bd9Sstevel@tonic-gate break; 26397c478bd9Sstevel@tonic-gate case IPC_STAT64: 26407c478bd9Sstevel@tonic-gate if (pri->Errno) 26417c478bd9Sstevel@tonic-gate break; 26427c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 26437c478bd9Sstevel@tonic-gate case IPC_SET64: 26447c478bd9Sstevel@tonic-gate show_shmctl64(pri, (long)pri->sys_args[3]); 26457c478bd9Sstevel@tonic-gate break; 26467c478bd9Sstevel@tonic-gate } 26477c478bd9Sstevel@tonic-gate } 26487c478bd9Sstevel@tonic-gate break; 26497c478bd9Sstevel@tonic-gate case 2: /* shmdt() */ 26507c478bd9Sstevel@tonic-gate case 3: /* shmget() */ 26517c478bd9Sstevel@tonic-gate case 4: /* shmids() */ 26527c478bd9Sstevel@tonic-gate default: /* unexpected subcode */ 26537c478bd9Sstevel@tonic-gate break; 26547c478bd9Sstevel@tonic-gate } 26557c478bd9Sstevel@tonic-gate } 26567c478bd9Sstevel@tonic-gate 26577c478bd9Sstevel@tonic-gate void 26587c478bd9Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count) 26597c478bd9Sstevel@tonic-gate { 26607c478bd9Sstevel@tonic-gate int groups[100]; 26617c478bd9Sstevel@tonic-gate 26627c478bd9Sstevel@tonic-gate if (count > 100) 26637c478bd9Sstevel@tonic-gate count = 100; 26647c478bd9Sstevel@tonic-gate 26657c478bd9Sstevel@tonic-gate if (count > 0 && offset != NULL && 26667c478bd9Sstevel@tonic-gate Pread(Proc, &groups[0], count*sizeof (int), offset) == 26677c478bd9Sstevel@tonic-gate count*sizeof (int)) { 26687c478bd9Sstevel@tonic-gate int n; 26697c478bd9Sstevel@tonic-gate 26707c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 26717c478bd9Sstevel@tonic-gate for (n = 0; !interrupt && n < count; n++) { 26727c478bd9Sstevel@tonic-gate if (n != 0 && n%10 == 0) 26737c478bd9Sstevel@tonic-gate (void) printf("\n%s\t", pri->pname); 26747c478bd9Sstevel@tonic-gate (void) printf(" %5d", groups[n]); 26757c478bd9Sstevel@tonic-gate } 26767c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 26777c478bd9Sstevel@tonic-gate } 26787c478bd9Sstevel@tonic-gate } 26797c478bd9Sstevel@tonic-gate 26807c478bd9Sstevel@tonic-gate /* 26817c478bd9Sstevel@tonic-gate * This assumes that a sigset_t is simply an array of ints. 26827c478bd9Sstevel@tonic-gate */ 26837c478bd9Sstevel@tonic-gate char * 26847c478bd9Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp) 26857c478bd9Sstevel@tonic-gate { 26867c478bd9Sstevel@tonic-gate char *s = pri->code_buf; 26877c478bd9Sstevel@tonic-gate int n = sizeof (*sp) / sizeof (int32_t); 26887c478bd9Sstevel@tonic-gate int32_t *lp = (int32_t *)sp; 26897c478bd9Sstevel@tonic-gate 26907c478bd9Sstevel@tonic-gate while (--n >= 0) { 26917c478bd9Sstevel@tonic-gate int32_t val = *lp++; 26927c478bd9Sstevel@tonic-gate 26937c478bd9Sstevel@tonic-gate if (val == 0) 26947c478bd9Sstevel@tonic-gate s += sprintf(s, " 0"); 26957c478bd9Sstevel@tonic-gate else 26967c478bd9Sstevel@tonic-gate s += sprintf(s, " 0x%.8X", val); 26977c478bd9Sstevel@tonic-gate } 26987c478bd9Sstevel@tonic-gate 26997c478bd9Sstevel@tonic-gate return (pri->code_buf); 27007c478bd9Sstevel@tonic-gate } 27017c478bd9Sstevel@tonic-gate 27027c478bd9Sstevel@tonic-gate void 27037c478bd9Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name) 27047c478bd9Sstevel@tonic-gate { 27057c478bd9Sstevel@tonic-gate sigset_t sigset; 27067c478bd9Sstevel@tonic-gate 27077c478bd9Sstevel@tonic-gate if (offset != NULL && 27087c478bd9Sstevel@tonic-gate Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) { 27097c478bd9Sstevel@tonic-gate (void) printf("%s\t%s =%s\n", 27107c478bd9Sstevel@tonic-gate pri->pname, name, sigset_string(pri, &sigset)); 27117c478bd9Sstevel@tonic-gate } 27127c478bd9Sstevel@tonic-gate } 27137c478bd9Sstevel@tonic-gate 27147c478bd9Sstevel@tonic-gate #ifdef _LP64 27157c478bd9Sstevel@tonic-gate void 27167c478bd9Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name) 27177c478bd9Sstevel@tonic-gate { 27187c478bd9Sstevel@tonic-gate struct sigaltstack32 altstack; 27197c478bd9Sstevel@tonic-gate 27207c478bd9Sstevel@tonic-gate if (offset != NULL && 27217c478bd9Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27227c478bd9Sstevel@tonic-gate sizeof (altstack)) { 27237c478bd9Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n", 27247c478bd9Sstevel@tonic-gate pri->pname, 27257c478bd9Sstevel@tonic-gate name, 27267c478bd9Sstevel@tonic-gate altstack.ss_sp, 27277c478bd9Sstevel@tonic-gate altstack.ss_size, 27287c478bd9Sstevel@tonic-gate altstack.ss_flags); 27297c478bd9Sstevel@tonic-gate } 27307c478bd9Sstevel@tonic-gate } 27317c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 27327c478bd9Sstevel@tonic-gate 27337c478bd9Sstevel@tonic-gate void 27347c478bd9Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name) 27357c478bd9Sstevel@tonic-gate { 27367c478bd9Sstevel@tonic-gate struct sigaltstack altstack; 27377c478bd9Sstevel@tonic-gate 27387c478bd9Sstevel@tonic-gate #ifdef _LP64 27397c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27407c478bd9Sstevel@tonic-gate show_sigaltstack32(pri, offset, name); 27417c478bd9Sstevel@tonic-gate return; 27427c478bd9Sstevel@tonic-gate } 27437c478bd9Sstevel@tonic-gate #endif 27447c478bd9Sstevel@tonic-gate if (offset != NULL && 27457c478bd9Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) == 27467c478bd9Sstevel@tonic-gate sizeof (altstack)) { 27477c478bd9Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n", 27487c478bd9Sstevel@tonic-gate pri->pname, 27497c478bd9Sstevel@tonic-gate name, 27507c478bd9Sstevel@tonic-gate (ulong_t)altstack.ss_sp, 27517c478bd9Sstevel@tonic-gate (ulong_t)altstack.ss_size, 27527c478bd9Sstevel@tonic-gate altstack.ss_flags); 27537c478bd9Sstevel@tonic-gate } 27547c478bd9Sstevel@tonic-gate } 27557c478bd9Sstevel@tonic-gate 27567c478bd9Sstevel@tonic-gate #ifdef _LP64 27577c478bd9Sstevel@tonic-gate void 27587c478bd9Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp) 27597c478bd9Sstevel@tonic-gate { 27607c478bd9Sstevel@tonic-gate struct sigaction32 sigaction; 27617c478bd9Sstevel@tonic-gate 27627c478bd9Sstevel@tonic-gate if (offset != NULL && 27637c478bd9Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27647c478bd9Sstevel@tonic-gate sizeof (sigaction)) { 27657c478bd9Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27667c478bd9Sstevel@tonic-gate if (odisp != NULL) 27677c478bd9Sstevel@tonic-gate sigaction.sa_handler = (caddr32_t)odisp; 27687c478bd9Sstevel@tonic-gate (void) printf( 27697c478bd9Sstevel@tonic-gate "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n", 27707c478bd9Sstevel@tonic-gate pri->pname, 27717c478bd9Sstevel@tonic-gate name, 27727c478bd9Sstevel@tonic-gate sigaction.sa_handler, 27737c478bd9Sstevel@tonic-gate sigset_string(pri, (sigset_t *)&sigaction.sa_mask), 27747c478bd9Sstevel@tonic-gate sigaction.sa_flags); 27757c478bd9Sstevel@tonic-gate } 27767c478bd9Sstevel@tonic-gate } 27777c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 27787c478bd9Sstevel@tonic-gate 27797c478bd9Sstevel@tonic-gate void 27807c478bd9Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp) 27817c478bd9Sstevel@tonic-gate { 27827c478bd9Sstevel@tonic-gate struct sigaction sigaction; 27837c478bd9Sstevel@tonic-gate 27847c478bd9Sstevel@tonic-gate #ifdef _LP64 27857c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 27867c478bd9Sstevel@tonic-gate show_sigaction32(pri, offset, name, odisp); 27877c478bd9Sstevel@tonic-gate return; 27887c478bd9Sstevel@tonic-gate } 27897c478bd9Sstevel@tonic-gate #endif 27907c478bd9Sstevel@tonic-gate if (offset != NULL && 27917c478bd9Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) == 27927c478bd9Sstevel@tonic-gate sizeof (sigaction)) { 27937c478bd9Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */ 27947c478bd9Sstevel@tonic-gate if (odisp != NULL) 27957c478bd9Sstevel@tonic-gate sigaction.sa_handler = (void (*)())odisp; 27967c478bd9Sstevel@tonic-gate (void) printf( 27977c478bd9Sstevel@tonic-gate "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n", 27987c478bd9Sstevel@tonic-gate pri->pname, 27997c478bd9Sstevel@tonic-gate name, 28007c478bd9Sstevel@tonic-gate (long)sigaction.sa_handler, 28017c478bd9Sstevel@tonic-gate sigset_string(pri, &sigaction.sa_mask), 28027c478bd9Sstevel@tonic-gate sigaction.sa_flags); 28037c478bd9Sstevel@tonic-gate } 28047c478bd9Sstevel@tonic-gate } 28057c478bd9Sstevel@tonic-gate 28067c478bd9Sstevel@tonic-gate #ifdef _LP64 28077c478bd9Sstevel@tonic-gate void 28087c478bd9Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip) 28097c478bd9Sstevel@tonic-gate { 28107c478bd9Sstevel@tonic-gate const char *code = NULL; 28117c478bd9Sstevel@tonic-gate 28127c478bd9Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 28137c478bd9Sstevel@tonic-gate signame(pri, sip->si_signo)); 28147c478bd9Sstevel@tonic-gate 28157c478bd9Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 28167c478bd9Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid); 28177c478bd9Sstevel@tonic-gate if (sip->si_code != 0) 28187c478bd9Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 28197c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 28207c478bd9Sstevel@tonic-gate return; 28217c478bd9Sstevel@tonic-gate } 28227c478bd9Sstevel@tonic-gate 28237c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 28247c478bd9Sstevel@tonic-gate default: 28257c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 28267c478bd9Sstevel@tonic-gate return; 28277c478bd9Sstevel@tonic-gate case SIGILL: 28287c478bd9Sstevel@tonic-gate case SIGTRAP: 28297c478bd9Sstevel@tonic-gate case SIGFPE: 28307c478bd9Sstevel@tonic-gate case SIGSEGV: 28317c478bd9Sstevel@tonic-gate case SIGBUS: 28327c478bd9Sstevel@tonic-gate case SIGEMT: 28337c478bd9Sstevel@tonic-gate case SIGCLD: 28347c478bd9Sstevel@tonic-gate case SIGPOLL: 28357c478bd9Sstevel@tonic-gate case SIGXFSZ: 28367c478bd9Sstevel@tonic-gate break; 28377c478bd9Sstevel@tonic-gate } 28387c478bd9Sstevel@tonic-gate 28397c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 28407c478bd9Sstevel@tonic-gate case SIGILL: 28417c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28427c478bd9Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 28437c478bd9Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 28447c478bd9Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 28457c478bd9Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 28467c478bd9Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 28477c478bd9Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 28487c478bd9Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 28497c478bd9Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 28507c478bd9Sstevel@tonic-gate } 28517c478bd9Sstevel@tonic-gate break; 28527c478bd9Sstevel@tonic-gate case SIGTRAP: 28537c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28547c478bd9Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 28557c478bd9Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 28567c478bd9Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 28577c478bd9Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 28587c478bd9Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 28597c478bd9Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 28607c478bd9Sstevel@tonic-gate } 28617c478bd9Sstevel@tonic-gate break; 28627c478bd9Sstevel@tonic-gate case SIGFPE: 28637c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28647c478bd9Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 28657c478bd9Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 28667c478bd9Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 28677c478bd9Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 28687c478bd9Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 28697c478bd9Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 28707c478bd9Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 28717c478bd9Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 28727c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN) 28737c478bd9Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 28747c478bd9Sstevel@tonic-gate #endif 28757c478bd9Sstevel@tonic-gate } 28767c478bd9Sstevel@tonic-gate break; 28777c478bd9Sstevel@tonic-gate case SIGSEGV: 28787c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28797c478bd9Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 28807c478bd9Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 28817c478bd9Sstevel@tonic-gate } 28827c478bd9Sstevel@tonic-gate break; 28837c478bd9Sstevel@tonic-gate case SIGEMT: 28847c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28857c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF 28867c478bd9Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 28877c478bd9Sstevel@tonic-gate #endif 28887c478bd9Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 28897c478bd9Sstevel@tonic-gate } 28907c478bd9Sstevel@tonic-gate break; 28917c478bd9Sstevel@tonic-gate case SIGBUS: 28927c478bd9Sstevel@tonic-gate switch (sip->si_code) { 28937c478bd9Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 28947c478bd9Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 28957c478bd9Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 28967c478bd9Sstevel@tonic-gate } 28977c478bd9Sstevel@tonic-gate break; 28987c478bd9Sstevel@tonic-gate case SIGCLD: 28997c478bd9Sstevel@tonic-gate switch (sip->si_code) { 29007c478bd9Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 29017c478bd9Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 29027c478bd9Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 29037c478bd9Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 29047c478bd9Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 29057c478bd9Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 29067c478bd9Sstevel@tonic-gate } 29077c478bd9Sstevel@tonic-gate break; 29087c478bd9Sstevel@tonic-gate case SIGPOLL: 29097c478bd9Sstevel@tonic-gate switch (sip->si_code) { 29107c478bd9Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 29117c478bd9Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 29127c478bd9Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 29137c478bd9Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 29147c478bd9Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 29157c478bd9Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 29167c478bd9Sstevel@tonic-gate } 29177c478bd9Sstevel@tonic-gate break; 29187c478bd9Sstevel@tonic-gate } 29197c478bd9Sstevel@tonic-gate 29207c478bd9Sstevel@tonic-gate if (code == NULL) { 29217c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 29227c478bd9Sstevel@tonic-gate code = (const char *)pri->code_buf; 29237c478bd9Sstevel@tonic-gate } 29247c478bd9Sstevel@tonic-gate 29257c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 29267c478bd9Sstevel@tonic-gate case SIGILL: 29277c478bd9Sstevel@tonic-gate case SIGTRAP: 29287c478bd9Sstevel@tonic-gate case SIGFPE: 29297c478bd9Sstevel@tonic-gate case SIGSEGV: 29307c478bd9Sstevel@tonic-gate case SIGBUS: 29317c478bd9Sstevel@tonic-gate case SIGEMT: 29327c478bd9Sstevel@tonic-gate (void) printf(" %s addr=0x%.8X", 29337c478bd9Sstevel@tonic-gate code, 29347c478bd9Sstevel@tonic-gate sip->si_addr); 29357c478bd9Sstevel@tonic-gate break; 29367c478bd9Sstevel@tonic-gate case SIGCLD: 29377c478bd9Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 29387c478bd9Sstevel@tonic-gate code, 29397c478bd9Sstevel@tonic-gate sip->si_pid, 29407c478bd9Sstevel@tonic-gate sip->si_status); 29417c478bd9Sstevel@tonic-gate break; 29427c478bd9Sstevel@tonic-gate case SIGPOLL: 29437c478bd9Sstevel@tonic-gate case SIGXFSZ: 29447c478bd9Sstevel@tonic-gate (void) printf(" %s fd=%d band=%d", 29457c478bd9Sstevel@tonic-gate code, 29467c478bd9Sstevel@tonic-gate sip->si_fd, 29477c478bd9Sstevel@tonic-gate sip->si_band); 29487c478bd9Sstevel@tonic-gate break; 29497c478bd9Sstevel@tonic-gate } 29507c478bd9Sstevel@tonic-gate 29517c478bd9Sstevel@tonic-gate if (sip->si_errno != 0) { 29527c478bd9Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 29537c478bd9Sstevel@tonic-gate 29547c478bd9Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 29557c478bd9Sstevel@tonic-gate if (ename != NULL) 29567c478bd9Sstevel@tonic-gate (void) printf("(%s)", ename); 29577c478bd9Sstevel@tonic-gate } 29587c478bd9Sstevel@tonic-gate 29597c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 29607c478bd9Sstevel@tonic-gate } 29617c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 29627c478bd9Sstevel@tonic-gate 29637c478bd9Sstevel@tonic-gate void 29647c478bd9Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip) 29657c478bd9Sstevel@tonic-gate { 29667c478bd9Sstevel@tonic-gate const char *code = NULL; 29677c478bd9Sstevel@tonic-gate 29687c478bd9Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname, 29697c478bd9Sstevel@tonic-gate signame(pri, sip->si_signo)); 29707c478bd9Sstevel@tonic-gate 29717c478bd9Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) { 29727c478bd9Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", 29737c478bd9Sstevel@tonic-gate (int)sip->si_pid, 29747c478bd9Sstevel@tonic-gate (int)sip->si_uid); 29757c478bd9Sstevel@tonic-gate if (sip->si_code != 0) 29767c478bd9Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code); 29777c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 29787c478bd9Sstevel@tonic-gate return; 29797c478bd9Sstevel@tonic-gate } 29807c478bd9Sstevel@tonic-gate 29817c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 29827c478bd9Sstevel@tonic-gate default: 29837c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 29847c478bd9Sstevel@tonic-gate return; 29857c478bd9Sstevel@tonic-gate case SIGILL: 29867c478bd9Sstevel@tonic-gate case SIGTRAP: 29877c478bd9Sstevel@tonic-gate case SIGFPE: 29887c478bd9Sstevel@tonic-gate case SIGSEGV: 29897c478bd9Sstevel@tonic-gate case SIGBUS: 29907c478bd9Sstevel@tonic-gate case SIGEMT: 29917c478bd9Sstevel@tonic-gate case SIGCLD: 29927c478bd9Sstevel@tonic-gate case SIGPOLL: 29937c478bd9Sstevel@tonic-gate case SIGXFSZ: 29947c478bd9Sstevel@tonic-gate break; 29957c478bd9Sstevel@tonic-gate } 29967c478bd9Sstevel@tonic-gate 29977c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 29987c478bd9Sstevel@tonic-gate case SIGILL: 29997c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30007c478bd9Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break; 30017c478bd9Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break; 30027c478bd9Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break; 30037c478bd9Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break; 30047c478bd9Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break; 30057c478bd9Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break; 30067c478bd9Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break; 30077c478bd9Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break; 30087c478bd9Sstevel@tonic-gate } 30097c478bd9Sstevel@tonic-gate break; 30107c478bd9Sstevel@tonic-gate case SIGTRAP: 30117c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30127c478bd9Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break; 30137c478bd9Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break; 30147c478bd9Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break; 30157c478bd9Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break; 30167c478bd9Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break; 30177c478bd9Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break; 30187c478bd9Sstevel@tonic-gate } 30197c478bd9Sstevel@tonic-gate break; 30207c478bd9Sstevel@tonic-gate case SIGFPE: 30217c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30227c478bd9Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break; 30237c478bd9Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break; 30247c478bd9Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break; 30257c478bd9Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break; 30267c478bd9Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break; 30277c478bd9Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break; 30287c478bd9Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break; 30297c478bd9Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break; 30307c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN) 30317c478bd9Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break; 30327c478bd9Sstevel@tonic-gate #endif 30337c478bd9Sstevel@tonic-gate } 30347c478bd9Sstevel@tonic-gate break; 30357c478bd9Sstevel@tonic-gate case SIGSEGV: 30367c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30377c478bd9Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break; 30387c478bd9Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break; 30397c478bd9Sstevel@tonic-gate } 30407c478bd9Sstevel@tonic-gate break; 30417c478bd9Sstevel@tonic-gate case SIGEMT: 30427c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30437c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF 30447c478bd9Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break; 30457c478bd9Sstevel@tonic-gate #endif 30467c478bd9Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break; 30477c478bd9Sstevel@tonic-gate } 30487c478bd9Sstevel@tonic-gate break; 30497c478bd9Sstevel@tonic-gate case SIGBUS: 30507c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30517c478bd9Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break; 30527c478bd9Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break; 30537c478bd9Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break; 30547c478bd9Sstevel@tonic-gate } 30557c478bd9Sstevel@tonic-gate break; 30567c478bd9Sstevel@tonic-gate case SIGCLD: 30577c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30587c478bd9Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break; 30597c478bd9Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break; 30607c478bd9Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break; 30617c478bd9Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break; 30627c478bd9Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break; 30637c478bd9Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break; 30647c478bd9Sstevel@tonic-gate } 30657c478bd9Sstevel@tonic-gate break; 30667c478bd9Sstevel@tonic-gate case SIGPOLL: 30677c478bd9Sstevel@tonic-gate switch (sip->si_code) { 30687c478bd9Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break; 30697c478bd9Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break; 30707c478bd9Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break; 30717c478bd9Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break; 30727c478bd9Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break; 30737c478bd9Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break; 30747c478bd9Sstevel@tonic-gate } 30757c478bd9Sstevel@tonic-gate break; 30767c478bd9Sstevel@tonic-gate } 30777c478bd9Sstevel@tonic-gate 30787c478bd9Sstevel@tonic-gate if (code == NULL) { 30797c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code); 30807c478bd9Sstevel@tonic-gate code = (const char *)pri->code_buf; 30817c478bd9Sstevel@tonic-gate } 30827c478bd9Sstevel@tonic-gate 30837c478bd9Sstevel@tonic-gate switch (sip->si_signo) { 30847c478bd9Sstevel@tonic-gate case SIGILL: 30857c478bd9Sstevel@tonic-gate case SIGTRAP: 30867c478bd9Sstevel@tonic-gate case SIGFPE: 30877c478bd9Sstevel@tonic-gate case SIGSEGV: 30887c478bd9Sstevel@tonic-gate case SIGBUS: 30897c478bd9Sstevel@tonic-gate case SIGEMT: 30907c478bd9Sstevel@tonic-gate (void) printf(" %s addr=0x%.8lX", 30917c478bd9Sstevel@tonic-gate code, 30927c478bd9Sstevel@tonic-gate (long)sip->si_addr); 30937c478bd9Sstevel@tonic-gate break; 30947c478bd9Sstevel@tonic-gate case SIGCLD: 30957c478bd9Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X", 30967c478bd9Sstevel@tonic-gate code, 30977c478bd9Sstevel@tonic-gate (int)sip->si_pid, 30987c478bd9Sstevel@tonic-gate sip->si_status); 30997c478bd9Sstevel@tonic-gate break; 31007c478bd9Sstevel@tonic-gate case SIGPOLL: 31017c478bd9Sstevel@tonic-gate case SIGXFSZ: 31027c478bd9Sstevel@tonic-gate (void) printf(" %s fd=%d band=%ld", 31037c478bd9Sstevel@tonic-gate code, 31047c478bd9Sstevel@tonic-gate sip->si_fd, 31057c478bd9Sstevel@tonic-gate sip->si_band); 31067c478bd9Sstevel@tonic-gate break; 31077c478bd9Sstevel@tonic-gate } 31087c478bd9Sstevel@tonic-gate 31097c478bd9Sstevel@tonic-gate if (sip->si_errno != 0) { 31107c478bd9Sstevel@tonic-gate const char *ename = errname(sip->si_errno); 31117c478bd9Sstevel@tonic-gate 31127c478bd9Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno); 31137c478bd9Sstevel@tonic-gate if (ename != NULL) 31147c478bd9Sstevel@tonic-gate (void) printf("(%s)", ename); 31157c478bd9Sstevel@tonic-gate } 31167c478bd9Sstevel@tonic-gate 31177c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 31187c478bd9Sstevel@tonic-gate } 31197c478bd9Sstevel@tonic-gate 31207c478bd9Sstevel@tonic-gate #ifdef _LP64 31217c478bd9Sstevel@tonic-gate void 31227c478bd9Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset) 31237c478bd9Sstevel@tonic-gate { 31247c478bd9Sstevel@tonic-gate struct siginfo32 siginfo; 31257c478bd9Sstevel@tonic-gate 31267c478bd9Sstevel@tonic-gate if (offset != NULL && 31277c478bd9Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31287c478bd9Sstevel@tonic-gate print_siginfo32(pri, &siginfo); 31297c478bd9Sstevel@tonic-gate } 31307c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 31317c478bd9Sstevel@tonic-gate 31327c478bd9Sstevel@tonic-gate void 31337c478bd9Sstevel@tonic-gate show_siginfo(private_t *pri, long offset) 31347c478bd9Sstevel@tonic-gate { 31357c478bd9Sstevel@tonic-gate struct siginfo siginfo; 31367c478bd9Sstevel@tonic-gate 31377c478bd9Sstevel@tonic-gate #ifdef _LP64 31387c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 31397c478bd9Sstevel@tonic-gate show_siginfo32(pri, offset); 31407c478bd9Sstevel@tonic-gate return; 31417c478bd9Sstevel@tonic-gate } 31427c478bd9Sstevel@tonic-gate #endif 31437c478bd9Sstevel@tonic-gate if (offset != NULL && 31447c478bd9Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo)) 31457c478bd9Sstevel@tonic-gate print_siginfo(pri, &siginfo); 31467c478bd9Sstevel@tonic-gate } 31477c478bd9Sstevel@tonic-gate 31487c478bd9Sstevel@tonic-gate void 31497c478bd9Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count) 31507c478bd9Sstevel@tonic-gate { 31517c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4); 31527c478bd9Sstevel@tonic-gate 31537c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 31547c478bd9Sstevel@tonic-gate if (serial) 31557c478bd9Sstevel@tonic-gate Eserialize(); 31567c478bd9Sstevel@tonic-gate 31577c478bd9Sstevel@tonic-gate while (count > 0) { 31587c478bd9Sstevel@tonic-gate char buf[32]; 31597c478bd9Sstevel@tonic-gate int nb = (count < 32)? count : 32; 31607c478bd9Sstevel@tonic-gate int i; 31617c478bd9Sstevel@tonic-gate 31627c478bd9Sstevel@tonic-gate if (Pread(Proc, buf, (size_t)nb, offset) != nb) 31637c478bd9Sstevel@tonic-gate break; 31647c478bd9Sstevel@tonic-gate 31657c478bd9Sstevel@tonic-gate (void) printf("%s ", pri->pname); 31667c478bd9Sstevel@tonic-gate for (i = 0; i < nb; i++) 31677c478bd9Sstevel@tonic-gate (void) printf(" %d", buf[i]); 31687c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout); 31697c478bd9Sstevel@tonic-gate 31707c478bd9Sstevel@tonic-gate count -= nb; 31717c478bd9Sstevel@tonic-gate offset += nb; 31727c478bd9Sstevel@tonic-gate } 31737c478bd9Sstevel@tonic-gate 31747c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 31757c478bd9Sstevel@tonic-gate if (serial) 31767c478bd9Sstevel@tonic-gate Xserialize(); 31777c478bd9Sstevel@tonic-gate } 31787c478bd9Sstevel@tonic-gate 31797c478bd9Sstevel@tonic-gate #ifdef _LP64 31807c478bd9Sstevel@tonic-gate void 31817c478bd9Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count) 31827c478bd9Sstevel@tonic-gate { 31837c478bd9Sstevel@tonic-gate iovec32_t iovec[16]; 31847c478bd9Sstevel@tonic-gate iovec32_t *ip; 31857c478bd9Sstevel@tonic-gate long nb; 31867c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 31877c478bd9Sstevel@tonic-gate 31887c478bd9Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 31897c478bd9Sstevel@tonic-gate niov = 16; 31907c478bd9Sstevel@tonic-gate 31917c478bd9Sstevel@tonic-gate if (offset != NULL && niov > 0 && 31927c478bd9Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset) 31937c478bd9Sstevel@tonic-gate == niov*sizeof (iovec32_t)) { 31947c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 31957c478bd9Sstevel@tonic-gate if (serial) 31967c478bd9Sstevel@tonic-gate Eserialize(); 31977c478bd9Sstevel@tonic-gate 31987c478bd9Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 31997c478bd9Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n", 32007c478bd9Sstevel@tonic-gate pri->pname, 32017c478bd9Sstevel@tonic-gate ip->iov_base, 32027c478bd9Sstevel@tonic-gate ip->iov_len); 32037c478bd9Sstevel@tonic-gate if ((nb = count) > 0) { 32047c478bd9Sstevel@tonic-gate if (nb > ip->iov_len) 32057c478bd9Sstevel@tonic-gate nb = ip->iov_len; 32067c478bd9Sstevel@tonic-gate if (nb > 0) 32077c478bd9Sstevel@tonic-gate count -= nb; 32087c478bd9Sstevel@tonic-gate } 32097c478bd9Sstevel@tonic-gate if (showbuf && nb > 0) 32107c478bd9Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 32117c478bd9Sstevel@tonic-gate } 32127c478bd9Sstevel@tonic-gate 32137c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 32147c478bd9Sstevel@tonic-gate if (serial) 32157c478bd9Sstevel@tonic-gate Xserialize(); 32167c478bd9Sstevel@tonic-gate } 32177c478bd9Sstevel@tonic-gate } 32187c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 32197c478bd9Sstevel@tonic-gate 32207c478bd9Sstevel@tonic-gate void 32217c478bd9Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count) 32227c478bd9Sstevel@tonic-gate { 32237c478bd9Sstevel@tonic-gate iovec_t iovec[16]; 32247c478bd9Sstevel@tonic-gate iovec_t *ip; 32257c478bd9Sstevel@tonic-gate long nb; 32267c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf); 32277c478bd9Sstevel@tonic-gate 32287c478bd9Sstevel@tonic-gate #ifdef _LP64 32297c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 32307c478bd9Sstevel@tonic-gate show_iovec32(pri, offset, niov, showbuf, count); 32317c478bd9Sstevel@tonic-gate return; 32327c478bd9Sstevel@tonic-gate } 32337c478bd9Sstevel@tonic-gate #endif 32347c478bd9Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */ 32357c478bd9Sstevel@tonic-gate niov = 16; 32367c478bd9Sstevel@tonic-gate 32377c478bd9Sstevel@tonic-gate if (offset != NULL && niov > 0 && 32387c478bd9Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset) 32397c478bd9Sstevel@tonic-gate == niov*sizeof (iovec_t)) { 32407c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 32417c478bd9Sstevel@tonic-gate if (serial) 32427c478bd9Sstevel@tonic-gate Eserialize(); 32437c478bd9Sstevel@tonic-gate 32447c478bd9Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) { 32457c478bd9Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n", 32467c478bd9Sstevel@tonic-gate pri->pname, 32477c478bd9Sstevel@tonic-gate (long)ip->iov_base, 32487c478bd9Sstevel@tonic-gate ip->iov_len); 32497c478bd9Sstevel@tonic-gate if ((nb = count) > 0) { 32507c478bd9Sstevel@tonic-gate if (nb > ip->iov_len) 32517c478bd9Sstevel@tonic-gate nb = ip->iov_len; 32527c478bd9Sstevel@tonic-gate if (nb > 0) 32537c478bd9Sstevel@tonic-gate count -= nb; 32547c478bd9Sstevel@tonic-gate } 32557c478bd9Sstevel@tonic-gate if (showbuf && nb > 0) 32567c478bd9Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb); 32577c478bd9Sstevel@tonic-gate } 32587c478bd9Sstevel@tonic-gate 32597c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 32607c478bd9Sstevel@tonic-gate if (serial) 32617c478bd9Sstevel@tonic-gate Xserialize(); 32627c478bd9Sstevel@tonic-gate } 32637c478bd9Sstevel@tonic-gate } 32647c478bd9Sstevel@tonic-gate 32657c478bd9Sstevel@tonic-gate void 32667c478bd9Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count) 32677c478bd9Sstevel@tonic-gate { 32687c478bd9Sstevel@tonic-gate long buf[MYBUFSIZ / sizeof (long)]; 32697c478bd9Sstevel@tonic-gate struct dirent32 *dp; 32707c478bd9Sstevel@tonic-gate int serial = (count > 100); 32717c478bd9Sstevel@tonic-gate 32727c478bd9Sstevel@tonic-gate if (offset == NULL) 32737c478bd9Sstevel@tonic-gate return; 32747c478bd9Sstevel@tonic-gate 32757c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 32767c478bd9Sstevel@tonic-gate if (serial) 32777c478bd9Sstevel@tonic-gate Eserialize(); 32787c478bd9Sstevel@tonic-gate 32797c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) { 32807c478bd9Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 32817c478bd9Sstevel@tonic-gate 32827c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 32837c478bd9Sstevel@tonic-gate break; 32847c478bd9Sstevel@tonic-gate 32857c478bd9Sstevel@tonic-gate dp = (struct dirent32 *)&buf[0]; 32867c478bd9Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 32877c478bd9Sstevel@tonic-gate break; 32887c478bd9Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 32897c478bd9Sstevel@tonic-gate /* getdents() error? */ 32907c478bd9Sstevel@tonic-gate (void) printf( 32917c478bd9Sstevel@tonic-gate "%s ino=%-5u off=%-4d rlen=%-3d\n", 32927c478bd9Sstevel@tonic-gate pri->pname, 32937c478bd9Sstevel@tonic-gate dp->d_ino, 32947c478bd9Sstevel@tonic-gate dp->d_off, 32957c478bd9Sstevel@tonic-gate dp->d_reclen); 32967c478bd9Sstevel@tonic-gate break; 32977c478bd9Sstevel@tonic-gate } 32987c478bd9Sstevel@tonic-gate 32997c478bd9Sstevel@tonic-gate while (!interrupt && 33007c478bd9Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 33017c478bd9Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 33027c478bd9Sstevel@tonic-gate (void) printf( 33037c478bd9Sstevel@tonic-gate "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n", 33047c478bd9Sstevel@tonic-gate pri->pname, 33057c478bd9Sstevel@tonic-gate dp->d_ino, 33067c478bd9Sstevel@tonic-gate dp->d_off, 33077c478bd9Sstevel@tonic-gate dp->d_reclen, 33087c478bd9Sstevel@tonic-gate dp->d_reclen - (int)(dp->d_name - (char *)dp), 33097c478bd9Sstevel@tonic-gate dp->d_name); 33107c478bd9Sstevel@tonic-gate nb -= dp->d_reclen; 33117c478bd9Sstevel@tonic-gate count -= dp->d_reclen; 33127c478bd9Sstevel@tonic-gate offset += dp->d_reclen; 33137c478bd9Sstevel@tonic-gate /* LINTED improper alignment */ 33147c478bd9Sstevel@tonic-gate dp = (struct dirent32 *)((char *)dp + dp->d_reclen); 33157c478bd9Sstevel@tonic-gate } 33167c478bd9Sstevel@tonic-gate } 33177c478bd9Sstevel@tonic-gate 33187c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 33197c478bd9Sstevel@tonic-gate if (serial) 33207c478bd9Sstevel@tonic-gate Xserialize(); 33217c478bd9Sstevel@tonic-gate } 33227c478bd9Sstevel@tonic-gate 33237c478bd9Sstevel@tonic-gate void 33247c478bd9Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count) 33257c478bd9Sstevel@tonic-gate { 33267c478bd9Sstevel@tonic-gate long long buf[MYBUFSIZ / sizeof (long long)]; 33277c478bd9Sstevel@tonic-gate struct dirent64 *dp; 33287c478bd9Sstevel@tonic-gate int serial = (count > 100); 33297c478bd9Sstevel@tonic-gate 33307c478bd9Sstevel@tonic-gate if (offset == NULL) 33317c478bd9Sstevel@tonic-gate return; 33327c478bd9Sstevel@tonic-gate 33337c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 33347c478bd9Sstevel@tonic-gate if (serial) 33357c478bd9Sstevel@tonic-gate Eserialize(); 33367c478bd9Sstevel@tonic-gate 33377c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) { 33387c478bd9Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ; 33397c478bd9Sstevel@tonic-gate 33407c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0) 33417c478bd9Sstevel@tonic-gate break; 33427c478bd9Sstevel@tonic-gate 33437c478bd9Sstevel@tonic-gate dp = (struct dirent64 *)&buf[0]; 33447c478bd9Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp)) 33457c478bd9Sstevel@tonic-gate break; 33467c478bd9Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) { 33477c478bd9Sstevel@tonic-gate /* getdents() error? */ 33487c478bd9Sstevel@tonic-gate (void) printf( 33497c478bd9Sstevel@tonic-gate "%s ino=%-5llu off=%-4lld rlen=%-3d\n", 33507c478bd9Sstevel@tonic-gate pri->pname, 33517c478bd9Sstevel@tonic-gate (long long)dp->d_ino, 33527c478bd9Sstevel@tonic-gate (long long)dp->d_off, 33537c478bd9Sstevel@tonic-gate dp->d_reclen); 33547c478bd9Sstevel@tonic-gate break; 33557c478bd9Sstevel@tonic-gate } 33567c478bd9Sstevel@tonic-gate 33577c478bd9Sstevel@tonic-gate while (!interrupt && 33587c478bd9Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) && 33597c478bd9Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) { 33607c478bd9Sstevel@tonic-gate (void) printf( 33617c478bd9Sstevel@tonic-gate "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n", 33627c478bd9Sstevel@tonic-gate pri->pname, 33637c478bd9Sstevel@tonic-gate (long long)dp->d_ino, 33647c478bd9Sstevel@tonic-gate (long long)dp->d_off, 33657c478bd9Sstevel@tonic-gate dp->d_reclen, 33667c478bd9Sstevel@tonic-gate dp->d_reclen - (int)(dp->d_name - (char *)dp), 33677c478bd9Sstevel@tonic-gate dp->d_name); 33687c478bd9Sstevel@tonic-gate nb -= dp->d_reclen; 33697c478bd9Sstevel@tonic-gate count -= dp->d_reclen; 33707c478bd9Sstevel@tonic-gate offset += dp->d_reclen; 33717c478bd9Sstevel@tonic-gate /* LINTED improper alignment */ 33727c478bd9Sstevel@tonic-gate dp = (struct dirent64 *)((char *)dp + dp->d_reclen); 33737c478bd9Sstevel@tonic-gate } 33747c478bd9Sstevel@tonic-gate } 33757c478bd9Sstevel@tonic-gate 33767c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 33777c478bd9Sstevel@tonic-gate if (serial) 33787c478bd9Sstevel@tonic-gate Xserialize(); 33797c478bd9Sstevel@tonic-gate } 33807c478bd9Sstevel@tonic-gate 33817c478bd9Sstevel@tonic-gate void 33827c478bd9Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset) 33837c478bd9Sstevel@tonic-gate { 33847c478bd9Sstevel@tonic-gate struct rlimit32 rlimit; 33857c478bd9Sstevel@tonic-gate 33867c478bd9Sstevel@tonic-gate if (offset != NULL && 33877c478bd9Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 33887c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 33897c478bd9Sstevel@tonic-gate switch (rlimit.rlim_cur) { 33907c478bd9Sstevel@tonic-gate case RLIM32_INFINITY: 33917c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_INFINITY", stdout); 33927c478bd9Sstevel@tonic-gate break; 33937c478bd9Sstevel@tonic-gate case RLIM32_SAVED_MAX: 33947c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_MAX", stdout); 33957c478bd9Sstevel@tonic-gate break; 33967c478bd9Sstevel@tonic-gate case RLIM32_SAVED_CUR: 33977c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_CUR", stdout); 33987c478bd9Sstevel@tonic-gate break; 33997c478bd9Sstevel@tonic-gate default: 34007c478bd9Sstevel@tonic-gate (void) printf("cur = %lu", (long)rlimit.rlim_cur); 34017c478bd9Sstevel@tonic-gate break; 34027c478bd9Sstevel@tonic-gate } 34037c478bd9Sstevel@tonic-gate switch (rlimit.rlim_max) { 34047c478bd9Sstevel@tonic-gate case RLIM32_INFINITY: 34057c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_INFINITY\n", stdout); 34067c478bd9Sstevel@tonic-gate break; 34077c478bd9Sstevel@tonic-gate case RLIM32_SAVED_MAX: 34087c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_MAX\n", stdout); 34097c478bd9Sstevel@tonic-gate break; 34107c478bd9Sstevel@tonic-gate case RLIM32_SAVED_CUR: 34117c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_CUR\n", stdout); 34127c478bd9Sstevel@tonic-gate break; 34137c478bd9Sstevel@tonic-gate default: 34147c478bd9Sstevel@tonic-gate (void) printf(" max = %lu\n", (long)rlimit.rlim_max); 34157c478bd9Sstevel@tonic-gate break; 34167c478bd9Sstevel@tonic-gate } 34177c478bd9Sstevel@tonic-gate } 34187c478bd9Sstevel@tonic-gate } 34197c478bd9Sstevel@tonic-gate 34207c478bd9Sstevel@tonic-gate void 34217c478bd9Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset) 34227c478bd9Sstevel@tonic-gate { 34237c478bd9Sstevel@tonic-gate struct rlimit64 rlimit; 34247c478bd9Sstevel@tonic-gate 34257c478bd9Sstevel@tonic-gate if (offset != NULL && 34267c478bd9Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) { 34277c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname); 34287c478bd9Sstevel@tonic-gate switch (rlimit.rlim_cur) { 34297c478bd9Sstevel@tonic-gate case RLIM64_INFINITY: 34307c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_INFINITY", stdout); 34317c478bd9Sstevel@tonic-gate break; 34327c478bd9Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34337c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_MAX", stdout); 34347c478bd9Sstevel@tonic-gate break; 34357c478bd9Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34367c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_CUR", stdout); 34377c478bd9Sstevel@tonic-gate break; 34387c478bd9Sstevel@tonic-gate default: 34397c478bd9Sstevel@tonic-gate (void) printf("cur = %llu", 34407c478bd9Sstevel@tonic-gate (unsigned long long)rlimit.rlim_cur); 34417c478bd9Sstevel@tonic-gate break; 34427c478bd9Sstevel@tonic-gate } 34437c478bd9Sstevel@tonic-gate switch (rlimit.rlim_max) { 34447c478bd9Sstevel@tonic-gate case RLIM64_INFINITY: 34457c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_INFINITY\n", stdout); 34467c478bd9Sstevel@tonic-gate break; 34477c478bd9Sstevel@tonic-gate case RLIM64_SAVED_MAX: 34487c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout); 34497c478bd9Sstevel@tonic-gate break; 34507c478bd9Sstevel@tonic-gate case RLIM64_SAVED_CUR: 34517c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout); 34527c478bd9Sstevel@tonic-gate break; 34537c478bd9Sstevel@tonic-gate default: 34547c478bd9Sstevel@tonic-gate (void) printf(" max = %llu\n", 34557c478bd9Sstevel@tonic-gate (unsigned long long)rlimit.rlim_max); 34567c478bd9Sstevel@tonic-gate break; 34577c478bd9Sstevel@tonic-gate } 34587c478bd9Sstevel@tonic-gate } 34597c478bd9Sstevel@tonic-gate } 34607c478bd9Sstevel@tonic-gate 34617c478bd9Sstevel@tonic-gate void 34627c478bd9Sstevel@tonic-gate show_nuname(private_t *pri, long offset) 34637c478bd9Sstevel@tonic-gate { 34647c478bd9Sstevel@tonic-gate struct utsname ubuf; 34657c478bd9Sstevel@tonic-gate 34667c478bd9Sstevel@tonic-gate if (offset != NULL && 34677c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) { 34687c478bd9Sstevel@tonic-gate (void) printf( 34697c478bd9Sstevel@tonic-gate "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n", 34707c478bd9Sstevel@tonic-gate pri->pname, 34717c478bd9Sstevel@tonic-gate ubuf.sysname, 34727c478bd9Sstevel@tonic-gate ubuf.nodename, 34737c478bd9Sstevel@tonic-gate ubuf.release, 34747c478bd9Sstevel@tonic-gate ubuf.version, 34757c478bd9Sstevel@tonic-gate ubuf.machine); 34767c478bd9Sstevel@tonic-gate } 34777c478bd9Sstevel@tonic-gate } 34787c478bd9Sstevel@tonic-gate 34797c478bd9Sstevel@tonic-gate void 34807c478bd9Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2) 34817c478bd9Sstevel@tonic-gate { 34827c478bd9Sstevel@tonic-gate show_timeval(pri, off1, " delta"); 34837c478bd9Sstevel@tonic-gate show_timeval(pri, off2, "olddelta"); 34847c478bd9Sstevel@tonic-gate } 34857c478bd9Sstevel@tonic-gate 34867c478bd9Sstevel@tonic-gate void 34877c478bd9Sstevel@tonic-gate show_sockaddr(private_t *pri, 34887c478bd9Sstevel@tonic-gate const char *str, long addroff, long lenoff, long len) 34897c478bd9Sstevel@tonic-gate { 34907c478bd9Sstevel@tonic-gate /* 34917c478bd9Sstevel@tonic-gate * A buffer large enough for PATH_MAX size AF_UNIX address, which is 34927c478bd9Sstevel@tonic-gate * also large enough to store a sockaddr_in or a sockaddr_in6. 34937c478bd9Sstevel@tonic-gate */ 34947c478bd9Sstevel@tonic-gate long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1) 34957c478bd9Sstevel@tonic-gate / sizeof (long)]; 34967c478bd9Sstevel@tonic-gate struct sockaddr *sa = (struct sockaddr *)buf; 34977c478bd9Sstevel@tonic-gate struct sockaddr_in *sin = (struct sockaddr_in *)buf; 34987c478bd9Sstevel@tonic-gate struct sockaddr_un *soun = (struct sockaddr_un *)buf; 34997c478bd9Sstevel@tonic-gate struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf; 35007c478bd9Sstevel@tonic-gate char addrbuf[INET6_ADDRSTRLEN]; 35017c478bd9Sstevel@tonic-gate 35027c478bd9Sstevel@tonic-gate if (lenoff != 0) { 35037c478bd9Sstevel@tonic-gate uint_t ilen; 35047c478bd9Sstevel@tonic-gate if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen)) 35057c478bd9Sstevel@tonic-gate return; 35067c478bd9Sstevel@tonic-gate len = ilen; 35077c478bd9Sstevel@tonic-gate } 35087c478bd9Sstevel@tonic-gate 35097c478bd9Sstevel@tonic-gate if (len >= sizeof (buf)) /* protect against ridiculous length */ 35107c478bd9Sstevel@tonic-gate len = sizeof (buf) - 1; 35117c478bd9Sstevel@tonic-gate if (Pread(Proc, buf, len, addroff) != len) 35127c478bd9Sstevel@tonic-gate return; 35137c478bd9Sstevel@tonic-gate 35147c478bd9Sstevel@tonic-gate switch (sa->sa_family) { 35157c478bd9Sstevel@tonic-gate case AF_INET6: 35167c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_INET6 %s = %s port = %u\n", 35177c478bd9Sstevel@tonic-gate pri->pname, str, 35187c478bd9Sstevel@tonic-gate inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, 35197c478bd9Sstevel@tonic-gate sizeof (addrbuf)), 35207c478bd9Sstevel@tonic-gate ntohs(sin6->sin6_port)); 35217c478bd9Sstevel@tonic-gate (void) printf("%s\tscope id = %u source id = 0x%x\n" 35227c478bd9Sstevel@tonic-gate "%s\tflow class = 0x%02x flow label = 0x%05x\n", 35237c478bd9Sstevel@tonic-gate pri->pname, ntohl(sin6->sin6_scope_id), 35247c478bd9Sstevel@tonic-gate ntohl(sin6->__sin6_src_id), 35257c478bd9Sstevel@tonic-gate pri->pname, 35267c478bd9Sstevel@tonic-gate ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20), 35277c478bd9Sstevel@tonic-gate ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL)); 35287c478bd9Sstevel@tonic-gate break; 35297c478bd9Sstevel@tonic-gate case AF_INET: 35307c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_%s %s = %s port = %u\n", 35312caf0dcdSrshoaib pri->pname, "INET", 35327c478bd9Sstevel@tonic-gate str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf, 35337c478bd9Sstevel@tonic-gate sizeof (addrbuf)), ntohs(sin->sin_port)); 35347c478bd9Sstevel@tonic-gate break; 35357c478bd9Sstevel@tonic-gate case AF_UNIX: 35367c478bd9Sstevel@tonic-gate len -= sizeof (soun->sun_family); 35377c478bd9Sstevel@tonic-gate if (len >= 0) { 35387c478bd9Sstevel@tonic-gate /* Null terminate */ 35397c478bd9Sstevel@tonic-gate soun->sun_path[len] = NULL; 35407c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_UNIX %s = %s\n", pri->pname, 35417c478bd9Sstevel@tonic-gate str, soun->sun_path); 35427c478bd9Sstevel@tonic-gate } 35437c478bd9Sstevel@tonic-gate break; 35447c478bd9Sstevel@tonic-gate } 35457c478bd9Sstevel@tonic-gate } 35467c478bd9Sstevel@tonic-gate 35477c478bd9Sstevel@tonic-gate void 35487c478bd9Sstevel@tonic-gate show_msghdr(private_t *pri, long offset) 35497c478bd9Sstevel@tonic-gate { 355081006e0fSja97890 const lwpstatus_t *Lsp = pri->lwpstat; 355181006e0fSja97890 int what = Lsp->pr_what; 355281006e0fSja97890 int err = pri->Errno; 35537c478bd9Sstevel@tonic-gate struct msghdr msg; 355481006e0fSja97890 int showbuf = FALSE; 355581006e0fSja97890 int i = pri->sys_args[0]+1; 355681006e0fSja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35577c478bd9Sstevel@tonic-gate 35587c478bd9Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35597c478bd9Sstevel@tonic-gate return; 356081006e0fSja97890 35617c478bd9Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 35627c478bd9Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 35637c478bd9Sstevel@tonic-gate (long)msg.msg_name, 0, (long)msg.msg_namelen); 356481006e0fSja97890 356581006e0fSja97890 /* 356681006e0fSja97890 * Print the iovec if the syscall was successful and the fd is 356781006e0fSja97890 * part of the set being traced. 356881006e0fSja97890 */ 356981006e0fSja97890 if ((what == SYS_recvmsg && !err && 357081006e0fSja97890 prismember(&readfd, i)) || 357181006e0fSja97890 (what == SYS_sendmsg && 357281006e0fSja97890 prismember(&writefd, i))) 357381006e0fSja97890 showbuf = TRUE; 357481006e0fSja97890 357581006e0fSja97890 show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 357681006e0fSja97890 35777c478bd9Sstevel@tonic-gate } 35787c478bd9Sstevel@tonic-gate 35797c478bd9Sstevel@tonic-gate #ifdef _LP64 35807c478bd9Sstevel@tonic-gate void 35817c478bd9Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset) 35827c478bd9Sstevel@tonic-gate { 35837c478bd9Sstevel@tonic-gate struct msghdr32 { 35847c478bd9Sstevel@tonic-gate caddr32_t msg_name; 358581006e0fSja97890 uint32_t msg_namelen; 358681006e0fSja97890 caddr32_t msg_iov; 358781006e0fSja97890 int32_t msg_iovlen; 35887c478bd9Sstevel@tonic-gate } msg; 358981006e0fSja97890 const lwpstatus_t *Lsp = pri->lwpstat; 359081006e0fSja97890 int what = Lsp->pr_what; 359181006e0fSja97890 int err = pri->Errno; 359281006e0fSja97890 int showbuf = FALSE; 359381006e0fSja97890 int i = pri->sys_args[0]+1; 359481006e0fSja97890 long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024; 35957c478bd9Sstevel@tonic-gate 35967c478bd9Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg)) 35977c478bd9Sstevel@tonic-gate return; 359881006e0fSja97890 35997c478bd9Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0) 36007c478bd9Sstevel@tonic-gate show_sockaddr(pri, "msg_name", 36017c478bd9Sstevel@tonic-gate (long)msg.msg_name, 0, (long)msg.msg_namelen); 360281006e0fSja97890 /* 360381006e0fSja97890 * Print the iovec if the syscall was successful and the fd is 360481006e0fSja97890 * part of the set being traced. 360581006e0fSja97890 */ 360681006e0fSja97890 if ((what == SYS_recvmsg && !err && 360781006e0fSja97890 prismember(&readfd, i)) || 360881006e0fSja97890 (what == SYS_sendmsg && 360981006e0fSja97890 prismember(&writefd, i))) 361081006e0fSja97890 showbuf = TRUE; 361181006e0fSja97890 361281006e0fSja97890 show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb); 361381006e0fSja97890 36147c478bd9Sstevel@tonic-gate } 36157c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 36167c478bd9Sstevel@tonic-gate 36177c478bd9Sstevel@tonic-gate static void 36187c478bd9Sstevel@tonic-gate show_doorargs(private_t *pri, long offset) 36197c478bd9Sstevel@tonic-gate { 36207c478bd9Sstevel@tonic-gate door_arg_t args; 36217c478bd9Sstevel@tonic-gate 36227c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 36237c478bd9Sstevel@tonic-gate (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n", 36247c478bd9Sstevel@tonic-gate pri->pname, 36257c478bd9Sstevel@tonic-gate (ulong_t)args.data_ptr, 36267c478bd9Sstevel@tonic-gate (ulong_t)args.data_size); 36277c478bd9Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n", 36287c478bd9Sstevel@tonic-gate pri->pname, 36297c478bd9Sstevel@tonic-gate (ulong_t)args.desc_ptr, 36307c478bd9Sstevel@tonic-gate args.desc_num); 36317c478bd9Sstevel@tonic-gate (void) printf("%s\trbuf=0x%lX rsize=%lu\n", 36327c478bd9Sstevel@tonic-gate pri->pname, 36337c478bd9Sstevel@tonic-gate (ulong_t)args.rbuf, 36347c478bd9Sstevel@tonic-gate (ulong_t)args.rsize); 36357c478bd9Sstevel@tonic-gate } 36367c478bd9Sstevel@tonic-gate } 36377c478bd9Sstevel@tonic-gate 36387c478bd9Sstevel@tonic-gate static void 36397c478bd9Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc) 36407c478bd9Sstevel@tonic-gate { 36417c478bd9Sstevel@tonic-gate int i = 0; 36427c478bd9Sstevel@tonic-gate const priv_set_t *s; 36437c478bd9Sstevel@tonic-gate priv_ptype_t sn; 36447c478bd9Sstevel@tonic-gate char *str; 36457c478bd9Sstevel@tonic-gate 36467c478bd9Sstevel@tonic-gate while ((sn = priv_getsetbynum(i++)) != NULL) { 36477c478bd9Sstevel@tonic-gate s = ucred_getprivset(uc, sn); 36487c478bd9Sstevel@tonic-gate 36497c478bd9Sstevel@tonic-gate if (s == NULL) 36507c478bd9Sstevel@tonic-gate continue; 36517c478bd9Sstevel@tonic-gate 36527c478bd9Sstevel@tonic-gate (void) printf("%s\t%c: %s\n", 36537c478bd9Sstevel@tonic-gate pri->pname, 36547c478bd9Sstevel@tonic-gate *sn, 36557c478bd9Sstevel@tonic-gate str = priv_set_to_str(s, ',', PRIV_STR_SHORT)); 36567c478bd9Sstevel@tonic-gate 36577c478bd9Sstevel@tonic-gate free(str); 36587c478bd9Sstevel@tonic-gate } 36597c478bd9Sstevel@tonic-gate } 36607c478bd9Sstevel@tonic-gate 36617c478bd9Sstevel@tonic-gate static void 36627c478bd9Sstevel@tonic-gate show_ucred(private_t *pri, long offset) 36637c478bd9Sstevel@tonic-gate { 36647c478bd9Sstevel@tonic-gate ucred_t *uc = _ucred_alloc(); 36657c478bd9Sstevel@tonic-gate size_t sz; 36667c478bd9Sstevel@tonic-gate 36677c478bd9Sstevel@tonic-gate if (uc == NULL) 36687c478bd9Sstevel@tonic-gate return; 36697c478bd9Sstevel@tonic-gate 36707c478bd9Sstevel@tonic-gate sz = Pread(Proc, uc, uc->uc_size, offset); 36717c478bd9Sstevel@tonic-gate 36727c478bd9Sstevel@tonic-gate /* 36737c478bd9Sstevel@tonic-gate * A new uc_size is read, it could be smaller than the previously 36747c478bd9Sstevel@tonic-gate * value. We accept short reads that fill the whole header. 36757c478bd9Sstevel@tonic-gate */ 36767c478bd9Sstevel@tonic-gate if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) { 36777c478bd9Sstevel@tonic-gate (void) printf("%s\teuid=%d egid=%d\n", 36787c478bd9Sstevel@tonic-gate pri->pname, 36797c478bd9Sstevel@tonic-gate (int)ucred_geteuid(uc), 36807c478bd9Sstevel@tonic-gate (int)ucred_getegid(uc)); 36817c478bd9Sstevel@tonic-gate (void) printf("%s\truid=%d rgid=%d\n", 36827c478bd9Sstevel@tonic-gate pri->pname, 36837c478bd9Sstevel@tonic-gate (int)ucred_getruid(uc), 36847c478bd9Sstevel@tonic-gate (int)ucred_getrgid(uc)); 36857c478bd9Sstevel@tonic-gate (void) printf("%s\tpid=%d zoneid=%d\n", 36867c478bd9Sstevel@tonic-gate pri->pname, 36877c478bd9Sstevel@tonic-gate (int)ucred_getpid(uc), 36887c478bd9Sstevel@tonic-gate (int)ucred_getzoneid(uc)); 36897c478bd9Sstevel@tonic-gate show_ucred_privsets(pri, uc); 36907c478bd9Sstevel@tonic-gate } 36917c478bd9Sstevel@tonic-gate ucred_free(uc); 36927c478bd9Sstevel@tonic-gate } 36937c478bd9Sstevel@tonic-gate 36947c478bd9Sstevel@tonic-gate static void 3695821c4a97Sdp show_privset(private_t *pri, long offset, size_t size, char *label) 36967c478bd9Sstevel@tonic-gate { 36977c478bd9Sstevel@tonic-gate priv_set_t *tmp = priv_allocset(); 36987c478bd9Sstevel@tonic-gate size_t sz; 36997c478bd9Sstevel@tonic-gate 37007c478bd9Sstevel@tonic-gate if (tmp == NULL) 37017c478bd9Sstevel@tonic-gate return; 37027c478bd9Sstevel@tonic-gate 37037c478bd9Sstevel@tonic-gate sz = Pread(Proc, tmp, size, offset); 37047c478bd9Sstevel@tonic-gate 37057c478bd9Sstevel@tonic-gate if (sz == size) { 37067c478bd9Sstevel@tonic-gate char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT); 37077c478bd9Sstevel@tonic-gate if (str != NULL) { 3708821c4a97Sdp (void) printf("%s\t%s%s\n", pri->pname, label, str); 37097c478bd9Sstevel@tonic-gate free(str); 37107c478bd9Sstevel@tonic-gate } 37117c478bd9Sstevel@tonic-gate } 37127c478bd9Sstevel@tonic-gate priv_freeset(tmp); 37137c478bd9Sstevel@tonic-gate } 37147c478bd9Sstevel@tonic-gate 37157c478bd9Sstevel@tonic-gate static void 37167c478bd9Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset) 37177c478bd9Sstevel@tonic-gate { 37187c478bd9Sstevel@tonic-gate door_info_t info; 37197c478bd9Sstevel@tonic-gate door_attr_t attr; 37207c478bd9Sstevel@tonic-gate 37217c478bd9Sstevel@tonic-gate if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info)) 37227c478bd9Sstevel@tonic-gate return; 37237c478bd9Sstevel@tonic-gate (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n", 37247c478bd9Sstevel@tonic-gate pri->pname, 37257c478bd9Sstevel@tonic-gate (int)info.di_target, 37267c478bd9Sstevel@tonic-gate info.di_proc, 37277c478bd9Sstevel@tonic-gate info.di_data); 37287c478bd9Sstevel@tonic-gate attr = info.di_attributes; 37297c478bd9Sstevel@tonic-gate (void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr)); 37307c478bd9Sstevel@tonic-gate (void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier); 37317c478bd9Sstevel@tonic-gate } 37327c478bd9Sstevel@tonic-gate 37337c478bd9Sstevel@tonic-gate static void 37347c478bd9Sstevel@tonic-gate show_doorparam(private_t *pri, long offset) 37357c478bd9Sstevel@tonic-gate { 37367c478bd9Sstevel@tonic-gate ulong_t val; 37377c478bd9Sstevel@tonic-gate 37387c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37397c478bd9Sstevel@tonic-gate (void) printf("%s\tvalue=%lu\n", 37407c478bd9Sstevel@tonic-gate pri->pname, 37417c478bd9Sstevel@tonic-gate val); 37427c478bd9Sstevel@tonic-gate } 37437c478bd9Sstevel@tonic-gate } 37447c478bd9Sstevel@tonic-gate 37457c478bd9Sstevel@tonic-gate #ifdef _LP64 37467c478bd9Sstevel@tonic-gate 37477c478bd9Sstevel@tonic-gate static void 37487c478bd9Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset) 37497c478bd9Sstevel@tonic-gate { 37507c478bd9Sstevel@tonic-gate struct door_arg32 args; 37517c478bd9Sstevel@tonic-gate 37527c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 37537c478bd9Sstevel@tonic-gate (void) printf("%s\tdata_ptr=%X data_size=%u\n", 37547c478bd9Sstevel@tonic-gate pri->pname, 37557c478bd9Sstevel@tonic-gate args.data_ptr, 37567c478bd9Sstevel@tonic-gate args.data_size); 37577c478bd9Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n", 37587c478bd9Sstevel@tonic-gate pri->pname, 37597c478bd9Sstevel@tonic-gate args.desc_ptr, 37607c478bd9Sstevel@tonic-gate args.desc_num); 37617c478bd9Sstevel@tonic-gate (void) printf("%s\trbuf=0x%X rsize=%u\n", 37627c478bd9Sstevel@tonic-gate pri->pname, 37637c478bd9Sstevel@tonic-gate args.rbuf, 37647c478bd9Sstevel@tonic-gate args.rsize); 37657c478bd9Sstevel@tonic-gate } 37667c478bd9Sstevel@tonic-gate } 37677c478bd9Sstevel@tonic-gate 37687c478bd9Sstevel@tonic-gate static void 37697c478bd9Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset) 37707c478bd9Sstevel@tonic-gate { 37717c478bd9Sstevel@tonic-gate uint_t val; 37727c478bd9Sstevel@tonic-gate 37737c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) { 37747c478bd9Sstevel@tonic-gate (void) printf("%s\tvalue=%u\n", 37757c478bd9Sstevel@tonic-gate pri->pname, 37767c478bd9Sstevel@tonic-gate val); 37777c478bd9Sstevel@tonic-gate } 37787c478bd9Sstevel@tonic-gate } 37797c478bd9Sstevel@tonic-gate 37807c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 37817c478bd9Sstevel@tonic-gate 37827c478bd9Sstevel@tonic-gate static void 37837c478bd9Sstevel@tonic-gate show_doors(private_t *pri) 37847c478bd9Sstevel@tonic-gate { 37857c478bd9Sstevel@tonic-gate switch (pri->sys_args[5]) { 37867c478bd9Sstevel@tonic-gate case DOOR_CALL: 37877c478bd9Sstevel@tonic-gate #ifdef _LP64 37887c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 37897c478bd9Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37907c478bd9Sstevel@tonic-gate else 37917c478bd9Sstevel@tonic-gate show_doorargs32(pri, (long)pri->sys_args[1]); 37927c478bd9Sstevel@tonic-gate #else 37937c478bd9Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]); 37947c478bd9Sstevel@tonic-gate #endif 37957c478bd9Sstevel@tonic-gate break; 37967c478bd9Sstevel@tonic-gate case DOOR_UCRED: 37977c478bd9Sstevel@tonic-gate if (!pri->Errno) 37987c478bd9Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[0]); 37997c478bd9Sstevel@tonic-gate break; 38007c478bd9Sstevel@tonic-gate case DOOR_INFO: 38017c478bd9Sstevel@tonic-gate if (!pri->Errno) 38027c478bd9Sstevel@tonic-gate show_doorinfo(pri, (long)pri->sys_args[1]); 38037c478bd9Sstevel@tonic-gate break; 38047c478bd9Sstevel@tonic-gate case DOOR_GETPARAM: 38057c478bd9Sstevel@tonic-gate if (!pri->Errno) { 38067c478bd9Sstevel@tonic-gate #ifdef _LP64 38077c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 38087c478bd9Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 38097c478bd9Sstevel@tonic-gate else 38107c478bd9Sstevel@tonic-gate show_doorparam32(pri, (long)pri->sys_args[2]); 38117c478bd9Sstevel@tonic-gate #else 38127c478bd9Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]); 38137c478bd9Sstevel@tonic-gate #endif 38147c478bd9Sstevel@tonic-gate } 38157c478bd9Sstevel@tonic-gate break; 38167c478bd9Sstevel@tonic-gate } 38177c478bd9Sstevel@tonic-gate } 38187c478bd9Sstevel@tonic-gate 38197c478bd9Sstevel@tonic-gate static void 38207c478bd9Sstevel@tonic-gate show_portargs(private_t *pri, long offset) 38217c478bd9Sstevel@tonic-gate { 38227c478bd9Sstevel@tonic-gate port_event_t args; 38237c478bd9Sstevel@tonic-gate 38247c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38257c478bd9Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38267c478bd9Sstevel@tonic-gate pri->pname, 38277c478bd9Sstevel@tonic-gate args.portev_events, 38287c478bd9Sstevel@tonic-gate args.portev_source); 38297c478bd9Sstevel@tonic-gate (void) printf("%s\tobject=0x%p user=0x%p\n", 38307c478bd9Sstevel@tonic-gate pri->pname, 38317c478bd9Sstevel@tonic-gate (void *)args.portev_object, 38327c478bd9Sstevel@tonic-gate (void *)args.portev_user); 38337c478bd9Sstevel@tonic-gate } 38347c478bd9Sstevel@tonic-gate } 38357c478bd9Sstevel@tonic-gate 38367c478bd9Sstevel@tonic-gate 38377c478bd9Sstevel@tonic-gate #ifdef _LP64 38387c478bd9Sstevel@tonic-gate 38397c478bd9Sstevel@tonic-gate static void 38407c478bd9Sstevel@tonic-gate show_portargs32(private_t *pri, long offset) 38417c478bd9Sstevel@tonic-gate { 38427c478bd9Sstevel@tonic-gate port_event32_t args; 38437c478bd9Sstevel@tonic-gate 38447c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 38457c478bd9Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n", 38467c478bd9Sstevel@tonic-gate pri->pname, 38477c478bd9Sstevel@tonic-gate args.portev_events, 38487c478bd9Sstevel@tonic-gate args.portev_source); 38497c478bd9Sstevel@tonic-gate (void) printf("%s\tobject=0x%x user=0x%x\n", 38507c478bd9Sstevel@tonic-gate pri->pname, 38517c478bd9Sstevel@tonic-gate args.portev_object, 38527c478bd9Sstevel@tonic-gate args.portev_user); 38537c478bd9Sstevel@tonic-gate } 38547c478bd9Sstevel@tonic-gate } 38557c478bd9Sstevel@tonic-gate 38567c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 38577c478bd9Sstevel@tonic-gate 38587c478bd9Sstevel@tonic-gate static void 38597c478bd9Sstevel@tonic-gate show_ports(private_t *pri) 38607c478bd9Sstevel@tonic-gate { 38617c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 38627c478bd9Sstevel@tonic-gate case PORT_GET: 38637c478bd9Sstevel@tonic-gate #ifdef _LP64 38647c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 38657c478bd9Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38667c478bd9Sstevel@tonic-gate else 38677c478bd9Sstevel@tonic-gate show_portargs32(pri, (long)pri->sys_args[2]); 38687c478bd9Sstevel@tonic-gate #else 38697c478bd9Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]); 38707c478bd9Sstevel@tonic-gate #endif 38717c478bd9Sstevel@tonic-gate break; 38727c478bd9Sstevel@tonic-gate } 38737c478bd9Sstevel@tonic-gate } 38747c478bd9Sstevel@tonic-gate 38757c478bd9Sstevel@tonic-gate #define MAX_SNDFL_PRD 16 38767c478bd9Sstevel@tonic-gate 38777c478bd9Sstevel@tonic-gate #ifdef _LP64 38787c478bd9Sstevel@tonic-gate 38797c478bd9Sstevel@tonic-gate static void 38807c478bd9Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd, 38817c478bd9Sstevel@tonic-gate ksendfilevec32_t *sndvec, int sfvcnt) 38827c478bd9Sstevel@tonic-gate { 38837c478bd9Sstevel@tonic-gate ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD]; 38847c478bd9Sstevel@tonic-gate size_t cpy_rqst; 38857c478bd9Sstevel@tonic-gate 38867c478bd9Sstevel@tonic-gate Eserialize(); 38877c478bd9Sstevel@tonic-gate while (sfvcnt > 0) { 38887c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 38897c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst; 38907c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 38917c478bd9Sstevel@tonic-gate 38927c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 38937c478bd9Sstevel@tonic-gate break; 38947c478bd9Sstevel@tonic-gate 38957c478bd9Sstevel@tonic-gate snd_ptr = &snd[0]; 38967c478bd9Sstevel@tonic-gate 38977c478bd9Sstevel@tonic-gate while (cpy_rqst) { 38987c478bd9Sstevel@tonic-gate (void) printf( 38997c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39007c478bd9Sstevel@tonic-gate "sfv_off=%d\tsfv_len=%u\n", 39017c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd, 39027c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag, 39037c478bd9Sstevel@tonic-gate snd_ptr->sfv_off, 39047c478bd9Sstevel@tonic-gate snd_ptr->sfv_len); 39057c478bd9Sstevel@tonic-gate 39067c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39077c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) { 39087c478bd9Sstevel@tonic-gate showbuffer(pri, 39097c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 39107c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len); 39117c478bd9Sstevel@tonic-gate } 39127c478bd9Sstevel@tonic-gate 39137c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39147c478bd9Sstevel@tonic-gate snd_ptr++; 39157c478bd9Sstevel@tonic-gate } 39167c478bd9Sstevel@tonic-gate 39177c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39187c478bd9Sstevel@tonic-gate } 39197c478bd9Sstevel@tonic-gate Xserialize(); 39207c478bd9Sstevel@tonic-gate } 39217c478bd9Sstevel@tonic-gate 39227c478bd9Sstevel@tonic-gate static void 39237c478bd9Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd, 39247c478bd9Sstevel@tonic-gate ksendfilevec64_t *sndvec, int sfvcnt) 39257c478bd9Sstevel@tonic-gate { 39267c478bd9Sstevel@tonic-gate ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39277c478bd9Sstevel@tonic-gate size_t cpy_rqst; 39287c478bd9Sstevel@tonic-gate 39297c478bd9Sstevel@tonic-gate Eserialize(); 39307c478bd9Sstevel@tonic-gate while (sfvcnt > 0) { 39317c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39327c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39337c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39347c478bd9Sstevel@tonic-gate 39357c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39367c478bd9Sstevel@tonic-gate break; 39377c478bd9Sstevel@tonic-gate 39387c478bd9Sstevel@tonic-gate snd_ptr = &snd[0]; 39397c478bd9Sstevel@tonic-gate 39407c478bd9Sstevel@tonic-gate while (cpy_rqst) { 39417c478bd9Sstevel@tonic-gate (void) printf( 39427c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39437c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%u\n", 39447c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd, 39457c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag, 39467c478bd9Sstevel@tonic-gate snd_ptr->sfv_off, 39477c478bd9Sstevel@tonic-gate snd_ptr->sfv_len); 39487c478bd9Sstevel@tonic-gate 39497c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 39507c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) { 39517c478bd9Sstevel@tonic-gate showbuffer(pri, 39527c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff, 39537c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len); 39547c478bd9Sstevel@tonic-gate } 39557c478bd9Sstevel@tonic-gate 39567c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 39577c478bd9Sstevel@tonic-gate snd_ptr++; 39587c478bd9Sstevel@tonic-gate } 39597c478bd9Sstevel@tonic-gate 39607c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 39617c478bd9Sstevel@tonic-gate } 39627c478bd9Sstevel@tonic-gate Xserialize(); 39637c478bd9Sstevel@tonic-gate } 39647c478bd9Sstevel@tonic-gate 39657c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 39667c478bd9Sstevel@tonic-gate 39677c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 39687c478bd9Sstevel@tonic-gate static void 39697c478bd9Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt) 39707c478bd9Sstevel@tonic-gate { 39717c478bd9Sstevel@tonic-gate sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD]; 39727c478bd9Sstevel@tonic-gate size_t cpy_rqst; 39737c478bd9Sstevel@tonic-gate 39747c478bd9Sstevel@tonic-gate #ifdef _LP64 39757c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 39767c478bd9Sstevel@tonic-gate show_ksendfilevec32(pri, fd, 39777c478bd9Sstevel@tonic-gate (ksendfilevec32_t *)sndvec, sfvcnt); 39787c478bd9Sstevel@tonic-gate return; 39797c478bd9Sstevel@tonic-gate } 39807c478bd9Sstevel@tonic-gate #endif 39817c478bd9Sstevel@tonic-gate Eserialize(); 39827c478bd9Sstevel@tonic-gate while (sfvcnt > 0) { 39837c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 39847c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst; 39857c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 39867c478bd9Sstevel@tonic-gate 39877c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 39887c478bd9Sstevel@tonic-gate break; 39897c478bd9Sstevel@tonic-gate 39907c478bd9Sstevel@tonic-gate snd_ptr = &snd[0]; 39917c478bd9Sstevel@tonic-gate 39927c478bd9Sstevel@tonic-gate while (cpy_rqst) { 39937c478bd9Sstevel@tonic-gate (void) printf( 39947c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 39957c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 39967c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd, 39977c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag, 39987c478bd9Sstevel@tonic-gate snd_ptr->sfv_off, 39997c478bd9Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 40007c478bd9Sstevel@tonic-gate 40017c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 40027c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) { 40037c478bd9Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 40047c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len); 40057c478bd9Sstevel@tonic-gate } 40067c478bd9Sstevel@tonic-gate 40077c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 40087c478bd9Sstevel@tonic-gate snd_ptr++; 40097c478bd9Sstevel@tonic-gate } 40107c478bd9Sstevel@tonic-gate 40117c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 40127c478bd9Sstevel@tonic-gate } 40137c478bd9Sstevel@tonic-gate Xserialize(); 40147c478bd9Sstevel@tonic-gate } 40157c478bd9Sstevel@tonic-gate 40167c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 40177c478bd9Sstevel@tonic-gate static void 40187c478bd9Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt) 40197c478bd9Sstevel@tonic-gate { 40207c478bd9Sstevel@tonic-gate sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD]; 40217c478bd9Sstevel@tonic-gate size_t cpy_rqst; 40227c478bd9Sstevel@tonic-gate 40237c478bd9Sstevel@tonic-gate #ifdef _LP64 40247c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) { 40257c478bd9Sstevel@tonic-gate show_ksendfilevec64(pri, fd, 40267c478bd9Sstevel@tonic-gate (ksendfilevec64_t *)sndvec, sfvcnt); 40277c478bd9Sstevel@tonic-gate return; 40287c478bd9Sstevel@tonic-gate } 40297c478bd9Sstevel@tonic-gate #endif 40307c478bd9Sstevel@tonic-gate 40317c478bd9Sstevel@tonic-gate Eserialize(); 40327c478bd9Sstevel@tonic-gate while (sfvcnt > 0) { 40337c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD); 40347c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst; 40357c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]); 40367c478bd9Sstevel@tonic-gate 40377c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst) 40387c478bd9Sstevel@tonic-gate break; 40397c478bd9Sstevel@tonic-gate 40407c478bd9Sstevel@tonic-gate snd_ptr = &snd[0]; 40417c478bd9Sstevel@tonic-gate 40427c478bd9Sstevel@tonic-gate while (cpy_rqst) { 40437c478bd9Sstevel@tonic-gate (void) printf( 40447c478bd9Sstevel@tonic-gate #ifdef _LP64 40457c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40467c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n", 40477c478bd9Sstevel@tonic-gate #else 40487c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t" 40497c478bd9Sstevel@tonic-gate "sfv_off=%lld\tsfv_len=%lu\n", 40507c478bd9Sstevel@tonic-gate #endif 40517c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd, 40527c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag, 40537c478bd9Sstevel@tonic-gate snd_ptr->sfv_off, 40547c478bd9Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len); 40557c478bd9Sstevel@tonic-gate 40567c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF && 40577c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) { 40587c478bd9Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off, 40597c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len); 40607c478bd9Sstevel@tonic-gate } 40617c478bd9Sstevel@tonic-gate 40627c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]); 40637c478bd9Sstevel@tonic-gate snd_ptr++; 40647c478bd9Sstevel@tonic-gate } 40657c478bd9Sstevel@tonic-gate 40667c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD; 40677c478bd9Sstevel@tonic-gate } 40687c478bd9Sstevel@tonic-gate Xserialize(); 40697c478bd9Sstevel@tonic-gate } 40707c478bd9Sstevel@tonic-gate 40717c478bd9Sstevel@tonic-gate static void 40727c478bd9Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset) 40737c478bd9Sstevel@tonic-gate { 40747c478bd9Sstevel@tonic-gate struct memcntl_mha mha; 40757c478bd9Sstevel@tonic-gate const char *s = NULL; 40767c478bd9Sstevel@tonic-gate 40777c478bd9Sstevel@tonic-gate if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) { 40787c478bd9Sstevel@tonic-gate switch (mha.mha_cmd) { 40797c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 40807c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 40817c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 40827c478bd9Sstevel@tonic-gate } 40837c478bd9Sstevel@tonic-gate if (s) 40847c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 40857c478bd9Sstevel@tonic-gate " mha_pagesize=%lu\n", 40867c478bd9Sstevel@tonic-gate pri->pname, s, mha.mha_flags, 40877c478bd9Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40887c478bd9Sstevel@tonic-gate else 40897c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 40907c478bd9Sstevel@tonic-gate " mha_pagesize=%lu\n", 40917c478bd9Sstevel@tonic-gate pri->pname, mha.mha_cmd, mha.mha_flags, 40927c478bd9Sstevel@tonic-gate (ulong_t)mha.mha_pagesize); 40937c478bd9Sstevel@tonic-gate } 40947c478bd9Sstevel@tonic-gate } 40957c478bd9Sstevel@tonic-gate 40967c478bd9Sstevel@tonic-gate #ifdef _LP64 40977c478bd9Sstevel@tonic-gate 40987c478bd9Sstevel@tonic-gate static void 40997c478bd9Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset) 41007c478bd9Sstevel@tonic-gate { 41017c478bd9Sstevel@tonic-gate struct memcntl_mha32 mha32; 41027c478bd9Sstevel@tonic-gate const char *s = NULL; 41037c478bd9Sstevel@tonic-gate 41047c478bd9Sstevel@tonic-gate if (Pread(Proc, &mha32, sizeof (mha32), offset) == 41057c478bd9Sstevel@tonic-gate sizeof (mha32)) { 41067c478bd9Sstevel@tonic-gate switch (mha32.mha_cmd) { 41077c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break; 41087c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break; 41097c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break; 41107c478bd9Sstevel@tonic-gate } 41117c478bd9Sstevel@tonic-gate if (s) 41127c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x" 41137c478bd9Sstevel@tonic-gate " mha_pagesize=%u\n", 41147c478bd9Sstevel@tonic-gate pri->pname, s, mha32.mha_flags, mha32.mha_pagesize); 41157c478bd9Sstevel@tonic-gate else 41167c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x" 41177c478bd9Sstevel@tonic-gate " mha_pagesize=%u\n", 41187c478bd9Sstevel@tonic-gate pri->pname, mha32.mha_cmd, mha32.mha_flags, 41197c478bd9Sstevel@tonic-gate mha32.mha_pagesize); 41207c478bd9Sstevel@tonic-gate } 41217c478bd9Sstevel@tonic-gate } 41227c478bd9Sstevel@tonic-gate 41237c478bd9Sstevel@tonic-gate #endif /* _LP64 */ 41247c478bd9Sstevel@tonic-gate 41257c478bd9Sstevel@tonic-gate static void 41267c478bd9Sstevel@tonic-gate show_memcntl(private_t *pri) 41277c478bd9Sstevel@tonic-gate { 41287c478bd9Sstevel@tonic-gate 41297c478bd9Sstevel@tonic-gate if ((int)pri->sys_args[2] != MC_HAT_ADVISE) 41307c478bd9Sstevel@tonic-gate return; 41317c478bd9Sstevel@tonic-gate #ifdef _LP64 41327c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64) 41337c478bd9Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41347c478bd9Sstevel@tonic-gate else 41357c478bd9Sstevel@tonic-gate show_memcntl_mha32(pri, (long)pri->sys_args[3]); 41367c478bd9Sstevel@tonic-gate #else 41377c478bd9Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]); 41387c478bd9Sstevel@tonic-gate #endif 41397c478bd9Sstevel@tonic-gate } 41407c478bd9Sstevel@tonic-gate 41417c478bd9Sstevel@tonic-gate void 41427c478bd9Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count) 41437c478bd9Sstevel@tonic-gate { 41447c478bd9Sstevel@tonic-gate id_t buf[MYBUFSIZ / sizeof (id_t)]; 41457c478bd9Sstevel@tonic-gate id_t *idp; 41467c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 48); 41477c478bd9Sstevel@tonic-gate 41487c478bd9Sstevel@tonic-gate if (offset == NULL) 41497c478bd9Sstevel@tonic-gate return; 41507c478bd9Sstevel@tonic-gate 41517c478bd9Sstevel@tonic-gate /* enter region of lengthy output */ 41527c478bd9Sstevel@tonic-gate if (serial) 41537c478bd9Sstevel@tonic-gate Eserialize(); 41547c478bd9Sstevel@tonic-gate 41557c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) { 41567c478bd9Sstevel@tonic-gate ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)? 41577c478bd9Sstevel@tonic-gate count * sizeof (id_t) : MYBUFSIZ; 41587c478bd9Sstevel@tonic-gate 41597c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 || 41607c478bd9Sstevel@tonic-gate nb < sizeof (id_t)) 41617c478bd9Sstevel@tonic-gate break; 41627c478bd9Sstevel@tonic-gate 41637c478bd9Sstevel@tonic-gate idp = buf; 41647c478bd9Sstevel@tonic-gate while (!interrupt && nb >= sizeof (id_t)) { 41657c478bd9Sstevel@tonic-gate (void) printf("%s\t%8d\n", pri->pname, (int)*idp); 41667c478bd9Sstevel@tonic-gate offset += sizeof (id_t); 41677c478bd9Sstevel@tonic-gate nb -= sizeof (id_t); 41687c478bd9Sstevel@tonic-gate idp++; 41697c478bd9Sstevel@tonic-gate count--; 41707c478bd9Sstevel@tonic-gate } 41717c478bd9Sstevel@tonic-gate } 41727c478bd9Sstevel@tonic-gate 41737c478bd9Sstevel@tonic-gate /* exit region of lengthy output */ 41747c478bd9Sstevel@tonic-gate if (serial) 41757c478bd9Sstevel@tonic-gate Xserialize(); 41767c478bd9Sstevel@tonic-gate } 41777c478bd9Sstevel@tonic-gate 41787c478bd9Sstevel@tonic-gate void 41797c478bd9Sstevel@tonic-gate show_ntp_gettime(private_t *pri) 41807c478bd9Sstevel@tonic-gate { 41817c478bd9Sstevel@tonic-gate struct ntptimeval ntv; 41827c478bd9Sstevel@tonic-gate long offset; 41837c478bd9Sstevel@tonic-gate 41847c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 41857c478bd9Sstevel@tonic-gate return; 41867c478bd9Sstevel@tonic-gate 41877c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) { 41887c478bd9Sstevel@tonic-gate if (Pread(Proc, &ntv, sizeof (ntv), offset) 41897c478bd9Sstevel@tonic-gate != sizeof (ntv)) 41907c478bd9Sstevel@tonic-gate return; 41917c478bd9Sstevel@tonic-gate } else { 41927c478bd9Sstevel@tonic-gate struct ntptimeval32 ntv32; 41937c478bd9Sstevel@tonic-gate 41947c478bd9Sstevel@tonic-gate if (Pread(Proc, &ntv32, sizeof (ntv32), offset) 41957c478bd9Sstevel@tonic-gate != sizeof (ntv32)) 41967c478bd9Sstevel@tonic-gate return; 41977c478bd9Sstevel@tonic-gate 41987c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time); 41997c478bd9Sstevel@tonic-gate ntv.maxerror = ntv32.maxerror; 42007c478bd9Sstevel@tonic-gate ntv.esterror = ntv32.esterror; 42017c478bd9Sstevel@tonic-gate } 42027c478bd9Sstevel@tonic-gate 42037c478bd9Sstevel@tonic-gate (void) printf("\ttime: %ld.%6.6ld sec\n", 42047c478bd9Sstevel@tonic-gate ntv.time.tv_sec, ntv.time.tv_usec); 42057c478bd9Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", ntv.maxerror); 42067c478bd9Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", ntv.esterror); 42077c478bd9Sstevel@tonic-gate } 42087c478bd9Sstevel@tonic-gate 42097c478bd9Sstevel@tonic-gate static char * 42107c478bd9Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val) 42117c478bd9Sstevel@tonic-gate { 42127c478bd9Sstevel@tonic-gate char *str = pri->code_buf; 42137c478bd9Sstevel@tonic-gate size_t used = 0; 42147c478bd9Sstevel@tonic-gate 42157c478bd9Sstevel@tonic-gate *str = '\0'; 42167c478bd9Sstevel@tonic-gate if (val & MOD_OFFSET) 42177c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf)); 42187c478bd9Sstevel@tonic-gate if (val & MOD_FREQUENCY) 42197c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf)); 42207c478bd9Sstevel@tonic-gate if (val & MOD_MAXERROR) 42217c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf)); 42227c478bd9Sstevel@tonic-gate if (val & MOD_ESTERROR) 42237c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf)); 42247c478bd9Sstevel@tonic-gate if (val & MOD_STATUS) 42257c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf)); 42267c478bd9Sstevel@tonic-gate if (val & MOD_TIMECONST) 42277c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf)); 42287c478bd9Sstevel@tonic-gate if (val & MOD_CLKB) 42297c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf)); 42307c478bd9Sstevel@tonic-gate if (val & MOD_CLKA) 42317c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf)); 42327c478bd9Sstevel@tonic-gate 42337c478bd9Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42347c478bd9Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42357c478bd9Sstevel@tonic-gate 42367c478bd9Sstevel@tonic-gate return (str + 1); 42377c478bd9Sstevel@tonic-gate } 42387c478bd9Sstevel@tonic-gate 42397c478bd9Sstevel@tonic-gate static char * 42407c478bd9Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val) 42417c478bd9Sstevel@tonic-gate { 42427c478bd9Sstevel@tonic-gate char *str = pri->code_buf; 42437c478bd9Sstevel@tonic-gate size_t used = 0; 42447c478bd9Sstevel@tonic-gate 42457c478bd9Sstevel@tonic-gate *str = '\0'; 42467c478bd9Sstevel@tonic-gate if (val & STA_PLL) 42477c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf)); 42487c478bd9Sstevel@tonic-gate if (val & STA_PPSFREQ) 42497c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf)); 42507c478bd9Sstevel@tonic-gate if (val & STA_PPSTIME) 42517c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf)); 42527c478bd9Sstevel@tonic-gate if (val & STA_FLL) 42537c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf)); 42547c478bd9Sstevel@tonic-gate 42557c478bd9Sstevel@tonic-gate if (val & STA_INS) 42567c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_INS", sizeof (pri->code_buf)); 42577c478bd9Sstevel@tonic-gate if (val & STA_DEL) 42587c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf)); 42597c478bd9Sstevel@tonic-gate if (val & STA_UNSYNC) 42607c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf)); 42617c478bd9Sstevel@tonic-gate if (val & STA_FREQHOLD) 42627c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf)); 42637c478bd9Sstevel@tonic-gate 42647c478bd9Sstevel@tonic-gate if (val & STA_PPSSIGNAL) 42657c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf)); 42667c478bd9Sstevel@tonic-gate if (val & STA_PPSJITTER) 42677c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf)); 42687c478bd9Sstevel@tonic-gate if (val & STA_PPSWANDER) 42697c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf)); 42707c478bd9Sstevel@tonic-gate if (val & STA_PPSERROR) 42717c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf)); 42727c478bd9Sstevel@tonic-gate 42737c478bd9Sstevel@tonic-gate if (val & STA_CLOCKERR) 42747c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf)); 42757c478bd9Sstevel@tonic-gate 42767c478bd9Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf)) 42777c478bd9Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val); 42787c478bd9Sstevel@tonic-gate 42797c478bd9Sstevel@tonic-gate return (str + 1); 42807c478bd9Sstevel@tonic-gate } 42817c478bd9Sstevel@tonic-gate 42827c478bd9Sstevel@tonic-gate void 42837c478bd9Sstevel@tonic-gate show_ntp_adjtime(private_t *pri) 42847c478bd9Sstevel@tonic-gate { 42857c478bd9Sstevel@tonic-gate struct timex timex; 42867c478bd9Sstevel@tonic-gate long offset; 42877c478bd9Sstevel@tonic-gate 42887c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == NULL) 42897c478bd9Sstevel@tonic-gate return; 42907c478bd9Sstevel@tonic-gate 42917c478bd9Sstevel@tonic-gate if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex)) 42927c478bd9Sstevel@tonic-gate return; 42937c478bd9Sstevel@tonic-gate 42947c478bd9Sstevel@tonic-gate (void) printf("\tmodes: %s\n", get_timex_modes(pri, timex.modes)); 42957c478bd9Sstevel@tonic-gate (void) printf("\toffset: %11d usec\n", timex.offset); 42967c478bd9Sstevel@tonic-gate (void) printf("\tfreq: %11d scaled ppm\n", timex.freq); 42977c478bd9Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", timex.maxerror); 42987c478bd9Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", timex.esterror); 42997c478bd9Sstevel@tonic-gate (void) printf("\tstatus: %s\n", get_timex_status(pri, timex.status)); 43007c478bd9Sstevel@tonic-gate (void) printf("\tconstant: %11d\n", timex.constant); 43017c478bd9Sstevel@tonic-gate (void) printf("\tprecision: %11d usec\n", timex.precision); 43027c478bd9Sstevel@tonic-gate (void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance); 43037c478bd9Sstevel@tonic-gate (void) printf("\tppsfreq: %11d scaled ppm\n", timex.ppsfreq); 43047c478bd9Sstevel@tonic-gate (void) printf("\tjitter: %11d usec\n", timex.jitter); 43057c478bd9Sstevel@tonic-gate (void) printf("\tshift: %11d sec\n", timex.shift); 43067c478bd9Sstevel@tonic-gate (void) printf("\tstabil: %11d scaled ppm\n", timex.stabil); 43077c478bd9Sstevel@tonic-gate (void) printf("\tjitcnt: %11d\n", timex.jitcnt); 43087c478bd9Sstevel@tonic-gate (void) printf("\tcalcnt: %11d\n", timex.calcnt); 43097c478bd9Sstevel@tonic-gate (void) printf("\terrcnt: %11d\n", timex.errcnt); 43107c478bd9Sstevel@tonic-gate (void) printf("\tstbcnt: %11d\n", timex.stbcnt); 43117c478bd9Sstevel@tonic-gate } 43127c478bd9Sstevel@tonic-gate 43137c478bd9Sstevel@tonic-gate void 43147c478bd9Sstevel@tonic-gate show_getrusage(long offset) 43157c478bd9Sstevel@tonic-gate { 43167c478bd9Sstevel@tonic-gate struct rusage r; 43177c478bd9Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43187c478bd9Sstevel@tonic-gate return; 43197c478bd9Sstevel@tonic-gate (void) printf("\t user time: %ld.%6.6ld sec\n", 43207c478bd9Sstevel@tonic-gate r.ru_utime.tv_sec, 43217c478bd9Sstevel@tonic-gate r.ru_utime.tv_usec); 43227c478bd9Sstevel@tonic-gate (void) printf("\t system time: %ld.%6.6ld sec\n", 43237c478bd9Sstevel@tonic-gate r.ru_stime.tv_sec, 43247c478bd9Sstevel@tonic-gate r.ru_stime.tv_usec); 43257c478bd9Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %ld\n", 43267c478bd9Sstevel@tonic-gate r.ru_maxrss); 43277c478bd9Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %ld\n", 43287c478bd9Sstevel@tonic-gate r.ru_ixrss); 43297c478bd9Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %ld\n", 43307c478bd9Sstevel@tonic-gate r.ru_idrss); 43317c478bd9Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %ld\n", 43327c478bd9Sstevel@tonic-gate r.ru_isrss); 43337c478bd9Sstevel@tonic-gate (void) printf("\t minor faults: %ld\n", 43347c478bd9Sstevel@tonic-gate r.ru_minflt); 43357c478bd9Sstevel@tonic-gate (void) printf("\t major faults: %ld\n", 43367c478bd9Sstevel@tonic-gate r.ru_majflt); 43377c478bd9Sstevel@tonic-gate (void) printf("\t # of swaps: %ld\n", 43387c478bd9Sstevel@tonic-gate r.ru_nswap); 43397c478bd9Sstevel@tonic-gate (void) printf("\t blocked inputs: %ld\n", 43407c478bd9Sstevel@tonic-gate r.ru_inblock); 43417c478bd9Sstevel@tonic-gate (void) printf("\t blocked outputs: %ld\n", 43427c478bd9Sstevel@tonic-gate r.ru_oublock); 43437c478bd9Sstevel@tonic-gate (void) printf("\t msgs sent: %ld\n", 43447c478bd9Sstevel@tonic-gate r.ru_msgsnd); 43457c478bd9Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %ld\n", 43467c478bd9Sstevel@tonic-gate r.ru_msgrcv); 43477c478bd9Sstevel@tonic-gate (void) printf("\t signals rcv'd: %ld\n", 43487c478bd9Sstevel@tonic-gate r.ru_nsignals); 43497c478bd9Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %ld\n", 43507c478bd9Sstevel@tonic-gate r.ru_nvcsw); 43517c478bd9Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %ld\n", 43527c478bd9Sstevel@tonic-gate r.ru_nivcsw); 43537c478bd9Sstevel@tonic-gate } 43547c478bd9Sstevel@tonic-gate 43557c478bd9Sstevel@tonic-gate #ifdef _LP64 43567c478bd9Sstevel@tonic-gate void 43577c478bd9Sstevel@tonic-gate show_getrusage32(long offset) 43587c478bd9Sstevel@tonic-gate { 43597c478bd9Sstevel@tonic-gate struct rusage32 r; 43607c478bd9Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r)) 43617c478bd9Sstevel@tonic-gate return; 43627c478bd9Sstevel@tonic-gate (void) printf("\t user time: %d.%6.6d sec\n", 43637c478bd9Sstevel@tonic-gate r.ru_utime.tv_sec, 43647c478bd9Sstevel@tonic-gate r.ru_utime.tv_usec); 43657c478bd9Sstevel@tonic-gate (void) printf("\t system time: %d.%6.6d sec\n", 43667c478bd9Sstevel@tonic-gate r.ru_stime.tv_sec, 43677c478bd9Sstevel@tonic-gate r.ru_stime.tv_usec); 43687c478bd9Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %d\n", 43697c478bd9Sstevel@tonic-gate r.ru_maxrss); 43707c478bd9Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %d\n", 43717c478bd9Sstevel@tonic-gate r.ru_ixrss); 43727c478bd9Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %d\n", 43737c478bd9Sstevel@tonic-gate r.ru_idrss); 43747c478bd9Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %d\n", 43757c478bd9Sstevel@tonic-gate r.ru_isrss); 43767c478bd9Sstevel@tonic-gate (void) printf("\t minor faults: %d\n", 43777c478bd9Sstevel@tonic-gate r.ru_minflt); 43787c478bd9Sstevel@tonic-gate (void) printf("\t major faults: %d\n", 43797c478bd9Sstevel@tonic-gate r.ru_majflt); 43807c478bd9Sstevel@tonic-gate (void) printf("\t # of swaps: %d\n", 43817c478bd9Sstevel@tonic-gate r.ru_nswap); 43827c478bd9Sstevel@tonic-gate (void) printf("\t blocked inputs: %d\n", 43837c478bd9Sstevel@tonic-gate r.ru_inblock); 43847c478bd9Sstevel@tonic-gate (void) printf("\t blocked outputs: %d\n", 43857c478bd9Sstevel@tonic-gate r.ru_oublock); 43867c478bd9Sstevel@tonic-gate (void) printf("\t msgs sent: %d\n", 43877c478bd9Sstevel@tonic-gate r.ru_msgsnd); 43887c478bd9Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %d\n", 43897c478bd9Sstevel@tonic-gate r.ru_msgrcv); 43907c478bd9Sstevel@tonic-gate (void) printf("\t signals rcv'd: %d\n", 43917c478bd9Sstevel@tonic-gate r.ru_nsignals); 43927c478bd9Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %d\n", 43937c478bd9Sstevel@tonic-gate r.ru_nvcsw); 43947c478bd9Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %d\n", 43957c478bd9Sstevel@tonic-gate r.ru_nivcsw); 43967c478bd9Sstevel@tonic-gate } 43977c478bd9Sstevel@tonic-gate #endif 43987c478bd9Sstevel@tonic-gate 4399*aa4a4f3bSnf202958 /* 4400*aa4a4f3bSnf202958 * Utility function to print a packed nvlist by unpacking 4401*aa4a4f3bSnf202958 * and calling the libnvpair pretty printer. Frees all 4402*aa4a4f3bSnf202958 * allocated memory internally. 4403*aa4a4f3bSnf202958 */ 4404*aa4a4f3bSnf202958 static void 4405*aa4a4f3bSnf202958 show_packed_nvlist(private_t *pri, uintptr_t offset, size_t size) 4406*aa4a4f3bSnf202958 { 4407*aa4a4f3bSnf202958 nvlist_t *nvl = NULL; 4408*aa4a4f3bSnf202958 size_t readsize; 4409*aa4a4f3bSnf202958 char *buf; 4410*aa4a4f3bSnf202958 4411*aa4a4f3bSnf202958 if ((offset == 0) || (size == 0)) { 4412*aa4a4f3bSnf202958 return; 4413*aa4a4f3bSnf202958 } 4414*aa4a4f3bSnf202958 4415*aa4a4f3bSnf202958 buf = my_malloc(size, "nvlist decode buffer"); 4416*aa4a4f3bSnf202958 readsize = Pread(Proc, buf, size, offset); 4417*aa4a4f3bSnf202958 if (readsize != size) { 4418*aa4a4f3bSnf202958 (void) printf("%s\t<?>", pri->pname); 4419*aa4a4f3bSnf202958 } else { 4420*aa4a4f3bSnf202958 int result; 4421*aa4a4f3bSnf202958 4422*aa4a4f3bSnf202958 result = nvlist_unpack(buf, size, &nvl, 0); 4423*aa4a4f3bSnf202958 if (result == 0) { 4424*aa4a4f3bSnf202958 nvlist_print(stdout, nvl); 4425*aa4a4f3bSnf202958 nvlist_free(nvl); 4426*aa4a4f3bSnf202958 } else { 4427*aa4a4f3bSnf202958 (void) printf("%s\tunpack of nvlist" 4428*aa4a4f3bSnf202958 " failed: %d\n", pri->pname, result); 4429*aa4a4f3bSnf202958 } 4430*aa4a4f3bSnf202958 } 4431*aa4a4f3bSnf202958 free(buf); 4432*aa4a4f3bSnf202958 } 4433*aa4a4f3bSnf202958 4434821c4a97Sdp static void 4435821c4a97Sdp show_zone_create_args(private_t *pri, long offset) 4436821c4a97Sdp { 4437821c4a97Sdp zone_def args; 4438821c4a97Sdp char zone_name[ZONENAME_MAX]; 4439821c4a97Sdp char zone_root[MAXPATHLEN]; 4440821c4a97Sdp char *zone_zfs = NULL; 4441821c4a97Sdp 4442821c4a97Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 4443821c4a97Sdp 4444821c4a97Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name), 4445821c4a97Sdp (uintptr_t)args.zone_name) == -1) 4446821c4a97Sdp (void) strcpy(zone_name, "<?>"); 4447821c4a97Sdp 4448821c4a97Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root), 4449821c4a97Sdp (uintptr_t)args.zone_root) == -1) 4450821c4a97Sdp (void) strcpy(zone_root, "<?>"); 4451821c4a97Sdp 4452821c4a97Sdp if (args.zfsbufsz > 0) { 4453821c4a97Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz)); 4454821c4a97Sdp if (zone_zfs != NULL) { 4455821c4a97Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz, 4456821c4a97Sdp (uintptr_t)args.zfsbuf) == -1) 4457821c4a97Sdp (void) strcpy(zone_zfs, "<?>"); 4458821c4a97Sdp } 4459821c4a97Sdp } else { 4460821c4a97Sdp zone_zfs = ""; 4461821c4a97Sdp } 4462821c4a97Sdp 4463821c4a97Sdp (void) printf("%s\t zone_name: %s\n", pri->pname, 4464821c4a97Sdp zone_name); 4465821c4a97Sdp (void) printf("%s\t zone_root: %s\n", pri->pname, 4466821c4a97Sdp zone_root); 4467821c4a97Sdp 4468821c4a97Sdp show_privset(pri, (uintptr_t)args.zone_privs, 4469821c4a97Sdp args.zone_privssz, " zone_privs: "); 4470821c4a97Sdp 4471821c4a97Sdp (void) printf("%s\t rctlbuf: 0x%p\n", pri->pname, 4472821c4a97Sdp (void *)args.rctlbuf); 4473821c4a97Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname, 4474821c4a97Sdp (ulong_t)args.rctlbufsz); 4475821c4a97Sdp 4476*aa4a4f3bSnf202958 show_packed_nvlist(pri, (uintptr_t)args.rctlbuf, 4477*aa4a4f3bSnf202958 args.rctlbufsz); 4478*aa4a4f3bSnf202958 4479821c4a97Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs); 4480821c4a97Sdp 4481821c4a97Sdp (void) printf("%s\textended_error: 0x%p\n", pri->pname, 4482821c4a97Sdp (void *)args.extended_error); 4483821c4a97Sdp 448445916cd2Sjpk if (is_system_labeled()) { 448545916cd2Sjpk char *label_str = NULL; 448645916cd2Sjpk bslabel_t zone_label; 448745916cd2Sjpk 448845916cd2Sjpk (void) printf("%s\t match: %d\n", pri->pname, 448945916cd2Sjpk args.match); 449045916cd2Sjpk (void) printf("%s\t doi: %d\n", pri->pname, 449145916cd2Sjpk args.doi); 449245916cd2Sjpk 449345916cd2Sjpk if (Pread_string(Proc, (char *)&zone_label, 449445916cd2Sjpk sizeof (zone_label), (uintptr_t)args.label) != -1) { 449545916cd2Sjpk /* show the label as string */ 449645916cd2Sjpk if (label_to_str(&zone_label, &label_str, 449745916cd2Sjpk M_LABEL, SHORT_NAMES) != 0) { 449845916cd2Sjpk /* have to dump label as raw string */ 449945916cd2Sjpk (void) label_to_str(&zone_label, 450045916cd2Sjpk &label_str, M_INTERNAL, 450145916cd2Sjpk SHORT_NAMES); 450245916cd2Sjpk } 450345916cd2Sjpk } 450445916cd2Sjpk 450545916cd2Sjpk (void) printf("%s\t label: %s\n", 450645916cd2Sjpk pri->pname, label_str != NULL ? label_str : "<?>"); 450745916cd2Sjpk if (label_str) 450845916cd2Sjpk free(label_str); 450945916cd2Sjpk } 451045916cd2Sjpk 4511821c4a97Sdp if (args.zfsbufsz > 0) 4512821c4a97Sdp free(zone_zfs); 4513821c4a97Sdp } 4514821c4a97Sdp } 4515821c4a97Sdp 4516821c4a97Sdp 4517821c4a97Sdp #ifdef _LP64 4518821c4a97Sdp 4519821c4a97Sdp static void 4520821c4a97Sdp show_zone_create_args32(private_t *pri, long offset) 4521821c4a97Sdp { 4522821c4a97Sdp zone_def32 args; 4523821c4a97Sdp char zone_name[ZONENAME_MAX]; 4524821c4a97Sdp char zone_root[MAXPATHLEN]; 4525821c4a97Sdp char *zone_zfs = NULL; 4526821c4a97Sdp 4527821c4a97Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) { 4528821c4a97Sdp 4529821c4a97Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name), 4530821c4a97Sdp (uintptr_t)args.zone_name) == -1) 4531821c4a97Sdp (void) strcpy(zone_name, "<?>"); 4532821c4a97Sdp 4533821c4a97Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root), 4534821c4a97Sdp (uintptr_t)args.zone_root) == -1) 4535821c4a97Sdp (void) strcpy(zone_root, "<?>"); 4536821c4a97Sdp 4537821c4a97Sdp if (args.zfsbufsz > 0) { 4538821c4a97Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz)); 4539821c4a97Sdp if (zone_zfs != NULL) { 4540821c4a97Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz, 4541821c4a97Sdp (uintptr_t)args.zfsbuf) == -1) 4542821c4a97Sdp (void) strcpy(zone_zfs, "<?>"); 4543821c4a97Sdp } 4544821c4a97Sdp } else { 4545821c4a97Sdp zone_zfs = ""; 4546821c4a97Sdp } 4547821c4a97Sdp 4548821c4a97Sdp (void) printf("%s\t zone_name: %s\n", pri->pname, 4549821c4a97Sdp zone_name); 4550821c4a97Sdp (void) printf("%s\t zone_root: %s\n", pri->pname, 4551821c4a97Sdp zone_root); 4552821c4a97Sdp 4553821c4a97Sdp show_privset(pri, (uintptr_t)args.zone_privs, 4554821c4a97Sdp args.zone_privssz, " zone_privs: "); 4555821c4a97Sdp 45563246257cSdp (void) printf("%s\t rctlbuf: 0x%x\n", pri->pname, 45573246257cSdp (caddr32_t)args.rctlbuf); 4558821c4a97Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname, 4559821c4a97Sdp (ulong_t)args.rctlbufsz); 4560821c4a97Sdp 4561*aa4a4f3bSnf202958 show_packed_nvlist(pri, (uintptr_t)args.rctlbuf, 4562*aa4a4f3bSnf202958 args.rctlbufsz); 4563*aa4a4f3bSnf202958 4564821c4a97Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs); 4565821c4a97Sdp 45663246257cSdp (void) printf("%s\textended_error: 0x%x\n", pri->pname, 45673246257cSdp (caddr32_t)args.extended_error); 4568821c4a97Sdp 456945916cd2Sjpk if (is_system_labeled()) { 457045916cd2Sjpk char *label_str = NULL; 457145916cd2Sjpk bslabel_t zone_label; 457245916cd2Sjpk 457345916cd2Sjpk (void) printf("%s\t match: %d\n", pri->pname, 457445916cd2Sjpk args.match); 457545916cd2Sjpk (void) printf("%s\t doi: %d\n", pri->pname, 457645916cd2Sjpk args.doi); 457745916cd2Sjpk 457845916cd2Sjpk if (Pread_string(Proc, (char *)&zone_label, 457945916cd2Sjpk sizeof (zone_label), (caddr32_t)args.label) != -1) { 458045916cd2Sjpk /* show the label as string */ 458145916cd2Sjpk if (label_to_str(&zone_label, &label_str, 458245916cd2Sjpk M_LABEL, SHORT_NAMES) != 0) { 458345916cd2Sjpk /* have to dump label as raw string */ 458445916cd2Sjpk (void) label_to_str(&zone_label, 458545916cd2Sjpk &label_str, M_INTERNAL, 458645916cd2Sjpk SHORT_NAMES); 458745916cd2Sjpk } 458845916cd2Sjpk } 458945916cd2Sjpk (void) printf("%s\t label: %s\n", 459045916cd2Sjpk pri->pname, label_str != NULL ? label_str : "<?>"); 459145916cd2Sjpk if (label_str) 459245916cd2Sjpk free(label_str); 459345916cd2Sjpk } 459445916cd2Sjpk 4595821c4a97Sdp if (args.zfsbufsz > 0) 4596821c4a97Sdp free(zone_zfs); 4597821c4a97Sdp } 4598821c4a97Sdp } 4599821c4a97Sdp 4600821c4a97Sdp #endif 4601821c4a97Sdp 4602821c4a97Sdp static void 4603821c4a97Sdp show_zones(private_t *pri) 4604821c4a97Sdp { 4605821c4a97Sdp switch (pri->sys_args[0]) { 4606821c4a97Sdp case ZONE_CREATE: 4607821c4a97Sdp #ifdef _LP64 4608821c4a97Sdp if (data_model == PR_MODEL_LP64) 4609821c4a97Sdp show_zone_create_args(pri, (long)pri->sys_args[1]); 4610821c4a97Sdp else 4611821c4a97Sdp show_zone_create_args32(pri, (long)pri->sys_args[1]); 4612821c4a97Sdp #else 4613821c4a97Sdp show_zone_create_args(pri, (long)pri->sys_args[1]); 4614821c4a97Sdp #endif 4615821c4a97Sdp break; 4616821c4a97Sdp } 4617821c4a97Sdp } 4618821c4a97Sdp 4619*aa4a4f3bSnf202958 static void 4620*aa4a4f3bSnf202958 show_rctlblk(private_t *pri, long _rctlblk) 4621*aa4a4f3bSnf202958 { 4622*aa4a4f3bSnf202958 rctlblk_t *blk; 4623*aa4a4f3bSnf202958 int size = rctlblk_size(); 4624*aa4a4f3bSnf202958 size_t readsize; 4625*aa4a4f3bSnf202958 const char *s; 4626*aa4a4f3bSnf202958 4627*aa4a4f3bSnf202958 blk = my_malloc(size, "rctlblk decode buffer"); 4628*aa4a4f3bSnf202958 readsize = Pread(Proc, blk, size, _rctlblk); 4629*aa4a4f3bSnf202958 if (readsize != size) { 4630*aa4a4f3bSnf202958 (void) printf("%s\t\t<?>", pri->pname); 4631*aa4a4f3bSnf202958 } else { 4632*aa4a4f3bSnf202958 (void) printf("%s\t\t Privilege: 0x%x\n", 4633*aa4a4f3bSnf202958 pri->pname, 4634*aa4a4f3bSnf202958 rctlblk_get_privilege(blk)); 4635*aa4a4f3bSnf202958 (void) printf("%s\t\t Value: %lld\n", 4636*aa4a4f3bSnf202958 pri->pname, 4637*aa4a4f3bSnf202958 rctlblk_get_value(blk)); 4638*aa4a4f3bSnf202958 (void) printf("%s\t\tEnforced Value: %lld\n", 4639*aa4a4f3bSnf202958 pri->pname, 4640*aa4a4f3bSnf202958 rctlblk_get_enforced_value(blk)); 4641*aa4a4f3bSnf202958 4642*aa4a4f3bSnf202958 { 4643*aa4a4f3bSnf202958 int sig, act; 4644*aa4a4f3bSnf202958 act = rctlblk_get_local_action(blk, &sig); 4645*aa4a4f3bSnf202958 4646*aa4a4f3bSnf202958 s = rctl_local_action(pri, act); 4647*aa4a4f3bSnf202958 if (s == NULL) { 4648*aa4a4f3bSnf202958 (void) printf("%s\t\t Local action: 0x%x\n", 4649*aa4a4f3bSnf202958 pri->pname, act); 4650*aa4a4f3bSnf202958 } else { 4651*aa4a4f3bSnf202958 (void) printf("%s\t\t Local action: %s\n", 4652*aa4a4f3bSnf202958 pri->pname, s); 4653*aa4a4f3bSnf202958 } 4654*aa4a4f3bSnf202958 4655*aa4a4f3bSnf202958 if (act & RCTL_LOCAL_SIGNAL) { 4656*aa4a4f3bSnf202958 (void) printf("%s\t\t " 4657*aa4a4f3bSnf202958 "For signal %s\n", 4658*aa4a4f3bSnf202958 pri->pname, signame(pri, sig)); 4659*aa4a4f3bSnf202958 } 4660*aa4a4f3bSnf202958 } 4661*aa4a4f3bSnf202958 4662*aa4a4f3bSnf202958 s = rctl_local_flags(pri, rctlblk_get_local_flags(blk)); 4663*aa4a4f3bSnf202958 if (s == NULL) { 4664*aa4a4f3bSnf202958 (void) printf("%s\t\t Local flags: 0x%x\n", 4665*aa4a4f3bSnf202958 pri->pname, rctlblk_get_local_flags(blk)); 4666*aa4a4f3bSnf202958 } else { 4667*aa4a4f3bSnf202958 (void) printf("%s\t\t Local flags: %s\n", 4668*aa4a4f3bSnf202958 pri->pname, s); 4669*aa4a4f3bSnf202958 } 4670*aa4a4f3bSnf202958 4671*aa4a4f3bSnf202958 #ifdef _LP64 4672*aa4a4f3bSnf202958 (void) printf("%s\t\t Recipient PID: %d\n", 4673*aa4a4f3bSnf202958 pri->pname, 4674*aa4a4f3bSnf202958 rctlblk_get_recipient_pid(blk)); 4675*aa4a4f3bSnf202958 #else 4676*aa4a4f3bSnf202958 (void) printf("%s\t\t Recipient PID: %ld\n", 4677*aa4a4f3bSnf202958 pri->pname, 4678*aa4a4f3bSnf202958 rctlblk_get_recipient_pid(blk)); 4679*aa4a4f3bSnf202958 #endif 4680*aa4a4f3bSnf202958 (void) printf("%s\t\t Firing Time: %lld\n", 4681*aa4a4f3bSnf202958 pri->pname, 4682*aa4a4f3bSnf202958 rctlblk_get_firing_time(blk)); 4683*aa4a4f3bSnf202958 } 4684*aa4a4f3bSnf202958 free(blk); 4685*aa4a4f3bSnf202958 } 4686*aa4a4f3bSnf202958 4687*aa4a4f3bSnf202958 static void 4688*aa4a4f3bSnf202958 show_rctls(private_t *pri) 4689*aa4a4f3bSnf202958 { 4690*aa4a4f3bSnf202958 switch (pri->sys_args[0]) { 4691*aa4a4f3bSnf202958 case 0: /* getrctl */ 4692*aa4a4f3bSnf202958 case 1: /* setrctl */ 4693*aa4a4f3bSnf202958 /* 4694*aa4a4f3bSnf202958 * If these offsets look a little odd, remember that they're 4695*aa4a4f3bSnf202958 * into the _raw_ system call 4696*aa4a4f3bSnf202958 */ 4697*aa4a4f3bSnf202958 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri->pname, 4698*aa4a4f3bSnf202958 pri->sys_args[2]); 4699*aa4a4f3bSnf202958 if (pri->sys_args[2] != NULL) { 4700*aa4a4f3bSnf202958 show_rctlblk(pri, pri->sys_args[2]); 4701*aa4a4f3bSnf202958 } 4702*aa4a4f3bSnf202958 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri->pname, 4703*aa4a4f3bSnf202958 pri->sys_args[3]); 4704*aa4a4f3bSnf202958 if (pri->sys_args[3] != NULL) { 4705*aa4a4f3bSnf202958 show_rctlblk(pri, pri->sys_args[3]); 4706*aa4a4f3bSnf202958 } 4707*aa4a4f3bSnf202958 break; 4708*aa4a4f3bSnf202958 } 4709*aa4a4f3bSnf202958 } 4710821c4a97Sdp 47117c478bd9Sstevel@tonic-gate /* expound verbosely upon syscall arguments */ 47127c478bd9Sstevel@tonic-gate /*ARGSUSED*/ 47137c478bd9Sstevel@tonic-gate void 47147c478bd9Sstevel@tonic-gate expound(private_t *pri, long r0, int raw) 47157c478bd9Sstevel@tonic-gate { 47167c478bd9Sstevel@tonic-gate const lwpstatus_t *Lsp = pri->lwpstat; 47177c478bd9Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64); 47187c478bd9Sstevel@tonic-gate int what = Lsp->pr_what; 47197c478bd9Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */ 47207c478bd9Sstevel@tonic-gate /* for a failed system call */ 47217c478bd9Sstevel@tonic-gate #ifndef _LP64 47227c478bd9Sstevel@tonic-gate /* We are a 32-bit truss; we can't grok a 64-bit process */ 47237c478bd9Sstevel@tonic-gate if (lp64) 47247c478bd9Sstevel@tonic-gate return; 47257c478bd9Sstevel@tonic-gate #endif 47267c478bd9Sstevel@tonic-gate /* for reporting sleeping system calls */ 47277c478bd9Sstevel@tonic-gate if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP))) 47287c478bd9Sstevel@tonic-gate what = Lsp->pr_syscall; 47297c478bd9Sstevel@tonic-gate 47307c478bd9Sstevel@tonic-gate switch (what) { 47317c478bd9Sstevel@tonic-gate case SYS_utime: 47327c478bd9Sstevel@tonic-gate show_utime(pri); 47337c478bd9Sstevel@tonic-gate break; 47347c478bd9Sstevel@tonic-gate case SYS_utimes: 47357c478bd9Sstevel@tonic-gate show_utimes(pri); 47367c478bd9Sstevel@tonic-gate break; 47377c478bd9Sstevel@tonic-gate case SYS_gettimeofday: 47387c478bd9Sstevel@tonic-gate if (!err) 47397c478bd9Sstevel@tonic-gate show_timeofday(pri); 47407c478bd9Sstevel@tonic-gate break; 47417c478bd9Sstevel@tonic-gate case SYS_getitimer: 47427c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 47437c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 47447c478bd9Sstevel@tonic-gate " value"); 47457c478bd9Sstevel@tonic-gate break; 47467c478bd9Sstevel@tonic-gate case SYS_setitimer: 47477c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 47487c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1], 47497c478bd9Sstevel@tonic-gate " value"); 47507c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 47517c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[2], 47527c478bd9Sstevel@tonic-gate "ovalue"); 47537c478bd9Sstevel@tonic-gate break; 47547c478bd9Sstevel@tonic-gate case SYS_stime: 47557c478bd9Sstevel@tonic-gate show_stime(pri); 47567c478bd9Sstevel@tonic-gate break; 47577c478bd9Sstevel@tonic-gate case SYS_times: 47587c478bd9Sstevel@tonic-gate if (!err) 47597c478bd9Sstevel@tonic-gate show_times(pri); 47607c478bd9Sstevel@tonic-gate break; 47617c478bd9Sstevel@tonic-gate case SYS_utssys: 47627c478bd9Sstevel@tonic-gate if (err) 47637c478bd9Sstevel@tonic-gate break; 47647c478bd9Sstevel@tonic-gate #ifdef _LP64 47657c478bd9Sstevel@tonic-gate if (lp64) 47667c478bd9Sstevel@tonic-gate show_utssys(pri, r0); 47677c478bd9Sstevel@tonic-gate else 47687c478bd9Sstevel@tonic-gate show_utssys32(pri, r0); 47697c478bd9Sstevel@tonic-gate #else 47707c478bd9Sstevel@tonic-gate show_utssys(pri, r0); 47717c478bd9Sstevel@tonic-gate #endif 47727c478bd9Sstevel@tonic-gate break; 47737c478bd9Sstevel@tonic-gate case SYS_ioctl: 47747c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) /* each case must decide for itself */ 47757c478bd9Sstevel@tonic-gate show_ioctl(pri, pri->sys_args[1], 47767c478bd9Sstevel@tonic-gate (long)pri->sys_args[2]); 47777c478bd9Sstevel@tonic-gate break; 47787c478bd9Sstevel@tonic-gate case SYS_stat: 47797c478bd9Sstevel@tonic-gate case SYS_fstat: 47807c478bd9Sstevel@tonic-gate case SYS_lstat: 47817c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 47827c478bd9Sstevel@tonic-gate show_stat(pri, (long)pri->sys_args[1]); 47837c478bd9Sstevel@tonic-gate break; 47847c478bd9Sstevel@tonic-gate case SYS_stat64: 47857c478bd9Sstevel@tonic-gate case SYS_fstat64: 47867c478bd9Sstevel@tonic-gate case SYS_lstat64: 47877c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2) 47887c478bd9Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[1]); 47897c478bd9Sstevel@tonic-gate break; 47907c478bd9Sstevel@tonic-gate case SYS_fsat: 47917c478bd9Sstevel@tonic-gate /* 47927c478bd9Sstevel@tonic-gate * subcodes for fstatat() and fstatat64(). 47937c478bd9Sstevel@tonic-gate */ 47947c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 4) { 47957c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == 3) 47967c478bd9Sstevel@tonic-gate show_statat(pri, (long)pri->sys_args[3]); 47977c478bd9Sstevel@tonic-gate else if (pri->sys_args[0] == 2) 47987c478bd9Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[3]); 47997c478bd9Sstevel@tonic-gate } 48007c478bd9Sstevel@tonic-gate break; 48017c478bd9Sstevel@tonic-gate case SYS_xstat: 48027c478bd9Sstevel@tonic-gate case SYS_fxstat: 48037c478bd9Sstevel@tonic-gate case SYS_lxstat: 48047c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 3) 48057c478bd9Sstevel@tonic-gate show_xstat(pri, (int)pri->sys_args[0], 48067c478bd9Sstevel@tonic-gate (long)pri->sys_args[2]); 48077c478bd9Sstevel@tonic-gate break; 48087c478bd9Sstevel@tonic-gate case SYS_statvfs: 48097c478bd9Sstevel@tonic-gate case SYS_fstatvfs: 48107c478bd9Sstevel@tonic-gate if (err) 48117c478bd9Sstevel@tonic-gate break; 48127c478bd9Sstevel@tonic-gate #ifdef _LP64 48137c478bd9Sstevel@tonic-gate if (!lp64) { 48147c478bd9Sstevel@tonic-gate show_statvfs32(pri); 48157c478bd9Sstevel@tonic-gate break; 48167c478bd9Sstevel@tonic-gate } 48177c478bd9Sstevel@tonic-gate #endif 48187c478bd9Sstevel@tonic-gate show_statvfs(pri); 48197c478bd9Sstevel@tonic-gate break; 48207c478bd9Sstevel@tonic-gate case SYS_statvfs64: 48217c478bd9Sstevel@tonic-gate case SYS_fstatvfs64: 48227c478bd9Sstevel@tonic-gate if (err) 48237c478bd9Sstevel@tonic-gate break; 48247c478bd9Sstevel@tonic-gate show_statvfs64(pri); 48257c478bd9Sstevel@tonic-gate break; 48267c478bd9Sstevel@tonic-gate case SYS_statfs: 48277c478bd9Sstevel@tonic-gate case SYS_fstatfs: 48287c478bd9Sstevel@tonic-gate if (err) 48297c478bd9Sstevel@tonic-gate break; 48307c478bd9Sstevel@tonic-gate #ifdef _LP64 48317c478bd9Sstevel@tonic-gate if (lp64) 48327c478bd9Sstevel@tonic-gate show_statfs(pri); 48337c478bd9Sstevel@tonic-gate else 48347c478bd9Sstevel@tonic-gate show_statfs32(pri); 48357c478bd9Sstevel@tonic-gate #else 48367c478bd9Sstevel@tonic-gate show_statfs(pri); 48377c478bd9Sstevel@tonic-gate #endif 48387c478bd9Sstevel@tonic-gate break; 48397c478bd9Sstevel@tonic-gate case SYS_fcntl: 48407c478bd9Sstevel@tonic-gate show_fcntl(pri); 48417c478bd9Sstevel@tonic-gate break; 48427c478bd9Sstevel@tonic-gate case SYS_msgsys: 48437c478bd9Sstevel@tonic-gate show_msgsys(pri, r0); /* each case must decide for itself */ 48447c478bd9Sstevel@tonic-gate break; 48457c478bd9Sstevel@tonic-gate case SYS_semsys: 48467c478bd9Sstevel@tonic-gate show_semsys(pri); /* each case must decide for itself */ 48477c478bd9Sstevel@tonic-gate break; 48487c478bd9Sstevel@tonic-gate case SYS_shmsys: 48497c478bd9Sstevel@tonic-gate show_shmsys(pri); /* each case must decide for itself */ 48507c478bd9Sstevel@tonic-gate break; 48517c478bd9Sstevel@tonic-gate case SYS_getdents: 48527c478bd9Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 48537c478bd9Sstevel@tonic-gate break; 48547c478bd9Sstevel@tonic-gate #ifdef _LP64 48557c478bd9Sstevel@tonic-gate if (!lp64) { 48567c478bd9Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 48577c478bd9Sstevel@tonic-gate break; 48587c478bd9Sstevel@tonic-gate } 48597c478bd9Sstevel@tonic-gate /* FALLTHROUGH */ 48607c478bd9Sstevel@tonic-gate #else 48617c478bd9Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0); 48627c478bd9Sstevel@tonic-gate break; 48637c478bd9Sstevel@tonic-gate #endif 48647c478bd9Sstevel@tonic-gate case SYS_getdents64: 48657c478bd9Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0) 48667c478bd9Sstevel@tonic-gate break; 48677c478bd9Sstevel@tonic-gate show_dents64(pri, (long)pri->sys_args[1], r0); 48687c478bd9Sstevel@tonic-gate break; 48697c478bd9Sstevel@tonic-gate case SYS_getmsg: 48707c478bd9Sstevel@tonic-gate show_gp_msg(pri, what); 48717c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) 48727c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "flags"); 48737c478bd9Sstevel@tonic-gate break; 48747c478bd9Sstevel@tonic-gate case SYS_getpmsg: 48757c478bd9Sstevel@tonic-gate show_gp_msg(pri, what); 48767c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) 48777c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "band"); 48787c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4) 48797c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[4], "flags"); 48807c478bd9Sstevel@tonic-gate break; 48817c478bd9Sstevel@tonic-gate case SYS_putmsg: 48827c478bd9Sstevel@tonic-gate case SYS_putpmsg: 48837c478bd9Sstevel@tonic-gate show_gp_msg(pri, what); 48847c478bd9Sstevel@tonic-gate break; 48857c478bd9Sstevel@tonic-gate case SYS_poll: 48867c478bd9Sstevel@tonic-gate show_poll(pri); 48877c478bd9Sstevel@tonic-gate break; 48887c478bd9Sstevel@tonic-gate case SYS_pollsys: 48897c478bd9Sstevel@tonic-gate show_pollsys(pri); 48907c478bd9Sstevel@tonic-gate break; 48917c478bd9Sstevel@tonic-gate case SYS_setgroups: 48927c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0) 48937c478bd9Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 48947c478bd9Sstevel@tonic-gate break; 48957c478bd9Sstevel@tonic-gate case SYS_getgroups: 48967c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0) 48977c478bd9Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0); 48987c478bd9Sstevel@tonic-gate break; 48997c478bd9Sstevel@tonic-gate case SYS_sigprocmask: 49007c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 49017c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], " set"); 49027c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 49037c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[2], "oset"); 49047c478bd9Sstevel@tonic-gate break; 49057c478bd9Sstevel@tonic-gate case SYS_sigsuspend: 49067c478bd9Sstevel@tonic-gate case SYS_sigtimedwait: 49077c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 49087c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[0], "sigmask"); 49097c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 49107c478bd9Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[1]); 49117c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) 49127c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 49137c478bd9Sstevel@tonic-gate break; 49147c478bd9Sstevel@tonic-gate case SYS_sigaltstack: 49157c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 49167c478bd9Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[0], 49177c478bd9Sstevel@tonic-gate "new"); 49187c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 49197c478bd9Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[1], 49207c478bd9Sstevel@tonic-gate "old"); 49217c478bd9Sstevel@tonic-gate break; 49227c478bd9Sstevel@tonic-gate case SYS_sigaction: 49237c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 49247c478bd9Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[1], 49257c478bd9Sstevel@tonic-gate "new", NULL); 49267c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 49277c478bd9Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[2], 49287c478bd9Sstevel@tonic-gate "old", r0); 49297c478bd9Sstevel@tonic-gate break; 49307c478bd9Sstevel@tonic-gate case SYS_sigpending: 49317c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 49327c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], "sigmask"); 49337c478bd9Sstevel@tonic-gate break; 49347c478bd9Sstevel@tonic-gate case SYS_waitsys: 49357c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 49367c478bd9Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[2]); 49377c478bd9Sstevel@tonic-gate break; 49387c478bd9Sstevel@tonic-gate case SYS_sigsendsys: 49397c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 49407c478bd9Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[0]); 49417c478bd9Sstevel@tonic-gate break; 49427c478bd9Sstevel@tonic-gate case SYS_priocntlsys: 49437c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 49447c478bd9Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[1]); 49457c478bd9Sstevel@tonic-gate break; 49467c478bd9Sstevel@tonic-gate case SYS_mincore: 49477c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 49487c478bd9Sstevel@tonic-gate show_bool(pri, (long)pri->sys_args[2], 49497c478bd9Sstevel@tonic-gate (pri->sys_args[1] + pagesize - 1) / pagesize); 49507c478bd9Sstevel@tonic-gate break; 49517c478bd9Sstevel@tonic-gate case SYS_readv: 49527c478bd9Sstevel@tonic-gate case SYS_writev: 49537c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) { 49547c478bd9Sstevel@tonic-gate int i = pri->sys_args[0]+1; 49557c478bd9Sstevel@tonic-gate int showbuf = FALSE; 49567c478bd9Sstevel@tonic-gate long nb = (what == SYS_readv)? r0 : 32*1024; 49577c478bd9Sstevel@tonic-gate 49587c478bd9Sstevel@tonic-gate if ((what == SYS_readv && !err && 49597c478bd9Sstevel@tonic-gate prismember(&readfd, i)) || 49607c478bd9Sstevel@tonic-gate (what == SYS_writev && 49617c478bd9Sstevel@tonic-gate prismember(&writefd, i))) 49627c478bd9Sstevel@tonic-gate showbuf = TRUE; 49637c478bd9Sstevel@tonic-gate show_iovec(pri, (long)pri->sys_args[1], 49647c478bd9Sstevel@tonic-gate pri->sys_args[2], showbuf, nb); 49657c478bd9Sstevel@tonic-gate } 49667c478bd9Sstevel@tonic-gate break; 49677c478bd9Sstevel@tonic-gate case SYS_getrlimit: 49687c478bd9Sstevel@tonic-gate if (err) 49697c478bd9Sstevel@tonic-gate break; 49707c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 49717c478bd9Sstevel@tonic-gate case SYS_setrlimit: 49727c478bd9Sstevel@tonic-gate if (pri->sys_nargs <= 1) 49737c478bd9Sstevel@tonic-gate break; 49747c478bd9Sstevel@tonic-gate #ifdef _LP64 49757c478bd9Sstevel@tonic-gate if (lp64) 49767c478bd9Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 49777c478bd9Sstevel@tonic-gate else 49787c478bd9Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 49797c478bd9Sstevel@tonic-gate #else 49807c478bd9Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]); 49817c478bd9Sstevel@tonic-gate #endif 49827c478bd9Sstevel@tonic-gate break; 49837c478bd9Sstevel@tonic-gate case SYS_getrlimit64: 49847c478bd9Sstevel@tonic-gate if (err) 49857c478bd9Sstevel@tonic-gate break; 49867c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/ 49877c478bd9Sstevel@tonic-gate case SYS_setrlimit64: 49887c478bd9Sstevel@tonic-gate if (pri->sys_nargs <= 1) 49897c478bd9Sstevel@tonic-gate break; 49907c478bd9Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]); 49917c478bd9Sstevel@tonic-gate break; 49927c478bd9Sstevel@tonic-gate case SYS_uname: 49937c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 49947c478bd9Sstevel@tonic-gate show_nuname(pri, (long)pri->sys_args[0]); 49957c478bd9Sstevel@tonic-gate break; 49967c478bd9Sstevel@tonic-gate case SYS_adjtime: 49977c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 49987c478bd9Sstevel@tonic-gate show_adjtime(pri, (long)pri->sys_args[0], 49997c478bd9Sstevel@tonic-gate (long)pri->sys_args[1]); 50007c478bd9Sstevel@tonic-gate break; 50017c478bd9Sstevel@tonic-gate case SYS_lwp_info: 50027c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 0) 50037c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "cpu time"); 50047c478bd9Sstevel@tonic-gate break; 50057c478bd9Sstevel@tonic-gate case SYS_lwp_wait: 50067c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1) 50077c478bd9Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[1], "lwpid"); 50087c478bd9Sstevel@tonic-gate break; 50097c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_wakeup: 50107c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_lock: 50117c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_unlock: 50127c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_trylock: 50137c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_init: 50147c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50157c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 50167c478bd9Sstevel@tonic-gate break; 50177c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_timedlock: 50187c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50197c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]); 50207c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 50217c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 50227c478bd9Sstevel@tonic-gate break; 50237c478bd9Sstevel@tonic-gate case SYS_lwp_cond_wait: 50247c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50257c478bd9Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 50267c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 50277c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[1]); 50287c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) 50297c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 50307c478bd9Sstevel@tonic-gate break; 50317c478bd9Sstevel@tonic-gate case SYS_lwp_cond_signal: 50327c478bd9Sstevel@tonic-gate case SYS_lwp_cond_broadcast: 50337c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50347c478bd9Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]); 50357c478bd9Sstevel@tonic-gate break; 50367c478bd9Sstevel@tonic-gate case SYS_lwp_sema_wait: 50377c478bd9Sstevel@tonic-gate case SYS_lwp_sema_trywait: 50387c478bd9Sstevel@tonic-gate case SYS_lwp_sema_post: 50397c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50407c478bd9Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 50417c478bd9Sstevel@tonic-gate break; 50427c478bd9Sstevel@tonic-gate case SYS_lwp_sema_timedwait: 50437c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50447c478bd9Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]); 50457c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 50467c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 50477c478bd9Sstevel@tonic-gate break; 50487c478bd9Sstevel@tonic-gate case SYS_lwp_rwlock_sys: 50497c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1) 50507c478bd9Sstevel@tonic-gate show_rwlock(pri, (long)pri->sys_args[1]); 50517c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2 && 50527c478bd9Sstevel@tonic-gate (pri->sys_args[0] == 0 || pri->sys_args[0] == 1)) 50537c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout"); 50547c478bd9Sstevel@tonic-gate break; 50557c478bd9Sstevel@tonic-gate case SYS_lwp_create: 50567c478bd9Sstevel@tonic-gate /* XXX print some values in ucontext ??? */ 50577c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 50587c478bd9Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[2], "lwpid"); 50597c478bd9Sstevel@tonic-gate break; 50607c478bd9Sstevel@tonic-gate case SYS_kaio: 50617c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1) 50627c478bd9Sstevel@tonic-gate show_timeval(pri, (long)pri->sys_args[1], "timeout"); 50637c478bd9Sstevel@tonic-gate break; 50647c478bd9Sstevel@tonic-gate case SYS_nanosleep: 50657c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0) 50667c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "tmout"); 50677c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (err == 0 || err == EINTR)) 50687c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "resid"); 50697c478bd9Sstevel@tonic-gate break; 50707c478bd9Sstevel@tonic-gate case SYS_privsys: 50717c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 50727c478bd9Sstevel@tonic-gate case PRIVSYS_SETPPRIV: 50737c478bd9Sstevel@tonic-gate case PRIVSYS_GETPPRIV: 50747c478bd9Sstevel@tonic-gate if (!err) 50757c478bd9Sstevel@tonic-gate show_privset(pri, (long)pri->sys_args[3], 5076821c4a97Sdp (size_t)pri->sys_args[4], ""); 50777c478bd9Sstevel@tonic-gate } 50787c478bd9Sstevel@tonic-gate break; 50797c478bd9Sstevel@tonic-gate case SYS_ucredsys: 50807c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) { 50817c478bd9Sstevel@tonic-gate case UCREDSYS_UCREDGET: 50827c478bd9Sstevel@tonic-gate case UCREDSYS_GETPEERUCRED: 50837c478bd9Sstevel@tonic-gate if (err == 0) 50847c478bd9Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[2]); 50857c478bd9Sstevel@tonic-gate break; 50867c478bd9Sstevel@tonic-gate } 50877c478bd9Sstevel@tonic-gate break; 50887c478bd9Sstevel@tonic-gate case SYS_bind: 50897c478bd9Sstevel@tonic-gate case SYS_connect: 50907c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) 50917c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 50927c478bd9Sstevel@tonic-gate 0, (long)pri->sys_args[2]); 50937c478bd9Sstevel@tonic-gate break; 50947c478bd9Sstevel@tonic-gate case SYS_sendto: 50957c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 5) 50967c478bd9Sstevel@tonic-gate show_sockaddr(pri, "to", (long)pri->sys_args[4], 0, 50977c478bd9Sstevel@tonic-gate pri->sys_args[5]); 50987c478bd9Sstevel@tonic-gate break; 50997c478bd9Sstevel@tonic-gate case SYS_accept: 51007c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 51017c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 51027c478bd9Sstevel@tonic-gate (long)pri->sys_args[2], 0); 51037c478bd9Sstevel@tonic-gate break; 51047c478bd9Sstevel@tonic-gate case SYS_getsockname: 51057c478bd9Sstevel@tonic-gate case SYS_getpeername: 51067c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 51077c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1], 51087c478bd9Sstevel@tonic-gate (long)pri->sys_args[2], 0); 51097c478bd9Sstevel@tonic-gate break; 51107c478bd9Sstevel@tonic-gate case SYS_cladm: 51117c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2) 51127c478bd9Sstevel@tonic-gate show_cladm(pri, pri->sys_args[0], pri->sys_args[1], 51137c478bd9Sstevel@tonic-gate (long)pri->sys_args[2]); 51147c478bd9Sstevel@tonic-gate break; 51157c478bd9Sstevel@tonic-gate case SYS_recvfrom: 51167c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 5) 51177c478bd9Sstevel@tonic-gate show_sockaddr(pri, "from", (long)pri->sys_args[4], 51187c478bd9Sstevel@tonic-gate (long)pri->sys_args[5], 0); 51197c478bd9Sstevel@tonic-gate break; 51207c478bd9Sstevel@tonic-gate case SYS_recvmsg: 51217c478bd9Sstevel@tonic-gate if (err) 51227c478bd9Sstevel@tonic-gate break; 51237c478bd9Sstevel@tonic-gate /* FALLTHROUGH */ 51247c478bd9Sstevel@tonic-gate case SYS_sendmsg: 512581006e0fSja97890 if (pri->sys_nargs <= 2) 51267c478bd9Sstevel@tonic-gate break; 51277c478bd9Sstevel@tonic-gate #ifdef _LP64 51287c478bd9Sstevel@tonic-gate if (lp64) 51297c478bd9Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 51307c478bd9Sstevel@tonic-gate else 51317c478bd9Sstevel@tonic-gate show_msghdr32(pri, pri->sys_args[1]); 51327c478bd9Sstevel@tonic-gate #else 51337c478bd9Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]); 51347c478bd9Sstevel@tonic-gate #endif 51357c478bd9Sstevel@tonic-gate break; 51367c478bd9Sstevel@tonic-gate case SYS_door: 51377c478bd9Sstevel@tonic-gate show_doors(pri); 51387c478bd9Sstevel@tonic-gate break; 51397c478bd9Sstevel@tonic-gate case SYS_sendfilev: 51407c478bd9Sstevel@tonic-gate if (pri->sys_nargs != 5) 51417c478bd9Sstevel@tonic-gate break; 51427c478bd9Sstevel@tonic-gate 51437c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == SENDFILEV) { 51447c478bd9Sstevel@tonic-gate show_sendfilevec(pri, (int)pri->sys_args[1], 51457c478bd9Sstevel@tonic-gate (sendfilevec_t *)pri->sys_args[2], 51467c478bd9Sstevel@tonic-gate (int)pri->sys_args[3]); 51477c478bd9Sstevel@tonic-gate } else if (pri->sys_args[0] == SENDFILEV64) { 51487c478bd9Sstevel@tonic-gate show_sendfilevec64(pri, (int)pri->sys_args[1], 51497c478bd9Sstevel@tonic-gate (sendfilevec64_t *)pri->sys_args[2], 51507c478bd9Sstevel@tonic-gate (int)pri->sys_args[3]); 51517c478bd9Sstevel@tonic-gate } 51527c478bd9Sstevel@tonic-gate break; 51537c478bd9Sstevel@tonic-gate case SYS_memcntl: 51547c478bd9Sstevel@tonic-gate show_memcntl(pri); 51557c478bd9Sstevel@tonic-gate break; 51567c478bd9Sstevel@tonic-gate case SYS_lwp_park: 51577c478bd9Sstevel@tonic-gate /* subcode 0: lwp_park(timespec_t *, id_t) */ 51587c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && pri->sys_args[0] == 0) 51597c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout"); 51607c478bd9Sstevel@tonic-gate /* subcode 2: lwp_unpark_all(id_t *, int) */ 51617c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2 && pri->sys_args[0] == 2) 51627c478bd9Sstevel@tonic-gate show_ids(pri, (long)pri->sys_args[1], 51637c478bd9Sstevel@tonic-gate (int)pri->sys_args[2]); 51647c478bd9Sstevel@tonic-gate break; 51657c478bd9Sstevel@tonic-gate case SYS_ntp_gettime: 51667c478bd9Sstevel@tonic-gate if (!err) 51677c478bd9Sstevel@tonic-gate show_ntp_gettime(pri); 51687c478bd9Sstevel@tonic-gate break; 51697c478bd9Sstevel@tonic-gate case SYS_ntp_adjtime: 51707c478bd9Sstevel@tonic-gate if (!err) 51717c478bd9Sstevel@tonic-gate show_ntp_adjtime(pri); 51727c478bd9Sstevel@tonic-gate break; 51737c478bd9Sstevel@tonic-gate case SYS_rusagesys: 51747c478bd9Sstevel@tonic-gate if (!err) 51757c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) { 51767c478bd9Sstevel@tonic-gate #ifdef _LP64 51777c478bd9Sstevel@tonic-gate if (!lp64) 51787c478bd9Sstevel@tonic-gate show_getrusage32(pri->sys_args[1]); 51797c478bd9Sstevel@tonic-gate else 51807c478bd9Sstevel@tonic-gate #endif 51817c478bd9Sstevel@tonic-gate show_getrusage(pri->sys_args[1]); 51827c478bd9Sstevel@tonic-gate } 51837c478bd9Sstevel@tonic-gate break; 51847c478bd9Sstevel@tonic-gate case SYS_port: 51857c478bd9Sstevel@tonic-gate show_ports(pri); 51867c478bd9Sstevel@tonic-gate break; 5187821c4a97Sdp 5188821c4a97Sdp case SYS_zone: 5189821c4a97Sdp show_zones(pri); 5190821c4a97Sdp break; 5191*aa4a4f3bSnf202958 5192*aa4a4f3bSnf202958 case SYS_rctlsys: 5193*aa4a4f3bSnf202958 show_rctls(pri); 5194*aa4a4f3bSnf202958 break; 51957c478bd9Sstevel@tonic-gate } 51967c478bd9Sstevel@tonic-gate } 5197