17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
52caf0dcdSrshoaib * Common Development and Distribution License (the "License").
62caf0dcdSrshoaib * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
212caf0dcdSrshoaib
227c478bd9Sstevel@tonic-gate /*
23a803cc21SGordon Ross * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
243e95bd4aSAnders Persson * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
259c3fd121SMatthew Ahrens * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
267a5aac98SJerry Jelinek * Copyright 2015 Joyent, Inc.
277c478bd9Sstevel@tonic-gate */
287c478bd9Sstevel@tonic-gate
297c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30*27aa4812SToomas Soome /* All Rights Reserved */
317c478bd9Sstevel@tonic-gate
327c478bd9Sstevel@tonic-gate #define _SYSCALL32
337c478bd9Sstevel@tonic-gate
347c478bd9Sstevel@tonic-gate #include <stdio.h>
357c478bd9Sstevel@tonic-gate #include <stdlib.h>
367c478bd9Sstevel@tonic-gate #include <unistd.h>
377c478bd9Sstevel@tonic-gate #include <ctype.h>
387c478bd9Sstevel@tonic-gate #include <sys/types.h>
397c478bd9Sstevel@tonic-gate #include <sys/mman.h>
407c478bd9Sstevel@tonic-gate #include <libproc.h>
417c478bd9Sstevel@tonic-gate #include <string.h>
427c478bd9Sstevel@tonic-gate #include <limits.h>
437c478bd9Sstevel@tonic-gate #include <sys/statfs.h>
447c478bd9Sstevel@tonic-gate #include <sys/times.h>
457c478bd9Sstevel@tonic-gate #include <sys/timex.h>
467c478bd9Sstevel@tonic-gate #include <sys/utssys.h>
477c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
487c478bd9Sstevel@tonic-gate #include <sys/ipc.h>
497c478bd9Sstevel@tonic-gate #include <sys/ipc_impl.h>
507c478bd9Sstevel@tonic-gate #include <sys/msg.h>
517c478bd9Sstevel@tonic-gate #include <sys/msg_impl.h>
527c478bd9Sstevel@tonic-gate #include <sys/sem.h>
537c478bd9Sstevel@tonic-gate #include <sys/sem_impl.h>
547c478bd9Sstevel@tonic-gate #include <sys/shm.h>
557c478bd9Sstevel@tonic-gate #include <sys/shm_impl.h>
567c478bd9Sstevel@tonic-gate #include <sys/dirent.h>
577c478bd9Sstevel@tonic-gate #include <ustat.h>
587c478bd9Sstevel@tonic-gate #include <fcntl.h>
597c478bd9Sstevel@tonic-gate #include <time.h>
607c478bd9Sstevel@tonic-gate #include <sys/termios.h>
617c478bd9Sstevel@tonic-gate #include <sys/termiox.h>
627c478bd9Sstevel@tonic-gate #include <sys/termio.h>
637c478bd9Sstevel@tonic-gate #include <sys/ttold.h>
647c478bd9Sstevel@tonic-gate #include <sys/jioctl.h>
657c478bd9Sstevel@tonic-gate #include <sys/filio.h>
667c478bd9Sstevel@tonic-gate #include <stropts.h>
677c478bd9Sstevel@tonic-gate #include <poll.h>
687c478bd9Sstevel@tonic-gate #include <sys/uio.h>
697c478bd9Sstevel@tonic-gate #include <sys/resource.h>
707c478bd9Sstevel@tonic-gate #include <sys/statvfs.h>
717c478bd9Sstevel@tonic-gate #include <sys/time.h>
727c478bd9Sstevel@tonic-gate #include <sys/aio.h>
737c478bd9Sstevel@tonic-gate #include <sys/socket.h>
747c478bd9Sstevel@tonic-gate #include <netinet/in.h>
757c478bd9Sstevel@tonic-gate #include <sys/un.h>
767c478bd9Sstevel@tonic-gate #include <sys/byteorder.h>
777c478bd9Sstevel@tonic-gate #include <arpa/inet.h>
787c478bd9Sstevel@tonic-gate #include <sys/audioio.h>
797c478bd9Sstevel@tonic-gate #include <sys/cladm.h>
807c478bd9Sstevel@tonic-gate #include <sys/synch.h>
817c478bd9Sstevel@tonic-gate #include <sys/synch32.h>
827c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
837c478bd9Sstevel@tonic-gate #include <sys/sendfile.h>
847c478bd9Sstevel@tonic-gate #include <priv.h>
857c478bd9Sstevel@tonic-gate #include <ucred.h>
867c478bd9Sstevel@tonic-gate #include <sys/ucred.h>
877c478bd9Sstevel@tonic-gate #include <sys/port_impl.h>
88821c4a97Sdp #include <sys/zone.h>
89821c4a97Sdp #include <sys/priv_impl.h>
90821c4a97Sdp #include <sys/priv.h>
9145916cd2Sjpk #include <tsol/label.h>
92aa4a4f3bSnf #include <sys/nvpair.h>
93aa4a4f3bSnf #include <libnvpair.h>
94532877c4Srd #include <sys/rctl_impl.h>
953e95bd4aSAnders Persson #include <sys/socketvar.h>
96a803cc21SGordon Ross #include <sys/fs/zfs.h>
97a803cc21SGordon Ross #include <sys/zfs_ioctl.h>
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate #include "ramdata.h"
1007c478bd9Sstevel@tonic-gate #include "systable.h"
1017c478bd9Sstevel@tonic-gate #include "proto.h"
1027c478bd9Sstevel@tonic-gate
1037c478bd9Sstevel@tonic-gate void show_sigset(private_t *, long, const char *);
1047c478bd9Sstevel@tonic-gate void show_ioctl(private_t *, int, long);
105a803cc21SGordon Ross void show_zfs_ioc(private_t *, long);
1067c478bd9Sstevel@tonic-gate
1073b862e9aSRoger A. Faulkner static void
mk_ctime(char * str,size_t maxsize,time_t value)1083b862e9aSRoger A. Faulkner mk_ctime(char *str, size_t maxsize, time_t value)
1093b862e9aSRoger A. Faulkner {
1103b862e9aSRoger A. Faulkner (void) strftime(str, maxsize, "%b %e %H:%M:%S %Z %Y",
1113b862e9aSRoger A. Faulkner localtime(&value));
1123b862e9aSRoger A. Faulkner }
1133b862e9aSRoger A. Faulkner
1147c478bd9Sstevel@tonic-gate void
prtime(private_t * pri,const char * name,time_t value)1157c478bd9Sstevel@tonic-gate prtime(private_t *pri, const char *name, time_t value)
1167c478bd9Sstevel@tonic-gate {
1177c478bd9Sstevel@tonic-gate char str[80];
1187c478bd9Sstevel@tonic-gate
1193b862e9aSRoger A. Faulkner mk_ctime(str, sizeof (str), value);
1203b862e9aSRoger A. Faulkner (void) printf("%s\t%s%s [ %lu ]\n",
1217c478bd9Sstevel@tonic-gate pri->pname,
1227c478bd9Sstevel@tonic-gate name,
1237c478bd9Sstevel@tonic-gate str,
1243b862e9aSRoger A. Faulkner value);
1257c478bd9Sstevel@tonic-gate }
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate void
prtimeval(private_t * pri,const char * name,struct timeval * value)1283b862e9aSRoger A. Faulkner prtimeval(private_t *pri, const char *name, struct timeval *value)
1297c478bd9Sstevel@tonic-gate {
1303b862e9aSRoger A. Faulkner char str[80];
1313b862e9aSRoger A. Faulkner
1323b862e9aSRoger A. Faulkner mk_ctime(str, sizeof (str), value->tv_sec);
1333b862e9aSRoger A. Faulkner (void) printf("%s\t%s%s [ %lu.%6.6lu ]\n",
1343b862e9aSRoger A. Faulkner pri->pname,
1353b862e9aSRoger A. Faulkner name,
1363b862e9aSRoger A. Faulkner str,
1373b862e9aSRoger A. Faulkner value->tv_sec,
1383b862e9aSRoger A. Faulkner value->tv_usec);
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate void
prtimestruc(private_t * pri,const char * name,timestruc_t * value)1423b862e9aSRoger A. Faulkner prtimestruc(private_t *pri, const char *name, timestruc_t *value)
1433b862e9aSRoger A. Faulkner {
1443b862e9aSRoger A. Faulkner char str[80];
1453b862e9aSRoger A. Faulkner
1463b862e9aSRoger A. Faulkner mk_ctime(str, sizeof (str), value->tv_sec);
1473b862e9aSRoger A. Faulkner (void) printf("%s\t%s%s [ %lu.%9.9lu ]\n",
1483b862e9aSRoger A. Faulkner pri->pname,
1493b862e9aSRoger A. Faulkner name,
1503b862e9aSRoger A. Faulkner str,
1513b862e9aSRoger A. Faulkner value->tv_sec,
1523b862e9aSRoger A. Faulkner value->tv_nsec);
1533b862e9aSRoger A. Faulkner }
1543b862e9aSRoger A. Faulkner
1553b862e9aSRoger A. Faulkner static void
show_utimens(private_t * pri,long offset)1563b862e9aSRoger A. Faulkner show_utimens(private_t *pri, long offset)
1573b862e9aSRoger A. Faulkner {
1583b862e9aSRoger A. Faulkner struct {
1593b862e9aSRoger A. Faulkner timespec_t atime;
1603b862e9aSRoger A. Faulkner timespec_t mtime;
1613b862e9aSRoger A. Faulkner } utimbuf;
1623b862e9aSRoger A. Faulkner
1633b862e9aSRoger A. Faulkner if (offset == 0)
1643b862e9aSRoger A. Faulkner return;
1653b862e9aSRoger A. Faulkner
1663b862e9aSRoger A. Faulkner if (data_model == PR_MODEL_NATIVE) {
1673b862e9aSRoger A. Faulkner if (Pread(Proc, &utimbuf, sizeof (utimbuf), offset)
1683b862e9aSRoger A. Faulkner != sizeof (utimbuf))
1693b862e9aSRoger A. Faulkner return;
1703b862e9aSRoger A. Faulkner } else {
1713b862e9aSRoger A. Faulkner struct {
1723b862e9aSRoger A. Faulkner timespec32_t atime;
1733b862e9aSRoger A. Faulkner timespec32_t mtime;
1743b862e9aSRoger A. Faulkner } utimbuf32;
1753b862e9aSRoger A. Faulkner
1763b862e9aSRoger A. Faulkner if (Pread(Proc, &utimbuf32, sizeof (utimbuf32), offset)
1773b862e9aSRoger A. Faulkner != sizeof (utimbuf32))
1783b862e9aSRoger A. Faulkner return;
1793b862e9aSRoger A. Faulkner
1803b862e9aSRoger A. Faulkner TIMESPEC32_TO_TIMESPEC(&utimbuf.atime, &utimbuf32.atime);
1813b862e9aSRoger A. Faulkner TIMESPEC32_TO_TIMESPEC(&utimbuf.mtime, &utimbuf32.mtime);
1823b862e9aSRoger A. Faulkner }
1833b862e9aSRoger A. Faulkner
1843b862e9aSRoger A. Faulkner /* print access and modification times */
1853b862e9aSRoger A. Faulkner if (utimbuf.atime.tv_nsec == UTIME_OMIT)
1863b862e9aSRoger A. Faulkner (void) printf("%s\tat = UTIME_OMIT\n", pri->pname);
1873b862e9aSRoger A. Faulkner else if (utimbuf.atime.tv_nsec == UTIME_NOW)
1883b862e9aSRoger A. Faulkner (void) printf("%s\tat = UTIME_NOW\n", pri->pname);
1893b862e9aSRoger A. Faulkner else
1903b862e9aSRoger A. Faulkner prtimestruc(pri, "at = ", &utimbuf.atime);
1913b862e9aSRoger A. Faulkner if (utimbuf.mtime.tv_nsec == UTIME_OMIT)
1923b862e9aSRoger A. Faulkner (void) printf("%s\tmt = UTIME_OMIT\n", pri->pname);
1933b862e9aSRoger A. Faulkner else if (utimbuf.mtime.tv_nsec == UTIME_NOW)
1943b862e9aSRoger A. Faulkner (void) printf("%s\tmt = UTIME_NOW\n", pri->pname);
1953b862e9aSRoger A. Faulkner else
19635da9b40SPavel Filipensky prtimestruc(pri, "mt = ", &utimbuf.mtime);
1977c478bd9Sstevel@tonic-gate }
1987c478bd9Sstevel@tonic-gate
1997c478bd9Sstevel@tonic-gate void
show_timeofday(private_t * pri)2007c478bd9Sstevel@tonic-gate show_timeofday(private_t *pri)
2017c478bd9Sstevel@tonic-gate {
2027c478bd9Sstevel@tonic-gate struct timeval tod;
2037c478bd9Sstevel@tonic-gate long offset;
2047c478bd9Sstevel@tonic-gate
205*27aa4812SToomas Soome if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
2067c478bd9Sstevel@tonic-gate return;
2077c478bd9Sstevel@tonic-gate
2087c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
2097c478bd9Sstevel@tonic-gate if (Pread(Proc, &tod, sizeof (tod), offset)
2107c478bd9Sstevel@tonic-gate != sizeof (tod))
2117c478bd9Sstevel@tonic-gate return;
2127c478bd9Sstevel@tonic-gate } else {
2137c478bd9Sstevel@tonic-gate struct timeval32 tod32;
2147c478bd9Sstevel@tonic-gate
2157c478bd9Sstevel@tonic-gate if (Pread(Proc, &tod32, sizeof (tod32), offset)
2167c478bd9Sstevel@tonic-gate != sizeof (tod32))
2177c478bd9Sstevel@tonic-gate return;
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&tod, &tod32);
2207c478bd9Sstevel@tonic-gate }
2217c478bd9Sstevel@tonic-gate
2223b862e9aSRoger A. Faulkner prtimeval(pri, "time: ", &tod);
2237c478bd9Sstevel@tonic-gate }
2247c478bd9Sstevel@tonic-gate
2257c478bd9Sstevel@tonic-gate void
show_itimerval(private_t * pri,long offset,const char * name)2267c478bd9Sstevel@tonic-gate show_itimerval(private_t *pri, long offset, const char *name)
2277c478bd9Sstevel@tonic-gate {
2287c478bd9Sstevel@tonic-gate struct itimerval itimerval;
2297c478bd9Sstevel@tonic-gate
2303b862e9aSRoger A. Faulkner if (offset == 0)
2317c478bd9Sstevel@tonic-gate return;
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
2347c478bd9Sstevel@tonic-gate if (Pread(Proc, &itimerval, sizeof (itimerval), offset)
2357c478bd9Sstevel@tonic-gate != sizeof (itimerval))
2367c478bd9Sstevel@tonic-gate return;
2377c478bd9Sstevel@tonic-gate } else {
2387c478bd9Sstevel@tonic-gate struct itimerval32 itimerval32;
2397c478bd9Sstevel@tonic-gate
2407c478bd9Sstevel@tonic-gate if (Pread(Proc, &itimerval32, sizeof (itimerval32), offset)
2417c478bd9Sstevel@tonic-gate != sizeof (itimerval32))
2427c478bd9Sstevel@tonic-gate return;
2437c478bd9Sstevel@tonic-gate
2447c478bd9Sstevel@tonic-gate ITIMERVAL32_TO_ITIMERVAL(&itimerval, &itimerval32);
2457c478bd9Sstevel@tonic-gate }
2467c478bd9Sstevel@tonic-gate
2477c478bd9Sstevel@tonic-gate (void) printf(
2487c478bd9Sstevel@tonic-gate "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n",
2497c478bd9Sstevel@tonic-gate pri->pname,
2507c478bd9Sstevel@tonic-gate name,
2517c478bd9Sstevel@tonic-gate itimerval.it_interval.tv_sec,
2527c478bd9Sstevel@tonic-gate itimerval.it_interval.tv_usec,
2537c478bd9Sstevel@tonic-gate itimerval.it_value.tv_sec,
2547c478bd9Sstevel@tonic-gate itimerval.it_value.tv_usec);
2557c478bd9Sstevel@tonic-gate }
2567c478bd9Sstevel@tonic-gate
2577c478bd9Sstevel@tonic-gate void
show_timeval(private_t * pri,long offset,const char * name)2587c478bd9Sstevel@tonic-gate show_timeval(private_t *pri, long offset, const char *name)
2597c478bd9Sstevel@tonic-gate {
2607c478bd9Sstevel@tonic-gate struct timeval timeval;
2617c478bd9Sstevel@tonic-gate
2623b862e9aSRoger A. Faulkner if (offset == 0)
2637c478bd9Sstevel@tonic-gate return;
2647c478bd9Sstevel@tonic-gate
2657c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
2667c478bd9Sstevel@tonic-gate if (Pread(Proc, &timeval, sizeof (timeval), offset)
2677c478bd9Sstevel@tonic-gate != sizeof (timeval))
2687c478bd9Sstevel@tonic-gate return;
2697c478bd9Sstevel@tonic-gate } else {
2707c478bd9Sstevel@tonic-gate struct timeval32 timeval32;
2717c478bd9Sstevel@tonic-gate
2727c478bd9Sstevel@tonic-gate if (Pread(Proc, &timeval32, sizeof (timeval32), offset)
2737c478bd9Sstevel@tonic-gate != sizeof (timeval32))
2747c478bd9Sstevel@tonic-gate return;
2757c478bd9Sstevel@tonic-gate
2767c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&timeval, &timeval32);
2777c478bd9Sstevel@tonic-gate }
2787c478bd9Sstevel@tonic-gate
2797c478bd9Sstevel@tonic-gate (void) printf(
2807c478bd9Sstevel@tonic-gate "%s\t%s: %ld.%6.6ld sec\n",
2817c478bd9Sstevel@tonic-gate pri->pname,
2827c478bd9Sstevel@tonic-gate name,
2837c478bd9Sstevel@tonic-gate timeval.tv_sec,
2847c478bd9Sstevel@tonic-gate timeval.tv_usec);
2857c478bd9Sstevel@tonic-gate }
2867c478bd9Sstevel@tonic-gate
2877c478bd9Sstevel@tonic-gate void
show_timestruc(private_t * pri,long offset,const char * name)2887c478bd9Sstevel@tonic-gate show_timestruc(private_t *pri, long offset, const char *name)
2897c478bd9Sstevel@tonic-gate {
2907c478bd9Sstevel@tonic-gate timestruc_t timestruc;
2917c478bd9Sstevel@tonic-gate
2923b862e9aSRoger A. Faulkner if (offset == 0)
2937c478bd9Sstevel@tonic-gate return;
2947c478bd9Sstevel@tonic-gate
2957c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
2967c478bd9Sstevel@tonic-gate if (Pread(Proc, ×truc, sizeof (timestruc), offset)
2977c478bd9Sstevel@tonic-gate != sizeof (timestruc))
2987c478bd9Sstevel@tonic-gate return;
2997c478bd9Sstevel@tonic-gate } else {
3007c478bd9Sstevel@tonic-gate timestruc32_t timestruc32;
3017c478bd9Sstevel@tonic-gate
3027c478bd9Sstevel@tonic-gate if (Pread(Proc, ×truc32, sizeof (timestruc32), offset)
3037c478bd9Sstevel@tonic-gate != sizeof (timestruc32))
3047c478bd9Sstevel@tonic-gate return;
3057c478bd9Sstevel@tonic-gate
3067c478bd9Sstevel@tonic-gate TIMESPEC32_TO_TIMESPEC(×truc, ×truc32);
3077c478bd9Sstevel@tonic-gate }
3087c478bd9Sstevel@tonic-gate
3097c478bd9Sstevel@tonic-gate (void) printf(
3107c478bd9Sstevel@tonic-gate "%s\t%s: %ld.%9.9ld sec\n",
3117c478bd9Sstevel@tonic-gate pri->pname,
3127c478bd9Sstevel@tonic-gate name,
3137c478bd9Sstevel@tonic-gate timestruc.tv_sec,
3147c478bd9Sstevel@tonic-gate timestruc.tv_nsec);
3157c478bd9Sstevel@tonic-gate }
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gate void
show_stime(private_t * pri)3187c478bd9Sstevel@tonic-gate show_stime(private_t *pri)
3197c478bd9Sstevel@tonic-gate {
3207c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 1) {
3217c478bd9Sstevel@tonic-gate /* print new system time */
3227c478bd9Sstevel@tonic-gate prtime(pri, "systime = ", (time_t)pri->sys_args[0]);
3237c478bd9Sstevel@tonic-gate }
3247c478bd9Sstevel@tonic-gate }
3257c478bd9Sstevel@tonic-gate
3267c478bd9Sstevel@tonic-gate void
show_times(private_t * pri)3277c478bd9Sstevel@tonic-gate show_times(private_t *pri)
3287c478bd9Sstevel@tonic-gate {
3297c478bd9Sstevel@tonic-gate long hz = sysconf(_SC_CLK_TCK);
3307c478bd9Sstevel@tonic-gate long offset;
3317c478bd9Sstevel@tonic-gate struct tms tms;
3327c478bd9Sstevel@tonic-gate
333*27aa4812SToomas Soome if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
3347c478bd9Sstevel@tonic-gate return;
3357c478bd9Sstevel@tonic-gate
3367c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
3377c478bd9Sstevel@tonic-gate if (Pread(Proc, &tms, sizeof (tms), offset)
3387c478bd9Sstevel@tonic-gate != sizeof (tms))
3397c478bd9Sstevel@tonic-gate return;
3407c478bd9Sstevel@tonic-gate } else {
3417c478bd9Sstevel@tonic-gate struct tms32 tms32;
3427c478bd9Sstevel@tonic-gate
3437c478bd9Sstevel@tonic-gate if (Pread(Proc, &tms32, sizeof (tms32), offset)
3447c478bd9Sstevel@tonic-gate != sizeof (tms32))
3457c478bd9Sstevel@tonic-gate return;
3467c478bd9Sstevel@tonic-gate
3477c478bd9Sstevel@tonic-gate /*
3487c478bd9Sstevel@tonic-gate * This looks a bit odd (since the values are actually
3497c478bd9Sstevel@tonic-gate * signed), but we need to suppress sign extension to
3507c478bd9Sstevel@tonic-gate * preserve compatibility (we've always printed these
3517c478bd9Sstevel@tonic-gate * numbers as unsigned quantities).
3527c478bd9Sstevel@tonic-gate */
3537c478bd9Sstevel@tonic-gate tms.tms_utime = (unsigned)tms32.tms_utime;
3547c478bd9Sstevel@tonic-gate tms.tms_stime = (unsigned)tms32.tms_stime;
3557c478bd9Sstevel@tonic-gate tms.tms_cutime = (unsigned)tms32.tms_cutime;
3567c478bd9Sstevel@tonic-gate tms.tms_cstime = (unsigned)tms32.tms_cstime;
3577c478bd9Sstevel@tonic-gate }
3587c478bd9Sstevel@tonic-gate
3597c478bd9Sstevel@tonic-gate (void) printf(
3607c478bd9Sstevel@tonic-gate "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
3617c478bd9Sstevel@tonic-gate pri->pname,
3627c478bd9Sstevel@tonic-gate tms.tms_utime,
3637c478bd9Sstevel@tonic-gate tms.tms_stime,
3647c478bd9Sstevel@tonic-gate tms.tms_cutime,
3657c478bd9Sstevel@tonic-gate tms.tms_cstime,
3667c478bd9Sstevel@tonic-gate hz);
3677c478bd9Sstevel@tonic-gate }
3687c478bd9Sstevel@tonic-gate
3697c478bd9Sstevel@tonic-gate void
show_uname(private_t * pri,long offset)3707c478bd9Sstevel@tonic-gate show_uname(private_t *pri, long offset)
3717c478bd9Sstevel@tonic-gate {
3727c478bd9Sstevel@tonic-gate /*
3737c478bd9Sstevel@tonic-gate * Old utsname buffer (no longer accessible in <sys/utsname.h>).
3747c478bd9Sstevel@tonic-gate */
3757c478bd9Sstevel@tonic-gate struct {
3767c478bd9Sstevel@tonic-gate char sysname[9];
3777c478bd9Sstevel@tonic-gate char nodename[9];
3787c478bd9Sstevel@tonic-gate char release[9];
3797c478bd9Sstevel@tonic-gate char version[9];
3807c478bd9Sstevel@tonic-gate char machine[9];
3817c478bd9Sstevel@tonic-gate } ubuf;
3827c478bd9Sstevel@tonic-gate
383*27aa4812SToomas Soome if (offset != 0 &&
3847c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
3857c478bd9Sstevel@tonic-gate (void) printf(
386019c3c43Sraf "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
387019c3c43Sraf pri->pname,
388019c3c43Sraf ubuf.sysname,
389019c3c43Sraf ubuf.nodename,
390019c3c43Sraf ubuf.release,
391019c3c43Sraf ubuf.version,
392019c3c43Sraf ubuf.machine);
3937c478bd9Sstevel@tonic-gate }
3947c478bd9Sstevel@tonic-gate }
3957c478bd9Sstevel@tonic-gate
3967c478bd9Sstevel@tonic-gate /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
3977c478bd9Sstevel@tonic-gate void
show_ustat(private_t * pri,long offset)3987c478bd9Sstevel@tonic-gate show_ustat(private_t *pri, long offset)
3997c478bd9Sstevel@tonic-gate {
4007c478bd9Sstevel@tonic-gate struct ustat ubuf;
4017c478bd9Sstevel@tonic-gate
402*27aa4812SToomas Soome if (offset != 0 &&
4037c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4047c478bd9Sstevel@tonic-gate (void) printf(
405019c3c43Sraf "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
406019c3c43Sraf pri->pname,
407019c3c43Sraf ubuf.f_tfree,
408019c3c43Sraf ubuf.f_tinode,
409019c3c43Sraf ubuf.f_fname,
410019c3c43Sraf ubuf.f_fpack);
4117c478bd9Sstevel@tonic-gate }
4127c478bd9Sstevel@tonic-gate }
4137c478bd9Sstevel@tonic-gate
4147c478bd9Sstevel@tonic-gate void
show_ustat32(private_t * pri,long offset)4157c478bd9Sstevel@tonic-gate show_ustat32(private_t *pri, long offset)
4167c478bd9Sstevel@tonic-gate {
4177c478bd9Sstevel@tonic-gate struct ustat32 ubuf;
4187c478bd9Sstevel@tonic-gate
419*27aa4812SToomas Soome if (offset != 0 &&
4207c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
4217c478bd9Sstevel@tonic-gate (void) printf(
422019c3c43Sraf "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
423019c3c43Sraf pri->pname,
424019c3c43Sraf ubuf.f_tfree,
425019c3c43Sraf ubuf.f_tinode,
426019c3c43Sraf ubuf.f_fname,
427019c3c43Sraf ubuf.f_fpack);
4287c478bd9Sstevel@tonic-gate }
4297c478bd9Sstevel@tonic-gate }
4307c478bd9Sstevel@tonic-gate
4317c478bd9Sstevel@tonic-gate void
show_fusers(private_t * pri,long offset,long nproc)4327c478bd9Sstevel@tonic-gate show_fusers(private_t *pri, long offset, long nproc)
4337c478bd9Sstevel@tonic-gate {
4347c478bd9Sstevel@tonic-gate f_user_t fubuf;
4357c478bd9Sstevel@tonic-gate int serial = (nproc > 4);
4367c478bd9Sstevel@tonic-gate
4373b862e9aSRoger A. Faulkner if (offset == 0)
4387c478bd9Sstevel@tonic-gate return;
4397c478bd9Sstevel@tonic-gate
4407c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
4417c478bd9Sstevel@tonic-gate if (serial)
4427c478bd9Sstevel@tonic-gate Eserialize();
4437c478bd9Sstevel@tonic-gate
4447c478bd9Sstevel@tonic-gate while (nproc > 0 &&
4457c478bd9Sstevel@tonic-gate Pread(Proc, &fubuf, sizeof (fubuf), offset) == sizeof (fubuf)) {
446f48205beScasper (void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
4477c478bd9Sstevel@tonic-gate pri->pname,
4487c478bd9Sstevel@tonic-gate (int)fubuf.fu_pid,
449f48205beScasper fubuf.fu_uid,
4507c478bd9Sstevel@tonic-gate fuflags(pri, fubuf.fu_flags));
4517c478bd9Sstevel@tonic-gate nproc--;
4527c478bd9Sstevel@tonic-gate offset += sizeof (fubuf);
4537c478bd9Sstevel@tonic-gate }
4547c478bd9Sstevel@tonic-gate
4557c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
4567c478bd9Sstevel@tonic-gate if (serial)
4577c478bd9Sstevel@tonic-gate Xserialize();
4587c478bd9Sstevel@tonic-gate }
4597c478bd9Sstevel@tonic-gate
4607c478bd9Sstevel@tonic-gate void
show_utssys(private_t * pri,long r0)4617c478bd9Sstevel@tonic-gate show_utssys(private_t *pri, long r0)
4627c478bd9Sstevel@tonic-gate {
4637c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) {
4647c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) {
4657c478bd9Sstevel@tonic-gate case UTS_UNAME:
4667c478bd9Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]);
4677c478bd9Sstevel@tonic-gate break;
4687c478bd9Sstevel@tonic-gate case UTS_USTAT:
4697c478bd9Sstevel@tonic-gate show_ustat(pri, (long)pri->sys_args[0]);
4707c478bd9Sstevel@tonic-gate break;
4717c478bd9Sstevel@tonic-gate case UTS_FUSERS:
4727c478bd9Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0);
4737c478bd9Sstevel@tonic-gate break;
4747c478bd9Sstevel@tonic-gate }
4757c478bd9Sstevel@tonic-gate }
4767c478bd9Sstevel@tonic-gate }
4777c478bd9Sstevel@tonic-gate
4787c478bd9Sstevel@tonic-gate void
show_utssys32(private_t * pri,long r0)4797c478bd9Sstevel@tonic-gate show_utssys32(private_t *pri, long r0)
4807c478bd9Sstevel@tonic-gate {
4817c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) {
4827c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) {
4837c478bd9Sstevel@tonic-gate case UTS_UNAME:
4847c478bd9Sstevel@tonic-gate show_uname(pri, (long)pri->sys_args[0]);
4857c478bd9Sstevel@tonic-gate break;
4867c478bd9Sstevel@tonic-gate case UTS_USTAT:
4877c478bd9Sstevel@tonic-gate show_ustat32(pri, (long)pri->sys_args[0]);
4887c478bd9Sstevel@tonic-gate break;
4897c478bd9Sstevel@tonic-gate case UTS_FUSERS:
4907c478bd9Sstevel@tonic-gate show_fusers(pri, (long)pri->sys_args[3], r0);
4917c478bd9Sstevel@tonic-gate break;
4927c478bd9Sstevel@tonic-gate }
4937c478bd9Sstevel@tonic-gate }
4947c478bd9Sstevel@tonic-gate }
4957c478bd9Sstevel@tonic-gate
4967c478bd9Sstevel@tonic-gate void
show_cladm(private_t * pri,int code,int function,long offset)4977c478bd9Sstevel@tonic-gate show_cladm(private_t *pri, int code, int function, long offset)
4987c478bd9Sstevel@tonic-gate {
4997c478bd9Sstevel@tonic-gate int arg;
5007c478bd9Sstevel@tonic-gate
5017c478bd9Sstevel@tonic-gate switch (code) {
5027c478bd9Sstevel@tonic-gate case CL_INITIALIZE:
5037c478bd9Sstevel@tonic-gate switch (function) {
5047c478bd9Sstevel@tonic-gate case CL_GET_BOOTFLAG:
5057c478bd9Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset)
5067c478bd9Sstevel@tonic-gate == sizeof (arg)) {
5077c478bd9Sstevel@tonic-gate if (arg & CLUSTER_CONFIGURED)
5087c478bd9Sstevel@tonic-gate (void) printf("%s\tbootflags="
5097c478bd9Sstevel@tonic-gate "CLUSTER_CONFIGURED", pri->pname);
5107c478bd9Sstevel@tonic-gate if (arg & CLUSTER_BOOTED)
5117c478bd9Sstevel@tonic-gate (void) printf("|CLUSTER_BOOTED\n");
5127c478bd9Sstevel@tonic-gate }
5137c478bd9Sstevel@tonic-gate break;
5147c478bd9Sstevel@tonic-gate }
5157c478bd9Sstevel@tonic-gate break;
5167c478bd9Sstevel@tonic-gate case CL_CONFIG:
5177c478bd9Sstevel@tonic-gate switch (function) {
5187c478bd9Sstevel@tonic-gate case CL_NODEID:
5197c478bd9Sstevel@tonic-gate case CL_HIGHEST_NODEID:
5207c478bd9Sstevel@tonic-gate if (Pread(Proc, &arg, sizeof (arg), offset)
5217c478bd9Sstevel@tonic-gate == sizeof (arg))
5227c478bd9Sstevel@tonic-gate (void) printf("%s\tnodeid=%d\n",
523019c3c43Sraf pri->pname, arg);
5247c478bd9Sstevel@tonic-gate }
5257c478bd9Sstevel@tonic-gate break;
5267c478bd9Sstevel@tonic-gate }
5277c478bd9Sstevel@tonic-gate }
5287c478bd9Sstevel@tonic-gate
529883492d5Sraf #define ALL_LOCK_TYPES \
530*27aa4812SToomas Soome (USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE | \
531*27aa4812SToomas Soome LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST | \
532883492d5Sraf USYNC_PROCESS_ROBUST)
5337c478bd9Sstevel@tonic-gate
5347c478bd9Sstevel@tonic-gate /* return cv and mutex types */
5357c478bd9Sstevel@tonic-gate const char *
synch_type(private_t * pri,uint_t type)5367c478bd9Sstevel@tonic-gate synch_type(private_t *pri, uint_t type)
5377c478bd9Sstevel@tonic-gate {
5387c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
5397c478bd9Sstevel@tonic-gate
5407c478bd9Sstevel@tonic-gate if (type & USYNC_PROCESS)
5417c478bd9Sstevel@tonic-gate (void) strcpy(str, "USYNC_PROCESS");
5427c478bd9Sstevel@tonic-gate else
5437c478bd9Sstevel@tonic-gate (void) strcpy(str, "USYNC_THREAD");
5447c478bd9Sstevel@tonic-gate
5457c478bd9Sstevel@tonic-gate if (type & LOCK_ERRORCHECK)
5467c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_ERRORCHECK");
5477c478bd9Sstevel@tonic-gate if (type & LOCK_RECURSIVE)
5487c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_RECURSIVE");
5497c478bd9Sstevel@tonic-gate if (type & LOCK_PRIO_INHERIT)
5507c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_INHERIT");
5517c478bd9Sstevel@tonic-gate if (type & LOCK_PRIO_PROTECT)
5527c478bd9Sstevel@tonic-gate (void) strcat(str, "|LOCK_PRIO_PROTECT");
553883492d5Sraf if (type & LOCK_ROBUST)
554883492d5Sraf (void) strcat(str, "|LOCK_ROBUST");
555883492d5Sraf if (type & USYNC_PROCESS_ROBUST)
556883492d5Sraf (void) strcat(str, "|USYNC_PROCESS_ROBUST");
5577c478bd9Sstevel@tonic-gate
5587c478bd9Sstevel@tonic-gate if ((type &= ~ALL_LOCK_TYPES) != 0)
5597c478bd9Sstevel@tonic-gate (void) sprintf(str + strlen(str), "|0x%.4X", type);
5607c478bd9Sstevel@tonic-gate
5617c478bd9Sstevel@tonic-gate return ((const char *)str);
5627c478bd9Sstevel@tonic-gate }
5637c478bd9Sstevel@tonic-gate
5647c478bd9Sstevel@tonic-gate void
show_mutex(private_t * pri,long offset)5657c478bd9Sstevel@tonic-gate show_mutex(private_t *pri, long offset)
5667c478bd9Sstevel@tonic-gate {
5677c478bd9Sstevel@tonic-gate lwp_mutex_t mutex;
5687c478bd9Sstevel@tonic-gate
5697c478bd9Sstevel@tonic-gate if (Pread(Proc, &mutex, sizeof (mutex), offset) == sizeof (mutex)) {
5707c478bd9Sstevel@tonic-gate (void) printf("%s\tmutex type: %s\n",
571019c3c43Sraf pri->pname,
572019c3c43Sraf synch_type(pri, mutex.mutex_type));
5737c478bd9Sstevel@tonic-gate }
5747c478bd9Sstevel@tonic-gate }
5757c478bd9Sstevel@tonic-gate
5767c478bd9Sstevel@tonic-gate void
show_condvar(private_t * pri,long offset)5777c478bd9Sstevel@tonic-gate show_condvar(private_t *pri, long offset)
5787c478bd9Sstevel@tonic-gate {
5797c478bd9Sstevel@tonic-gate lwp_cond_t condvar;
5807c478bd9Sstevel@tonic-gate
5817c478bd9Sstevel@tonic-gate if (Pread(Proc, &condvar, sizeof (condvar), offset)
5827c478bd9Sstevel@tonic-gate == sizeof (condvar)) {
5837c478bd9Sstevel@tonic-gate (void) printf("%s\tcondvar type: %s\n",
584019c3c43Sraf pri->pname,
585019c3c43Sraf synch_type(pri, condvar.cond_type));
5867c478bd9Sstevel@tonic-gate }
5877c478bd9Sstevel@tonic-gate }
5887c478bd9Sstevel@tonic-gate
5897c478bd9Sstevel@tonic-gate void
show_sema(private_t * pri,long offset)5907c478bd9Sstevel@tonic-gate show_sema(private_t *pri, long offset)
5917c478bd9Sstevel@tonic-gate {
5927c478bd9Sstevel@tonic-gate lwp_sema_t sema;
5937c478bd9Sstevel@tonic-gate
5947c478bd9Sstevel@tonic-gate if (Pread(Proc, &sema, sizeof (sema), offset) == sizeof (sema)) {
5957c478bd9Sstevel@tonic-gate (void) printf("%s\tsema type: %s count = %u\n",
596019c3c43Sraf pri->pname,
597019c3c43Sraf synch_type(pri, sema.sema_type),
598019c3c43Sraf sema.sema_count);
5997c478bd9Sstevel@tonic-gate }
6007c478bd9Sstevel@tonic-gate }
6017c478bd9Sstevel@tonic-gate
6027c478bd9Sstevel@tonic-gate void
show_rwlock(private_t * pri,long offset)6037c478bd9Sstevel@tonic-gate show_rwlock(private_t *pri, long offset)
6047c478bd9Sstevel@tonic-gate {
6057c478bd9Sstevel@tonic-gate lwp_rwlock_t rwlock;
6067c478bd9Sstevel@tonic-gate
6077c478bd9Sstevel@tonic-gate if (Pread(Proc, &rwlock, sizeof (rwlock), offset) == sizeof (rwlock)) {
6087c478bd9Sstevel@tonic-gate (void) printf("%s\trwlock type: %s readers = %d\n",
609019c3c43Sraf pri->pname,
610019c3c43Sraf synch_type(pri, rwlock.rwlock_type),
611019c3c43Sraf rwlock.rwlock_readers);
6127c478bd9Sstevel@tonic-gate }
6137c478bd9Sstevel@tonic-gate }
6147c478bd9Sstevel@tonic-gate
6157c478bd9Sstevel@tonic-gate /* represent character as itself ('c') or octal (012) */
6167c478bd9Sstevel@tonic-gate char *
show_char(char * buf,int c)6177c478bd9Sstevel@tonic-gate show_char(char *buf, int c)
6187c478bd9Sstevel@tonic-gate {
6197c478bd9Sstevel@tonic-gate const char *fmt;
6207c478bd9Sstevel@tonic-gate
6217c478bd9Sstevel@tonic-gate if (c >= ' ' && c < 0177)
6227c478bd9Sstevel@tonic-gate fmt = "'%c'";
6237c478bd9Sstevel@tonic-gate else
6247c478bd9Sstevel@tonic-gate fmt = "%.3o";
6257c478bd9Sstevel@tonic-gate
6267c478bd9Sstevel@tonic-gate (void) sprintf(buf, fmt, c&0xff);
6277c478bd9Sstevel@tonic-gate return (buf);
6287c478bd9Sstevel@tonic-gate }
6297c478bd9Sstevel@tonic-gate
6307c478bd9Sstevel@tonic-gate void
show_termio(private_t * pri,long offset)6317c478bd9Sstevel@tonic-gate show_termio(private_t *pri, long offset)
6327c478bd9Sstevel@tonic-gate {
6337c478bd9Sstevel@tonic-gate struct termio termio;
6347c478bd9Sstevel@tonic-gate char cbuf[8];
6357c478bd9Sstevel@tonic-gate int i;
6367c478bd9Sstevel@tonic-gate
6377c478bd9Sstevel@tonic-gate if (Pread(Proc, &termio, sizeof (termio), offset) == sizeof (termio)) {
6387c478bd9Sstevel@tonic-gate (void) printf(
6397c478bd9Sstevel@tonic-gate "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
640019c3c43Sraf pri->pname,
641019c3c43Sraf termio.c_iflag,
642019c3c43Sraf termio.c_oflag,
643019c3c43Sraf termio.c_cflag,
644019c3c43Sraf termio.c_lflag,
645019c3c43Sraf termio.c_line);
6467c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname);
6477c478bd9Sstevel@tonic-gate for (i = 0; i < NCC; i++)
6487c478bd9Sstevel@tonic-gate (void) printf(" %s",
649019c3c43Sraf show_char(cbuf, (int)termio.c_cc[i]));
6507c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
6517c478bd9Sstevel@tonic-gate }
6527c478bd9Sstevel@tonic-gate }
6537c478bd9Sstevel@tonic-gate
6547c478bd9Sstevel@tonic-gate void
show_termios(private_t * pri,long offset)6557c478bd9Sstevel@tonic-gate show_termios(private_t *pri, long offset)
6567c478bd9Sstevel@tonic-gate {
6577c478bd9Sstevel@tonic-gate struct termios termios;
6587c478bd9Sstevel@tonic-gate char cbuf[8];
6597c478bd9Sstevel@tonic-gate int i;
6607c478bd9Sstevel@tonic-gate
6617c478bd9Sstevel@tonic-gate if (Pread(Proc, &termios, sizeof (termios), offset)
6627c478bd9Sstevel@tonic-gate == sizeof (termios)) {
6637c478bd9Sstevel@tonic-gate (void) printf(
664019c3c43Sraf "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
665019c3c43Sraf pri->pname,
666019c3c43Sraf termios.c_iflag,
667019c3c43Sraf termios.c_oflag,
668019c3c43Sraf termios.c_cflag,
669019c3c43Sraf termios.c_lflag);
6707c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname);
6717c478bd9Sstevel@tonic-gate for (i = 0; i < NCCS; i++) {
6727c478bd9Sstevel@tonic-gate if (i == NCC) /* show new chars on new line */
6737c478bd9Sstevel@tonic-gate (void) printf("\n%s\t\t", pri->pname);
6747c478bd9Sstevel@tonic-gate (void) printf(" %s",
675019c3c43Sraf show_char(cbuf, (int)termios.c_cc[i]));
6767c478bd9Sstevel@tonic-gate }
6777c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
6787c478bd9Sstevel@tonic-gate }
6797c478bd9Sstevel@tonic-gate }
6807c478bd9Sstevel@tonic-gate
6817c478bd9Sstevel@tonic-gate void
show_termiox(private_t * pri,long offset)6827c478bd9Sstevel@tonic-gate show_termiox(private_t *pri, long offset)
6837c478bd9Sstevel@tonic-gate {
6847c478bd9Sstevel@tonic-gate struct termiox termiox;
6857c478bd9Sstevel@tonic-gate int i;
6867c478bd9Sstevel@tonic-gate
6877c478bd9Sstevel@tonic-gate if (Pread(Proc, &termiox, sizeof (termiox), offset)
6887c478bd9Sstevel@tonic-gate == sizeof (termiox)) {
6897c478bd9Sstevel@tonic-gate (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
690019c3c43Sraf pri->pname,
691019c3c43Sraf termiox.x_hflag,
692019c3c43Sraf termiox.x_cflag,
693019c3c43Sraf termiox.x_rflag[0]);
6947c478bd9Sstevel@tonic-gate for (i = 1; i < NFF; i++)
6957c478bd9Sstevel@tonic-gate (void) printf(",0%.3o", termiox.x_rflag[i]);
6967c478bd9Sstevel@tonic-gate (void) printf(" sflag=0%.3o\n",
697019c3c43Sraf termiox.x_sflag);
6987c478bd9Sstevel@tonic-gate }
6997c478bd9Sstevel@tonic-gate }
7007c478bd9Sstevel@tonic-gate
7017c478bd9Sstevel@tonic-gate void
show_sgttyb(private_t * pri,long offset)7027c478bd9Sstevel@tonic-gate show_sgttyb(private_t *pri, long offset)
7037c478bd9Sstevel@tonic-gate {
7047c478bd9Sstevel@tonic-gate struct sgttyb sgttyb;
7057c478bd9Sstevel@tonic-gate
7067c478bd9Sstevel@tonic-gate if (Pread(Proc, &sgttyb, sizeof (sgttyb), offset) == sizeof (sgttyb)) {
7077c478bd9Sstevel@tonic-gate char erase[8];
7087c478bd9Sstevel@tonic-gate char kill[8];
7097c478bd9Sstevel@tonic-gate
7107c478bd9Sstevel@tonic-gate (void) printf(
7117c478bd9Sstevel@tonic-gate "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
712019c3c43Sraf pri->pname,
713019c3c43Sraf sgttyb.sg_ispeed&0xff,
714019c3c43Sraf sgttyb.sg_ospeed&0xff,
715019c3c43Sraf show_char(erase, sgttyb.sg_erase),
716019c3c43Sraf show_char(kill, sgttyb.sg_kill),
717019c3c43Sraf sgttyb.sg_flags);
7187c478bd9Sstevel@tonic-gate }
7197c478bd9Sstevel@tonic-gate }
7207c478bd9Sstevel@tonic-gate
7217c478bd9Sstevel@tonic-gate void
show_ltchars(private_t * pri,long offset)7227c478bd9Sstevel@tonic-gate show_ltchars(private_t *pri, long offset)
7237c478bd9Sstevel@tonic-gate {
7247c478bd9Sstevel@tonic-gate struct ltchars ltchars;
7257c478bd9Sstevel@tonic-gate char *p;
7267c478bd9Sstevel@tonic-gate char cbuf[8];
7277c478bd9Sstevel@tonic-gate int i;
7287c478bd9Sstevel@tonic-gate
7297c478bd9Sstevel@tonic-gate if (Pread(Proc, <chars, sizeof (ltchars), offset)
7307c478bd9Sstevel@tonic-gate == sizeof (ltchars)) {
7317c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname);
7327c478bd9Sstevel@tonic-gate for (p = (char *)<chars, i = 0; i < sizeof (ltchars); i++)
7337c478bd9Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++));
7347c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
7357c478bd9Sstevel@tonic-gate }
7367c478bd9Sstevel@tonic-gate }
7377c478bd9Sstevel@tonic-gate
7387c478bd9Sstevel@tonic-gate void
show_tchars(private_t * pri,long offset)7397c478bd9Sstevel@tonic-gate show_tchars(private_t *pri, long offset)
7407c478bd9Sstevel@tonic-gate {
7417c478bd9Sstevel@tonic-gate struct tchars tchars;
7427c478bd9Sstevel@tonic-gate char *p;
7437c478bd9Sstevel@tonic-gate char cbuf[8];
7447c478bd9Sstevel@tonic-gate int i;
7457c478bd9Sstevel@tonic-gate
7467c478bd9Sstevel@tonic-gate if (Pread(Proc, &tchars, sizeof (tchars), offset) == sizeof (tchars)) {
7477c478bd9Sstevel@tonic-gate (void) printf("%s\t cc: ", pri->pname);
7487c478bd9Sstevel@tonic-gate for (p = (char *)&tchars, i = 0; i < sizeof (tchars); i++)
7497c478bd9Sstevel@tonic-gate (void) printf(" %s", show_char(cbuf, (int)*p++));
7507c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
7517c478bd9Sstevel@tonic-gate }
7527c478bd9Sstevel@tonic-gate }
7537c478bd9Sstevel@tonic-gate
7547c478bd9Sstevel@tonic-gate void
show_termcb(private_t * pri,long offset)7557c478bd9Sstevel@tonic-gate show_termcb(private_t *pri, long offset)
7567c478bd9Sstevel@tonic-gate {
7577c478bd9Sstevel@tonic-gate struct termcb termcb;
7587c478bd9Sstevel@tonic-gate
7597c478bd9Sstevel@tonic-gate if (Pread(Proc, &termcb, sizeof (termcb), offset) == sizeof (termcb)) {
7607c478bd9Sstevel@tonic-gate (void) printf(
761019c3c43Sraf "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
762019c3c43Sraf pri->pname,
763019c3c43Sraf termcb.st_flgs&0xff,
764019c3c43Sraf termcb.st_termt&0xff,
765019c3c43Sraf termcb.st_crow&0xff,
766019c3c43Sraf termcb.st_ccol&0xff,
767019c3c43Sraf termcb.st_vrow&0xff,
768019c3c43Sraf termcb.st_lrow&0xff);
7697c478bd9Sstevel@tonic-gate }
7707c478bd9Sstevel@tonic-gate }
7717c478bd9Sstevel@tonic-gate
7727c478bd9Sstevel@tonic-gate /* integer value pointed to by ioctl() arg */
7737c478bd9Sstevel@tonic-gate void
show_strint(private_t * pri,int code,long offset)7747c478bd9Sstevel@tonic-gate show_strint(private_t *pri, int code, long offset)
7757c478bd9Sstevel@tonic-gate {
7767c478bd9Sstevel@tonic-gate int val;
7777c478bd9Sstevel@tonic-gate
7787c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
7797c478bd9Sstevel@tonic-gate const char *s = NULL;
7807c478bd9Sstevel@tonic-gate
7817c478bd9Sstevel@tonic-gate switch (code) { /* interpret these symbolically */
7827c478bd9Sstevel@tonic-gate case I_GRDOPT:
7837c478bd9Sstevel@tonic-gate s = strrdopt(val);
7847c478bd9Sstevel@tonic-gate break;
7857c478bd9Sstevel@tonic-gate case I_GETSIG:
7867c478bd9Sstevel@tonic-gate s = strevents(pri, val);
7877c478bd9Sstevel@tonic-gate break;
7887c478bd9Sstevel@tonic-gate case TIOCFLUSH:
7897c478bd9Sstevel@tonic-gate s = tiocflush(pri, val);
7907c478bd9Sstevel@tonic-gate break;
7917c478bd9Sstevel@tonic-gate }
7927c478bd9Sstevel@tonic-gate
7937c478bd9Sstevel@tonic-gate if (s == NULL)
7947c478bd9Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %d\n",
795019c3c43Sraf pri->pname, offset, val);
7967c478bd9Sstevel@tonic-gate else
7977c478bd9Sstevel@tonic-gate (void) printf("%s\t0x%.8lX: %s\n",
798019c3c43Sraf pri->pname, offset, s);
7997c478bd9Sstevel@tonic-gate }
8007c478bd9Sstevel@tonic-gate }
8017c478bd9Sstevel@tonic-gate
8027c478bd9Sstevel@tonic-gate void
show_strioctl(private_t * pri,long offset)8037c478bd9Sstevel@tonic-gate show_strioctl(private_t *pri, long offset)
8047c478bd9Sstevel@tonic-gate {
8057c478bd9Sstevel@tonic-gate struct strioctl strioctl;
8067c478bd9Sstevel@tonic-gate
8077c478bd9Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8087c478bd9Sstevel@tonic-gate sizeof (strioctl)) {
8097c478bd9Sstevel@tonic-gate (void) printf(
810019c3c43Sraf "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
811019c3c43Sraf pri->pname,
812019c3c43Sraf ioctlname(pri, strioctl.ic_cmd),
813019c3c43Sraf strioctl.ic_timout,
814019c3c43Sraf strioctl.ic_len,
815019c3c43Sraf (long)strioctl.ic_dp);
8167c478bd9Sstevel@tonic-gate
8177c478bd9Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */
8187c478bd9Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd,
819019c3c43Sraf (long)strioctl.ic_dp);
8207c478bd9Sstevel@tonic-gate --pri->recur;
8217c478bd9Sstevel@tonic-gate }
8227c478bd9Sstevel@tonic-gate }
8237c478bd9Sstevel@tonic-gate
8247c478bd9Sstevel@tonic-gate void
show_strioctl32(private_t * pri,long offset)8257c478bd9Sstevel@tonic-gate show_strioctl32(private_t *pri, long offset)
8267c478bd9Sstevel@tonic-gate {
8277c478bd9Sstevel@tonic-gate struct strioctl32 strioctl;
8287c478bd9Sstevel@tonic-gate
8297c478bd9Sstevel@tonic-gate if (Pread(Proc, &strioctl, sizeof (strioctl), offset) ==
8307c478bd9Sstevel@tonic-gate sizeof (strioctl)) {
8317c478bd9Sstevel@tonic-gate (void) printf(
832019c3c43Sraf "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
833019c3c43Sraf pri->pname,
834019c3c43Sraf ioctlname(pri, strioctl.ic_cmd),
835019c3c43Sraf strioctl.ic_timout,
836019c3c43Sraf strioctl.ic_len,
837019c3c43Sraf (long)strioctl.ic_dp);
8387c478bd9Sstevel@tonic-gate
8397c478bd9Sstevel@tonic-gate if (pri->recur++ == 0) /* avoid indefinite recursion */
8407c478bd9Sstevel@tonic-gate show_ioctl(pri, strioctl.ic_cmd,
841019c3c43Sraf (long)strioctl.ic_dp);
8427c478bd9Sstevel@tonic-gate --pri->recur;
8437c478bd9Sstevel@tonic-gate }
8447c478bd9Sstevel@tonic-gate }
8457c478bd9Sstevel@tonic-gate
8467c478bd9Sstevel@tonic-gate void
print_strbuf(private_t * pri,struct strbuf * sp,const char * name,int dump)8477c478bd9Sstevel@tonic-gate print_strbuf(private_t *pri, struct strbuf *sp, const char *name, int dump)
8487c478bd9Sstevel@tonic-gate {
8497c478bd9Sstevel@tonic-gate (void) printf(
850019c3c43Sraf "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
851019c3c43Sraf pri->pname,
852019c3c43Sraf name,
853019c3c43Sraf sp->maxlen,
854019c3c43Sraf sp->len,
855019c3c43Sraf (long)sp->buf);
8567c478bd9Sstevel@tonic-gate /*
8577c478bd9Sstevel@tonic-gate * Should we show the buffer contents?
8587c478bd9Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options?
8597c478bd9Sstevel@tonic-gate */
8607c478bd9Sstevel@tonic-gate if (sp->buf == NULL || sp->len <= 0)
8617c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
8627c478bd9Sstevel@tonic-gate else {
8637c478bd9Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len;
8647c478bd9Sstevel@tonic-gate char buffer[8];
8657c478bd9Sstevel@tonic-gate char obuf[40];
8667c478bd9Sstevel@tonic-gate
8677c478bd9Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
8687c478bd9Sstevel@tonic-gate (void) strcpy(obuf, ": \"");
8697c478bd9Sstevel@tonic-gate showbytes(buffer, nb, obuf+3);
8707c478bd9Sstevel@tonic-gate (void) strcat(obuf,
871019c3c43Sraf (nb == sp->len)?
872019c3c43Sraf (const char *)"\"" : (const char *)"\"..");
8737c478bd9Sstevel@tonic-gate (void) fputs(obuf, stdout);
8747c478bd9Sstevel@tonic-gate }
8757c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
8767c478bd9Sstevel@tonic-gate if (dump && sp->len > 8)
8777c478bd9Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len);
8787c478bd9Sstevel@tonic-gate }
8797c478bd9Sstevel@tonic-gate }
8807c478bd9Sstevel@tonic-gate
8817c478bd9Sstevel@tonic-gate void
print_strbuf32(private_t * pri,struct strbuf32 * sp,const char * name,int dump)8827c478bd9Sstevel@tonic-gate print_strbuf32(private_t *pri, struct strbuf32 *sp, const char *name, int dump)
8837c478bd9Sstevel@tonic-gate {
8847c478bd9Sstevel@tonic-gate (void) printf(
885019c3c43Sraf "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
886019c3c43Sraf pri->pname,
887019c3c43Sraf name,
888019c3c43Sraf sp->maxlen,
889019c3c43Sraf sp->len,
890019c3c43Sraf (long)sp->buf);
8917c478bd9Sstevel@tonic-gate /*
8927c478bd9Sstevel@tonic-gate * Should we show the buffer contents?
8937c478bd9Sstevel@tonic-gate * Keyed to the '-r fds' and '-w fds' options?
8947c478bd9Sstevel@tonic-gate */
895*27aa4812SToomas Soome if (sp->buf == 0 || sp->len <= 0)
8967c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
8977c478bd9Sstevel@tonic-gate else {
8987c478bd9Sstevel@tonic-gate int nb = (sp->len > 8)? 8 : sp->len;
8997c478bd9Sstevel@tonic-gate char buffer[8];
9007c478bd9Sstevel@tonic-gate char obuf[40];
9017c478bd9Sstevel@tonic-gate
9027c478bd9Sstevel@tonic-gate if (Pread(Proc, buffer, (size_t)nb, (long)sp->buf) == nb) {
9037c478bd9Sstevel@tonic-gate (void) strcpy(obuf, ": \"");
9047c478bd9Sstevel@tonic-gate showbytes(buffer, nb, obuf+3);
9057c478bd9Sstevel@tonic-gate (void) strcat(obuf,
906019c3c43Sraf (nb == sp->len)?
907019c3c43Sraf (const char *)"\"" : (const char *)"\"..");
9087c478bd9Sstevel@tonic-gate (void) fputs(obuf, stdout);
9097c478bd9Sstevel@tonic-gate }
9107c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
9117c478bd9Sstevel@tonic-gate if (dump && sp->len > 8)
9127c478bd9Sstevel@tonic-gate showbuffer(pri, (long)sp->buf, (long)sp->len);
9137c478bd9Sstevel@tonic-gate }
9147c478bd9Sstevel@tonic-gate }
9157c478bd9Sstevel@tonic-gate
9167c478bd9Sstevel@tonic-gate /* strpeek and strfdinsert flags word */
9177c478bd9Sstevel@tonic-gate const char *
strflags(private_t * pri,int flags)9187c478bd9Sstevel@tonic-gate strflags(private_t *pri, int flags)
9197c478bd9Sstevel@tonic-gate {
9207c478bd9Sstevel@tonic-gate const char *s;
9217c478bd9Sstevel@tonic-gate
9227c478bd9Sstevel@tonic-gate switch (flags) {
9237c478bd9Sstevel@tonic-gate case 0:
9247c478bd9Sstevel@tonic-gate s = "0";
9257c478bd9Sstevel@tonic-gate break;
9267c478bd9Sstevel@tonic-gate case RS_HIPRI:
9277c478bd9Sstevel@tonic-gate s = "RS_HIPRI";
9287c478bd9Sstevel@tonic-gate break;
9297c478bd9Sstevel@tonic-gate default:
9307c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "0x%.4X", flags);
9317c478bd9Sstevel@tonic-gate s = pri->code_buf;
9327c478bd9Sstevel@tonic-gate }
9337c478bd9Sstevel@tonic-gate
9347c478bd9Sstevel@tonic-gate return (s);
9357c478bd9Sstevel@tonic-gate }
9367c478bd9Sstevel@tonic-gate
9377c478bd9Sstevel@tonic-gate void
show_strpeek(private_t * pri,long offset)9387c478bd9Sstevel@tonic-gate show_strpeek(private_t *pri, long offset)
9397c478bd9Sstevel@tonic-gate {
9407c478bd9Sstevel@tonic-gate struct strpeek strpeek;
9417c478bd9Sstevel@tonic-gate
9427c478bd9Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9437c478bd9Sstevel@tonic-gate == sizeof (strpeek)) {
9447c478bd9Sstevel@tonic-gate
9457c478bd9Sstevel@tonic-gate print_strbuf(pri, &strpeek.ctlbuf, "ctl", FALSE);
9467c478bd9Sstevel@tonic-gate print_strbuf(pri, &strpeek.databuf, "dat", FALSE);
9477c478bd9Sstevel@tonic-gate
9487c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s\n",
949019c3c43Sraf pri->pname,
950019c3c43Sraf strflags(pri, strpeek.flags));
9517c478bd9Sstevel@tonic-gate }
9527c478bd9Sstevel@tonic-gate }
9537c478bd9Sstevel@tonic-gate
9547c478bd9Sstevel@tonic-gate void
show_strpeek32(private_t * pri,long offset)9557c478bd9Sstevel@tonic-gate show_strpeek32(private_t *pri, long offset)
9567c478bd9Sstevel@tonic-gate {
9577c478bd9Sstevel@tonic-gate struct strpeek32 strpeek;
9587c478bd9Sstevel@tonic-gate
9597c478bd9Sstevel@tonic-gate if (Pread(Proc, &strpeek, sizeof (strpeek), offset)
9607c478bd9Sstevel@tonic-gate == sizeof (strpeek)) {
9617c478bd9Sstevel@tonic-gate
9627c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strpeek.ctlbuf, "ctl", FALSE);
9637c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strpeek.databuf, "dat", FALSE);
9647c478bd9Sstevel@tonic-gate
9657c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s\n",
966019c3c43Sraf pri->pname,
967019c3c43Sraf strflags(pri, strpeek.flags));
9687c478bd9Sstevel@tonic-gate }
9697c478bd9Sstevel@tonic-gate }
9707c478bd9Sstevel@tonic-gate
9717c478bd9Sstevel@tonic-gate void
show_strfdinsert(private_t * pri,long offset)9727c478bd9Sstevel@tonic-gate show_strfdinsert(private_t *pri, long offset)
9737c478bd9Sstevel@tonic-gate {
9747c478bd9Sstevel@tonic-gate struct strfdinsert strfdinsert;
9757c478bd9Sstevel@tonic-gate
9767c478bd9Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
9777c478bd9Sstevel@tonic-gate sizeof (strfdinsert)) {
9787c478bd9Sstevel@tonic-gate
9797c478bd9Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
9807c478bd9Sstevel@tonic-gate print_strbuf(pri, &strfdinsert.databuf, "dat", FALSE);
9817c478bd9Sstevel@tonic-gate
9827c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
983019c3c43Sraf pri->pname,
984019c3c43Sraf strflags(pri, strfdinsert.flags),
985019c3c43Sraf strfdinsert.fildes,
986019c3c43Sraf strfdinsert.offset);
9877c478bd9Sstevel@tonic-gate }
9887c478bd9Sstevel@tonic-gate }
9897c478bd9Sstevel@tonic-gate
9907c478bd9Sstevel@tonic-gate void
show_strfdinsert32(private_t * pri,long offset)9917c478bd9Sstevel@tonic-gate show_strfdinsert32(private_t *pri, long offset)
9927c478bd9Sstevel@tonic-gate {
9937c478bd9Sstevel@tonic-gate struct strfdinsert32 strfdinsert;
9947c478bd9Sstevel@tonic-gate
9957c478bd9Sstevel@tonic-gate if (Pread(Proc, &strfdinsert, sizeof (strfdinsert), offset) ==
9967c478bd9Sstevel@tonic-gate sizeof (strfdinsert)) {
9977c478bd9Sstevel@tonic-gate
9987c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.ctlbuf, "ctl", FALSE);
9997c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strfdinsert.databuf, "dat", FALSE);
10007c478bd9Sstevel@tonic-gate
10017c478bd9Sstevel@tonic-gate (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
1002019c3c43Sraf pri->pname,
1003019c3c43Sraf strflags(pri, strfdinsert.flags),
1004019c3c43Sraf strfdinsert.fildes,
1005019c3c43Sraf strfdinsert.offset);
10067c478bd9Sstevel@tonic-gate }
10077c478bd9Sstevel@tonic-gate }
10087c478bd9Sstevel@tonic-gate
10097c478bd9Sstevel@tonic-gate void
show_strrecvfd(private_t * pri,long offset)10107c478bd9Sstevel@tonic-gate show_strrecvfd(private_t *pri, long offset)
10117c478bd9Sstevel@tonic-gate {
10127c478bd9Sstevel@tonic-gate struct strrecvfd strrecvfd;
10137c478bd9Sstevel@tonic-gate
10147c478bd9Sstevel@tonic-gate if (Pread(Proc, &strrecvfd, sizeof (strrecvfd), offset) ==
10157c478bd9Sstevel@tonic-gate sizeof (strrecvfd)) {
10167c478bd9Sstevel@tonic-gate (void) printf(
1017019c3c43Sraf "%s\tfd=%-5d uid=%-5u gid=%u\n",
1018019c3c43Sraf pri->pname,
1019019c3c43Sraf strrecvfd.fd,
1020019c3c43Sraf strrecvfd.uid,
1021019c3c43Sraf strrecvfd.gid);
10227c478bd9Sstevel@tonic-gate }
10237c478bd9Sstevel@tonic-gate }
10247c478bd9Sstevel@tonic-gate
10257c478bd9Sstevel@tonic-gate void
show_strlist(private_t * pri,long offset)10267c478bd9Sstevel@tonic-gate show_strlist(private_t *pri, long offset)
10277c478bd9Sstevel@tonic-gate {
10287c478bd9Sstevel@tonic-gate struct str_list strlist;
10297c478bd9Sstevel@tonic-gate struct str_mlist list;
10307c478bd9Sstevel@tonic-gate int count;
10317c478bd9Sstevel@tonic-gate
10327c478bd9Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10337c478bd9Sstevel@tonic-gate sizeof (strlist)) {
10347c478bd9Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1035019c3c43Sraf pri->pname,
1036019c3c43Sraf strlist.sl_nmods,
1037019c3c43Sraf (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",
1046019c3c43Sraf pri->pname,
1047019c3c43Sraf (int)sizeof (list.l_name),
1048019c3c43Sraf list.l_name);
10497c478bd9Sstevel@tonic-gate offset += sizeof (struct str_mlist);
10507c478bd9Sstevel@tonic-gate }
10517c478bd9Sstevel@tonic-gate }
10527c478bd9Sstevel@tonic-gate }
10537c478bd9Sstevel@tonic-gate
10547c478bd9Sstevel@tonic-gate void
show_strlist32(private_t * pri,long offset)10557c478bd9Sstevel@tonic-gate show_strlist32(private_t *pri, long offset)
10567c478bd9Sstevel@tonic-gate {
10577c478bd9Sstevel@tonic-gate struct str_list32 strlist;
10587c478bd9Sstevel@tonic-gate struct str_mlist list;
10597c478bd9Sstevel@tonic-gate int count;
10607c478bd9Sstevel@tonic-gate
10617c478bd9Sstevel@tonic-gate if (Pread(Proc, &strlist, sizeof (strlist), offset) ==
10627c478bd9Sstevel@tonic-gate sizeof (strlist)) {
10637c478bd9Sstevel@tonic-gate (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1064019c3c43Sraf pri->pname,
1065019c3c43Sraf strlist.sl_nmods,
1066019c3c43Sraf (long)strlist.sl_modlist);
10677c478bd9Sstevel@tonic-gate
10687c478bd9Sstevel@tonic-gate count = strlist.sl_nmods;
10697c478bd9Sstevel@tonic-gate offset = (long)strlist.sl_modlist;
10707c478bd9Sstevel@tonic-gate while (!interrupt && --count >= 0) {
10717c478bd9Sstevel@tonic-gate if (Pread(Proc, &list, sizeof (list), offset) !=
10727c478bd9Sstevel@tonic-gate sizeof (list))
10737c478bd9Sstevel@tonic-gate break;
10747c478bd9Sstevel@tonic-gate (void) printf("%s\t\t\"%.*s\"\n",
1075019c3c43Sraf pri->pname,
1076019c3c43Sraf (int)sizeof (list.l_name),
1077019c3c43Sraf list.l_name);
10787c478bd9Sstevel@tonic-gate offset += sizeof (struct str_mlist);
10797c478bd9Sstevel@tonic-gate }
10807c478bd9Sstevel@tonic-gate }
10817c478bd9Sstevel@tonic-gate }
10827c478bd9Sstevel@tonic-gate
10837c478bd9Sstevel@tonic-gate void
show_jwinsize(private_t * pri,long offset)10847c478bd9Sstevel@tonic-gate show_jwinsize(private_t *pri, long offset)
10857c478bd9Sstevel@tonic-gate {
10867c478bd9Sstevel@tonic-gate struct jwinsize jwinsize;
10877c478bd9Sstevel@tonic-gate
10887c478bd9Sstevel@tonic-gate if (Pread(Proc, &jwinsize, sizeof (jwinsize), offset) ==
10897c478bd9Sstevel@tonic-gate sizeof (jwinsize)) {
10907c478bd9Sstevel@tonic-gate (void) printf(
1091019c3c43Sraf "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1092019c3c43Sraf pri->pname,
1093019c3c43Sraf (unsigned)jwinsize.bytesx,
1094019c3c43Sraf (unsigned)jwinsize.bytesy,
1095019c3c43Sraf (unsigned)jwinsize.bitsx,
1096019c3c43Sraf (unsigned)jwinsize.bitsy);
10977c478bd9Sstevel@tonic-gate }
10987c478bd9Sstevel@tonic-gate }
10997c478bd9Sstevel@tonic-gate
11007c478bd9Sstevel@tonic-gate void
show_winsize(private_t * pri,long offset)11017c478bd9Sstevel@tonic-gate show_winsize(private_t *pri, long offset)
11027c478bd9Sstevel@tonic-gate {
11037c478bd9Sstevel@tonic-gate struct winsize winsize;
11047c478bd9Sstevel@tonic-gate
11057c478bd9Sstevel@tonic-gate if (Pread(Proc, &winsize, sizeof (winsize), offset)
11067c478bd9Sstevel@tonic-gate == sizeof (winsize)) {
11077c478bd9Sstevel@tonic-gate (void) printf(
1108019c3c43Sraf "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1109019c3c43Sraf pri->pname,
1110019c3c43Sraf winsize.ws_row,
1111019c3c43Sraf winsize.ws_col,
1112019c3c43Sraf winsize.ws_xpixel,
1113019c3c43Sraf winsize.ws_ypixel);
11147c478bd9Sstevel@tonic-gate }
11157c478bd9Sstevel@tonic-gate }
11167c478bd9Sstevel@tonic-gate
11177c478bd9Sstevel@tonic-gate struct audio_stuff {
11187c478bd9Sstevel@tonic-gate uint_t bit;
11197c478bd9Sstevel@tonic-gate const char *str;
11207c478bd9Sstevel@tonic-gate };
11217c478bd9Sstevel@tonic-gate
11227c478bd9Sstevel@tonic-gate const struct audio_stuff audio_output_ports[] = {
11237c478bd9Sstevel@tonic-gate { AUDIO_SPEAKER, "SPEAKER" },
11247c478bd9Sstevel@tonic-gate { AUDIO_HEADPHONE, "HEADPHONE" },
11257c478bd9Sstevel@tonic-gate { AUDIO_LINE_OUT, "LINE_OUT" },
11267c478bd9Sstevel@tonic-gate { AUDIO_SPDIF_OUT, "SPDIF_OUT" },
11277c478bd9Sstevel@tonic-gate { AUDIO_AUX1_OUT, "AUX1_OUT" },
11287c478bd9Sstevel@tonic-gate { AUDIO_AUX2_OUT, "AUX2_OUT" },
11297c478bd9Sstevel@tonic-gate { 0, NULL }
11307c478bd9Sstevel@tonic-gate };
11317c478bd9Sstevel@tonic-gate
11327c478bd9Sstevel@tonic-gate const struct audio_stuff audio_input_ports[] = {
11337c478bd9Sstevel@tonic-gate { AUDIO_MICROPHONE, "MICROPHONE" },
11347c478bd9Sstevel@tonic-gate { AUDIO_LINE_IN, "LINE_IN" },
11357c478bd9Sstevel@tonic-gate { AUDIO_CD, "CD" },
11367c478bd9Sstevel@tonic-gate { AUDIO_SPDIF_IN, "SPDIF_IN" },
11377c478bd9Sstevel@tonic-gate { AUDIO_AUX1_IN, "AUX1_IN" },
11387c478bd9Sstevel@tonic-gate { AUDIO_AUX2_IN, "AUX2_IN" },
11397c478bd9Sstevel@tonic-gate { AUDIO_CODEC_LOOPB_IN, "CODEC_LOOPB_IN" },
11407c478bd9Sstevel@tonic-gate { AUDIO_SUNVTS, "SUNVTS" },
11417c478bd9Sstevel@tonic-gate { 0, NULL }
11427c478bd9Sstevel@tonic-gate };
11437c478bd9Sstevel@tonic-gate
11447c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_hw_features[] = {
11457c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_DUPLEX, "DUPLEX" },
11467c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_MSCODEC, "MSCODEC" },
11477c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_IN2OUT, "IN2OUT" },
11487c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_PLAY, "PLAY" },
11497c478bd9Sstevel@tonic-gate { AUDIO_HWFEATURE_RECORD, "RECORD" },
11507c478bd9Sstevel@tonic-gate { 0, NULL }
11517c478bd9Sstevel@tonic-gate };
11527c478bd9Sstevel@tonic-gate
11537c478bd9Sstevel@tonic-gate static const struct audio_stuff audio_sw_features[] = {
11547c478bd9Sstevel@tonic-gate { AUDIO_SWFEATURE_MIXER, "MIXER" },
11557c478bd9Sstevel@tonic-gate { 0, NULL }
11567c478bd9Sstevel@tonic-gate };
11577c478bd9Sstevel@tonic-gate
11587c478bd9Sstevel@tonic-gate void
show_audio_features(const private_t * pri,const struct audio_stuff * audio_porttab,uint_t features,const char * name)11597c478bd9Sstevel@tonic-gate show_audio_features(const private_t *pri,
11600b09d754SToomas Soome const struct audio_stuff *audio_porttab, uint_t features,
11610b09d754SToomas Soome const char *name)
11627c478bd9Sstevel@tonic-gate {
11637c478bd9Sstevel@tonic-gate (void) printf("%s\t%s=", pri->pname, name);
11647c478bd9Sstevel@tonic-gate if (features == 0) {
11657c478bd9Sstevel@tonic-gate (void) printf("0\n");
11667c478bd9Sstevel@tonic-gate return;
11677c478bd9Sstevel@tonic-gate }
11687c478bd9Sstevel@tonic-gate
11697c478bd9Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) {
11707c478bd9Sstevel@tonic-gate if (features & audio_porttab->bit) {
11717c478bd9Sstevel@tonic-gate (void) printf(audio_porttab->str);
11727c478bd9Sstevel@tonic-gate features &= ~audio_porttab->bit;
11737c478bd9Sstevel@tonic-gate if (features)
11747c478bd9Sstevel@tonic-gate (void) putchar('|');
11757c478bd9Sstevel@tonic-gate }
11767c478bd9Sstevel@tonic-gate }
11777c478bd9Sstevel@tonic-gate if (features)
11787c478bd9Sstevel@tonic-gate (void) printf("0x%x", features);
11797c478bd9Sstevel@tonic-gate (void) putchar('\n');
11807c478bd9Sstevel@tonic-gate }
11817c478bd9Sstevel@tonic-gate
11827c478bd9Sstevel@tonic-gate void
show_audio_ports(private_t * pri,const char * mode,const char * field,uint_t ports)11837c478bd9Sstevel@tonic-gate show_audio_ports(private_t *pri, const char *mode,
11840b09d754SToomas Soome const char *field, uint_t ports)
11857c478bd9Sstevel@tonic-gate {
11867c478bd9Sstevel@tonic-gate const struct audio_stuff *audio_porttab;
11877c478bd9Sstevel@tonic-gate
11887c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\t%s=", pri->pname, mode, field);
11897c478bd9Sstevel@tonic-gate if (ports == 0) {
11907c478bd9Sstevel@tonic-gate (void) printf("0\n");
11917c478bd9Sstevel@tonic-gate return;
11927c478bd9Sstevel@tonic-gate }
11937c478bd9Sstevel@tonic-gate if (*mode == 'p')
11947c478bd9Sstevel@tonic-gate audio_porttab = audio_output_ports;
11957c478bd9Sstevel@tonic-gate else
11967c478bd9Sstevel@tonic-gate audio_porttab = audio_input_ports;
11977c478bd9Sstevel@tonic-gate for (; audio_porttab->bit != 0; ++audio_porttab) {
11987c478bd9Sstevel@tonic-gate if (ports & audio_porttab->bit) {
11997c478bd9Sstevel@tonic-gate (void) printf(audio_porttab->str);
12007c478bd9Sstevel@tonic-gate ports &= ~audio_porttab->bit;
12017c478bd9Sstevel@tonic-gate if (ports)
12027c478bd9Sstevel@tonic-gate (void) putchar('|');
12037c478bd9Sstevel@tonic-gate }
12047c478bd9Sstevel@tonic-gate }
12057c478bd9Sstevel@tonic-gate if (ports)
12067c478bd9Sstevel@tonic-gate (void) printf("0x%x", ports);
12077c478bd9Sstevel@tonic-gate (void) putchar('\n');
12087c478bd9Sstevel@tonic-gate }
12097c478bd9Sstevel@tonic-gate
12107c478bd9Sstevel@tonic-gate void
show_audio_prinfo(private_t * pri,const char * mode,struct audio_prinfo * au_pr)12117c478bd9Sstevel@tonic-gate show_audio_prinfo(private_t *pri, const char *mode, struct audio_prinfo *au_pr)
12127c478bd9Sstevel@tonic-gate {
12137c478bd9Sstevel@tonic-gate const char *s;
12147c478bd9Sstevel@tonic-gate
12157c478bd9Sstevel@tonic-gate /*
12167c478bd9Sstevel@tonic-gate * The following values describe the audio data encoding.
12177c478bd9Sstevel@tonic-gate */
12187c478bd9Sstevel@tonic-gate
12197c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1220019c3c43Sraf pri->pname, mode,
1221019c3c43Sraf au_pr->sample_rate,
1222019c3c43Sraf au_pr->channels,
1223019c3c43Sraf au_pr->precision);
12247c478bd9Sstevel@tonic-gate
12257c478bd9Sstevel@tonic-gate s = NULL;
12267c478bd9Sstevel@tonic-gate switch (au_pr->encoding) {
12277c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_NONE: s = "NONE"; break;
12287c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_ULAW: s = "ULAW"; break;
12297c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_ALAW: s = "ALAW"; break;
12307c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR: s = "LINEAR"; break;
12317c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_DVI: s = "DVI"; break;
12327c478bd9Sstevel@tonic-gate case AUDIO_ENCODING_LINEAR8: s = "LINEAR8"; break;
12337c478bd9Sstevel@tonic-gate }
12347c478bd9Sstevel@tonic-gate if (s)
12357c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%s\n", pri->pname, mode, s);
12367c478bd9Sstevel@tonic-gate else {
12377c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tencoding=%u\n",
1238019c3c43Sraf pri->pname, mode, au_pr->encoding);
12397c478bd9Sstevel@tonic-gate }
12407c478bd9Sstevel@tonic-gate
12417c478bd9Sstevel@tonic-gate /*
12427c478bd9Sstevel@tonic-gate * The following values control audio device configuration
12437c478bd9Sstevel@tonic-gate */
12447c478bd9Sstevel@tonic-gate
12457c478bd9Sstevel@tonic-gate (void) printf(
1246019c3c43Sraf "%s\t%s\tgain=%u buffer_size=%u\n",
1247019c3c43Sraf pri->pname, mode,
1248019c3c43Sraf au_pr->gain,
1249019c3c43Sraf au_pr->buffer_size);
12507c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "port", au_pr->port);
12517c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "avail_ports", au_pr->avail_ports);
12527c478bd9Sstevel@tonic-gate show_audio_ports(pri, mode, "mod_ports", au_pr->mod_ports);
12537c478bd9Sstevel@tonic-gate
12547c478bd9Sstevel@tonic-gate /*
12557c478bd9Sstevel@tonic-gate * The following values describe driver state
12567c478bd9Sstevel@tonic-gate */
12577c478bd9Sstevel@tonic-gate
12587c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1259019c3c43Sraf pri->pname, mode,
1260019c3c43Sraf au_pr->samples,
1261019c3c43Sraf au_pr->eof,
1262019c3c43Sraf au_pr->pause,
1263019c3c43Sraf au_pr->error);
12647c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1265019c3c43Sraf pri->pname, mode,
1266019c3c43Sraf au_pr->waiting,
1267019c3c43Sraf au_pr->balance,
1268019c3c43Sraf au_pr->minordev);
12697c478bd9Sstevel@tonic-gate
12707c478bd9Sstevel@tonic-gate /*
12717c478bd9Sstevel@tonic-gate * The following values are read-only state flags
12727c478bd9Sstevel@tonic-gate */
12737c478bd9Sstevel@tonic-gate (void) printf("%s\t%s\topen=%u active=%u\n",
1274019c3c43Sraf pri->pname, mode,
1275019c3c43Sraf au_pr->open,
1276019c3c43Sraf au_pr->active);
12777c478bd9Sstevel@tonic-gate }
12787c478bd9Sstevel@tonic-gate
12797c478bd9Sstevel@tonic-gate void
show_audio_info(private_t * pri,long offset)12807c478bd9Sstevel@tonic-gate show_audio_info(private_t *pri, long offset)
12817c478bd9Sstevel@tonic-gate {
12827c478bd9Sstevel@tonic-gate struct audio_info au;
12837c478bd9Sstevel@tonic-gate
12847c478bd9Sstevel@tonic-gate if (Pread(Proc, &au, sizeof (au), offset) == sizeof (au)) {
12857c478bd9Sstevel@tonic-gate show_audio_prinfo(pri, "play", &au.play);
12867c478bd9Sstevel@tonic-gate show_audio_prinfo(pri, "record", &au.record);
12877c478bd9Sstevel@tonic-gate (void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1288019c3c43Sraf pri->pname, au.monitor_gain, au.output_muted);
12897c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_hw_features, au.hw_features,
12907c478bd9Sstevel@tonic-gate "hw_features");
12917c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_sw_features, au.sw_features,
12927c478bd9Sstevel@tonic-gate "sw_features");
12937c478bd9Sstevel@tonic-gate show_audio_features(pri, audio_sw_features,
12947c478bd9Sstevel@tonic-gate au.sw_features_enabled, "sw_features_enabled");
12957c478bd9Sstevel@tonic-gate }
12967c478bd9Sstevel@tonic-gate }
12977c478bd9Sstevel@tonic-gate
12987c478bd9Sstevel@tonic-gate void
show_ioctl(private_t * pri,int code,long offset)12997c478bd9Sstevel@tonic-gate show_ioctl(private_t *pri, int code, long offset)
13007c478bd9Sstevel@tonic-gate {
13017c478bd9Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64);
13027c478bd9Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */
13037c478bd9Sstevel@tonic-gate /* for a failed system call */
13043b862e9aSRoger A. Faulkner if (offset == 0)
13057c478bd9Sstevel@tonic-gate return;
13067c478bd9Sstevel@tonic-gate
13077c478bd9Sstevel@tonic-gate switch (code) {
13087c478bd9Sstevel@tonic-gate case TCGETA:
13097c478bd9Sstevel@tonic-gate if (err)
13107c478bd9Sstevel@tonic-gate break;
13117c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13127c478bd9Sstevel@tonic-gate case TCSETA:
13137c478bd9Sstevel@tonic-gate case TCSETAW:
13147c478bd9Sstevel@tonic-gate case TCSETAF:
13157c478bd9Sstevel@tonic-gate show_termio(pri, offset);
13167c478bd9Sstevel@tonic-gate break;
13177c478bd9Sstevel@tonic-gate case TCGETS:
13187c478bd9Sstevel@tonic-gate if (err)
13197c478bd9Sstevel@tonic-gate break;
13207c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13217c478bd9Sstevel@tonic-gate case TCSETS:
13227c478bd9Sstevel@tonic-gate case TCSETSW:
13237c478bd9Sstevel@tonic-gate case TCSETSF:
13247c478bd9Sstevel@tonic-gate show_termios(pri, offset);
13257c478bd9Sstevel@tonic-gate break;
13267c478bd9Sstevel@tonic-gate case TCGETX:
13277c478bd9Sstevel@tonic-gate if (err)
13287c478bd9Sstevel@tonic-gate break;
13297c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13307c478bd9Sstevel@tonic-gate case TCSETX:
13317c478bd9Sstevel@tonic-gate case TCSETXW:
13327c478bd9Sstevel@tonic-gate case TCSETXF:
13337c478bd9Sstevel@tonic-gate show_termiox(pri, offset);
13347c478bd9Sstevel@tonic-gate break;
13357c478bd9Sstevel@tonic-gate case TIOCGETP:
13367c478bd9Sstevel@tonic-gate if (err)
13377c478bd9Sstevel@tonic-gate break;
13387c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13397c478bd9Sstevel@tonic-gate case TIOCSETN:
13407c478bd9Sstevel@tonic-gate case TIOCSETP:
13417c478bd9Sstevel@tonic-gate show_sgttyb(pri, offset);
13427c478bd9Sstevel@tonic-gate break;
13437c478bd9Sstevel@tonic-gate case TIOCGLTC:
13447c478bd9Sstevel@tonic-gate if (err)
13457c478bd9Sstevel@tonic-gate break;
13467c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13477c478bd9Sstevel@tonic-gate case TIOCSLTC:
13487c478bd9Sstevel@tonic-gate show_ltchars(pri, offset);
13497c478bd9Sstevel@tonic-gate break;
13507c478bd9Sstevel@tonic-gate case TIOCGETC:
13517c478bd9Sstevel@tonic-gate if (err)
13527c478bd9Sstevel@tonic-gate break;
13537c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13547c478bd9Sstevel@tonic-gate case TIOCSETC:
13557c478bd9Sstevel@tonic-gate show_tchars(pri, offset);
13567c478bd9Sstevel@tonic-gate break;
13577c478bd9Sstevel@tonic-gate case LDGETT:
13587c478bd9Sstevel@tonic-gate if (err)
13597c478bd9Sstevel@tonic-gate break;
13607c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13617c478bd9Sstevel@tonic-gate case LDSETT:
13627c478bd9Sstevel@tonic-gate show_termcb(pri, offset);
13637c478bd9Sstevel@tonic-gate break;
13647c478bd9Sstevel@tonic-gate /* streams ioctl()s */
13657c478bd9Sstevel@tonic-gate #if 0
13667c478bd9Sstevel@tonic-gate /* these are displayed as strings in the arg list */
13677c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */
13687c478bd9Sstevel@tonic-gate case I_PUSH:
13697c478bd9Sstevel@tonic-gate case I_LOOK:
13707c478bd9Sstevel@tonic-gate case I_FIND:
13717c478bd9Sstevel@tonic-gate /* these are displayed as decimal in the arg list */
13727c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */
13737c478bd9Sstevel@tonic-gate case I_LINK:
13747c478bd9Sstevel@tonic-gate case I_UNLINK:
13757c478bd9Sstevel@tonic-gate case I_SENDFD:
13767c478bd9Sstevel@tonic-gate /* these are displayed symbolically in the arg list */
13777c478bd9Sstevel@tonic-gate /* by prt_ioa(). don't display them again here */
13787c478bd9Sstevel@tonic-gate case I_SRDOPT:
13797c478bd9Sstevel@tonic-gate case I_SETSIG:
13807c478bd9Sstevel@tonic-gate case I_FLUSH:
13817c478bd9Sstevel@tonic-gate break;
13827c478bd9Sstevel@tonic-gate /* this one just ignores the argument */
13837c478bd9Sstevel@tonic-gate case I_POP:
13847c478bd9Sstevel@tonic-gate break;
13857c478bd9Sstevel@tonic-gate #endif
13867c478bd9Sstevel@tonic-gate /* these return something in an int pointed to by arg */
13877c478bd9Sstevel@tonic-gate case I_NREAD:
13887c478bd9Sstevel@tonic-gate case I_GRDOPT:
13897c478bd9Sstevel@tonic-gate case I_GETSIG:
13907c478bd9Sstevel@tonic-gate case TIOCGSID:
13917c478bd9Sstevel@tonic-gate case TIOCGPGRP:
13927c478bd9Sstevel@tonic-gate case TIOCLGET:
13937c478bd9Sstevel@tonic-gate case FIONREAD:
13947c478bd9Sstevel@tonic-gate case FIORDCHK:
13957c478bd9Sstevel@tonic-gate if (err)
13967c478bd9Sstevel@tonic-gate break;
13977c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
13987c478bd9Sstevel@tonic-gate /* these pass something in an int pointed to by arg */
13997c478bd9Sstevel@tonic-gate case TIOCSPGRP:
14007c478bd9Sstevel@tonic-gate case TIOCFLUSH:
14017c478bd9Sstevel@tonic-gate case TIOCLBIS:
14027c478bd9Sstevel@tonic-gate case TIOCLBIC:
14037c478bd9Sstevel@tonic-gate case TIOCLSET:
14047c478bd9Sstevel@tonic-gate show_strint(pri, code, offset);
14057c478bd9Sstevel@tonic-gate break;
14067c478bd9Sstevel@tonic-gate /* these all point to structures */
14077c478bd9Sstevel@tonic-gate case I_STR:
14087c478bd9Sstevel@tonic-gate if (lp64)
14097c478bd9Sstevel@tonic-gate show_strioctl(pri, offset);
14107c478bd9Sstevel@tonic-gate else
14117c478bd9Sstevel@tonic-gate show_strioctl32(pri, offset);
14127c478bd9Sstevel@tonic-gate break;
14137c478bd9Sstevel@tonic-gate case I_PEEK:
14147c478bd9Sstevel@tonic-gate if (lp64)
14157c478bd9Sstevel@tonic-gate show_strpeek(pri, offset);
14167c478bd9Sstevel@tonic-gate else
14177c478bd9Sstevel@tonic-gate show_strpeek32(pri, offset);
14187c478bd9Sstevel@tonic-gate break;
14197c478bd9Sstevel@tonic-gate case I_FDINSERT:
14207c478bd9Sstevel@tonic-gate if (lp64)
14217c478bd9Sstevel@tonic-gate show_strfdinsert(pri, offset);
14227c478bd9Sstevel@tonic-gate else
14237c478bd9Sstevel@tonic-gate show_strfdinsert32(pri, offset);
14247c478bd9Sstevel@tonic-gate break;
14257c478bd9Sstevel@tonic-gate case I_RECVFD:
14267c478bd9Sstevel@tonic-gate if (err)
14277c478bd9Sstevel@tonic-gate break;
14287c478bd9Sstevel@tonic-gate show_strrecvfd(pri, offset);
14297c478bd9Sstevel@tonic-gate break;
14307c478bd9Sstevel@tonic-gate case I_LIST:
14317c478bd9Sstevel@tonic-gate if (err)
14327c478bd9Sstevel@tonic-gate break;
14337c478bd9Sstevel@tonic-gate if (lp64)
14347c478bd9Sstevel@tonic-gate show_strlist(pri, offset);
14357c478bd9Sstevel@tonic-gate else
14367c478bd9Sstevel@tonic-gate show_strlist32(pri, offset);
14377c478bd9Sstevel@tonic-gate break;
14387c478bd9Sstevel@tonic-gate case JWINSIZE:
14397c478bd9Sstevel@tonic-gate if (err)
14407c478bd9Sstevel@tonic-gate break;
14417c478bd9Sstevel@tonic-gate show_jwinsize(pri, offset);
14427c478bd9Sstevel@tonic-gate break;
14437c478bd9Sstevel@tonic-gate case TIOCGWINSZ:
14447c478bd9Sstevel@tonic-gate if (err)
14457c478bd9Sstevel@tonic-gate break;
14467c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
14477c478bd9Sstevel@tonic-gate case TIOCSWINSZ:
14487c478bd9Sstevel@tonic-gate show_winsize(pri, offset);
14497c478bd9Sstevel@tonic-gate break;
14507c478bd9Sstevel@tonic-gate case AUDIO_GETINFO:
14517c478bd9Sstevel@tonic-gate case (int)AUDIO_SETINFO:
14527c478bd9Sstevel@tonic-gate show_audio_info(pri, offset);
14537c478bd9Sstevel@tonic-gate break;
14547c478bd9Sstevel@tonic-gate
14557c478bd9Sstevel@tonic-gate default:
1456a803cc21SGordon Ross if ((code & ~0xff) == ZFS_IOC) {
1457a803cc21SGordon Ross show_zfs_ioc(pri, offset);
1458a803cc21SGordon Ross break;
1459a803cc21SGordon Ross }
1460a803cc21SGordon Ross
14617c478bd9Sstevel@tonic-gate if (code & IOC_INOUT) {
14627c478bd9Sstevel@tonic-gate const char *str = ioctldatastruct(code);
14637c478bd9Sstevel@tonic-gate
14647c478bd9Sstevel@tonic-gate (void) printf("\t\t%s",
14657c478bd9Sstevel@tonic-gate (code & IOC_INOUT) == IOC_INOUT ? "write/read" :
14667c478bd9Sstevel@tonic-gate code & IOC_IN ? "write" : "read");
14677c478bd9Sstevel@tonic-gate if (str != NULL) {
14687c478bd9Sstevel@tonic-gate (void) printf(" (struct %s)\n", str);
14697c478bd9Sstevel@tonic-gate } else {
14707c478bd9Sstevel@tonic-gate (void) printf(" %d bytes\n",
14717c478bd9Sstevel@tonic-gate (code >> 16) & IOCPARM_MASK);
14727c478bd9Sstevel@tonic-gate }
14737c478bd9Sstevel@tonic-gate }
14747c478bd9Sstevel@tonic-gate }
14757c478bd9Sstevel@tonic-gate }
14767c478bd9Sstevel@tonic-gate
14777c478bd9Sstevel@tonic-gate void
show_statvfs(private_t * pri)14787c478bd9Sstevel@tonic-gate show_statvfs(private_t *pri)
14797c478bd9Sstevel@tonic-gate {
14807c478bd9Sstevel@tonic-gate long offset;
14817c478bd9Sstevel@tonic-gate struct statvfs statvfs;
14827c478bd9Sstevel@tonic-gate char *cp;
14837c478bd9Sstevel@tonic-gate
1484*27aa4812SToomas Soome if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
14857c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset)
14867c478bd9Sstevel@tonic-gate == sizeof (statvfs)) {
14877c478bd9Sstevel@tonic-gate (void) printf(
14887c478bd9Sstevel@tonic-gate "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1489019c3c43Sraf pri->pname,
1490019c3c43Sraf statvfs.f_bsize,
1491019c3c43Sraf statvfs.f_frsize,
1492019c3c43Sraf (u_longlong_t)statvfs.f_blocks,
1493019c3c43Sraf (u_longlong_t)statvfs.f_bfree);
14947c478bd9Sstevel@tonic-gate (void) printf(
14957c478bd9Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1496019c3c43Sraf pri->pname,
1497019c3c43Sraf (u_longlong_t)statvfs.f_bavail,
1498019c3c43Sraf (u_longlong_t)statvfs.f_files,
1499019c3c43Sraf (u_longlong_t)statvfs.f_ffree,
1500019c3c43Sraf (u_longlong_t)statvfs.f_favail);
15017c478bd9Sstevel@tonic-gate (void) printf(
1502019c3c43Sraf "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1503019c3c43Sraf pri->pname,
1504019c3c43Sraf statvfs.f_fsid,
1505019c3c43Sraf statvfs.f_basetype,
1506019c3c43Sraf (long)statvfs.f_namemax);
15077c478bd9Sstevel@tonic-gate (void) printf(
1508019c3c43Sraf "%s\tflag=%s\n",
1509019c3c43Sraf pri->pname,
1510019c3c43Sraf svfsflags(pri, (ulong_t)statvfs.f_flag));
15117c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15127c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15137c478bd9Sstevel@tonic-gate *(cp+1) != '\0')
15147c478bd9Sstevel@tonic-gate *cp = ' ';
15157c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n",
1516019c3c43Sraf pri->pname,
1517019c3c43Sraf (int)sizeof (statvfs.f_fstr),
1518019c3c43Sraf statvfs.f_fstr);
15197c478bd9Sstevel@tonic-gate }
15207c478bd9Sstevel@tonic-gate }
15217c478bd9Sstevel@tonic-gate
15227c478bd9Sstevel@tonic-gate void
show_statvfs32(private_t * pri)15237c478bd9Sstevel@tonic-gate show_statvfs32(private_t *pri)
15247c478bd9Sstevel@tonic-gate {
15257c478bd9Sstevel@tonic-gate long offset;
15267c478bd9Sstevel@tonic-gate struct statvfs32 statvfs;
15277c478bd9Sstevel@tonic-gate char *cp;
15287c478bd9Sstevel@tonic-gate
1529*27aa4812SToomas Soome if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15307c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset)
15317c478bd9Sstevel@tonic-gate == sizeof (statvfs)) {
15327c478bd9Sstevel@tonic-gate (void) printf(
1533019c3c43Sraf "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1534019c3c43Sraf pri->pname,
1535019c3c43Sraf statvfs.f_bsize,
1536019c3c43Sraf statvfs.f_frsize,
1537019c3c43Sraf statvfs.f_blocks,
1538019c3c43Sraf statvfs.f_bfree);
15397c478bd9Sstevel@tonic-gate (void) printf(
1540019c3c43Sraf "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1541019c3c43Sraf pri->pname,
1542019c3c43Sraf statvfs.f_bavail,
1543019c3c43Sraf statvfs.f_files,
1544019c3c43Sraf statvfs.f_ffree,
1545019c3c43Sraf statvfs.f_favail);
15467c478bd9Sstevel@tonic-gate (void) printf(
1547019c3c43Sraf "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1548019c3c43Sraf pri->pname,
1549019c3c43Sraf statvfs.f_fsid,
1550019c3c43Sraf statvfs.f_basetype,
1551019c3c43Sraf (int)statvfs.f_namemax);
15527c478bd9Sstevel@tonic-gate (void) printf(
1553019c3c43Sraf "%s\tflag=%s\n",
1554019c3c43Sraf pri->pname,
1555019c3c43Sraf svfsflags(pri, (ulong_t)statvfs.f_flag));
15567c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
15577c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
15587c478bd9Sstevel@tonic-gate *(cp+1) != '\0')
15597c478bd9Sstevel@tonic-gate *cp = ' ';
15607c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n",
1561019c3c43Sraf pri->pname,
1562019c3c43Sraf (int)sizeof (statvfs.f_fstr),
1563019c3c43Sraf statvfs.f_fstr);
15647c478bd9Sstevel@tonic-gate }
15657c478bd9Sstevel@tonic-gate }
15667c478bd9Sstevel@tonic-gate
15677c478bd9Sstevel@tonic-gate void
show_statvfs64(private_t * pri)15687c478bd9Sstevel@tonic-gate show_statvfs64(private_t *pri)
15697c478bd9Sstevel@tonic-gate {
15707c478bd9Sstevel@tonic-gate long offset;
15717c478bd9Sstevel@tonic-gate struct statvfs64_32 statvfs;
15727c478bd9Sstevel@tonic-gate char *cp;
15737c478bd9Sstevel@tonic-gate
1574*27aa4812SToomas Soome if (pri->sys_nargs > 1 && (offset = pri->sys_args[1]) != 0 &&
15757c478bd9Sstevel@tonic-gate Pread(Proc, &statvfs, sizeof (statvfs), offset)
15767c478bd9Sstevel@tonic-gate == sizeof (statvfs)) {
15777c478bd9Sstevel@tonic-gate (void) printf(
1578019c3c43Sraf "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1579019c3c43Sraf pri->pname,
1580019c3c43Sraf statvfs.f_bsize,
1581019c3c43Sraf statvfs.f_frsize,
1582019c3c43Sraf (u_longlong_t)statvfs.f_blocks,
1583019c3c43Sraf (u_longlong_t)statvfs.f_bfree);
15847c478bd9Sstevel@tonic-gate (void) printf(
15857c478bd9Sstevel@tonic-gate "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1586019c3c43Sraf pri->pname,
1587019c3c43Sraf (u_longlong_t)statvfs.f_bavail,
1588019c3c43Sraf (u_longlong_t)statvfs.f_files,
1589019c3c43Sraf (u_longlong_t)statvfs.f_ffree,
1590019c3c43Sraf (u_longlong_t)statvfs.f_favail);
15917c478bd9Sstevel@tonic-gate (void) printf(
1592019c3c43Sraf "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1593019c3c43Sraf pri->pname,
1594019c3c43Sraf statvfs.f_fsid,
1595019c3c43Sraf statvfs.f_basetype,
1596019c3c43Sraf (int)statvfs.f_namemax);
15977c478bd9Sstevel@tonic-gate (void) printf(
1598019c3c43Sraf "%s\tflag=%s\n",
1599019c3c43Sraf pri->pname,
1600019c3c43Sraf svfsflags(pri, (ulong_t)statvfs.f_flag));
16017c478bd9Sstevel@tonic-gate cp = statvfs.f_fstr + strlen(statvfs.f_fstr);
16027c478bd9Sstevel@tonic-gate if (cp < statvfs.f_fstr + sizeof (statvfs.f_fstr) - 1 &&
16037c478bd9Sstevel@tonic-gate *(cp+1) != '\0')
16047c478bd9Sstevel@tonic-gate *cp = ' ';
16057c478bd9Sstevel@tonic-gate (void) printf("%s\tfstr=\"%.*s\"\n",
1606019c3c43Sraf pri->pname,
1607019c3c43Sraf (int)sizeof (statvfs.f_fstr),
1608019c3c43Sraf statvfs.f_fstr);
16097c478bd9Sstevel@tonic-gate }
16107c478bd9Sstevel@tonic-gate }
16117c478bd9Sstevel@tonic-gate
16127c478bd9Sstevel@tonic-gate void
show_statfs(private_t * pri)16137c478bd9Sstevel@tonic-gate show_statfs(private_t *pri)
16147c478bd9Sstevel@tonic-gate {
16157c478bd9Sstevel@tonic-gate long offset;
16167c478bd9Sstevel@tonic-gate struct statfs statfs;
16177c478bd9Sstevel@tonic-gate
1618*27aa4812SToomas Soome if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16197c478bd9Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16207c478bd9Sstevel@tonic-gate (void) printf(
16217c478bd9Sstevel@tonic-gate "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1622019c3c43Sraf pri->pname,
1623019c3c43Sraf statfs.f_fstyp,
1624019c3c43Sraf statfs.f_bsize,
1625019c3c43Sraf statfs.f_frsize,
1626019c3c43Sraf statfs.f_blocks,
1627019c3c43Sraf statfs.f_bfree,
1628019c3c43Sraf statfs.f_files,
1629019c3c43Sraf statfs.f_ffree);
16307c478bd9Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1631019c3c43Sraf pri->pname,
1632019c3c43Sraf statfs.f_fname,
1633019c3c43Sraf statfs.f_fpack);
16347c478bd9Sstevel@tonic-gate }
16357c478bd9Sstevel@tonic-gate }
16367c478bd9Sstevel@tonic-gate
16377c478bd9Sstevel@tonic-gate void
show_statfs32(private_t * pri)16387c478bd9Sstevel@tonic-gate show_statfs32(private_t *pri)
16397c478bd9Sstevel@tonic-gate {
16407c478bd9Sstevel@tonic-gate long offset;
16417c478bd9Sstevel@tonic-gate struct statfs32 statfs;
16427c478bd9Sstevel@tonic-gate
1643*27aa4812SToomas Soome if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0 &&
16447c478bd9Sstevel@tonic-gate Pread(Proc, &statfs, sizeof (statfs), offset) == sizeof (statfs)) {
16457c478bd9Sstevel@tonic-gate (void) printf(
1646019c3c43Sraf "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1647019c3c43Sraf pri->pname,
1648019c3c43Sraf statfs.f_fstyp,
1649019c3c43Sraf statfs.f_bsize,
1650019c3c43Sraf statfs.f_frsize,
1651019c3c43Sraf statfs.f_blocks,
1652019c3c43Sraf statfs.f_bfree,
1653019c3c43Sraf statfs.f_files,
1654019c3c43Sraf statfs.f_ffree);
16557c478bd9Sstevel@tonic-gate (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1656019c3c43Sraf pri->pname,
1657019c3c43Sraf statfs.f_fname,
1658019c3c43Sraf statfs.f_fpack);
16597c478bd9Sstevel@tonic-gate }
16607c478bd9Sstevel@tonic-gate }
16617c478bd9Sstevel@tonic-gate
16627c478bd9Sstevel@tonic-gate void
show_flock32(private_t * pri,long offset)16637c478bd9Sstevel@tonic-gate show_flock32(private_t *pri, long offset)
16647c478bd9Sstevel@tonic-gate {
16657c478bd9Sstevel@tonic-gate struct flock32 flock;
16667c478bd9Sstevel@tonic-gate
16677c478bd9Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
16687c478bd9Sstevel@tonic-gate const char *str = NULL;
16697c478bd9Sstevel@tonic-gate
16707c478bd9Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname);
16717c478bd9Sstevel@tonic-gate
16727c478bd9Sstevel@tonic-gate switch (flock.l_type) {
16737c478bd9Sstevel@tonic-gate case F_RDLCK:
16747c478bd9Sstevel@tonic-gate str = "F_RDLCK";
16757c478bd9Sstevel@tonic-gate break;
16767c478bd9Sstevel@tonic-gate case F_WRLCK:
16777c478bd9Sstevel@tonic-gate str = "F_WRLCK";
16787c478bd9Sstevel@tonic-gate break;
16797c478bd9Sstevel@tonic-gate case F_UNLCK:
16807c478bd9Sstevel@tonic-gate str = "F_UNLCK";
16817c478bd9Sstevel@tonic-gate break;
16827c478bd9Sstevel@tonic-gate }
16837c478bd9Sstevel@tonic-gate if (str != NULL)
16847c478bd9Sstevel@tonic-gate (void) printf("%s", str);
16857c478bd9Sstevel@tonic-gate else
16867c478bd9Sstevel@tonic-gate (void) printf("%-7d", flock.l_type);
16877c478bd9Sstevel@tonic-gate
16887c478bd9Sstevel@tonic-gate str = whencearg(flock.l_whence);
16897c478bd9Sstevel@tonic-gate if (str != NULL)
16907c478bd9Sstevel@tonic-gate (void) printf(" whence=%s", str);
16917c478bd9Sstevel@tonic-gate else
16927c478bd9Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence);
16937c478bd9Sstevel@tonic-gate
16947c478bd9Sstevel@tonic-gate (void) printf(
1695019c3c43Sraf " start=%-5d len=%-5d sys=%-2u pid=%d\n",
1696019c3c43Sraf flock.l_start,
1697019c3c43Sraf flock.l_len,
1698019c3c43Sraf flock.l_sysid,
1699019c3c43Sraf flock.l_pid);
17007c478bd9Sstevel@tonic-gate }
17017c478bd9Sstevel@tonic-gate }
17027c478bd9Sstevel@tonic-gate
17037c478bd9Sstevel@tonic-gate void
show_flock64(private_t * pri,long offset)17047c478bd9Sstevel@tonic-gate show_flock64(private_t *pri, long offset)
17057c478bd9Sstevel@tonic-gate {
17067c478bd9Sstevel@tonic-gate struct flock64 flock;
17077c478bd9Sstevel@tonic-gate
17087c478bd9Sstevel@tonic-gate if (Pread(Proc, &flock, sizeof (flock), offset) == sizeof (flock)) {
17097c478bd9Sstevel@tonic-gate const char *str = NULL;
17107c478bd9Sstevel@tonic-gate
17117c478bd9Sstevel@tonic-gate (void) printf("%s\ttyp=", pri->pname);
17127c478bd9Sstevel@tonic-gate
17137c478bd9Sstevel@tonic-gate switch (flock.l_type) {
17147c478bd9Sstevel@tonic-gate case F_RDLCK:
17157c478bd9Sstevel@tonic-gate str = "F_RDLCK";
17167c478bd9Sstevel@tonic-gate break;
17177c478bd9Sstevel@tonic-gate case F_WRLCK:
17187c478bd9Sstevel@tonic-gate str = "F_WRLCK";
17197c478bd9Sstevel@tonic-gate break;
17207c478bd9Sstevel@tonic-gate case F_UNLCK:
17217c478bd9Sstevel@tonic-gate str = "F_UNLCK";
17227c478bd9Sstevel@tonic-gate break;
17237c478bd9Sstevel@tonic-gate }
17247c478bd9Sstevel@tonic-gate if (str != NULL)
17257c478bd9Sstevel@tonic-gate (void) printf("%s", str);
17267c478bd9Sstevel@tonic-gate else
17277c478bd9Sstevel@tonic-gate (void) printf("%-7d", flock.l_type);
17287c478bd9Sstevel@tonic-gate
17297c478bd9Sstevel@tonic-gate str = whencearg(flock.l_whence);
17307c478bd9Sstevel@tonic-gate if (str != NULL)
17317c478bd9Sstevel@tonic-gate (void) printf(" whence=%s", str);
17327c478bd9Sstevel@tonic-gate else
17337c478bd9Sstevel@tonic-gate (void) printf(" whence=%-8u", flock.l_whence);
17347c478bd9Sstevel@tonic-gate
17357c478bd9Sstevel@tonic-gate (void) printf(
1736019c3c43Sraf " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1737019c3c43Sraf (long long)flock.l_start,
1738019c3c43Sraf (long long)flock.l_len,
1739019c3c43Sraf flock.l_sysid,
1740019c3c43Sraf (int)flock.l_pid);
17417c478bd9Sstevel@tonic-gate }
17427c478bd9Sstevel@tonic-gate }
17437c478bd9Sstevel@tonic-gate
17447c478bd9Sstevel@tonic-gate void
show_share(private_t * pri,long offset)17457c478bd9Sstevel@tonic-gate show_share(private_t *pri, long offset)
17467c478bd9Sstevel@tonic-gate {
17477c478bd9Sstevel@tonic-gate struct fshare fshare;
17487c478bd9Sstevel@tonic-gate
17497c478bd9Sstevel@tonic-gate if (Pread(Proc, &fshare, sizeof (fshare), offset) == sizeof (fshare)) {
17507c478bd9Sstevel@tonic-gate const char *str = NULL;
17517c478bd9Sstevel@tonic-gate int manddny = 0;
17527c478bd9Sstevel@tonic-gate
17537c478bd9Sstevel@tonic-gate (void) printf("%s\taccess=", pri->pname);
17547c478bd9Sstevel@tonic-gate
17557c478bd9Sstevel@tonic-gate switch (fshare.f_access) {
17567c478bd9Sstevel@tonic-gate case F_RDACC:
17577c478bd9Sstevel@tonic-gate str = "F_RDACC";
17587c478bd9Sstevel@tonic-gate break;
17597c478bd9Sstevel@tonic-gate case F_WRACC:
17607c478bd9Sstevel@tonic-gate str = "F_WRACC";
17617c478bd9Sstevel@tonic-gate break;
17627c478bd9Sstevel@tonic-gate case F_RWACC:
17637c478bd9Sstevel@tonic-gate str = "F_RWACC";
17647c478bd9Sstevel@tonic-gate break;
17657c478bd9Sstevel@tonic-gate }
17667c478bd9Sstevel@tonic-gate if (str != NULL)
17677c478bd9Sstevel@tonic-gate (void) printf("%s", str);
17687c478bd9Sstevel@tonic-gate else
17697c478bd9Sstevel@tonic-gate (void) printf("%-7d", fshare.f_access);
17707c478bd9Sstevel@tonic-gate
17717c478bd9Sstevel@tonic-gate str = NULL;
17727c478bd9Sstevel@tonic-gate if (fshare.f_deny & F_MANDDNY) {
17737c478bd9Sstevel@tonic-gate fshare.f_deny &= ~F_MANDDNY;
17747c478bd9Sstevel@tonic-gate manddny = 1;
17757c478bd9Sstevel@tonic-gate }
17767c478bd9Sstevel@tonic-gate switch (fshare.f_deny) {
17777c478bd9Sstevel@tonic-gate case F_NODNY:
17787c478bd9Sstevel@tonic-gate str = "F_NODNY";
17797c478bd9Sstevel@tonic-gate break;
17807c478bd9Sstevel@tonic-gate case F_RDDNY:
17817c478bd9Sstevel@tonic-gate str = "F_RDDNY";
17827c478bd9Sstevel@tonic-gate break;
17837c478bd9Sstevel@tonic-gate case F_WRDNY:
17847c478bd9Sstevel@tonic-gate str = "F_WRDNY";
17857c478bd9Sstevel@tonic-gate break;
17867c478bd9Sstevel@tonic-gate case F_RWDNY:
17877c478bd9Sstevel@tonic-gate str = "F_RWDNY";
17887c478bd9Sstevel@tonic-gate break;
17897c478bd9Sstevel@tonic-gate case F_COMPAT:
17907c478bd9Sstevel@tonic-gate str = "F_COMPAT";
17917c478bd9Sstevel@tonic-gate break;
17927c478bd9Sstevel@tonic-gate }
17937c478bd9Sstevel@tonic-gate if (str != NULL) {
17947c478bd9Sstevel@tonic-gate if (manddny)
17957c478bd9Sstevel@tonic-gate (void) printf(" deny=F_MANDDNY|%s", str);
17967c478bd9Sstevel@tonic-gate else
17977c478bd9Sstevel@tonic-gate (void) printf(" deny=%s", str);
17987c478bd9Sstevel@tonic-gate } else {
17997c478bd9Sstevel@tonic-gate (void) printf(" deny=0x%x", manddny?
1800019c3c43Sraf fshare.f_deny | F_MANDDNY : fshare.f_deny);
18017c478bd9Sstevel@tonic-gate }
18027c478bd9Sstevel@tonic-gate
18037c478bd9Sstevel@tonic-gate (void) printf(" id=%x\n", fshare.f_id);
18047c478bd9Sstevel@tonic-gate }
18057c478bd9Sstevel@tonic-gate }
18067c478bd9Sstevel@tonic-gate
18077c478bd9Sstevel@tonic-gate void
show_ffg(private_t * pri)18087c478bd9Sstevel@tonic-gate show_ffg(private_t *pri)
18097c478bd9Sstevel@tonic-gate {
18107c478bd9Sstevel@tonic-gate (void) putchar('\t');
18117c478bd9Sstevel@tonic-gate (void) putchar('\t');
18127c478bd9Sstevel@tonic-gate prt_ffg(pri, 0, pri->Rval1);
18137c478bd9Sstevel@tonic-gate (void) puts(pri->sys_string);
18147c478bd9Sstevel@tonic-gate }
18157c478bd9Sstevel@tonic-gate
18167c478bd9Sstevel@tonic-gate /* print values in fcntl() pointed-to structure */
18177c478bd9Sstevel@tonic-gate void
show_fcntl(private_t * pri)18187c478bd9Sstevel@tonic-gate show_fcntl(private_t *pri)
18197c478bd9Sstevel@tonic-gate {
18207c478bd9Sstevel@tonic-gate long offset;
18217c478bd9Sstevel@tonic-gate
18227c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 2 && pri->sys_args[1] == F_GETFL) {
18237c478bd9Sstevel@tonic-gate show_ffg(pri);
18247c478bd9Sstevel@tonic-gate return;
18257c478bd9Sstevel@tonic-gate }
18267c478bd9Sstevel@tonic-gate
1827*27aa4812SToomas Soome if (pri->sys_nargs < 3 || (offset = pri->sys_args[2]) == 0)
18287c478bd9Sstevel@tonic-gate return;
18297c478bd9Sstevel@tonic-gate
18307c478bd9Sstevel@tonic-gate switch (pri->sys_args[1]) {
18317c478bd9Sstevel@tonic-gate case F_GETLK:
18327c478bd9Sstevel@tonic-gate case F_SETLK:
18337c478bd9Sstevel@tonic-gate case F_SETLKW:
18347c478bd9Sstevel@tonic-gate case F_FREESP:
18357c478bd9Sstevel@tonic-gate case F_ALLOCSP:
18367c478bd9Sstevel@tonic-gate case F_SETLK_NBMAND:
18377a5aac98SJerry Jelinek case F_OFD_GETLK:
18387a5aac98SJerry Jelinek case F_OFD_SETLK:
18397a5aac98SJerry Jelinek case F_OFD_SETLKW:
18407a5aac98SJerry Jelinek case F_FLOCK:
18417a5aac98SJerry Jelinek case F_FLOCKW:
18427c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
18437c478bd9Sstevel@tonic-gate show_flock64(pri, offset);
18447c478bd9Sstevel@tonic-gate else
18457c478bd9Sstevel@tonic-gate show_flock32(pri, offset);
18467c478bd9Sstevel@tonic-gate break;
18477c478bd9Sstevel@tonic-gate case 33: /* F_GETLK64 */
18487c478bd9Sstevel@tonic-gate case 34: /* F_SETLK64 */
18497c478bd9Sstevel@tonic-gate case 35: /* F_SETLKW64 */
18507c478bd9Sstevel@tonic-gate case 27: /* F_FREESP64 */
1851019c3c43Sraf case 28: /* F_ALLOCSP64 */
18527c478bd9Sstevel@tonic-gate case 44: /* F_SETLK64_NBMAND */
18537a5aac98SJerry Jelinek case 50: /* F_OFD_GETLK64 */
18547a5aac98SJerry Jelinek case 51: /* F_OFD_SETLK64 */
18557a5aac98SJerry Jelinek case 52: /* F_OFD_SETLKW64 */
18567a5aac98SJerry Jelinek case 55: /* F_FLOCK64 */
18577a5aac98SJerry Jelinek case 56: /* F_FLOCKW64 */
18587c478bd9Sstevel@tonic-gate show_flock64(pri, offset);
18597c478bd9Sstevel@tonic-gate break;
18607c478bd9Sstevel@tonic-gate case F_SHARE:
18617c478bd9Sstevel@tonic-gate case F_UNSHARE:
18627c478bd9Sstevel@tonic-gate show_share(pri, offset);
18637c478bd9Sstevel@tonic-gate break;
18647c478bd9Sstevel@tonic-gate }
18657c478bd9Sstevel@tonic-gate }
18667c478bd9Sstevel@tonic-gate
18677c478bd9Sstevel@tonic-gate void
show_strbuf(private_t * pri,long offset,const char * name,int dump)18687c478bd9Sstevel@tonic-gate show_strbuf(private_t *pri, long offset, const char *name, int dump)
18697c478bd9Sstevel@tonic-gate {
18707c478bd9Sstevel@tonic-gate struct strbuf strbuf;
18717c478bd9Sstevel@tonic-gate
18727c478bd9Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
18737c478bd9Sstevel@tonic-gate print_strbuf(pri, &strbuf, name, dump);
18747c478bd9Sstevel@tonic-gate }
18757c478bd9Sstevel@tonic-gate
18767c478bd9Sstevel@tonic-gate void
show_strbuf32(private_t * pri,long offset,const char * name,int dump)18777c478bd9Sstevel@tonic-gate show_strbuf32(private_t *pri, long offset, const char *name, int dump)
18787c478bd9Sstevel@tonic-gate {
18797c478bd9Sstevel@tonic-gate struct strbuf32 strbuf;
18807c478bd9Sstevel@tonic-gate
18817c478bd9Sstevel@tonic-gate if (Pread(Proc, &strbuf, sizeof (strbuf), offset) == sizeof (strbuf))
18827c478bd9Sstevel@tonic-gate print_strbuf32(pri, &strbuf, name, dump);
18837c478bd9Sstevel@tonic-gate }
18847c478bd9Sstevel@tonic-gate
18857c478bd9Sstevel@tonic-gate void
show_gp_msg(private_t * pri,int what)18867c478bd9Sstevel@tonic-gate show_gp_msg(private_t *pri, int what)
18877c478bd9Sstevel@tonic-gate {
18887c478bd9Sstevel@tonic-gate long offset;
18897c478bd9Sstevel@tonic-gate int dump = FALSE;
18907c478bd9Sstevel@tonic-gate int fdp1 = pri->sys_args[0] + 1;
18917c478bd9Sstevel@tonic-gate
18927c478bd9Sstevel@tonic-gate switch (what) {
18937c478bd9Sstevel@tonic-gate case SYS_getmsg:
18947c478bd9Sstevel@tonic-gate case SYS_getpmsg:
18957c478bd9Sstevel@tonic-gate if (pri->Errno == 0 && prismember(&readfd, fdp1))
18967c478bd9Sstevel@tonic-gate dump = TRUE;
18977c478bd9Sstevel@tonic-gate break;
18987c478bd9Sstevel@tonic-gate case SYS_putmsg:
18997c478bd9Sstevel@tonic-gate case SYS_putpmsg:
19007c478bd9Sstevel@tonic-gate if (prismember(&writefd, fdp1))
19017c478bd9Sstevel@tonic-gate dump = TRUE;
19027c478bd9Sstevel@tonic-gate break;
19037c478bd9Sstevel@tonic-gate }
19047c478bd9Sstevel@tonic-gate
19057c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
19067c478bd9Sstevel@tonic-gate if (dump)
19077c478bd9Sstevel@tonic-gate Eserialize();
19087c478bd9Sstevel@tonic-gate
1909*27aa4812SToomas Soome if (pri->sys_nargs >= 2 && (offset = pri->sys_args[1]) != 0) {
19107c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
19117c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "ctl", dump);
19127c478bd9Sstevel@tonic-gate else
19137c478bd9Sstevel@tonic-gate show_strbuf32(pri, offset, "ctl", dump);
19147c478bd9Sstevel@tonic-gate }
1915*27aa4812SToomas Soome if (pri->sys_nargs >= 3 && (offset = pri->sys_args[2]) != 0) {
19167c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
19177c478bd9Sstevel@tonic-gate show_strbuf(pri, offset, "dat", dump);
19187c478bd9Sstevel@tonic-gate else
19197c478bd9Sstevel@tonic-gate show_strbuf32(pri, offset, "dat", dump);
19207c478bd9Sstevel@tonic-gate }
19217c478bd9Sstevel@tonic-gate
19227c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
19237c478bd9Sstevel@tonic-gate if (dump)
19247c478bd9Sstevel@tonic-gate Xserialize();
19257c478bd9Sstevel@tonic-gate }
19267c478bd9Sstevel@tonic-gate
19277c478bd9Sstevel@tonic-gate void
show_int(private_t * pri,long offset,const char * name)19287c478bd9Sstevel@tonic-gate show_int(private_t *pri, long offset, const char *name)
19297c478bd9Sstevel@tonic-gate {
19307c478bd9Sstevel@tonic-gate int value;
19317c478bd9Sstevel@tonic-gate
19327c478bd9Sstevel@tonic-gate if (offset != 0 &&
19337c478bd9Sstevel@tonic-gate Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
19347c478bd9Sstevel@tonic-gate (void) printf("%s\t%s:\t%d\n",
1935019c3c43Sraf pri->pname,
1936019c3c43Sraf name,
1937019c3c43Sraf value);
19387c478bd9Sstevel@tonic-gate }
19397c478bd9Sstevel@tonic-gate
19407c478bd9Sstevel@tonic-gate void
show_hhex_int(private_t * pri,long offset,const char * name)19417c478bd9Sstevel@tonic-gate show_hhex_int(private_t *pri, long offset, const char *name)
19427c478bd9Sstevel@tonic-gate {
19437c478bd9Sstevel@tonic-gate int value;
19447c478bd9Sstevel@tonic-gate
19457c478bd9Sstevel@tonic-gate if (Pread(Proc, &value, sizeof (value), offset) == sizeof (value))
19467c478bd9Sstevel@tonic-gate (void) printf("%s\t%s:\t0x%.4X\n",
1947019c3c43Sraf pri->pname,
1948019c3c43Sraf name,
1949019c3c43Sraf value);
19507c478bd9Sstevel@tonic-gate }
19517c478bd9Sstevel@tonic-gate
19527c478bd9Sstevel@tonic-gate #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \
19537c478bd9Sstevel@tonic-gate POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
19547c478bd9Sstevel@tonic-gate
19557c478bd9Sstevel@tonic-gate const char *
pollevent(private_t * pri,int arg)19567c478bd9Sstevel@tonic-gate pollevent(private_t *pri, int arg)
19577c478bd9Sstevel@tonic-gate {
19587c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
19597c478bd9Sstevel@tonic-gate
19607c478bd9Sstevel@tonic-gate if (arg == 0)
19617c478bd9Sstevel@tonic-gate return ("0");
19627c478bd9Sstevel@tonic-gate if (arg & ~ALL_POLL_FLAGS) {
19637c478bd9Sstevel@tonic-gate (void) sprintf(str, "0x%-5X", arg);
19647c478bd9Sstevel@tonic-gate return ((const char *)str);
19657c478bd9Sstevel@tonic-gate }
19667c478bd9Sstevel@tonic-gate
19677c478bd9Sstevel@tonic-gate *str = '\0';
19687c478bd9Sstevel@tonic-gate if (arg & POLLIN)
19697c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLIN");
19707c478bd9Sstevel@tonic-gate if (arg & POLLPRI)
19717c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLPRI");
19727c478bd9Sstevel@tonic-gate if (arg & POLLOUT)
19737c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLOUT");
19747c478bd9Sstevel@tonic-gate if (arg & POLLRDNORM)
19757c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLRDNORM");
19767c478bd9Sstevel@tonic-gate if (arg & POLLRDBAND)
19777c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLRDBAND");
19787c478bd9Sstevel@tonic-gate if (arg & POLLWRBAND)
19797c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLWRBAND");
19807c478bd9Sstevel@tonic-gate if (arg & POLLERR)
19817c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLERR");
19827c478bd9Sstevel@tonic-gate if (arg & POLLHUP)
19837c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLHUP");
19847c478bd9Sstevel@tonic-gate if (arg & POLLNVAL)
19857c478bd9Sstevel@tonic-gate (void) strcat(str, "|POLLNVAL");
19867c478bd9Sstevel@tonic-gate
19877c478bd9Sstevel@tonic-gate return ((const char *)(str+1));
19887c478bd9Sstevel@tonic-gate }
19897c478bd9Sstevel@tonic-gate
19907c478bd9Sstevel@tonic-gate static void
show_one_pollfd(private_t * pri,struct pollfd * ppollfd)19917c478bd9Sstevel@tonic-gate show_one_pollfd(private_t *pri, struct pollfd *ppollfd)
19927c478bd9Sstevel@tonic-gate {
19937c478bd9Sstevel@tonic-gate /*
19947c478bd9Sstevel@tonic-gate * can't print both events and revents in same printf.
19957c478bd9Sstevel@tonic-gate * pollevent() returns a pointer to a TSD location.
19967c478bd9Sstevel@tonic-gate */
19977c478bd9Sstevel@tonic-gate (void) printf("%s\tfd=%-2d ev=%s",
19987c478bd9Sstevel@tonic-gate pri->pname, ppollfd->fd, pollevent(pri, ppollfd->events));
19997c478bd9Sstevel@tonic-gate (void) printf(" rev=%s\n", pollevent(pri, ppollfd->revents));
20007c478bd9Sstevel@tonic-gate }
20017c478bd9Sstevel@tonic-gate
20027c478bd9Sstevel@tonic-gate static void
show_all_pollfds(private_t * pri,long offset,int nfds)20037c478bd9Sstevel@tonic-gate show_all_pollfds(private_t *pri, long offset, int nfds)
20047c478bd9Sstevel@tonic-gate {
20057c478bd9Sstevel@tonic-gate struct pollfd pollfd[2];
20067c478bd9Sstevel@tonic-gate int skip = -1;
20077c478bd9Sstevel@tonic-gate
20087c478bd9Sstevel@tonic-gate for (; nfds && !interrupt; nfds--, offset += sizeof (struct pollfd)) {
20097c478bd9Sstevel@tonic-gate if (Pread(Proc, &pollfd[0], sizeof (struct pollfd), offset) !=
20107c478bd9Sstevel@tonic-gate sizeof (struct pollfd))
20117c478bd9Sstevel@tonic-gate continue;
20127c478bd9Sstevel@tonic-gate
20137c478bd9Sstevel@tonic-gate if (skip >= 0 && pollfd[0].fd == pollfd[1].fd &&
20147c478bd9Sstevel@tonic-gate pollfd[0].events == pollfd[1].events &&
20157c478bd9Sstevel@tonic-gate pollfd[0].revents == pollfd[1].revents) {
20167c478bd9Sstevel@tonic-gate skip++;
20177c478bd9Sstevel@tonic-gate continue;
20187c478bd9Sstevel@tonic-gate }
20197c478bd9Sstevel@tonic-gate
20207c478bd9Sstevel@tonic-gate if (skip > 0)
20217c478bd9Sstevel@tonic-gate (void) printf("%s\t...last pollfd structure"
20227c478bd9Sstevel@tonic-gate " repeated %d time%s...\n",
20237c478bd9Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s"));
20247c478bd9Sstevel@tonic-gate
20257c478bd9Sstevel@tonic-gate skip = 0;
20267c478bd9Sstevel@tonic-gate show_one_pollfd(pri, &pollfd[0]);
20277c478bd9Sstevel@tonic-gate pollfd[1] = pollfd[0];
20287c478bd9Sstevel@tonic-gate }
20297c478bd9Sstevel@tonic-gate
20307c478bd9Sstevel@tonic-gate if (skip > 0)
20317c478bd9Sstevel@tonic-gate (void) printf(
20327c478bd9Sstevel@tonic-gate "%s\t...last pollfd structure repeated %d time%s...\n",
20337c478bd9Sstevel@tonic-gate pri->pname, skip, (skip == 1 ? "" : "s"));
20347c478bd9Sstevel@tonic-gate }
20357c478bd9Sstevel@tonic-gate
20367c478bd9Sstevel@tonic-gate void
show_pollsys(private_t * pri)20377c478bd9Sstevel@tonic-gate show_pollsys(private_t *pri)
20387c478bd9Sstevel@tonic-gate {
20397c478bd9Sstevel@tonic-gate long offset;
20407c478bd9Sstevel@tonic-gate int nfds;
20417c478bd9Sstevel@tonic-gate int serial = 0;
20427c478bd9Sstevel@tonic-gate
20437c478bd9Sstevel@tonic-gate if (pri->sys_nargs < 2)
20447c478bd9Sstevel@tonic-gate return;
20457c478bd9Sstevel@tonic-gate
20467c478bd9Sstevel@tonic-gate offset = pri->sys_args[0];
20477c478bd9Sstevel@tonic-gate nfds = pri->sys_args[1];
20487c478bd9Sstevel@tonic-gate
20497c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
2050*27aa4812SToomas Soome if (offset != 0 && nfds > 32) {
20517c478bd9Sstevel@tonic-gate Eserialize();
20527c478bd9Sstevel@tonic-gate serial = 1;
20537c478bd9Sstevel@tonic-gate }
20547c478bd9Sstevel@tonic-gate
2055*27aa4812SToomas Soome if (offset != 0 && nfds > 0)
20567c478bd9Sstevel@tonic-gate show_all_pollfds(pri, offset, nfds);
20577c478bd9Sstevel@tonic-gate
20587c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2)
20597c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout");
20607c478bd9Sstevel@tonic-gate
20617c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3)
20627c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[3], "sigmask");
20637c478bd9Sstevel@tonic-gate
20647c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
20657c478bd9Sstevel@tonic-gate if (serial)
20667c478bd9Sstevel@tonic-gate Xserialize();
20677c478bd9Sstevel@tonic-gate }
20687c478bd9Sstevel@tonic-gate
20697c478bd9Sstevel@tonic-gate static void
show_perm64(private_t * pri,struct ipc_perm64 * ip)20707c478bd9Sstevel@tonic-gate show_perm64(private_t *pri, struct ipc_perm64 *ip)
20717c478bd9Sstevel@tonic-gate {
2072f48205beScasper (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
20737c478bd9Sstevel@tonic-gate "m=0%.6o key=%d projid=%-5d\n",
20747c478bd9Sstevel@tonic-gate pri->pname,
2075f48205beScasper ip->ipcx_uid,
2076f48205beScasper ip->ipcx_gid,
2077f48205beScasper ip->ipcx_cuid,
2078f48205beScasper ip->ipcx_cgid,
20797c478bd9Sstevel@tonic-gate (int)ip->ipcx_zoneid,
20807c478bd9Sstevel@tonic-gate (unsigned int)ip->ipcx_mode,
20817c478bd9Sstevel@tonic-gate ip->ipcx_key,
20827c478bd9Sstevel@tonic-gate (int)ip->ipcx_projid);
20837c478bd9Sstevel@tonic-gate }
20847c478bd9Sstevel@tonic-gate
20857c478bd9Sstevel@tonic-gate void
show_perm(private_t * pri,struct ipc_perm * ip)20867c478bd9Sstevel@tonic-gate show_perm(private_t *pri, struct ipc_perm *ip)
20877c478bd9Sstevel@tonic-gate {
20887c478bd9Sstevel@tonic-gate (void) printf(
2089019c3c43Sraf "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2090019c3c43Sraf pri->pname,
2091019c3c43Sraf ip->uid,
2092019c3c43Sraf ip->gid,
2093019c3c43Sraf ip->cuid,
2094019c3c43Sraf ip->cgid,
2095019c3c43Sraf (int)ip->mode,
2096019c3c43Sraf ip->seq,
2097019c3c43Sraf ip->key);
20987c478bd9Sstevel@tonic-gate }
20997c478bd9Sstevel@tonic-gate
21007c478bd9Sstevel@tonic-gate void
show_perm32(private_t * pri,struct ipc_perm32 * ip)21017c478bd9Sstevel@tonic-gate show_perm32(private_t *pri, struct ipc_perm32 *ip)
21027c478bd9Sstevel@tonic-gate {
21037c478bd9Sstevel@tonic-gate (void) printf(
2104019c3c43Sraf "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2105019c3c43Sraf pri->pname,
2106019c3c43Sraf ip->uid,
2107019c3c43Sraf ip->gid,
2108019c3c43Sraf ip->cuid,
2109019c3c43Sraf ip->cgid,
2110019c3c43Sraf ip->mode,
2111019c3c43Sraf ip->seq,
2112019c3c43Sraf ip->key);
21137c478bd9Sstevel@tonic-gate }
21147c478bd9Sstevel@tonic-gate
21157c478bd9Sstevel@tonic-gate static void
show_msgctl64(private_t * pri,long offset)21167c478bd9Sstevel@tonic-gate show_msgctl64(private_t *pri, long offset)
21177c478bd9Sstevel@tonic-gate {
21187c478bd9Sstevel@tonic-gate struct msqid_ds64 msgq;
21197c478bd9Sstevel@tonic-gate
2120*27aa4812SToomas Soome if (offset != 0 &&
21217c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21227c478bd9Sstevel@tonic-gate show_perm64(pri, &msgq.msgx_perm);
21237c478bd9Sstevel@tonic-gate
21247c478bd9Sstevel@tonic-gate (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
21257c478bd9Sstevel@tonic-gate "lspid=%-5d lrpid=%-5d\n", pri->pname,
21267c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_cbytes,
21277c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_qnum,
21287c478bd9Sstevel@tonic-gate (unsigned long long)msgq.msgx_qbytes,
21297c478bd9Sstevel@tonic-gate (int)msgq.msgx_lspid,
21307c478bd9Sstevel@tonic-gate (int)msgq.msgx_lrpid);
21317c478bd9Sstevel@tonic-gate
21327c478bd9Sstevel@tonic-gate prtime(pri, " st = ", (time_t)msgq.msgx_stime);
21337c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", (time_t)msgq.msgx_rtime);
21347c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)msgq.msgx_ctime);
21357c478bd9Sstevel@tonic-gate }
21367c478bd9Sstevel@tonic-gate }
21377c478bd9Sstevel@tonic-gate
21387c478bd9Sstevel@tonic-gate void
show_msgctl(private_t * pri,long offset)21397c478bd9Sstevel@tonic-gate show_msgctl(private_t *pri, long offset)
21407c478bd9Sstevel@tonic-gate {
21417c478bd9Sstevel@tonic-gate struct msqid_ds msgq;
21427c478bd9Sstevel@tonic-gate
2143*27aa4812SToomas Soome if (offset != 0 &&
21447c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21457c478bd9Sstevel@tonic-gate show_perm(pri, &msgq.msg_perm);
21467c478bd9Sstevel@tonic-gate
21477c478bd9Sstevel@tonic-gate (void) printf(
21487c478bd9Sstevel@tonic-gate "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2149019c3c43Sraf pri->pname,
2150019c3c43Sraf msgq.msg_cbytes,
2151019c3c43Sraf msgq.msg_qnum,
2152019c3c43Sraf msgq.msg_qbytes,
2153019c3c43Sraf (int)msgq.msg_lspid,
2154019c3c43Sraf (int)msgq.msg_lrpid);
21557c478bd9Sstevel@tonic-gate
21567c478bd9Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime);
21577c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime);
21587c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime);
21597c478bd9Sstevel@tonic-gate }
21607c478bd9Sstevel@tonic-gate }
21617c478bd9Sstevel@tonic-gate
21627c478bd9Sstevel@tonic-gate void
show_msgctl32(private_t * pri,long offset)21637c478bd9Sstevel@tonic-gate show_msgctl32(private_t *pri, long offset)
21647c478bd9Sstevel@tonic-gate {
21657c478bd9Sstevel@tonic-gate struct msqid_ds32 msgq;
21667c478bd9Sstevel@tonic-gate
2167*27aa4812SToomas Soome if (offset != 0 &&
21687c478bd9Sstevel@tonic-gate Pread(Proc, &msgq, sizeof (msgq), offset) == sizeof (msgq)) {
21697c478bd9Sstevel@tonic-gate show_perm32(pri, &msgq.msg_perm);
21707c478bd9Sstevel@tonic-gate
21717c478bd9Sstevel@tonic-gate (void) printf(
21727c478bd9Sstevel@tonic-gate "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2173019c3c43Sraf pri->pname,
2174019c3c43Sraf msgq.msg_cbytes,
2175019c3c43Sraf msgq.msg_qnum,
2176019c3c43Sraf msgq.msg_qbytes,
2177019c3c43Sraf msgq.msg_lspid,
2178019c3c43Sraf msgq.msg_lrpid);
21797c478bd9Sstevel@tonic-gate
21807c478bd9Sstevel@tonic-gate prtime(pri, " st = ", msgq.msg_stime);
21817c478bd9Sstevel@tonic-gate prtime(pri, " rt = ", msgq.msg_rtime);
21827c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", msgq.msg_ctime);
21837c478bd9Sstevel@tonic-gate }
21847c478bd9Sstevel@tonic-gate }
21857c478bd9Sstevel@tonic-gate
21867c478bd9Sstevel@tonic-gate void
show_msgbuf(private_t * pri,long offset,long msgsz)21877c478bd9Sstevel@tonic-gate show_msgbuf(private_t *pri, long offset, long msgsz)
21887c478bd9Sstevel@tonic-gate {
21897c478bd9Sstevel@tonic-gate struct msgbuf msgb;
21907c478bd9Sstevel@tonic-gate
2191*27aa4812SToomas Soome if (offset != 0 &&
21927c478bd9Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
21937c478bd9Sstevel@tonic-gate sizeof (msgb.mtype)) {
21947c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
21957c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4)
21967c478bd9Sstevel@tonic-gate Eserialize();
21977c478bd9Sstevel@tonic-gate
21987c478bd9Sstevel@tonic-gate (void) printf("%s\tmtype=%lu mtext[]=\n",
2199019c3c43Sraf pri->pname,
2200019c3c43Sraf msgb.mtype);
22017c478bd9Sstevel@tonic-gate showbuffer(pri,
2202019c3c43Sraf (long)(offset + sizeof (msgb.mtype)), msgsz);
22037c478bd9Sstevel@tonic-gate
22047c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
22057c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4)
22067c478bd9Sstevel@tonic-gate Xserialize();
22077c478bd9Sstevel@tonic-gate }
22087c478bd9Sstevel@tonic-gate }
22097c478bd9Sstevel@tonic-gate
22107c478bd9Sstevel@tonic-gate void
show_msgbuf32(private_t * pri,long offset,long msgsz)22117c478bd9Sstevel@tonic-gate show_msgbuf32(private_t *pri, long offset, long msgsz)
22127c478bd9Sstevel@tonic-gate {
22137c478bd9Sstevel@tonic-gate struct ipcmsgbuf32 msgb;
22147c478bd9Sstevel@tonic-gate
2215*27aa4812SToomas Soome if (offset != 0 &&
22167c478bd9Sstevel@tonic-gate Pread(Proc, &msgb, sizeof (msgb.mtype), offset) ==
22177c478bd9Sstevel@tonic-gate sizeof (msgb.mtype)) {
22187c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
22197c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4)
22207c478bd9Sstevel@tonic-gate Eserialize();
22217c478bd9Sstevel@tonic-gate
22227c478bd9Sstevel@tonic-gate (void) printf("%s\tmtype=%u mtext[]=\n",
2223019c3c43Sraf pri->pname,
2224019c3c43Sraf msgb.mtype);
22257c478bd9Sstevel@tonic-gate showbuffer(pri,
2226019c3c43Sraf (long)(offset + sizeof (msgb.mtype)), msgsz);
22277c478bd9Sstevel@tonic-gate
22287c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
22297c478bd9Sstevel@tonic-gate if (msgsz > MYBUFSIZ / 4)
22307c478bd9Sstevel@tonic-gate Xserialize();
22317c478bd9Sstevel@tonic-gate }
22327c478bd9Sstevel@tonic-gate }
22337c478bd9Sstevel@tonic-gate
22347c478bd9Sstevel@tonic-gate void
show_msgsys(private_t * pri,long msgsz)22357c478bd9Sstevel@tonic-gate show_msgsys(private_t *pri, long msgsz)
22367c478bd9Sstevel@tonic-gate {
22377c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
22387c478bd9Sstevel@tonic-gate case 0: /* msgget() */
22397c478bd9Sstevel@tonic-gate break;
22407c478bd9Sstevel@tonic-gate case 1: /* msgctl() */
22417c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) {
22427c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) {
22437c478bd9Sstevel@tonic-gate case IPC_STAT:
22447c478bd9Sstevel@tonic-gate if (pri->Errno)
22457c478bd9Sstevel@tonic-gate break;
22467c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
22477c478bd9Sstevel@tonic-gate case IPC_SET:
22487c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
22497c478bd9Sstevel@tonic-gate show_msgctl(pri,
2250019c3c43Sraf (long)pri->sys_args[3]);
22517c478bd9Sstevel@tonic-gate else
22527c478bd9Sstevel@tonic-gate show_msgctl32(pri,
2253019c3c43Sraf (long)pri->sys_args[3]);
22547c478bd9Sstevel@tonic-gate break;
22557c478bd9Sstevel@tonic-gate case IPC_STAT64:
22567c478bd9Sstevel@tonic-gate if (pri->Errno)
22577c478bd9Sstevel@tonic-gate break;
22587c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
22597c478bd9Sstevel@tonic-gate case IPC_SET64:
22607c478bd9Sstevel@tonic-gate show_msgctl64(pri, (long)pri->sys_args[3]);
22617c478bd9Sstevel@tonic-gate break;
22627c478bd9Sstevel@tonic-gate }
22637c478bd9Sstevel@tonic-gate }
22647c478bd9Sstevel@tonic-gate break;
22657c478bd9Sstevel@tonic-gate case 2: /* msgrcv() */
22667c478bd9Sstevel@tonic-gate if (!pri->Errno && pri->sys_nargs > 2) {
22677c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
22687c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2], msgsz);
22697c478bd9Sstevel@tonic-gate else
22707c478bd9Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2], msgsz);
22717c478bd9Sstevel@tonic-gate }
22727c478bd9Sstevel@tonic-gate break;
22737c478bd9Sstevel@tonic-gate case 3: /* msgsnd() */
22747c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) {
22757c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
22767c478bd9Sstevel@tonic-gate show_msgbuf(pri, pri->sys_args[2],
2277019c3c43Sraf pri->sys_args[3]);
22787c478bd9Sstevel@tonic-gate else
22797c478bd9Sstevel@tonic-gate show_msgbuf32(pri, pri->sys_args[2],
2280019c3c43Sraf pri->sys_args[3]);
22817c478bd9Sstevel@tonic-gate }
22827c478bd9Sstevel@tonic-gate break;
22837c478bd9Sstevel@tonic-gate case 4: /* msgids() */
22847c478bd9Sstevel@tonic-gate case 5: /* msgsnap() */
22857c478bd9Sstevel@tonic-gate default: /* unexpected subcode */
22867c478bd9Sstevel@tonic-gate break;
22877c478bd9Sstevel@tonic-gate }
22887c478bd9Sstevel@tonic-gate }
22897c478bd9Sstevel@tonic-gate
22907c478bd9Sstevel@tonic-gate static void
show_semctl64(private_t * pri,long offset)22917c478bd9Sstevel@tonic-gate show_semctl64(private_t *pri, long offset)
22927c478bd9Sstevel@tonic-gate {
22937c478bd9Sstevel@tonic-gate struct semid_ds64 semds;
22947c478bd9Sstevel@tonic-gate
2295*27aa4812SToomas Soome if (offset != 0 &&
22967c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
22977c478bd9Sstevel@tonic-gate show_perm64(pri, &semds.semx_perm);
22987c478bd9Sstevel@tonic-gate
22997c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n", pri->pname, semds.semx_nsems);
23007c478bd9Sstevel@tonic-gate
23017c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", (time_t)semds.semx_otime);
23027c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)semds.semx_ctime);
23037c478bd9Sstevel@tonic-gate }
23047c478bd9Sstevel@tonic-gate }
23057c478bd9Sstevel@tonic-gate
23067c478bd9Sstevel@tonic-gate void
show_semctl(private_t * pri,long offset)23077c478bd9Sstevel@tonic-gate show_semctl(private_t *pri, long offset)
23087c478bd9Sstevel@tonic-gate {
23097c478bd9Sstevel@tonic-gate struct semid_ds semds;
23107c478bd9Sstevel@tonic-gate
2311*27aa4812SToomas Soome if (offset != 0 &&
23127c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
23137c478bd9Sstevel@tonic-gate show_perm(pri, &semds.sem_perm);
23147c478bd9Sstevel@tonic-gate
23157c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n",
2316019c3c43Sraf pri->pname,
2317019c3c43Sraf semds.sem_nsems);
23187c478bd9Sstevel@tonic-gate
23197c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime);
23207c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime);
23217c478bd9Sstevel@tonic-gate }
23227c478bd9Sstevel@tonic-gate }
23237c478bd9Sstevel@tonic-gate
23247c478bd9Sstevel@tonic-gate void
show_semctl32(private_t * pri,long offset)23257c478bd9Sstevel@tonic-gate show_semctl32(private_t *pri, long offset)
23267c478bd9Sstevel@tonic-gate {
23277c478bd9Sstevel@tonic-gate struct semid_ds32 semds;
23287c478bd9Sstevel@tonic-gate
2329*27aa4812SToomas Soome if (offset != 0 &&
23307c478bd9Sstevel@tonic-gate Pread(Proc, &semds, sizeof (semds), offset) == sizeof (semds)) {
23317c478bd9Sstevel@tonic-gate show_perm32(pri, &semds.sem_perm);
23327c478bd9Sstevel@tonic-gate
23337c478bd9Sstevel@tonic-gate (void) printf("%s\tnsems=%u\n",
2334019c3c43Sraf pri->pname,
2335019c3c43Sraf semds.sem_nsems);
23367c478bd9Sstevel@tonic-gate
23377c478bd9Sstevel@tonic-gate prtime(pri, " ot = ", semds.sem_otime);
23387c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", semds.sem_ctime);
23397c478bd9Sstevel@tonic-gate }
23407c478bd9Sstevel@tonic-gate }
23417c478bd9Sstevel@tonic-gate
23427c478bd9Sstevel@tonic-gate void
show_semop(private_t * pri,long offset,long nsops,long timeout)23437c478bd9Sstevel@tonic-gate show_semop(private_t *pri, long offset, long nsops, long timeout)
23447c478bd9Sstevel@tonic-gate {
23457c478bd9Sstevel@tonic-gate struct sembuf sembuf;
23467c478bd9Sstevel@tonic-gate const char *str;
23477c478bd9Sstevel@tonic-gate
23483b862e9aSRoger A. Faulkner if (offset == 0)
23497c478bd9Sstevel@tonic-gate return;
23507c478bd9Sstevel@tonic-gate
23517c478bd9Sstevel@tonic-gate if (nsops > 40) /* let's not be ridiculous */
23527c478bd9Sstevel@tonic-gate nsops = 40;
23537c478bd9Sstevel@tonic-gate
23547c478bd9Sstevel@tonic-gate for (; nsops > 0 && !interrupt; --nsops, offset += sizeof (sembuf)) {
23557c478bd9Sstevel@tonic-gate if (Pread(Proc, &sembuf, sizeof (sembuf), offset) !=
23567c478bd9Sstevel@tonic-gate sizeof (sembuf))
23577c478bd9Sstevel@tonic-gate break;
23587c478bd9Sstevel@tonic-gate
23597c478bd9Sstevel@tonic-gate (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2360019c3c43Sraf pri->pname,
2361019c3c43Sraf sembuf.sem_num,
2362019c3c43Sraf sembuf.sem_op);
23637c478bd9Sstevel@tonic-gate
23647c478bd9Sstevel@tonic-gate if (sembuf.sem_flg == 0)
23657c478bd9Sstevel@tonic-gate (void) printf("0\n");
23667c478bd9Sstevel@tonic-gate else if ((str = semflags(pri, sembuf.sem_flg)) != NULL)
23677c478bd9Sstevel@tonic-gate (void) printf("%s\n", str);
23687c478bd9Sstevel@tonic-gate else
23697c478bd9Sstevel@tonic-gate (void) printf("0%.6o\n", sembuf.sem_flg);
23707c478bd9Sstevel@tonic-gate }
23717c478bd9Sstevel@tonic-gate if (timeout)
23727c478bd9Sstevel@tonic-gate show_timestruc(pri, timeout, "timeout");
23737c478bd9Sstevel@tonic-gate }
23747c478bd9Sstevel@tonic-gate
23757c478bd9Sstevel@tonic-gate void
show_semsys(private_t * pri)23767c478bd9Sstevel@tonic-gate show_semsys(private_t *pri)
23777c478bd9Sstevel@tonic-gate {
23787c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
23797c478bd9Sstevel@tonic-gate case 0: /* semctl() */
23807c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4) {
23817c478bd9Sstevel@tonic-gate switch (pri->sys_args[3]) {
23827c478bd9Sstevel@tonic-gate case IPC_STAT:
23837c478bd9Sstevel@tonic-gate if (pri->Errno)
23847c478bd9Sstevel@tonic-gate break;
23857c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
23867c478bd9Sstevel@tonic-gate case IPC_SET:
23877c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
23887c478bd9Sstevel@tonic-gate show_semctl(pri,
2389019c3c43Sraf (long)pri->sys_args[4]);
23907c478bd9Sstevel@tonic-gate else
23917c478bd9Sstevel@tonic-gate show_semctl32(pri,
2392019c3c43Sraf (long)pri->sys_args[4]);
23937c478bd9Sstevel@tonic-gate break;
23947c478bd9Sstevel@tonic-gate case IPC_STAT64:
23957c478bd9Sstevel@tonic-gate if (pri->Errno)
23967c478bd9Sstevel@tonic-gate break;
23977c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
23987c478bd9Sstevel@tonic-gate case IPC_SET64:
23997c478bd9Sstevel@tonic-gate show_semctl64(pri, (long)pri->sys_args[4]);
24007c478bd9Sstevel@tonic-gate break;
24017c478bd9Sstevel@tonic-gate }
24027c478bd9Sstevel@tonic-gate }
24037c478bd9Sstevel@tonic-gate break;
24047c478bd9Sstevel@tonic-gate case 1: /* semget() */
24057c478bd9Sstevel@tonic-gate break;
24067c478bd9Sstevel@tonic-gate case 2: /* semop() */
24077c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3)
24087c478bd9Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2],
2409019c3c43Sraf pri->sys_args[3], 0);
24107c478bd9Sstevel@tonic-gate break;
24117c478bd9Sstevel@tonic-gate case 3: /* semids() */
24127c478bd9Sstevel@tonic-gate break;
24137c478bd9Sstevel@tonic-gate case 4: /* semtimedop() */
24147c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4)
24157c478bd9Sstevel@tonic-gate show_semop(pri, (long)pri->sys_args[2],
2416019c3c43Sraf pri->sys_args[3], pri->sys_args[4]);
24177c478bd9Sstevel@tonic-gate break;
24187c478bd9Sstevel@tonic-gate default: /* unexpected subcode */
24197c478bd9Sstevel@tonic-gate break;
24207c478bd9Sstevel@tonic-gate }
24217c478bd9Sstevel@tonic-gate }
24227c478bd9Sstevel@tonic-gate
24237c478bd9Sstevel@tonic-gate static void
show_shmctl64(private_t * pri,long offset)24247c478bd9Sstevel@tonic-gate show_shmctl64(private_t *pri, long offset)
24257c478bd9Sstevel@tonic-gate {
24267c478bd9Sstevel@tonic-gate struct shmid_ds64 shmds;
24277c478bd9Sstevel@tonic-gate
2428*27aa4812SToomas Soome if (offset != 0 &&
24297c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24307c478bd9Sstevel@tonic-gate show_perm64(pri, &shmds.shmx_perm);
24317c478bd9Sstevel@tonic-gate
24327c478bd9Sstevel@tonic-gate (void) printf(
24337c478bd9Sstevel@tonic-gate "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
24347c478bd9Sstevel@tonic-gate pri->pname,
24357c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_segsz,
24367c478bd9Sstevel@tonic-gate (int)shmds.shmx_lpid,
24377c478bd9Sstevel@tonic-gate (int)shmds.shmx_cpid,
24387c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_nattch,
24397c478bd9Sstevel@tonic-gate (unsigned long long)shmds.shmx_cnattch);
24407c478bd9Sstevel@tonic-gate
24417c478bd9Sstevel@tonic-gate prtime(pri, " at = ", (time_t)shmds.shmx_atime);
24427c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", (time_t)shmds.shmx_dtime);
24437c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", (time_t)shmds.shmx_ctime);
24447c478bd9Sstevel@tonic-gate }
24457c478bd9Sstevel@tonic-gate }
24467c478bd9Sstevel@tonic-gate
24477c478bd9Sstevel@tonic-gate void
show_shmctl(private_t * pri,long offset)24487c478bd9Sstevel@tonic-gate show_shmctl(private_t *pri, long offset)
24497c478bd9Sstevel@tonic-gate {
24507c478bd9Sstevel@tonic-gate struct shmid_ds shmds;
24517c478bd9Sstevel@tonic-gate
2452*27aa4812SToomas Soome if (offset != 0 &&
24537c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24547c478bd9Sstevel@tonic-gate show_perm(pri, &shmds.shm_perm);
24557c478bd9Sstevel@tonic-gate
24567c478bd9Sstevel@tonic-gate (void) printf(
2457019c3c43Sraf "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2458019c3c43Sraf pri->pname,
2459019c3c43Sraf (ulong_t)shmds.shm_segsz,
2460019c3c43Sraf (int)shmds.shm_lpid,
2461019c3c43Sraf (int)shmds.shm_cpid,
2462019c3c43Sraf shmds.shm_nattch,
2463019c3c43Sraf shmds.shm_cnattch);
24647c478bd9Sstevel@tonic-gate
24657c478bd9Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime);
24667c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime);
24677c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime);
24687c478bd9Sstevel@tonic-gate }
24697c478bd9Sstevel@tonic-gate }
24707c478bd9Sstevel@tonic-gate
24717c478bd9Sstevel@tonic-gate void
show_shmctl32(private_t * pri,long offset)24727c478bd9Sstevel@tonic-gate show_shmctl32(private_t *pri, long offset)
24737c478bd9Sstevel@tonic-gate {
24747c478bd9Sstevel@tonic-gate struct shmid_ds32 shmds;
24757c478bd9Sstevel@tonic-gate
2476*27aa4812SToomas Soome if (offset != 0 &&
24777c478bd9Sstevel@tonic-gate Pread(Proc, &shmds, sizeof (shmds), offset) == sizeof (shmds)) {
24787c478bd9Sstevel@tonic-gate show_perm32(pri, &shmds.shm_perm);
24797c478bd9Sstevel@tonic-gate
24807c478bd9Sstevel@tonic-gate (void) printf(
2481019c3c43Sraf "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2482019c3c43Sraf pri->pname,
2483019c3c43Sraf shmds.shm_segsz,
2484019c3c43Sraf shmds.shm_lpid,
2485019c3c43Sraf shmds.shm_cpid,
2486019c3c43Sraf shmds.shm_nattch,
2487019c3c43Sraf shmds.shm_cnattch);
24887c478bd9Sstevel@tonic-gate
24897c478bd9Sstevel@tonic-gate prtime(pri, " at = ", shmds.shm_atime);
24907c478bd9Sstevel@tonic-gate prtime(pri, " dt = ", shmds.shm_dtime);
24917c478bd9Sstevel@tonic-gate prtime(pri, " ct = ", shmds.shm_ctime);
24927c478bd9Sstevel@tonic-gate }
24937c478bd9Sstevel@tonic-gate }
24947c478bd9Sstevel@tonic-gate
24957c478bd9Sstevel@tonic-gate void
show_shmsys(private_t * pri)24967c478bd9Sstevel@tonic-gate show_shmsys(private_t *pri)
24977c478bd9Sstevel@tonic-gate {
24987c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
24997c478bd9Sstevel@tonic-gate case 0: /* shmat() */
25007c478bd9Sstevel@tonic-gate break;
25017c478bd9Sstevel@tonic-gate case 1: /* shmctl() */
25027c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3) {
25037c478bd9Sstevel@tonic-gate switch (pri->sys_args[2]) {
25047c478bd9Sstevel@tonic-gate case IPC_STAT:
25057c478bd9Sstevel@tonic-gate if (pri->Errno)
25067c478bd9Sstevel@tonic-gate break;
25077c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
25087c478bd9Sstevel@tonic-gate case IPC_SET:
25097c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
25107c478bd9Sstevel@tonic-gate show_shmctl(pri,
2511019c3c43Sraf (long)pri->sys_args[3]);
25127c478bd9Sstevel@tonic-gate else
25137c478bd9Sstevel@tonic-gate show_shmctl32(pri,
2514019c3c43Sraf (long)pri->sys_args[3]);
25157c478bd9Sstevel@tonic-gate break;
25167c478bd9Sstevel@tonic-gate case IPC_STAT64:
25177c478bd9Sstevel@tonic-gate if (pri->Errno)
25187c478bd9Sstevel@tonic-gate break;
25197c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
25207c478bd9Sstevel@tonic-gate case IPC_SET64:
25217c478bd9Sstevel@tonic-gate show_shmctl64(pri, (long)pri->sys_args[3]);
25227c478bd9Sstevel@tonic-gate break;
25237c478bd9Sstevel@tonic-gate }
25247c478bd9Sstevel@tonic-gate }
25257c478bd9Sstevel@tonic-gate break;
25267c478bd9Sstevel@tonic-gate case 2: /* shmdt() */
25277c478bd9Sstevel@tonic-gate case 3: /* shmget() */
25287c478bd9Sstevel@tonic-gate case 4: /* shmids() */
25297c478bd9Sstevel@tonic-gate default: /* unexpected subcode */
25307c478bd9Sstevel@tonic-gate break;
25317c478bd9Sstevel@tonic-gate }
25327c478bd9Sstevel@tonic-gate }
25337c478bd9Sstevel@tonic-gate
25347c478bd9Sstevel@tonic-gate void
show_groups(private_t * pri,long offset,long count)25357c478bd9Sstevel@tonic-gate show_groups(private_t *pri, long offset, long count)
25367c478bd9Sstevel@tonic-gate {
25377c478bd9Sstevel@tonic-gate int groups[100];
25387c478bd9Sstevel@tonic-gate
25397c478bd9Sstevel@tonic-gate if (count > 100)
25407c478bd9Sstevel@tonic-gate count = 100;
25417c478bd9Sstevel@tonic-gate
2542*27aa4812SToomas Soome if (count > 0 && offset != 0 &&
25437c478bd9Sstevel@tonic-gate Pread(Proc, &groups[0], count*sizeof (int), offset) ==
25447c478bd9Sstevel@tonic-gate count*sizeof (int)) {
25457c478bd9Sstevel@tonic-gate int n;
25467c478bd9Sstevel@tonic-gate
25477c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname);
25487c478bd9Sstevel@tonic-gate for (n = 0; !interrupt && n < count; n++) {
25497c478bd9Sstevel@tonic-gate if (n != 0 && n%10 == 0)
25507c478bd9Sstevel@tonic-gate (void) printf("\n%s\t", pri->pname);
25517c478bd9Sstevel@tonic-gate (void) printf(" %5d", groups[n]);
25527c478bd9Sstevel@tonic-gate }
25537c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
25547c478bd9Sstevel@tonic-gate }
25557c478bd9Sstevel@tonic-gate }
25567c478bd9Sstevel@tonic-gate
25577c478bd9Sstevel@tonic-gate /*
25587c478bd9Sstevel@tonic-gate * This assumes that a sigset_t is simply an array of ints.
25597c478bd9Sstevel@tonic-gate */
25607c478bd9Sstevel@tonic-gate char *
sigset_string(private_t * pri,sigset_t * sp)25617c478bd9Sstevel@tonic-gate sigset_string(private_t *pri, sigset_t *sp)
25627c478bd9Sstevel@tonic-gate {
25637c478bd9Sstevel@tonic-gate char *s = pri->code_buf;
25647c478bd9Sstevel@tonic-gate int n = sizeof (*sp) / sizeof (int32_t);
25657c478bd9Sstevel@tonic-gate int32_t *lp = (int32_t *)sp;
25667c478bd9Sstevel@tonic-gate
25677c478bd9Sstevel@tonic-gate while (--n >= 0) {
25687c478bd9Sstevel@tonic-gate int32_t val = *lp++;
25697c478bd9Sstevel@tonic-gate
25707c478bd9Sstevel@tonic-gate if (val == 0)
25717c478bd9Sstevel@tonic-gate s += sprintf(s, " 0");
25727c478bd9Sstevel@tonic-gate else
25737c478bd9Sstevel@tonic-gate s += sprintf(s, " 0x%.8X", val);
25747c478bd9Sstevel@tonic-gate }
25757c478bd9Sstevel@tonic-gate
25767c478bd9Sstevel@tonic-gate return (pri->code_buf);
25777c478bd9Sstevel@tonic-gate }
25787c478bd9Sstevel@tonic-gate
25797c478bd9Sstevel@tonic-gate void
show_sigset(private_t * pri,long offset,const char * name)25807c478bd9Sstevel@tonic-gate show_sigset(private_t *pri, long offset, const char *name)
25817c478bd9Sstevel@tonic-gate {
25827c478bd9Sstevel@tonic-gate sigset_t sigset;
25837c478bd9Sstevel@tonic-gate
2584*27aa4812SToomas Soome if (offset != 0 &&
25857c478bd9Sstevel@tonic-gate Pread(Proc, &sigset, sizeof (sigset), offset) == sizeof (sigset)) {
25867c478bd9Sstevel@tonic-gate (void) printf("%s\t%s =%s\n",
2587019c3c43Sraf pri->pname, name, sigset_string(pri, &sigset));
25887c478bd9Sstevel@tonic-gate }
25897c478bd9Sstevel@tonic-gate }
25907c478bd9Sstevel@tonic-gate
25917c478bd9Sstevel@tonic-gate void
show_sigaltstack32(private_t * pri,long offset,const char * name)25927c478bd9Sstevel@tonic-gate show_sigaltstack32(private_t *pri, long offset, const char *name)
25937c478bd9Sstevel@tonic-gate {
25947c478bd9Sstevel@tonic-gate struct sigaltstack32 altstack;
25957c478bd9Sstevel@tonic-gate
2596*27aa4812SToomas Soome if (offset != 0 &&
25977c478bd9Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) ==
25987c478bd9Sstevel@tonic-gate sizeof (altstack)) {
25997c478bd9Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2600019c3c43Sraf pri->pname,
2601019c3c43Sraf name,
2602019c3c43Sraf altstack.ss_sp,
2603019c3c43Sraf altstack.ss_size,
2604019c3c43Sraf altstack.ss_flags);
26057c478bd9Sstevel@tonic-gate }
26067c478bd9Sstevel@tonic-gate }
26077c478bd9Sstevel@tonic-gate
26087c478bd9Sstevel@tonic-gate void
show_sigaltstack(private_t * pri,long offset,const char * name)26097c478bd9Sstevel@tonic-gate show_sigaltstack(private_t *pri, long offset, const char *name)
26107c478bd9Sstevel@tonic-gate {
26117c478bd9Sstevel@tonic-gate struct sigaltstack altstack;
26127c478bd9Sstevel@tonic-gate
26137c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
26147c478bd9Sstevel@tonic-gate show_sigaltstack32(pri, offset, name);
26157c478bd9Sstevel@tonic-gate return;
26167c478bd9Sstevel@tonic-gate }
2617*27aa4812SToomas Soome if (offset != 0 &&
26187c478bd9Sstevel@tonic-gate Pread(Proc, &altstack, sizeof (altstack), offset) ==
26197c478bd9Sstevel@tonic-gate sizeof (altstack)) {
26207c478bd9Sstevel@tonic-gate (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2621019c3c43Sraf pri->pname,
2622019c3c43Sraf name,
2623019c3c43Sraf (ulong_t)altstack.ss_sp,
2624019c3c43Sraf (ulong_t)altstack.ss_size,
2625019c3c43Sraf altstack.ss_flags);
26267c478bd9Sstevel@tonic-gate }
26277c478bd9Sstevel@tonic-gate }
26287c478bd9Sstevel@tonic-gate
26297c478bd9Sstevel@tonic-gate void
show_sigaction32(private_t * pri,long offset,const char * name,long odisp)26307c478bd9Sstevel@tonic-gate show_sigaction32(private_t *pri, long offset, const char *name, long odisp)
26317c478bd9Sstevel@tonic-gate {
26327c478bd9Sstevel@tonic-gate struct sigaction32 sigaction;
26337c478bd9Sstevel@tonic-gate
2634*27aa4812SToomas Soome if (offset != 0 &&
26357c478bd9Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
26367c478bd9Sstevel@tonic-gate sizeof (sigaction)) {
26377c478bd9Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */
2638*27aa4812SToomas Soome if (odisp != 0)
26397c478bd9Sstevel@tonic-gate sigaction.sa_handler = (caddr32_t)odisp;
26407c478bd9Sstevel@tonic-gate (void) printf(
2641019c3c43Sraf "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2642019c3c43Sraf pri->pname,
2643019c3c43Sraf name,
2644019c3c43Sraf sigaction.sa_handler,
2645019c3c43Sraf sigset_string(pri, (sigset_t *)&sigaction.sa_mask),
2646019c3c43Sraf sigaction.sa_flags);
26477c478bd9Sstevel@tonic-gate }
26487c478bd9Sstevel@tonic-gate }
26497c478bd9Sstevel@tonic-gate
26507c478bd9Sstevel@tonic-gate void
show_sigaction(private_t * pri,long offset,const char * name,long odisp)26517c478bd9Sstevel@tonic-gate show_sigaction(private_t *pri, long offset, const char *name, long odisp)
26527c478bd9Sstevel@tonic-gate {
26537c478bd9Sstevel@tonic-gate struct sigaction sigaction;
26547c478bd9Sstevel@tonic-gate
26557c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
26567c478bd9Sstevel@tonic-gate show_sigaction32(pri, offset, name, odisp);
26577c478bd9Sstevel@tonic-gate return;
26587c478bd9Sstevel@tonic-gate }
2659*27aa4812SToomas Soome if (offset != 0 &&
26607c478bd9Sstevel@tonic-gate Pread(Proc, &sigaction, sizeof (sigaction), offset) ==
26617c478bd9Sstevel@tonic-gate sizeof (sigaction)) {
26627c478bd9Sstevel@tonic-gate /* This is stupid, we shouldn't have to do this */
2663*27aa4812SToomas Soome if (odisp != 0)
26647c478bd9Sstevel@tonic-gate sigaction.sa_handler = (void (*)())odisp;
26657c478bd9Sstevel@tonic-gate (void) printf(
2666019c3c43Sraf "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2667019c3c43Sraf pri->pname,
2668019c3c43Sraf name,
2669019c3c43Sraf (long)sigaction.sa_handler,
2670019c3c43Sraf sigset_string(pri, &sigaction.sa_mask),
2671019c3c43Sraf sigaction.sa_flags);
26727c478bd9Sstevel@tonic-gate }
26737c478bd9Sstevel@tonic-gate }
26747c478bd9Sstevel@tonic-gate
26757c478bd9Sstevel@tonic-gate void
print_siginfo32(private_t * pri,const siginfo32_t * sip)26767c478bd9Sstevel@tonic-gate print_siginfo32(private_t *pri, const siginfo32_t *sip)
26777c478bd9Sstevel@tonic-gate {
26787c478bd9Sstevel@tonic-gate const char *code = NULL;
26797c478bd9Sstevel@tonic-gate
26807c478bd9Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname,
2681019c3c43Sraf signame(pri, sip->si_signo));
26827c478bd9Sstevel@tonic-gate
26837c478bd9Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
26847c478bd9Sstevel@tonic-gate (void) printf(" pid=%d uid=%d", sip->si_pid, sip->si_uid);
26857c478bd9Sstevel@tonic-gate if (sip->si_code != 0)
26867c478bd9Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code);
26877c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
26887c478bd9Sstevel@tonic-gate return;
26897c478bd9Sstevel@tonic-gate }
26907c478bd9Sstevel@tonic-gate
26917c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
26927c478bd9Sstevel@tonic-gate default:
26937c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
26947c478bd9Sstevel@tonic-gate return;
26957c478bd9Sstevel@tonic-gate case SIGILL:
26967c478bd9Sstevel@tonic-gate case SIGTRAP:
26977c478bd9Sstevel@tonic-gate case SIGFPE:
26987c478bd9Sstevel@tonic-gate case SIGSEGV:
26997c478bd9Sstevel@tonic-gate case SIGBUS:
27007c478bd9Sstevel@tonic-gate case SIGEMT:
27017c478bd9Sstevel@tonic-gate case SIGCLD:
27027c478bd9Sstevel@tonic-gate case SIGPOLL:
27037c478bd9Sstevel@tonic-gate case SIGXFSZ:
27047c478bd9Sstevel@tonic-gate break;
27057c478bd9Sstevel@tonic-gate }
27067c478bd9Sstevel@tonic-gate
27077c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
27087c478bd9Sstevel@tonic-gate case SIGILL:
27097c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27107c478bd9Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break;
27117c478bd9Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break;
27127c478bd9Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break;
27137c478bd9Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break;
27147c478bd9Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break;
27157c478bd9Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break;
27167c478bd9Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break;
27177c478bd9Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break;
27187c478bd9Sstevel@tonic-gate }
27197c478bd9Sstevel@tonic-gate break;
27207c478bd9Sstevel@tonic-gate case SIGTRAP:
27217c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27227c478bd9Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break;
27237c478bd9Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break;
27247c478bd9Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break;
27257c478bd9Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break;
27267c478bd9Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break;
27277c478bd9Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break;
27287c478bd9Sstevel@tonic-gate }
27297c478bd9Sstevel@tonic-gate break;
27307c478bd9Sstevel@tonic-gate case SIGFPE:
27317c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27327c478bd9Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break;
27337c478bd9Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break;
27347c478bd9Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break;
27357c478bd9Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break;
27367c478bd9Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break;
27377c478bd9Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break;
27387c478bd9Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break;
27397c478bd9Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break;
27407c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
27417c478bd9Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break;
27427c478bd9Sstevel@tonic-gate #endif
27437c478bd9Sstevel@tonic-gate }
27447c478bd9Sstevel@tonic-gate break;
27457c478bd9Sstevel@tonic-gate case SIGSEGV:
27467c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27477c478bd9Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break;
27487c478bd9Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break;
27497c478bd9Sstevel@tonic-gate }
27507c478bd9Sstevel@tonic-gate break;
27517c478bd9Sstevel@tonic-gate case SIGEMT:
27527c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27537c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
27547c478bd9Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break;
27557c478bd9Sstevel@tonic-gate #endif
27567c478bd9Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break;
27577c478bd9Sstevel@tonic-gate }
27587c478bd9Sstevel@tonic-gate break;
27597c478bd9Sstevel@tonic-gate case SIGBUS:
27607c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27617c478bd9Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break;
27627c478bd9Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break;
27637c478bd9Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break;
27647c478bd9Sstevel@tonic-gate }
27657c478bd9Sstevel@tonic-gate break;
27667c478bd9Sstevel@tonic-gate case SIGCLD:
27677c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27687c478bd9Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break;
27697c478bd9Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break;
27707c478bd9Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break;
27717c478bd9Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break;
27727c478bd9Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break;
27737c478bd9Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break;
27747c478bd9Sstevel@tonic-gate }
27757c478bd9Sstevel@tonic-gate break;
27767c478bd9Sstevel@tonic-gate case SIGPOLL:
27777c478bd9Sstevel@tonic-gate switch (sip->si_code) {
27787c478bd9Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break;
27797c478bd9Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break;
27807c478bd9Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break;
27817c478bd9Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break;
27827c478bd9Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break;
27837c478bd9Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break;
27847c478bd9Sstevel@tonic-gate }
27857c478bd9Sstevel@tonic-gate break;
27867c478bd9Sstevel@tonic-gate }
27877c478bd9Sstevel@tonic-gate
27887c478bd9Sstevel@tonic-gate if (code == NULL) {
27897c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code);
27907c478bd9Sstevel@tonic-gate code = (const char *)pri->code_buf;
27917c478bd9Sstevel@tonic-gate }
27927c478bd9Sstevel@tonic-gate
27937c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
27947c478bd9Sstevel@tonic-gate case SIGILL:
27957c478bd9Sstevel@tonic-gate case SIGTRAP:
27967c478bd9Sstevel@tonic-gate case SIGFPE:
27977c478bd9Sstevel@tonic-gate case SIGSEGV:
27987c478bd9Sstevel@tonic-gate case SIGBUS:
27997c478bd9Sstevel@tonic-gate case SIGEMT:
28007c478bd9Sstevel@tonic-gate (void) printf(" %s addr=0x%.8X",
2801019c3c43Sraf code,
2802019c3c43Sraf sip->si_addr);
28037c478bd9Sstevel@tonic-gate break;
28047c478bd9Sstevel@tonic-gate case SIGCLD:
28057c478bd9Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X",
2806019c3c43Sraf code,
2807019c3c43Sraf sip->si_pid,
2808019c3c43Sraf sip->si_status);
28097c478bd9Sstevel@tonic-gate break;
28107c478bd9Sstevel@tonic-gate case SIGPOLL:
28117c478bd9Sstevel@tonic-gate case SIGXFSZ:
28127c478bd9Sstevel@tonic-gate (void) printf(" %s fd=%d band=%d",
2813019c3c43Sraf code,
2814019c3c43Sraf sip->si_fd,
2815019c3c43Sraf sip->si_band);
28167c478bd9Sstevel@tonic-gate break;
28177c478bd9Sstevel@tonic-gate }
28187c478bd9Sstevel@tonic-gate
28197c478bd9Sstevel@tonic-gate if (sip->si_errno != 0) {
28207c478bd9Sstevel@tonic-gate const char *ename = errname(sip->si_errno);
28217c478bd9Sstevel@tonic-gate
28227c478bd9Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno);
28237c478bd9Sstevel@tonic-gate if (ename != NULL)
28247c478bd9Sstevel@tonic-gate (void) printf("(%s)", ename);
28257c478bd9Sstevel@tonic-gate }
28267c478bd9Sstevel@tonic-gate
28277c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
28287c478bd9Sstevel@tonic-gate }
28297c478bd9Sstevel@tonic-gate
28307c478bd9Sstevel@tonic-gate void
print_siginfo(private_t * pri,const siginfo_t * sip)28317c478bd9Sstevel@tonic-gate print_siginfo(private_t *pri, const siginfo_t *sip)
28327c478bd9Sstevel@tonic-gate {
28337c478bd9Sstevel@tonic-gate const char *code = NULL;
28347c478bd9Sstevel@tonic-gate
28357c478bd9Sstevel@tonic-gate (void) printf("%s siginfo: %s", pri->pname,
2836019c3c43Sraf signame(pri, sip->si_signo));
28377c478bd9Sstevel@tonic-gate
28387c478bd9Sstevel@tonic-gate if (sip->si_signo != 0 && SI_FROMUSER(sip) && sip->si_pid != 0) {
2839f48205beScasper (void) printf(" pid=%d uid=%u",
28407c478bd9Sstevel@tonic-gate (int)sip->si_pid,
2841f48205beScasper sip->si_uid);
28427c478bd9Sstevel@tonic-gate if (sip->si_code != 0)
28437c478bd9Sstevel@tonic-gate (void) printf(" code=%d", sip->si_code);
28447c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
28457c478bd9Sstevel@tonic-gate return;
28467c478bd9Sstevel@tonic-gate }
28477c478bd9Sstevel@tonic-gate
28487c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
28497c478bd9Sstevel@tonic-gate default:
28507c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
28517c478bd9Sstevel@tonic-gate return;
28527c478bd9Sstevel@tonic-gate case SIGILL:
28537c478bd9Sstevel@tonic-gate case SIGTRAP:
28547c478bd9Sstevel@tonic-gate case SIGFPE:
28557c478bd9Sstevel@tonic-gate case SIGSEGV:
28567c478bd9Sstevel@tonic-gate case SIGBUS:
28577c478bd9Sstevel@tonic-gate case SIGEMT:
28587c478bd9Sstevel@tonic-gate case SIGCLD:
28597c478bd9Sstevel@tonic-gate case SIGPOLL:
28607c478bd9Sstevel@tonic-gate case SIGXFSZ:
28617c478bd9Sstevel@tonic-gate break;
28627c478bd9Sstevel@tonic-gate }
28637c478bd9Sstevel@tonic-gate
28647c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
28657c478bd9Sstevel@tonic-gate case SIGILL:
28667c478bd9Sstevel@tonic-gate switch (sip->si_code) {
28677c478bd9Sstevel@tonic-gate case ILL_ILLOPC: code = "ILL_ILLOPC"; break;
28687c478bd9Sstevel@tonic-gate case ILL_ILLOPN: code = "ILL_ILLOPN"; break;
28697c478bd9Sstevel@tonic-gate case ILL_ILLADR: code = "ILL_ILLADR"; break;
28707c478bd9Sstevel@tonic-gate case ILL_ILLTRP: code = "ILL_ILLTRP"; break;
28717c478bd9Sstevel@tonic-gate case ILL_PRVOPC: code = "ILL_PRVOPC"; break;
28727c478bd9Sstevel@tonic-gate case ILL_PRVREG: code = "ILL_PRVREG"; break;
28737c478bd9Sstevel@tonic-gate case ILL_COPROC: code = "ILL_COPROC"; break;
28747c478bd9Sstevel@tonic-gate case ILL_BADSTK: code = "ILL_BADSTK"; break;
28757c478bd9Sstevel@tonic-gate }
28767c478bd9Sstevel@tonic-gate break;
28777c478bd9Sstevel@tonic-gate case SIGTRAP:
28787c478bd9Sstevel@tonic-gate switch (sip->si_code) {
28797c478bd9Sstevel@tonic-gate case TRAP_BRKPT: code = "TRAP_BRKPT"; break;
28807c478bd9Sstevel@tonic-gate case TRAP_TRACE: code = "TRAP_TRACE"; break;
28817c478bd9Sstevel@tonic-gate case TRAP_RWATCH: code = "TRAP_RWATCH"; break;
28827c478bd9Sstevel@tonic-gate case TRAP_WWATCH: code = "TRAP_WWATCH"; break;
28837c478bd9Sstevel@tonic-gate case TRAP_XWATCH: code = "TRAP_XWATCH"; break;
28847c478bd9Sstevel@tonic-gate case TRAP_DTRACE: code = "TRAP_DTRACE"; break;
28857c478bd9Sstevel@tonic-gate }
28867c478bd9Sstevel@tonic-gate break;
28877c478bd9Sstevel@tonic-gate case SIGFPE:
28887c478bd9Sstevel@tonic-gate switch (sip->si_code) {
28897c478bd9Sstevel@tonic-gate case FPE_INTDIV: code = "FPE_INTDIV"; break;
28907c478bd9Sstevel@tonic-gate case FPE_INTOVF: code = "FPE_INTOVF"; break;
28917c478bd9Sstevel@tonic-gate case FPE_FLTDIV: code = "FPE_FLTDIV"; break;
28927c478bd9Sstevel@tonic-gate case FPE_FLTOVF: code = "FPE_FLTOVF"; break;
28937c478bd9Sstevel@tonic-gate case FPE_FLTUND: code = "FPE_FLTUND"; break;
28947c478bd9Sstevel@tonic-gate case FPE_FLTRES: code = "FPE_FLTRES"; break;
28957c478bd9Sstevel@tonic-gate case FPE_FLTINV: code = "FPE_FLTINV"; break;
28967c478bd9Sstevel@tonic-gate case FPE_FLTSUB: code = "FPE_FLTSUB"; break;
28977c478bd9Sstevel@tonic-gate #if defined(FPE_FLTDEN)
28987c478bd9Sstevel@tonic-gate case FPE_FLTDEN: code = "FPE_FLTDEN"; break;
28997c478bd9Sstevel@tonic-gate #endif
29007c478bd9Sstevel@tonic-gate }
29017c478bd9Sstevel@tonic-gate break;
29027c478bd9Sstevel@tonic-gate case SIGSEGV:
29037c478bd9Sstevel@tonic-gate switch (sip->si_code) {
29047c478bd9Sstevel@tonic-gate case SEGV_MAPERR: code = "SEGV_MAPERR"; break;
29057c478bd9Sstevel@tonic-gate case SEGV_ACCERR: code = "SEGV_ACCERR"; break;
29067c478bd9Sstevel@tonic-gate }
29077c478bd9Sstevel@tonic-gate break;
29087c478bd9Sstevel@tonic-gate case SIGEMT:
29097c478bd9Sstevel@tonic-gate switch (sip->si_code) {
29107c478bd9Sstevel@tonic-gate #ifdef EMT_TAGOVF
29117c478bd9Sstevel@tonic-gate case EMT_TAGOVF: code = "EMT_TAGOVF"; break;
29127c478bd9Sstevel@tonic-gate #endif
29137c478bd9Sstevel@tonic-gate case EMT_CPCOVF: code = "EMT_CPCOVF"; break;
29147c478bd9Sstevel@tonic-gate }
29157c478bd9Sstevel@tonic-gate break;
29167c478bd9Sstevel@tonic-gate case SIGBUS:
29177c478bd9Sstevel@tonic-gate switch (sip->si_code) {
29187c478bd9Sstevel@tonic-gate case BUS_ADRALN: code = "BUS_ADRALN"; break;
29197c478bd9Sstevel@tonic-gate case BUS_ADRERR: code = "BUS_ADRERR"; break;
29207c478bd9Sstevel@tonic-gate case BUS_OBJERR: code = "BUS_OBJERR"; break;
29217c478bd9Sstevel@tonic-gate }
29227c478bd9Sstevel@tonic-gate break;
29237c478bd9Sstevel@tonic-gate case SIGCLD:
29247c478bd9Sstevel@tonic-gate switch (sip->si_code) {
29257c478bd9Sstevel@tonic-gate case CLD_EXITED: code = "CLD_EXITED"; break;
29267c478bd9Sstevel@tonic-gate case CLD_KILLED: code = "CLD_KILLED"; break;
29277c478bd9Sstevel@tonic-gate case CLD_DUMPED: code = "CLD_DUMPED"; break;
29287c478bd9Sstevel@tonic-gate case CLD_TRAPPED: code = "CLD_TRAPPED"; break;
29297c478bd9Sstevel@tonic-gate case CLD_STOPPED: code = "CLD_STOPPED"; break;
29307c478bd9Sstevel@tonic-gate case CLD_CONTINUED: code = "CLD_CONTINUED"; break;
29317c478bd9Sstevel@tonic-gate }
29327c478bd9Sstevel@tonic-gate break;
29337c478bd9Sstevel@tonic-gate case SIGPOLL:
29347c478bd9Sstevel@tonic-gate switch (sip->si_code) {
29357c478bd9Sstevel@tonic-gate case POLL_IN: code = "POLL_IN"; break;
29367c478bd9Sstevel@tonic-gate case POLL_OUT: code = "POLL_OUT"; break;
29377c478bd9Sstevel@tonic-gate case POLL_MSG: code = "POLL_MSG"; break;
29387c478bd9Sstevel@tonic-gate case POLL_ERR: code = "POLL_ERR"; break;
29397c478bd9Sstevel@tonic-gate case POLL_PRI: code = "POLL_PRI"; break;
29407c478bd9Sstevel@tonic-gate case POLL_HUP: code = "POLL_HUP"; break;
29417c478bd9Sstevel@tonic-gate }
29427c478bd9Sstevel@tonic-gate break;
29437c478bd9Sstevel@tonic-gate }
29447c478bd9Sstevel@tonic-gate
29457c478bd9Sstevel@tonic-gate if (code == NULL) {
29467c478bd9Sstevel@tonic-gate (void) sprintf(pri->code_buf, "code=%d", sip->si_code);
29477c478bd9Sstevel@tonic-gate code = (const char *)pri->code_buf;
29487c478bd9Sstevel@tonic-gate }
29497c478bd9Sstevel@tonic-gate
29507c478bd9Sstevel@tonic-gate switch (sip->si_signo) {
29517c478bd9Sstevel@tonic-gate case SIGILL:
29527c478bd9Sstevel@tonic-gate case SIGTRAP:
29537c478bd9Sstevel@tonic-gate case SIGFPE:
29547c478bd9Sstevel@tonic-gate case SIGSEGV:
29557c478bd9Sstevel@tonic-gate case SIGBUS:
29567c478bd9Sstevel@tonic-gate case SIGEMT:
29577c478bd9Sstevel@tonic-gate (void) printf(" %s addr=0x%.8lX",
2958019c3c43Sraf code,
2959019c3c43Sraf (long)sip->si_addr);
29607c478bd9Sstevel@tonic-gate break;
29617c478bd9Sstevel@tonic-gate case SIGCLD:
29627c478bd9Sstevel@tonic-gate (void) printf(" %s pid=%d status=0x%.4X",
2963019c3c43Sraf code,
2964019c3c43Sraf (int)sip->si_pid,
2965019c3c43Sraf sip->si_status);
29667c478bd9Sstevel@tonic-gate break;
29677c478bd9Sstevel@tonic-gate case SIGPOLL:
29687c478bd9Sstevel@tonic-gate case SIGXFSZ:
29697c478bd9Sstevel@tonic-gate (void) printf(" %s fd=%d band=%ld",
2970019c3c43Sraf code,
2971019c3c43Sraf sip->si_fd,
2972019c3c43Sraf sip->si_band);
29737c478bd9Sstevel@tonic-gate break;
29747c478bd9Sstevel@tonic-gate }
29757c478bd9Sstevel@tonic-gate
29767c478bd9Sstevel@tonic-gate if (sip->si_errno != 0) {
29777c478bd9Sstevel@tonic-gate const char *ename = errname(sip->si_errno);
29787c478bd9Sstevel@tonic-gate
29797c478bd9Sstevel@tonic-gate (void) printf(" errno=%d", sip->si_errno);
29807c478bd9Sstevel@tonic-gate if (ename != NULL)
29817c478bd9Sstevel@tonic-gate (void) printf("(%s)", ename);
29827c478bd9Sstevel@tonic-gate }
29837c478bd9Sstevel@tonic-gate
29847c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
29857c478bd9Sstevel@tonic-gate }
29867c478bd9Sstevel@tonic-gate
29877c478bd9Sstevel@tonic-gate void
show_siginfo32(private_t * pri,long offset)29887c478bd9Sstevel@tonic-gate show_siginfo32(private_t *pri, long offset)
29897c478bd9Sstevel@tonic-gate {
29907c478bd9Sstevel@tonic-gate struct siginfo32 siginfo;
29917c478bd9Sstevel@tonic-gate
2992*27aa4812SToomas Soome if (offset != 0 &&
29937c478bd9Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
29947c478bd9Sstevel@tonic-gate print_siginfo32(pri, &siginfo);
29957c478bd9Sstevel@tonic-gate }
29967c478bd9Sstevel@tonic-gate
29977c478bd9Sstevel@tonic-gate void
show_siginfo(private_t * pri,long offset)29987c478bd9Sstevel@tonic-gate show_siginfo(private_t *pri, long offset)
29997c478bd9Sstevel@tonic-gate {
30007c478bd9Sstevel@tonic-gate struct siginfo siginfo;
30017c478bd9Sstevel@tonic-gate
30027c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
30037c478bd9Sstevel@tonic-gate show_siginfo32(pri, offset);
30047c478bd9Sstevel@tonic-gate return;
30057c478bd9Sstevel@tonic-gate }
3006*27aa4812SToomas Soome if (offset != 0 &&
30077c478bd9Sstevel@tonic-gate Pread(Proc, &siginfo, sizeof (siginfo), offset) == sizeof (siginfo))
30087c478bd9Sstevel@tonic-gate print_siginfo(pri, &siginfo);
30097c478bd9Sstevel@tonic-gate }
30107c478bd9Sstevel@tonic-gate
30117c478bd9Sstevel@tonic-gate void
show_bool(private_t * pri,long offset,int count)30127c478bd9Sstevel@tonic-gate show_bool(private_t *pri, long offset, int count)
30137c478bd9Sstevel@tonic-gate {
30147c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4);
30157c478bd9Sstevel@tonic-gate
30167c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
30177c478bd9Sstevel@tonic-gate if (serial)
30187c478bd9Sstevel@tonic-gate Eserialize();
30197c478bd9Sstevel@tonic-gate
30207c478bd9Sstevel@tonic-gate while (count > 0) {
30217c478bd9Sstevel@tonic-gate char buf[32];
30227c478bd9Sstevel@tonic-gate int nb = (count < 32)? count : 32;
30237c478bd9Sstevel@tonic-gate int i;
30247c478bd9Sstevel@tonic-gate
30257c478bd9Sstevel@tonic-gate if (Pread(Proc, buf, (size_t)nb, offset) != nb)
30267c478bd9Sstevel@tonic-gate break;
30277c478bd9Sstevel@tonic-gate
30287c478bd9Sstevel@tonic-gate (void) printf("%s ", pri->pname);
30297c478bd9Sstevel@tonic-gate for (i = 0; i < nb; i++)
30307c478bd9Sstevel@tonic-gate (void) printf(" %d", buf[i]);
30317c478bd9Sstevel@tonic-gate (void) fputc('\n', stdout);
30327c478bd9Sstevel@tonic-gate
30337c478bd9Sstevel@tonic-gate count -= nb;
30347c478bd9Sstevel@tonic-gate offset += nb;
30357c478bd9Sstevel@tonic-gate }
30367c478bd9Sstevel@tonic-gate
30377c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
30387c478bd9Sstevel@tonic-gate if (serial)
30397c478bd9Sstevel@tonic-gate Xserialize();
30407c478bd9Sstevel@tonic-gate }
30417c478bd9Sstevel@tonic-gate
30427c478bd9Sstevel@tonic-gate void
show_iovec32(private_t * pri,long offset,int niov,int showbuf,long count)30437c478bd9Sstevel@tonic-gate show_iovec32(private_t *pri, long offset, int niov, int showbuf, long count)
30447c478bd9Sstevel@tonic-gate {
30457c478bd9Sstevel@tonic-gate iovec32_t iovec[16];
30467c478bd9Sstevel@tonic-gate iovec32_t *ip;
30477c478bd9Sstevel@tonic-gate long nb;
30487c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf);
30497c478bd9Sstevel@tonic-gate
30507c478bd9Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */
30517c478bd9Sstevel@tonic-gate niov = 16;
30527c478bd9Sstevel@tonic-gate
3053*27aa4812SToomas Soome if (offset != 0 && niov > 0 &&
30547c478bd9Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec32_t), offset)
30557c478bd9Sstevel@tonic-gate == niov*sizeof (iovec32_t)) {
30567c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
30577c478bd9Sstevel@tonic-gate if (serial)
30587c478bd9Sstevel@tonic-gate Eserialize();
30597c478bd9Sstevel@tonic-gate
30607c478bd9Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
30617c478bd9Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n",
3062019c3c43Sraf pri->pname,
3063019c3c43Sraf ip->iov_base,
3064019c3c43Sraf ip->iov_len);
30657c478bd9Sstevel@tonic-gate if ((nb = count) > 0) {
30667c478bd9Sstevel@tonic-gate if (nb > ip->iov_len)
30677c478bd9Sstevel@tonic-gate nb = ip->iov_len;
30687c478bd9Sstevel@tonic-gate if (nb > 0)
30697c478bd9Sstevel@tonic-gate count -= nb;
30707c478bd9Sstevel@tonic-gate }
30717c478bd9Sstevel@tonic-gate if (showbuf && nb > 0)
30727c478bd9Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb);
30737c478bd9Sstevel@tonic-gate }
30747c478bd9Sstevel@tonic-gate
30757c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
30767c478bd9Sstevel@tonic-gate if (serial)
30777c478bd9Sstevel@tonic-gate Xserialize();
30787c478bd9Sstevel@tonic-gate }
30797c478bd9Sstevel@tonic-gate }
30807c478bd9Sstevel@tonic-gate
30817c478bd9Sstevel@tonic-gate void
show_iovec(private_t * pri,long offset,long niov,int showbuf,long count)30827c478bd9Sstevel@tonic-gate show_iovec(private_t *pri, long offset, long niov, int showbuf, long count)
30837c478bd9Sstevel@tonic-gate {
30847c478bd9Sstevel@tonic-gate iovec_t iovec[16];
30857c478bd9Sstevel@tonic-gate iovec_t *ip;
30867c478bd9Sstevel@tonic-gate long nb;
30877c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 4 && showbuf);
30887c478bd9Sstevel@tonic-gate
30897c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
30907c478bd9Sstevel@tonic-gate show_iovec32(pri, offset, niov, showbuf, count);
30917c478bd9Sstevel@tonic-gate return;
30927c478bd9Sstevel@tonic-gate }
30937c478bd9Sstevel@tonic-gate if (niov > 16) /* is this the real limit? */
30947c478bd9Sstevel@tonic-gate niov = 16;
30957c478bd9Sstevel@tonic-gate
3096*27aa4812SToomas Soome if (offset != 0 && niov > 0 &&
30977c478bd9Sstevel@tonic-gate Pread(Proc, &iovec[0], niov*sizeof (iovec_t), offset)
30987c478bd9Sstevel@tonic-gate == niov*sizeof (iovec_t)) {
30997c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
31007c478bd9Sstevel@tonic-gate if (serial)
31017c478bd9Sstevel@tonic-gate Eserialize();
31027c478bd9Sstevel@tonic-gate
31037c478bd9Sstevel@tonic-gate for (ip = &iovec[0]; niov-- && !interrupt; ip++) {
31047c478bd9Sstevel@tonic-gate (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n",
3105019c3c43Sraf pri->pname,
3106019c3c43Sraf (long)ip->iov_base,
3107019c3c43Sraf ip->iov_len);
31087c478bd9Sstevel@tonic-gate if ((nb = count) > 0) {
31097c478bd9Sstevel@tonic-gate if (nb > ip->iov_len)
31107c478bd9Sstevel@tonic-gate nb = ip->iov_len;
31117c478bd9Sstevel@tonic-gate if (nb > 0)
31127c478bd9Sstevel@tonic-gate count -= nb;
31137c478bd9Sstevel@tonic-gate }
31147c478bd9Sstevel@tonic-gate if (showbuf && nb > 0)
31157c478bd9Sstevel@tonic-gate showbuffer(pri, (long)ip->iov_base, nb);
31167c478bd9Sstevel@tonic-gate }
31177c478bd9Sstevel@tonic-gate
31187c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
31197c478bd9Sstevel@tonic-gate if (serial)
31207c478bd9Sstevel@tonic-gate Xserialize();
31217c478bd9Sstevel@tonic-gate }
31227c478bd9Sstevel@tonic-gate }
31237c478bd9Sstevel@tonic-gate
31247c478bd9Sstevel@tonic-gate void
show_dents32(private_t * pri,long offset,long count)31257c478bd9Sstevel@tonic-gate show_dents32(private_t *pri, long offset, long count)
31267c478bd9Sstevel@tonic-gate {
31277c478bd9Sstevel@tonic-gate long buf[MYBUFSIZ / sizeof (long)];
31287c478bd9Sstevel@tonic-gate struct dirent32 *dp;
31297c478bd9Sstevel@tonic-gate int serial = (count > 100);
31307c478bd9Sstevel@tonic-gate
31313b862e9aSRoger A. Faulkner if (offset == 0)
31327c478bd9Sstevel@tonic-gate return;
31337c478bd9Sstevel@tonic-gate
31347c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
31357c478bd9Sstevel@tonic-gate if (serial)
31367c478bd9Sstevel@tonic-gate Eserialize();
31377c478bd9Sstevel@tonic-gate
31387c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) {
31397c478bd9Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
31407c478bd9Sstevel@tonic-gate
31417c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
31427c478bd9Sstevel@tonic-gate break;
31437c478bd9Sstevel@tonic-gate
31447c478bd9Sstevel@tonic-gate dp = (struct dirent32 *)&buf[0];
31457c478bd9Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp))
31467c478bd9Sstevel@tonic-gate break;
31477c478bd9Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) {
31487c478bd9Sstevel@tonic-gate /* getdents() error? */
31497c478bd9Sstevel@tonic-gate (void) printf(
3150019c3c43Sraf "%s ino=%-5u off=%-4d rlen=%-3d\n",
3151019c3c43Sraf pri->pname,
3152019c3c43Sraf dp->d_ino,
3153019c3c43Sraf dp->d_off,
3154019c3c43Sraf dp->d_reclen);
31557c478bd9Sstevel@tonic-gate break;
31567c478bd9Sstevel@tonic-gate }
31577c478bd9Sstevel@tonic-gate
31587c478bd9Sstevel@tonic-gate while (!interrupt &&
31597c478bd9Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) &&
31607c478bd9Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) {
31617c478bd9Sstevel@tonic-gate (void) printf(
3162019c3c43Sraf "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3163019c3c43Sraf pri->pname,
3164019c3c43Sraf dp->d_ino,
3165019c3c43Sraf dp->d_off,
3166019c3c43Sraf dp->d_reclen,
3167019c3c43Sraf dp->d_reclen - (int)(dp->d_name - (char *)dp),
3168019c3c43Sraf dp->d_name);
31697c478bd9Sstevel@tonic-gate nb -= dp->d_reclen;
31707c478bd9Sstevel@tonic-gate count -= dp->d_reclen;
31717c478bd9Sstevel@tonic-gate offset += dp->d_reclen;
31727c478bd9Sstevel@tonic-gate /* LINTED improper alignment */
31737c478bd9Sstevel@tonic-gate dp = (struct dirent32 *)((char *)dp + dp->d_reclen);
31747c478bd9Sstevel@tonic-gate }
31757c478bd9Sstevel@tonic-gate }
31767c478bd9Sstevel@tonic-gate
31777c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
31787c478bd9Sstevel@tonic-gate if (serial)
31797c478bd9Sstevel@tonic-gate Xserialize();
31807c478bd9Sstevel@tonic-gate }
31817c478bd9Sstevel@tonic-gate
31827c478bd9Sstevel@tonic-gate void
show_dents64(private_t * pri,long offset,long count)31837c478bd9Sstevel@tonic-gate show_dents64(private_t *pri, long offset, long count)
31847c478bd9Sstevel@tonic-gate {
31857c478bd9Sstevel@tonic-gate long long buf[MYBUFSIZ / sizeof (long long)];
31867c478bd9Sstevel@tonic-gate struct dirent64 *dp;
31877c478bd9Sstevel@tonic-gate int serial = (count > 100);
31887c478bd9Sstevel@tonic-gate
31893b862e9aSRoger A. Faulkner if (offset == 0)
31907c478bd9Sstevel@tonic-gate return;
31917c478bd9Sstevel@tonic-gate
31927c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
31937c478bd9Sstevel@tonic-gate if (serial)
31947c478bd9Sstevel@tonic-gate Eserialize();
31957c478bd9Sstevel@tonic-gate
31967c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) {
31977c478bd9Sstevel@tonic-gate int nb = count < MYBUFSIZ? (int)count : MYBUFSIZ;
31987c478bd9Sstevel@tonic-gate
31997c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) <= 0)
32007c478bd9Sstevel@tonic-gate break;
32017c478bd9Sstevel@tonic-gate
32027c478bd9Sstevel@tonic-gate dp = (struct dirent64 *)&buf[0];
32037c478bd9Sstevel@tonic-gate if (nb < (int)(dp->d_name - (char *)dp))
32047c478bd9Sstevel@tonic-gate break;
32057c478bd9Sstevel@tonic-gate if ((unsigned)nb < dp->d_reclen) {
32067c478bd9Sstevel@tonic-gate /* getdents() error? */
32077c478bd9Sstevel@tonic-gate (void) printf(
3208019c3c43Sraf "%s ino=%-5llu off=%-4lld rlen=%-3d\n",
3209019c3c43Sraf pri->pname,
3210019c3c43Sraf (long long)dp->d_ino,
3211019c3c43Sraf (long long)dp->d_off,
3212019c3c43Sraf dp->d_reclen);
32137c478bd9Sstevel@tonic-gate break;
32147c478bd9Sstevel@tonic-gate }
32157c478bd9Sstevel@tonic-gate
32167c478bd9Sstevel@tonic-gate while (!interrupt &&
32177c478bd9Sstevel@tonic-gate nb >= (int)(dp->d_name - (char *)dp) &&
32187c478bd9Sstevel@tonic-gate (unsigned)nb >= dp->d_reclen) {
32197c478bd9Sstevel@tonic-gate (void) printf(
3220019c3c43Sraf "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3221019c3c43Sraf pri->pname,
3222019c3c43Sraf (long long)dp->d_ino,
3223019c3c43Sraf (long long)dp->d_off,
3224019c3c43Sraf dp->d_reclen,
3225019c3c43Sraf dp->d_reclen - (int)(dp->d_name - (char *)dp),
3226019c3c43Sraf dp->d_name);
32277c478bd9Sstevel@tonic-gate nb -= dp->d_reclen;
32287c478bd9Sstevel@tonic-gate count -= dp->d_reclen;
32297c478bd9Sstevel@tonic-gate offset += dp->d_reclen;
32307c478bd9Sstevel@tonic-gate /* LINTED improper alignment */
32317c478bd9Sstevel@tonic-gate dp = (struct dirent64 *)((char *)dp + dp->d_reclen);
32327c478bd9Sstevel@tonic-gate }
32337c478bd9Sstevel@tonic-gate }
32347c478bd9Sstevel@tonic-gate
32357c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
32367c478bd9Sstevel@tonic-gate if (serial)
32377c478bd9Sstevel@tonic-gate Xserialize();
32387c478bd9Sstevel@tonic-gate }
32397c478bd9Sstevel@tonic-gate
32407c478bd9Sstevel@tonic-gate void
show_rlimit32(private_t * pri,long offset)32417c478bd9Sstevel@tonic-gate show_rlimit32(private_t *pri, long offset)
32427c478bd9Sstevel@tonic-gate {
32437c478bd9Sstevel@tonic-gate struct rlimit32 rlimit;
32447c478bd9Sstevel@tonic-gate
3245*27aa4812SToomas Soome if (offset != 0 &&
32467c478bd9Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
32477c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname);
32487c478bd9Sstevel@tonic-gate switch (rlimit.rlim_cur) {
32497c478bd9Sstevel@tonic-gate case RLIM32_INFINITY:
32507c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_INFINITY", stdout);
32517c478bd9Sstevel@tonic-gate break;
32527c478bd9Sstevel@tonic-gate case RLIM32_SAVED_MAX:
32537c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_MAX", stdout);
32547c478bd9Sstevel@tonic-gate break;
32557c478bd9Sstevel@tonic-gate case RLIM32_SAVED_CUR:
32567c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM_SAVED_CUR", stdout);
32577c478bd9Sstevel@tonic-gate break;
32587c478bd9Sstevel@tonic-gate default:
32597c478bd9Sstevel@tonic-gate (void) printf("cur = %lu", (long)rlimit.rlim_cur);
32607c478bd9Sstevel@tonic-gate break;
32617c478bd9Sstevel@tonic-gate }
32627c478bd9Sstevel@tonic-gate switch (rlimit.rlim_max) {
32637c478bd9Sstevel@tonic-gate case RLIM32_INFINITY:
32647c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_INFINITY\n", stdout);
32657c478bd9Sstevel@tonic-gate break;
32667c478bd9Sstevel@tonic-gate case RLIM32_SAVED_MAX:
32677c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_MAX\n", stdout);
32687c478bd9Sstevel@tonic-gate break;
32697c478bd9Sstevel@tonic-gate case RLIM32_SAVED_CUR:
32707c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM_SAVED_CUR\n", stdout);
32717c478bd9Sstevel@tonic-gate break;
32727c478bd9Sstevel@tonic-gate default:
32737c478bd9Sstevel@tonic-gate (void) printf(" max = %lu\n", (long)rlimit.rlim_max);
32747c478bd9Sstevel@tonic-gate break;
32757c478bd9Sstevel@tonic-gate }
32767c478bd9Sstevel@tonic-gate }
32777c478bd9Sstevel@tonic-gate }
32787c478bd9Sstevel@tonic-gate
32797c478bd9Sstevel@tonic-gate void
show_rlimit64(private_t * pri,long offset)32807c478bd9Sstevel@tonic-gate show_rlimit64(private_t *pri, long offset)
32817c478bd9Sstevel@tonic-gate {
32827c478bd9Sstevel@tonic-gate struct rlimit64 rlimit;
32837c478bd9Sstevel@tonic-gate
3284*27aa4812SToomas Soome if (offset != 0 &&
32857c478bd9Sstevel@tonic-gate Pread(Proc, &rlimit, sizeof (rlimit), offset) == sizeof (rlimit)) {
32867c478bd9Sstevel@tonic-gate (void) printf("%s\t", pri->pname);
32877c478bd9Sstevel@tonic-gate switch (rlimit.rlim_cur) {
32887c478bd9Sstevel@tonic-gate case RLIM64_INFINITY:
32897c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_INFINITY", stdout);
32907c478bd9Sstevel@tonic-gate break;
32917c478bd9Sstevel@tonic-gate case RLIM64_SAVED_MAX:
32927c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_MAX", stdout);
32937c478bd9Sstevel@tonic-gate break;
32947c478bd9Sstevel@tonic-gate case RLIM64_SAVED_CUR:
32957c478bd9Sstevel@tonic-gate (void) fputs("cur = RLIM64_SAVED_CUR", stdout);
32967c478bd9Sstevel@tonic-gate break;
32977c478bd9Sstevel@tonic-gate default:
32987c478bd9Sstevel@tonic-gate (void) printf("cur = %llu",
32997c478bd9Sstevel@tonic-gate (unsigned long long)rlimit.rlim_cur);
33007c478bd9Sstevel@tonic-gate break;
33017c478bd9Sstevel@tonic-gate }
33027c478bd9Sstevel@tonic-gate switch (rlimit.rlim_max) {
33037c478bd9Sstevel@tonic-gate case RLIM64_INFINITY:
33047c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_INFINITY\n", stdout);
33057c478bd9Sstevel@tonic-gate break;
33067c478bd9Sstevel@tonic-gate case RLIM64_SAVED_MAX:
33077c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout);
33087c478bd9Sstevel@tonic-gate break;
33097c478bd9Sstevel@tonic-gate case RLIM64_SAVED_CUR:
33107c478bd9Sstevel@tonic-gate (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout);
33117c478bd9Sstevel@tonic-gate break;
33127c478bd9Sstevel@tonic-gate default:
33137c478bd9Sstevel@tonic-gate (void) printf(" max = %llu\n",
33147c478bd9Sstevel@tonic-gate (unsigned long long)rlimit.rlim_max);
33157c478bd9Sstevel@tonic-gate break;
33167c478bd9Sstevel@tonic-gate }
33177c478bd9Sstevel@tonic-gate }
33187c478bd9Sstevel@tonic-gate }
33197c478bd9Sstevel@tonic-gate
33207c478bd9Sstevel@tonic-gate void
show_nuname(private_t * pri,long offset)33217c478bd9Sstevel@tonic-gate show_nuname(private_t *pri, long offset)
33227c478bd9Sstevel@tonic-gate {
33237c478bd9Sstevel@tonic-gate struct utsname ubuf;
33247c478bd9Sstevel@tonic-gate
3325*27aa4812SToomas Soome if (offset != 0 &&
33267c478bd9Sstevel@tonic-gate Pread(Proc, &ubuf, sizeof (ubuf), offset) == sizeof (ubuf)) {
33277c478bd9Sstevel@tonic-gate (void) printf(
3328019c3c43Sraf "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3329019c3c43Sraf pri->pname,
3330019c3c43Sraf ubuf.sysname,
3331019c3c43Sraf ubuf.nodename,
3332019c3c43Sraf ubuf.release,
3333019c3c43Sraf ubuf.version,
3334019c3c43Sraf ubuf.machine);
33357c478bd9Sstevel@tonic-gate }
33367c478bd9Sstevel@tonic-gate }
33377c478bd9Sstevel@tonic-gate
33387c478bd9Sstevel@tonic-gate void
show_adjtime(private_t * pri,long off1,long off2)33397c478bd9Sstevel@tonic-gate show_adjtime(private_t *pri, long off1, long off2)
33407c478bd9Sstevel@tonic-gate {
33417c478bd9Sstevel@tonic-gate show_timeval(pri, off1, " delta");
33427c478bd9Sstevel@tonic-gate show_timeval(pri, off2, "olddelta");
33437c478bd9Sstevel@tonic-gate }
33447c478bd9Sstevel@tonic-gate
33457c478bd9Sstevel@tonic-gate void
show_sockaddr(private_t * pri,const char * str,long addroff,long lenoff,long len)33467c478bd9Sstevel@tonic-gate show_sockaddr(private_t *pri,
33470b09d754SToomas Soome const char *str, long addroff, long lenoff, long len)
33487c478bd9Sstevel@tonic-gate {
33497c478bd9Sstevel@tonic-gate /*
33507c478bd9Sstevel@tonic-gate * A buffer large enough for PATH_MAX size AF_UNIX address, which is
33517c478bd9Sstevel@tonic-gate * also large enough to store a sockaddr_in or a sockaddr_in6.
33527c478bd9Sstevel@tonic-gate */
33537c478bd9Sstevel@tonic-gate long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1)
3354019c3c43Sraf / sizeof (long)];
33557c478bd9Sstevel@tonic-gate struct sockaddr *sa = (struct sockaddr *)buf;
33567c478bd9Sstevel@tonic-gate struct sockaddr_in *sin = (struct sockaddr_in *)buf;
33577c478bd9Sstevel@tonic-gate struct sockaddr_un *soun = (struct sockaddr_un *)buf;
33587c478bd9Sstevel@tonic-gate struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf;
33597c478bd9Sstevel@tonic-gate char addrbuf[INET6_ADDRSTRLEN];
33607c478bd9Sstevel@tonic-gate
33617c478bd9Sstevel@tonic-gate if (lenoff != 0) {
33627c478bd9Sstevel@tonic-gate uint_t ilen;
33637c478bd9Sstevel@tonic-gate if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen))
33647c478bd9Sstevel@tonic-gate return;
33657c478bd9Sstevel@tonic-gate len = ilen;
33667c478bd9Sstevel@tonic-gate }
33677c478bd9Sstevel@tonic-gate
33687c478bd9Sstevel@tonic-gate if (len >= sizeof (buf)) /* protect against ridiculous length */
33697c478bd9Sstevel@tonic-gate len = sizeof (buf) - 1;
33707c478bd9Sstevel@tonic-gate if (Pread(Proc, buf, len, addroff) != len)
33717c478bd9Sstevel@tonic-gate return;
33727c478bd9Sstevel@tonic-gate
33737c478bd9Sstevel@tonic-gate switch (sa->sa_family) {
33747c478bd9Sstevel@tonic-gate case AF_INET6:
33757c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_INET6 %s = %s port = %u\n",
33767c478bd9Sstevel@tonic-gate pri->pname, str,
33777c478bd9Sstevel@tonic-gate inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf,
3378019c3c43Sraf sizeof (addrbuf)),
33797c478bd9Sstevel@tonic-gate ntohs(sin6->sin6_port));
33807c478bd9Sstevel@tonic-gate (void) printf("%s\tscope id = %u source id = 0x%x\n"
33817c478bd9Sstevel@tonic-gate "%s\tflow class = 0x%02x flow label = 0x%05x\n",
33827c478bd9Sstevel@tonic-gate pri->pname, ntohl(sin6->sin6_scope_id),
33837c478bd9Sstevel@tonic-gate ntohl(sin6->__sin6_src_id),
33847c478bd9Sstevel@tonic-gate pri->pname,
33857c478bd9Sstevel@tonic-gate ntohl((sin6->sin6_flowinfo & IPV6_FLOWINFO_TCLASS) >> 20),
33867c478bd9Sstevel@tonic-gate ntohl(sin6->sin6_flowinfo & IPV6_FLOWINFO_FLOWLABEL));
33877c478bd9Sstevel@tonic-gate break;
33887c478bd9Sstevel@tonic-gate case AF_INET:
33897c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_%s %s = %s port = %u\n",
33902caf0dcdSrshoaib pri->pname, "INET",
33917c478bd9Sstevel@tonic-gate str, inet_ntop(AF_INET, &sin->sin_addr, addrbuf,
33927c478bd9Sstevel@tonic-gate sizeof (addrbuf)), ntohs(sin->sin_port));
33937c478bd9Sstevel@tonic-gate break;
33947c478bd9Sstevel@tonic-gate case AF_UNIX:
33957c478bd9Sstevel@tonic-gate len -= sizeof (soun->sun_family);
33967c478bd9Sstevel@tonic-gate if (len >= 0) {
33977c478bd9Sstevel@tonic-gate /* Null terminate */
3398*27aa4812SToomas Soome soun->sun_path[len] = 0;
33997c478bd9Sstevel@tonic-gate (void) printf("%s\tAF_UNIX %s = %s\n", pri->pname,
3400019c3c43Sraf str, soun->sun_path);
34017c478bd9Sstevel@tonic-gate }
34027c478bd9Sstevel@tonic-gate break;
34037c478bd9Sstevel@tonic-gate }
34047c478bd9Sstevel@tonic-gate }
34057c478bd9Sstevel@tonic-gate
34067c478bd9Sstevel@tonic-gate void
show_msghdr(private_t * pri,long offset)34077c478bd9Sstevel@tonic-gate show_msghdr(private_t *pri, long offset)
34087c478bd9Sstevel@tonic-gate {
340981006e0fSja const lwpstatus_t *Lsp = pri->lwpstat;
341081006e0fSja int what = Lsp->pr_what;
341181006e0fSja int err = pri->Errno;
34127c478bd9Sstevel@tonic-gate struct msghdr msg;
341381006e0fSja int showbuf = FALSE;
341481006e0fSja int i = pri->sys_args[0]+1;
341581006e0fSja long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
34167c478bd9Sstevel@tonic-gate
34177c478bd9Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
34187c478bd9Sstevel@tonic-gate return;
341981006e0fSja
34207c478bd9Sstevel@tonic-gate if (msg.msg_name != NULL && msg.msg_namelen != 0)
34217c478bd9Sstevel@tonic-gate show_sockaddr(pri, "msg_name",
3422019c3c43Sraf (long)msg.msg_name, 0, (long)msg.msg_namelen);
342381006e0fSja
342481006e0fSja /*
342581006e0fSja * Print the iovec if the syscall was successful and the fd is
342681006e0fSja * part of the set being traced.
342781006e0fSja */
342881006e0fSja if ((what == SYS_recvmsg && !err &&
342981006e0fSja prismember(&readfd, i)) ||
343081006e0fSja (what == SYS_sendmsg &&
343181006e0fSja prismember(&writefd, i)))
343281006e0fSja showbuf = TRUE;
343381006e0fSja
343481006e0fSja show_iovec(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
343581006e0fSja
34367c478bd9Sstevel@tonic-gate }
34377c478bd9Sstevel@tonic-gate
34387c478bd9Sstevel@tonic-gate void
show_msghdr32(private_t * pri,long offset)34397c478bd9Sstevel@tonic-gate show_msghdr32(private_t *pri, long offset)
34407c478bd9Sstevel@tonic-gate {
34417c478bd9Sstevel@tonic-gate struct msghdr32 {
34427c478bd9Sstevel@tonic-gate caddr32_t msg_name;
344381006e0fSja uint32_t msg_namelen;
3444*27aa4812SToomas Soome caddr32_t msg_iov;
344581006e0fSja int32_t msg_iovlen;
34467c478bd9Sstevel@tonic-gate } msg;
344781006e0fSja const lwpstatus_t *Lsp = pri->lwpstat;
344881006e0fSja int what = Lsp->pr_what;
344981006e0fSja int err = pri->Errno;
345081006e0fSja int showbuf = FALSE;
345181006e0fSja int i = pri->sys_args[0]+1;
345281006e0fSja long nb = (what == SYS_recvmsg)? pri->Rval1 : 32*1024;
34537c478bd9Sstevel@tonic-gate
34547c478bd9Sstevel@tonic-gate if (Pread(Proc, &msg, sizeof (msg), offset) != sizeof (msg))
34557c478bd9Sstevel@tonic-gate return;
345681006e0fSja
3457*27aa4812SToomas Soome if (msg.msg_name != 0 && msg.msg_namelen != 0)
34587c478bd9Sstevel@tonic-gate show_sockaddr(pri, "msg_name",
3459019c3c43Sraf (long)msg.msg_name, 0, (long)msg.msg_namelen);
346081006e0fSja /*
346181006e0fSja * Print the iovec if the syscall was successful and the fd is
346281006e0fSja * part of the set being traced.
346381006e0fSja */
346481006e0fSja if ((what == SYS_recvmsg && !err &&
346581006e0fSja prismember(&readfd, i)) ||
346681006e0fSja (what == SYS_sendmsg &&
346781006e0fSja prismember(&writefd, i)))
346881006e0fSja showbuf = TRUE;
346981006e0fSja
347081006e0fSja show_iovec32(pri, (long)msg.msg_iov, msg.msg_iovlen, showbuf, nb);
347181006e0fSja
34727c478bd9Sstevel@tonic-gate }
34737c478bd9Sstevel@tonic-gate
34747c478bd9Sstevel@tonic-gate static void
show_doorargs(private_t * pri,long offset)34757c478bd9Sstevel@tonic-gate show_doorargs(private_t *pri, long offset)
34767c478bd9Sstevel@tonic-gate {
34777c478bd9Sstevel@tonic-gate door_arg_t args;
34787c478bd9Sstevel@tonic-gate
34797c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
34807c478bd9Sstevel@tonic-gate (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
34817c478bd9Sstevel@tonic-gate pri->pname,
34827c478bd9Sstevel@tonic-gate (ulong_t)args.data_ptr,
34837c478bd9Sstevel@tonic-gate (ulong_t)args.data_size);
34847c478bd9Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
34857c478bd9Sstevel@tonic-gate pri->pname,
34867c478bd9Sstevel@tonic-gate (ulong_t)args.desc_ptr,
34877c478bd9Sstevel@tonic-gate args.desc_num);
34887c478bd9Sstevel@tonic-gate (void) printf("%s\trbuf=0x%lX rsize=%lu\n",
34897c478bd9Sstevel@tonic-gate pri->pname,
34907c478bd9Sstevel@tonic-gate (ulong_t)args.rbuf,
34917c478bd9Sstevel@tonic-gate (ulong_t)args.rsize);
34927c478bd9Sstevel@tonic-gate }
34937c478bd9Sstevel@tonic-gate }
34947c478bd9Sstevel@tonic-gate
34957c478bd9Sstevel@tonic-gate static void
show_ucred_privsets(private_t * pri,ucred_t * uc)34967c478bd9Sstevel@tonic-gate show_ucred_privsets(private_t *pri, ucred_t *uc)
34977c478bd9Sstevel@tonic-gate {
34987c478bd9Sstevel@tonic-gate int i = 0;
34997c478bd9Sstevel@tonic-gate const priv_set_t *s;
35007c478bd9Sstevel@tonic-gate priv_ptype_t sn;
35017c478bd9Sstevel@tonic-gate char *str;
35027c478bd9Sstevel@tonic-gate
35037c478bd9Sstevel@tonic-gate while ((sn = priv_getsetbynum(i++)) != NULL) {
35047c478bd9Sstevel@tonic-gate s = ucred_getprivset(uc, sn);
35057c478bd9Sstevel@tonic-gate
35067c478bd9Sstevel@tonic-gate if (s == NULL)
35077c478bd9Sstevel@tonic-gate continue;
35087c478bd9Sstevel@tonic-gate
35097c478bd9Sstevel@tonic-gate (void) printf("%s\t%c: %s\n",
35107c478bd9Sstevel@tonic-gate pri->pname,
35117c478bd9Sstevel@tonic-gate *sn,
35127c478bd9Sstevel@tonic-gate str = priv_set_to_str(s, ',', PRIV_STR_SHORT));
35137c478bd9Sstevel@tonic-gate
35147c478bd9Sstevel@tonic-gate free(str);
35157c478bd9Sstevel@tonic-gate }
35167c478bd9Sstevel@tonic-gate }
35177c478bd9Sstevel@tonic-gate
35187c478bd9Sstevel@tonic-gate static void
show_ucred(private_t * pri,long offset)35197c478bd9Sstevel@tonic-gate show_ucred(private_t *pri, long offset)
35207c478bd9Sstevel@tonic-gate {
35217c478bd9Sstevel@tonic-gate ucred_t *uc = _ucred_alloc();
35227c478bd9Sstevel@tonic-gate size_t sz;
35237c478bd9Sstevel@tonic-gate
35247c478bd9Sstevel@tonic-gate if (uc == NULL)
35257c478bd9Sstevel@tonic-gate return;
35267c478bd9Sstevel@tonic-gate
35277c478bd9Sstevel@tonic-gate sz = Pread(Proc, uc, uc->uc_size, offset);
35287c478bd9Sstevel@tonic-gate
35297c478bd9Sstevel@tonic-gate /*
35307c478bd9Sstevel@tonic-gate * A new uc_size is read, it could be smaller than the previously
35317c478bd9Sstevel@tonic-gate * value. We accept short reads that fill the whole header.
35327c478bd9Sstevel@tonic-gate */
35337c478bd9Sstevel@tonic-gate if (sz >= sizeof (ucred_t) && sz >= uc->uc_size) {
3534f48205beScasper (void) printf("%s\teuid=%u egid=%u\n",
35357c478bd9Sstevel@tonic-gate pri->pname,
3536f48205beScasper ucred_geteuid(uc),
3537f48205beScasper ucred_getegid(uc));
3538f48205beScasper (void) printf("%s\truid=%u rgid=%u\n",
35397c478bd9Sstevel@tonic-gate pri->pname,
3540f48205beScasper ucred_getruid(uc),
3541f48205beScasper ucred_getrgid(uc));
35427c478bd9Sstevel@tonic-gate (void) printf("%s\tpid=%d zoneid=%d\n",
35437c478bd9Sstevel@tonic-gate pri->pname,
35447c478bd9Sstevel@tonic-gate (int)ucred_getpid(uc),
35457c478bd9Sstevel@tonic-gate (int)ucred_getzoneid(uc));
35467c478bd9Sstevel@tonic-gate show_ucred_privsets(pri, uc);
35477c478bd9Sstevel@tonic-gate }
35487c478bd9Sstevel@tonic-gate ucred_free(uc);
35497c478bd9Sstevel@tonic-gate }
35507c478bd9Sstevel@tonic-gate
35517c478bd9Sstevel@tonic-gate static void
show_privset(private_t * pri,long offset,size_t size,char * label)3552821c4a97Sdp show_privset(private_t *pri, long offset, size_t size, char *label)
35537c478bd9Sstevel@tonic-gate {
35547c478bd9Sstevel@tonic-gate priv_set_t *tmp = priv_allocset();
35557c478bd9Sstevel@tonic-gate size_t sz;
35567c478bd9Sstevel@tonic-gate
35577c478bd9Sstevel@tonic-gate if (tmp == NULL)
35587c478bd9Sstevel@tonic-gate return;
35597c478bd9Sstevel@tonic-gate
35607c478bd9Sstevel@tonic-gate sz = Pread(Proc, tmp, size, offset);
35617c478bd9Sstevel@tonic-gate
35627c478bd9Sstevel@tonic-gate if (sz == size) {
35637c478bd9Sstevel@tonic-gate char *str = priv_set_to_str(tmp, ',', PRIV_STR_SHORT);
35647c478bd9Sstevel@tonic-gate if (str != NULL) {
3565821c4a97Sdp (void) printf("%s\t%s%s\n", pri->pname, label, str);
35667c478bd9Sstevel@tonic-gate free(str);
35677c478bd9Sstevel@tonic-gate }
35687c478bd9Sstevel@tonic-gate }
35697c478bd9Sstevel@tonic-gate priv_freeset(tmp);
35707c478bd9Sstevel@tonic-gate }
35717c478bd9Sstevel@tonic-gate
35727c478bd9Sstevel@tonic-gate static void
show_doorinfo(private_t * pri,long offset)35737c478bd9Sstevel@tonic-gate show_doorinfo(private_t *pri, long offset)
35747c478bd9Sstevel@tonic-gate {
35757c478bd9Sstevel@tonic-gate door_info_t info;
35767c478bd9Sstevel@tonic-gate door_attr_t attr;
35777c478bd9Sstevel@tonic-gate
35787c478bd9Sstevel@tonic-gate if (Pread(Proc, &info, sizeof (info), offset) != sizeof (info))
35797c478bd9Sstevel@tonic-gate return;
35807c478bd9Sstevel@tonic-gate (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
35817c478bd9Sstevel@tonic-gate pri->pname,
35827c478bd9Sstevel@tonic-gate (int)info.di_target,
35837c478bd9Sstevel@tonic-gate info.di_proc,
35847c478bd9Sstevel@tonic-gate info.di_data);
35857c478bd9Sstevel@tonic-gate attr = info.di_attributes;
35867c478bd9Sstevel@tonic-gate (void) printf("%s\tattributes=%s\n", pri->pname, door_flags(pri, attr));
35877c478bd9Sstevel@tonic-gate (void) printf("%s\tuniquifier=%llu\n", pri->pname, info.di_uniquifier);
35887c478bd9Sstevel@tonic-gate }
35897c478bd9Sstevel@tonic-gate
35907c478bd9Sstevel@tonic-gate static void
show_doorparam(private_t * pri,long offset)35917c478bd9Sstevel@tonic-gate show_doorparam(private_t *pri, long offset)
35927c478bd9Sstevel@tonic-gate {
35937c478bd9Sstevel@tonic-gate ulong_t val;
35947c478bd9Sstevel@tonic-gate
35957c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
35967c478bd9Sstevel@tonic-gate (void) printf("%s\tvalue=%lu\n",
35977c478bd9Sstevel@tonic-gate pri->pname,
35987c478bd9Sstevel@tonic-gate val);
35997c478bd9Sstevel@tonic-gate }
36007c478bd9Sstevel@tonic-gate }
36017c478bd9Sstevel@tonic-gate
36027c478bd9Sstevel@tonic-gate
36037c478bd9Sstevel@tonic-gate static void
show_doorargs32(private_t * pri,long offset)36047c478bd9Sstevel@tonic-gate show_doorargs32(private_t *pri, long offset)
36057c478bd9Sstevel@tonic-gate {
36067c478bd9Sstevel@tonic-gate struct door_arg32 args;
36077c478bd9Sstevel@tonic-gate
36087c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36097c478bd9Sstevel@tonic-gate (void) printf("%s\tdata_ptr=%X data_size=%u\n",
36107c478bd9Sstevel@tonic-gate pri->pname,
36117c478bd9Sstevel@tonic-gate args.data_ptr,
36127c478bd9Sstevel@tonic-gate args.data_size);
36137c478bd9Sstevel@tonic-gate (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
36147c478bd9Sstevel@tonic-gate pri->pname,
36157c478bd9Sstevel@tonic-gate args.desc_ptr,
36167c478bd9Sstevel@tonic-gate args.desc_num);
36177c478bd9Sstevel@tonic-gate (void) printf("%s\trbuf=0x%X rsize=%u\n",
36187c478bd9Sstevel@tonic-gate pri->pname,
36197c478bd9Sstevel@tonic-gate args.rbuf,
36207c478bd9Sstevel@tonic-gate args.rsize);
36217c478bd9Sstevel@tonic-gate }
36227c478bd9Sstevel@tonic-gate }
36237c478bd9Sstevel@tonic-gate
36247c478bd9Sstevel@tonic-gate static void
show_doorparam32(private_t * pri,long offset)36257c478bd9Sstevel@tonic-gate show_doorparam32(private_t *pri, long offset)
36267c478bd9Sstevel@tonic-gate {
36277c478bd9Sstevel@tonic-gate uint_t val;
36287c478bd9Sstevel@tonic-gate
36297c478bd9Sstevel@tonic-gate if (Pread(Proc, &val, sizeof (val), offset) == sizeof (val)) {
36307c478bd9Sstevel@tonic-gate (void) printf("%s\tvalue=%u\n",
36317c478bd9Sstevel@tonic-gate pri->pname,
36327c478bd9Sstevel@tonic-gate val);
36337c478bd9Sstevel@tonic-gate }
36347c478bd9Sstevel@tonic-gate }
36357c478bd9Sstevel@tonic-gate
36367c478bd9Sstevel@tonic-gate
36377c478bd9Sstevel@tonic-gate static void
show_doors(private_t * pri)36387c478bd9Sstevel@tonic-gate show_doors(private_t *pri)
36397c478bd9Sstevel@tonic-gate {
36407c478bd9Sstevel@tonic-gate switch (pri->sys_args[5]) {
36417c478bd9Sstevel@tonic-gate case DOOR_CALL:
36427c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
36437c478bd9Sstevel@tonic-gate show_doorargs(pri, (long)pri->sys_args[1]);
36447c478bd9Sstevel@tonic-gate else
36457c478bd9Sstevel@tonic-gate show_doorargs32(pri, (long)pri->sys_args[1]);
36467c478bd9Sstevel@tonic-gate break;
36477c478bd9Sstevel@tonic-gate case DOOR_UCRED:
36487c478bd9Sstevel@tonic-gate if (!pri->Errno)
36497c478bd9Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[0]);
36507c478bd9Sstevel@tonic-gate break;
36517c478bd9Sstevel@tonic-gate case DOOR_INFO:
36527c478bd9Sstevel@tonic-gate if (!pri->Errno)
36537c478bd9Sstevel@tonic-gate show_doorinfo(pri, (long)pri->sys_args[1]);
36547c478bd9Sstevel@tonic-gate break;
36557c478bd9Sstevel@tonic-gate case DOOR_GETPARAM:
36567c478bd9Sstevel@tonic-gate if (!pri->Errno) {
36577c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
36587c478bd9Sstevel@tonic-gate show_doorparam(pri, (long)pri->sys_args[2]);
36597c478bd9Sstevel@tonic-gate else
36607c478bd9Sstevel@tonic-gate show_doorparam32(pri, (long)pri->sys_args[2]);
36617c478bd9Sstevel@tonic-gate }
36627c478bd9Sstevel@tonic-gate break;
36637c478bd9Sstevel@tonic-gate }
36647c478bd9Sstevel@tonic-gate }
36657c478bd9Sstevel@tonic-gate
36667c478bd9Sstevel@tonic-gate static void
show_portargs(private_t * pri,long offset)36677c478bd9Sstevel@tonic-gate show_portargs(private_t *pri, long offset)
36687c478bd9Sstevel@tonic-gate {
36697c478bd9Sstevel@tonic-gate port_event_t args;
36707c478bd9Sstevel@tonic-gate
36717c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36727c478bd9Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n",
36737c478bd9Sstevel@tonic-gate pri->pname,
36747c478bd9Sstevel@tonic-gate args.portev_events,
36757c478bd9Sstevel@tonic-gate args.portev_source);
36767c478bd9Sstevel@tonic-gate (void) printf("%s\tobject=0x%p user=0x%p\n",
36777c478bd9Sstevel@tonic-gate pri->pname,
36787c478bd9Sstevel@tonic-gate (void *)args.portev_object,
36797c478bd9Sstevel@tonic-gate (void *)args.portev_user);
36807c478bd9Sstevel@tonic-gate }
36817c478bd9Sstevel@tonic-gate }
36827c478bd9Sstevel@tonic-gate
36837c478bd9Sstevel@tonic-gate
36847c478bd9Sstevel@tonic-gate
36857c478bd9Sstevel@tonic-gate static void
show_portargs32(private_t * pri,long offset)36867c478bd9Sstevel@tonic-gate show_portargs32(private_t *pri, long offset)
36877c478bd9Sstevel@tonic-gate {
36887c478bd9Sstevel@tonic-gate port_event32_t args;
36897c478bd9Sstevel@tonic-gate
36907c478bd9Sstevel@tonic-gate if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
36917c478bd9Sstevel@tonic-gate (void) printf("%s\tevents=0x%x source=%u\n",
36927c478bd9Sstevel@tonic-gate pri->pname,
36937c478bd9Sstevel@tonic-gate args.portev_events,
36947c478bd9Sstevel@tonic-gate args.portev_source);
36957c478bd9Sstevel@tonic-gate (void) printf("%s\tobject=0x%x user=0x%x\n",
36967c478bd9Sstevel@tonic-gate pri->pname,
36977c478bd9Sstevel@tonic-gate args.portev_object,
36987c478bd9Sstevel@tonic-gate args.portev_user);
36997c478bd9Sstevel@tonic-gate }
37007c478bd9Sstevel@tonic-gate }
37017c478bd9Sstevel@tonic-gate
37027c478bd9Sstevel@tonic-gate
37037c478bd9Sstevel@tonic-gate static void
show_ports(private_t * pri)37047c478bd9Sstevel@tonic-gate show_ports(private_t *pri)
37057c478bd9Sstevel@tonic-gate {
37067c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
37077c478bd9Sstevel@tonic-gate case PORT_GET:
37087c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
37097c478bd9Sstevel@tonic-gate show_portargs(pri, (long)pri->sys_args[2]);
37107c478bd9Sstevel@tonic-gate else
37117c478bd9Sstevel@tonic-gate show_portargs32(pri, (long)pri->sys_args[2]);
37127c478bd9Sstevel@tonic-gate break;
37137c478bd9Sstevel@tonic-gate }
37147c478bd9Sstevel@tonic-gate }
37157c478bd9Sstevel@tonic-gate
37167c478bd9Sstevel@tonic-gate #define MAX_SNDFL_PRD 16
37177c478bd9Sstevel@tonic-gate
37187c478bd9Sstevel@tonic-gate
37197c478bd9Sstevel@tonic-gate static void
show_ksendfilevec32(private_t * pri,int fd,ksendfilevec32_t * sndvec,int sfvcnt)37207c478bd9Sstevel@tonic-gate show_ksendfilevec32(private_t *pri, int fd,
37217c478bd9Sstevel@tonic-gate ksendfilevec32_t *sndvec, int sfvcnt)
37227c478bd9Sstevel@tonic-gate {
37237c478bd9Sstevel@tonic-gate ksendfilevec32_t *snd_ptr, snd[MAX_SNDFL_PRD];
37247c478bd9Sstevel@tonic-gate size_t cpy_rqst;
37257c478bd9Sstevel@tonic-gate
37267c478bd9Sstevel@tonic-gate Eserialize();
37277c478bd9Sstevel@tonic-gate while (sfvcnt > 0) {
37287c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
37297c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst;
37307c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]);
37317c478bd9Sstevel@tonic-gate
37327c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
37337c478bd9Sstevel@tonic-gate break;
37347c478bd9Sstevel@tonic-gate
37357c478bd9Sstevel@tonic-gate snd_ptr = &snd[0];
37367c478bd9Sstevel@tonic-gate
37377c478bd9Sstevel@tonic-gate while (cpy_rqst) {
37387c478bd9Sstevel@tonic-gate (void) printf(
37397c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t"
37407c478bd9Sstevel@tonic-gate "sfv_off=%d\tsfv_len=%u\n",
37417c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd,
37427c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag,
37437c478bd9Sstevel@tonic-gate snd_ptr->sfv_off,
37447c478bd9Sstevel@tonic-gate snd_ptr->sfv_len);
37457c478bd9Sstevel@tonic-gate
37467c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF &&
37477c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) {
37487c478bd9Sstevel@tonic-gate showbuffer(pri,
37497c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff,
37507c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len);
37517c478bd9Sstevel@tonic-gate }
37527c478bd9Sstevel@tonic-gate
37537c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]);
37547c478bd9Sstevel@tonic-gate snd_ptr++;
37557c478bd9Sstevel@tonic-gate }
37567c478bd9Sstevel@tonic-gate
37577c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD;
37587c478bd9Sstevel@tonic-gate }
37597c478bd9Sstevel@tonic-gate Xserialize();
37607c478bd9Sstevel@tonic-gate }
37617c478bd9Sstevel@tonic-gate
37627c478bd9Sstevel@tonic-gate static void
show_ksendfilevec64(private_t * pri,int fd,ksendfilevec64_t * sndvec,int sfvcnt)37637c478bd9Sstevel@tonic-gate show_ksendfilevec64(private_t *pri, int fd,
37647c478bd9Sstevel@tonic-gate ksendfilevec64_t *sndvec, int sfvcnt)
37657c478bd9Sstevel@tonic-gate {
37667c478bd9Sstevel@tonic-gate ksendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
37677c478bd9Sstevel@tonic-gate size_t cpy_rqst;
37687c478bd9Sstevel@tonic-gate
37697c478bd9Sstevel@tonic-gate Eserialize();
37707c478bd9Sstevel@tonic-gate while (sfvcnt > 0) {
37717c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
37727c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst;
37737c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]);
37747c478bd9Sstevel@tonic-gate
37757c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
37767c478bd9Sstevel@tonic-gate break;
37777c478bd9Sstevel@tonic-gate
37787c478bd9Sstevel@tonic-gate snd_ptr = &snd[0];
37797c478bd9Sstevel@tonic-gate
37807c478bd9Sstevel@tonic-gate while (cpy_rqst) {
37817c478bd9Sstevel@tonic-gate (void) printf(
37827c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t"
37837c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%u\n",
37847c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd,
37857c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag,
37867c478bd9Sstevel@tonic-gate snd_ptr->sfv_off,
37877c478bd9Sstevel@tonic-gate snd_ptr->sfv_len);
37887c478bd9Sstevel@tonic-gate
37897c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF &&
37907c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) {
37917c478bd9Sstevel@tonic-gate showbuffer(pri,
37927c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_off & 0xffffffff,
37937c478bd9Sstevel@tonic-gate (long)snd_ptr->sfv_len);
37947c478bd9Sstevel@tonic-gate }
37957c478bd9Sstevel@tonic-gate
37967c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]);
37977c478bd9Sstevel@tonic-gate snd_ptr++;
37987c478bd9Sstevel@tonic-gate }
37997c478bd9Sstevel@tonic-gate
38007c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD;
38017c478bd9Sstevel@tonic-gate }
38027c478bd9Sstevel@tonic-gate Xserialize();
38037c478bd9Sstevel@tonic-gate }
38047c478bd9Sstevel@tonic-gate
38057c478bd9Sstevel@tonic-gate
38067c478bd9Sstevel@tonic-gate /*ARGSUSED*/
38077c478bd9Sstevel@tonic-gate static void
show_sendfilevec(private_t * pri,int fd,sendfilevec_t * sndvec,int sfvcnt)38087c478bd9Sstevel@tonic-gate show_sendfilevec(private_t *pri, int fd, sendfilevec_t *sndvec, int sfvcnt)
38097c478bd9Sstevel@tonic-gate {
38107c478bd9Sstevel@tonic-gate sendfilevec_t *snd_ptr, snd[MAX_SNDFL_PRD];
38117c478bd9Sstevel@tonic-gate size_t cpy_rqst;
38127c478bd9Sstevel@tonic-gate
38137c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
38147c478bd9Sstevel@tonic-gate show_ksendfilevec32(pri, fd,
38157c478bd9Sstevel@tonic-gate (ksendfilevec32_t *)sndvec, sfvcnt);
38167c478bd9Sstevel@tonic-gate return;
38177c478bd9Sstevel@tonic-gate }
38187c478bd9Sstevel@tonic-gate Eserialize();
38197c478bd9Sstevel@tonic-gate while (sfvcnt > 0) {
38207c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
38217c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst;
38227c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]);
38237c478bd9Sstevel@tonic-gate
38247c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
38257c478bd9Sstevel@tonic-gate break;
38267c478bd9Sstevel@tonic-gate
38277c478bd9Sstevel@tonic-gate snd_ptr = &snd[0];
38287c478bd9Sstevel@tonic-gate
38297c478bd9Sstevel@tonic-gate while (cpy_rqst) {
38307c478bd9Sstevel@tonic-gate (void) printf(
38317c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t"
38327c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n",
38337c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd,
38347c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag,
38357c478bd9Sstevel@tonic-gate snd_ptr->sfv_off,
38367c478bd9Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len);
38377c478bd9Sstevel@tonic-gate
38387c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF &&
38397c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) {
38407c478bd9Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off,
3841019c3c43Sraf (long)snd_ptr->sfv_len);
38427c478bd9Sstevel@tonic-gate }
38437c478bd9Sstevel@tonic-gate
38447c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]);
38457c478bd9Sstevel@tonic-gate snd_ptr++;
38467c478bd9Sstevel@tonic-gate }
38477c478bd9Sstevel@tonic-gate
38487c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD;
38497c478bd9Sstevel@tonic-gate }
38507c478bd9Sstevel@tonic-gate Xserialize();
38517c478bd9Sstevel@tonic-gate }
38527c478bd9Sstevel@tonic-gate
38537c478bd9Sstevel@tonic-gate /*ARGSUSED*/
38547c478bd9Sstevel@tonic-gate static void
show_sendfilevec64(private_t * pri,int fd,sendfilevec64_t * sndvec,int sfvcnt)38557c478bd9Sstevel@tonic-gate show_sendfilevec64(private_t *pri, int fd, sendfilevec64_t *sndvec, int sfvcnt)
38567c478bd9Sstevel@tonic-gate {
38577c478bd9Sstevel@tonic-gate sendfilevec64_t *snd_ptr, snd[MAX_SNDFL_PRD];
38587c478bd9Sstevel@tonic-gate size_t cpy_rqst;
38597c478bd9Sstevel@tonic-gate
38607c478bd9Sstevel@tonic-gate if (data_model != PR_MODEL_LP64) {
38617c478bd9Sstevel@tonic-gate show_ksendfilevec64(pri, fd,
38627c478bd9Sstevel@tonic-gate (ksendfilevec64_t *)sndvec, sfvcnt);
38637c478bd9Sstevel@tonic-gate return;
38647c478bd9Sstevel@tonic-gate }
38657c478bd9Sstevel@tonic-gate
38667c478bd9Sstevel@tonic-gate Eserialize();
38677c478bd9Sstevel@tonic-gate while (sfvcnt > 0) {
38687c478bd9Sstevel@tonic-gate cpy_rqst = MIN(sfvcnt, MAX_SNDFL_PRD);
38697c478bd9Sstevel@tonic-gate sfvcnt -= cpy_rqst;
38707c478bd9Sstevel@tonic-gate cpy_rqst *= sizeof (snd[0]);
38717c478bd9Sstevel@tonic-gate
38727c478bd9Sstevel@tonic-gate if (Pread(Proc, snd, cpy_rqst, (uintptr_t)sndvec) != cpy_rqst)
38737c478bd9Sstevel@tonic-gate break;
38747c478bd9Sstevel@tonic-gate
38757c478bd9Sstevel@tonic-gate snd_ptr = &snd[0];
38767c478bd9Sstevel@tonic-gate
38777c478bd9Sstevel@tonic-gate while (cpy_rqst) {
38787c478bd9Sstevel@tonic-gate (void) printf(
38797c478bd9Sstevel@tonic-gate "sfv_fd=%d\tsfv_flag=0x%x\t"
38807c478bd9Sstevel@tonic-gate "sfv_off=%ld\tsfv_len=%lu\n",
38817c478bd9Sstevel@tonic-gate snd_ptr->sfv_fd,
38827c478bd9Sstevel@tonic-gate snd_ptr->sfv_flag,
38837c478bd9Sstevel@tonic-gate snd_ptr->sfv_off,
38847c478bd9Sstevel@tonic-gate (ulong_t)snd_ptr->sfv_len);
38857c478bd9Sstevel@tonic-gate
38867c478bd9Sstevel@tonic-gate if (snd_ptr->sfv_fd == SFV_FD_SELF &&
38877c478bd9Sstevel@tonic-gate prismember(&writefd, fd)) {
38887c478bd9Sstevel@tonic-gate showbuffer(pri, (long)snd_ptr->sfv_off,
3889019c3c43Sraf (long)snd_ptr->sfv_len);
38907c478bd9Sstevel@tonic-gate }
38917c478bd9Sstevel@tonic-gate
38927c478bd9Sstevel@tonic-gate cpy_rqst -= sizeof (snd[0]);
38937c478bd9Sstevel@tonic-gate snd_ptr++;
38947c478bd9Sstevel@tonic-gate }
38957c478bd9Sstevel@tonic-gate
38967c478bd9Sstevel@tonic-gate sndvec += MAX_SNDFL_PRD;
38977c478bd9Sstevel@tonic-gate }
38987c478bd9Sstevel@tonic-gate Xserialize();
38997c478bd9Sstevel@tonic-gate }
39007c478bd9Sstevel@tonic-gate
39017c478bd9Sstevel@tonic-gate static void
show_memcntl_mha(private_t * pri,long offset)39027c478bd9Sstevel@tonic-gate show_memcntl_mha(private_t *pri, long offset)
39037c478bd9Sstevel@tonic-gate {
39047c478bd9Sstevel@tonic-gate struct memcntl_mha mha;
39057c478bd9Sstevel@tonic-gate const char *s = NULL;
39067c478bd9Sstevel@tonic-gate
39077c478bd9Sstevel@tonic-gate if (Pread(Proc, &mha, sizeof (mha), offset) == sizeof (mha)) {
39087c478bd9Sstevel@tonic-gate switch (mha.mha_cmd) {
39097c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break;
39107c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break;
39117c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break;
39127c478bd9Sstevel@tonic-gate }
39137c478bd9Sstevel@tonic-gate if (s)
39147c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
39157c478bd9Sstevel@tonic-gate " mha_pagesize=%lu\n",
39167c478bd9Sstevel@tonic-gate pri->pname, s, mha.mha_flags,
39177c478bd9Sstevel@tonic-gate (ulong_t)mha.mha_pagesize);
39187c478bd9Sstevel@tonic-gate else
39197c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
39207c478bd9Sstevel@tonic-gate " mha_pagesize=%lu\n",
39217c478bd9Sstevel@tonic-gate pri->pname, mha.mha_cmd, mha.mha_flags,
39227c478bd9Sstevel@tonic-gate (ulong_t)mha.mha_pagesize);
39237c478bd9Sstevel@tonic-gate }
39247c478bd9Sstevel@tonic-gate }
39257c478bd9Sstevel@tonic-gate
39267c478bd9Sstevel@tonic-gate
39277c478bd9Sstevel@tonic-gate static void
show_memcntl_mha32(private_t * pri,long offset)39287c478bd9Sstevel@tonic-gate show_memcntl_mha32(private_t *pri, long offset)
39297c478bd9Sstevel@tonic-gate {
39307c478bd9Sstevel@tonic-gate struct memcntl_mha32 mha32;
39317c478bd9Sstevel@tonic-gate const char *s = NULL;
39327c478bd9Sstevel@tonic-gate
39337c478bd9Sstevel@tonic-gate if (Pread(Proc, &mha32, sizeof (mha32), offset) ==
39347c478bd9Sstevel@tonic-gate sizeof (mha32)) {
39357c478bd9Sstevel@tonic-gate switch (mha32.mha_cmd) {
39367c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_VA: s = "MHA_MAPSIZE_VA"; break;
39377c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_BSSBRK: s = "MHA_MAPSIZE_BSSBRK"; break;
39387c478bd9Sstevel@tonic-gate case MHA_MAPSIZE_STACK: s = "MHA_MAPSIZE_STACK"; break;
39397c478bd9Sstevel@tonic-gate }
39407c478bd9Sstevel@tonic-gate if (s)
39417c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
39427c478bd9Sstevel@tonic-gate " mha_pagesize=%u\n",
39437c478bd9Sstevel@tonic-gate pri->pname, s, mha32.mha_flags, mha32.mha_pagesize);
39447c478bd9Sstevel@tonic-gate else
39457c478bd9Sstevel@tonic-gate (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
39467c478bd9Sstevel@tonic-gate " mha_pagesize=%u\n",
39477c478bd9Sstevel@tonic-gate pri->pname, mha32.mha_cmd, mha32.mha_flags,
39487c478bd9Sstevel@tonic-gate mha32.mha_pagesize);
39497c478bd9Sstevel@tonic-gate }
39507c478bd9Sstevel@tonic-gate }
39517c478bd9Sstevel@tonic-gate
39527c478bd9Sstevel@tonic-gate
39537c478bd9Sstevel@tonic-gate static void
show_memcntl(private_t * pri)39547c478bd9Sstevel@tonic-gate show_memcntl(private_t *pri)
39557c478bd9Sstevel@tonic-gate {
39567c478bd9Sstevel@tonic-gate
39577c478bd9Sstevel@tonic-gate if ((int)pri->sys_args[2] != MC_HAT_ADVISE)
39587c478bd9Sstevel@tonic-gate return;
39597c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_LP64)
39607c478bd9Sstevel@tonic-gate show_memcntl_mha(pri, (long)pri->sys_args[3]);
39617c478bd9Sstevel@tonic-gate else
39627c478bd9Sstevel@tonic-gate show_memcntl_mha32(pri, (long)pri->sys_args[3]);
39637c478bd9Sstevel@tonic-gate }
39647c478bd9Sstevel@tonic-gate
39657c478bd9Sstevel@tonic-gate void
show_ids(private_t * pri,long offset,int count)39667c478bd9Sstevel@tonic-gate show_ids(private_t *pri, long offset, int count)
39677c478bd9Sstevel@tonic-gate {
39687c478bd9Sstevel@tonic-gate id_t buf[MYBUFSIZ / sizeof (id_t)];
39697c478bd9Sstevel@tonic-gate id_t *idp;
39707c478bd9Sstevel@tonic-gate int serial = (count > MYBUFSIZ / 48);
39717c478bd9Sstevel@tonic-gate
39723b862e9aSRoger A. Faulkner if (offset == 0)
39737c478bd9Sstevel@tonic-gate return;
39747c478bd9Sstevel@tonic-gate
39757c478bd9Sstevel@tonic-gate /* enter region of lengthy output */
39767c478bd9Sstevel@tonic-gate if (serial)
39777c478bd9Sstevel@tonic-gate Eserialize();
39787c478bd9Sstevel@tonic-gate
39797c478bd9Sstevel@tonic-gate while (count > 0 && !interrupt) {
39807c478bd9Sstevel@tonic-gate ssize_t nb = (count * sizeof (id_t) < MYBUFSIZ)?
3981019c3c43Sraf count * sizeof (id_t) : MYBUFSIZ;
39827c478bd9Sstevel@tonic-gate
39837c478bd9Sstevel@tonic-gate if ((nb = Pread(Proc, &buf[0], (size_t)nb, offset)) < 0 ||
39847c478bd9Sstevel@tonic-gate nb < sizeof (id_t))
39857c478bd9Sstevel@tonic-gate break;
39867c478bd9Sstevel@tonic-gate
39877c478bd9Sstevel@tonic-gate idp = buf;
39887c478bd9Sstevel@tonic-gate while (!interrupt && nb >= sizeof (id_t)) {
39897c478bd9Sstevel@tonic-gate (void) printf("%s\t%8d\n", pri->pname, (int)*idp);
39907c478bd9Sstevel@tonic-gate offset += sizeof (id_t);
39917c478bd9Sstevel@tonic-gate nb -= sizeof (id_t);
39927c478bd9Sstevel@tonic-gate idp++;
39937c478bd9Sstevel@tonic-gate count--;
39947c478bd9Sstevel@tonic-gate }
39957c478bd9Sstevel@tonic-gate }
39967c478bd9Sstevel@tonic-gate
39977c478bd9Sstevel@tonic-gate /* exit region of lengthy output */
39987c478bd9Sstevel@tonic-gate if (serial)
39997c478bd9Sstevel@tonic-gate Xserialize();
40007c478bd9Sstevel@tonic-gate }
40017c478bd9Sstevel@tonic-gate
40027c478bd9Sstevel@tonic-gate void
show_ntp_gettime(private_t * pri)40037c478bd9Sstevel@tonic-gate show_ntp_gettime(private_t *pri)
40047c478bd9Sstevel@tonic-gate {
40057c478bd9Sstevel@tonic-gate struct ntptimeval ntv;
40067c478bd9Sstevel@tonic-gate long offset;
40077c478bd9Sstevel@tonic-gate
4008*27aa4812SToomas Soome if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
40097c478bd9Sstevel@tonic-gate return;
40107c478bd9Sstevel@tonic-gate
40117c478bd9Sstevel@tonic-gate if (data_model == PR_MODEL_NATIVE) {
40127c478bd9Sstevel@tonic-gate if (Pread(Proc, &ntv, sizeof (ntv), offset)
40137c478bd9Sstevel@tonic-gate != sizeof (ntv))
40147c478bd9Sstevel@tonic-gate return;
40157c478bd9Sstevel@tonic-gate } else {
40167c478bd9Sstevel@tonic-gate struct ntptimeval32 ntv32;
40177c478bd9Sstevel@tonic-gate
40187c478bd9Sstevel@tonic-gate if (Pread(Proc, &ntv32, sizeof (ntv32), offset)
40197c478bd9Sstevel@tonic-gate != sizeof (ntv32))
40207c478bd9Sstevel@tonic-gate return;
40217c478bd9Sstevel@tonic-gate
40227c478bd9Sstevel@tonic-gate TIMEVAL32_TO_TIMEVAL(&ntv.time, &ntv32.time);
40237c478bd9Sstevel@tonic-gate ntv.maxerror = ntv32.maxerror;
40247c478bd9Sstevel@tonic-gate ntv.esterror = ntv32.esterror;
40257c478bd9Sstevel@tonic-gate }
40267c478bd9Sstevel@tonic-gate
40277c478bd9Sstevel@tonic-gate (void) printf("\ttime: %ld.%6.6ld sec\n",
40287c478bd9Sstevel@tonic-gate ntv.time.tv_sec, ntv.time.tv_usec);
40297c478bd9Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", ntv.maxerror);
40307c478bd9Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", ntv.esterror);
40317c478bd9Sstevel@tonic-gate }
40327c478bd9Sstevel@tonic-gate
40337c478bd9Sstevel@tonic-gate static char *
get_timex_modes(private_t * pri,uint32_t val)40347c478bd9Sstevel@tonic-gate get_timex_modes(private_t *pri, uint32_t val)
40357c478bd9Sstevel@tonic-gate {
40367c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
40377c478bd9Sstevel@tonic-gate size_t used = 0;
40387c478bd9Sstevel@tonic-gate
40397c478bd9Sstevel@tonic-gate *str = '\0';
40407c478bd9Sstevel@tonic-gate if (val & MOD_OFFSET)
40417c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_OFFSET", sizeof (pri->code_buf));
40427c478bd9Sstevel@tonic-gate if (val & MOD_FREQUENCY)
40437c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_FREQUENCY", sizeof (pri->code_buf));
40447c478bd9Sstevel@tonic-gate if (val & MOD_MAXERROR)
40457c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_MAXERROR", sizeof (pri->code_buf));
40467c478bd9Sstevel@tonic-gate if (val & MOD_ESTERROR)
40477c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_ESTERROR", sizeof (pri->code_buf));
40487c478bd9Sstevel@tonic-gate if (val & MOD_STATUS)
40497c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_STATUS", sizeof (pri->code_buf));
40507c478bd9Sstevel@tonic-gate if (val & MOD_TIMECONST)
40517c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_TIMECONST", sizeof (pri->code_buf));
40527c478bd9Sstevel@tonic-gate if (val & MOD_CLKB)
40537c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKB", sizeof (pri->code_buf));
40547c478bd9Sstevel@tonic-gate if (val & MOD_CLKA)
40557c478bd9Sstevel@tonic-gate used = strlcat(str, "|MOD_CLKA", sizeof (pri->code_buf));
40567c478bd9Sstevel@tonic-gate
40577c478bd9Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf))
40587c478bd9Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
40597c478bd9Sstevel@tonic-gate
40607c478bd9Sstevel@tonic-gate return (str + 1);
40617c478bd9Sstevel@tonic-gate }
40627c478bd9Sstevel@tonic-gate
40637c478bd9Sstevel@tonic-gate static char *
get_timex_status(private_t * pri,int32_t val)40647c478bd9Sstevel@tonic-gate get_timex_status(private_t *pri, int32_t val)
40657c478bd9Sstevel@tonic-gate {
40667c478bd9Sstevel@tonic-gate char *str = pri->code_buf;
40677c478bd9Sstevel@tonic-gate size_t used = 0;
40687c478bd9Sstevel@tonic-gate
40697c478bd9Sstevel@tonic-gate *str = '\0';
40707c478bd9Sstevel@tonic-gate if (val & STA_PLL)
40717c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PLL", sizeof (pri->code_buf));
40727c478bd9Sstevel@tonic-gate if (val & STA_PPSFREQ)
40737c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSFREQ", sizeof (pri->code_buf));
40747c478bd9Sstevel@tonic-gate if (val & STA_PPSTIME)
40757c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSTIME", sizeof (pri->code_buf));
40767c478bd9Sstevel@tonic-gate if (val & STA_FLL)
40777c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_FLL", sizeof (pri->code_buf));
40787c478bd9Sstevel@tonic-gate
40797c478bd9Sstevel@tonic-gate if (val & STA_INS)
40807c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_INS", sizeof (pri->code_buf));
40817c478bd9Sstevel@tonic-gate if (val & STA_DEL)
40827c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_DEL", sizeof (pri->code_buf));
40837c478bd9Sstevel@tonic-gate if (val & STA_UNSYNC)
40847c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_UNSYNC", sizeof (pri->code_buf));
40857c478bd9Sstevel@tonic-gate if (val & STA_FREQHOLD)
40867c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_FREQHOLD", sizeof (pri->code_buf));
40877c478bd9Sstevel@tonic-gate
40887c478bd9Sstevel@tonic-gate if (val & STA_PPSSIGNAL)
40897c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSSIGNAL", sizeof (pri->code_buf));
40907c478bd9Sstevel@tonic-gate if (val & STA_PPSJITTER)
40917c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSJITTER", sizeof (pri->code_buf));
40927c478bd9Sstevel@tonic-gate if (val & STA_PPSWANDER)
40937c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSWANDER", sizeof (pri->code_buf));
40947c478bd9Sstevel@tonic-gate if (val & STA_PPSERROR)
40957c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_PPSERROR", sizeof (pri->code_buf));
40967c478bd9Sstevel@tonic-gate
40977c478bd9Sstevel@tonic-gate if (val & STA_CLOCKERR)
40987c478bd9Sstevel@tonic-gate used = strlcat(str, "|STA_CLOCKERR", sizeof (pri->code_buf));
40997c478bd9Sstevel@tonic-gate
41007c478bd9Sstevel@tonic-gate if (used == 0 || used >= sizeof (pri->code_buf))
41017c478bd9Sstevel@tonic-gate (void) snprintf(str, sizeof (pri->code_buf), " 0x%.4x", val);
41027c478bd9Sstevel@tonic-gate
41037c478bd9Sstevel@tonic-gate return (str + 1);
41047c478bd9Sstevel@tonic-gate }
41057c478bd9Sstevel@tonic-gate
41067c478bd9Sstevel@tonic-gate void
show_ntp_adjtime(private_t * pri)41077c478bd9Sstevel@tonic-gate show_ntp_adjtime(private_t *pri)
41087c478bd9Sstevel@tonic-gate {
41097c478bd9Sstevel@tonic-gate struct timex timex;
41107c478bd9Sstevel@tonic-gate long offset;
41117c478bd9Sstevel@tonic-gate
4112*27aa4812SToomas Soome if (pri->sys_nargs < 1 || (offset = pri->sys_args[0]) == 0)
41137c478bd9Sstevel@tonic-gate return;
41147c478bd9Sstevel@tonic-gate
41157c478bd9Sstevel@tonic-gate if (Pread(Proc, &timex, sizeof (timex), offset) != sizeof (timex))
41167c478bd9Sstevel@tonic-gate return;
41177c478bd9Sstevel@tonic-gate
41187c478bd9Sstevel@tonic-gate (void) printf("\tmodes: %s\n", get_timex_modes(pri, timex.modes));
41197c478bd9Sstevel@tonic-gate (void) printf("\toffset: %11d usec\n", timex.offset);
41207c478bd9Sstevel@tonic-gate (void) printf("\tfreq: %11d scaled ppm\n", timex.freq);
41217c478bd9Sstevel@tonic-gate (void) printf("\tmaxerror: %11d usec\n", timex.maxerror);
41227c478bd9Sstevel@tonic-gate (void) printf("\testerror: %11d usec\n", timex.esterror);
41237c478bd9Sstevel@tonic-gate (void) printf("\tstatus: %s\n", get_timex_status(pri, timex.status));
41247c478bd9Sstevel@tonic-gate (void) printf("\tconstant: %11d\n", timex.constant);
41257c478bd9Sstevel@tonic-gate (void) printf("\tprecision: %11d usec\n", timex.precision);
41267c478bd9Sstevel@tonic-gate (void) printf("\ttolerance: %11d scaled ppm\n", timex.tolerance);
41277c478bd9Sstevel@tonic-gate (void) printf("\tppsfreq: %11d scaled ppm\n", timex.ppsfreq);
41287c478bd9Sstevel@tonic-gate (void) printf("\tjitter: %11d usec\n", timex.jitter);
41297c478bd9Sstevel@tonic-gate (void) printf("\tshift: %11d sec\n", timex.shift);
41307c478bd9Sstevel@tonic-gate (void) printf("\tstabil: %11d scaled ppm\n", timex.stabil);
41317c478bd9Sstevel@tonic-gate (void) printf("\tjitcnt: %11d\n", timex.jitcnt);
41327c478bd9Sstevel@tonic-gate (void) printf("\tcalcnt: %11d\n", timex.calcnt);
41337c478bd9Sstevel@tonic-gate (void) printf("\terrcnt: %11d\n", timex.errcnt);
41347c478bd9Sstevel@tonic-gate (void) printf("\tstbcnt: %11d\n", timex.stbcnt);
41357c478bd9Sstevel@tonic-gate }
41367c478bd9Sstevel@tonic-gate
41377c478bd9Sstevel@tonic-gate void
show_getrusage(long offset)41387c478bd9Sstevel@tonic-gate show_getrusage(long offset)
41397c478bd9Sstevel@tonic-gate {
41407c478bd9Sstevel@tonic-gate struct rusage r;
41417c478bd9Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
41427c478bd9Sstevel@tonic-gate return;
41437c478bd9Sstevel@tonic-gate (void) printf("\t user time: %ld.%6.6ld sec\n",
41447c478bd9Sstevel@tonic-gate r.ru_utime.tv_sec,
41457c478bd9Sstevel@tonic-gate r.ru_utime.tv_usec);
41467c478bd9Sstevel@tonic-gate (void) printf("\t system time: %ld.%6.6ld sec\n",
41477c478bd9Sstevel@tonic-gate r.ru_stime.tv_sec,
41487c478bd9Sstevel@tonic-gate r.ru_stime.tv_usec);
41497c478bd9Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %ld\n",
41507c478bd9Sstevel@tonic-gate r.ru_maxrss);
41517c478bd9Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %ld\n",
41527c478bd9Sstevel@tonic-gate r.ru_ixrss);
41537c478bd9Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %ld\n",
41547c478bd9Sstevel@tonic-gate r.ru_idrss);
41557c478bd9Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %ld\n",
41567c478bd9Sstevel@tonic-gate r.ru_isrss);
41577c478bd9Sstevel@tonic-gate (void) printf("\t minor faults: %ld\n",
41587c478bd9Sstevel@tonic-gate r.ru_minflt);
41597c478bd9Sstevel@tonic-gate (void) printf("\t major faults: %ld\n",
41607c478bd9Sstevel@tonic-gate r.ru_majflt);
41617c478bd9Sstevel@tonic-gate (void) printf("\t # of swaps: %ld\n",
41627c478bd9Sstevel@tonic-gate r.ru_nswap);
41637c478bd9Sstevel@tonic-gate (void) printf("\t blocked inputs: %ld\n",
41647c478bd9Sstevel@tonic-gate r.ru_inblock);
41657c478bd9Sstevel@tonic-gate (void) printf("\t blocked outputs: %ld\n",
41667c478bd9Sstevel@tonic-gate r.ru_oublock);
41677c478bd9Sstevel@tonic-gate (void) printf("\t msgs sent: %ld\n",
41687c478bd9Sstevel@tonic-gate r.ru_msgsnd);
41697c478bd9Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %ld\n",
41707c478bd9Sstevel@tonic-gate r.ru_msgrcv);
41717c478bd9Sstevel@tonic-gate (void) printf("\t signals rcv'd: %ld\n",
41727c478bd9Sstevel@tonic-gate r.ru_nsignals);
41737c478bd9Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %ld\n",
41747c478bd9Sstevel@tonic-gate r.ru_nvcsw);
41757c478bd9Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %ld\n",
41767c478bd9Sstevel@tonic-gate r.ru_nivcsw);
41777c478bd9Sstevel@tonic-gate }
41787c478bd9Sstevel@tonic-gate
41797c478bd9Sstevel@tonic-gate void
show_getrusage32(long offset)41807c478bd9Sstevel@tonic-gate show_getrusage32(long offset)
41817c478bd9Sstevel@tonic-gate {
41827c478bd9Sstevel@tonic-gate struct rusage32 r;
41837c478bd9Sstevel@tonic-gate if (Pread(Proc, &r, sizeof (r), offset) != sizeof (r))
41847c478bd9Sstevel@tonic-gate return;
41857c478bd9Sstevel@tonic-gate (void) printf("\t user time: %d.%6.6d sec\n",
41867c478bd9Sstevel@tonic-gate r.ru_utime.tv_sec,
41877c478bd9Sstevel@tonic-gate r.ru_utime.tv_usec);
41887c478bd9Sstevel@tonic-gate (void) printf("\t system time: %d.%6.6d sec\n",
41897c478bd9Sstevel@tonic-gate r.ru_stime.tv_sec,
41907c478bd9Sstevel@tonic-gate r.ru_stime.tv_usec);
41917c478bd9Sstevel@tonic-gate (void) printf("\t max rss: <unimpl> %d\n",
41927c478bd9Sstevel@tonic-gate r.ru_maxrss);
41937c478bd9Sstevel@tonic-gate (void) printf("\t shared data: <unimpl> %d\n",
41947c478bd9Sstevel@tonic-gate r.ru_ixrss);
41957c478bd9Sstevel@tonic-gate (void) printf("\t unshared data: <unimpl> %d\n",
41967c478bd9Sstevel@tonic-gate r.ru_idrss);
41977c478bd9Sstevel@tonic-gate (void) printf("\t unshared stack: <unimpl> %d\n",
41987c478bd9Sstevel@tonic-gate r.ru_isrss);
41997c478bd9Sstevel@tonic-gate (void) printf("\t minor faults: %d\n",
42007c478bd9Sstevel@tonic-gate r.ru_minflt);
42017c478bd9Sstevel@tonic-gate (void) printf("\t major faults: %d\n",
42027c478bd9Sstevel@tonic-gate r.ru_majflt);
42037c478bd9Sstevel@tonic-gate (void) printf("\t # of swaps: %d\n",
42047c478bd9Sstevel@tonic-gate r.ru_nswap);
42057c478bd9Sstevel@tonic-gate (void) printf("\t blocked inputs: %d\n",
42067c478bd9Sstevel@tonic-gate r.ru_inblock);
42077c478bd9Sstevel@tonic-gate (void) printf("\t blocked outputs: %d\n",
42087c478bd9Sstevel@tonic-gate r.ru_oublock);
42097c478bd9Sstevel@tonic-gate (void) printf("\t msgs sent: %d\n",
42107c478bd9Sstevel@tonic-gate r.ru_msgsnd);
42117c478bd9Sstevel@tonic-gate (void) printf("\t msgs rcv'd: %d\n",
42127c478bd9Sstevel@tonic-gate r.ru_msgrcv);
42137c478bd9Sstevel@tonic-gate (void) printf("\t signals rcv'd: %d\n",
42147c478bd9Sstevel@tonic-gate r.ru_nsignals);
42157c478bd9Sstevel@tonic-gate (void) printf("\tvol cntxt swtchs: %d\n",
42167c478bd9Sstevel@tonic-gate r.ru_nvcsw);
42177c478bd9Sstevel@tonic-gate (void) printf("\tinv cntxt swtchs: %d\n",
42187c478bd9Sstevel@tonic-gate r.ru_nivcsw);
42197c478bd9Sstevel@tonic-gate }
42207c478bd9Sstevel@tonic-gate
4221aa4a4f3bSnf /*
4222aa4a4f3bSnf * Utility function to print a packed nvlist by unpacking
4223aa4a4f3bSnf * and calling the libnvpair pretty printer. Frees all
4224aa4a4f3bSnf * allocated memory internally.
4225aa4a4f3bSnf */
4226aa4a4f3bSnf static void
show_packed_nvlist(private_t * pri,uintptr_t offset,size_t size)4227aa4a4f3bSnf show_packed_nvlist(private_t *pri, uintptr_t offset, size_t size)
4228aa4a4f3bSnf {
4229aa4a4f3bSnf nvlist_t *nvl = NULL;
4230aa4a4f3bSnf size_t readsize;
4231aa4a4f3bSnf char *buf;
4232aa4a4f3bSnf
4233aa4a4f3bSnf if ((offset == 0) || (size == 0)) {
4234aa4a4f3bSnf return;
4235aa4a4f3bSnf }
4236aa4a4f3bSnf
4237aa4a4f3bSnf buf = my_malloc(size, "nvlist decode buffer");
4238aa4a4f3bSnf readsize = Pread(Proc, buf, size, offset);
4239aa4a4f3bSnf if (readsize != size) {
4240aa4a4f3bSnf (void) printf("%s\t<?>", pri->pname);
4241aa4a4f3bSnf } else {
4242aa4a4f3bSnf int result;
4243aa4a4f3bSnf
4244aa4a4f3bSnf result = nvlist_unpack(buf, size, &nvl, 0);
4245aa4a4f3bSnf if (result == 0) {
4246a803cc21SGordon Ross dump_nvlist(nvl, 8);
4247aa4a4f3bSnf nvlist_free(nvl);
4248aa4a4f3bSnf } else {
4249aa4a4f3bSnf (void) printf("%s\tunpack of nvlist"
4250aa4a4f3bSnf " failed: %d\n", pri->pname, result);
4251aa4a4f3bSnf }
4252aa4a4f3bSnf }
4253aa4a4f3bSnf free(buf);
4254aa4a4f3bSnf }
4255aa4a4f3bSnf
4256821c4a97Sdp static void
show_zone_create_args(private_t * pri,long offset)4257821c4a97Sdp show_zone_create_args(private_t *pri, long offset)
4258821c4a97Sdp {
4259821c4a97Sdp zone_def args;
4260821c4a97Sdp char zone_name[ZONENAME_MAX];
4261821c4a97Sdp char zone_root[MAXPATHLEN];
4262821c4a97Sdp char *zone_zfs = NULL;
4263821c4a97Sdp
4264821c4a97Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4265821c4a97Sdp
4266821c4a97Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name),
4267821c4a97Sdp (uintptr_t)args.zone_name) == -1)
4268821c4a97Sdp (void) strcpy(zone_name, "<?>");
4269821c4a97Sdp
4270821c4a97Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root),
4271821c4a97Sdp (uintptr_t)args.zone_root) == -1)
4272821c4a97Sdp (void) strcpy(zone_root, "<?>");
4273821c4a97Sdp
4274821c4a97Sdp if (args.zfsbufsz > 0) {
4275821c4a97Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz));
4276821c4a97Sdp if (zone_zfs != NULL) {
4277821c4a97Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz,
4278821c4a97Sdp (uintptr_t)args.zfsbuf) == -1)
4279821c4a97Sdp (void) strcpy(zone_zfs, "<?>");
4280821c4a97Sdp }
4281821c4a97Sdp } else {
4282821c4a97Sdp zone_zfs = "";
4283821c4a97Sdp }
4284821c4a97Sdp
4285821c4a97Sdp (void) printf("%s\t zone_name: %s\n", pri->pname,
4286821c4a97Sdp zone_name);
4287821c4a97Sdp (void) printf("%s\t zone_root: %s\n", pri->pname,
4288821c4a97Sdp zone_root);
4289821c4a97Sdp
4290821c4a97Sdp show_privset(pri, (uintptr_t)args.zone_privs,
4291821c4a97Sdp args.zone_privssz, " zone_privs: ");
4292821c4a97Sdp
4293821c4a97Sdp (void) printf("%s\t rctlbuf: 0x%p\n", pri->pname,
4294821c4a97Sdp (void *)args.rctlbuf);
4295821c4a97Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname,
4296821c4a97Sdp (ulong_t)args.rctlbufsz);
4297821c4a97Sdp
4298aa4a4f3bSnf show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4299aa4a4f3bSnf args.rctlbufsz);
4300aa4a4f3bSnf
4301821c4a97Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs);
4302821c4a97Sdp
4303821c4a97Sdp (void) printf("%s\textended_error: 0x%p\n", pri->pname,
4304821c4a97Sdp (void *)args.extended_error);
4305821c4a97Sdp
430645916cd2Sjpk if (is_system_labeled()) {
430745916cd2Sjpk char *label_str = NULL;
430845916cd2Sjpk bslabel_t zone_label;
430945916cd2Sjpk
431045916cd2Sjpk (void) printf("%s\t match: %d\n", pri->pname,
431145916cd2Sjpk args.match);
431245916cd2Sjpk (void) printf("%s\t doi: %d\n", pri->pname,
431345916cd2Sjpk args.doi);
431445916cd2Sjpk
431545916cd2Sjpk if (Pread_string(Proc, (char *)&zone_label,
431645916cd2Sjpk sizeof (zone_label), (uintptr_t)args.label) != -1) {
431745916cd2Sjpk /* show the label as string */
431845916cd2Sjpk if (label_to_str(&zone_label, &label_str,
431945916cd2Sjpk M_LABEL, SHORT_NAMES) != 0) {
432045916cd2Sjpk /* have to dump label as raw string */
432145916cd2Sjpk (void) label_to_str(&zone_label,
432245916cd2Sjpk &label_str, M_INTERNAL,
432345916cd2Sjpk SHORT_NAMES);
432445916cd2Sjpk }
432545916cd2Sjpk }
432645916cd2Sjpk
432745916cd2Sjpk (void) printf("%s\t label: %s\n",
432845916cd2Sjpk pri->pname, label_str != NULL ? label_str : "<?>");
432945916cd2Sjpk if (label_str)
433045916cd2Sjpk free(label_str);
433145916cd2Sjpk }
433245916cd2Sjpk
4333821c4a97Sdp if (args.zfsbufsz > 0)
4334821c4a97Sdp free(zone_zfs);
4335821c4a97Sdp }
4336821c4a97Sdp }
4337821c4a97Sdp
4338821c4a97Sdp
4339821c4a97Sdp
4340821c4a97Sdp static void
show_zone_create_args32(private_t * pri,long offset)4341821c4a97Sdp show_zone_create_args32(private_t *pri, long offset)
4342821c4a97Sdp {
4343821c4a97Sdp zone_def32 args;
4344821c4a97Sdp char zone_name[ZONENAME_MAX];
4345821c4a97Sdp char zone_root[MAXPATHLEN];
4346821c4a97Sdp char *zone_zfs = NULL;
4347821c4a97Sdp
4348821c4a97Sdp if (Pread(Proc, &args, sizeof (args), offset) == sizeof (args)) {
4349821c4a97Sdp
4350821c4a97Sdp if (Pread_string(Proc, zone_name, sizeof (zone_name),
4351821c4a97Sdp (uintptr_t)args.zone_name) == -1)
4352821c4a97Sdp (void) strcpy(zone_name, "<?>");
4353821c4a97Sdp
4354821c4a97Sdp if (Pread_string(Proc, zone_root, sizeof (zone_root),
4355821c4a97Sdp (uintptr_t)args.zone_root) == -1)
4356821c4a97Sdp (void) strcpy(zone_root, "<?>");
4357821c4a97Sdp
4358821c4a97Sdp if (args.zfsbufsz > 0) {
4359821c4a97Sdp zone_zfs = malloc(MIN(4, args.zfsbufsz));
4360821c4a97Sdp if (zone_zfs != NULL) {
4361821c4a97Sdp if (Pread(Proc, zone_zfs, args.zfsbufsz,
4362821c4a97Sdp (uintptr_t)args.zfsbuf) == -1)
4363821c4a97Sdp (void) strcpy(zone_zfs, "<?>");
4364821c4a97Sdp }
4365821c4a97Sdp } else {
4366821c4a97Sdp zone_zfs = "";
4367821c4a97Sdp }
4368821c4a97Sdp
4369821c4a97Sdp (void) printf("%s\t zone_name: %s\n", pri->pname,
4370821c4a97Sdp zone_name);
4371821c4a97Sdp (void) printf("%s\t zone_root: %s\n", pri->pname,
4372821c4a97Sdp zone_root);
4373821c4a97Sdp
4374821c4a97Sdp show_privset(pri, (uintptr_t)args.zone_privs,
4375821c4a97Sdp args.zone_privssz, " zone_privs: ");
4376821c4a97Sdp
43773246257cSdp (void) printf("%s\t rctlbuf: 0x%x\n", pri->pname,
43783246257cSdp (caddr32_t)args.rctlbuf);
4379821c4a97Sdp (void) printf("%s\t rctlbufsz: %lu\n", pri->pname,
4380821c4a97Sdp (ulong_t)args.rctlbufsz);
4381821c4a97Sdp
4382aa4a4f3bSnf show_packed_nvlist(pri, (uintptr_t)args.rctlbuf,
4383aa4a4f3bSnf args.rctlbufsz);
4384aa4a4f3bSnf
4385821c4a97Sdp (void) printf("%s\t zfs: %s\n", pri->pname, zone_zfs);
4386821c4a97Sdp
43873246257cSdp (void) printf("%s\textended_error: 0x%x\n", pri->pname,
43883246257cSdp (caddr32_t)args.extended_error);
4389821c4a97Sdp
439045916cd2Sjpk if (is_system_labeled()) {
439145916cd2Sjpk char *label_str = NULL;
439245916cd2Sjpk bslabel_t zone_label;
439345916cd2Sjpk
439445916cd2Sjpk (void) printf("%s\t match: %d\n", pri->pname,
439545916cd2Sjpk args.match);
439645916cd2Sjpk (void) printf("%s\t doi: %d\n", pri->pname,
439745916cd2Sjpk args.doi);
439845916cd2Sjpk
439945916cd2Sjpk if (Pread_string(Proc, (char *)&zone_label,
440045916cd2Sjpk sizeof (zone_label), (caddr32_t)args.label) != -1) {
440145916cd2Sjpk /* show the label as string */
440245916cd2Sjpk if (label_to_str(&zone_label, &label_str,
440345916cd2Sjpk M_LABEL, SHORT_NAMES) != 0) {
440445916cd2Sjpk /* have to dump label as raw string */
440545916cd2Sjpk (void) label_to_str(&zone_label,
440645916cd2Sjpk &label_str, M_INTERNAL,
440745916cd2Sjpk SHORT_NAMES);
440845916cd2Sjpk }
440945916cd2Sjpk }
441045916cd2Sjpk (void) printf("%s\t label: %s\n",
441145916cd2Sjpk pri->pname, label_str != NULL ? label_str : "<?>");
441245916cd2Sjpk if (label_str)
441345916cd2Sjpk free(label_str);
441445916cd2Sjpk }
441545916cd2Sjpk
4416821c4a97Sdp if (args.zfsbufsz > 0)
4417821c4a97Sdp free(zone_zfs);
4418821c4a97Sdp }
4419821c4a97Sdp }
4420821c4a97Sdp
4421821c4a97Sdp
4422821c4a97Sdp static void
show_zones(private_t * pri)4423821c4a97Sdp show_zones(private_t *pri)
4424821c4a97Sdp {
4425821c4a97Sdp switch (pri->sys_args[0]) {
4426821c4a97Sdp case ZONE_CREATE:
4427821c4a97Sdp if (data_model == PR_MODEL_LP64)
4428821c4a97Sdp show_zone_create_args(pri, (long)pri->sys_args[1]);
4429821c4a97Sdp else
4430821c4a97Sdp show_zone_create_args32(pri, (long)pri->sys_args[1]);
4431821c4a97Sdp break;
4432821c4a97Sdp }
4433821c4a97Sdp }
4434821c4a97Sdp
4435aa4a4f3bSnf static void
show_rctlblk(private_t * pri,long _rctlblk)4436aa4a4f3bSnf show_rctlblk(private_t *pri, long _rctlblk)
4437aa4a4f3bSnf {
4438aa4a4f3bSnf rctlblk_t *blk;
4439aa4a4f3bSnf int size = rctlblk_size();
4440aa4a4f3bSnf size_t readsize;
4441aa4a4f3bSnf const char *s;
4442aa4a4f3bSnf
4443aa4a4f3bSnf blk = my_malloc(size, "rctlblk decode buffer");
4444aa4a4f3bSnf readsize = Pread(Proc, blk, size, _rctlblk);
4445aa4a4f3bSnf if (readsize != size) {
4446aa4a4f3bSnf (void) printf("%s\t\t<?>", pri->pname);
4447aa4a4f3bSnf } else {
4448aa4a4f3bSnf (void) printf("%s\t\t Privilege: 0x%x\n",
4449aa4a4f3bSnf pri->pname,
4450aa4a4f3bSnf rctlblk_get_privilege(blk));
4451aa4a4f3bSnf (void) printf("%s\t\t Value: %lld\n",
4452aa4a4f3bSnf pri->pname,
4453aa4a4f3bSnf rctlblk_get_value(blk));
4454aa4a4f3bSnf (void) printf("%s\t\tEnforced Value: %lld\n",
4455aa4a4f3bSnf pri->pname,
4456aa4a4f3bSnf rctlblk_get_enforced_value(blk));
4457aa4a4f3bSnf
4458aa4a4f3bSnf {
4459aa4a4f3bSnf int sig, act;
4460aa4a4f3bSnf act = rctlblk_get_local_action(blk, &sig);
4461aa4a4f3bSnf
4462aa4a4f3bSnf s = rctl_local_action(pri, act);
4463aa4a4f3bSnf if (s == NULL) {
4464aa4a4f3bSnf (void) printf("%s\t\t Local action: 0x%x\n",
4465aa4a4f3bSnf pri->pname, act);
4466aa4a4f3bSnf } else {
4467aa4a4f3bSnf (void) printf("%s\t\t Local action: %s\n",
4468aa4a4f3bSnf pri->pname, s);
4469aa4a4f3bSnf }
4470aa4a4f3bSnf
4471aa4a4f3bSnf if (act & RCTL_LOCAL_SIGNAL) {
4472aa4a4f3bSnf (void) printf("%s\t\t "
4473aa4a4f3bSnf "For signal %s\n",
4474aa4a4f3bSnf pri->pname, signame(pri, sig));
4475aa4a4f3bSnf }
4476aa4a4f3bSnf }
4477aa4a4f3bSnf
4478aa4a4f3bSnf s = rctl_local_flags(pri, rctlblk_get_local_flags(blk));
4479aa4a4f3bSnf if (s == NULL) {
4480aa4a4f3bSnf (void) printf("%s\t\t Local flags: 0x%x\n",
4481aa4a4f3bSnf pri->pname, rctlblk_get_local_flags(blk));
4482aa4a4f3bSnf } else {
4483aa4a4f3bSnf (void) printf("%s\t\t Local flags: %s\n",
4484aa4a4f3bSnf pri->pname, s);
4485aa4a4f3bSnf }
4486aa4a4f3bSnf
4487aa4a4f3bSnf (void) printf("%s\t\t Recipient PID: %d\n",
4488aa4a4f3bSnf pri->pname,
4489aa4a4f3bSnf rctlblk_get_recipient_pid(blk));
4490aa4a4f3bSnf (void) printf("%s\t\t Firing Time: %lld\n",
4491aa4a4f3bSnf pri->pname,
4492aa4a4f3bSnf rctlblk_get_firing_time(blk));
4493aa4a4f3bSnf }
4494aa4a4f3bSnf free(blk);
4495aa4a4f3bSnf }
4496aa4a4f3bSnf
4497aa4a4f3bSnf static void
show_rctls(private_t * pri)4498aa4a4f3bSnf show_rctls(private_t *pri)
4499aa4a4f3bSnf {
4500532877c4Srd int entry;
4501532877c4Srd
4502aa4a4f3bSnf switch (pri->sys_args[0]) {
4503aa4a4f3bSnf case 0: /* getrctl */
4504aa4a4f3bSnf case 1: /* setrctl */
4505aa4a4f3bSnf /*
4506aa4a4f3bSnf * If these offsets look a little odd, remember that they're
4507aa4a4f3bSnf * into the _raw_ system call
4508aa4a4f3bSnf */
4509aa4a4f3bSnf (void) printf("%s\tOld rctlblk: 0x%lx\n", pri->pname,
4510aa4a4f3bSnf pri->sys_args[2]);
4511*27aa4812SToomas Soome if (pri->sys_args[2] != 0) {
4512aa4a4f3bSnf show_rctlblk(pri, pri->sys_args[2]);
4513aa4a4f3bSnf }
4514aa4a4f3bSnf (void) printf("%s\tNew rctlblk: 0x%lx\n", pri->pname,
4515aa4a4f3bSnf pri->sys_args[3]);
4516*27aa4812SToomas Soome if (pri->sys_args[3] != 0) {
4517aa4a4f3bSnf show_rctlblk(pri, pri->sys_args[3]);
4518aa4a4f3bSnf }
4519aa4a4f3bSnf break;
4520532877c4Srd case 4: /* setprojrctl */
4521532877c4Srd for (entry = 0; entry < pri->sys_args[4]; entry++) {
4522532877c4Srd (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4523532877c4Srd pri->pname, entry,
4524532877c4Srd (long)RCTLBLK_INC(pri->sys_args[3], entry));
4525532877c4Srd if (RCTLBLK_INC(pri->sys_args[3], entry) != NULL) {
4526532877c4Srd show_rctlblk(pri,
4527532877c4Srd (long)RCTLBLK_INC(pri->sys_args[3], entry));
4528532877c4Srd }
4529532877c4Srd }
4530aa4a4f3bSnf }
4531aa4a4f3bSnf }
4532821c4a97Sdp
45333b862e9aSRoger A. Faulkner void
show_utimesys(private_t * pri)45343b862e9aSRoger A. Faulkner show_utimesys(private_t *pri)
45353b862e9aSRoger A. Faulkner {
45363b862e9aSRoger A. Faulkner switch (pri->sys_args[0]) {
45373b862e9aSRoger A. Faulkner case 0: /* futimens() */
45383b862e9aSRoger A. Faulkner if (pri->sys_nargs > 2)
45393b862e9aSRoger A. Faulkner show_utimens(pri, (long)pri->sys_args[2]);
45403b862e9aSRoger A. Faulkner break;
45413b862e9aSRoger A. Faulkner case 1: /* utimensat */
45423b862e9aSRoger A. Faulkner if (pri->sys_nargs > 3)
45433b862e9aSRoger A. Faulkner show_utimens(pri, (long)pri->sys_args[3]);
45443b862e9aSRoger A. Faulkner break;
45453b862e9aSRoger A. Faulkner default: /* unexpected subcode */
45463b862e9aSRoger A. Faulkner break;
45473b862e9aSRoger A. Faulkner }
45483b862e9aSRoger A. Faulkner }
45493b862e9aSRoger A. Faulkner
45503e95bd4aSAnders Persson static void
show_sockconfig_filter_prop32(private_t * pri,long addr)45513e95bd4aSAnders Persson show_sockconfig_filter_prop32(private_t *pri, long addr)
45523e95bd4aSAnders Persson {
45533e95bd4aSAnders Persson struct sockconfig_filter_props32 props;
45543e95bd4aSAnders Persson const char *s = NULL;
45553e95bd4aSAnders Persson char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
45563e95bd4aSAnders Persson sof_socktuple32_t *tup;
45573e95bd4aSAnders Persson size_t sz;
45583e95bd4aSAnders Persson int i;
45593e95bd4aSAnders Persson
45603e95bd4aSAnders Persson if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
45613e95bd4aSAnders Persson if (Pread_string(Proc, buf, sizeof (buf),
45623e95bd4aSAnders Persson (uintptr_t)props.sfp_modname) == -1)
45633e95bd4aSAnders Persson (void) strcpy(buf, "<?>");
45643e95bd4aSAnders Persson (void) printf("%s\tmodule name: %s\n", pri->pname, buf);
45653e95bd4aSAnders Persson (void) printf("%s\tattach semantics: %s", pri->pname,
45663e95bd4aSAnders Persson props.sfp_autoattach ? "automatic" : "progammatic");
45673e95bd4aSAnders Persson if (props.sfp_autoattach) {
45683e95bd4aSAnders Persson buf[0] = '\0';
45693e95bd4aSAnders Persson switch (props.sfp_hint) {
45703e95bd4aSAnders Persson case SOF_HINT_TOP: s = "top"; break;
45713e95bd4aSAnders Persson case SOF_HINT_BOTTOM: s = "bottom"; break;
45723e95bd4aSAnders Persson case SOF_HINT_BEFORE:
45733e95bd4aSAnders Persson case SOF_HINT_AFTER:
45743e95bd4aSAnders Persson s = (props.sfp_hint == SOF_HINT_BEFORE) ?
45753e95bd4aSAnders Persson "before" : "after";
45763e95bd4aSAnders Persson if (Pread_string(Proc, buf, sizeof (buf),
45773e95bd4aSAnders Persson (uintptr_t)props.sfp_hintarg) == -1)
45783e95bd4aSAnders Persson (void) strcpy(buf, "<?>");
45793e95bd4aSAnders Persson }
45803e95bd4aSAnders Persson if (s != NULL) {
45813e95bd4aSAnders Persson (void) printf(", placement: %s %s", s, buf);
45823e95bd4aSAnders Persson }
45833e95bd4aSAnders Persson }
45843e95bd4aSAnders Persson (void) printf("\n");
45853e95bd4aSAnders Persson (void) printf("%s\tsocket tuples:\n", pri->pname);
45863e95bd4aSAnders Persson if (props.sfp_socktuple_cnt == 0) {
45873e95bd4aSAnders Persson (void) printf("\t\t<empty>\n");
45883e95bd4aSAnders Persson return;
45893e95bd4aSAnders Persson }
45903e95bd4aSAnders Persson sz = props.sfp_socktuple_cnt * sizeof (*tup);
45913e95bd4aSAnders Persson tup = my_malloc(sz, "socket tuple buffer");
45923e95bd4aSAnders Persson if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
45933e95bd4aSAnders Persson for (i = 0; i < props.sfp_socktuple_cnt; i++) {
45943e95bd4aSAnders Persson (void) printf(
45953e95bd4aSAnders Persson "\t\tfamily: %d, type: %d, proto: %d\n",
45963e95bd4aSAnders Persson tup[i].sofst_family, tup[i].sofst_type,
45973e95bd4aSAnders Persson tup[i].sofst_protocol);
45983e95bd4aSAnders Persson }
45993e95bd4aSAnders Persson }
46003e95bd4aSAnders Persson }
46013e95bd4aSAnders Persson static void
show_sockconfig_filter_prop(private_t * pri,long addr)46023e95bd4aSAnders Persson show_sockconfig_filter_prop(private_t *pri, long addr)
46033e95bd4aSAnders Persson {
46043e95bd4aSAnders Persson struct sockconfig_filter_props props;
46053e95bd4aSAnders Persson const char *s = NULL;
46063e95bd4aSAnders Persson char buf[MAX(FILNAME_MAX, MODMAXNAMELEN)];
46073e95bd4aSAnders Persson sof_socktuple_t *tup;
46083e95bd4aSAnders Persson size_t sz;
46093e95bd4aSAnders Persson int i;
46103e95bd4aSAnders Persson
46113e95bd4aSAnders Persson if (Pread(Proc, &props, sizeof (props), addr) == sizeof (props)) {
46123e95bd4aSAnders Persson if (Pread_string(Proc, buf, sizeof (buf),
46133e95bd4aSAnders Persson (uintptr_t)props.sfp_modname) == -1)
46143e95bd4aSAnders Persson (void) strcpy(buf, "<?>");
46153e95bd4aSAnders Persson (void) printf("%s\tmodule name: %s\n", pri->pname, buf);
46163e95bd4aSAnders Persson (void) printf("%s\tattach semantics: %s", pri->pname,
46173e95bd4aSAnders Persson props.sfp_autoattach ? "automatic" : "progammatic");
46183e95bd4aSAnders Persson if (props.sfp_autoattach) {
46193e95bd4aSAnders Persson buf[0] = '\0';
46203e95bd4aSAnders Persson switch (props.sfp_hint) {
46213e95bd4aSAnders Persson case SOF_HINT_TOP: s = "top"; break;
46223e95bd4aSAnders Persson case SOF_HINT_BOTTOM: s = "bottom"; break;
46233e95bd4aSAnders Persson case SOF_HINT_BEFORE:
46243e95bd4aSAnders Persson case SOF_HINT_AFTER:
46253e95bd4aSAnders Persson s = (props.sfp_hint == SOF_HINT_BEFORE) ?
46263e95bd4aSAnders Persson "before" : "after";
46273e95bd4aSAnders Persson if (Pread_string(Proc, buf, sizeof (buf),
46283e95bd4aSAnders Persson (uintptr_t)props.sfp_hintarg) == -1)
46293e95bd4aSAnders Persson (void) strcpy(buf, "<?>");
46303e95bd4aSAnders Persson }
46313e95bd4aSAnders Persson if (s != NULL) {
46323e95bd4aSAnders Persson (void) printf(", placement: %s", s);
46333e95bd4aSAnders Persson }
46343e95bd4aSAnders Persson }
46353e95bd4aSAnders Persson (void) printf("\n");
46363e95bd4aSAnders Persson (void) printf("%s\tsocket tuples:\n", pri->pname);
46373e95bd4aSAnders Persson if (props.sfp_socktuple_cnt == 0) {
46383e95bd4aSAnders Persson (void) printf("\t\t<empty>\n");
46393e95bd4aSAnders Persson return;
46403e95bd4aSAnders Persson }
46413e95bd4aSAnders Persson sz = props.sfp_socktuple_cnt * sizeof (*tup);
46423e95bd4aSAnders Persson tup = my_malloc(sz, "socket tuple buffer");
46433e95bd4aSAnders Persson if (Pread(Proc, tup, sz, (uintptr_t)props.sfp_socktuple) == sz)
46443e95bd4aSAnders Persson for (i = 0; i < props.sfp_socktuple_cnt; i++) {
46453e95bd4aSAnders Persson (void) printf(
46463e95bd4aSAnders Persson "\t\tfamily: %d, type: %d, proto: %d\n",
46473e95bd4aSAnders Persson tup[i].sofst_family, tup[i].sofst_type,
46483e95bd4aSAnders Persson tup[i].sofst_protocol);
46493e95bd4aSAnders Persson }
46503e95bd4aSAnders Persson }
46513e95bd4aSAnders Persson }
46523e95bd4aSAnders Persson
46533e95bd4aSAnders Persson void
show_sockconfig(private_t * pri)46543e95bd4aSAnders Persson show_sockconfig(private_t *pri)
46553e95bd4aSAnders Persson {
46563e95bd4aSAnders Persson switch (pri->sys_args[0]) {
46573e95bd4aSAnders Persson case SOCKCONFIG_ADD_FILTER:
46583e95bd4aSAnders Persson if (data_model == PR_MODEL_LP64)
46593e95bd4aSAnders Persson show_sockconfig_filter_prop(pri,
46603e95bd4aSAnders Persson (long)pri->sys_args[2]);
46613e95bd4aSAnders Persson else
46623e95bd4aSAnders Persson show_sockconfig_filter_prop32(pri,
46633e95bd4aSAnders Persson (long)pri->sys_args[2]);
46643e95bd4aSAnders Persson break;
46653e95bd4aSAnders Persson default:
46663e95bd4aSAnders Persson break;
46673e95bd4aSAnders Persson }
46683e95bd4aSAnders Persson }
46693e95bd4aSAnders Persson
4670a803cc21SGordon Ross void
show_zfs_ioc(private_t * pri,long addr)4671a803cc21SGordon Ross show_zfs_ioc(private_t *pri, long addr)
4672a803cc21SGordon Ross {
4673a803cc21SGordon Ross static const zfs_share_t zero_share = {0};
4674a803cc21SGordon Ross static const dmu_objset_stats_t zero_objstats = {0};
4675a803cc21SGordon Ross static const struct drr_begin zero_drrbegin = {0};
4676a803cc21SGordon Ross static const zinject_record_t zero_injectrec = {0};
4677a803cc21SGordon Ross static const zfs_stat_t zero_zstat = {0};
4678a803cc21SGordon Ross zfs_cmd_t zc;
4679a803cc21SGordon Ross
4680a803cc21SGordon Ross if (Pread(Proc, &zc, sizeof (zc), addr) != sizeof (zc)) {
4681a803cc21SGordon Ross (void) printf(" zfs_ioctl read failed\n");
4682a803cc21SGordon Ross return;
4683a803cc21SGordon Ross }
4684a803cc21SGordon Ross
4685a803cc21SGordon Ross if (zc.zc_name[0])
4686a803cc21SGordon Ross (void) printf(" zc_name=%s\n", zc.zc_name);
4687a803cc21SGordon Ross if (zc.zc_value[0])
4688a803cc21SGordon Ross (void) printf(" zc_value=%s\n", zc.zc_value);
4689a803cc21SGordon Ross if (zc.zc_string[0])
46903b2aab18SMatthew Ahrens (void) printf(" zc_string=%s\n", zc.zc_string);
4691a803cc21SGordon Ross if (zc.zc_guid != 0) {
4692a803cc21SGordon Ross (void) printf(" zc_guid=%llu\n",
4693a803cc21SGordon Ross (u_longlong_t)zc.zc_guid);
4694a803cc21SGordon Ross }
4695a803cc21SGordon Ross if (zc.zc_nvlist_conf_size) {
4696a803cc21SGordon Ross (void) printf(" nvlist_conf:\n");
4697a803cc21SGordon Ross show_packed_nvlist(pri, zc.zc_nvlist_conf,
4698a803cc21SGordon Ross zc.zc_nvlist_conf_size);
4699a803cc21SGordon Ross }
4700a803cc21SGordon Ross if (zc.zc_nvlist_src_size) {
4701a803cc21SGordon Ross (void) printf(" nvlist_src:\n");
4702a803cc21SGordon Ross show_packed_nvlist(pri, zc.zc_nvlist_src,
4703a803cc21SGordon Ross zc.zc_nvlist_src_size);
4704a803cc21SGordon Ross }
4705a803cc21SGordon Ross if (zc.zc_nvlist_dst_size) {
4706a803cc21SGordon Ross (void) printf(" nvlist_dst:\n");
4707a803cc21SGordon Ross show_packed_nvlist(pri, zc.zc_nvlist_dst,
4708a803cc21SGordon Ross zc.zc_nvlist_dst_size);
4709a803cc21SGordon Ross }
4710a803cc21SGordon Ross if (zc.zc_cookie != 0) {
4711a803cc21SGordon Ross (void) printf(" zc_cookie=%llu\n",
4712a803cc21SGordon Ross (u_longlong_t)zc.zc_cookie);
4713a803cc21SGordon Ross }
4714a803cc21SGordon Ross if (zc.zc_objset_type != 0) {
4715a803cc21SGordon Ross (void) printf(" zc_objset_type=%llu\n",
4716a803cc21SGordon Ross (u_longlong_t)zc.zc_objset_type);
4717a803cc21SGordon Ross }
4718a803cc21SGordon Ross if (zc.zc_perm_action != 0) {
4719a803cc21SGordon Ross (void) printf(" zc_perm_action=%llu\n",
4720a803cc21SGordon Ross (u_longlong_t)zc.zc_perm_action);
4721a803cc21SGordon Ross }
4722a803cc21SGordon Ross if (zc.zc_history != 0) {
4723a803cc21SGordon Ross (void) printf(" zc_history=%llu\n",
4724a803cc21SGordon Ross (u_longlong_t)zc.zc_history);
4725a803cc21SGordon Ross }
4726a803cc21SGordon Ross if (zc.zc_obj != 0) {
4727a803cc21SGordon Ross (void) printf(" zc_obj=%llu\n",
4728a803cc21SGordon Ross (u_longlong_t)zc.zc_obj);
4729a803cc21SGordon Ross }
4730a803cc21SGordon Ross if (zc.zc_iflags != 0) {
4731a803cc21SGordon Ross (void) printf(" zc_obj=0x%llx\n",
4732a803cc21SGordon Ross (u_longlong_t)zc.zc_iflags);
4733a803cc21SGordon Ross }
4734a803cc21SGordon Ross
4735a803cc21SGordon Ross if (memcmp(&zc.zc_share, &zero_share, sizeof (zc.zc_share))) {
4736a803cc21SGordon Ross zfs_share_t *z = &zc.zc_share;
4737a803cc21SGordon Ross (void) printf(" zc_share:\n");
4738a803cc21SGordon Ross if (z->z_exportdata) {
4739a803cc21SGordon Ross (void) printf("\tz_exportdata=0x%llx\n",
4740a803cc21SGordon Ross (u_longlong_t)z->z_exportdata);
4741a803cc21SGordon Ross }
4742a803cc21SGordon Ross if (z->z_sharedata) {
4743a803cc21SGordon Ross (void) printf("\tz_sharedata=0x%llx\n",
4744a803cc21SGordon Ross (u_longlong_t)z->z_sharedata);
4745a803cc21SGordon Ross }
4746a803cc21SGordon Ross if (z->z_sharetype) {
4747a803cc21SGordon Ross (void) printf("\tz_sharetype=%llu\n",
4748a803cc21SGordon Ross (u_longlong_t)z->z_sharetype);
4749a803cc21SGordon Ross }
4750a803cc21SGordon Ross if (z->z_sharemax) {
4751a803cc21SGordon Ross (void) printf("\tz_sharemax=%llu\n",
4752a803cc21SGordon Ross (u_longlong_t)z->z_sharemax);
4753a803cc21SGordon Ross }
4754a803cc21SGordon Ross }
4755a803cc21SGordon Ross
4756a803cc21SGordon Ross if (memcmp(&zc.zc_objset_stats, &zero_objstats,
4757a803cc21SGordon Ross sizeof (zc.zc_objset_stats))) {
4758a803cc21SGordon Ross dmu_objset_stats_t *dds = &zc.zc_objset_stats;
4759a803cc21SGordon Ross (void) printf(" zc_objset_stats:\n");
4760a803cc21SGordon Ross if (dds->dds_num_clones) {
4761a803cc21SGordon Ross (void) printf("\tdds_num_clones=%llu\n",
4762a803cc21SGordon Ross (u_longlong_t)dds->dds_num_clones);
4763a803cc21SGordon Ross }
4764a803cc21SGordon Ross if (dds->dds_creation_txg) {
4765a803cc21SGordon Ross (void) printf("\tdds_creation_txg=%llu\n",
4766a803cc21SGordon Ross (u_longlong_t)dds->dds_creation_txg);
4767a803cc21SGordon Ross }
4768a803cc21SGordon Ross if (dds->dds_guid) {
4769a803cc21SGordon Ross (void) printf("\tdds_guid=%llu\n",
4770a803cc21SGordon Ross (u_longlong_t)dds->dds_guid);
4771a803cc21SGordon Ross }
4772a803cc21SGordon Ross if (dds->dds_type)
4773a803cc21SGordon Ross (void) printf("\tdds_type=%u\n", dds->dds_type);
4774a803cc21SGordon Ross if (dds->dds_is_snapshot) {
4775a803cc21SGordon Ross (void) printf("\tdds_is_snapshot=%u\n",
4776a803cc21SGordon Ross dds->dds_is_snapshot);
4777a803cc21SGordon Ross }
4778a803cc21SGordon Ross if (dds->dds_inconsistent) {
4779a803cc21SGordon Ross (void) printf("\tdds_inconsitent=%u\n",
4780a803cc21SGordon Ross dds->dds_inconsistent);
4781a803cc21SGordon Ross }
4782a803cc21SGordon Ross if (dds->dds_origin[0]) {
4783a803cc21SGordon Ross (void) printf("\tdds_origin=%s\n", dds->dds_origin);
4784a803cc21SGordon Ross }
4785a803cc21SGordon Ross }
4786a803cc21SGordon Ross
4787a803cc21SGordon Ross if (memcmp(&zc.zc_begin_record, &zero_drrbegin,
4788a803cc21SGordon Ross sizeof (zc.zc_begin_record))) {
47899c3fd121SMatthew Ahrens struct drr_begin *drr = &zc.zc_begin_record.drr_u.drr_begin;
4790a803cc21SGordon Ross (void) printf(" zc_begin_record:\n");
4791a803cc21SGordon Ross if (drr->drr_magic) {
4792a803cc21SGordon Ross (void) printf("\tdrr_magic=%llu\n",
4793a803cc21SGordon Ross (u_longlong_t)drr->drr_magic);
4794a803cc21SGordon Ross }
4795a803cc21SGordon Ross if (drr->drr_versioninfo) {
4796a803cc21SGordon Ross (void) printf("\tdrr_versioninfo=%llu\n",
4797a803cc21SGordon Ross (u_longlong_t)drr->drr_versioninfo);
4798a803cc21SGordon Ross }
4799a803cc21SGordon Ross if (drr->drr_creation_time) {
4800a803cc21SGordon Ross (void) printf("\tdrr_creation_time=%llu\n",
4801a803cc21SGordon Ross (u_longlong_t)drr->drr_creation_time);
4802a803cc21SGordon Ross }
4803a803cc21SGordon Ross if (drr->drr_type)
4804a803cc21SGordon Ross (void) printf("\tdrr_type=%u\n", drr->drr_type);
4805a803cc21SGordon Ross if (drr->drr_flags)
4806a803cc21SGordon Ross (void) printf("\tdrr_flags=0x%x\n", drr->drr_flags);
4807a803cc21SGordon Ross if (drr->drr_toguid) {
4808a803cc21SGordon Ross (void) printf("\tdrr_toguid=%llu\n",
4809a803cc21SGordon Ross (u_longlong_t)drr->drr_toguid);
4810a803cc21SGordon Ross }
4811a803cc21SGordon Ross if (drr->drr_fromguid) {
4812a803cc21SGordon Ross (void) printf("\tdrr_fromguid=%llu\n",
4813a803cc21SGordon Ross (u_longlong_t)drr->drr_fromguid);
4814a803cc21SGordon Ross }
4815a803cc21SGordon Ross if (drr->drr_toname[0]) {
4816a803cc21SGordon Ross (void) printf("\tdrr_toname=%s\n", drr->drr_toname);
4817a803cc21SGordon Ross }
4818a803cc21SGordon Ross }
4819a803cc21SGordon Ross
4820a803cc21SGordon Ross if (memcmp(&zc.zc_inject_record, &zero_injectrec,
4821a803cc21SGordon Ross sizeof (zc.zc_inject_record))) {
4822a803cc21SGordon Ross zinject_record_t *zi = &zc.zc_inject_record;
4823a803cc21SGordon Ross (void) printf(" zc_inject_record:\n");
4824a803cc21SGordon Ross if (zi->zi_objset) {
4825a803cc21SGordon Ross (void) printf("\tzi_objset=%llu\n",
4826a803cc21SGordon Ross (u_longlong_t)zi->zi_objset);
4827a803cc21SGordon Ross }
4828a803cc21SGordon Ross if (zi->zi_object) {
4829a803cc21SGordon Ross (void) printf("\tzi_object=%llu\n",
4830a803cc21SGordon Ross (u_longlong_t)zi->zi_object);
4831a803cc21SGordon Ross }
4832a803cc21SGordon Ross if (zi->zi_start) {
4833a803cc21SGordon Ross (void) printf("\tzi_start=%llu\n",
4834a803cc21SGordon Ross (u_longlong_t)zi->zi_start);
4835a803cc21SGordon Ross }
4836a803cc21SGordon Ross if (zi->zi_end) {
4837a803cc21SGordon Ross (void) printf("\tzi_end=%llu\n",
4838a803cc21SGordon Ross (u_longlong_t)zi->zi_end);
4839a803cc21SGordon Ross }
4840a803cc21SGordon Ross if (zi->zi_guid) {
4841a803cc21SGordon Ross (void) printf("\tzi_guid=%llu\n",
4842a803cc21SGordon Ross (u_longlong_t)zi->zi_guid);
4843a803cc21SGordon Ross }
4844a803cc21SGordon Ross if (zi->zi_level) {
4845a803cc21SGordon Ross (void) printf("\tzi_level=%lu\n",
4846a803cc21SGordon Ross (ulong_t)zi->zi_level);
4847a803cc21SGordon Ross }
4848a803cc21SGordon Ross if (zi->zi_error) {
4849a803cc21SGordon Ross (void) printf("\tzi_error=%lu\n",
4850a803cc21SGordon Ross (ulong_t)zi->zi_error);
4851a803cc21SGordon Ross }
4852a803cc21SGordon Ross if (zi->zi_type) {
4853a803cc21SGordon Ross (void) printf("\tzi_type=%llu\n",
4854a803cc21SGordon Ross (u_longlong_t)zi->zi_type);
4855a803cc21SGordon Ross }
4856a803cc21SGordon Ross if (zi->zi_freq) {
4857a803cc21SGordon Ross (void) printf("\tzi_freq=%lu\n",
4858a803cc21SGordon Ross (ulong_t)zi->zi_freq);
4859a803cc21SGordon Ross }
4860a803cc21SGordon Ross if (zi->zi_failfast) {
4861a803cc21SGordon Ross (void) printf("\tzi_failfast=%lu\n",
4862a803cc21SGordon Ross (ulong_t)zi->zi_failfast);
4863a803cc21SGordon Ross }
4864a803cc21SGordon Ross if (zi->zi_func[0])
4865a803cc21SGordon Ross (void) printf("\tzi_func=%s\n", zi->zi_func);
4866a803cc21SGordon Ross if (zi->zi_iotype) {
4867a803cc21SGordon Ross (void) printf("\tzi_iotype=%lu\n",
4868a803cc21SGordon Ross (ulong_t)zi->zi_iotype);
4869a803cc21SGordon Ross }
4870a803cc21SGordon Ross if (zi->zi_duration) {
4871a803cc21SGordon Ross (void) printf("\tzi_duration=%ld\n",
4872a803cc21SGordon Ross (long)zi->zi_duration);
4873a803cc21SGordon Ross }
4874a803cc21SGordon Ross if (zi->zi_timer) {
4875a803cc21SGordon Ross (void) printf("\tzi_timer=%llu\n",
4876a803cc21SGordon Ross (u_longlong_t)zi->zi_timer);
4877a803cc21SGordon Ross }
4878a803cc21SGordon Ross }
4879a803cc21SGordon Ross
4880a803cc21SGordon Ross if (zc.zc_defer_destroy) {
4881a803cc21SGordon Ross (void) printf(" zc_defer_destroy=%d\n",
4882a803cc21SGordon Ross (int)zc.zc_defer_destroy);
4883a803cc21SGordon Ross }
48845d7b4d43SMatthew Ahrens if (zc.zc_flags) {
48855d7b4d43SMatthew Ahrens (void) printf(" zc_flags=0x%x\n",
48865d7b4d43SMatthew Ahrens zc.zc_flags);
4887a803cc21SGordon Ross }
4888a803cc21SGordon Ross if (zc.zc_action_handle) {
4889a803cc21SGordon Ross (void) printf(" zc_action_handle=%llu\n",
4890a803cc21SGordon Ross (u_longlong_t)zc.zc_action_handle);
4891a803cc21SGordon Ross }
4892a803cc21SGordon Ross if (zc.zc_cleanup_fd >= 0)
4893a803cc21SGordon Ross (void) printf(" zc_cleanup_fd=%d\n", zc.zc_cleanup_fd);
4894a803cc21SGordon Ross if (zc.zc_sendobj) {
4895a803cc21SGordon Ross (void) printf(" zc_sendobj=%llu\n",
4896a803cc21SGordon Ross (u_longlong_t)zc.zc_sendobj);
4897a803cc21SGordon Ross }
4898a803cc21SGordon Ross if (zc.zc_fromobj) {
4899a803cc21SGordon Ross (void) printf(" zc_fromobj=%llu\n",
4900a803cc21SGordon Ross (u_longlong_t)zc.zc_fromobj);
4901a803cc21SGordon Ross }
4902a803cc21SGordon Ross if (zc.zc_createtxg) {
4903a803cc21SGordon Ross (void) printf(" zc_createtxg=%llu\n",
4904a803cc21SGordon Ross (u_longlong_t)zc.zc_createtxg);
4905a803cc21SGordon Ross }
4906a803cc21SGordon Ross
4907a803cc21SGordon Ross if (memcmp(&zc.zc_stat, &zero_zstat, sizeof (zc.zc_stat))) {
4908a803cc21SGordon Ross zfs_stat_t *zs = &zc.zc_stat;
4909a803cc21SGordon Ross (void) printf(" zc_stat:\n");
4910a803cc21SGordon Ross if (zs->zs_gen) {
4911a803cc21SGordon Ross (void) printf("\tzs_gen=%llu\n",
4912a803cc21SGordon Ross (u_longlong_t)zs->zs_gen);
4913a803cc21SGordon Ross }
4914a803cc21SGordon Ross if (zs->zs_mode) {
4915a803cc21SGordon Ross (void) printf("\tzs_mode=%llu\n",
4916a803cc21SGordon Ross (u_longlong_t)zs->zs_mode);
4917a803cc21SGordon Ross }
4918a803cc21SGordon Ross if (zs->zs_links) {
4919a803cc21SGordon Ross (void) printf("\tzs_links=%llu\n",
4920a803cc21SGordon Ross (u_longlong_t)zs->zs_links);
4921a803cc21SGordon Ross }
4922a803cc21SGordon Ross if (zs->zs_ctime[0]) {
4923a803cc21SGordon Ross (void) printf("\tzs_ctime[0]=%llu\n",
4924a803cc21SGordon Ross (u_longlong_t)zs->zs_ctime[0]);
4925a803cc21SGordon Ross }
4926a803cc21SGordon Ross if (zs->zs_ctime[1]) {
4927a803cc21SGordon Ross (void) printf("\tzs_ctime[1]=%llu\n",
4928a803cc21SGordon Ross (u_longlong_t)zs->zs_ctime[1]);
4929a803cc21SGordon Ross }
4930a803cc21SGordon Ross }
4931a803cc21SGordon Ross }
4932a803cc21SGordon Ross
49337c478bd9Sstevel@tonic-gate /* expound verbosely upon syscall arguments */
49347c478bd9Sstevel@tonic-gate /*ARGSUSED*/
49357c478bd9Sstevel@tonic-gate void
expound(private_t * pri,long r0,int raw)49367c478bd9Sstevel@tonic-gate expound(private_t *pri, long r0, int raw)
49377c478bd9Sstevel@tonic-gate {
49387c478bd9Sstevel@tonic-gate const lwpstatus_t *Lsp = pri->lwpstat;
49397c478bd9Sstevel@tonic-gate int lp64 = (data_model == PR_MODEL_LP64);
49407c478bd9Sstevel@tonic-gate int what = Lsp->pr_what;
49417c478bd9Sstevel@tonic-gate int err = pri->Errno; /* don't display output parameters */
49427c478bd9Sstevel@tonic-gate /* for a failed system call */
49437c478bd9Sstevel@tonic-gate /* for reporting sleeping system calls */
49447c478bd9Sstevel@tonic-gate if (what == 0 && (Lsp->pr_flags & (PR_ASLEEP|PR_VFORKP)))
49457c478bd9Sstevel@tonic-gate what = Lsp->pr_syscall;
49467c478bd9Sstevel@tonic-gate
49477c478bd9Sstevel@tonic-gate switch (what) {
49487c478bd9Sstevel@tonic-gate case SYS_gettimeofday:
49497c478bd9Sstevel@tonic-gate if (!err)
49507c478bd9Sstevel@tonic-gate show_timeofday(pri);
49517c478bd9Sstevel@tonic-gate break;
49527c478bd9Sstevel@tonic-gate case SYS_getitimer:
49537c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
49547c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1],
4955019c3c43Sraf " value");
49567c478bd9Sstevel@tonic-gate break;
49577c478bd9Sstevel@tonic-gate case SYS_setitimer:
49587c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
49597c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[1],
4960019c3c43Sraf " value");
49617c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
49627c478bd9Sstevel@tonic-gate show_itimerval(pri, (long)pri->sys_args[2],
4963019c3c43Sraf "ovalue");
49647c478bd9Sstevel@tonic-gate break;
49657c478bd9Sstevel@tonic-gate case SYS_stime:
49667c478bd9Sstevel@tonic-gate show_stime(pri);
49677c478bd9Sstevel@tonic-gate break;
49687c478bd9Sstevel@tonic-gate case SYS_times:
49697c478bd9Sstevel@tonic-gate if (!err)
49707c478bd9Sstevel@tonic-gate show_times(pri);
49717c478bd9Sstevel@tonic-gate break;
49727c478bd9Sstevel@tonic-gate case SYS_utssys:
49737c478bd9Sstevel@tonic-gate if (err)
49747c478bd9Sstevel@tonic-gate break;
49757c478bd9Sstevel@tonic-gate if (lp64)
49767c478bd9Sstevel@tonic-gate show_utssys(pri, r0);
49777c478bd9Sstevel@tonic-gate else
49787c478bd9Sstevel@tonic-gate show_utssys32(pri, r0);
49797c478bd9Sstevel@tonic-gate break;
49807c478bd9Sstevel@tonic-gate case SYS_ioctl:
49817c478bd9Sstevel@tonic-gate if (pri->sys_nargs >= 3) /* each case must decide for itself */
49827c478bd9Sstevel@tonic-gate show_ioctl(pri, pri->sys_args[1],
4983019c3c43Sraf (long)pri->sys_args[2]);
49847c478bd9Sstevel@tonic-gate break;
49858fd04b83SRoger A. Faulkner case SYS_fstatat:
49868fd04b83SRoger A. Faulkner if (!err && pri->sys_nargs >= 3)
49878fd04b83SRoger A. Faulkner show_stat(pri, (long)pri->sys_args[2]);
49888fd04b83SRoger A. Faulkner break;
49898fd04b83SRoger A. Faulkner case SYS_fstatat64:
49908fd04b83SRoger A. Faulkner if (!err && pri->sys_nargs >= 3)
49918fd04b83SRoger A. Faulkner show_stat64_32(pri, (long)pri->sys_args[2]);
49928fd04b83SRoger A. Faulkner break;
49937c478bd9Sstevel@tonic-gate case SYS_stat:
49947c478bd9Sstevel@tonic-gate case SYS_fstat:
49957c478bd9Sstevel@tonic-gate case SYS_lstat:
49967c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2)
49977c478bd9Sstevel@tonic-gate show_stat(pri, (long)pri->sys_args[1]);
49987c478bd9Sstevel@tonic-gate break;
49997c478bd9Sstevel@tonic-gate case SYS_stat64:
50007c478bd9Sstevel@tonic-gate case SYS_fstat64:
50017c478bd9Sstevel@tonic-gate case SYS_lstat64:
50027c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs >= 2)
50037c478bd9Sstevel@tonic-gate show_stat64_32(pri, (long)pri->sys_args[1]);
50047c478bd9Sstevel@tonic-gate break;
50057c478bd9Sstevel@tonic-gate case SYS_statvfs:
50067c478bd9Sstevel@tonic-gate case SYS_fstatvfs:
50077c478bd9Sstevel@tonic-gate if (err)
50087c478bd9Sstevel@tonic-gate break;
50097c478bd9Sstevel@tonic-gate if (!lp64) {
50107c478bd9Sstevel@tonic-gate show_statvfs32(pri);
50117c478bd9Sstevel@tonic-gate break;
50127c478bd9Sstevel@tonic-gate }
50137c478bd9Sstevel@tonic-gate show_statvfs(pri);
50147c478bd9Sstevel@tonic-gate break;
50157c478bd9Sstevel@tonic-gate case SYS_statvfs64:
50167c478bd9Sstevel@tonic-gate case SYS_fstatvfs64:
50177c478bd9Sstevel@tonic-gate if (err)
50187c478bd9Sstevel@tonic-gate break;
50197c478bd9Sstevel@tonic-gate show_statvfs64(pri);
50207c478bd9Sstevel@tonic-gate break;
50217c478bd9Sstevel@tonic-gate case SYS_statfs:
50227c478bd9Sstevel@tonic-gate case SYS_fstatfs:
50237c478bd9Sstevel@tonic-gate if (err)
50247c478bd9Sstevel@tonic-gate break;
50257c478bd9Sstevel@tonic-gate if (lp64)
50267c478bd9Sstevel@tonic-gate show_statfs(pri);
50277c478bd9Sstevel@tonic-gate else
50287c478bd9Sstevel@tonic-gate show_statfs32(pri);
50297c478bd9Sstevel@tonic-gate break;
50307c478bd9Sstevel@tonic-gate case SYS_fcntl:
50317c478bd9Sstevel@tonic-gate show_fcntl(pri);
50327c478bd9Sstevel@tonic-gate break;
50337c478bd9Sstevel@tonic-gate case SYS_msgsys:
50347c478bd9Sstevel@tonic-gate show_msgsys(pri, r0); /* each case must decide for itself */
50357c478bd9Sstevel@tonic-gate break;
50367c478bd9Sstevel@tonic-gate case SYS_semsys:
50377c478bd9Sstevel@tonic-gate show_semsys(pri); /* each case must decide for itself */
50387c478bd9Sstevel@tonic-gate break;
50397c478bd9Sstevel@tonic-gate case SYS_shmsys:
50407c478bd9Sstevel@tonic-gate show_shmsys(pri); /* each case must decide for itself */
50417c478bd9Sstevel@tonic-gate break;
50427c478bd9Sstevel@tonic-gate case SYS_getdents:
50437c478bd9Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0)
50447c478bd9Sstevel@tonic-gate break;
50457c478bd9Sstevel@tonic-gate if (!lp64) {
50467c478bd9Sstevel@tonic-gate show_dents32(pri, (long)pri->sys_args[1], r0);
50477c478bd9Sstevel@tonic-gate break;
50487c478bd9Sstevel@tonic-gate }
50490b09d754SToomas Soome /* FALLTHROUGH */
50507c478bd9Sstevel@tonic-gate case SYS_getdents64:
50517c478bd9Sstevel@tonic-gate if (err || pri->sys_nargs <= 1 || r0 <= 0)
50527c478bd9Sstevel@tonic-gate break;
50537c478bd9Sstevel@tonic-gate show_dents64(pri, (long)pri->sys_args[1], r0);
50547c478bd9Sstevel@tonic-gate break;
50557c478bd9Sstevel@tonic-gate case SYS_getmsg:
50567c478bd9Sstevel@tonic-gate show_gp_msg(pri, what);
50577c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3)
50587c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "flags");
50597c478bd9Sstevel@tonic-gate break;
50607c478bd9Sstevel@tonic-gate case SYS_getpmsg:
50617c478bd9Sstevel@tonic-gate show_gp_msg(pri, what);
50627c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 3)
50637c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[3], "band");
50647c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 4)
50657c478bd9Sstevel@tonic-gate show_hhex_int(pri, (long)pri->sys_args[4], "flags");
50667c478bd9Sstevel@tonic-gate break;
50677c478bd9Sstevel@tonic-gate case SYS_putmsg:
50687c478bd9Sstevel@tonic-gate case SYS_putpmsg:
50697c478bd9Sstevel@tonic-gate show_gp_msg(pri, what);
50707c478bd9Sstevel@tonic-gate break;
50717c478bd9Sstevel@tonic-gate case SYS_pollsys:
50727c478bd9Sstevel@tonic-gate show_pollsys(pri);
50737c478bd9Sstevel@tonic-gate break;
50747c478bd9Sstevel@tonic-gate case SYS_setgroups:
50757c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (r0 = pri->sys_args[0]) > 0)
50767c478bd9Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0);
50777c478bd9Sstevel@tonic-gate break;
50787c478bd9Sstevel@tonic-gate case SYS_getgroups:
50797c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1 && pri->sys_args[0] > 0)
50807c478bd9Sstevel@tonic-gate show_groups(pri, (long)pri->sys_args[1], r0);
50817c478bd9Sstevel@tonic-gate break;
50827c478bd9Sstevel@tonic-gate case SYS_sigprocmask:
50837c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
50847c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], " set");
50857c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
50867c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[2], "oset");
50877c478bd9Sstevel@tonic-gate break;
50887c478bd9Sstevel@tonic-gate case SYS_sigsuspend:
50897c478bd9Sstevel@tonic-gate case SYS_sigtimedwait:
50907c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
50917c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[0], "sigmask");
50927c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
50937c478bd9Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[1]);
50947c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2)
50957c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout");
50967c478bd9Sstevel@tonic-gate break;
50977c478bd9Sstevel@tonic-gate case SYS_sigaltstack:
50987c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
50997c478bd9Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[0],
5100019c3c43Sraf "new");
51017c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
51027c478bd9Sstevel@tonic-gate show_sigaltstack(pri, (long)pri->sys_args[1],
5103019c3c43Sraf "old");
51047c478bd9Sstevel@tonic-gate break;
51057c478bd9Sstevel@tonic-gate case SYS_sigaction:
51067c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
51077c478bd9Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[1],
5108*27aa4812SToomas Soome "new", 0);
51097c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
51107c478bd9Sstevel@tonic-gate show_sigaction(pri, (long)pri->sys_args[2],
5111019c3c43Sraf "old", r0);
51127c478bd9Sstevel@tonic-gate break;
5113f48068adSraf case SYS_signotify:
5114f48068adSraf if (pri->sys_nargs > 1)
5115f48068adSraf show_siginfo(pri, (long)pri->sys_args[1]);
5116f48068adSraf break;
5117f48068adSraf case SYS_sigresend:
5118f48068adSraf if (pri->sys_nargs > 1)
5119f48068adSraf show_siginfo(pri, (long)pri->sys_args[1]);
5120f48068adSraf if (pri->sys_nargs > 2)
5121f48068adSraf show_sigset(pri, (long)pri->sys_args[2], "sigmask");
5122f48068adSraf break;
51237c478bd9Sstevel@tonic-gate case SYS_sigpending:
51247c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
51257c478bd9Sstevel@tonic-gate show_sigset(pri, (long)pri->sys_args[1], "sigmask");
51267c478bd9Sstevel@tonic-gate break;
5127a574db85Sraf case SYS_waitid:
51287c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
51297c478bd9Sstevel@tonic-gate show_siginfo(pri, (long)pri->sys_args[2]);
51307c478bd9Sstevel@tonic-gate break;
51317c478bd9Sstevel@tonic-gate case SYS_sigsendsys:
51327c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
51337c478bd9Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[0]);
51347c478bd9Sstevel@tonic-gate break;
51357c478bd9Sstevel@tonic-gate case SYS_priocntlsys:
51367c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
51377c478bd9Sstevel@tonic-gate show_procset(pri, (long)pri->sys_args[1]);
51387c478bd9Sstevel@tonic-gate break;
51397c478bd9Sstevel@tonic-gate case SYS_mincore:
51407c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
51417c478bd9Sstevel@tonic-gate show_bool(pri, (long)pri->sys_args[2],
5142019c3c43Sraf (pri->sys_args[1] + pagesize - 1) / pagesize);
51437c478bd9Sstevel@tonic-gate break;
51447c478bd9Sstevel@tonic-gate case SYS_readv:
51457c478bd9Sstevel@tonic-gate case SYS_writev:
51467c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2) {
51477c478bd9Sstevel@tonic-gate int i = pri->sys_args[0]+1;
51487c478bd9Sstevel@tonic-gate int showbuf = FALSE;
51497c478bd9Sstevel@tonic-gate long nb = (what == SYS_readv)? r0 : 32*1024;
51507c478bd9Sstevel@tonic-gate
51517c478bd9Sstevel@tonic-gate if ((what == SYS_readv && !err &&
51527c478bd9Sstevel@tonic-gate prismember(&readfd, i)) ||
51537c478bd9Sstevel@tonic-gate (what == SYS_writev &&
51547c478bd9Sstevel@tonic-gate prismember(&writefd, i)))
51557c478bd9Sstevel@tonic-gate showbuf = TRUE;
51567c478bd9Sstevel@tonic-gate show_iovec(pri, (long)pri->sys_args[1],
5157019c3c43Sraf pri->sys_args[2], showbuf, nb);
51587c478bd9Sstevel@tonic-gate }
51597c478bd9Sstevel@tonic-gate break;
51607c478bd9Sstevel@tonic-gate case SYS_getrlimit:
51617c478bd9Sstevel@tonic-gate if (err)
51627c478bd9Sstevel@tonic-gate break;
51637c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
51647c478bd9Sstevel@tonic-gate case SYS_setrlimit:
51657c478bd9Sstevel@tonic-gate if (pri->sys_nargs <= 1)
51667c478bd9Sstevel@tonic-gate break;
51677c478bd9Sstevel@tonic-gate if (lp64)
51687c478bd9Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]);
51697c478bd9Sstevel@tonic-gate else
51707c478bd9Sstevel@tonic-gate show_rlimit32(pri, (long)pri->sys_args[1]);
51717c478bd9Sstevel@tonic-gate break;
51727c478bd9Sstevel@tonic-gate case SYS_getrlimit64:
51737c478bd9Sstevel@tonic-gate if (err)
51747c478bd9Sstevel@tonic-gate break;
51757c478bd9Sstevel@tonic-gate /*FALLTHROUGH*/
51767c478bd9Sstevel@tonic-gate case SYS_setrlimit64:
51777c478bd9Sstevel@tonic-gate if (pri->sys_nargs <= 1)
51787c478bd9Sstevel@tonic-gate break;
51797c478bd9Sstevel@tonic-gate show_rlimit64(pri, (long)pri->sys_args[1]);
51807c478bd9Sstevel@tonic-gate break;
51817c478bd9Sstevel@tonic-gate case SYS_uname:
51827c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 0)
51837c478bd9Sstevel@tonic-gate show_nuname(pri, (long)pri->sys_args[0]);
51847c478bd9Sstevel@tonic-gate break;
51857c478bd9Sstevel@tonic-gate case SYS_adjtime:
51867c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
51877c478bd9Sstevel@tonic-gate show_adjtime(pri, (long)pri->sys_args[0],
5188019c3c43Sraf (long)pri->sys_args[1]);
51897c478bd9Sstevel@tonic-gate break;
51907c478bd9Sstevel@tonic-gate case SYS_lwp_info:
51917c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 0)
51927c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "cpu time");
51937c478bd9Sstevel@tonic-gate break;
51947c478bd9Sstevel@tonic-gate case SYS_lwp_wait:
51957c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 1)
51967c478bd9Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[1], "lwpid");
51977c478bd9Sstevel@tonic-gate break;
51987c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_wakeup:
51997c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_unlock:
52007c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_trylock:
5201883492d5Sraf case SYS_lwp_mutex_register:
52027c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52037c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]);
52047c478bd9Sstevel@tonic-gate break;
52057c478bd9Sstevel@tonic-gate case SYS_lwp_mutex_timedlock:
52067c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52077c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[0]);
52087c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
52097c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout");
52107c478bd9Sstevel@tonic-gate break;
52117c478bd9Sstevel@tonic-gate case SYS_lwp_cond_wait:
52127c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52137c478bd9Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]);
52147c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
52157c478bd9Sstevel@tonic-gate show_mutex(pri, (long)pri->sys_args[1]);
52167c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2)
52177c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout");
52187c478bd9Sstevel@tonic-gate break;
52197c478bd9Sstevel@tonic-gate case SYS_lwp_cond_signal:
52207c478bd9Sstevel@tonic-gate case SYS_lwp_cond_broadcast:
52217c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52227c478bd9Sstevel@tonic-gate show_condvar(pri, (long)pri->sys_args[0]);
52237c478bd9Sstevel@tonic-gate break;
52247c478bd9Sstevel@tonic-gate case SYS_lwp_sema_trywait:
52257c478bd9Sstevel@tonic-gate case SYS_lwp_sema_post:
52267c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52277c478bd9Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]);
52287c478bd9Sstevel@tonic-gate break;
52297c478bd9Sstevel@tonic-gate case SYS_lwp_sema_timedwait:
52307c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52317c478bd9Sstevel@tonic-gate show_sema(pri, (long)pri->sys_args[0]);
52327c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
52337c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout");
52347c478bd9Sstevel@tonic-gate break;
52357c478bd9Sstevel@tonic-gate case SYS_lwp_rwlock_sys:
52367c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1)
52377c478bd9Sstevel@tonic-gate show_rwlock(pri, (long)pri->sys_args[1]);
52387c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2 &&
52397c478bd9Sstevel@tonic-gate (pri->sys_args[0] == 0 || pri->sys_args[0] == 1))
52407c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[2], "timeout");
52417c478bd9Sstevel@tonic-gate break;
52427c478bd9Sstevel@tonic-gate case SYS_lwp_create:
52437c478bd9Sstevel@tonic-gate /* XXX print some values in ucontext ??? */
52447c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
52457c478bd9Sstevel@tonic-gate show_int(pri, (long)pri->sys_args[2], "lwpid");
52467c478bd9Sstevel@tonic-gate break;
52477c478bd9Sstevel@tonic-gate case SYS_kaio:
52487c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == AIOWAIT && !err && pri->sys_nargs > 1)
52497c478bd9Sstevel@tonic-gate show_timeval(pri, (long)pri->sys_args[1], "timeout");
52507c478bd9Sstevel@tonic-gate break;
52517c478bd9Sstevel@tonic-gate case SYS_nanosleep:
52527c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 0)
52537c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[0], "tmout");
52547c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 1 && (err == 0 || err == EINTR))
52557c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "resid");
52567c478bd9Sstevel@tonic-gate break;
52577c478bd9Sstevel@tonic-gate case SYS_privsys:
52587c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
52597c478bd9Sstevel@tonic-gate case PRIVSYS_SETPPRIV:
52607c478bd9Sstevel@tonic-gate case PRIVSYS_GETPPRIV:
52617c478bd9Sstevel@tonic-gate if (!err)
52627c478bd9Sstevel@tonic-gate show_privset(pri, (long)pri->sys_args[3],
5263019c3c43Sraf (size_t)pri->sys_args[4], "");
52647c478bd9Sstevel@tonic-gate }
52657c478bd9Sstevel@tonic-gate break;
52667c478bd9Sstevel@tonic-gate case SYS_ucredsys:
52677c478bd9Sstevel@tonic-gate switch (pri->sys_args[0]) {
52687c478bd9Sstevel@tonic-gate case UCREDSYS_UCREDGET:
52697c478bd9Sstevel@tonic-gate case UCREDSYS_GETPEERUCRED:
52707c478bd9Sstevel@tonic-gate if (err == 0)
52717c478bd9Sstevel@tonic-gate show_ucred(pri, (long)pri->sys_args[2]);
52727c478bd9Sstevel@tonic-gate break;
52737c478bd9Sstevel@tonic-gate }
52747c478bd9Sstevel@tonic-gate break;
52757c478bd9Sstevel@tonic-gate case SYS_bind:
52767c478bd9Sstevel@tonic-gate case SYS_connect:
52777c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2)
52787c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1],
5279019c3c43Sraf 0, (long)pri->sys_args[2]);
52807c478bd9Sstevel@tonic-gate break;
52817c478bd9Sstevel@tonic-gate case SYS_sendto:
52827c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 5)
52837c478bd9Sstevel@tonic-gate show_sockaddr(pri, "to", (long)pri->sys_args[4], 0,
5284019c3c43Sraf pri->sys_args[5]);
52857c478bd9Sstevel@tonic-gate break;
52867c478bd9Sstevel@tonic-gate case SYS_accept:
52877c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
52887c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1],
5289019c3c43Sraf (long)pri->sys_args[2], 0);
52907c478bd9Sstevel@tonic-gate break;
52917c478bd9Sstevel@tonic-gate case SYS_getsockname:
52927c478bd9Sstevel@tonic-gate case SYS_getpeername:
52937c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
52947c478bd9Sstevel@tonic-gate show_sockaddr(pri, "name", (long)pri->sys_args[1],
5295019c3c43Sraf (long)pri->sys_args[2], 0);
52967c478bd9Sstevel@tonic-gate break;
52977c478bd9Sstevel@tonic-gate case SYS_cladm:
52987c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 2)
52997c478bd9Sstevel@tonic-gate show_cladm(pri, pri->sys_args[0], pri->sys_args[1],
53007c478bd9Sstevel@tonic-gate (long)pri->sys_args[2]);
53017c478bd9Sstevel@tonic-gate break;
53027c478bd9Sstevel@tonic-gate case SYS_recvfrom:
53037c478bd9Sstevel@tonic-gate if (!err && pri->sys_nargs > 5)
53047c478bd9Sstevel@tonic-gate show_sockaddr(pri, "from", (long)pri->sys_args[4],
5305019c3c43Sraf (long)pri->sys_args[5], 0);
53067c478bd9Sstevel@tonic-gate break;
53077c478bd9Sstevel@tonic-gate case SYS_recvmsg:
53087c478bd9Sstevel@tonic-gate if (err)
53097c478bd9Sstevel@tonic-gate break;
53107c478bd9Sstevel@tonic-gate /* FALLTHROUGH */
53117c478bd9Sstevel@tonic-gate case SYS_sendmsg:
531281006e0fSja if (pri->sys_nargs <= 2)
53137c478bd9Sstevel@tonic-gate break;
53147c478bd9Sstevel@tonic-gate if (lp64)
53157c478bd9Sstevel@tonic-gate show_msghdr(pri, pri->sys_args[1]);
53167c478bd9Sstevel@tonic-gate else
53177c478bd9Sstevel@tonic-gate show_msghdr32(pri, pri->sys_args[1]);
53187c478bd9Sstevel@tonic-gate break;
53197c478bd9Sstevel@tonic-gate case SYS_door:
53207c478bd9Sstevel@tonic-gate show_doors(pri);
53217c478bd9Sstevel@tonic-gate break;
53227c478bd9Sstevel@tonic-gate case SYS_sendfilev:
53237c478bd9Sstevel@tonic-gate if (pri->sys_nargs != 5)
53247c478bd9Sstevel@tonic-gate break;
53257c478bd9Sstevel@tonic-gate
53267c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == SENDFILEV) {
53277c478bd9Sstevel@tonic-gate show_sendfilevec(pri, (int)pri->sys_args[1],
5328019c3c43Sraf (sendfilevec_t *)pri->sys_args[2],
5329019c3c43Sraf (int)pri->sys_args[3]);
53307c478bd9Sstevel@tonic-gate } else if (pri->sys_args[0] == SENDFILEV64) {
53317c478bd9Sstevel@tonic-gate show_sendfilevec64(pri, (int)pri->sys_args[1],
5332019c3c43Sraf (sendfilevec64_t *)pri->sys_args[2],
5333019c3c43Sraf (int)pri->sys_args[3]);
53347c478bd9Sstevel@tonic-gate }
53357c478bd9Sstevel@tonic-gate break;
53367c478bd9Sstevel@tonic-gate case SYS_memcntl:
53377c478bd9Sstevel@tonic-gate show_memcntl(pri);
53387c478bd9Sstevel@tonic-gate break;
53397c478bd9Sstevel@tonic-gate case SYS_lwp_park:
534047eb4d1eSsl /*
534147eb4d1eSsl * subcode 0: lwp_park(timespec_t *, id_t)
534247eb4d1eSsl * subcode 4: lwp_set_park(timespec_t *, id_t)
534347eb4d1eSsl */
534447eb4d1eSsl if (pri->sys_nargs > 1 &&
534547eb4d1eSsl (pri->sys_args[0] == 0 || pri->sys_args[0] == 4))
53467c478bd9Sstevel@tonic-gate show_timestruc(pri, (long)pri->sys_args[1], "timeout");
53477c478bd9Sstevel@tonic-gate /* subcode 2: lwp_unpark_all(id_t *, int) */
53487c478bd9Sstevel@tonic-gate if (pri->sys_nargs > 2 && pri->sys_args[0] == 2)
53497c478bd9Sstevel@tonic-gate show_ids(pri, (long)pri->sys_args[1],
535047eb4d1eSsl (int)pri->sys_args[2]);
53517c478bd9Sstevel@tonic-gate break;
53527c478bd9Sstevel@tonic-gate case SYS_ntp_gettime:
53537c478bd9Sstevel@tonic-gate if (!err)
53547c478bd9Sstevel@tonic-gate show_ntp_gettime(pri);
53557c478bd9Sstevel@tonic-gate break;
53567c478bd9Sstevel@tonic-gate case SYS_ntp_adjtime:
53577c478bd9Sstevel@tonic-gate if (!err)
53587c478bd9Sstevel@tonic-gate show_ntp_adjtime(pri);
53597c478bd9Sstevel@tonic-gate break;
53607c478bd9Sstevel@tonic-gate case SYS_rusagesys:
53617c478bd9Sstevel@tonic-gate if (!err)
53627c478bd9Sstevel@tonic-gate if (pri->sys_args[0] == _RUSAGESYS_GETRUSAGE) {
53637c478bd9Sstevel@tonic-gate if (!lp64)
5364019c3c43Sraf show_getrusage32(pri->sys_args[1]);
53657c478bd9Sstevel@tonic-gate else
5366019c3c43Sraf show_getrusage(pri->sys_args[1]);
53677c478bd9Sstevel@tonic-gate }
53687c478bd9Sstevel@tonic-gate break;
53697c478bd9Sstevel@tonic-gate case SYS_port:
53707c478bd9Sstevel@tonic-gate show_ports(pri);
53717c478bd9Sstevel@tonic-gate break;
5372821c4a97Sdp case SYS_zone:
5373821c4a97Sdp show_zones(pri);
5374821c4a97Sdp break;
5375aa4a4f3bSnf case SYS_rctlsys:
5376aa4a4f3bSnf show_rctls(pri);
5377aa4a4f3bSnf break;
53783b862e9aSRoger A. Faulkner case SYS_utimesys:
53793b862e9aSRoger A. Faulkner show_utimesys(pri);
53803b862e9aSRoger A. Faulkner break;
53813e95bd4aSAnders Persson case SYS_sockconfig:
53823e95bd4aSAnders Persson show_sockconfig(pri);
53833e95bd4aSAnders Persson break;
53847c478bd9Sstevel@tonic-gate }
53857c478bd9Sstevel@tonic-gate }
5386