4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
26 * Copyright 2015 Joyent, Inc.
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
38 #include <sys/types.h>
43 #include <sys/statfs.h>
44 #include <sys/times.h>
45 #include <sys/timex.h>
46 #include <sys/utssys.h>
47 #include <sys/utsname.h>
49 #include <sys/ipc_impl.h>
51 #include <sys/msg_impl.h>
53 #include <sys/sem_impl.h>
55 #include <sys/shm_impl.h>
56 #include <sys/dirent.h>
60 #include <sys/termios.h>
61 #include <sys/termiox.h>
62 #include <sys/termio.h>
63 #include <sys/ttold.h>
64 #include <sys/jioctl.h>
65 #include <sys/filio.h>
69 #include <sys/resource.h>
70 #include <sys/statvfs.h>
73 #include <sys/socket.h>
74 #include <netinet/in.h>
76 #include <sys/byteorder.h>
77 #include <arpa/inet.h>
78 #include <sys/audioio.h>
79 #include <sys/cladm.h>
80 #include <sys/synch.h>
81 #include <sys/synch32.h>
82 #include <sys/sysmacros.h>
83 #include <sys/sendfile.h>
86 #include <sys/ucred.h>
87 #include <sys/port_impl.h>
89 #include <sys/priv_impl.h>
91 #include <tsol/label.h>
92 #include <sys/nvpair.h>
93 #include <libnvpair.h>
94 #include <sys/rctl_impl.h>
95 #include <sys/socketvar.h>
96 #include <sys/fs/zfs.h>
97 #include <sys/zfs_ioctl.h>
100 #include "systable.h"
103 void show_sigset(private_t
*, long, const char *);
104 void show_ioctl(private_t
*, int, long);
105 void show_zfs_ioc(private_t
*, long);
108 mk_ctime(char *str
, size_t maxsize
, time_t value
)
110 (void) strftime(str
, maxsize
, "%b %e %H:%M:%S %Z %Y",
115 prtime(private_t
*pri
, const char *name
, time_t value
)
119 mk_ctime(str
, sizeof (str
), value
);
120 (void) printf("%s\t%s%s [ %lu ]\n",
128 prtimeval(private_t
*pri
, const char *name
, struct timeval
*value
)
132 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
133 (void) printf("%s\t%s%s [ %lu.%6.6lu ]\n",
142 prtimestruc(private_t
*pri
, const char *name
, timestruc_t
*value
)
146 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
147 (void) printf("%s\t%s%s [ %lu.%9.9lu ]\n",
156 show_utimens(private_t
*pri
, long offset
)
166 if (data_model
== PR_MODEL_NATIVE
) {
167 if (Pread(Proc
, &utimbuf
, sizeof (utimbuf
), offset
)
176 if (Pread(Proc
, &utimbuf32
, sizeof (utimbuf32
), offset
)
177 != sizeof (utimbuf32
))
180 TIMESPEC32_TO_TIMESPEC(&utimbuf
.atime
, &utimbuf32
.atime
);
181 TIMESPEC32_TO_TIMESPEC(&utimbuf
.mtime
, &utimbuf32
.mtime
);
184 /* print access and modification times */
185 if (utimbuf
.atime
.tv_nsec
== UTIME_OMIT
)
186 (void) printf("%s\tat = UTIME_OMIT\n", pri
->pname
);
187 else if (utimbuf
.atime
.tv_nsec
== UTIME_NOW
)
188 (void) printf("%s\tat = UTIME_NOW\n", pri
->pname
);
190 prtimestruc(pri
, "at = ", &utimbuf
.atime
);
191 if (utimbuf
.mtime
.tv_nsec
== UTIME_OMIT
)
192 (void) printf("%s\tmt = UTIME_OMIT\n", pri
->pname
);
193 else if (utimbuf
.mtime
.tv_nsec
== UTIME_NOW
)
194 (void) printf("%s\tmt = UTIME_NOW\n", pri
->pname
);
196 prtimestruc(pri
, "mt = ", &utimbuf
.mtime
);
200 show_timeofday(private_t
*pri
)
205 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
208 if (data_model
== PR_MODEL_NATIVE
) {
209 if (Pread(Proc
, &tod
, sizeof (tod
), offset
)
213 struct timeval32 tod32
;
215 if (Pread(Proc
, &tod32
, sizeof (tod32
), offset
)
219 TIMEVAL32_TO_TIMEVAL(&tod
, &tod32
);
222 prtimeval(pri
, "time: ", &tod
);
226 show_itimerval(private_t
*pri
, long offset
, const char *name
)
228 struct itimerval itimerval
;
233 if (data_model
== PR_MODEL_NATIVE
) {
234 if (Pread(Proc
, &itimerval
, sizeof (itimerval
), offset
)
235 != sizeof (itimerval
))
238 struct itimerval32 itimerval32
;
240 if (Pread(Proc
, &itimerval32
, sizeof (itimerval32
), offset
)
241 != sizeof (itimerval32
))
244 ITIMERVAL32_TO_ITIMERVAL(&itimerval
, &itimerval32
);
248 "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n",
251 itimerval
.it_interval
.tv_sec
,
252 itimerval
.it_interval
.tv_usec
,
253 itimerval
.it_value
.tv_sec
,
254 itimerval
.it_value
.tv_usec
);
258 show_timeval(private_t
*pri
, long offset
, const char *name
)
260 struct timeval timeval
;
265 if (data_model
== PR_MODEL_NATIVE
) {
266 if (Pread(Proc
, &timeval
, sizeof (timeval
), offset
)
270 struct timeval32 timeval32
;
272 if (Pread(Proc
, &timeval32
, sizeof (timeval32
), offset
)
273 != sizeof (timeval32
))
276 TIMEVAL32_TO_TIMEVAL(&timeval
, &timeval32
);
280 "%s\t%s: %ld.%6.6ld sec\n",
288 show_timestruc(private_t
*pri
, long offset
, const char *name
)
290 timestruc_t timestruc
;
295 if (data_model
== PR_MODEL_NATIVE
) {
296 if (Pread(Proc
, ×truc
, sizeof (timestruc
), offset
)
297 != sizeof (timestruc
))
300 timestruc32_t timestruc32
;
302 if (Pread(Proc
, ×truc32
, sizeof (timestruc32
), offset
)
303 != sizeof (timestruc32
))
306 TIMESPEC32_TO_TIMESPEC(×truc
, ×truc32
);
310 "%s\t%s: %ld.%9.9ld sec\n",
318 show_stime(private_t
*pri
)
320 if (pri
->sys_nargs
>= 1) {
321 /* print new system time */
322 prtime(pri
, "systime = ", (time_t)pri
->sys_args
[0]);
327 show_times(private_t
*pri
)
329 long hz
= sysconf(_SC_CLK_TCK
);
333 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
336 if (data_model
== PR_MODEL_NATIVE
) {
337 if (Pread(Proc
, &tms
, sizeof (tms
), offset
)
343 if (Pread(Proc
, &tms32
, sizeof (tms32
), offset
)
348 * This looks a bit odd (since the values are actually
349 * signed), but we need to suppress sign extension to
350 * preserve compatibility (we've always printed these
351 * numbers as unsigned quantities).
353 tms
.tms_utime
= (unsigned)tms32
.tms_utime
;
354 tms
.tms_stime
= (unsigned)tms32
.tms_stime
;
355 tms
.tms_cutime
= (unsigned)tms32
.tms_cutime
;
356 tms
.tms_cstime
= (unsigned)tms32
.tms_cstime
;
360 "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
370 show_uname(private_t
*pri
, long offset
)
373 * Old utsname buffer (no longer accessible in <sys/utsname.h>).
383 if (offset
!= NULL
&&
384 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
386 "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
396 /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
398 show_ustat(private_t
*pri
, long offset
)
402 if (offset
!= NULL
&&
403 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
405 "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
416 show_ustat32(private_t
*pri
, long offset
)
420 if (offset
!= NULL
&&
421 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
423 "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
434 show_fusers(private_t
*pri
, long offset
, long nproc
)
437 int serial
= (nproc
> 4);
442 /* enter region of lengthy output */
447 Pread(Proc
, &fubuf
, sizeof (fubuf
), offset
) == sizeof (fubuf
)) {
448 (void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
452 fuflags(pri
, fubuf
.fu_flags
));
454 offset
+= sizeof (fubuf
);
457 /* exit region of lengthy output */
463 show_utssys(private_t
*pri
, long r0
)
465 if (pri
->sys_nargs
>= 3) {
466 switch (pri
->sys_args
[2]) {
468 show_uname(pri
, (long)pri
->sys_args
[0]);
471 show_ustat(pri
, (long)pri
->sys_args
[0]);
474 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
482 show_utssys32(private_t
*pri
, long r0
)
484 if (pri
->sys_nargs
>= 3) {
485 switch (pri
->sys_args
[2]) {
487 show_uname(pri
, (long)pri
->sys_args
[0]);
490 show_ustat32(pri
, (long)pri
->sys_args
[0]);
493 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
501 show_cladm(private_t
*pri
, int code
, int function
, long offset
)
508 case CL_GET_BOOTFLAG
:
509 if (Pread(Proc
, &arg
, sizeof (arg
), offset
)
511 if (arg
& CLUSTER_CONFIGURED
)
512 (void) printf("%s\tbootflags="
513 "CLUSTER_CONFIGURED", pri
->pname
);
514 if (arg
& CLUSTER_BOOTED
)
515 (void) printf("|CLUSTER_BOOTED\n");
523 case CL_HIGHEST_NODEID
:
524 if (Pread(Proc
, &arg
, sizeof (arg
), offset
)
526 (void) printf("%s\tnodeid=%d\n",
533 #define ALL_LOCK_TYPES \
534 (USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE | \
535 LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST | \
536 USYNC_PROCESS_ROBUST)
538 /* return cv and mutex types */
540 synch_type(private_t
*pri
, uint_t type
)
542 char *str
= pri
->code_buf
;
544 if (type
& USYNC_PROCESS
)
545 (void) strcpy(str
, "USYNC_PROCESS");
547 (void) strcpy(str
, "USYNC_THREAD");
549 if (type
& LOCK_ERRORCHECK
)
550 (void) strcat(str
, "|LOCK_ERRORCHECK");
551 if (type
& LOCK_RECURSIVE
)
552 (void) strcat(str
, "|LOCK_RECURSIVE");
553 if (type
& LOCK_PRIO_INHERIT
)
554 (void) strcat(str
, "|LOCK_PRIO_INHERIT");
555 if (type
& LOCK_PRIO_PROTECT
)
556 (void) strcat(str
, "|LOCK_PRIO_PROTECT");
557 if (type
& LOCK_ROBUST
)
558 (void) strcat(str
, "|LOCK_ROBUST");
559 if (type
& USYNC_PROCESS_ROBUST
)
560 (void) strcat(str
, "|USYNC_PROCESS_ROBUST");
562 if ((type
&= ~ALL_LOCK_TYPES
) != 0)
563 (void) sprintf(str
+ strlen(str
), "|0x%.4X", type
);
565 return ((const char *)str
);
569 show_mutex(private_t
*pri
, long offset
)
573 if (Pread(Proc
, &mutex
, sizeof (mutex
), offset
) == sizeof (mutex
)) {
574 (void) printf("%s\tmutex type: %s\n",
576 synch_type(pri
, mutex
.mutex_type
));
581 show_condvar(private_t
*pri
, long offset
)
585 if (Pread(Proc
, &condvar
, sizeof (condvar
), offset
)
586 == sizeof (condvar
)) {
587 (void) printf("%s\tcondvar type: %s\n",
589 synch_type(pri
, condvar
.cond_type
));
594 show_sema(private_t
*pri
, long offset
)
598 if (Pread(Proc
, &sema
, sizeof (sema
), offset
) == sizeof (sema
)) {
599 (void) printf("%s\tsema type: %s count = %u\n",
601 synch_type(pri
, sema
.sema_type
),
607 show_rwlock(private_t
*pri
, long offset
)
611 if (Pread(Proc
, &rwlock
, sizeof (rwlock
), offset
) == sizeof (rwlock
)) {
612 (void) printf("%s\trwlock type: %s readers = %d\n",
614 synch_type(pri
, rwlock
.rwlock_type
),
615 rwlock
.rwlock_readers
);
619 /* represent character as itself ('c') or octal (012) */
621 show_char(char *buf
, int c
)
625 if (c
>= ' ' && c
< 0177)
630 (void) sprintf(buf
, fmt
, c
&0xff);
635 show_termio(private_t
*pri
, long offset
)
637 struct termio termio
;
641 if (Pread(Proc
, &termio
, sizeof (termio
), offset
) == sizeof (termio
)) {
643 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
650 (void) printf("%s\t cc: ", pri
->pname
);
651 for (i
= 0; i
< NCC
; i
++)
653 show_char(cbuf
, (int)termio
.c_cc
[i
]));
654 (void) fputc('\n', stdout
);
659 show_termios(private_t
*pri
, long offset
)
661 struct termios termios
;
665 if (Pread(Proc
, &termios
, sizeof (termios
), offset
)
666 == sizeof (termios
)) {
668 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
674 (void) printf("%s\t cc: ", pri
->pname
);
675 for (i
= 0; i
< NCCS
; i
++) {
676 if (i
== NCC
) /* show new chars on new line */
677 (void) printf("\n%s\t\t", pri
->pname
);
679 show_char(cbuf
, (int)termios
.c_cc
[i
]));
681 (void) fputc('\n', stdout
);
686 show_termiox(private_t
*pri
, long offset
)
688 struct termiox termiox
;
691 if (Pread(Proc
, &termiox
, sizeof (termiox
), offset
)
692 == sizeof (termiox
)) {
693 (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
698 for (i
= 1; i
< NFF
; i
++)
699 (void) printf(",0%.3o", termiox
.x_rflag
[i
]);
700 (void) printf(" sflag=0%.3o\n",
706 show_sgttyb(private_t
*pri
, long offset
)
708 struct sgttyb sgttyb
;
710 if (Pread(Proc
, &sgttyb
, sizeof (sgttyb
), offset
) == sizeof (sgttyb
)) {
715 "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
717 sgttyb
.sg_ispeed
&0xff,
718 sgttyb
.sg_ospeed
&0xff,
719 show_char(erase
, sgttyb
.sg_erase
),
720 show_char(kill
, sgttyb
.sg_kill
),
726 show_ltchars(private_t
*pri
, long offset
)
728 struct ltchars ltchars
;
733 if (Pread(Proc
, <chars
, sizeof (ltchars
), offset
)
734 == sizeof (ltchars
)) {
735 (void) printf("%s\t cc: ", pri
->pname
);
736 for (p
= (char *)<chars
, i
= 0; i
< sizeof (ltchars
); i
++)
737 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
738 (void) fputc('\n', stdout
);
743 show_tchars(private_t
*pri
, long offset
)
745 struct tchars tchars
;
750 if (Pread(Proc
, &tchars
, sizeof (tchars
), offset
) == sizeof (tchars
)) {
751 (void) printf("%s\t cc: ", pri
->pname
);
752 for (p
= (char *)&tchars
, i
= 0; i
< sizeof (tchars
); i
++)
753 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
754 (void) fputc('\n', stdout
);
759 show_termcb(private_t
*pri
, long offset
)
761 struct termcb termcb
;
763 if (Pread(Proc
, &termcb
, sizeof (termcb
), offset
) == sizeof (termcb
)) {
765 "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
768 termcb
.st_termt
&0xff,
772 termcb
.st_lrow
&0xff);
776 /* integer value pointed to by ioctl() arg */
778 show_strint(private_t
*pri
, int code
, long offset
)
782 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
783 const char *s
= NULL
;
785 switch (code
) { /* interpret these symbolically */
790 s
= strevents(pri
, val
);
793 s
= tiocflush(pri
, val
);
798 (void) printf("%s\t0x%.8lX: %d\n",
799 pri
->pname
, offset
, val
);
801 (void) printf("%s\t0x%.8lX: %s\n",
802 pri
->pname
, offset
, s
);
807 show_strioctl(private_t
*pri
, long offset
)
809 struct strioctl strioctl
;
811 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
814 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
816 ioctlname(pri
, strioctl
.ic_cmd
),
819 (long)strioctl
.ic_dp
);
821 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
822 show_ioctl(pri
, strioctl
.ic_cmd
,
823 (long)strioctl
.ic_dp
);
830 show_strioctl32(private_t
*pri
, long offset
)
832 struct strioctl32 strioctl
;
834 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
837 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
839 ioctlname(pri
, strioctl
.ic_cmd
),
842 (long)strioctl
.ic_dp
);
844 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
845 show_ioctl(pri
, strioctl
.ic_cmd
,
846 (long)strioctl
.ic_dp
);
853 print_strbuf(private_t
*pri
, struct strbuf
*sp
, const char *name
, int dump
)
856 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
863 * Should we show the buffer contents?
864 * Keyed to the '-r fds' and '-w fds' options?
866 if (sp
->buf
== NULL
|| sp
->len
<= 0)
867 (void) fputc('\n', stdout
);
869 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
873 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
874 (void) strcpy(obuf
, ": \"");
875 showbytes(buffer
, nb
, obuf
+3);
878 (const char *)"\"" : (const char *)"\"..");
879 (void) fputs(obuf
, stdout
);
881 (void) fputc('\n', stdout
);
882 if (dump
&& sp
->len
> 8)
883 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
889 print_strbuf32(private_t
*pri
, struct strbuf32
*sp
, const char *name
, int dump
)
892 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
899 * Should we show the buffer contents?
900 * Keyed to the '-r fds' and '-w fds' options?
902 if (sp
->buf
== NULL
|| sp
->len
<= 0)
903 (void) fputc('\n', stdout
);
905 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
909 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
910 (void) strcpy(obuf
, ": \"");
911 showbytes(buffer
, nb
, obuf
+3);
914 (const char *)"\"" : (const char *)"\"..");
915 (void) fputs(obuf
, stdout
);
917 (void) fputc('\n', stdout
);
918 if (dump
&& sp
->len
> 8)
919 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
924 /* strpeek and strfdinsert flags word */
926 strflags(private_t
*pri
, int flags
)
938 (void) sprintf(pri
->code_buf
, "0x%.4X", flags
);
946 show_strpeek(private_t
*pri
, long offset
)
948 struct strpeek strpeek
;
950 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
951 == sizeof (strpeek
)) {
953 print_strbuf(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
954 print_strbuf(pri
, &strpeek
.databuf
, "dat", FALSE
);
956 (void) printf("%s\tflags=%s\n",
958 strflags(pri
, strpeek
.flags
));
964 show_strpeek32(private_t
*pri
, long offset
)
966 struct strpeek32 strpeek
;
968 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
969 == sizeof (strpeek
)) {
971 print_strbuf32(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
972 print_strbuf32(pri
, &strpeek
.databuf
, "dat", FALSE
);
974 (void) printf("%s\tflags=%s\n",
976 strflags(pri
, strpeek
.flags
));
982 show_strfdinsert(private_t
*pri
, long offset
)
984 struct strfdinsert strfdinsert
;
986 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
987 sizeof (strfdinsert
)) {
989 print_strbuf(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
990 print_strbuf(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
992 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
994 strflags(pri
, strfdinsert
.flags
),
1002 show_strfdinsert32(private_t
*pri
, long offset
)
1004 struct strfdinsert32 strfdinsert
;
1006 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
1007 sizeof (strfdinsert
)) {
1009 print_strbuf32(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
1010 print_strbuf32(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
1012 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
1014 strflags(pri
, strfdinsert
.flags
),
1016 strfdinsert
.offset
);
1022 show_strrecvfd(private_t
*pri
, long offset
)
1024 struct strrecvfd strrecvfd
;
1026 if (Pread(Proc
, &strrecvfd
, sizeof (strrecvfd
), offset
) ==
1027 sizeof (strrecvfd
)) {
1029 "%s\tfd=%-5d uid=%-5u gid=%u\n",
1038 show_strlist(private_t
*pri
, long offset
)
1040 struct str_list strlist
;
1041 struct str_mlist list
;
1044 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
1046 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1049 (long)strlist
.sl_modlist
);
1051 count
= strlist
.sl_nmods
;
1052 offset
= (long)strlist
.sl_modlist
;
1053 while (!interrupt
&& --count
>= 0) {
1054 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
1057 (void) printf("%s\t\t\"%.*s\"\n",
1059 (int)sizeof (list
.l_name
),
1061 offset
+= sizeof (struct str_mlist
);
1068 show_strlist32(private_t
*pri
, long offset
)
1070 struct str_list32 strlist
;
1071 struct str_mlist list
;
1074 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
1076 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1079 (long)strlist
.sl_modlist
);
1081 count
= strlist
.sl_nmods
;
1082 offset
= (long)strlist
.sl_modlist
;
1083 while (!interrupt
&& --count
>= 0) {
1084 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
1087 (void) printf("%s\t\t\"%.*s\"\n",
1089 (int)sizeof (list
.l_name
),
1091 offset
+= sizeof (struct str_mlist
);
1098 show_jwinsize(private_t
*pri
, long offset
)
1100 struct jwinsize jwinsize
;
1102 if (Pread(Proc
, &jwinsize
, sizeof (jwinsize
), offset
) ==
1103 sizeof (jwinsize
)) {
1105 "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1107 (unsigned)jwinsize
.bytesx
,
1108 (unsigned)jwinsize
.bytesy
,
1109 (unsigned)jwinsize
.bitsx
,
1110 (unsigned)jwinsize
.bitsy
);
1115 show_winsize(private_t
*pri
, long offset
)
1117 struct winsize winsize
;
1119 if (Pread(Proc
, &winsize
, sizeof (winsize
), offset
)
1120 == sizeof (winsize
)) {
1122 "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1131 struct audio_stuff
{
1136 const struct audio_stuff audio_output_ports
[] = {
1137 { AUDIO_SPEAKER
, "SPEAKER" },
1138 { AUDIO_HEADPHONE
, "HEADPHONE" },
1139 { AUDIO_LINE_OUT
, "LINE_OUT" },
1140 { AUDIO_SPDIF_OUT
, "SPDIF_OUT" },
1141 { AUDIO_AUX1_OUT
, "AUX1_OUT" },
1142 { AUDIO_AUX2_OUT
, "AUX2_OUT" },
1146 const struct audio_stuff audio_input_ports
[] = {
1147 { AUDIO_MICROPHONE
, "MICROPHONE" },
1148 { AUDIO_LINE_IN
, "LINE_IN" },
1150 { AUDIO_SPDIF_IN
, "SPDIF_IN" },
1151 { AUDIO_AUX1_IN
, "AUX1_IN" },
1152 { AUDIO_AUX2_IN
, "AUX2_IN" },
1153 { AUDIO_CODEC_LOOPB_IN
, "CODEC_LOOPB_IN" },
1154 { AUDIO_SUNVTS
, "SUNVTS" },
1158 static const struct audio_stuff audio_hw_features
[] = {
1159 { AUDIO_HWFEATURE_DUPLEX
, "DUPLEX" },
1160 { AUDIO_HWFEATURE_MSCODEC
, "MSCODEC" },
1161 { AUDIO_HWFEATURE_IN2OUT
, "IN2OUT" },
1162 { AUDIO_HWFEATURE_PLAY
, "PLAY" },
1163 { AUDIO_HWFEATURE_RECORD
, "RECORD" },
1167 static const struct audio_stuff audio_sw_features
[] = {
1168 { AUDIO_SWFEATURE_MIXER
, "MIXER" },
1173 show_audio_features(const private_t
*pri
,
1174 const struct audio_stuff
*audio_porttab
, uint_t features
,
1177 (void) printf("%s\t%s=", pri
->pname
, name
);
1178 if (features
== 0) {
1179 (void) printf("0\n");
1183 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1184 if (features
& audio_porttab
->bit
) {
1185 (void) printf(audio_porttab
->str
);
1186 features
&= ~audio_porttab
->bit
;
1188 (void) putchar('|');
1192 (void) printf("0x%x", features
);
1193 (void) putchar('\n');
1197 show_audio_ports(private_t
*pri
, const char *mode
,
1198 const char *field
, uint_t ports
)
1200 const struct audio_stuff
*audio_porttab
;
1202 (void) printf("%s\t%s\t%s=", pri
->pname
, mode
, field
);
1204 (void) printf("0\n");
1208 audio_porttab
= audio_output_ports
;
1210 audio_porttab
= audio_input_ports
;
1211 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1212 if (ports
& audio_porttab
->bit
) {
1213 (void) printf(audio_porttab
->str
);
1214 ports
&= ~audio_porttab
->bit
;
1216 (void) putchar('|');
1220 (void) printf("0x%x", ports
);
1221 (void) putchar('\n');
1225 show_audio_prinfo(private_t
*pri
, const char *mode
, struct audio_prinfo
*au_pr
)
1230 * The following values describe the audio data encoding.
1233 (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1240 switch (au_pr
->encoding
) {
1241 case AUDIO_ENCODING_NONE
: s
= "NONE"; break;
1242 case AUDIO_ENCODING_ULAW
: s
= "ULAW"; break;
1243 case AUDIO_ENCODING_ALAW
: s
= "ALAW"; break;
1244 case AUDIO_ENCODING_LINEAR
: s
= "LINEAR"; break;
1245 case AUDIO_ENCODING_DVI
: s
= "DVI"; break;
1246 case AUDIO_ENCODING_LINEAR8
: s
= "LINEAR8"; break;
1249 (void) printf("%s\t%s\tencoding=%s\n", pri
->pname
, mode
, s
);
1251 (void) printf("%s\t%s\tencoding=%u\n",
1252 pri
->pname
, mode
, au_pr
->encoding
);
1256 * The following values control audio device configuration
1260 "%s\t%s\tgain=%u buffer_size=%u\n",
1263 au_pr
->buffer_size
);
1264 show_audio_ports(pri
, mode
, "port", au_pr
->port
);
1265 show_audio_ports(pri
, mode
, "avail_ports", au_pr
->avail_ports
);
1266 show_audio_ports(pri
, mode
, "mod_ports", au_pr
->mod_ports
);
1269 * The following values describe driver state
1272 (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1278 (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1285 * The following values are read-only state flags
1287 (void) printf("%s\t%s\topen=%u active=%u\n",
1294 show_audio_info(private_t
*pri
, long offset
)
1296 struct audio_info au
;
1298 if (Pread(Proc
, &au
, sizeof (au
), offset
) == sizeof (au
)) {
1299 show_audio_prinfo(pri
, "play", &au
.play
);
1300 show_audio_prinfo(pri
, "record", &au
.record
);
1301 (void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1302 pri
->pname
, au
.monitor_gain
, au
.output_muted
);
1303 show_audio_features(pri
, audio_hw_features
, au
.hw_features
,
1305 show_audio_features(pri
, audio_sw_features
, au
.sw_features
,
1307 show_audio_features(pri
, audio_sw_features
,
1308 au
.sw_features_enabled
, "sw_features_enabled");
1313 show_ioctl(private_t
*pri
, int code
, long offset
)
1315 int lp64
= (data_model
== PR_MODEL_LP64
);
1316 int err
= pri
->Errno
; /* don't display output parameters */
1317 /* for a failed system call */
1333 show_termio(pri
, offset
);
1342 show_termios(pri
, offset
);
1351 show_termiox(pri
, offset
);
1359 show_sgttyb(pri
, offset
);
1366 show_ltchars(pri
, offset
);
1373 show_tchars(pri
, offset
);
1380 show_termcb(pri
, offset
);
1382 /* streams ioctl()s */
1384 /* these are displayed as strings in the arg list */
1385 /* by prt_ioa(). don't display them again here */
1389 /* these are displayed as decimal in the arg list */
1390 /* by prt_ioa(). don't display them again here */
1394 /* these are displayed symbolically in the arg list */
1395 /* by prt_ioa(). don't display them again here */
1400 /* this one just ignores the argument */
1404 /* these return something in an int pointed to by arg */
1416 /* these pass something in an int pointed to by arg */
1422 show_strint(pri
, code
, offset
);
1424 /* these all point to structures */
1428 show_strioctl(pri
, offset
);
1430 show_strioctl32(pri
, offset
);
1432 show_strioctl(pri
, offset
);
1438 show_strpeek(pri
, offset
);
1440 show_strpeek32(pri
, offset
);
1442 show_strpeek(pri
, offset
);
1448 show_strfdinsert(pri
, offset
);
1450 show_strfdinsert32(pri
, offset
);
1452 show_strfdinsert(pri
, offset
);
1458 show_strrecvfd(pri
, offset
);
1465 show_strlist(pri
, offset
);
1467 show_strlist32(pri
, offset
);
1469 show_strlist(pri
, offset
);
1475 show_jwinsize(pri
, offset
);
1482 show_winsize(pri
, offset
);
1485 case (int)AUDIO_SETINFO
:
1486 show_audio_info(pri
, offset
);
1490 if ((code
& ~0xff) == ZFS_IOC
) {
1491 show_zfs_ioc(pri
, offset
);
1495 if (code
& IOC_INOUT
) {
1496 const char *str
= ioctldatastruct(code
);
1498 (void) printf("\t\t%s",
1499 (code
& IOC_INOUT
) == IOC_INOUT
? "write/read" :
1500 code
& IOC_IN
? "write" : "read");
1502 (void) printf(" (struct %s)\n", str
);
1504 (void) printf(" %d bytes\n",
1505 (code
>> 16) & IOCPARM_MASK
);
1512 show_statvfs(private_t
*pri
)
1515 struct statvfs statvfs
;
1518 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1519 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1520 == sizeof (statvfs
)) {
1522 "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1526 (u_longlong_t
)statvfs
.f_blocks
,
1527 (u_longlong_t
)statvfs
.f_bfree
);
1529 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1531 (u_longlong_t
)statvfs
.f_bavail
,
1532 (u_longlong_t
)statvfs
.f_files
,
1533 (u_longlong_t
)statvfs
.f_ffree
,
1534 (u_longlong_t
)statvfs
.f_favail
);
1536 "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1540 (long)statvfs
.f_namemax
);
1544 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1545 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1546 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1549 (void) printf("%s\tfstr=\"%.*s\"\n",
1551 (int)sizeof (statvfs
.f_fstr
),
1558 show_statvfs32(private_t
*pri
)
1561 struct statvfs32 statvfs
;
1564 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1565 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1566 == sizeof (statvfs
)) {
1568 "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1575 "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1582 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1586 (int)statvfs
.f_namemax
);
1590 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1591 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1592 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1595 (void) printf("%s\tfstr=\"%.*s\"\n",
1597 (int)sizeof (statvfs
.f_fstr
),
1604 show_statvfs64(private_t
*pri
)
1607 struct statvfs64_32 statvfs
;
1610 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1611 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1612 == sizeof (statvfs
)) {
1614 "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1618 (u_longlong_t
)statvfs
.f_blocks
,
1619 (u_longlong_t
)statvfs
.f_bfree
);
1621 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1623 (u_longlong_t
)statvfs
.f_bavail
,
1624 (u_longlong_t
)statvfs
.f_files
,
1625 (u_longlong_t
)statvfs
.f_ffree
,
1626 (u_longlong_t
)statvfs
.f_favail
);
1628 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1632 (int)statvfs
.f_namemax
);
1636 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1637 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1638 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1641 (void) printf("%s\tfstr=\"%.*s\"\n",
1643 (int)sizeof (statvfs
.f_fstr
),
1649 show_statfs(private_t
*pri
)
1652 struct statfs statfs
;
1654 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
&&
1655 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1657 "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1666 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1675 show_statfs32(private_t
*pri
)
1678 struct statfs32 statfs
;
1680 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
&&
1681 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1683 "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1692 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1701 show_flock32(private_t
*pri
, long offset
)
1703 struct flock32 flock
;
1705 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1706 const char *str
= NULL
;
1708 (void) printf("%s\ttyp=", pri
->pname
);
1710 switch (flock
.l_type
) {
1722 (void) printf("%s", str
);
1724 (void) printf("%-7d", flock
.l_type
);
1726 str
= whencearg(flock
.l_whence
);
1728 (void) printf(" whence=%s", str
);
1730 (void) printf(" whence=%-8u", flock
.l_whence
);
1733 " start=%-5d len=%-5d sys=%-2u pid=%d\n",
1742 show_flock64(private_t
*pri
, long offset
)
1744 struct flock64 flock
;
1746 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1747 const char *str
= NULL
;
1749 (void) printf("%s\ttyp=", pri
->pname
);
1751 switch (flock
.l_type
) {
1763 (void) printf("%s", str
);
1765 (void) printf("%-7d", flock
.l_type
);
1767 str
= whencearg(flock
.l_whence
);
1769 (void) printf(" whence=%s", str
);
1771 (void) printf(" whence=%-8u", flock
.l_whence
);
1774 " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1775 (long long)flock
.l_start
,
1776 (long long)flock
.l_len
,
1783 show_share(private_t
*pri
, long offset
)
1785 struct fshare fshare
;
1787 if (Pread(Proc
, &fshare
, sizeof (fshare
), offset
) == sizeof (fshare
)) {
1788 const char *str
= NULL
;
1791 (void) printf("%s\taccess=", pri
->pname
);
1793 switch (fshare
.f_access
) {
1805 (void) printf("%s", str
);
1807 (void) printf("%-7d", fshare
.f_access
);
1810 if (fshare
.f_deny
& F_MANDDNY
) {
1811 fshare
.f_deny
&= ~F_MANDDNY
;
1814 switch (fshare
.f_deny
) {
1833 (void) printf(" deny=F_MANDDNY|%s", str
);
1835 (void) printf(" deny=%s", str
);
1837 (void) printf(" deny=0x%x", manddny
?
1838 fshare
.f_deny
| F_MANDDNY
: fshare
.f_deny
);
1841 (void) printf(" id=%x\n", fshare
.f_id
);
1846 show_ffg(private_t
*pri
)
1848 (void) putchar('\t');
1849 (void) putchar('\t');
1850 prt_ffg(pri
, 0, pri
->Rval1
);
1851 (void) puts(pri
->sys_string
);
1854 /* print values in fcntl() pointed-to structure */
1856 show_fcntl(private_t
*pri
)
1860 if (pri
->sys_nargs
>= 2 && pri
->sys_args
[1] == F_GETFL
) {
1865 if (pri
->sys_nargs
< 3 || (offset
= pri
->sys_args
[2]) == NULL
)
1868 switch (pri
->sys_args
[1]) {
1875 case F_SETLK_NBMAND
:
1881 if (data_model
== PR_MODEL_LP64
)
1882 show_flock64(pri
, offset
);
1884 show_flock32(pri
, offset
);
1886 case 33: /* F_GETLK64 */
1887 case 34: /* F_SETLK64 */
1888 case 35: /* F_SETLKW64 */
1889 case 27: /* F_FREESP64 */
1890 case 28: /* F_ALLOCSP64 */
1891 case 44: /* F_SETLK64_NBMAND */
1892 case 50: /* F_OFD_GETLK64 */
1893 case 51: /* F_OFD_SETLK64 */
1894 case 52: /* F_OFD_SETLKW64 */
1895 case 55: /* F_FLOCK64 */
1896 case 56: /* F_FLOCKW64 */
1897 show_flock64(pri
, offset
);
1905 case F_SETLK_NBMAND
:
1906 show_flock32(pri
, offset
);
1913 case F_SETLK64_NBMAND
:
1916 case F_OFD_SETLKW64
:
1919 show_flock64(pri
, offset
);
1924 show_share(pri
, offset
);
1930 show_strbuf(private_t
*pri
, long offset
, const char *name
, int dump
)
1932 struct strbuf strbuf
;
1934 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1935 print_strbuf(pri
, &strbuf
, name
, dump
);
1940 show_strbuf32(private_t
*pri
, long offset
, const char *name
, int dump
)
1942 struct strbuf32 strbuf
;
1944 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1945 print_strbuf32(pri
, &strbuf
, name
, dump
);
1950 show_gp_msg(private_t
*pri
, int what
)
1954 int fdp1
= pri
->sys_args
[0] + 1;
1959 if (pri
->Errno
== 0 && prismember(&readfd
, fdp1
))
1964 if (prismember(&writefd
, fdp1
))
1969 /* enter region of lengthy output */
1974 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
) {
1975 if (data_model
== PR_MODEL_LP64
)
1976 show_strbuf(pri
, offset
, "ctl", dump
);
1978 show_strbuf32(pri
, offset
, "ctl", dump
);
1980 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != NULL
) {
1981 if (data_model
== PR_MODEL_LP64
)
1982 show_strbuf(pri
, offset
, "dat", dump
);
1984 show_strbuf32(pri
, offset
, "dat", dump
);
1987 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
)
1988 show_strbuf(pri
, offset
, "ctl", dump
);
1989 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != NULL
)
1990 show_strbuf(pri
, offset
, "dat", dump
);
1993 /* exit region of lengthy output */
1999 show_int(private_t
*pri
, long offset
, const char *name
)
2004 Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
2005 (void) printf("%s\t%s:\t%d\n",
2012 show_hhex_int(private_t
*pri
, long offset
, const char *name
)
2016 if (Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
2017 (void) printf("%s\t%s:\t0x%.4X\n",
2023 #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \
2024 POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
2027 pollevent(private_t
*pri
, int arg
)
2029 char *str
= pri
->code_buf
;
2033 if (arg
& ~ALL_POLL_FLAGS
) {
2034 (void) sprintf(str
, "0x%-5X", arg
);
2035 return ((const char *)str
);
2040 (void) strcat(str
, "|POLLIN");
2042 (void) strcat(str
, "|POLLPRI");
2044 (void) strcat(str
, "|POLLOUT");
2045 if (arg
& POLLRDNORM
)
2046 (void) strcat(str
, "|POLLRDNORM");
2047 if (arg
& POLLRDBAND
)
2048 (void) strcat(str
, "|POLLRDBAND");
2049 if (arg
& POLLWRBAND
)
2050 (void) strcat(str
, "|POLLWRBAND");
2052 (void) strcat(str
, "|POLLERR");
2054 (void) strcat(str
, "|POLLHUP");
2056 (void) strcat(str
, "|POLLNVAL");
2058 return ((const char *)(str
+1));
2062 show_one_pollfd(private_t
*pri
, struct pollfd
*ppollfd
)
2065 * can't print both events and revents in same printf.
2066 * pollevent() returns a pointer to a TSD location.
2068 (void) printf("%s\tfd=%-2d ev=%s",
2069 pri
->pname
, ppollfd
->fd
, pollevent(pri
, ppollfd
->events
));
2070 (void) printf(" rev=%s\n", pollevent(pri
, ppollfd
->revents
));
2074 show_all_pollfds(private_t
*pri
, long offset
, int nfds
)
2076 struct pollfd pollfd
[2];
2079 for (; nfds
&& !interrupt
; nfds
--, offset
+= sizeof (struct pollfd
)) {
2080 if (Pread(Proc
, &pollfd
[0], sizeof (struct pollfd
), offset
) !=
2081 sizeof (struct pollfd
))
2084 if (skip
>= 0 && pollfd
[0].fd
== pollfd
[1].fd
&&
2085 pollfd
[0].events
== pollfd
[1].events
&&
2086 pollfd
[0].revents
== pollfd
[1].revents
) {
2092 (void) printf("%s\t...last pollfd structure"
2093 " repeated %d time%s...\n",
2094 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2097 show_one_pollfd(pri
, &pollfd
[0]);
2098 pollfd
[1] = pollfd
[0];
2103 "%s\t...last pollfd structure repeated %d time%s...\n",
2104 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2108 show_pollsys(private_t
*pri
)
2114 if (pri
->sys_nargs
< 2)
2117 offset
= pri
->sys_args
[0];
2118 nfds
= pri
->sys_args
[1];
2120 /* enter region of lengthy output */
2121 if (offset
!= NULL
&& nfds
> 32) {
2126 if (offset
!= NULL
&& nfds
> 0)
2127 show_all_pollfds(pri
, offset
, nfds
);
2129 if (pri
->sys_nargs
> 2)
2130 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
2132 if (pri
->sys_nargs
> 3)
2133 show_sigset(pri
, (long)pri
->sys_args
[3], "sigmask");
2135 /* exit region of lengthy output */
2141 show_perm64(private_t
*pri
, struct ipc_perm64
*ip
)
2143 (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
2144 "m=0%.6o key=%d projid=%-5d\n",
2150 (int)ip
->ipcx_zoneid
,
2151 (unsigned int)ip
->ipcx_mode
,
2153 (int)ip
->ipcx_projid
);
2157 show_perm(private_t
*pri
, struct ipc_perm
*ip
)
2160 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2173 show_perm32(private_t
*pri
, struct ipc_perm32
*ip
)
2176 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2189 show_msgctl64(private_t
*pri
, long offset
)
2191 struct msqid_ds64 msgq
;
2193 if (offset
!= NULL
&&
2194 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2195 show_perm64(pri
, &msgq
.msgx_perm
);
2197 (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
2198 "lspid=%-5d lrpid=%-5d\n", pri
->pname
,
2199 (unsigned long long)msgq
.msgx_cbytes
,
2200 (unsigned long long)msgq
.msgx_qnum
,
2201 (unsigned long long)msgq
.msgx_qbytes
,
2202 (int)msgq
.msgx_lspid
,
2203 (int)msgq
.msgx_lrpid
);
2205 prtime(pri
, " st = ", (time_t)msgq
.msgx_stime
);
2206 prtime(pri
, " rt = ", (time_t)msgq
.msgx_rtime
);
2207 prtime(pri
, " ct = ", (time_t)msgq
.msgx_ctime
);
2212 show_msgctl(private_t
*pri
, long offset
)
2214 struct msqid_ds msgq
;
2216 if (offset
!= NULL
&&
2217 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2218 show_perm(pri
, &msgq
.msg_perm
);
2221 "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2226 (int)msgq
.msg_lspid
,
2227 (int)msgq
.msg_lrpid
);
2229 prtime(pri
, " st = ", msgq
.msg_stime
);
2230 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2231 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2237 show_msgctl32(private_t
*pri
, long offset
)
2239 struct msqid_ds32 msgq
;
2241 if (offset
!= NULL
&&
2242 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2243 show_perm32(pri
, &msgq
.msg_perm
);
2246 "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2254 prtime(pri
, " st = ", msgq
.msg_stime
);
2255 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2256 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2262 show_msgbuf(private_t
*pri
, long offset
, long msgsz
)
2266 if (offset
!= NULL
&&
2267 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2268 sizeof (msgb
.mtype
)) {
2269 /* enter region of lengthy output */
2270 if (msgsz
> MYBUFSIZ
/ 4)
2273 (void) printf("%s\tmtype=%lu mtext[]=\n",
2277 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2279 /* exit region of lengthy output */
2280 if (msgsz
> MYBUFSIZ
/ 4)
2287 show_msgbuf32(private_t
*pri
, long offset
, long msgsz
)
2289 struct ipcmsgbuf32 msgb
;
2291 if (offset
!= NULL
&&
2292 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2293 sizeof (msgb
.mtype
)) {
2294 /* enter region of lengthy output */
2295 if (msgsz
> MYBUFSIZ
/ 4)
2298 (void) printf("%s\tmtype=%u mtext[]=\n",
2302 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2304 /* exit region of lengthy output */
2305 if (msgsz
> MYBUFSIZ
/ 4)
2313 show_msgsys(private_t
*pri
, long msgsz
)
2315 switch (pri
->sys_args
[0]) {
2316 case 0: /* msgget() */
2318 case 1: /* msgctl() */
2319 if (pri
->sys_nargs
> 3) {
2320 switch (pri
->sys_args
[2]) {
2326 if (data_model
== PR_MODEL_LP64
)
2328 (long)pri
->sys_args
[3]);
2331 (long)pri
->sys_args
[3]);
2338 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2343 case 2: /* msgrcv() */
2344 if (!pri
->Errno
&& pri
->sys_nargs
> 2) {
2345 if (data_model
== PR_MODEL_LP64
)
2346 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2348 show_msgbuf32(pri
, pri
->sys_args
[2], msgsz
);
2351 case 3: /* msgsnd() */
2352 if (pri
->sys_nargs
> 3) {
2353 if (data_model
== PR_MODEL_LP64
)
2354 show_msgbuf(pri
, pri
->sys_args
[2],
2357 show_msgbuf32(pri
, pri
->sys_args
[2],
2361 case 4: /* msgids() */
2362 case 5: /* msgsnap() */
2363 default: /* unexpected subcode */
2369 show_msgsys(private_t
*pri
, long msgsz
)
2371 switch (pri
->sys_args
[0]) {
2372 case 0: /* msgget() */
2374 case 1: /* msgctl() */
2375 if (pri
->sys_nargs
> 3) {
2376 switch (pri
->sys_args
[2]) {
2382 show_msgctl(pri
, (long)pri
->sys_args
[3]);
2389 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2394 case 2: /* msgrcv() */
2395 if (!pri
->Errno
&& pri
->sys_nargs
> 2)
2396 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2398 case 3: /* msgsnd() */
2399 if (pri
->sys_nargs
> 3)
2400 show_msgbuf(pri
, pri
->sys_args
[2],
2403 case 4: /* msgids() */
2404 case 5: /* msgsnap() */
2405 default: /* unexpected subcode */
2412 show_semctl64(private_t
*pri
, long offset
)
2414 struct semid_ds64 semds
;
2416 if (offset
!= NULL
&&
2417 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2418 show_perm64(pri
, &semds
.semx_perm
);
2420 (void) printf("%s\tnsems=%u\n", pri
->pname
, semds
.semx_nsems
);
2422 prtime(pri
, " ot = ", (time_t)semds
.semx_otime
);
2423 prtime(pri
, " ct = ", (time_t)semds
.semx_ctime
);
2428 show_semctl(private_t
*pri
, long offset
)
2430 struct semid_ds semds
;
2432 if (offset
!= NULL
&&
2433 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2434 show_perm(pri
, &semds
.sem_perm
);
2436 (void) printf("%s\tnsems=%u\n",
2440 prtime(pri
, " ot = ", semds
.sem_otime
);
2441 prtime(pri
, " ct = ", semds
.sem_ctime
);
2447 show_semctl32(private_t
*pri
, long offset
)
2449 struct semid_ds32 semds
;
2451 if (offset
!= NULL
&&
2452 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2453 show_perm32(pri
, &semds
.sem_perm
);
2455 (void) printf("%s\tnsems=%u\n",
2459 prtime(pri
, " ot = ", semds
.sem_otime
);
2460 prtime(pri
, " ct = ", semds
.sem_ctime
);
2466 show_semop(private_t
*pri
, long offset
, long nsops
, long timeout
)
2468 struct sembuf sembuf
;
2474 if (nsops
> 40) /* let's not be ridiculous */
2477 for (; nsops
> 0 && !interrupt
; --nsops
, offset
+= sizeof (sembuf
)) {
2478 if (Pread(Proc
, &sembuf
, sizeof (sembuf
), offset
) !=
2482 (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2487 if (sembuf
.sem_flg
== 0)
2488 (void) printf("0\n");
2489 else if ((str
= semflags(pri
, sembuf
.sem_flg
)) != NULL
)
2490 (void) printf("%s\n", str
);
2492 (void) printf("0%.6o\n", sembuf
.sem_flg
);
2495 show_timestruc(pri
, timeout
, "timeout");
2499 show_semsys(private_t
*pri
)
2501 switch (pri
->sys_args
[0]) {
2502 case 0: /* semctl() */
2503 if (pri
->sys_nargs
> 4) {
2504 switch (pri
->sys_args
[3]) {
2511 if (data_model
== PR_MODEL_LP64
)
2513 (long)pri
->sys_args
[4]);
2516 (long)pri
->sys_args
[4]);
2518 show_semctl(pri
, (long)pri
->sys_args
[4]);
2526 show_semctl64(pri
, (long)pri
->sys_args
[4]);
2531 case 1: /* semget() */
2533 case 2: /* semop() */
2534 if (pri
->sys_nargs
> 3)
2535 show_semop(pri
, (long)pri
->sys_args
[2],
2536 pri
->sys_args
[3], 0);
2538 case 3: /* semids() */
2540 case 4: /* semtimedop() */
2541 if (pri
->sys_nargs
> 4)
2542 show_semop(pri
, (long)pri
->sys_args
[2],
2543 pri
->sys_args
[3], pri
->sys_args
[4]);
2545 default: /* unexpected subcode */
2551 show_shmctl64(private_t
*pri
, long offset
)
2553 struct shmid_ds64 shmds
;
2555 if (offset
!= NULL
&&
2556 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2557 show_perm64(pri
, &shmds
.shmx_perm
);
2560 "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
2562 (unsigned long long)shmds
.shmx_segsz
,
2563 (int)shmds
.shmx_lpid
,
2564 (int)shmds
.shmx_cpid
,
2565 (unsigned long long)shmds
.shmx_nattch
,
2566 (unsigned long long)shmds
.shmx_cnattch
);
2568 prtime(pri
, " at = ", (time_t)shmds
.shmx_atime
);
2569 prtime(pri
, " dt = ", (time_t)shmds
.shmx_dtime
);
2570 prtime(pri
, " ct = ", (time_t)shmds
.shmx_ctime
);
2575 show_shmctl(private_t
*pri
, long offset
)
2577 struct shmid_ds shmds
;
2579 if (offset
!= NULL
&&
2580 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2581 show_perm(pri
, &shmds
.shm_perm
);
2584 "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2586 (ulong_t
)shmds
.shm_segsz
,
2587 (int)shmds
.shm_lpid
,
2588 (int)shmds
.shm_cpid
,
2592 prtime(pri
, " at = ", shmds
.shm_atime
);
2593 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2594 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2600 show_shmctl32(private_t
*pri
, long offset
)
2602 struct shmid_ds32 shmds
;
2604 if (offset
!= NULL
&&
2605 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2606 show_perm32(pri
, &shmds
.shm_perm
);
2609 "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2617 prtime(pri
, " at = ", shmds
.shm_atime
);
2618 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2619 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2625 show_shmsys(private_t
*pri
)
2627 switch (pri
->sys_args
[0]) {
2628 case 0: /* shmat() */
2630 case 1: /* shmctl() */
2631 if (pri
->sys_nargs
> 3) {
2632 switch (pri
->sys_args
[2]) {
2639 if (data_model
== PR_MODEL_LP64
)
2641 (long)pri
->sys_args
[3]);
2644 (long)pri
->sys_args
[3]);
2646 show_shmctl(pri
, (long)pri
->sys_args
[3]);
2654 show_shmctl64(pri
, (long)pri
->sys_args
[3]);
2659 case 2: /* shmdt() */
2660 case 3: /* shmget() */
2661 case 4: /* shmids() */
2662 default: /* unexpected subcode */
2668 show_groups(private_t
*pri
, long offset
, long count
)
2675 if (count
> 0 && offset
!= NULL
&&
2676 Pread(Proc
, &groups
[0], count
*sizeof (int), offset
) ==
2677 count
*sizeof (int)) {
2680 (void) printf("%s\t", pri
->pname
);
2681 for (n
= 0; !interrupt
&& n
< count
; n
++) {
2682 if (n
!= 0 && n
%10 == 0)
2683 (void) printf("\n%s\t", pri
->pname
);
2684 (void) printf(" %5d", groups
[n
]);
2686 (void) fputc('\n', stdout
);
2691 * This assumes that a sigset_t is simply an array of ints.
2694 sigset_string(private_t
*pri
, sigset_t
*sp
)
2696 char *s
= pri
->code_buf
;
2697 int n
= sizeof (*sp
) / sizeof (int32_t);
2698 int32_t *lp
= (int32_t *)sp
;
2701 int32_t val
= *lp
++;
2704 s
+= sprintf(s
, " 0");
2706 s
+= sprintf(s
, " 0x%.8X", val
);
2709 return (pri
->code_buf
);
2713 show_sigset(private_t
*pri
, long offset
, const char *name
)
2717 if (offset
!= NULL
&&
2718 Pread(Proc
, &sigset
, sizeof (sigset
), offset
) == sizeof (sigset
)) {
2719 (void) printf("%s\t%s =%s\n",
2720 pri
->pname
, name
, sigset_string(pri
, &sigset
));
2726 show_sigaltstack32(private_t
*pri
, long offset
, const char *name
)
2728 struct sigaltstack32 altstack
;
2730 if (offset
!= NULL
&&
2731 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2732 sizeof (altstack
)) {
2733 (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2744 show_sigaltstack(private_t
*pri
, long offset
, const char *name
)
2746 struct sigaltstack altstack
;
2749 if (data_model
!= PR_MODEL_LP64
) {
2750 show_sigaltstack32(pri
, offset
, name
);
2754 if (offset
!= NULL
&&
2755 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2756 sizeof (altstack
)) {
2757 (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2760 (ulong_t
)altstack
.ss_sp
,
2761 (ulong_t
)altstack
.ss_size
,
2768 show_sigaction32(private_t
*pri
, long offset
, const char *name
, long odisp
)
2770 struct sigaction32 sigaction
;
2772 if (offset
!= NULL
&&
2773 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2774 sizeof (sigaction
)) {
2775 /* This is stupid, we shouldn't have to do this */
2777 sigaction
.sa_handler
= (caddr32_t
)odisp
;
2779 "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2782 sigaction
.sa_handler
,
2783 sigset_string(pri
, (sigset_t
*)&sigaction
.sa_mask
),
2784 sigaction
.sa_flags
);
2790 show_sigaction(private_t
*pri
, long offset
, const char *name
, long odisp
)
2792 struct sigaction sigaction
;
2795 if (data_model
!= PR_MODEL_LP64
) {
2796 show_sigaction32(pri
, offset
, name
, odisp
);
2800 if (offset
!= NULL
&&
2801 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2802 sizeof (sigaction
)) {
2803 /* This is stupid, we shouldn't have to do this */
2805 sigaction
.sa_handler
= (void (*)())odisp
;
2807 "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2810 (long)sigaction
.sa_handler
,
2811 sigset_string(pri
, &sigaction
.sa_mask
),
2812 sigaction
.sa_flags
);
2818 print_siginfo32(private_t
*pri
, const siginfo32_t
*sip
)
2820 const char *code
= NULL
;
2822 (void) printf("%s siginfo: %s", pri
->pname
,
2823 signame(pri
, sip
->si_signo
));
2825 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2826 (void) printf(" pid=%d uid=%d", sip
->si_pid
, sip
->si_uid
);
2827 if (sip
->si_code
!= 0)
2828 (void) printf(" code=%d", sip
->si_code
);
2829 (void) fputc('\n', stdout
);
2833 switch (sip
->si_signo
) {
2835 (void) fputc('\n', stdout
);
2849 switch (sip
->si_signo
) {
2851 switch (sip
->si_code
) {
2852 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2853 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2854 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2855 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2856 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2857 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2858 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2859 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2863 switch (sip
->si_code
) {
2864 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2865 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2866 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2867 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2868 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2869 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2873 switch (sip
->si_code
) {
2874 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2875 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2876 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2877 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2878 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2879 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2880 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2881 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2882 #if defined(FPE_FLTDEN)
2883 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2888 switch (sip
->si_code
) {
2889 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2890 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2894 switch (sip
->si_code
) {
2896 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2898 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2902 switch (sip
->si_code
) {
2903 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2904 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2905 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2909 switch (sip
->si_code
) {
2910 case CLD_EXITED
: code
= "CLD_EXITED"; break;
2911 case CLD_KILLED
: code
= "CLD_KILLED"; break;
2912 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
2913 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
2914 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
2915 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
2919 switch (sip
->si_code
) {
2920 case POLL_IN
: code
= "POLL_IN"; break;
2921 case POLL_OUT
: code
= "POLL_OUT"; break;
2922 case POLL_MSG
: code
= "POLL_MSG"; break;
2923 case POLL_ERR
: code
= "POLL_ERR"; break;
2924 case POLL_PRI
: code
= "POLL_PRI"; break;
2925 case POLL_HUP
: code
= "POLL_HUP"; break;
2931 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
2932 code
= (const char *)pri
->code_buf
;
2935 switch (sip
->si_signo
) {
2942 (void) printf(" %s addr=0x%.8X",
2947 (void) printf(" %s pid=%d status=0x%.4X",
2954 (void) printf(" %s fd=%d band=%d",
2961 if (sip
->si_errno
!= 0) {
2962 const char *ename
= errname(sip
->si_errno
);
2964 (void) printf(" errno=%d", sip
->si_errno
);
2966 (void) printf("(%s)", ename
);
2969 (void) fputc('\n', stdout
);
2974 print_siginfo(private_t
*pri
, const siginfo_t
*sip
)
2976 const char *code
= NULL
;
2978 (void) printf("%s siginfo: %s", pri
->pname
,
2979 signame(pri
, sip
->si_signo
));
2981 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2982 (void) printf(" pid=%d uid=%u",
2985 if (sip
->si_code
!= 0)
2986 (void) printf(" code=%d", sip
->si_code
);
2987 (void) fputc('\n', stdout
);
2991 switch (sip
->si_signo
) {
2993 (void) fputc('\n', stdout
);
3007 switch (sip
->si_signo
) {
3009 switch (sip
->si_code
) {
3010 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
3011 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
3012 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
3013 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
3014 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
3015 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
3016 case ILL_COPROC
: code
= "ILL_COPROC"; break;
3017 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
3021 switch (sip
->si_code
) {
3022 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
3023 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
3024 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
3025 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
3026 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
3027 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
3031 switch (sip
->si_code
) {
3032 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
3033 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
3034 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
3035 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
3036 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
3037 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
3038 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
3039 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
3040 #if defined(FPE_FLTDEN)
3041 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
3046 switch (sip
->si_code
) {
3047 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
3048 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
3052 switch (sip
->si_code
) {
3054 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
3056 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
3060 switch (sip
->si_code
) {
3061 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
3062 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
3063 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
3067 switch (sip
->si_code
) {
3068 case CLD_EXITED
: code
= "CLD_EXITED"; break;
3069 case CLD_KILLED
: code
= "CLD_KILLED"; break;
3070 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
3071 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
3072 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
3073 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
3077 switch (sip
->si_code
) {
3078 case POLL_IN
: code
= "POLL_IN"; break;
3079 case POLL_OUT
: code
= "POLL_OUT"; break;
3080 case POLL_MSG
: code
= "POLL_MSG"; break;
3081 case POLL_ERR
: code
= "POLL_ERR"; break;
3082 case POLL_PRI
: code
= "POLL_PRI"; break;
3083 case POLL_HUP
: code
= "POLL_HUP"; break;
3089 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
3090 code
= (const char *)pri
->code_buf
;
3093 switch (sip
->si_signo
) {
3100 (void) printf(" %s addr=0x%.8lX",
3102 (long)sip
->si_addr
);
3105 (void) printf(" %s pid=%d status=0x%.4X",
3112 (void) printf(" %s fd=%d band=%ld",
3119 if (sip
->si_errno
!= 0) {
3120 const char *ename
= errname(sip
->si_errno
);
3122 (void) printf(" errno=%d", sip
->si_errno
);
3124 (void) printf("(%s)", ename
);
3127 (void) fputc('\n', stdout
);
3132 show_siginfo32(private_t
*pri
, long offset
)
3134 struct siginfo32 siginfo
;
3136 if (offset
!= NULL
&&
3137 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3138 print_siginfo32(pri
, &siginfo
);
3143 show_siginfo(private_t
*pri
, long offset
)
3145 struct siginfo siginfo
;
3148 if (data_model
!= PR_MODEL_LP64
) {
3149 show_siginfo32(pri
, offset
);
3153 if (offset
!= NULL
&&
3154 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3155 print_siginfo(pri
, &siginfo
);
3159 show_bool(private_t
*pri
, long offset
, int count
)
3161 int serial
= (count
> MYBUFSIZ
/ 4);
3163 /* enter region of lengthy output */
3169 int nb
= (count
< 32)? count
: 32;
3172 if (Pread(Proc
, buf
, (size_t)nb
, offset
) != nb
)
3175 (void) printf("%s ", pri
->pname
);
3176 for (i
= 0; i
< nb
; i
++)
3177 (void) printf(" %d", buf
[i
]);
3178 (void) fputc('\n', stdout
);
3184 /* exit region of lengthy output */
3191 show_iovec32(private_t
*pri
, long offset
, int niov
, int showbuf
, long count
)
3193 iovec32_t iovec
[16];
3196 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3198 if (niov
> 16) /* is this the real limit? */
3201 if (offset
!= NULL
&& niov
> 0 &&
3202 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec32_t
), offset
)
3203 == niov
*sizeof (iovec32_t
)) {
3204 /* enter region of lengthy output */
3208 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3209 (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n",
3213 if ((nb
= count
) > 0) {
3214 if (nb
> ip
->iov_len
)
3219 if (showbuf
&& nb
> 0)
3220 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3223 /* exit region of lengthy output */
3231 show_iovec(private_t
*pri
, long offset
, long niov
, int showbuf
, long count
)
3236 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3239 if (data_model
!= PR_MODEL_LP64
) {
3240 show_iovec32(pri
, offset
, niov
, showbuf
, count
);
3244 if (niov
> 16) /* is this the real limit? */
3247 if (offset
!= NULL
&& niov
> 0 &&
3248 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec_t
), offset
)
3249 == niov
*sizeof (iovec_t
)) {
3250 /* enter region of lengthy output */
3254 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3255 (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n",
3259 if ((nb
= count
) > 0) {
3260 if (nb
> ip
->iov_len
)
3265 if (showbuf
&& nb
> 0)
3266 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3269 /* exit region of lengthy output */
3276 show_dents32(private_t
*pri
, long offset
, long count
)
3278 long buf
[MYBUFSIZ
/ sizeof (long)];
3279 struct dirent32
*dp
;
3280 int serial
= (count
> 100);
3285 /* enter region of lengthy output */
3289 while (count
> 0 && !interrupt
) {
3290 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3292 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3295 dp
= (struct dirent32
*)&buf
[0];
3296 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3298 if ((unsigned)nb
< dp
->d_reclen
) {
3299 /* getdents() error? */
3301 "%s ino=%-5u off=%-4d rlen=%-3d\n",
3309 while (!interrupt
&&
3310 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3311 (unsigned)nb
>= dp
->d_reclen
) {
3313 "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3318 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3321 count
-= dp
->d_reclen
;
3322 offset
+= dp
->d_reclen
;
3323 /* LINTED improper alignment */
3324 dp
= (struct dirent32
*)((char *)dp
+ dp
->d_reclen
);
3328 /* exit region of lengthy output */
3334 show_dents64(private_t
*pri
, long offset
, long count
)
3336 long long buf
[MYBUFSIZ
/ sizeof (long long)];
3337 struct dirent64
*dp
;
3338 int serial
= (count
> 100);
3343 /* enter region of lengthy output */
3347 while (count
> 0 && !interrupt
) {
3348 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3350 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3353 dp
= (struct dirent64
*)&buf
[0];
3354 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3356 if ((unsigned)nb
< dp
->d_reclen
) {
3357 /* getdents() error? */
3359 "%s ino=%-5llu off=%-4lld rlen=%-3d\n",
3361 (long long)dp
->d_ino
,
3362 (long long)dp
->d_off
,
3367 while (!interrupt
&&
3368 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3369 (unsigned)nb
>= dp
->d_reclen
) {
3371 "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3373 (long long)dp
->d_ino
,
3374 (long long)dp
->d_off
,
3376 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3379 count
-= dp
->d_reclen
;
3380 offset
+= dp
->d_reclen
;
3381 /* LINTED improper alignment */
3382 dp
= (struct dirent64
*)((char *)dp
+ dp
->d_reclen
);
3386 /* exit region of lengthy output */
3392 show_rlimit32(private_t
*pri
, long offset
)
3394 struct rlimit32 rlimit
;
3396 if (offset
!= NULL
&&
3397 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3398 (void) printf("%s\t", pri
->pname
);
3399 switch (rlimit
.rlim_cur
) {
3400 case RLIM32_INFINITY
:
3401 (void) fputs("cur = RLIM_INFINITY", stdout
);
3403 case RLIM32_SAVED_MAX
:
3404 (void) fputs("cur = RLIM_SAVED_MAX", stdout
);
3406 case RLIM32_SAVED_CUR
:
3407 (void) fputs("cur = RLIM_SAVED_CUR", stdout
);
3410 (void) printf("cur = %lu", (long)rlimit
.rlim_cur
);
3413 switch (rlimit
.rlim_max
) {
3414 case RLIM32_INFINITY
:
3415 (void) fputs(" max = RLIM_INFINITY\n", stdout
);
3417 case RLIM32_SAVED_MAX
:
3418 (void) fputs(" max = RLIM_SAVED_MAX\n", stdout
);
3420 case RLIM32_SAVED_CUR
:
3421 (void) fputs(" max = RLIM_SAVED_CUR\n", stdout
);
3424 (void) printf(" max = %lu\n", (long)rlimit
.rlim_max
);
3431 show_rlimit64(private_t
*pri
, long offset
)
3433 struct rlimit64 rlimit
;
3435 if (offset
!= NULL
&&
3436 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3437 (void) printf("%s\t", pri
->pname
);
3438 switch (rlimit
.rlim_cur
) {
3439 case RLIM64_INFINITY
:
3440 (void) fputs("cur = RLIM64_INFINITY", stdout
);
3442 case RLIM64_SAVED_MAX
:
3443 (void) fputs("cur = RLIM64_SAVED_MAX", stdout
);
3445 case RLIM64_SAVED_CUR
:
3446 (void) fputs("cur = RLIM64_SAVED_CUR", stdout
);
3449 (void) printf("cur = %llu",
3450 (unsigned long long)rlimit
.rlim_cur
);
3453 switch (rlimit
.rlim_max
) {
3454 case RLIM64_INFINITY
:
3455 (void) fputs(" max = RLIM64_INFINITY\n", stdout
);
3457 case RLIM64_SAVED_MAX
:
3458 (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout
);
3460 case RLIM64_SAVED_CUR
:
3461 (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout
);
3464 (void) printf(" max = %llu\n",
3465 (unsigned long long)rlimit
.rlim_max
);
3472 show_nuname(private_t
*pri
, long offset
)
3474 struct utsname ubuf
;
3476 if (offset
!= NULL
&&
3477 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
3479 "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3490 show_adjtime(private_t
*pri
, long off1
, long off2
)
3492 show_timeval(pri
, off1
, " delta");
3493 show_timeval(pri
, off2
, "olddelta");
3497 show_sockaddr(private_t
*pri
,
3498 const char *str
, long addroff
, long lenoff
, long len
)
3501 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
3502 * also large enough to store a sockaddr_in or a sockaddr_in6.
3504 long buf
[(sizeof (short) + PATH_MAX
+ sizeof (long) - 1)
3506 struct sockaddr
*sa
= (struct sockaddr
*)buf
;
3507 struct sockaddr_in
*sin
= (struct sockaddr_in
*)buf
;
3508 struct sockaddr_un
*soun
= (struct sockaddr_un
*)buf
;
3509 struct sockaddr_in6
*sin6
= (struct sockaddr_in6
*)buf
;
3510 char addrbuf
[INET6_ADDRSTRLEN
];
3514 if (Pread(Proc
, &ilen
, sizeof (ilen
), lenoff
) != sizeof (ilen
))
3519 if (len
>= sizeof (buf
)) /* protect against ridiculous length */
3520 len
= sizeof (buf
) - 1;
3521 if (Pread(Proc
, buf
, len
, addroff
) != len
)
3524 switch (sa
->sa_family
) {
3526 (void) printf("%s\tAF_INET6 %s = %s port = %u\n",
3528 inet_ntop(AF_INET6
, &sin6
->sin6_addr
, addrbuf
,
3530 ntohs(sin6
->sin6_port
));
3531 (void) printf("%s\tscope id = %u source id = 0x%x\n"
3532 "%s\tflow class = 0x%02x flow label = 0x%05x\n",
3533 pri
->pname
, ntohl(sin6
->sin6_scope_id
),
3534 ntohl(sin6
->__sin6_src_id
),
3536 ntohl((sin6
->sin6_flowinfo
& IPV6_FLOWINFO_TCLASS
) >> 20),
3537 ntohl(sin6
->sin6_flowinfo
& IPV6_FLOWINFO_FLOWLABEL
));
3540 (void) printf("%s\tAF_%s %s = %s port = %u\n",
3542 str
, inet_ntop(AF_INET
, &sin
->sin_addr
, addrbuf
,
3543 sizeof (addrbuf
)), ntohs(sin
->sin_port
));
3546 len
-= sizeof (soun
->sun_family
);
3548 /* Null terminate */
3549 soun
->sun_path
[len
] = NULL
;
3550 (void) printf("%s\tAF_UNIX %s = %s\n", pri
->pname
,
3551 str
, soun
->sun_path
);
3558 show_msghdr(private_t
*pri
, long offset
)
3560 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3561 int what
= Lsp
->pr_what
;
3562 int err
= pri
->Errno
;
3564 int showbuf
= FALSE
;
3565 int i
= pri
->sys_args
[0]+1;
3566 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3568 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3571 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3572 show_sockaddr(pri
, "msg_name",
3573 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3576 * Print the iovec if the syscall was successful and the fd is
3577 * part of the set being traced.
3579 if ((what
== SYS_recvmsg
&& !err
&&
3580 prismember(&readfd
, i
)) ||
3581 (what
== SYS_sendmsg
&&
3582 prismember(&writefd
, i
)))
3585 show_iovec(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3591 show_msghdr32(private_t
*pri
, long offset
)
3595 uint32_t msg_namelen
;
3599 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3600 int what
= Lsp
->pr_what
;
3601 int err
= pri
->Errno
;
3602 int showbuf
= FALSE
;
3603 int i
= pri
->sys_args
[0]+1;
3604 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3606 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3609 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3610 show_sockaddr(pri
, "msg_name",
3611 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3613 * Print the iovec if the syscall was successful and the fd is
3614 * part of the set being traced.
3616 if ((what
== SYS_recvmsg
&& !err
&&
3617 prismember(&readfd
, i
)) ||
3618 (what
== SYS_sendmsg
&&
3619 prismember(&writefd
, i
)))
3622 show_iovec32(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3628 show_doorargs(private_t
*pri
, long offset
)
3632 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3633 (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
3635 (ulong_t
)args
.data_ptr
,
3636 (ulong_t
)args
.data_size
);
3637 (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
3639 (ulong_t
)args
.desc_ptr
,
3641 (void) printf("%s\trbuf=0x%lX rsize=%lu\n",
3644 (ulong_t
)args
.rsize
);
3649 show_ucred_privsets(private_t
*pri
, ucred_t
*uc
)
3652 const priv_set_t
*s
;
3656 while ((sn
= priv_getsetbynum(i
++)) != NULL
) {
3657 s
= ucred_getprivset(uc
, sn
);
3662 (void) printf("%s\t%c: %s\n",
3665 str
= priv_set_to_str(s
, ',', PRIV_STR_SHORT
));
3672 show_ucred(private_t
*pri
, long offset
)
3674 ucred_t
*uc
= _ucred_alloc();
3680 sz
= Pread(Proc
, uc
, uc
->uc_size
, offset
);
3683 * A new uc_size is read, it could be smaller than the previously
3684 * value. We accept short reads that fill the whole header.
3686 if (sz
>= sizeof (ucred_t
) && sz
>= uc
->uc_size
) {
3687 (void) printf("%s\teuid=%u egid=%u\n",
3691 (void) printf("%s\truid=%u rgid=%u\n",
3695 (void) printf("%s\tpid=%d zoneid=%d\n",
3697 (int)ucred_getpid(uc
),
3698 (int)ucred_getzoneid(uc
));
3699 show_ucred_privsets(pri
, uc
);
3705 show_privset(private_t
*pri
, long offset
, size_t size
, char *label
)
3707 priv_set_t
*tmp
= priv_allocset();
3713 sz
= Pread(Proc
, tmp
, size
, offset
);
3716 char *str
= priv_set_to_str(tmp
, ',', PRIV_STR_SHORT
);
3718 (void) printf("%s\t%s%s\n", pri
->pname
, label
, str
);
3726 show_doorinfo(private_t
*pri
, long offset
)
3731 if (Pread(Proc
, &info
, sizeof (info
), offset
) != sizeof (info
))
3733 (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
3735 (int)info
.di_target
,
3738 attr
= info
.di_attributes
;
3739 (void) printf("%s\tattributes=%s\n", pri
->pname
, door_flags(pri
, attr
));
3740 (void) printf("%s\tuniquifier=%llu\n", pri
->pname
, info
.di_uniquifier
);
3744 show_doorparam(private_t
*pri
, long offset
)
3748 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3749 (void) printf("%s\tvalue=%lu\n",
3758 show_doorargs32(private_t
*pri
, long offset
)
3760 struct door_arg32 args
;
3762 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3763 (void) printf("%s\tdata_ptr=%X data_size=%u\n",
3767 (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
3771 (void) printf("%s\trbuf=0x%X rsize=%u\n",
3779 show_doorparam32(private_t
*pri
, long offset
)
3783 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3784 (void) printf("%s\tvalue=%u\n",
3793 show_doors(private_t
*pri
)
3795 switch (pri
->sys_args
[5]) {
3798 if (data_model
== PR_MODEL_LP64
)
3799 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3801 show_doorargs32(pri
, (long)pri
->sys_args
[1]);
3803 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3808 show_ucred(pri
, (long)pri
->sys_args
[0]);
3812 show_doorinfo(pri
, (long)pri
->sys_args
[1]);
3817 if (data_model
== PR_MODEL_LP64
)
3818 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3820 show_doorparam32(pri
, (long)pri
->sys_args
[2]);
3822 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3830 show_portargs(private_t
*pri
, long offset
)
3834 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3835 (void) printf("%s\tevents=0x%x source=%u\n",
3838 args
.portev_source
);
3839 (void) printf("%s\tobject=0x%p user=0x%p\n",
3841 (void *)args
.portev_object
,
3842 (void *)args
.portev_user
);
3850 show_portargs32(private_t
*pri
, long offset
)
3852 port_event32_t args
;
3854 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3855 (void) printf("%s\tevents=0x%x source=%u\n",
3858 args
.portev_source
);
3859 (void) printf("%s\tobject=0x%x user=0x%x\n",
3869 show_ports(private_t
*pri
)
3871 switch (pri
->sys_args
[0]) {
3874 if (data_model
== PR_MODEL_LP64
)
3875 show_portargs(pri
, (long)pri
->sys_args
[2]);
3877 show_portargs32(pri
, (long)pri
->sys_args
[2]);
3879 show_portargs(pri
, (long)pri
->sys_args
[2]);
3885 #define MAX_SNDFL_PRD 16
3890 show_ksendfilevec32(private_t
*pri
, int fd
,
3891 ksendfilevec32_t
*sndvec
, int sfvcnt
)
3893 ksendfilevec32_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3897 while (sfvcnt
> 0) {
3898 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3900 cpy_rqst
*= sizeof (snd
[0]);
3902 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3909 "sfv_fd=%d\tsfv_flag=0x%x\t"
3910 "sfv_off=%d\tsfv_len=%u\n",
3916 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3917 prismember(&writefd
, fd
)) {
3919 (long)snd_ptr
->sfv_off
& 0xffffffff,
3920 (long)snd_ptr
->sfv_len
);
3923 cpy_rqst
-= sizeof (snd
[0]);
3927 sndvec
+= MAX_SNDFL_PRD
;
3933 show_ksendfilevec64(private_t
*pri
, int fd
,
3934 ksendfilevec64_t
*sndvec
, int sfvcnt
)
3936 ksendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3940 while (sfvcnt
> 0) {
3941 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3943 cpy_rqst
*= sizeof (snd
[0]);
3945 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3952 "sfv_fd=%d\tsfv_flag=0x%x\t"
3953 "sfv_off=%ld\tsfv_len=%u\n",
3959 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3960 prismember(&writefd
, fd
)) {
3962 (long)snd_ptr
->sfv_off
& 0xffffffff,
3963 (long)snd_ptr
->sfv_len
);
3966 cpy_rqst
-= sizeof (snd
[0]);
3970 sndvec
+= MAX_SNDFL_PRD
;
3979 show_sendfilevec(private_t
*pri
, int fd
, sendfilevec_t
*sndvec
, int sfvcnt
)
3981 sendfilevec_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3985 if (data_model
!= PR_MODEL_LP64
) {
3986 show_ksendfilevec32(pri
, fd
,
3987 (ksendfilevec32_t
*)sndvec
, sfvcnt
);
3992 while (sfvcnt
> 0) {
3993 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3995 cpy_rqst
*= sizeof (snd
[0]);
3997 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
4004 "sfv_fd=%d\tsfv_flag=0x%x\t"
4005 "sfv_off=%ld\tsfv_len=%lu\n",
4009 (ulong_t
)snd_ptr
->sfv_len
);
4011 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
4012 prismember(&writefd
, fd
)) {
4013 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
4014 (long)snd_ptr
->sfv_len
);
4017 cpy_rqst
-= sizeof (snd
[0]);
4021 sndvec
+= MAX_SNDFL_PRD
;
4028 show_sendfilevec64(private_t
*pri
, int fd
, sendfilevec64_t
*sndvec
, int sfvcnt
)
4030 sendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
4034 if (data_model
!= PR_MODEL_LP64
) {
4035 show_ksendfilevec64(pri
, fd
,
4036 (ksendfilevec64_t
*)sndvec
, sfvcnt
);
4042 while (sfvcnt
> 0) {
4043 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
4045 cpy_rqst
*= sizeof (snd
[0]);
4047 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
4055 "sfv_fd=%d\tsfv_flag=0x%x\t"
4056 "sfv_off=%ld\tsfv_len=%lu\n",
4058 "sfv_fd=%d\tsfv_flag=0x%x\t"
4059 "sfv_off=%lld\tsfv_len=%lu\n",
4064 (ulong_t
)snd_ptr
->sfv_len
);
4066 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
4067 prismember(&writefd
, fd
)) {
4068 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
4069 (long)snd_ptr
->sfv_len
);
4072 cpy_rqst
-= sizeof (snd
[0]);
4076 sndvec
+= MAX_SNDFL_PRD
;
4082 show_memcntl_mha(private_t
*pri
, long offset
)
4084 struct memcntl_mha mha
;
4085 const char *s
= NULL
;
4087 if (Pread(Proc
, &mha
, sizeof (mha
), offset
) == sizeof (mha
)) {
4088 switch (mha
.mha_cmd
) {
4089 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4090 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4091 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4094 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4095 " mha_pagesize=%lu\n",
4096 pri
->pname
, s
, mha
.mha_flags
,
4097 (ulong_t
)mha
.mha_pagesize
);
4099 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4100 " mha_pagesize=%lu\n",
4101 pri
->pname
, mha
.mha_cmd
, mha
.mha_flags
,
4102 (ulong_t
)mha
.mha_pagesize
);
4109 show_memcntl_mha32(private_t
*pri
, long offset
)
4111 struct memcntl_mha32 mha32
;
4112 const char *s
= NULL
;
4114 if (Pread(Proc
, &mha32
, sizeof (mha32
), offset
) ==
4116 switch (mha32
.mha_cmd
) {
4117 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4118 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4119 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4122 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4123 " mha_pagesize=%u\n",
4124 pri
->pname
, s
, mha32
.mha_flags
, mha32
.mha_pagesize
);
4126 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4127 " mha_pagesize=%u\n",
4128 pri
->pname
, mha32
.mha_cmd
, mha32
.mha_flags
,
4129 mha32
.mha_pagesize
);
4136 show_memcntl(private_t
*pri
)
4139 if ((int)pri
->sys_args
[2] != MC_HAT_ADVISE
)
4142 if (data_model
== PR_MODEL_LP64
)
4143 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4145 show_memcntl_mha32(pri
, (long)pri
->sys_args
[3]);
4147 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4152 show_ids(private_t
*pri
, long offset
, int count
)
4154 id_t buf
[MYBUFSIZ
/ sizeof (id_t
)];
4156 int serial
= (count
> MYBUFSIZ
/ 48);
4161 /* enter region of lengthy output */
4165 while (count
> 0 && !interrupt
) {
4166 ssize_t nb
= (count
* sizeof (id_t
) < MYBUFSIZ
)?
4167 count
* sizeof (id_t
) : MYBUFSIZ
;
4169 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) < 0 ||
4174 while (!interrupt
&& nb
>= sizeof (id_t
)) {
4175 (void) printf("%s\t%8d\n", pri
->pname
, (int)*idp
);
4176 offset
+= sizeof (id_t
);
4177 nb
-= sizeof (id_t
);
4183 /* exit region of lengthy output */
4189 show_ntp_gettime(private_t
*pri
)
4191 struct ntptimeval ntv
;
4194 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
4197 if (data_model
== PR_MODEL_NATIVE
) {
4198 if (Pread(Proc
, &ntv
, sizeof (ntv
), offset
)
4202 struct ntptimeval32 ntv32
;
4204 if (Pread(Proc
, &ntv32
, sizeof (ntv32
), offset
)
4208 TIMEVAL32_TO_TIMEVAL(&ntv
.time
, &ntv32
.time
);
4209 ntv
.maxerror
= ntv32
.maxerror
;
4210 ntv
.esterror
= ntv32
.esterror
;
4213 (void) printf("\ttime: %ld.%6.6ld sec\n",
4214 ntv
.time
.tv_sec
, ntv
.time
.tv_usec
);
4215 (void) printf("\tmaxerror: %11d usec\n", ntv
.maxerror
);
4216 (void) printf("\testerror: %11d usec\n", ntv
.esterror
);
4220 get_timex_modes(private_t
*pri
, uint32_t val
)
4222 char *str
= pri
->code_buf
;
4226 if (val
& MOD_OFFSET
)
4227 used
= strlcat(str
, "|MOD_OFFSET", sizeof (pri
->code_buf
));
4228 if (val
& MOD_FREQUENCY
)
4229 used
= strlcat(str
, "|MOD_FREQUENCY", sizeof (pri
->code_buf
));
4230 if (val
& MOD_MAXERROR
)
4231 used
= strlcat(str
, "|MOD_MAXERROR", sizeof (pri
->code_buf
));
4232 if (val
& MOD_ESTERROR
)
4233 used
= strlcat(str
, "|MOD_ESTERROR", sizeof (pri
->code_buf
));
4234 if (val
& MOD_STATUS
)
4235 used
= strlcat(str
, "|MOD_STATUS", sizeof (pri
->code_buf
));
4236 if (val
& MOD_TIMECONST
)
4237 used
= strlcat(str
, "|MOD_TIMECONST", sizeof (pri
->code_buf
));
4239 used
= strlcat(str
, "|MOD_CLKB", sizeof (pri
->code_buf
));
4241 used
= strlcat(str
, "|MOD_CLKA", sizeof (pri
->code_buf
));
4243 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4244 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4250 get_timex_status(private_t
*pri
, int32_t val
)
4252 char *str
= pri
->code_buf
;
4257 used
= strlcat(str
, "|STA_PLL", sizeof (pri
->code_buf
));
4258 if (val
& STA_PPSFREQ
)
4259 used
= strlcat(str
, "|STA_PPSFREQ", sizeof (pri
->code_buf
));
4260 if (val
& STA_PPSTIME
)
4261 used
= strlcat(str
, "|STA_PPSTIME", sizeof (pri
->code_buf
));
4263 used
= strlcat(str
, "|STA_FLL", sizeof (pri
->code_buf
));
4266 used
= strlcat(str
, "|STA_INS", sizeof (pri
->code_buf
));
4268 used
= strlcat(str
, "|STA_DEL", sizeof (pri
->code_buf
));
4269 if (val
& STA_UNSYNC
)
4270 used
= strlcat(str
, "|STA_UNSYNC", sizeof (pri
->code_buf
));
4271 if (val
& STA_FREQHOLD
)
4272 used
= strlcat(str
, "|STA_FREQHOLD", sizeof (pri
->code_buf
));
4274 if (val
& STA_PPSSIGNAL
)
4275 used
= strlcat(str
, "|STA_PPSSIGNAL", sizeof (pri
->code_buf
));
4276 if (val
& STA_PPSJITTER
)
4277 used
= strlcat(str
, "|STA_PPSJITTER", sizeof (pri
->code_buf
));
4278 if (val
& STA_PPSWANDER
)
4279 used
= strlcat(str
, "|STA_PPSWANDER", sizeof (pri
->code_buf
));
4280 if (val
& STA_PPSERROR
)
4281 used
= strlcat(str
, "|STA_PPSERROR", sizeof (pri
->code_buf
));
4283 if (val
& STA_CLOCKERR
)
4284 used
= strlcat(str
, "|STA_CLOCKERR", sizeof (pri
->code_buf
));
4286 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4287 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4293 show_ntp_adjtime(private_t
*pri
)
4298 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
4301 if (Pread(Proc
, &timex
, sizeof (timex
), offset
) != sizeof (timex
))
4304 (void) printf("\tmodes: %s\n", get_timex_modes(pri
, timex
.modes
));
4305 (void) printf("\toffset: %11d usec\n", timex
.offset
);
4306 (void) printf("\tfreq: %11d scaled ppm\n", timex
.freq
);
4307 (void) printf("\tmaxerror: %11d usec\n", timex
.maxerror
);
4308 (void) printf("\testerror: %11d usec\n", timex
.esterror
);
4309 (void) printf("\tstatus: %s\n", get_timex_status(pri
, timex
.status
));
4310 (void) printf("\tconstant: %11d\n", timex
.constant
);
4311 (void) printf("\tprecision: %11d usec\n", timex
.precision
);
4312 (void) printf("\ttolerance: %11d scaled ppm\n", timex
.tolerance
);
4313 (void) printf("\tppsfreq: %11d scaled ppm\n", timex
.ppsfreq
);
4314 (void) printf("\tjitter: %11d usec\n", timex
.jitter
);
4315 (void) printf("\tshift: %11d sec\n", timex
.shift
);
4316 (void) printf("\tstabil: %11d scaled ppm\n", timex
.stabil
);
4317 (void) printf("\tjitcnt: %11d\n", timex
.jitcnt
);
4318 (void) printf("\tcalcnt: %11d\n", timex
.calcnt
);
4319 (void) printf("\terrcnt: %11d\n", timex
.errcnt
);
4320 (void) printf("\tstbcnt: %11d\n", timex
.stbcnt
);
4324 show_getrusage(long offset
)
4327 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4329 (void) printf("\t user time: %ld.%6.6ld sec\n",
4331 r
.ru_utime
.tv_usec
);
4332 (void) printf("\t system time: %ld.%6.6ld sec\n",
4334 r
.ru_stime
.tv_usec
);
4335 (void) printf("\t max rss: <unimpl> %ld\n",
4337 (void) printf("\t shared data: <unimpl> %ld\n",
4339 (void) printf("\t unshared data: <unimpl> %ld\n",
4341 (void) printf("\t unshared stack: <unimpl> %ld\n",
4343 (void) printf("\t minor faults: %ld\n",
4345 (void) printf("\t major faults: %ld\n",
4347 (void) printf("\t # of swaps: %ld\n",
4349 (void) printf("\t blocked inputs: %ld\n",
4351 (void) printf("\t blocked outputs: %ld\n",
4353 (void) printf("\t msgs sent: %ld\n",
4355 (void) printf("\t msgs rcv'd: %ld\n",
4357 (void) printf("\t signals rcv'd: %ld\n",
4359 (void) printf("\tvol cntxt swtchs: %ld\n",
4361 (void) printf("\tinv cntxt swtchs: %ld\n",
4367 show_getrusage32(long offset
)
4370 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4372 (void) printf("\t user time: %d.%6.6d sec\n",
4374 r
.ru_utime
.tv_usec
);
4375 (void) printf("\t system time: %d.%6.6d sec\n",
4377 r
.ru_stime
.tv_usec
);
4378 (void) printf("\t max rss: <unimpl> %d\n",
4380 (void) printf("\t shared data: <unimpl> %d\n",
4382 (void) printf("\t unshared data: <unimpl> %d\n",
4384 (void) printf("\t unshared stack: <unimpl> %d\n",
4386 (void) printf("\t minor faults: %d\n",
4388 (void) printf("\t major faults: %d\n",
4390 (void) printf("\t # of swaps: %d\n",
4392 (void) printf("\t blocked inputs: %d\n",
4394 (void) printf("\t blocked outputs: %d\n",
4396 (void) printf("\t msgs sent: %d\n",
4398 (void) printf("\t msgs rcv'd: %d\n",
4400 (void) printf("\t signals rcv'd: %d\n",
4402 (void) printf("\tvol cntxt swtchs: %d\n",
4404 (void) printf("\tinv cntxt swtchs: %d\n",
4410 * Utility function to print a packed nvlist by unpacking
4411 * and calling the libnvpair pretty printer. Frees all
4412 * allocated memory internally.
4415 show_packed_nvlist(private_t
*pri
, uintptr_t offset
, size_t size
)
4417 nvlist_t
*nvl
= NULL
;
4421 if ((offset
== 0) || (size
== 0)) {
4425 buf
= my_malloc(size
, "nvlist decode buffer");
4426 readsize
= Pread(Proc
, buf
, size
, offset
);
4427 if (readsize
!= size
) {
4428 (void) printf("%s\t<?>", pri
->pname
);
4432 result
= nvlist_unpack(buf
, size
, &nvl
, 0);
4434 dump_nvlist(nvl
, 8);
4437 (void) printf("%s\tunpack of nvlist"
4438 " failed: %d\n", pri
->pname
, result
);
4445 show_zone_create_args(private_t
*pri
, long offset
)
4448 char zone_name
[ZONENAME_MAX
];
4449 char zone_root
[MAXPATHLEN
];
4450 char *zone_zfs
= NULL
;
4452 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4454 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4455 (uintptr_t)args
.zone_name
) == -1)
4456 (void) strcpy(zone_name
, "<?>");
4458 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4459 (uintptr_t)args
.zone_root
) == -1)
4460 (void) strcpy(zone_root
, "<?>");
4462 if (args
.zfsbufsz
> 0) {
4463 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4464 if (zone_zfs
!= NULL
) {
4465 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4466 (uintptr_t)args
.zfsbuf
) == -1)
4467 (void) strcpy(zone_zfs
, "<?>");
4473 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4475 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4478 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4479 args
.zone_privssz
, " zone_privs: ");
4481 (void) printf("%s\t rctlbuf: 0x%p\n", pri
->pname
,
4482 (void *)args
.rctlbuf
);
4483 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4484 (ulong_t
)args
.rctlbufsz
);
4486 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4489 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4491 (void) printf("%s\textended_error: 0x%p\n", pri
->pname
,
4492 (void *)args
.extended_error
);
4494 if (is_system_labeled()) {
4495 char *label_str
= NULL
;
4496 bslabel_t zone_label
;
4498 (void) printf("%s\t match: %d\n", pri
->pname
,
4500 (void) printf("%s\t doi: %d\n", pri
->pname
,
4503 if (Pread_string(Proc
, (char *)&zone_label
,
4504 sizeof (zone_label
), (uintptr_t)args
.label
) != -1) {
4505 /* show the label as string */
4506 if (label_to_str(&zone_label
, &label_str
,
4507 M_LABEL
, SHORT_NAMES
) != 0) {
4508 /* have to dump label as raw string */
4509 (void) label_to_str(&zone_label
,
4510 &label_str
, M_INTERNAL
,
4515 (void) printf("%s\t label: %s\n",
4516 pri
->pname
, label_str
!= NULL
? label_str
: "<?>");
4521 if (args
.zfsbufsz
> 0)
4530 show_zone_create_args32(private_t
*pri
, long offset
)
4533 char zone_name
[ZONENAME_MAX
];
4534 char zone_root
[MAXPATHLEN
];
4535 char *zone_zfs
= NULL
;
4537 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4539 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4540 (uintptr_t)args
.zone_name
) == -1)
4541 (void) strcpy(zone_name
, "<?>");
4543 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4544 (uintptr_t)args
.zone_root
) == -1)
4545 (void) strcpy(zone_root
, "<?>");
4547 if (args
.zfsbufsz
> 0) {
4548 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4549 if (zone_zfs
!= NULL
) {
4550 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4551 (uintptr_t)args
.zfsbuf
) == -1)
4552 (void) strcpy(zone_zfs
, "<?>");
4558 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4560 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4563 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4564 args
.zone_privssz
, " zone_privs: ");
4566 (void) printf("%s\t rctlbuf: 0x%x\n", pri
->pname
,
4567 (caddr32_t
)args
.rctlbuf
);
4568 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4569 (ulong_t
)args
.rctlbufsz
);
4571 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4574 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4576 (void) printf("%s\textended_error: 0x%x\n", pri
->pname
,
4577 (caddr32_t
)args
.extended_error
);
4579 if (is_system_labeled()) {
4580 char *label_str
= NULL
;
4581 bslabel_t zone_label
;
4583 (void) printf("%s\t match: %d\n", pri
->pname
,
4585 (void) printf("%s\t doi: %d\n", pri
->pname
,
4588 if (Pread_string(Proc
, (char *)&zone_label
,
4589 sizeof (zone_label
), (caddr32_t
)args
.label
) != -1) {
4590 /* show the label as string */
4591 if (label_to_str(&zone_label
, &label_str
,
4592 M_LABEL
, SHORT_NAMES
) != 0) {
4593 /* have to dump label as raw string */
4594 (void) label_to_str(&zone_label
,
4595 &label_str
, M_INTERNAL
,
4599 (void) printf("%s\t label: %s\n",
4600 pri
->pname
, label_str
!= NULL
? label_str
: "<?>");
4605 if (args
.zfsbufsz
> 0)
4613 show_zones(private_t
*pri
)
4615 switch (pri
->sys_args
[0]) {
4618 if (data_model
== PR_MODEL_LP64
)
4619 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4621 show_zone_create_args32(pri
, (long)pri
->sys_args
[1]);
4623 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4630 show_rctlblk(private_t
*pri
, long _rctlblk
)
4633 int size
= rctlblk_size();
4637 blk
= my_malloc(size
, "rctlblk decode buffer");
4638 readsize
= Pread(Proc
, blk
, size
, _rctlblk
);
4639 if (readsize
!= size
) {
4640 (void) printf("%s\t\t<?>", pri
->pname
);
4642 (void) printf("%s\t\t Privilege: 0x%x\n",
4644 rctlblk_get_privilege(blk
));
4645 (void) printf("%s\t\t Value: %lld\n",
4647 rctlblk_get_value(blk
));
4648 (void) printf("%s\t\tEnforced Value: %lld\n",
4650 rctlblk_get_enforced_value(blk
));
4654 act
= rctlblk_get_local_action(blk
, &sig
);
4656 s
= rctl_local_action(pri
, act
);
4658 (void) printf("%s\t\t Local action: 0x%x\n",
4661 (void) printf("%s\t\t Local action: %s\n",
4665 if (act
& RCTL_LOCAL_SIGNAL
) {
4666 (void) printf("%s\t\t "
4668 pri
->pname
, signame(pri
, sig
));
4672 s
= rctl_local_flags(pri
, rctlblk_get_local_flags(blk
));
4674 (void) printf("%s\t\t Local flags: 0x%x\n",
4675 pri
->pname
, rctlblk_get_local_flags(blk
));
4677 (void) printf("%s\t\t Local flags: %s\n",
4682 (void) printf("%s\t\t Recipient PID: %d\n",
4684 rctlblk_get_recipient_pid(blk
));
4686 (void) printf("%s\t\t Recipient PID: %ld\n",
4688 rctlblk_get_recipient_pid(blk
));
4690 (void) printf("%s\t\t Firing Time: %lld\n",
4692 rctlblk_get_firing_time(blk
));
4698 show_rctls(private_t
*pri
)
4702 switch (pri
->sys_args
[0]) {
4703 case 0: /* getrctl */
4704 case 1: /* setrctl */
4706 * If these offsets look a little odd, remember that they're
4707 * into the _raw_ system call
4709 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri
->pname
,
4711 if (pri
->sys_args
[2] != NULL
) {
4712 show_rctlblk(pri
, pri
->sys_args
[2]);
4714 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri
->pname
,
4716 if (pri
->sys_args
[3] != NULL
) {
4717 show_rctlblk(pri
, pri
->sys_args
[3]);
4720 case 4: /* setprojrctl */
4721 for (entry
= 0; entry
< pri
->sys_args
[4]; entry
++) {
4722 (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4724 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4725 if (RCTLBLK_INC(pri
->sys_args
[3], entry
) != NULL
) {
4727 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4734 show_utimesys(private_t
*pri
)
4736 switch (pri
->sys_args
[0]) {
4737 case 0: /* futimens() */
4738 if (pri
->sys_nargs
> 2)
4739 show_utimens(pri
, (long)pri
->sys_args
[2]);
4741 case 1: /* utimensat */
4742 if (pri
->sys_nargs
> 3)
4743 show_utimens(pri
, (long)pri
->sys_args
[3]);
4745 default: /* unexpected subcode */
4752 show_sockconfig_filter_prop32(private_t
*pri
, long addr
)
4754 struct sockconfig_filter_props32 props
;
4755 const char *s
= NULL
;
4756 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4757 sof_socktuple32_t
*tup
;
4761 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4762 if (Pread_string(Proc
, buf
, sizeof (buf
),
4763 (uintptr_t)props
.sfp_modname
) == -1)
4764 (void) strcpy(buf
, "<?>");
4765 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4766 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4767 props
.sfp_autoattach
? "automatic" : "progammatic");
4768 if (props
.sfp_autoattach
) {
4770 switch (props
.sfp_hint
) {
4771 case SOF_HINT_TOP
: s
= "top"; break;
4772 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4773 case SOF_HINT_BEFORE
:
4774 case SOF_HINT_AFTER
:
4775 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4777 if (Pread_string(Proc
, buf
, sizeof (buf
),
4778 (uintptr_t)props
.sfp_hintarg
) == -1)
4779 (void) strcpy(buf
, "<?>");
4782 (void) printf(", placement: %s %s", s
, buf
);
4785 (void) printf("\n");
4786 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4787 if (props
.sfp_socktuple_cnt
== 0) {
4788 (void) printf("\t\t<empty>\n");
4791 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4792 tup
= my_malloc(sz
, "socket tuple buffer");
4793 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4794 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4796 "\t\tfamily: %d, type: %d, proto: %d\n",
4797 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4798 tup
[i
].sofst_protocol
);
4804 show_sockconfig_filter_prop(private_t
*pri
, long addr
)
4806 struct sockconfig_filter_props props
;
4807 const char *s
= NULL
;
4808 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4809 sof_socktuple_t
*tup
;
4813 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4814 if (Pread_string(Proc
, buf
, sizeof (buf
),
4815 (uintptr_t)props
.sfp_modname
) == -1)
4816 (void) strcpy(buf
, "<?>");
4817 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4818 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4819 props
.sfp_autoattach
? "automatic" : "progammatic");
4820 if (props
.sfp_autoattach
) {
4822 switch (props
.sfp_hint
) {
4823 case SOF_HINT_TOP
: s
= "top"; break;
4824 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4825 case SOF_HINT_BEFORE
:
4826 case SOF_HINT_AFTER
:
4827 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4829 if (Pread_string(Proc
, buf
, sizeof (buf
),
4830 (uintptr_t)props
.sfp_hintarg
) == -1)
4831 (void) strcpy(buf
, "<?>");
4834 (void) printf(", placement: %s", s
);
4837 (void) printf("\n");
4838 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4839 if (props
.sfp_socktuple_cnt
== 0) {
4840 (void) printf("\t\t<empty>\n");
4843 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4844 tup
= my_malloc(sz
, "socket tuple buffer");
4845 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4846 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4848 "\t\tfamily: %d, type: %d, proto: %d\n",
4849 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4850 tup
[i
].sofst_protocol
);
4856 show_sockconfig(private_t
*pri
)
4858 switch (pri
->sys_args
[0]) {
4859 case SOCKCONFIG_ADD_FILTER
:
4861 if (data_model
== PR_MODEL_LP64
)
4862 show_sockconfig_filter_prop(pri
,
4863 (long)pri
->sys_args
[2]);
4865 show_sockconfig_filter_prop32(pri
,
4866 (long)pri
->sys_args
[2]);
4868 show_sockconfig_filter_prop(pri
, (long)pri
->sys_args
[2]);
4877 show_zfs_ioc(private_t
*pri
, long addr
)
4879 static const zfs_share_t zero_share
= {0};
4880 static const dmu_objset_stats_t zero_objstats
= {0};
4881 static const struct drr_begin zero_drrbegin
= {0};
4882 static const zinject_record_t zero_injectrec
= {0};
4883 static const zfs_stat_t zero_zstat
= {0};
4886 if (Pread(Proc
, &zc
, sizeof (zc
), addr
) != sizeof (zc
)) {
4887 (void) printf(" zfs_ioctl read failed\n");
4892 (void) printf(" zc_name=%s\n", zc
.zc_name
);
4894 (void) printf(" zc_value=%s\n", zc
.zc_value
);
4895 if (zc
.zc_string
[0])
4896 (void) printf(" zc_string=%s\n", zc
.zc_string
);
4897 if (zc
.zc_guid
!= 0) {
4898 (void) printf(" zc_guid=%llu\n",
4899 (u_longlong_t
)zc
.zc_guid
);
4901 if (zc
.zc_nvlist_conf_size
) {
4902 (void) printf(" nvlist_conf:\n");
4903 show_packed_nvlist(pri
, zc
.zc_nvlist_conf
,
4904 zc
.zc_nvlist_conf_size
);
4906 if (zc
.zc_nvlist_src_size
) {
4907 (void) printf(" nvlist_src:\n");
4908 show_packed_nvlist(pri
, zc
.zc_nvlist_src
,
4909 zc
.zc_nvlist_src_size
);
4911 if (zc
.zc_nvlist_dst_size
) {
4912 (void) printf(" nvlist_dst:\n");
4913 show_packed_nvlist(pri
, zc
.zc_nvlist_dst
,
4914 zc
.zc_nvlist_dst_size
);
4916 if (zc
.zc_cookie
!= 0) {
4917 (void) printf(" zc_cookie=%llu\n",
4918 (u_longlong_t
)zc
.zc_cookie
);
4920 if (zc
.zc_objset_type
!= 0) {
4921 (void) printf(" zc_objset_type=%llu\n",
4922 (u_longlong_t
)zc
.zc_objset_type
);
4924 if (zc
.zc_perm_action
!= 0) {
4925 (void) printf(" zc_perm_action=%llu\n",
4926 (u_longlong_t
)zc
.zc_perm_action
);
4928 if (zc
.zc_history
!= 0) {
4929 (void) printf(" zc_history=%llu\n",
4930 (u_longlong_t
)zc
.zc_history
);
4932 if (zc
.zc_obj
!= 0) {
4933 (void) printf(" zc_obj=%llu\n",
4934 (u_longlong_t
)zc
.zc_obj
);
4936 if (zc
.zc_iflags
!= 0) {
4937 (void) printf(" zc_obj=0x%llx\n",
4938 (u_longlong_t
)zc
.zc_iflags
);
4941 if (memcmp(&zc
.zc_share
, &zero_share
, sizeof (zc
.zc_share
))) {
4942 zfs_share_t
*z
= &zc
.zc_share
;
4943 (void) printf(" zc_share:\n");
4944 if (z
->z_exportdata
) {
4945 (void) printf("\tz_exportdata=0x%llx\n",
4946 (u_longlong_t
)z
->z_exportdata
);
4948 if (z
->z_sharedata
) {
4949 (void) printf("\tz_sharedata=0x%llx\n",
4950 (u_longlong_t
)z
->z_sharedata
);
4952 if (z
->z_sharetype
) {
4953 (void) printf("\tz_sharetype=%llu\n",
4954 (u_longlong_t
)z
->z_sharetype
);
4956 if (z
->z_sharemax
) {
4957 (void) printf("\tz_sharemax=%llu\n",
4958 (u_longlong_t
)z
->z_sharemax
);
4962 if (memcmp(&zc
.zc_objset_stats
, &zero_objstats
,
4963 sizeof (zc
.zc_objset_stats
))) {
4964 dmu_objset_stats_t
*dds
= &zc
.zc_objset_stats
;
4965 (void) printf(" zc_objset_stats:\n");
4966 if (dds
->dds_num_clones
) {
4967 (void) printf("\tdds_num_clones=%llu\n",
4968 (u_longlong_t
)dds
->dds_num_clones
);
4970 if (dds
->dds_creation_txg
) {
4971 (void) printf("\tdds_creation_txg=%llu\n",
4972 (u_longlong_t
)dds
->dds_creation_txg
);
4974 if (dds
->dds_guid
) {
4975 (void) printf("\tdds_guid=%llu\n",
4976 (u_longlong_t
)dds
->dds_guid
);
4979 (void) printf("\tdds_type=%u\n", dds
->dds_type
);
4980 if (dds
->dds_is_snapshot
) {
4981 (void) printf("\tdds_is_snapshot=%u\n",
4982 dds
->dds_is_snapshot
);
4984 if (dds
->dds_inconsistent
) {
4985 (void) printf("\tdds_inconsitent=%u\n",
4986 dds
->dds_inconsistent
);
4988 if (dds
->dds_origin
[0]) {
4989 (void) printf("\tdds_origin=%s\n", dds
->dds_origin
);
4993 if (memcmp(&zc
.zc_begin_record
, &zero_drrbegin
,
4994 sizeof (zc
.zc_begin_record
))) {
4995 struct drr_begin
*drr
= &zc
.zc_begin_record
.drr_u
.drr_begin
;
4996 (void) printf(" zc_begin_record:\n");
4997 if (drr
->drr_magic
) {
4998 (void) printf("\tdrr_magic=%llu\n",
4999 (u_longlong_t
)drr
->drr_magic
);
5001 if (drr
->drr_versioninfo
) {
5002 (void) printf("\tdrr_versioninfo=%llu\n",
5003 (u_longlong_t
)drr
->drr_versioninfo
);
5005 if (drr
->drr_creation_time
) {
5006 (void) printf("\tdrr_creation_time=%llu\n",
5007 (u_longlong_t
)drr
->drr_creation_time
);
5010 (void) printf("\tdrr_type=%u\n", drr
->drr_type
);
5012 (void) printf("\tdrr_flags=0x%x\n", drr
->drr_flags
);
5013 if (drr
->drr_toguid
) {
5014 (void) printf("\tdrr_toguid=%llu\n",
5015 (u_longlong_t
)drr
->drr_toguid
);
5017 if (drr
->drr_fromguid
) {
5018 (void) printf("\tdrr_fromguid=%llu\n",
5019 (u_longlong_t
)drr
->drr_fromguid
);
5021 if (drr
->drr_toname
[0]) {
5022 (void) printf("\tdrr_toname=%s\n", drr
->drr_toname
);
5026 if (memcmp(&zc
.zc_inject_record
, &zero_injectrec
,
5027 sizeof (zc
.zc_inject_record
))) {
5028 zinject_record_t
*zi
= &zc
.zc_inject_record
;
5029 (void) printf(" zc_inject_record:\n");
5030 if (zi
->zi_objset
) {
5031 (void) printf("\tzi_objset=%llu\n",
5032 (u_longlong_t
)zi
->zi_objset
);
5034 if (zi
->zi_object
) {
5035 (void) printf("\tzi_object=%llu\n",
5036 (u_longlong_t
)zi
->zi_object
);
5039 (void) printf("\tzi_start=%llu\n",
5040 (u_longlong_t
)zi
->zi_start
);
5043 (void) printf("\tzi_end=%llu\n",
5044 (u_longlong_t
)zi
->zi_end
);
5047 (void) printf("\tzi_guid=%llu\n",
5048 (u_longlong_t
)zi
->zi_guid
);
5051 (void) printf("\tzi_level=%lu\n",
5052 (ulong_t
)zi
->zi_level
);
5055 (void) printf("\tzi_error=%lu\n",
5056 (ulong_t
)zi
->zi_error
);
5059 (void) printf("\tzi_type=%llu\n",
5060 (u_longlong_t
)zi
->zi_type
);
5063 (void) printf("\tzi_freq=%lu\n",
5064 (ulong_t
)zi
->zi_freq
);
5066 if (zi
->zi_failfast
) {
5067 (void) printf("\tzi_failfast=%lu\n",
5068 (ulong_t
)zi
->zi_failfast
);
5071 (void) printf("\tzi_func=%s\n", zi
->zi_func
);
5072 if (zi
->zi_iotype
) {
5073 (void) printf("\tzi_iotype=%lu\n",
5074 (ulong_t
)zi
->zi_iotype
);
5076 if (zi
->zi_duration
) {
5077 (void) printf("\tzi_duration=%ld\n",
5078 (long)zi
->zi_duration
);
5081 (void) printf("\tzi_timer=%llu\n",
5082 (u_longlong_t
)zi
->zi_timer
);
5086 if (zc
.zc_defer_destroy
) {
5087 (void) printf(" zc_defer_destroy=%d\n",
5088 (int)zc
.zc_defer_destroy
);
5091 (void) printf(" zc_flags=0x%x\n",
5094 if (zc
.zc_action_handle
) {
5095 (void) printf(" zc_action_handle=%llu\n",
5096 (u_longlong_t
)zc
.zc_action_handle
);
5098 if (zc
.zc_cleanup_fd
>= 0)
5099 (void) printf(" zc_cleanup_fd=%d\n", zc
.zc_cleanup_fd
);
5100 if (zc
.zc_sendobj
) {
5101 (void) printf(" zc_sendobj=%llu\n",
5102 (u_longlong_t
)zc
.zc_sendobj
);
5104 if (zc
.zc_fromobj
) {
5105 (void) printf(" zc_fromobj=%llu\n",
5106 (u_longlong_t
)zc
.zc_fromobj
);
5108 if (zc
.zc_createtxg
) {
5109 (void) printf(" zc_createtxg=%llu\n",
5110 (u_longlong_t
)zc
.zc_createtxg
);
5113 if (memcmp(&zc
.zc_stat
, &zero_zstat
, sizeof (zc
.zc_stat
))) {
5114 zfs_stat_t
*zs
= &zc
.zc_stat
;
5115 (void) printf(" zc_stat:\n");
5117 (void) printf("\tzs_gen=%llu\n",
5118 (u_longlong_t
)zs
->zs_gen
);
5121 (void) printf("\tzs_mode=%llu\n",
5122 (u_longlong_t
)zs
->zs_mode
);
5125 (void) printf("\tzs_links=%llu\n",
5126 (u_longlong_t
)zs
->zs_links
);
5128 if (zs
->zs_ctime
[0]) {
5129 (void) printf("\tzs_ctime[0]=%llu\n",
5130 (u_longlong_t
)zs
->zs_ctime
[0]);
5132 if (zs
->zs_ctime
[1]) {
5133 (void) printf("\tzs_ctime[1]=%llu\n",
5134 (u_longlong_t
)zs
->zs_ctime
[1]);
5139 /* expound verbosely upon syscall arguments */
5142 expound(private_t
*pri
, long r0
, int raw
)
5144 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
5145 int lp64
= (data_model
== PR_MODEL_LP64
);
5146 int what
= Lsp
->pr_what
;
5147 int err
= pri
->Errno
; /* don't display output parameters */
5148 /* for a failed system call */
5150 /* We are a 32-bit truss; we can't grok a 64-bit process */
5154 /* for reporting sleeping system calls */
5155 if (what
== 0 && (Lsp
->pr_flags
& (PR_ASLEEP
|PR_VFORKP
)))
5156 what
= Lsp
->pr_syscall
;
5159 case SYS_gettimeofday
:
5161 show_timeofday(pri
);
5164 if (!err
&& pri
->sys_nargs
> 1)
5165 show_itimerval(pri
, (long)pri
->sys_args
[1],
5169 if (pri
->sys_nargs
> 1)
5170 show_itimerval(pri
, (long)pri
->sys_args
[1],
5172 if (!err
&& pri
->sys_nargs
> 2)
5173 show_itimerval(pri
, (long)pri
->sys_args
[2],
5188 show_utssys(pri
, r0
);
5190 show_utssys32(pri
, r0
);
5192 show_utssys(pri
, r0
);
5196 if (pri
->sys_nargs
>= 3) /* each case must decide for itself */
5197 show_ioctl(pri
, pri
->sys_args
[1],
5198 (long)pri
->sys_args
[2]);
5201 if (!err
&& pri
->sys_nargs
>= 3)
5202 show_stat(pri
, (long)pri
->sys_args
[2]);
5205 if (!err
&& pri
->sys_nargs
>= 3)
5206 show_stat64_32(pri
, (long)pri
->sys_args
[2]);
5211 if (!err
&& pri
->sys_nargs
>= 2)
5212 show_stat(pri
, (long)pri
->sys_args
[1]);
5217 if (!err
&& pri
->sys_nargs
>= 2)
5218 show_stat64_32(pri
, (long)pri
->sys_args
[1]);
5226 show_statvfs32(pri
);
5233 case SYS_fstatvfs64
:
5236 show_statvfs64(pri
);
5255 show_msgsys(pri
, r0
); /* each case must decide for itself */
5258 show_semsys(pri
); /* each case must decide for itself */
5261 show_shmsys(pri
); /* each case must decide for itself */
5264 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5268 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5273 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5276 case SYS_getdents64
:
5277 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5279 show_dents64(pri
, (long)pri
->sys_args
[1], r0
);
5282 show_gp_msg(pri
, what
);
5283 if (pri
->sys_nargs
> 3)
5284 show_hhex_int(pri
, (long)pri
->sys_args
[3], "flags");
5287 show_gp_msg(pri
, what
);
5288 if (pri
->sys_nargs
> 3)
5289 show_hhex_int(pri
, (long)pri
->sys_args
[3], "band");
5290 if (pri
->sys_nargs
> 4)
5291 show_hhex_int(pri
, (long)pri
->sys_args
[4], "flags");
5295 show_gp_msg(pri
, what
);
5301 if (pri
->sys_nargs
> 1 && (r0
= pri
->sys_args
[0]) > 0)
5302 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5305 if (!err
&& pri
->sys_nargs
> 1 && pri
->sys_args
[0] > 0)
5306 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5308 case SYS_sigprocmask
:
5309 if (pri
->sys_nargs
> 1)
5310 show_sigset(pri
, (long)pri
->sys_args
[1], " set");
5311 if (!err
&& pri
->sys_nargs
> 2)
5312 show_sigset(pri
, (long)pri
->sys_args
[2], "oset");
5314 case SYS_sigsuspend
:
5315 case SYS_sigtimedwait
:
5316 if (pri
->sys_nargs
> 0)
5317 show_sigset(pri
, (long)pri
->sys_args
[0], "sigmask");
5318 if (!err
&& pri
->sys_nargs
> 1)
5319 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5320 if (pri
->sys_nargs
> 2)
5321 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5323 case SYS_sigaltstack
:
5324 if (pri
->sys_nargs
> 0)
5325 show_sigaltstack(pri
, (long)pri
->sys_args
[0],
5327 if (!err
&& pri
->sys_nargs
> 1)
5328 show_sigaltstack(pri
, (long)pri
->sys_args
[1],
5332 if (pri
->sys_nargs
> 1)
5333 show_sigaction(pri
, (long)pri
->sys_args
[1],
5335 if (!err
&& pri
->sys_nargs
> 2)
5336 show_sigaction(pri
, (long)pri
->sys_args
[2],
5340 if (pri
->sys_nargs
> 1)
5341 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5344 if (pri
->sys_nargs
> 1)
5345 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5346 if (pri
->sys_nargs
> 2)
5347 show_sigset(pri
, (long)pri
->sys_args
[2], "sigmask");
5349 case SYS_sigpending
:
5350 if (!err
&& pri
->sys_nargs
> 1)
5351 show_sigset(pri
, (long)pri
->sys_args
[1], "sigmask");
5354 if (!err
&& pri
->sys_nargs
> 2)
5355 show_siginfo(pri
, (long)pri
->sys_args
[2]);
5357 case SYS_sigsendsys
:
5358 if (pri
->sys_nargs
> 0)
5359 show_procset(pri
, (long)pri
->sys_args
[0]);
5361 case SYS_priocntlsys
:
5362 if (pri
->sys_nargs
> 1)
5363 show_procset(pri
, (long)pri
->sys_args
[1]);
5366 if (!err
&& pri
->sys_nargs
> 2)
5367 show_bool(pri
, (long)pri
->sys_args
[2],
5368 (pri
->sys_args
[1] + pagesize
- 1) / pagesize
);
5372 if (pri
->sys_nargs
> 2) {
5373 int i
= pri
->sys_args
[0]+1;
5374 int showbuf
= FALSE
;
5375 long nb
= (what
== SYS_readv
)? r0
: 32*1024;
5377 if ((what
== SYS_readv
&& !err
&&
5378 prismember(&readfd
, i
)) ||
5379 (what
== SYS_writev
&&
5380 prismember(&writefd
, i
)))
5382 show_iovec(pri
, (long)pri
->sys_args
[1],
5383 pri
->sys_args
[2], showbuf
, nb
);
5391 if (pri
->sys_nargs
<= 1)
5395 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5397 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5399 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5402 case SYS_getrlimit64
:
5406 case SYS_setrlimit64
:
5407 if (pri
->sys_nargs
<= 1)
5409 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5412 if (!err
&& pri
->sys_nargs
> 0)
5413 show_nuname(pri
, (long)pri
->sys_args
[0]);
5416 if (!err
&& pri
->sys_nargs
> 1)
5417 show_adjtime(pri
, (long)pri
->sys_args
[0],
5418 (long)pri
->sys_args
[1]);
5421 if (!err
&& pri
->sys_nargs
> 0)
5422 show_timestruc(pri
, (long)pri
->sys_args
[0], "cpu time");
5425 if (!err
&& pri
->sys_nargs
> 1)
5426 show_int(pri
, (long)pri
->sys_args
[1], "lwpid");
5428 case SYS_lwp_mutex_wakeup
:
5429 case SYS_lwp_mutex_unlock
:
5430 case SYS_lwp_mutex_trylock
:
5431 case SYS_lwp_mutex_register
:
5432 if (pri
->sys_nargs
> 0)
5433 show_mutex(pri
, (long)pri
->sys_args
[0]);
5435 case SYS_lwp_mutex_timedlock
:
5436 if (pri
->sys_nargs
> 0)
5437 show_mutex(pri
, (long)pri
->sys_args
[0]);
5438 if (pri
->sys_nargs
> 1)
5439 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5441 case SYS_lwp_cond_wait
:
5442 if (pri
->sys_nargs
> 0)
5443 show_condvar(pri
, (long)pri
->sys_args
[0]);
5444 if (pri
->sys_nargs
> 1)
5445 show_mutex(pri
, (long)pri
->sys_args
[1]);
5446 if (pri
->sys_nargs
> 2)
5447 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5449 case SYS_lwp_cond_signal
:
5450 case SYS_lwp_cond_broadcast
:
5451 if (pri
->sys_nargs
> 0)
5452 show_condvar(pri
, (long)pri
->sys_args
[0]);
5454 case SYS_lwp_sema_trywait
:
5455 case SYS_lwp_sema_post
:
5456 if (pri
->sys_nargs
> 0)
5457 show_sema(pri
, (long)pri
->sys_args
[0]);
5459 case SYS_lwp_sema_timedwait
:
5460 if (pri
->sys_nargs
> 0)
5461 show_sema(pri
, (long)pri
->sys_args
[0]);
5462 if (pri
->sys_nargs
> 1)
5463 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5465 case SYS_lwp_rwlock_sys
:
5466 if (pri
->sys_nargs
> 1)
5467 show_rwlock(pri
, (long)pri
->sys_args
[1]);
5468 if (pri
->sys_nargs
> 2 &&
5469 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 1))
5470 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5472 case SYS_lwp_create
:
5473 /* XXX print some values in ucontext ??? */
5474 if (!err
&& pri
->sys_nargs
> 2)
5475 show_int(pri
, (long)pri
->sys_args
[2], "lwpid");
5478 if (pri
->sys_args
[0] == AIOWAIT
&& !err
&& pri
->sys_nargs
> 1)
5479 show_timeval(pri
, (long)pri
->sys_args
[1], "timeout");
5482 if (pri
->sys_nargs
> 0)
5483 show_timestruc(pri
, (long)pri
->sys_args
[0], "tmout");
5484 if (pri
->sys_nargs
> 1 && (err
== 0 || err
== EINTR
))
5485 show_timestruc(pri
, (long)pri
->sys_args
[1], "resid");
5488 switch (pri
->sys_args
[0]) {
5489 case PRIVSYS_SETPPRIV
:
5490 case PRIVSYS_GETPPRIV
:
5492 show_privset(pri
, (long)pri
->sys_args
[3],
5493 (size_t)pri
->sys_args
[4], "");
5497 switch (pri
->sys_args
[0]) {
5498 case UCREDSYS_UCREDGET
:
5499 case UCREDSYS_GETPEERUCRED
:
5501 show_ucred(pri
, (long)pri
->sys_args
[2]);
5507 if (pri
->sys_nargs
> 2)
5508 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5509 0, (long)pri
->sys_args
[2]);
5512 if (pri
->sys_nargs
> 5)
5513 show_sockaddr(pri
, "to", (long)pri
->sys_args
[4], 0,
5517 if (!err
&& pri
->sys_nargs
> 2)
5518 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5519 (long)pri
->sys_args
[2], 0);
5521 case SYS_getsockname
:
5522 case SYS_getpeername
:
5523 if (!err
&& pri
->sys_nargs
> 2)
5524 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5525 (long)pri
->sys_args
[2], 0);
5528 if (!err
&& pri
->sys_nargs
> 2)
5529 show_cladm(pri
, pri
->sys_args
[0], pri
->sys_args
[1],
5530 (long)pri
->sys_args
[2]);
5533 if (!err
&& pri
->sys_nargs
> 5)
5534 show_sockaddr(pri
, "from", (long)pri
->sys_args
[4],
5535 (long)pri
->sys_args
[5], 0);
5542 if (pri
->sys_nargs
<= 2)
5546 show_msghdr(pri
, pri
->sys_args
[1]);
5548 show_msghdr32(pri
, pri
->sys_args
[1]);
5550 show_msghdr(pri
, pri
->sys_args
[1]);
5557 if (pri
->sys_nargs
!= 5)
5560 if (pri
->sys_args
[0] == SENDFILEV
) {
5561 show_sendfilevec(pri
, (int)pri
->sys_args
[1],
5562 (sendfilevec_t
*)pri
->sys_args
[2],
5563 (int)pri
->sys_args
[3]);
5564 } else if (pri
->sys_args
[0] == SENDFILEV64
) {
5565 show_sendfilevec64(pri
, (int)pri
->sys_args
[1],
5566 (sendfilevec64_t
*)pri
->sys_args
[2],
5567 (int)pri
->sys_args
[3]);
5575 * subcode 0: lwp_park(timespec_t *, id_t)
5576 * subcode 4: lwp_set_park(timespec_t *, id_t)
5578 if (pri
->sys_nargs
> 1 &&
5579 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 4))
5580 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5581 /* subcode 2: lwp_unpark_all(id_t *, int) */
5582 if (pri
->sys_nargs
> 2 && pri
->sys_args
[0] == 2)
5583 show_ids(pri
, (long)pri
->sys_args
[1],
5584 (int)pri
->sys_args
[2]);
5586 case SYS_ntp_gettime
:
5588 show_ntp_gettime(pri
);
5590 case SYS_ntp_adjtime
:
5592 show_ntp_adjtime(pri
);
5596 if (pri
->sys_args
[0] == _RUSAGESYS_GETRUSAGE
) {
5599 show_getrusage32(pri
->sys_args
[1]);
5602 show_getrusage(pri
->sys_args
[1]);
5617 case SYS_sockconfig
:
5618 show_sockconfig(pri
);