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/synch.h>
80 #include <sys/synch32.h>
81 #include <sys/sysmacros.h>
82 #include <sys/sendfile.h>
85 #include <sys/ucred.h>
86 #include <sys/port_impl.h>
88 #include <sys/priv_impl.h>
90 #include <sys/nvpair.h>
91 #include <libnvpair.h>
92 #include <sys/rctl_impl.h>
93 #include <sys/socketvar.h>
94 #include <sys/fs/zfs.h>
95 #include <sys/zfs_ioctl.h>
101 void show_sigset(private_t
*, long, const char *);
102 void show_ioctl(private_t
*, int, long);
103 void show_zfs_ioc(private_t
*, long);
106 mk_ctime(char *str
, size_t maxsize
, time_t value
)
108 (void) strftime(str
, maxsize
, "%b %e %H:%M:%S %Z %Y",
113 prtime(private_t
*pri
, const char *name
, time_t value
)
117 mk_ctime(str
, sizeof (str
), value
);
118 (void) printf("%s\t%s%s [ %lu ]\n",
126 prtimeval(private_t
*pri
, const char *name
, struct timeval
*value
)
130 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
131 (void) printf("%s\t%s%s [ %lu.%6.6lu ]\n",
140 prtimestruc(private_t
*pri
, const char *name
, timestruc_t
*value
)
144 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
145 (void) printf("%s\t%s%s [ %lu.%9.9lu ]\n",
154 show_utimens(private_t
*pri
, long offset
)
164 if (data_model
== PR_MODEL_NATIVE
) {
165 if (Pread(Proc
, &utimbuf
, sizeof (utimbuf
), offset
)
174 if (Pread(Proc
, &utimbuf32
, sizeof (utimbuf32
), offset
)
175 != sizeof (utimbuf32
))
178 TIMESPEC32_TO_TIMESPEC(&utimbuf
.atime
, &utimbuf32
.atime
);
179 TIMESPEC32_TO_TIMESPEC(&utimbuf
.mtime
, &utimbuf32
.mtime
);
182 /* print access and modification times */
183 if (utimbuf
.atime
.tv_nsec
== UTIME_OMIT
)
184 (void) printf("%s\tat = UTIME_OMIT\n", pri
->pname
);
185 else if (utimbuf
.atime
.tv_nsec
== UTIME_NOW
)
186 (void) printf("%s\tat = UTIME_NOW\n", pri
->pname
);
188 prtimestruc(pri
, "at = ", &utimbuf
.atime
);
189 if (utimbuf
.mtime
.tv_nsec
== UTIME_OMIT
)
190 (void) printf("%s\tmt = UTIME_OMIT\n", pri
->pname
);
191 else if (utimbuf
.mtime
.tv_nsec
== UTIME_NOW
)
192 (void) printf("%s\tmt = UTIME_NOW\n", pri
->pname
);
194 prtimestruc(pri
, "mt = ", &utimbuf
.mtime
);
198 show_timeofday(private_t
*pri
)
203 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
206 if (data_model
== PR_MODEL_NATIVE
) {
207 if (Pread(Proc
, &tod
, sizeof (tod
), offset
)
211 struct timeval32 tod32
;
213 if (Pread(Proc
, &tod32
, sizeof (tod32
), offset
)
217 TIMEVAL32_TO_TIMEVAL(&tod
, &tod32
);
220 prtimeval(pri
, "time: ", &tod
);
224 show_itimerval(private_t
*pri
, long offset
, const char *name
)
226 struct itimerval itimerval
;
231 if (data_model
== PR_MODEL_NATIVE
) {
232 if (Pread(Proc
, &itimerval
, sizeof (itimerval
), offset
)
233 != sizeof (itimerval
))
236 struct itimerval32 itimerval32
;
238 if (Pread(Proc
, &itimerval32
, sizeof (itimerval32
), offset
)
239 != sizeof (itimerval32
))
242 ITIMERVAL32_TO_ITIMERVAL(&itimerval
, &itimerval32
);
246 "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n",
249 itimerval
.it_interval
.tv_sec
,
250 itimerval
.it_interval
.tv_usec
,
251 itimerval
.it_value
.tv_sec
,
252 itimerval
.it_value
.tv_usec
);
256 show_timeval(private_t
*pri
, long offset
, const char *name
)
258 struct timeval timeval
;
263 if (data_model
== PR_MODEL_NATIVE
) {
264 if (Pread(Proc
, &timeval
, sizeof (timeval
), offset
)
268 struct timeval32 timeval32
;
270 if (Pread(Proc
, &timeval32
, sizeof (timeval32
), offset
)
271 != sizeof (timeval32
))
274 TIMEVAL32_TO_TIMEVAL(&timeval
, &timeval32
);
278 "%s\t%s: %ld.%6.6ld sec\n",
286 show_timestruc(private_t
*pri
, long offset
, const char *name
)
288 timestruc_t timestruc
;
293 if (data_model
== PR_MODEL_NATIVE
) {
294 if (Pread(Proc
, ×truc
, sizeof (timestruc
), offset
)
295 != sizeof (timestruc
))
298 timestruc32_t timestruc32
;
300 if (Pread(Proc
, ×truc32
, sizeof (timestruc32
), offset
)
301 != sizeof (timestruc32
))
304 TIMESPEC32_TO_TIMESPEC(×truc
, ×truc32
);
308 "%s\t%s: %ld.%9.9ld sec\n",
316 show_stime(private_t
*pri
)
318 if (pri
->sys_nargs
>= 1) {
319 /* print new system time */
320 prtime(pri
, "systime = ", (time_t)pri
->sys_args
[0]);
325 show_times(private_t
*pri
)
327 long hz
= sysconf(_SC_CLK_TCK
);
331 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
334 if (data_model
== PR_MODEL_NATIVE
) {
335 if (Pread(Proc
, &tms
, sizeof (tms
), offset
)
341 if (Pread(Proc
, &tms32
, sizeof (tms32
), offset
)
346 * This looks a bit odd (since the values are actually
347 * signed), but we need to suppress sign extension to
348 * preserve compatibility (we've always printed these
349 * numbers as unsigned quantities).
351 tms
.tms_utime
= (unsigned)tms32
.tms_utime
;
352 tms
.tms_stime
= (unsigned)tms32
.tms_stime
;
353 tms
.tms_cutime
= (unsigned)tms32
.tms_cutime
;
354 tms
.tms_cstime
= (unsigned)tms32
.tms_cstime
;
358 "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
367 /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
369 show_ustat(private_t
*pri
, long offset
)
374 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
376 "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
387 show_ustat32(private_t
*pri
, long offset
)
392 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
394 "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
405 show_fusers(private_t
*pri
, long offset
, long nproc
)
408 int serial
= (nproc
> 4);
413 /* enter region of lengthy output */
418 Pread(Proc
, &fubuf
, sizeof (fubuf
), offset
) == sizeof (fubuf
)) {
419 (void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
423 fuflags(pri
, fubuf
.fu_flags
));
425 offset
+= sizeof (fubuf
);
428 /* exit region of lengthy output */
434 show_utssys(private_t
*pri
, long r0
)
436 if (pri
->sys_nargs
>= 3) {
437 switch (pri
->sys_args
[2]) {
439 show_ustat(pri
, (long)pri
->sys_args
[0]);
442 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
450 show_utssys32(private_t
*pri
, long r0
)
452 if (pri
->sys_nargs
>= 3) {
453 switch (pri
->sys_args
[2]) {
455 show_ustat32(pri
, (long)pri
->sys_args
[0]);
458 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
465 #define ALL_LOCK_TYPES \
466 (USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE | \
467 LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST | \
468 USYNC_PROCESS_ROBUST)
470 /* return cv and mutex types */
472 synch_type(private_t
*pri
, uint_t type
)
474 char *str
= pri
->code_buf
;
476 if (type
& USYNC_PROCESS
)
477 (void) strcpy(str
, "USYNC_PROCESS");
479 (void) strcpy(str
, "USYNC_THREAD");
481 if (type
& LOCK_ERRORCHECK
)
482 (void) strcat(str
, "|LOCK_ERRORCHECK");
483 if (type
& LOCK_RECURSIVE
)
484 (void) strcat(str
, "|LOCK_RECURSIVE");
485 if (type
& LOCK_PRIO_INHERIT
)
486 (void) strcat(str
, "|LOCK_PRIO_INHERIT");
487 if (type
& LOCK_PRIO_PROTECT
)
488 (void) strcat(str
, "|LOCK_PRIO_PROTECT");
489 if (type
& LOCK_ROBUST
)
490 (void) strcat(str
, "|LOCK_ROBUST");
491 if (type
& USYNC_PROCESS_ROBUST
)
492 (void) strcat(str
, "|USYNC_PROCESS_ROBUST");
494 if ((type
&= ~ALL_LOCK_TYPES
) != 0)
495 (void) sprintf(str
+ strlen(str
), "|0x%.4X", type
);
497 return ((const char *)str
);
501 show_mutex(private_t
*pri
, long offset
)
505 if (Pread(Proc
, &mutex
, sizeof (mutex
), offset
) == sizeof (mutex
)) {
506 (void) printf("%s\tmutex type: %s\n",
508 synch_type(pri
, mutex
.mutex_type
));
513 show_condvar(private_t
*pri
, long offset
)
517 if (Pread(Proc
, &condvar
, sizeof (condvar
), offset
)
518 == sizeof (condvar
)) {
519 (void) printf("%s\tcondvar type: %s\n",
521 synch_type(pri
, condvar
.cond_type
));
526 show_sema(private_t
*pri
, long offset
)
530 if (Pread(Proc
, &sema
, sizeof (sema
), offset
) == sizeof (sema
)) {
531 (void) printf("%s\tsema type: %s count = %u\n",
533 synch_type(pri
, sema
.sema_type
),
539 show_rwlock(private_t
*pri
, long offset
)
543 if (Pread(Proc
, &rwlock
, sizeof (rwlock
), offset
) == sizeof (rwlock
)) {
544 (void) printf("%s\trwlock type: %s readers = %d\n",
546 synch_type(pri
, rwlock
.rwlock_type
),
547 rwlock
.rwlock_readers
);
551 /* represent character as itself ('c') or octal (012) */
553 show_char(char *buf
, int c
)
557 if (c
>= ' ' && c
< 0177)
562 (void) sprintf(buf
, fmt
, c
&0xff);
567 show_termio(private_t
*pri
, long offset
)
569 struct termio termio
;
573 if (Pread(Proc
, &termio
, sizeof (termio
), offset
) == sizeof (termio
)) {
575 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
582 (void) printf("%s\t cc: ", pri
->pname
);
583 for (i
= 0; i
< NCC
; i
++)
585 show_char(cbuf
, (int)termio
.c_cc
[i
]));
586 (void) fputc('\n', stdout
);
591 show_termios(private_t
*pri
, long offset
)
593 struct termios termios
;
597 if (Pread(Proc
, &termios
, sizeof (termios
), offset
)
598 == sizeof (termios
)) {
600 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
606 (void) printf("%s\t cc: ", pri
->pname
);
607 for (i
= 0; i
< NCCS
; i
++) {
608 if (i
== NCC
) /* show new chars on new line */
609 (void) printf("\n%s\t\t", pri
->pname
);
611 show_char(cbuf
, (int)termios
.c_cc
[i
]));
613 (void) fputc('\n', stdout
);
618 show_termiox(private_t
*pri
, long offset
)
620 struct termiox termiox
;
623 if (Pread(Proc
, &termiox
, sizeof (termiox
), offset
)
624 == sizeof (termiox
)) {
625 (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
630 for (i
= 1; i
< NFF
; i
++)
631 (void) printf(",0%.3o", termiox
.x_rflag
[i
]);
632 (void) printf(" sflag=0%.3o\n",
638 show_sgttyb(private_t
*pri
, long offset
)
640 struct sgttyb sgttyb
;
642 if (Pread(Proc
, &sgttyb
, sizeof (sgttyb
), offset
) == sizeof (sgttyb
)) {
647 "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
649 sgttyb
.sg_ispeed
&0xff,
650 sgttyb
.sg_ospeed
&0xff,
651 show_char(erase
, sgttyb
.sg_erase
),
652 show_char(kill
, sgttyb
.sg_kill
),
658 show_ltchars(private_t
*pri
, long offset
)
660 struct ltchars ltchars
;
665 if (Pread(Proc
, <chars
, sizeof (ltchars
), offset
)
666 == sizeof (ltchars
)) {
667 (void) printf("%s\t cc: ", pri
->pname
);
668 for (p
= (char *)<chars
, i
= 0; i
< sizeof (ltchars
); i
++)
669 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
670 (void) fputc('\n', stdout
);
675 show_tchars(private_t
*pri
, long offset
)
677 struct tchars tchars
;
682 if (Pread(Proc
, &tchars
, sizeof (tchars
), offset
) == sizeof (tchars
)) {
683 (void) printf("%s\t cc: ", pri
->pname
);
684 for (p
= (char *)&tchars
, i
= 0; i
< sizeof (tchars
); i
++)
685 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
686 (void) fputc('\n', stdout
);
691 show_termcb(private_t
*pri
, long offset
)
693 struct termcb termcb
;
695 if (Pread(Proc
, &termcb
, sizeof (termcb
), offset
) == sizeof (termcb
)) {
697 "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
700 termcb
.st_termt
&0xff,
704 termcb
.st_lrow
&0xff);
708 /* integer value pointed to by ioctl() arg */
710 show_strint(private_t
*pri
, int code
, long offset
)
714 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
715 const char *s
= NULL
;
717 switch (code
) { /* interpret these symbolically */
722 s
= strevents(pri
, val
);
725 s
= tiocflush(pri
, val
);
730 (void) printf("%s\t0x%.8lX: %d\n",
731 pri
->pname
, offset
, val
);
733 (void) printf("%s\t0x%.8lX: %s\n",
734 pri
->pname
, offset
, s
);
739 show_strioctl(private_t
*pri
, long offset
)
741 struct strioctl strioctl
;
743 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
746 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
748 ioctlname(pri
, strioctl
.ic_cmd
),
751 (long)strioctl
.ic_dp
);
753 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
754 show_ioctl(pri
, strioctl
.ic_cmd
,
755 (long)strioctl
.ic_dp
);
762 show_strioctl32(private_t
*pri
, long offset
)
764 struct strioctl32 strioctl
;
766 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
769 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
771 ioctlname(pri
, strioctl
.ic_cmd
),
774 (long)strioctl
.ic_dp
);
776 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
777 show_ioctl(pri
, strioctl
.ic_cmd
,
778 (long)strioctl
.ic_dp
);
785 print_strbuf(private_t
*pri
, struct strbuf
*sp
, const char *name
, int dump
)
788 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
795 * Should we show the buffer contents?
796 * Keyed to the '-r fds' and '-w fds' options?
798 if (sp
->buf
== NULL
|| sp
->len
<= 0)
799 (void) fputc('\n', stdout
);
801 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
805 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
806 (void) strcpy(obuf
, ": \"");
807 showbytes(buffer
, nb
, obuf
+3);
810 (const char *)"\"" : (const char *)"\"..");
811 (void) fputs(obuf
, stdout
);
813 (void) fputc('\n', stdout
);
814 if (dump
&& sp
->len
> 8)
815 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
821 print_strbuf32(private_t
*pri
, struct strbuf32
*sp
, const char *name
, int dump
)
824 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
831 * Should we show the buffer contents?
832 * Keyed to the '-r fds' and '-w fds' options?
834 if (sp
->buf
== (uintptr_t)NULL
|| sp
->len
<= 0)
835 (void) fputc('\n', stdout
);
837 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
841 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
842 (void) strcpy(obuf
, ": \"");
843 showbytes(buffer
, nb
, obuf
+3);
846 (const char *)"\"" : (const char *)"\"..");
847 (void) fputs(obuf
, stdout
);
849 (void) fputc('\n', stdout
);
850 if (dump
&& sp
->len
> 8)
851 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
856 /* strpeek and strfdinsert flags word */
858 strflags(private_t
*pri
, int flags
)
870 (void) sprintf(pri
->code_buf
, "0x%.4X", flags
);
878 show_strpeek(private_t
*pri
, long offset
)
880 struct strpeek strpeek
;
882 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
883 == sizeof (strpeek
)) {
885 print_strbuf(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
886 print_strbuf(pri
, &strpeek
.databuf
, "dat", FALSE
);
888 (void) printf("%s\tflags=%s\n",
890 strflags(pri
, strpeek
.flags
));
896 show_strpeek32(private_t
*pri
, long offset
)
898 struct strpeek32 strpeek
;
900 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
901 == sizeof (strpeek
)) {
903 print_strbuf32(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
904 print_strbuf32(pri
, &strpeek
.databuf
, "dat", FALSE
);
906 (void) printf("%s\tflags=%s\n",
908 strflags(pri
, strpeek
.flags
));
914 show_strfdinsert(private_t
*pri
, long offset
)
916 struct strfdinsert strfdinsert
;
918 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
919 sizeof (strfdinsert
)) {
921 print_strbuf(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
922 print_strbuf(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
924 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
926 strflags(pri
, strfdinsert
.flags
),
934 show_strfdinsert32(private_t
*pri
, long offset
)
936 struct strfdinsert32 strfdinsert
;
938 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
939 sizeof (strfdinsert
)) {
941 print_strbuf32(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
942 print_strbuf32(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
944 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
946 strflags(pri
, strfdinsert
.flags
),
954 show_strrecvfd(private_t
*pri
, long offset
)
956 struct strrecvfd strrecvfd
;
958 if (Pread(Proc
, &strrecvfd
, sizeof (strrecvfd
), offset
) ==
959 sizeof (strrecvfd
)) {
961 "%s\tfd=%-5d uid=%-5u gid=%u\n",
970 show_strlist(private_t
*pri
, long offset
)
972 struct str_list strlist
;
973 struct str_mlist list
;
976 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
978 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
981 (long)strlist
.sl_modlist
);
983 count
= strlist
.sl_nmods
;
984 offset
= (long)strlist
.sl_modlist
;
985 while (!interrupt
&& --count
>= 0) {
986 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
989 (void) printf("%s\t\t\"%.*s\"\n",
991 (int)sizeof (list
.l_name
),
993 offset
+= sizeof (struct str_mlist
);
1000 show_strlist32(private_t
*pri
, long offset
)
1002 struct str_list32 strlist
;
1003 struct str_mlist list
;
1006 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
1008 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1011 (long)strlist
.sl_modlist
);
1013 count
= strlist
.sl_nmods
;
1014 offset
= (long)strlist
.sl_modlist
;
1015 while (!interrupt
&& --count
>= 0) {
1016 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
1019 (void) printf("%s\t\t\"%.*s\"\n",
1021 (int)sizeof (list
.l_name
),
1023 offset
+= sizeof (struct str_mlist
);
1030 show_jwinsize(private_t
*pri
, long offset
)
1032 struct jwinsize jwinsize
;
1034 if (Pread(Proc
, &jwinsize
, sizeof (jwinsize
), offset
) ==
1035 sizeof (jwinsize
)) {
1037 "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1039 (unsigned)jwinsize
.bytesx
,
1040 (unsigned)jwinsize
.bytesy
,
1041 (unsigned)jwinsize
.bitsx
,
1042 (unsigned)jwinsize
.bitsy
);
1047 show_winsize(private_t
*pri
, long offset
)
1049 struct winsize winsize
;
1051 if (Pread(Proc
, &winsize
, sizeof (winsize
), offset
)
1052 == sizeof (winsize
)) {
1054 "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1063 struct audio_stuff
{
1068 const struct audio_stuff audio_output_ports
[] = {
1069 { AUDIO_SPEAKER
, "SPEAKER" },
1070 { AUDIO_HEADPHONE
, "HEADPHONE" },
1071 { AUDIO_LINE_OUT
, "LINE_OUT" },
1072 { AUDIO_SPDIF_OUT
, "SPDIF_OUT" },
1073 { AUDIO_AUX1_OUT
, "AUX1_OUT" },
1074 { AUDIO_AUX2_OUT
, "AUX2_OUT" },
1078 const struct audio_stuff audio_input_ports
[] = {
1079 { AUDIO_MICROPHONE
, "MICROPHONE" },
1080 { AUDIO_LINE_IN
, "LINE_IN" },
1082 { AUDIO_SPDIF_IN
, "SPDIF_IN" },
1083 { AUDIO_AUX1_IN
, "AUX1_IN" },
1084 { AUDIO_AUX2_IN
, "AUX2_IN" },
1085 { AUDIO_CODEC_LOOPB_IN
, "CODEC_LOOPB_IN" },
1086 { AUDIO_SUNVTS
, "SUNVTS" },
1090 static const struct audio_stuff audio_hw_features
[] = {
1091 { AUDIO_HWFEATURE_DUPLEX
, "DUPLEX" },
1092 { AUDIO_HWFEATURE_MSCODEC
, "MSCODEC" },
1093 { AUDIO_HWFEATURE_IN2OUT
, "IN2OUT" },
1094 { AUDIO_HWFEATURE_PLAY
, "PLAY" },
1095 { AUDIO_HWFEATURE_RECORD
, "RECORD" },
1099 static const struct audio_stuff audio_sw_features
[] = {
1100 { AUDIO_SWFEATURE_MIXER
, "MIXER" },
1105 show_audio_features(const private_t
*pri
,
1106 const struct audio_stuff
*audio_porttab
, uint_t features
,
1109 (void) printf("%s\t%s=", pri
->pname
, name
);
1110 if (features
== 0) {
1111 (void) printf("0\n");
1115 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1116 if (features
& audio_porttab
->bit
) {
1117 (void) printf(audio_porttab
->str
);
1118 features
&= ~audio_porttab
->bit
;
1120 (void) putchar('|');
1124 (void) printf("0x%x", features
);
1125 (void) putchar('\n');
1129 show_audio_ports(private_t
*pri
, const char *mode
,
1130 const char *field
, uint_t ports
)
1132 const struct audio_stuff
*audio_porttab
;
1134 (void) printf("%s\t%s\t%s=", pri
->pname
, mode
, field
);
1136 (void) printf("0\n");
1140 audio_porttab
= audio_output_ports
;
1142 audio_porttab
= audio_input_ports
;
1143 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1144 if (ports
& audio_porttab
->bit
) {
1145 (void) printf(audio_porttab
->str
);
1146 ports
&= ~audio_porttab
->bit
;
1148 (void) putchar('|');
1152 (void) printf("0x%x", ports
);
1153 (void) putchar('\n');
1157 show_audio_prinfo(private_t
*pri
, const char *mode
, struct audio_prinfo
*au_pr
)
1162 * The following values describe the audio data encoding.
1165 (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1172 switch (au_pr
->encoding
) {
1173 case AUDIO_ENCODING_NONE
: s
= "NONE"; break;
1174 case AUDIO_ENCODING_ULAW
: s
= "ULAW"; break;
1175 case AUDIO_ENCODING_ALAW
: s
= "ALAW"; break;
1176 case AUDIO_ENCODING_LINEAR
: s
= "LINEAR"; break;
1177 case AUDIO_ENCODING_DVI
: s
= "DVI"; break;
1178 case AUDIO_ENCODING_LINEAR8
: s
= "LINEAR8"; break;
1181 (void) printf("%s\t%s\tencoding=%s\n", pri
->pname
, mode
, s
);
1183 (void) printf("%s\t%s\tencoding=%u\n",
1184 pri
->pname
, mode
, au_pr
->encoding
);
1188 * The following values control audio device configuration
1192 "%s\t%s\tgain=%u buffer_size=%u\n",
1195 au_pr
->buffer_size
);
1196 show_audio_ports(pri
, mode
, "port", au_pr
->port
);
1197 show_audio_ports(pri
, mode
, "avail_ports", au_pr
->avail_ports
);
1198 show_audio_ports(pri
, mode
, "mod_ports", au_pr
->mod_ports
);
1201 * The following values describe driver state
1204 (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1210 (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1217 * The following values are read-only state flags
1219 (void) printf("%s\t%s\topen=%u active=%u\n",
1226 show_audio_info(private_t
*pri
, long offset
)
1228 struct audio_info au
;
1230 if (Pread(Proc
, &au
, sizeof (au
), offset
) == sizeof (au
)) {
1231 show_audio_prinfo(pri
, "play", &au
.play
);
1232 show_audio_prinfo(pri
, "record", &au
.record
);
1233 (void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1234 pri
->pname
, au
.monitor_gain
, au
.output_muted
);
1235 show_audio_features(pri
, audio_hw_features
, au
.hw_features
,
1237 show_audio_features(pri
, audio_sw_features
, au
.sw_features
,
1239 show_audio_features(pri
, audio_sw_features
,
1240 au
.sw_features_enabled
, "sw_features_enabled");
1245 show_ioctl(private_t
*pri
, int code
, long offset
)
1247 int lp64
= (data_model
== PR_MODEL_LP64
);
1248 int err
= pri
->Errno
; /* don't display output parameters */
1249 /* for a failed system call */
1265 show_termio(pri
, offset
);
1274 show_termios(pri
, offset
);
1283 show_termiox(pri
, offset
);
1291 show_sgttyb(pri
, offset
);
1298 show_ltchars(pri
, offset
);
1305 show_tchars(pri
, offset
);
1312 show_termcb(pri
, offset
);
1314 /* streams ioctl()s */
1316 /* these are displayed as strings in the arg list */
1317 /* by prt_ioa(). don't display them again here */
1321 /* these are displayed as decimal in the arg list */
1322 /* by prt_ioa(). don't display them again here */
1326 /* these are displayed symbolically in the arg list */
1327 /* by prt_ioa(). don't display them again here */
1332 /* this one just ignores the argument */
1336 /* these return something in an int pointed to by arg */
1348 /* these pass something in an int pointed to by arg */
1354 show_strint(pri
, code
, offset
);
1356 /* these all point to structures */
1360 show_strioctl(pri
, offset
);
1362 show_strioctl32(pri
, offset
);
1364 show_strioctl(pri
, offset
);
1370 show_strpeek(pri
, offset
);
1372 show_strpeek32(pri
, offset
);
1374 show_strpeek(pri
, offset
);
1380 show_strfdinsert(pri
, offset
);
1382 show_strfdinsert32(pri
, offset
);
1384 show_strfdinsert(pri
, offset
);
1390 show_strrecvfd(pri
, offset
);
1397 show_strlist(pri
, offset
);
1399 show_strlist32(pri
, offset
);
1401 show_strlist(pri
, offset
);
1407 show_jwinsize(pri
, offset
);
1414 show_winsize(pri
, offset
);
1417 case (int)AUDIO_SETINFO
:
1418 show_audio_info(pri
, offset
);
1422 if ((code
& ~0xff) == ZFS_IOC
) {
1423 show_zfs_ioc(pri
, offset
);
1427 if (code
& IOC_INOUT
) {
1428 const char *str
= ioctldatastruct(code
);
1430 (void) printf("\t\t%s",
1431 (code
& IOC_INOUT
) == IOC_INOUT
? "write/read" :
1432 code
& IOC_IN
? "write" : "read");
1434 (void) printf(" (struct %s)\n", str
);
1436 (void) printf(" %d bytes\n",
1437 (code
>> 16) & IOCPARM_MASK
);
1444 show_statvfs(private_t
*pri
)
1447 struct statvfs statvfs
;
1450 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != 0 &&
1451 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1452 == sizeof (statvfs
)) {
1454 "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1458 (u_longlong_t
)statvfs
.f_blocks
,
1459 (u_longlong_t
)statvfs
.f_bfree
);
1461 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1463 (u_longlong_t
)statvfs
.f_bavail
,
1464 (u_longlong_t
)statvfs
.f_files
,
1465 (u_longlong_t
)statvfs
.f_ffree
,
1466 (u_longlong_t
)statvfs
.f_favail
);
1468 "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1472 (long)statvfs
.f_namemax
);
1476 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1477 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1478 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1481 (void) printf("%s\tfstr=\"%.*s\"\n",
1483 (int)sizeof (statvfs
.f_fstr
),
1490 show_statvfs32(private_t
*pri
)
1493 struct statvfs32 statvfs
;
1496 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != 0 &&
1497 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1498 == sizeof (statvfs
)) {
1500 "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1507 "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1514 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1518 (int)statvfs
.f_namemax
);
1522 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1523 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1524 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1527 (void) printf("%s\tfstr=\"%.*s\"\n",
1529 (int)sizeof (statvfs
.f_fstr
),
1536 show_statvfs64(private_t
*pri
)
1539 struct statvfs64_32 statvfs
;
1542 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != 0 &&
1543 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1544 == sizeof (statvfs
)) {
1546 "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1550 (u_longlong_t
)statvfs
.f_blocks
,
1551 (u_longlong_t
)statvfs
.f_bfree
);
1553 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1555 (u_longlong_t
)statvfs
.f_bavail
,
1556 (u_longlong_t
)statvfs
.f_files
,
1557 (u_longlong_t
)statvfs
.f_ffree
,
1558 (u_longlong_t
)statvfs
.f_favail
);
1560 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1564 (int)statvfs
.f_namemax
);
1568 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1569 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1570 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1573 (void) printf("%s\tfstr=\"%.*s\"\n",
1575 (int)sizeof (statvfs
.f_fstr
),
1581 show_statfs(private_t
*pri
)
1584 struct statfs statfs
;
1586 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0 &&
1587 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1589 "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1598 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1607 show_statfs32(private_t
*pri
)
1610 struct statfs32 statfs
;
1612 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0 &&
1613 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1615 "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1624 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1633 show_flock32(private_t
*pri
, long offset
)
1635 struct flock32 flock
;
1637 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1638 const char *str
= NULL
;
1640 (void) printf("%s\ttyp=", pri
->pname
);
1642 switch (flock
.l_type
) {
1654 (void) printf("%s", str
);
1656 (void) printf("%-7d", flock
.l_type
);
1658 str
= whencearg(flock
.l_whence
);
1660 (void) printf(" whence=%s", str
);
1662 (void) printf(" whence=%-8u", flock
.l_whence
);
1665 " start=%-5d len=%-5d sys=%-2u pid=%d\n",
1674 show_flock64(private_t
*pri
, long offset
)
1676 struct flock64 flock
;
1678 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1679 const char *str
= NULL
;
1681 (void) printf("%s\ttyp=", pri
->pname
);
1683 switch (flock
.l_type
) {
1695 (void) printf("%s", str
);
1697 (void) printf("%-7d", flock
.l_type
);
1699 str
= whencearg(flock
.l_whence
);
1701 (void) printf(" whence=%s", str
);
1703 (void) printf(" whence=%-8u", flock
.l_whence
);
1706 " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1707 (long long)flock
.l_start
,
1708 (long long)flock
.l_len
,
1715 show_share(private_t
*pri
, long offset
)
1717 struct fshare fshare
;
1719 if (Pread(Proc
, &fshare
, sizeof (fshare
), offset
) == sizeof (fshare
)) {
1720 const char *str
= NULL
;
1723 (void) printf("%s\taccess=", pri
->pname
);
1725 switch (fshare
.f_access
) {
1737 (void) printf("%s", str
);
1739 (void) printf("%-7d", fshare
.f_access
);
1742 if (fshare
.f_deny
& F_MANDDNY
) {
1743 fshare
.f_deny
&= ~F_MANDDNY
;
1746 switch (fshare
.f_deny
) {
1765 (void) printf(" deny=F_MANDDNY|%s", str
);
1767 (void) printf(" deny=%s", str
);
1769 (void) printf(" deny=0x%x", manddny
?
1770 fshare
.f_deny
| F_MANDDNY
: fshare
.f_deny
);
1773 (void) printf(" id=%x\n", fshare
.f_id
);
1778 show_ffg(private_t
*pri
)
1780 (void) putchar('\t');
1781 (void) putchar('\t');
1782 prt_ffg(pri
, 0, pri
->Rval1
);
1783 (void) puts(pri
->sys_string
);
1786 /* print values in fcntl() pointed-to structure */
1788 show_fcntl(private_t
*pri
)
1792 if (pri
->sys_nargs
>= 2 && pri
->sys_args
[1] == F_GETFL
) {
1797 if (pri
->sys_nargs
< 3 || (offset
= pri
->sys_args
[2]) == 0)
1800 switch (pri
->sys_args
[1]) {
1807 case F_SETLK_NBMAND
:
1813 if (data_model
== PR_MODEL_LP64
)
1814 show_flock64(pri
, offset
);
1816 show_flock32(pri
, offset
);
1818 case 33: /* F_GETLK64 */
1819 case 34: /* F_SETLK64 */
1820 case 35: /* F_SETLKW64 */
1821 case 27: /* F_FREESP64 */
1822 case 28: /* F_ALLOCSP64 */
1823 case 44: /* F_SETLK64_NBMAND */
1824 case 50: /* F_OFD_GETLK64 */
1825 case 51: /* F_OFD_SETLK64 */
1826 case 52: /* F_OFD_SETLKW64 */
1827 case 55: /* F_FLOCK64 */
1828 case 56: /* F_FLOCKW64 */
1829 show_flock64(pri
, offset
);
1837 case F_SETLK64_NBMAND
:
1840 case F_OFD_SETLKW64
:
1843 show_flock64(pri
, offset
);
1848 show_share(pri
, offset
);
1854 show_strbuf(private_t
*pri
, long offset
, const char *name
, int dump
)
1856 struct strbuf strbuf
;
1858 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1859 print_strbuf(pri
, &strbuf
, name
, dump
);
1864 show_strbuf32(private_t
*pri
, long offset
, const char *name
, int dump
)
1866 struct strbuf32 strbuf
;
1868 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1869 print_strbuf32(pri
, &strbuf
, name
, dump
);
1874 show_gp_msg(private_t
*pri
, int what
)
1878 int fdp1
= pri
->sys_args
[0] + 1;
1883 if (pri
->Errno
== 0 && prismember(&readfd
, fdp1
))
1888 if (prismember(&writefd
, fdp1
))
1893 /* enter region of lengthy output */
1898 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0) {
1899 if (data_model
== PR_MODEL_LP64
)
1900 show_strbuf(pri
, offset
, "ctl", dump
);
1902 show_strbuf32(pri
, offset
, "ctl", dump
);
1904 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != 0) {
1905 if (data_model
== PR_MODEL_LP64
)
1906 show_strbuf(pri
, offset
, "dat", dump
);
1908 show_strbuf32(pri
, offset
, "dat", dump
);
1911 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0)
1912 show_strbuf(pri
, offset
, "ctl", dump
);
1913 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != 0)
1914 show_strbuf(pri
, offset
, "dat", dump
);
1917 /* exit region of lengthy output */
1923 show_int(private_t
*pri
, long offset
, const char *name
)
1928 Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
1929 (void) printf("%s\t%s:\t%d\n",
1936 show_hhex_int(private_t
*pri
, long offset
, const char *name
)
1940 if (Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
1941 (void) printf("%s\t%s:\t0x%.4X\n",
1947 #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \
1948 POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
1951 pollevent(private_t
*pri
, int arg
)
1953 char *str
= pri
->code_buf
;
1957 if (arg
& ~ALL_POLL_FLAGS
) {
1958 (void) sprintf(str
, "0x%-5X", arg
);
1959 return ((const char *)str
);
1964 (void) strcat(str
, "|POLLIN");
1966 (void) strcat(str
, "|POLLPRI");
1968 (void) strcat(str
, "|POLLOUT");
1969 if (arg
& POLLRDNORM
)
1970 (void) strcat(str
, "|POLLRDNORM");
1971 if (arg
& POLLRDBAND
)
1972 (void) strcat(str
, "|POLLRDBAND");
1973 if (arg
& POLLWRBAND
)
1974 (void) strcat(str
, "|POLLWRBAND");
1976 (void) strcat(str
, "|POLLERR");
1978 (void) strcat(str
, "|POLLHUP");
1980 (void) strcat(str
, "|POLLNVAL");
1982 return ((const char *)(str
+1));
1986 show_one_pollfd(private_t
*pri
, struct pollfd
*ppollfd
)
1989 * can't print both events and revents in same printf.
1990 * pollevent() returns a pointer to a TSD location.
1992 (void) printf("%s\tfd=%-2d ev=%s",
1993 pri
->pname
, ppollfd
->fd
, pollevent(pri
, ppollfd
->events
));
1994 (void) printf(" rev=%s\n", pollevent(pri
, ppollfd
->revents
));
1998 show_all_pollfds(private_t
*pri
, long offset
, int nfds
)
2000 struct pollfd pollfd
[2];
2003 for (; nfds
&& !interrupt
; nfds
--, offset
+= sizeof (struct pollfd
)) {
2004 if (Pread(Proc
, &pollfd
[0], sizeof (struct pollfd
), offset
) !=
2005 sizeof (struct pollfd
))
2008 if (skip
>= 0 && pollfd
[0].fd
== pollfd
[1].fd
&&
2009 pollfd
[0].events
== pollfd
[1].events
&&
2010 pollfd
[0].revents
== pollfd
[1].revents
) {
2016 (void) printf("%s\t...last pollfd structure"
2017 " repeated %d time%s...\n",
2018 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2021 show_one_pollfd(pri
, &pollfd
[0]);
2022 pollfd
[1] = pollfd
[0];
2027 "%s\t...last pollfd structure repeated %d time%s...\n",
2028 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2032 show_pollsys(private_t
*pri
)
2038 if (pri
->sys_nargs
< 2)
2041 offset
= pri
->sys_args
[0];
2042 nfds
= pri
->sys_args
[1];
2044 /* enter region of lengthy output */
2045 if (offset
!= 0 && nfds
> 32) {
2050 if (offset
!= 0 && nfds
> 0)
2051 show_all_pollfds(pri
, offset
, nfds
);
2053 if (pri
->sys_nargs
> 2)
2054 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
2056 if (pri
->sys_nargs
> 3)
2057 show_sigset(pri
, (long)pri
->sys_args
[3], "sigmask");
2059 /* exit region of lengthy output */
2065 show_perm64(private_t
*pri
, struct ipc_perm64
*ip
)
2067 (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
2068 "m=0%.6o key=%d projid=%-5d\n",
2074 (int)ip
->ipcx_zoneid
,
2075 (unsigned int)ip
->ipcx_mode
,
2077 (int)ip
->ipcx_projid
);
2081 show_perm(private_t
*pri
, struct ipc_perm
*ip
)
2084 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2097 show_perm32(private_t
*pri
, struct ipc_perm32
*ip
)
2100 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2113 show_msgctl64(private_t
*pri
, long offset
)
2115 struct msqid_ds64 msgq
;
2118 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2119 show_perm64(pri
, &msgq
.msgx_perm
);
2121 (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
2122 "lspid=%-5d lrpid=%-5d\n", pri
->pname
,
2123 (unsigned long long)msgq
.msgx_cbytes
,
2124 (unsigned long long)msgq
.msgx_qnum
,
2125 (unsigned long long)msgq
.msgx_qbytes
,
2126 (int)msgq
.msgx_lspid
,
2127 (int)msgq
.msgx_lrpid
);
2129 prtime(pri
, " st = ", (time_t)msgq
.msgx_stime
);
2130 prtime(pri
, " rt = ", (time_t)msgq
.msgx_rtime
);
2131 prtime(pri
, " ct = ", (time_t)msgq
.msgx_ctime
);
2136 show_msgctl(private_t
*pri
, long offset
)
2138 struct msqid_ds msgq
;
2141 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2142 show_perm(pri
, &msgq
.msg_perm
);
2145 "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2150 (int)msgq
.msg_lspid
,
2151 (int)msgq
.msg_lrpid
);
2153 prtime(pri
, " st = ", msgq
.msg_stime
);
2154 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2155 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2161 show_msgctl32(private_t
*pri
, long offset
)
2163 struct msqid_ds32 msgq
;
2166 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2167 show_perm32(pri
, &msgq
.msg_perm
);
2170 "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2178 prtime(pri
, " st = ", msgq
.msg_stime
);
2179 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2180 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2186 show_msgbuf(private_t
*pri
, long offset
, long msgsz
)
2191 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2192 sizeof (msgb
.mtype
)) {
2193 /* enter region of lengthy output */
2194 if (msgsz
> MYBUFSIZ
/ 4)
2197 (void) printf("%s\tmtype=%lu mtext[]=\n",
2201 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2203 /* exit region of lengthy output */
2204 if (msgsz
> MYBUFSIZ
/ 4)
2211 show_msgbuf32(private_t
*pri
, long offset
, long msgsz
)
2213 struct ipcmsgbuf32 msgb
;
2216 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2217 sizeof (msgb
.mtype
)) {
2218 /* enter region of lengthy output */
2219 if (msgsz
> MYBUFSIZ
/ 4)
2222 (void) printf("%s\tmtype=%u mtext[]=\n",
2226 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2228 /* exit region of lengthy output */
2229 if (msgsz
> MYBUFSIZ
/ 4)
2237 show_msgsys(private_t
*pri
, long msgsz
)
2239 switch (pri
->sys_args
[0]) {
2240 case 0: /* msgget() */
2242 case 1: /* msgctl() */
2243 if (pri
->sys_nargs
> 3) {
2244 switch (pri
->sys_args
[2]) {
2250 if (data_model
== PR_MODEL_LP64
)
2252 (long)pri
->sys_args
[3]);
2255 (long)pri
->sys_args
[3]);
2262 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2267 case 2: /* msgrcv() */
2268 if (!pri
->Errno
&& pri
->sys_nargs
> 2) {
2269 if (data_model
== PR_MODEL_LP64
)
2270 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2272 show_msgbuf32(pri
, pri
->sys_args
[2], msgsz
);
2275 case 3: /* msgsnd() */
2276 if (pri
->sys_nargs
> 3) {
2277 if (data_model
== PR_MODEL_LP64
)
2278 show_msgbuf(pri
, pri
->sys_args
[2],
2281 show_msgbuf32(pri
, pri
->sys_args
[2],
2285 case 4: /* msgids() */
2286 case 5: /* msgsnap() */
2287 default: /* unexpected subcode */
2293 show_msgsys(private_t
*pri
, long msgsz
)
2295 switch (pri
->sys_args
[0]) {
2296 case 0: /* msgget() */
2298 case 1: /* msgctl() */
2299 if (pri
->sys_nargs
> 3) {
2300 switch (pri
->sys_args
[2]) {
2306 show_msgctl(pri
, (long)pri
->sys_args
[3]);
2313 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2318 case 2: /* msgrcv() */
2319 if (!pri
->Errno
&& pri
->sys_nargs
> 2)
2320 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2322 case 3: /* msgsnd() */
2323 if (pri
->sys_nargs
> 3)
2324 show_msgbuf(pri
, pri
->sys_args
[2],
2327 case 4: /* msgids() */
2328 case 5: /* msgsnap() */
2329 default: /* unexpected subcode */
2336 show_semctl64(private_t
*pri
, long offset
)
2338 struct semid_ds64 semds
;
2341 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2342 show_perm64(pri
, &semds
.semx_perm
);
2344 (void) printf("%s\tnsems=%u\n", pri
->pname
, semds
.semx_nsems
);
2346 prtime(pri
, " ot = ", (time_t)semds
.semx_otime
);
2347 prtime(pri
, " ct = ", (time_t)semds
.semx_ctime
);
2352 show_semctl(private_t
*pri
, long offset
)
2354 struct semid_ds semds
;
2357 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2358 show_perm(pri
, &semds
.sem_perm
);
2360 (void) printf("%s\tnsems=%u\n",
2364 prtime(pri
, " ot = ", semds
.sem_otime
);
2365 prtime(pri
, " ct = ", semds
.sem_ctime
);
2371 show_semctl32(private_t
*pri
, long offset
)
2373 struct semid_ds32 semds
;
2376 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2377 show_perm32(pri
, &semds
.sem_perm
);
2379 (void) printf("%s\tnsems=%u\n",
2383 prtime(pri
, " ot = ", semds
.sem_otime
);
2384 prtime(pri
, " ct = ", semds
.sem_ctime
);
2390 show_semop(private_t
*pri
, long offset
, long nsops
, long timeout
)
2392 struct sembuf sembuf
;
2398 if (nsops
> 40) /* let's not be ridiculous */
2401 for (; nsops
> 0 && !interrupt
; --nsops
, offset
+= sizeof (sembuf
)) {
2402 if (Pread(Proc
, &sembuf
, sizeof (sembuf
), offset
) !=
2406 (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2411 if (sembuf
.sem_flg
== 0)
2412 (void) printf("0\n");
2413 else if ((str
= semflags(pri
, sembuf
.sem_flg
)) != NULL
)
2414 (void) printf("%s\n", str
);
2416 (void) printf("0%.6o\n", sembuf
.sem_flg
);
2419 show_timestruc(pri
, timeout
, "timeout");
2423 show_semsys(private_t
*pri
)
2425 switch (pri
->sys_args
[0]) {
2426 case 0: /* semctl() */
2427 if (pri
->sys_nargs
> 4) {
2428 switch (pri
->sys_args
[3]) {
2435 if (data_model
== PR_MODEL_LP64
)
2437 (long)pri
->sys_args
[4]);
2440 (long)pri
->sys_args
[4]);
2442 show_semctl(pri
, (long)pri
->sys_args
[4]);
2450 show_semctl64(pri
, (long)pri
->sys_args
[4]);
2455 case 1: /* semget() */
2457 case 2: /* semop() */
2458 if (pri
->sys_nargs
> 3)
2459 show_semop(pri
, (long)pri
->sys_args
[2],
2460 pri
->sys_args
[3], 0);
2462 case 3: /* semids() */
2464 case 4: /* semtimedop() */
2465 if (pri
->sys_nargs
> 4)
2466 show_semop(pri
, (long)pri
->sys_args
[2],
2467 pri
->sys_args
[3], pri
->sys_args
[4]);
2469 default: /* unexpected subcode */
2475 show_shmctl64(private_t
*pri
, long offset
)
2477 struct shmid_ds64 shmds
;
2480 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2481 show_perm64(pri
, &shmds
.shmx_perm
);
2484 "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
2486 (unsigned long long)shmds
.shmx_segsz
,
2487 (int)shmds
.shmx_lpid
,
2488 (int)shmds
.shmx_cpid
,
2489 (unsigned long long)shmds
.shmx_nattch
,
2490 (unsigned long long)shmds
.shmx_cnattch
);
2492 prtime(pri
, " at = ", (time_t)shmds
.shmx_atime
);
2493 prtime(pri
, " dt = ", (time_t)shmds
.shmx_dtime
);
2494 prtime(pri
, " ct = ", (time_t)shmds
.shmx_ctime
);
2499 show_shmctl(private_t
*pri
, long offset
)
2501 struct shmid_ds shmds
;
2504 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2505 show_perm(pri
, &shmds
.shm_perm
);
2508 "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2510 (ulong_t
)shmds
.shm_segsz
,
2511 (int)shmds
.shm_lpid
,
2512 (int)shmds
.shm_cpid
,
2516 prtime(pri
, " at = ", shmds
.shm_atime
);
2517 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2518 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2524 show_shmctl32(private_t
*pri
, long offset
)
2526 struct shmid_ds32 shmds
;
2529 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2530 show_perm32(pri
, &shmds
.shm_perm
);
2533 "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2541 prtime(pri
, " at = ", shmds
.shm_atime
);
2542 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2543 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2549 show_shmsys(private_t
*pri
)
2551 switch (pri
->sys_args
[0]) {
2552 case 0: /* shmat() */
2554 case 1: /* shmctl() */
2555 if (pri
->sys_nargs
> 3) {
2556 switch (pri
->sys_args
[2]) {
2563 if (data_model
== PR_MODEL_LP64
)
2565 (long)pri
->sys_args
[3]);
2568 (long)pri
->sys_args
[3]);
2570 show_shmctl(pri
, (long)pri
->sys_args
[3]);
2578 show_shmctl64(pri
, (long)pri
->sys_args
[3]);
2583 case 2: /* shmdt() */
2584 case 3: /* shmget() */
2585 case 4: /* shmids() */
2586 default: /* unexpected subcode */
2592 show_groups(private_t
*pri
, long offset
, long count
)
2599 if (count
> 0 && offset
!= 0 &&
2600 Pread(Proc
, &groups
[0], count
*sizeof (int), offset
) ==
2601 count
*sizeof (int)) {
2604 (void) printf("%s\t", pri
->pname
);
2605 for (n
= 0; !interrupt
&& n
< count
; n
++) {
2606 if (n
!= 0 && n
%10 == 0)
2607 (void) printf("\n%s\t", pri
->pname
);
2608 (void) printf(" %5d", groups
[n
]);
2610 (void) fputc('\n', stdout
);
2615 * This assumes that a sigset_t is simply an array of ints.
2618 sigset_string(private_t
*pri
, sigset_t
*sp
)
2620 char *s
= pri
->code_buf
;
2621 int n
= sizeof (*sp
) / sizeof (int32_t);
2622 int32_t *lp
= (int32_t *)sp
;
2625 int32_t val
= *lp
++;
2628 s
+= sprintf(s
, " 0");
2630 s
+= sprintf(s
, " 0x%.8X", val
);
2633 return (pri
->code_buf
);
2637 show_sigset(private_t
*pri
, long offset
, const char *name
)
2642 Pread(Proc
, &sigset
, sizeof (sigset
), offset
) == sizeof (sigset
)) {
2643 (void) printf("%s\t%s =%s\n",
2644 pri
->pname
, name
, sigset_string(pri
, &sigset
));
2650 show_sigaltstack32(private_t
*pri
, long offset
, const char *name
)
2652 struct sigaltstack32 altstack
;
2655 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2656 sizeof (altstack
)) {
2657 (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2668 show_sigaltstack(private_t
*pri
, long offset
, const char *name
)
2670 struct sigaltstack altstack
;
2673 if (data_model
!= PR_MODEL_LP64
) {
2674 show_sigaltstack32(pri
, offset
, name
);
2679 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2680 sizeof (altstack
)) {
2681 (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2684 (ulong_t
)altstack
.ss_sp
,
2685 (ulong_t
)altstack
.ss_size
,
2692 show_sigaction32(private_t
*pri
, long offset
, const char *name
, long odisp
)
2694 struct sigaction32 sigaction
;
2697 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2698 sizeof (sigaction
)) {
2699 /* This is stupid, we shouldn't have to do this */
2701 sigaction
.sa_handler
= (caddr32_t
)odisp
;
2703 "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2706 sigaction
.sa_handler
,
2707 sigset_string(pri
, (sigset_t
*)&sigaction
.sa_mask
),
2708 sigaction
.sa_flags
);
2714 show_sigaction(private_t
*pri
, long offset
, const char *name
, long odisp
)
2716 struct sigaction sigaction
;
2719 if (data_model
!= PR_MODEL_LP64
) {
2720 show_sigaction32(pri
, offset
, name
, odisp
);
2725 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2726 sizeof (sigaction
)) {
2727 /* This is stupid, we shouldn't have to do this */
2729 sigaction
.sa_handler
= (void (*)())odisp
;
2731 "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2734 (long)sigaction
.sa_handler
,
2735 sigset_string(pri
, &sigaction
.sa_mask
),
2736 sigaction
.sa_flags
);
2742 print_siginfo32(private_t
*pri
, const siginfo32_t
*sip
)
2744 const char *code
= NULL
;
2746 (void) printf("%s siginfo: %s", pri
->pname
,
2747 signame(pri
, sip
->si_signo
));
2749 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2750 (void) printf(" pid=%d uid=%d", sip
->si_pid
, sip
->si_uid
);
2751 if (sip
->si_code
!= 0)
2752 (void) printf(" code=%d", sip
->si_code
);
2753 (void) fputc('\n', stdout
);
2757 switch (sip
->si_signo
) {
2759 (void) fputc('\n', stdout
);
2773 switch (sip
->si_signo
) {
2775 switch (sip
->si_code
) {
2776 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2777 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2778 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2779 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2780 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2781 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2782 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2783 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2787 switch (sip
->si_code
) {
2788 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2789 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2790 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2791 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2792 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2793 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2797 switch (sip
->si_code
) {
2798 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2799 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2800 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2801 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2802 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2803 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2804 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2805 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2806 #if defined(FPE_FLTDEN)
2807 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2812 switch (sip
->si_code
) {
2813 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2814 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2818 switch (sip
->si_code
) {
2820 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2822 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2826 switch (sip
->si_code
) {
2827 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2828 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2829 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2833 switch (sip
->si_code
) {
2834 case CLD_EXITED
: code
= "CLD_EXITED"; break;
2835 case CLD_KILLED
: code
= "CLD_KILLED"; break;
2836 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
2837 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
2838 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
2839 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
2843 switch (sip
->si_code
) {
2844 case POLL_IN
: code
= "POLL_IN"; break;
2845 case POLL_OUT
: code
= "POLL_OUT"; break;
2846 case POLL_MSG
: code
= "POLL_MSG"; break;
2847 case POLL_ERR
: code
= "POLL_ERR"; break;
2848 case POLL_PRI
: code
= "POLL_PRI"; break;
2849 case POLL_HUP
: code
= "POLL_HUP"; break;
2855 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
2856 code
= (const char *)pri
->code_buf
;
2859 switch (sip
->si_signo
) {
2866 (void) printf(" %s addr=0x%.8X",
2871 (void) printf(" %s pid=%d status=0x%.4X",
2878 (void) printf(" %s fd=%d band=%d",
2885 if (sip
->si_errno
!= 0) {
2886 const char *ename
= errname(sip
->si_errno
);
2888 (void) printf(" errno=%d", sip
->si_errno
);
2890 (void) printf("(%s)", ename
);
2893 (void) fputc('\n', stdout
);
2898 print_siginfo(private_t
*pri
, const siginfo_t
*sip
)
2900 const char *code
= NULL
;
2902 (void) printf("%s siginfo: %s", pri
->pname
,
2903 signame(pri
, sip
->si_signo
));
2905 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2906 (void) printf(" pid=%d uid=%u",
2909 if (sip
->si_code
!= 0)
2910 (void) printf(" code=%d", sip
->si_code
);
2911 (void) fputc('\n', stdout
);
2915 switch (sip
->si_signo
) {
2917 (void) fputc('\n', stdout
);
2931 switch (sip
->si_signo
) {
2933 switch (sip
->si_code
) {
2934 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2935 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2936 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2937 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2938 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2939 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2940 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2941 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2945 switch (sip
->si_code
) {
2946 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2947 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2948 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2949 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2950 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2951 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2955 switch (sip
->si_code
) {
2956 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2957 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2958 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2959 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2960 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2961 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2962 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2963 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2964 #if defined(FPE_FLTDEN)
2965 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2970 switch (sip
->si_code
) {
2971 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2972 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2976 switch (sip
->si_code
) {
2978 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2980 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2984 switch (sip
->si_code
) {
2985 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2986 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2987 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2991 switch (sip
->si_code
) {
2992 case CLD_EXITED
: code
= "CLD_EXITED"; break;
2993 case CLD_KILLED
: code
= "CLD_KILLED"; break;
2994 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
2995 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
2996 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
2997 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
3001 switch (sip
->si_code
) {
3002 case POLL_IN
: code
= "POLL_IN"; break;
3003 case POLL_OUT
: code
= "POLL_OUT"; break;
3004 case POLL_MSG
: code
= "POLL_MSG"; break;
3005 case POLL_ERR
: code
= "POLL_ERR"; break;
3006 case POLL_PRI
: code
= "POLL_PRI"; break;
3007 case POLL_HUP
: code
= "POLL_HUP"; break;
3013 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
3014 code
= (const char *)pri
->code_buf
;
3017 switch (sip
->si_signo
) {
3024 (void) printf(" %s addr=0x%.8lX",
3026 (long)sip
->si_addr
);
3029 (void) printf(" %s pid=%d status=0x%.4X",
3036 (void) printf(" %s fd=%d band=%ld",
3043 if (sip
->si_errno
!= 0) {
3044 const char *ename
= errname(sip
->si_errno
);
3046 (void) printf(" errno=%d", sip
->si_errno
);
3048 (void) printf("(%s)", ename
);
3051 (void) fputc('\n', stdout
);
3056 show_siginfo32(private_t
*pri
, long offset
)
3058 struct siginfo32 siginfo
;
3061 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3062 print_siginfo32(pri
, &siginfo
);
3067 show_siginfo(private_t
*pri
, long offset
)
3069 struct siginfo siginfo
;
3072 if (data_model
!= PR_MODEL_LP64
) {
3073 show_siginfo32(pri
, offset
);
3078 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3079 print_siginfo(pri
, &siginfo
);
3083 show_bool(private_t
*pri
, long offset
, int count
)
3085 int serial
= (count
> MYBUFSIZ
/ 4);
3087 /* enter region of lengthy output */
3093 int nb
= (count
< 32)? count
: 32;
3096 if (Pread(Proc
, buf
, (size_t)nb
, offset
) != nb
)
3099 (void) printf("%s ", pri
->pname
);
3100 for (i
= 0; i
< nb
; i
++)
3101 (void) printf(" %d", buf
[i
]);
3102 (void) fputc('\n', stdout
);
3108 /* exit region of lengthy output */
3115 show_iovec32(private_t
*pri
, long offset
, int niov
, int showbuf
, long count
)
3117 iovec32_t iovec
[16];
3120 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3122 if (niov
> 16) /* is this the real limit? */
3125 if (offset
!= 0 && niov
> 0 &&
3126 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec32_t
), offset
)
3127 == niov
*sizeof (iovec32_t
)) {
3128 /* enter region of lengthy output */
3132 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3133 (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n",
3137 if ((nb
= count
) > 0) {
3138 if (nb
> ip
->iov_len
)
3143 if (showbuf
&& nb
> 0)
3144 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3147 /* exit region of lengthy output */
3155 show_iovec(private_t
*pri
, long offset
, long niov
, int showbuf
, long count
)
3160 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3163 if (data_model
!= PR_MODEL_LP64
) {
3164 show_iovec32(pri
, offset
, niov
, showbuf
, count
);
3168 if (niov
> 16) /* is this the real limit? */
3171 if (offset
!= 0 && niov
> 0 &&
3172 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec_t
), offset
)
3173 == niov
*sizeof (iovec_t
)) {
3174 /* enter region of lengthy output */
3178 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3179 (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n",
3183 if ((nb
= count
) > 0) {
3184 if (nb
> ip
->iov_len
)
3189 if (showbuf
&& nb
> 0)
3190 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3193 /* exit region of lengthy output */
3200 show_dents32(private_t
*pri
, long offset
, long count
)
3202 long buf
[MYBUFSIZ
/ sizeof (long)];
3203 struct dirent32
*dp
;
3204 int serial
= (count
> 100);
3209 /* enter region of lengthy output */
3213 while (count
> 0 && !interrupt
) {
3214 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3216 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3219 dp
= (struct dirent32
*)&buf
[0];
3220 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3222 if ((unsigned)nb
< dp
->d_reclen
) {
3223 /* getdents() error? */
3225 "%s ino=%-5u off=%-4d rlen=%-3d\n",
3233 while (!interrupt
&&
3234 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3235 (unsigned)nb
>= dp
->d_reclen
) {
3237 "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3242 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3245 count
-= dp
->d_reclen
;
3246 offset
+= dp
->d_reclen
;
3247 /* LINTED improper alignment */
3248 dp
= (struct dirent32
*)((char *)dp
+ dp
->d_reclen
);
3252 /* exit region of lengthy output */
3258 show_dents64(private_t
*pri
, long offset
, long count
)
3260 long long buf
[MYBUFSIZ
/ sizeof (long long)];
3261 struct dirent64
*dp
;
3262 int serial
= (count
> 100);
3267 /* enter region of lengthy output */
3271 while (count
> 0 && !interrupt
) {
3272 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3274 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3277 dp
= (struct dirent64
*)&buf
[0];
3278 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3280 if ((unsigned)nb
< dp
->d_reclen
) {
3281 /* getdents() error? */
3283 "%s ino=%-5llu off=%-4lld rlen=%-3d\n",
3285 (long long)dp
->d_ino
,
3286 (long long)dp
->d_off
,
3291 while (!interrupt
&&
3292 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3293 (unsigned)nb
>= dp
->d_reclen
) {
3295 "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3297 (long long)dp
->d_ino
,
3298 (long long)dp
->d_off
,
3300 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3303 count
-= dp
->d_reclen
;
3304 offset
+= dp
->d_reclen
;
3305 /* LINTED improper alignment */
3306 dp
= (struct dirent64
*)((char *)dp
+ dp
->d_reclen
);
3310 /* exit region of lengthy output */
3316 show_rlimit32(private_t
*pri
, long offset
)
3318 struct rlimit32 rlimit
;
3321 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3322 (void) printf("%s\t", pri
->pname
);
3323 switch (rlimit
.rlim_cur
) {
3324 case RLIM32_INFINITY
:
3325 (void) fputs("cur = RLIM_INFINITY", stdout
);
3327 case RLIM32_SAVED_MAX
:
3328 (void) fputs("cur = RLIM_SAVED_MAX", stdout
);
3330 case RLIM32_SAVED_CUR
:
3331 (void) fputs("cur = RLIM_SAVED_CUR", stdout
);
3334 (void) printf("cur = %lu", (long)rlimit
.rlim_cur
);
3337 switch (rlimit
.rlim_max
) {
3338 case RLIM32_INFINITY
:
3339 (void) fputs(" max = RLIM_INFINITY\n", stdout
);
3341 case RLIM32_SAVED_MAX
:
3342 (void) fputs(" max = RLIM_SAVED_MAX\n", stdout
);
3344 case RLIM32_SAVED_CUR
:
3345 (void) fputs(" max = RLIM_SAVED_CUR\n", stdout
);
3348 (void) printf(" max = %lu\n", (long)rlimit
.rlim_max
);
3355 show_rlimit64(private_t
*pri
, long offset
)
3357 struct rlimit64 rlimit
;
3360 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3361 (void) printf("%s\t", pri
->pname
);
3362 switch (rlimit
.rlim_cur
) {
3363 case RLIM64_INFINITY
:
3364 (void) fputs("cur = RLIM64_INFINITY", stdout
);
3366 case RLIM64_SAVED_MAX
:
3367 (void) fputs("cur = RLIM64_SAVED_MAX", stdout
);
3369 case RLIM64_SAVED_CUR
:
3370 (void) fputs("cur = RLIM64_SAVED_CUR", stdout
);
3373 (void) printf("cur = %llu",
3374 (unsigned long long)rlimit
.rlim_cur
);
3377 switch (rlimit
.rlim_max
) {
3378 case RLIM64_INFINITY
:
3379 (void) fputs(" max = RLIM64_INFINITY\n", stdout
);
3381 case RLIM64_SAVED_MAX
:
3382 (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout
);
3384 case RLIM64_SAVED_CUR
:
3385 (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout
);
3388 (void) printf(" max = %llu\n",
3389 (unsigned long long)rlimit
.rlim_max
);
3396 show_uname(private_t
*pri
, long offset
)
3398 struct utsname ubuf
;
3401 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
3403 "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3414 show_adjtime(private_t
*pri
, long off1
, long off2
)
3416 show_timeval(pri
, off1
, " delta");
3417 show_timeval(pri
, off2
, "olddelta");
3421 show_sockaddr(private_t
*pri
,
3422 const char *str
, long addroff
, long lenoff
, long len
)
3425 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
3426 * also large enough to store a sockaddr_in or a sockaddr_in6.
3428 long buf
[(sizeof (short) + PATH_MAX
+ sizeof (long) - 1)
3430 struct sockaddr
*sa
= (struct sockaddr
*)buf
;
3431 struct sockaddr_in
*sin
= (struct sockaddr_in
*)buf
;
3432 struct sockaddr_un
*soun
= (struct sockaddr_un
*)buf
;
3433 struct sockaddr_in6
*sin6
= (struct sockaddr_in6
*)buf
;
3434 char addrbuf
[INET6_ADDRSTRLEN
];
3438 if (Pread(Proc
, &ilen
, sizeof (ilen
), lenoff
) != sizeof (ilen
))
3443 if (len
>= sizeof (buf
)) /* protect against ridiculous length */
3444 len
= sizeof (buf
) - 1;
3445 if (Pread(Proc
, buf
, len
, addroff
) != len
)
3448 switch (sa
->sa_family
) {
3450 (void) printf("%s\tAF_INET6 %s = %s port = %u\n",
3452 inet_ntop(AF_INET6
, &sin6
->sin6_addr
, addrbuf
,
3454 ntohs(sin6
->sin6_port
));
3455 (void) printf("%s\tscope id = %u source id = 0x%x\n"
3456 "%s\tflow class = 0x%02x flow label = 0x%05x\n",
3457 pri
->pname
, ntohl(sin6
->sin6_scope_id
),
3458 ntohl(sin6
->__sin6_src_id
),
3460 ntohl((sin6
->sin6_flowinfo
& IPV6_FLOWINFO_TCLASS
) >> 20),
3461 ntohl(sin6
->sin6_flowinfo
& IPV6_FLOWINFO_FLOWLABEL
));
3464 (void) printf("%s\tAF_%s %s = %s port = %u\n",
3466 str
, inet_ntop(AF_INET
, &sin
->sin_addr
, addrbuf
,
3467 sizeof (addrbuf
)), ntohs(sin
->sin_port
));
3470 len
-= sizeof (soun
->sun_family
);
3472 /* Null terminate */
3473 soun
->sun_path
[len
] = '\0';
3474 (void) printf("%s\tAF_UNIX %s = %s\n", pri
->pname
,
3475 str
, soun
->sun_path
);
3482 show_msghdr(private_t
*pri
, long offset
)
3484 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3485 int what
= Lsp
->pr_what
;
3486 int err
= pri
->Errno
;
3488 int showbuf
= FALSE
;
3489 int i
= pri
->sys_args
[0]+1;
3490 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3492 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3495 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3496 show_sockaddr(pri
, "msg_name",
3497 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3500 * Print the iovec if the syscall was successful and the fd is
3501 * part of the set being traced.
3503 if ((what
== SYS_recvmsg
&& !err
&&
3504 prismember(&readfd
, i
)) ||
3505 (what
== SYS_sendmsg
&&
3506 prismember(&writefd
, i
)))
3509 show_iovec(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3515 show_msghdr32(private_t
*pri
, long offset
)
3519 uint32_t msg_namelen
;
3523 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3524 int what
= Lsp
->pr_what
;
3525 int err
= pri
->Errno
;
3526 int showbuf
= FALSE
;
3527 int i
= pri
->sys_args
[0]+1;
3528 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3530 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3533 if (msg
.msg_name
!= 0 && msg
.msg_namelen
!= 0)
3534 show_sockaddr(pri
, "msg_name",
3535 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3537 * Print the iovec if the syscall was successful and the fd is
3538 * part of the set being traced.
3540 if ((what
== SYS_recvmsg
&& !err
&&
3541 prismember(&readfd
, i
)) ||
3542 (what
== SYS_sendmsg
&&
3543 prismember(&writefd
, i
)))
3546 show_iovec32(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3552 show_doorargs(private_t
*pri
, long offset
)
3556 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3557 (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
3559 (ulong_t
)args
.data_ptr
,
3560 (ulong_t
)args
.data_size
);
3561 (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
3563 (ulong_t
)args
.desc_ptr
,
3565 (void) printf("%s\trbuf=0x%lX rsize=%lu\n",
3568 (ulong_t
)args
.rsize
);
3573 show_ucred_privsets(private_t
*pri
, ucred_t
*uc
)
3576 const priv_set_t
*s
;
3580 while ((sn
= priv_getsetbynum(i
++)) != NULL
) {
3581 s
= ucred_getprivset(uc
, sn
);
3586 (void) printf("%s\t%c: %s\n",
3589 str
= priv_set_to_str(s
, ',', PRIV_STR_SHORT
));
3596 show_ucred(private_t
*pri
, long offset
)
3598 ucred_t
*uc
= _ucred_alloc();
3604 sz
= Pread(Proc
, uc
, uc
->uc_size
, offset
);
3607 * A new uc_size is read, it could be smaller than the previously
3608 * value. We accept short reads that fill the whole header.
3610 if (sz
>= sizeof (ucred_t
) && sz
>= uc
->uc_size
) {
3611 (void) printf("%s\teuid=%u egid=%u\n",
3615 (void) printf("%s\truid=%u rgid=%u\n",
3619 (void) printf("%s\tpid=%d zoneid=%d\n",
3621 (int)ucred_getpid(uc
),
3622 (int)ucred_getzoneid(uc
));
3623 show_ucred_privsets(pri
, uc
);
3629 show_privset(private_t
*pri
, long offset
, size_t size
, char *label
)
3631 priv_set_t
*tmp
= priv_allocset();
3637 sz
= Pread(Proc
, tmp
, size
, offset
);
3640 char *str
= priv_set_to_str(tmp
, ',', PRIV_STR_SHORT
);
3642 (void) printf("%s\t%s%s\n", pri
->pname
, label
, str
);
3650 show_doorinfo(private_t
*pri
, long offset
)
3655 if (Pread(Proc
, &info
, sizeof (info
), offset
) != sizeof (info
))
3657 (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
3659 (int)info
.di_target
,
3662 attr
= info
.di_attributes
;
3663 (void) printf("%s\tattributes=%s\n", pri
->pname
, door_flags(pri
, attr
));
3664 (void) printf("%s\tuniquifier=%llu\n", pri
->pname
, info
.di_uniquifier
);
3668 show_doorparam(private_t
*pri
, long offset
)
3672 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3673 (void) printf("%s\tvalue=%lu\n",
3682 show_doorargs32(private_t
*pri
, long offset
)
3684 struct door_arg32 args
;
3686 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3687 (void) printf("%s\tdata_ptr=%X data_size=%u\n",
3691 (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
3695 (void) printf("%s\trbuf=0x%X rsize=%u\n",
3703 show_doorparam32(private_t
*pri
, long offset
)
3707 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3708 (void) printf("%s\tvalue=%u\n",
3717 show_doors(private_t
*pri
)
3719 switch (pri
->sys_args
[5]) {
3722 if (data_model
== PR_MODEL_LP64
)
3723 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3725 show_doorargs32(pri
, (long)pri
->sys_args
[1]);
3727 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3732 show_ucred(pri
, (long)pri
->sys_args
[0]);
3736 show_doorinfo(pri
, (long)pri
->sys_args
[1]);
3741 if (data_model
== PR_MODEL_LP64
)
3742 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3744 show_doorparam32(pri
, (long)pri
->sys_args
[2]);
3746 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3754 show_portargs(private_t
*pri
, long offset
)
3758 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3759 (void) printf("%s\tevents=0x%x source=%u\n",
3762 args
.portev_source
);
3763 (void) printf("%s\tobject=0x%p user=0x%p\n",
3765 (void *)args
.portev_object
,
3766 (void *)args
.portev_user
);
3774 show_portargs32(private_t
*pri
, long offset
)
3776 port_event32_t args
;
3778 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3779 (void) printf("%s\tevents=0x%x source=%u\n",
3782 args
.portev_source
);
3783 (void) printf("%s\tobject=0x%x user=0x%x\n",
3793 show_ports(private_t
*pri
)
3795 switch (pri
->sys_args
[0]) {
3798 if (data_model
== PR_MODEL_LP64
)
3799 show_portargs(pri
, (long)pri
->sys_args
[2]);
3801 show_portargs32(pri
, (long)pri
->sys_args
[2]);
3803 show_portargs(pri
, (long)pri
->sys_args
[2]);
3809 #define MAX_SNDFL_PRD 16
3814 show_ksendfilevec32(private_t
*pri
, int fd
,
3815 ksendfilevec32_t
*sndvec
, int sfvcnt
)
3817 ksendfilevec32_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3821 while (sfvcnt
> 0) {
3822 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3824 cpy_rqst
*= sizeof (snd
[0]);
3826 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3833 "sfv_fd=%d\tsfv_flag=0x%x\t"
3834 "sfv_off=%d\tsfv_len=%u\n",
3840 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3841 prismember(&writefd
, fd
)) {
3843 (long)snd_ptr
->sfv_off
& 0xffffffff,
3844 (long)snd_ptr
->sfv_len
);
3847 cpy_rqst
-= sizeof (snd
[0]);
3851 sndvec
+= MAX_SNDFL_PRD
;
3857 show_ksendfilevec64(private_t
*pri
, int fd
,
3858 ksendfilevec64_t
*sndvec
, int sfvcnt
)
3860 ksendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3864 while (sfvcnt
> 0) {
3865 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3867 cpy_rqst
*= sizeof (snd
[0]);
3869 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3876 "sfv_fd=%d\tsfv_flag=0x%x\t"
3877 "sfv_off=%ld\tsfv_len=%u\n",
3883 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3884 prismember(&writefd
, fd
)) {
3886 (long)snd_ptr
->sfv_off
& 0xffffffff,
3887 (long)snd_ptr
->sfv_len
);
3890 cpy_rqst
-= sizeof (snd
[0]);
3894 sndvec
+= MAX_SNDFL_PRD
;
3903 show_sendfilevec(private_t
*pri
, int fd
, sendfilevec_t
*sndvec
, int sfvcnt
)
3905 sendfilevec_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3909 if (data_model
!= PR_MODEL_LP64
) {
3910 show_ksendfilevec32(pri
, fd
,
3911 (ksendfilevec32_t
*)sndvec
, sfvcnt
);
3916 while (sfvcnt
> 0) {
3917 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3919 cpy_rqst
*= sizeof (snd
[0]);
3921 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3928 "sfv_fd=%d\tsfv_flag=0x%x\t"
3929 "sfv_off=%ld\tsfv_len=%lu\n",
3933 (ulong_t
)snd_ptr
->sfv_len
);
3935 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3936 prismember(&writefd
, fd
)) {
3937 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
3938 (long)snd_ptr
->sfv_len
);
3941 cpy_rqst
-= sizeof (snd
[0]);
3945 sndvec
+= MAX_SNDFL_PRD
;
3952 show_sendfilevec64(private_t
*pri
, int fd
, sendfilevec64_t
*sndvec
, int sfvcnt
)
3954 sendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3958 if (data_model
!= PR_MODEL_LP64
) {
3959 show_ksendfilevec64(pri
, fd
,
3960 (ksendfilevec64_t
*)sndvec
, sfvcnt
);
3966 while (sfvcnt
> 0) {
3967 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3969 cpy_rqst
*= sizeof (snd
[0]);
3971 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3979 "sfv_fd=%d\tsfv_flag=0x%x\t"
3980 "sfv_off=%ld\tsfv_len=%lu\n",
3982 "sfv_fd=%d\tsfv_flag=0x%x\t"
3983 "sfv_off=%lld\tsfv_len=%lu\n",
3988 (ulong_t
)snd_ptr
->sfv_len
);
3990 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3991 prismember(&writefd
, fd
)) {
3992 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
3993 (long)snd_ptr
->sfv_len
);
3996 cpy_rqst
-= sizeof (snd
[0]);
4000 sndvec
+= MAX_SNDFL_PRD
;
4006 show_memcntl_mha(private_t
*pri
, long offset
)
4008 struct memcntl_mha mha
;
4009 const char *s
= NULL
;
4011 if (Pread(Proc
, &mha
, sizeof (mha
), offset
) == sizeof (mha
)) {
4012 switch (mha
.mha_cmd
) {
4013 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4014 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4015 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4018 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4019 " mha_pagesize=%lu\n",
4020 pri
->pname
, s
, mha
.mha_flags
,
4021 (ulong_t
)mha
.mha_pagesize
);
4023 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4024 " mha_pagesize=%lu\n",
4025 pri
->pname
, mha
.mha_cmd
, mha
.mha_flags
,
4026 (ulong_t
)mha
.mha_pagesize
);
4033 show_memcntl_mha32(private_t
*pri
, long offset
)
4035 struct memcntl_mha32 mha32
;
4036 const char *s
= NULL
;
4038 if (Pread(Proc
, &mha32
, sizeof (mha32
), offset
) ==
4040 switch (mha32
.mha_cmd
) {
4041 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4042 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4043 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4046 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4047 " mha_pagesize=%u\n",
4048 pri
->pname
, s
, mha32
.mha_flags
, mha32
.mha_pagesize
);
4050 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4051 " mha_pagesize=%u\n",
4052 pri
->pname
, mha32
.mha_cmd
, mha32
.mha_flags
,
4053 mha32
.mha_pagesize
);
4060 show_memcntl(private_t
*pri
)
4063 if ((int)pri
->sys_args
[2] != MC_HAT_ADVISE
)
4066 if (data_model
== PR_MODEL_LP64
)
4067 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4069 show_memcntl_mha32(pri
, (long)pri
->sys_args
[3]);
4071 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4076 show_ids(private_t
*pri
, long offset
, int count
)
4078 id_t buf
[MYBUFSIZ
/ sizeof (id_t
)];
4080 int serial
= (count
> MYBUFSIZ
/ 48);
4085 /* enter region of lengthy output */
4089 while (count
> 0 && !interrupt
) {
4090 ssize_t nb
= (count
* sizeof (id_t
) < MYBUFSIZ
)?
4091 count
* sizeof (id_t
) : MYBUFSIZ
;
4093 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) < 0 ||
4098 while (!interrupt
&& nb
>= sizeof (id_t
)) {
4099 (void) printf("%s\t%8d\n", pri
->pname
, (int)*idp
);
4100 offset
+= sizeof (id_t
);
4101 nb
-= sizeof (id_t
);
4107 /* exit region of lengthy output */
4113 show_ntp_gettime(private_t
*pri
)
4115 struct ntptimeval ntv
;
4118 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
4121 if (data_model
== PR_MODEL_NATIVE
) {
4122 if (Pread(Proc
, &ntv
, sizeof (ntv
), offset
)
4126 struct ntptimeval32 ntv32
;
4128 if (Pread(Proc
, &ntv32
, sizeof (ntv32
), offset
)
4132 TIMEVAL32_TO_TIMEVAL(&ntv
.time
, &ntv32
.time
);
4133 ntv
.maxerror
= ntv32
.maxerror
;
4134 ntv
.esterror
= ntv32
.esterror
;
4137 (void) printf("\ttime: %ld.%6.6ld sec\n",
4138 ntv
.time
.tv_sec
, ntv
.time
.tv_usec
);
4139 (void) printf("\tmaxerror: %11d usec\n", ntv
.maxerror
);
4140 (void) printf("\testerror: %11d usec\n", ntv
.esterror
);
4144 get_timex_modes(private_t
*pri
, uint32_t val
)
4146 char *str
= pri
->code_buf
;
4150 if (val
& MOD_OFFSET
)
4151 used
= strlcat(str
, "|MOD_OFFSET", sizeof (pri
->code_buf
));
4152 if (val
& MOD_FREQUENCY
)
4153 used
= strlcat(str
, "|MOD_FREQUENCY", sizeof (pri
->code_buf
));
4154 if (val
& MOD_MAXERROR
)
4155 used
= strlcat(str
, "|MOD_MAXERROR", sizeof (pri
->code_buf
));
4156 if (val
& MOD_ESTERROR
)
4157 used
= strlcat(str
, "|MOD_ESTERROR", sizeof (pri
->code_buf
));
4158 if (val
& MOD_STATUS
)
4159 used
= strlcat(str
, "|MOD_STATUS", sizeof (pri
->code_buf
));
4160 if (val
& MOD_TIMECONST
)
4161 used
= strlcat(str
, "|MOD_TIMECONST", sizeof (pri
->code_buf
));
4163 used
= strlcat(str
, "|MOD_CLKB", sizeof (pri
->code_buf
));
4165 used
= strlcat(str
, "|MOD_CLKA", sizeof (pri
->code_buf
));
4167 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4168 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4174 get_timex_status(private_t
*pri
, int32_t val
)
4176 char *str
= pri
->code_buf
;
4181 used
= strlcat(str
, "|STA_PLL", sizeof (pri
->code_buf
));
4182 if (val
& STA_PPSFREQ
)
4183 used
= strlcat(str
, "|STA_PPSFREQ", sizeof (pri
->code_buf
));
4184 if (val
& STA_PPSTIME
)
4185 used
= strlcat(str
, "|STA_PPSTIME", sizeof (pri
->code_buf
));
4187 used
= strlcat(str
, "|STA_FLL", sizeof (pri
->code_buf
));
4190 used
= strlcat(str
, "|STA_INS", sizeof (pri
->code_buf
));
4192 used
= strlcat(str
, "|STA_DEL", sizeof (pri
->code_buf
));
4193 if (val
& STA_UNSYNC
)
4194 used
= strlcat(str
, "|STA_UNSYNC", sizeof (pri
->code_buf
));
4195 if (val
& STA_FREQHOLD
)
4196 used
= strlcat(str
, "|STA_FREQHOLD", sizeof (pri
->code_buf
));
4198 if (val
& STA_PPSSIGNAL
)
4199 used
= strlcat(str
, "|STA_PPSSIGNAL", sizeof (pri
->code_buf
));
4200 if (val
& STA_PPSJITTER
)
4201 used
= strlcat(str
, "|STA_PPSJITTER", sizeof (pri
->code_buf
));
4202 if (val
& STA_PPSWANDER
)
4203 used
= strlcat(str
, "|STA_PPSWANDER", sizeof (pri
->code_buf
));
4204 if (val
& STA_PPSERROR
)
4205 used
= strlcat(str
, "|STA_PPSERROR", sizeof (pri
->code_buf
));
4207 if (val
& STA_CLOCKERR
)
4208 used
= strlcat(str
, "|STA_CLOCKERR", sizeof (pri
->code_buf
));
4210 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4211 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4217 show_ntp_adjtime(private_t
*pri
)
4222 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
4225 if (Pread(Proc
, &timex
, sizeof (timex
), offset
) != sizeof (timex
))
4228 (void) printf("\tmodes: %s\n", get_timex_modes(pri
, timex
.modes
));
4229 (void) printf("\toffset: %11d usec\n", timex
.offset
);
4230 (void) printf("\tfreq: %11d scaled ppm\n", timex
.freq
);
4231 (void) printf("\tmaxerror: %11d usec\n", timex
.maxerror
);
4232 (void) printf("\testerror: %11d usec\n", timex
.esterror
);
4233 (void) printf("\tstatus: %s\n", get_timex_status(pri
, timex
.status
));
4234 (void) printf("\tconstant: %11d\n", timex
.constant
);
4235 (void) printf("\tprecision: %11d usec\n", timex
.precision
);
4236 (void) printf("\ttolerance: %11d scaled ppm\n", timex
.tolerance
);
4237 (void) printf("\tppsfreq: %11d scaled ppm\n", timex
.ppsfreq
);
4238 (void) printf("\tjitter: %11d usec\n", timex
.jitter
);
4239 (void) printf("\tshift: %11d sec\n", timex
.shift
);
4240 (void) printf("\tstabil: %11d scaled ppm\n", timex
.stabil
);
4241 (void) printf("\tjitcnt: %11d\n", timex
.jitcnt
);
4242 (void) printf("\tcalcnt: %11d\n", timex
.calcnt
);
4243 (void) printf("\terrcnt: %11d\n", timex
.errcnt
);
4244 (void) printf("\tstbcnt: %11d\n", timex
.stbcnt
);
4248 show_getrusage(long offset
)
4251 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4253 (void) printf("\t user time: %ld.%6.6ld sec\n",
4255 r
.ru_utime
.tv_usec
);
4256 (void) printf("\t system time: %ld.%6.6ld sec\n",
4258 r
.ru_stime
.tv_usec
);
4259 (void) printf("\t max rss: <unimpl> %ld\n",
4261 (void) printf("\t shared data: <unimpl> %ld\n",
4263 (void) printf("\t unshared data: <unimpl> %ld\n",
4265 (void) printf("\t unshared stack: <unimpl> %ld\n",
4267 (void) printf("\t minor faults: %ld\n",
4269 (void) printf("\t major faults: %ld\n",
4271 (void) printf("\t # of swaps: %ld\n",
4273 (void) printf("\t blocked inputs: %ld\n",
4275 (void) printf("\t blocked outputs: %ld\n",
4277 (void) printf("\t msgs sent: %ld\n",
4279 (void) printf("\t msgs rcv'd: %ld\n",
4281 (void) printf("\t signals rcv'd: %ld\n",
4283 (void) printf("\tvol cntxt swtchs: %ld\n",
4285 (void) printf("\tinv cntxt swtchs: %ld\n",
4291 show_getrusage32(long offset
)
4294 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4296 (void) printf("\t user time: %d.%6.6d sec\n",
4298 r
.ru_utime
.tv_usec
);
4299 (void) printf("\t system time: %d.%6.6d sec\n",
4301 r
.ru_stime
.tv_usec
);
4302 (void) printf("\t max rss: <unimpl> %d\n",
4304 (void) printf("\t shared data: <unimpl> %d\n",
4306 (void) printf("\t unshared data: <unimpl> %d\n",
4308 (void) printf("\t unshared stack: <unimpl> %d\n",
4310 (void) printf("\t minor faults: %d\n",
4312 (void) printf("\t major faults: %d\n",
4314 (void) printf("\t # of swaps: %d\n",
4316 (void) printf("\t blocked inputs: %d\n",
4318 (void) printf("\t blocked outputs: %d\n",
4320 (void) printf("\t msgs sent: %d\n",
4322 (void) printf("\t msgs rcv'd: %d\n",
4324 (void) printf("\t signals rcv'd: %d\n",
4326 (void) printf("\tvol cntxt swtchs: %d\n",
4328 (void) printf("\tinv cntxt swtchs: %d\n",
4334 * Utility function to print a packed nvlist by unpacking
4335 * and calling the libnvpair pretty printer. Frees all
4336 * allocated memory internally.
4339 show_packed_nvlist(private_t
*pri
, uintptr_t offset
, size_t size
)
4341 nvlist_t
*nvl
= NULL
;
4345 if ((offset
== 0) || (size
== 0)) {
4349 buf
= my_malloc(size
, "nvlist decode buffer");
4350 readsize
= Pread(Proc
, buf
, size
, offset
);
4351 if (readsize
!= size
) {
4352 (void) printf("%s\t<?>", pri
->pname
);
4356 result
= nvlist_unpack(buf
, size
, &nvl
, 0);
4358 dump_nvlist(nvl
, 8);
4361 (void) printf("%s\tunpack of nvlist"
4362 " failed: %d\n", pri
->pname
, result
);
4369 show_zone_create_args(private_t
*pri
, long offset
)
4372 char zone_name
[ZONENAME_MAX
];
4373 char zone_root
[MAXPATHLEN
];
4374 char *zone_zfs
= NULL
;
4376 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4378 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4379 (uintptr_t)args
.zone_name
) == -1)
4380 (void) strcpy(zone_name
, "<?>");
4382 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4383 (uintptr_t)args
.zone_root
) == -1)
4384 (void) strcpy(zone_root
, "<?>");
4386 if (args
.zfsbufsz
> 0) {
4387 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4388 if (zone_zfs
!= NULL
) {
4389 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4390 (uintptr_t)args
.zfsbuf
) == -1)
4391 (void) strcpy(zone_zfs
, "<?>");
4397 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4399 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4402 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4403 args
.zone_privssz
, " zone_privs: ");
4405 (void) printf("%s\t rctlbuf: 0x%p\n", pri
->pname
,
4406 (void *)args
.rctlbuf
);
4407 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4408 (ulong_t
)args
.rctlbufsz
);
4410 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4413 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4415 (void) printf("%s\textended_error: 0x%p\n", pri
->pname
,
4416 (void *)args
.extended_error
);
4418 if (args
.zfsbufsz
> 0)
4427 show_zone_create_args32(private_t
*pri
, long offset
)
4430 char zone_name
[ZONENAME_MAX
];
4431 char zone_root
[MAXPATHLEN
];
4432 char *zone_zfs
= NULL
;
4434 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4436 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4437 (uintptr_t)args
.zone_name
) == -1)
4438 (void) strcpy(zone_name
, "<?>");
4440 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4441 (uintptr_t)args
.zone_root
) == -1)
4442 (void) strcpy(zone_root
, "<?>");
4444 if (args
.zfsbufsz
> 0) {
4445 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4446 if (zone_zfs
!= NULL
) {
4447 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4448 (uintptr_t)args
.zfsbuf
) == -1)
4449 (void) strcpy(zone_zfs
, "<?>");
4455 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4457 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4460 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4461 args
.zone_privssz
, " zone_privs: ");
4463 (void) printf("%s\t rctlbuf: 0x%x\n", pri
->pname
,
4464 (caddr32_t
)args
.rctlbuf
);
4465 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4466 (ulong_t
)args
.rctlbufsz
);
4468 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4471 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4473 (void) printf("%s\textended_error: 0x%x\n", pri
->pname
,
4474 (caddr32_t
)args
.extended_error
);
4476 if (args
.zfsbufsz
> 0)
4484 show_zones(private_t
*pri
)
4486 switch (pri
->sys_args
[0]) {
4489 if (data_model
== PR_MODEL_LP64
)
4490 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4492 show_zone_create_args32(pri
, (long)pri
->sys_args
[1]);
4494 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4501 show_rctlblk(private_t
*pri
, long _rctlblk
)
4504 int size
= rctlblk_size();
4508 blk
= my_malloc(size
, "rctlblk decode buffer");
4509 readsize
= Pread(Proc
, blk
, size
, _rctlblk
);
4510 if (readsize
!= size
) {
4511 (void) printf("%s\t\t<?>", pri
->pname
);
4513 (void) printf("%s\t\t Privilege: 0x%x\n",
4515 rctlblk_get_privilege(blk
));
4516 (void) printf("%s\t\t Value: %lld\n",
4518 rctlblk_get_value(blk
));
4519 (void) printf("%s\t\tEnforced Value: %lld\n",
4521 rctlblk_get_enforced_value(blk
));
4525 act
= rctlblk_get_local_action(blk
, &sig
);
4527 s
= rctl_local_action(pri
, act
);
4529 (void) printf("%s\t\t Local action: 0x%x\n",
4532 (void) printf("%s\t\t Local action: %s\n",
4536 if (act
& RCTL_LOCAL_SIGNAL
) {
4537 (void) printf("%s\t\t "
4539 pri
->pname
, signame(pri
, sig
));
4543 s
= rctl_local_flags(pri
, rctlblk_get_local_flags(blk
));
4545 (void) printf("%s\t\t Local flags: 0x%x\n",
4546 pri
->pname
, rctlblk_get_local_flags(blk
));
4548 (void) printf("%s\t\t Local flags: %s\n",
4553 (void) printf("%s\t\t Recipient PID: %d\n",
4555 rctlblk_get_recipient_pid(blk
));
4557 (void) printf("%s\t\t Recipient PID: %ld\n",
4559 rctlblk_get_recipient_pid(blk
));
4561 (void) printf("%s\t\t Firing Time: %lld\n",
4563 rctlblk_get_firing_time(blk
));
4569 show_rctls(private_t
*pri
)
4573 switch (pri
->sys_args
[0]) {
4574 case 0: /* getrctl */
4575 case 1: /* setrctl */
4577 * If these offsets look a little odd, remember that they're
4578 * into the _raw_ system call
4580 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri
->pname
,
4582 if (pri
->sys_args
[2] != 0) {
4583 show_rctlblk(pri
, pri
->sys_args
[2]);
4585 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri
->pname
,
4587 if (pri
->sys_args
[3] != 0) {
4588 show_rctlblk(pri
, pri
->sys_args
[3]);
4591 case 4: /* setprojrctl */
4592 for (entry
= 0; entry
< pri
->sys_args
[4]; entry
++) {
4593 (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4595 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4596 if (RCTLBLK_INC(pri
->sys_args
[3], entry
) != NULL
) {
4598 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4605 show_utimesys(private_t
*pri
)
4607 switch (pri
->sys_args
[0]) {
4608 case 0: /* futimens() */
4609 if (pri
->sys_nargs
> 2)
4610 show_utimens(pri
, (long)pri
->sys_args
[2]);
4612 case 1: /* utimensat */
4613 if (pri
->sys_nargs
> 3)
4614 show_utimens(pri
, (long)pri
->sys_args
[3]);
4616 default: /* unexpected subcode */
4623 show_sockconfig_filter_prop32(private_t
*pri
, long addr
)
4625 struct sockconfig_filter_props32 props
;
4626 const char *s
= NULL
;
4627 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4628 sof_socktuple32_t
*tup
;
4632 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4633 if (Pread_string(Proc
, buf
, sizeof (buf
),
4634 (uintptr_t)props
.sfp_modname
) == -1)
4635 (void) strcpy(buf
, "<?>");
4636 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4637 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4638 props
.sfp_autoattach
? "automatic" : "progammatic");
4639 if (props
.sfp_autoattach
) {
4641 switch (props
.sfp_hint
) {
4642 case SOF_HINT_TOP
: s
= "top"; break;
4643 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4644 case SOF_HINT_BEFORE
:
4645 case SOF_HINT_AFTER
:
4646 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4648 if (Pread_string(Proc
, buf
, sizeof (buf
),
4649 (uintptr_t)props
.sfp_hintarg
) == -1)
4650 (void) strcpy(buf
, "<?>");
4653 (void) printf(", placement: %s %s", s
, buf
);
4656 (void) printf("\n");
4657 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4658 if (props
.sfp_socktuple_cnt
== 0) {
4659 (void) printf("\t\t<empty>\n");
4662 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4663 tup
= my_malloc(sz
, "socket tuple buffer");
4664 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4665 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4667 "\t\tfamily: %d, type: %d, proto: %d\n",
4668 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4669 tup
[i
].sofst_protocol
);
4675 show_sockconfig_filter_prop(private_t
*pri
, long addr
)
4677 struct sockconfig_filter_props props
;
4678 const char *s
= NULL
;
4679 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4680 sof_socktuple_t
*tup
;
4684 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4685 if (Pread_string(Proc
, buf
, sizeof (buf
),
4686 (uintptr_t)props
.sfp_modname
) == -1)
4687 (void) strcpy(buf
, "<?>");
4688 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4689 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4690 props
.sfp_autoattach
? "automatic" : "progammatic");
4691 if (props
.sfp_autoattach
) {
4693 switch (props
.sfp_hint
) {
4694 case SOF_HINT_TOP
: s
= "top"; break;
4695 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4696 case SOF_HINT_BEFORE
:
4697 case SOF_HINT_AFTER
:
4698 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4700 if (Pread_string(Proc
, buf
, sizeof (buf
),
4701 (uintptr_t)props
.sfp_hintarg
) == -1)
4702 (void) strcpy(buf
, "<?>");
4705 (void) printf(", placement: %s", s
);
4708 (void) printf("\n");
4709 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4710 if (props
.sfp_socktuple_cnt
== 0) {
4711 (void) printf("\t\t<empty>\n");
4714 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4715 tup
= my_malloc(sz
, "socket tuple buffer");
4716 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4717 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4719 "\t\tfamily: %d, type: %d, proto: %d\n",
4720 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4721 tup
[i
].sofst_protocol
);
4727 show_sockconfig(private_t
*pri
)
4729 switch (pri
->sys_args
[0]) {
4730 case SOCKCONFIG_ADD_FILTER
:
4732 if (data_model
== PR_MODEL_LP64
)
4733 show_sockconfig_filter_prop(pri
,
4734 (long)pri
->sys_args
[2]);
4736 show_sockconfig_filter_prop32(pri
,
4737 (long)pri
->sys_args
[2]);
4739 show_sockconfig_filter_prop(pri
, (long)pri
->sys_args
[2]);
4748 show_zfs_ioc(private_t
*pri
, long addr
)
4750 static const zfs_share_t zero_share
= {0};
4751 static const dmu_objset_stats_t zero_objstats
= {0};
4752 static const struct drr_begin zero_drrbegin
= {0};
4753 static const zinject_record_t zero_injectrec
= {0};
4754 static const zfs_stat_t zero_zstat
= {0};
4757 if (Pread(Proc
, &zc
, sizeof (zc
), addr
) != sizeof (zc
)) {
4758 (void) printf(" zfs_ioctl read failed\n");
4763 (void) printf(" zc_name=%s\n", zc
.zc_name
);
4765 (void) printf(" zc_value=%s\n", zc
.zc_value
);
4766 if (zc
.zc_string
[0])
4767 (void) printf(" zc_string=%s\n", zc
.zc_string
);
4768 if (zc
.zc_guid
!= 0) {
4769 (void) printf(" zc_guid=%llu\n",
4770 (u_longlong_t
)zc
.zc_guid
);
4772 if (zc
.zc_nvlist_conf_size
) {
4773 (void) printf(" nvlist_conf:\n");
4774 show_packed_nvlist(pri
, zc
.zc_nvlist_conf
,
4775 zc
.zc_nvlist_conf_size
);
4777 if (zc
.zc_nvlist_src_size
) {
4778 (void) printf(" nvlist_src:\n");
4779 show_packed_nvlist(pri
, zc
.zc_nvlist_src
,
4780 zc
.zc_nvlist_src_size
);
4782 if (zc
.zc_nvlist_dst_size
) {
4783 (void) printf(" nvlist_dst:\n");
4784 show_packed_nvlist(pri
, zc
.zc_nvlist_dst
,
4785 zc
.zc_nvlist_dst_size
);
4787 if (zc
.zc_cookie
!= 0) {
4788 (void) printf(" zc_cookie=%llu\n",
4789 (u_longlong_t
)zc
.zc_cookie
);
4791 if (zc
.zc_objset_type
!= 0) {
4792 (void) printf(" zc_objset_type=%llu\n",
4793 (u_longlong_t
)zc
.zc_objset_type
);
4795 if (zc
.zc_perm_action
!= 0) {
4796 (void) printf(" zc_perm_action=%llu\n",
4797 (u_longlong_t
)zc
.zc_perm_action
);
4799 if (zc
.zc_history
!= 0) {
4800 (void) printf(" zc_history=%llu\n",
4801 (u_longlong_t
)zc
.zc_history
);
4803 if (zc
.zc_obj
!= 0) {
4804 (void) printf(" zc_obj=%llu\n",
4805 (u_longlong_t
)zc
.zc_obj
);
4807 if (zc
.zc_iflags
!= 0) {
4808 (void) printf(" zc_obj=0x%llx\n",
4809 (u_longlong_t
)zc
.zc_iflags
);
4812 if (memcmp(&zc
.zc_share
, &zero_share
, sizeof (zc
.zc_share
))) {
4813 zfs_share_t
*z
= &zc
.zc_share
;
4814 (void) printf(" zc_share:\n");
4815 if (z
->z_exportdata
) {
4816 (void) printf("\tz_exportdata=0x%llx\n",
4817 (u_longlong_t
)z
->z_exportdata
);
4819 if (z
->z_sharedata
) {
4820 (void) printf("\tz_sharedata=0x%llx\n",
4821 (u_longlong_t
)z
->z_sharedata
);
4823 if (z
->z_sharetype
) {
4824 (void) printf("\tz_sharetype=%llu\n",
4825 (u_longlong_t
)z
->z_sharetype
);
4827 if (z
->z_sharemax
) {
4828 (void) printf("\tz_sharemax=%llu\n",
4829 (u_longlong_t
)z
->z_sharemax
);
4833 if (memcmp(&zc
.zc_objset_stats
, &zero_objstats
,
4834 sizeof (zc
.zc_objset_stats
))) {
4835 dmu_objset_stats_t
*dds
= &zc
.zc_objset_stats
;
4836 (void) printf(" zc_objset_stats:\n");
4837 if (dds
->dds_num_clones
) {
4838 (void) printf("\tdds_num_clones=%llu\n",
4839 (u_longlong_t
)dds
->dds_num_clones
);
4841 if (dds
->dds_creation_txg
) {
4842 (void) printf("\tdds_creation_txg=%llu\n",
4843 (u_longlong_t
)dds
->dds_creation_txg
);
4845 if (dds
->dds_guid
) {
4846 (void) printf("\tdds_guid=%llu\n",
4847 (u_longlong_t
)dds
->dds_guid
);
4850 (void) printf("\tdds_type=%u\n", dds
->dds_type
);
4851 if (dds
->dds_is_snapshot
) {
4852 (void) printf("\tdds_is_snapshot=%u\n",
4853 dds
->dds_is_snapshot
);
4855 if (dds
->dds_inconsistent
) {
4856 (void) printf("\tdds_inconsitent=%u\n",
4857 dds
->dds_inconsistent
);
4859 if (dds
->dds_origin
[0]) {
4860 (void) printf("\tdds_origin=%s\n", dds
->dds_origin
);
4864 if (memcmp(&zc
.zc_begin_record
, &zero_drrbegin
,
4865 sizeof (zc
.zc_begin_record
))) {
4866 struct drr_begin
*drr
= &zc
.zc_begin_record
.drr_u
.drr_begin
;
4867 (void) printf(" zc_begin_record:\n");
4868 if (drr
->drr_magic
) {
4869 (void) printf("\tdrr_magic=%llu\n",
4870 (u_longlong_t
)drr
->drr_magic
);
4872 if (drr
->drr_versioninfo
) {
4873 (void) printf("\tdrr_versioninfo=%llu\n",
4874 (u_longlong_t
)drr
->drr_versioninfo
);
4876 if (drr
->drr_creation_time
) {
4877 (void) printf("\tdrr_creation_time=%llu\n",
4878 (u_longlong_t
)drr
->drr_creation_time
);
4881 (void) printf("\tdrr_type=%u\n", drr
->drr_type
);
4883 (void) printf("\tdrr_flags=0x%x\n", drr
->drr_flags
);
4884 if (drr
->drr_toguid
) {
4885 (void) printf("\tdrr_toguid=%llu\n",
4886 (u_longlong_t
)drr
->drr_toguid
);
4888 if (drr
->drr_fromguid
) {
4889 (void) printf("\tdrr_fromguid=%llu\n",
4890 (u_longlong_t
)drr
->drr_fromguid
);
4892 if (drr
->drr_toname
[0]) {
4893 (void) printf("\tdrr_toname=%s\n", drr
->drr_toname
);
4897 if (memcmp(&zc
.zc_inject_record
, &zero_injectrec
,
4898 sizeof (zc
.zc_inject_record
))) {
4899 zinject_record_t
*zi
= &zc
.zc_inject_record
;
4900 (void) printf(" zc_inject_record:\n");
4901 if (zi
->zi_objset
) {
4902 (void) printf("\tzi_objset=%llu\n",
4903 (u_longlong_t
)zi
->zi_objset
);
4905 if (zi
->zi_object
) {
4906 (void) printf("\tzi_object=%llu\n",
4907 (u_longlong_t
)zi
->zi_object
);
4910 (void) printf("\tzi_start=%llu\n",
4911 (u_longlong_t
)zi
->zi_start
);
4914 (void) printf("\tzi_end=%llu\n",
4915 (u_longlong_t
)zi
->zi_end
);
4918 (void) printf("\tzi_guid=%llu\n",
4919 (u_longlong_t
)zi
->zi_guid
);
4922 (void) printf("\tzi_level=%lu\n",
4923 (ulong_t
)zi
->zi_level
);
4926 (void) printf("\tzi_error=%lu\n",
4927 (ulong_t
)zi
->zi_error
);
4930 (void) printf("\tzi_type=%llu\n",
4931 (u_longlong_t
)zi
->zi_type
);
4934 (void) printf("\tzi_freq=%lu\n",
4935 (ulong_t
)zi
->zi_freq
);
4937 if (zi
->zi_failfast
) {
4938 (void) printf("\tzi_failfast=%lu\n",
4939 (ulong_t
)zi
->zi_failfast
);
4942 (void) printf("\tzi_func=%s\n", zi
->zi_func
);
4943 if (zi
->zi_iotype
) {
4944 (void) printf("\tzi_iotype=%lu\n",
4945 (ulong_t
)zi
->zi_iotype
);
4947 if (zi
->zi_duration
) {
4948 (void) printf("\tzi_duration=%ld\n",
4949 (long)zi
->zi_duration
);
4952 (void) printf("\tzi_timer=%llu\n",
4953 (u_longlong_t
)zi
->zi_timer
);
4957 if (zc
.zc_defer_destroy
) {
4958 (void) printf(" zc_defer_destroy=%d\n",
4959 (int)zc
.zc_defer_destroy
);
4962 (void) printf(" zc_flags=0x%x\n",
4965 if (zc
.zc_action_handle
) {
4966 (void) printf(" zc_action_handle=%llu\n",
4967 (u_longlong_t
)zc
.zc_action_handle
);
4969 if (zc
.zc_cleanup_fd
>= 0)
4970 (void) printf(" zc_cleanup_fd=%d\n", zc
.zc_cleanup_fd
);
4971 if (zc
.zc_sendobj
) {
4972 (void) printf(" zc_sendobj=%llu\n",
4973 (u_longlong_t
)zc
.zc_sendobj
);
4975 if (zc
.zc_fromobj
) {
4976 (void) printf(" zc_fromobj=%llu\n",
4977 (u_longlong_t
)zc
.zc_fromobj
);
4979 if (zc
.zc_createtxg
) {
4980 (void) printf(" zc_createtxg=%llu\n",
4981 (u_longlong_t
)zc
.zc_createtxg
);
4984 if (memcmp(&zc
.zc_stat
, &zero_zstat
, sizeof (zc
.zc_stat
))) {
4985 zfs_stat_t
*zs
= &zc
.zc_stat
;
4986 (void) printf(" zc_stat:\n");
4988 (void) printf("\tzs_gen=%llu\n",
4989 (u_longlong_t
)zs
->zs_gen
);
4992 (void) printf("\tzs_mode=%llu\n",
4993 (u_longlong_t
)zs
->zs_mode
);
4996 (void) printf("\tzs_links=%llu\n",
4997 (u_longlong_t
)zs
->zs_links
);
4999 if (zs
->zs_ctime
[0]) {
5000 (void) printf("\tzs_ctime[0]=%llu\n",
5001 (u_longlong_t
)zs
->zs_ctime
[0]);
5003 if (zs
->zs_ctime
[1]) {
5004 (void) printf("\tzs_ctime[1]=%llu\n",
5005 (u_longlong_t
)zs
->zs_ctime
[1]);
5010 /* expound verbosely upon syscall arguments */
5013 expound(private_t
*pri
, long r0
, int raw
)
5015 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
5016 int lp64
= (data_model
== PR_MODEL_LP64
);
5017 int what
= Lsp
->pr_what
;
5018 int err
= pri
->Errno
; /* don't display output parameters */
5019 /* for a failed system call */
5021 /* We are a 32-bit truss; we can't grok a 64-bit process */
5025 /* for reporting sleeping system calls */
5026 if (what
== 0 && (Lsp
->pr_flags
& (PR_ASLEEP
|PR_VFORKP
)))
5027 what
= Lsp
->pr_syscall
;
5030 case SYS_gettimeofday
:
5032 show_timeofday(pri
);
5035 if (!err
&& pri
->sys_nargs
> 1)
5036 show_itimerval(pri
, (long)pri
->sys_args
[1],
5040 if (pri
->sys_nargs
> 1)
5041 show_itimerval(pri
, (long)pri
->sys_args
[1],
5043 if (!err
&& pri
->sys_nargs
> 2)
5044 show_itimerval(pri
, (long)pri
->sys_args
[2],
5059 show_utssys(pri
, r0
);
5061 show_utssys32(pri
, r0
);
5063 show_utssys(pri
, r0
);
5067 if (pri
->sys_nargs
>= 3) /* each case must decide for itself */
5068 show_ioctl(pri
, pri
->sys_args
[1],
5069 (long)pri
->sys_args
[2]);
5072 if (!err
&& pri
->sys_nargs
>= 3)
5073 show_stat(pri
, (long)pri
->sys_args
[2]);
5076 if (!err
&& pri
->sys_nargs
>= 3)
5077 show_stat64_32(pri
, (long)pri
->sys_args
[2]);
5082 if (!err
&& pri
->sys_nargs
>= 2)
5083 show_stat(pri
, (long)pri
->sys_args
[1]);
5088 if (!err
&& pri
->sys_nargs
>= 2)
5089 show_stat64_32(pri
, (long)pri
->sys_args
[1]);
5097 show_statvfs32(pri
);
5104 case SYS_fstatvfs64
:
5107 show_statvfs64(pri
);
5126 show_msgsys(pri
, r0
); /* each case must decide for itself */
5129 show_semsys(pri
); /* each case must decide for itself */
5132 show_shmsys(pri
); /* each case must decide for itself */
5135 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5139 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5143 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5147 case SYS_getdents64
:
5148 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5150 show_dents64(pri
, (long)pri
->sys_args
[1], r0
);
5153 show_gp_msg(pri
, what
);
5154 if (pri
->sys_nargs
> 3)
5155 show_hhex_int(pri
, (long)pri
->sys_args
[3], "flags");
5158 show_gp_msg(pri
, what
);
5159 if (pri
->sys_nargs
> 3)
5160 show_hhex_int(pri
, (long)pri
->sys_args
[3], "band");
5161 if (pri
->sys_nargs
> 4)
5162 show_hhex_int(pri
, (long)pri
->sys_args
[4], "flags");
5166 show_gp_msg(pri
, what
);
5172 if (pri
->sys_nargs
> 1 && (r0
= pri
->sys_args
[0]) > 0)
5173 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5176 if (!err
&& pri
->sys_nargs
> 1 && pri
->sys_args
[0] > 0)
5177 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5179 case SYS_sigprocmask
:
5180 if (pri
->sys_nargs
> 1)
5181 show_sigset(pri
, (long)pri
->sys_args
[1], " set");
5182 if (!err
&& pri
->sys_nargs
> 2)
5183 show_sigset(pri
, (long)pri
->sys_args
[2], "oset");
5185 case SYS_sigsuspend
:
5186 case SYS_sigtimedwait
:
5187 if (pri
->sys_nargs
> 0)
5188 show_sigset(pri
, (long)pri
->sys_args
[0], "sigmask");
5189 if (!err
&& pri
->sys_nargs
> 1)
5190 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5191 if (pri
->sys_nargs
> 2)
5192 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5194 case SYS_sigaltstack
:
5195 if (pri
->sys_nargs
> 0)
5196 show_sigaltstack(pri
, (long)pri
->sys_args
[0],
5198 if (!err
&& pri
->sys_nargs
> 1)
5199 show_sigaltstack(pri
, (long)pri
->sys_args
[1],
5203 if (pri
->sys_nargs
> 1)
5204 show_sigaction(pri
, (long)pri
->sys_args
[1],
5206 if (!err
&& pri
->sys_nargs
> 2)
5207 show_sigaction(pri
, (long)pri
->sys_args
[2],
5211 if (pri
->sys_nargs
> 1)
5212 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5215 if (pri
->sys_nargs
> 1)
5216 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5217 if (pri
->sys_nargs
> 2)
5218 show_sigset(pri
, (long)pri
->sys_args
[2], "sigmask");
5220 case SYS_sigpending
:
5221 if (!err
&& pri
->sys_nargs
> 1)
5222 show_sigset(pri
, (long)pri
->sys_args
[1], "sigmask");
5225 if (!err
&& pri
->sys_nargs
> 2)
5226 show_siginfo(pri
, (long)pri
->sys_args
[2]);
5228 case SYS_sigsendsys
:
5229 if (pri
->sys_nargs
> 0)
5230 show_procset(pri
, (long)pri
->sys_args
[0]);
5232 case SYS_priocntlsys
:
5233 if (pri
->sys_nargs
> 1)
5234 show_procset(pri
, (long)pri
->sys_args
[1]);
5237 if (!err
&& pri
->sys_nargs
> 2)
5238 show_bool(pri
, (long)pri
->sys_args
[2],
5239 (pri
->sys_args
[1] + pagesize
- 1) / pagesize
);
5243 if (pri
->sys_nargs
> 2) {
5244 int i
= pri
->sys_args
[0]+1;
5245 int showbuf
= FALSE
;
5246 long nb
= (what
== SYS_readv
)? r0
: 32*1024;
5248 if ((what
== SYS_readv
&& !err
&&
5249 prismember(&readfd
, i
)) ||
5250 (what
== SYS_writev
&&
5251 prismember(&writefd
, i
)))
5253 show_iovec(pri
, (long)pri
->sys_args
[1],
5254 pri
->sys_args
[2], showbuf
, nb
);
5262 if (pri
->sys_nargs
<= 1)
5266 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5268 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5270 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5273 case SYS_getrlimit64
:
5277 case SYS_setrlimit64
:
5278 if (pri
->sys_nargs
<= 1)
5280 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5283 if (!err
&& pri
->sys_nargs
> 0)
5284 show_uname(pri
, (long)pri
->sys_args
[0]);
5287 if (!err
&& pri
->sys_nargs
> 1)
5288 show_adjtime(pri
, (long)pri
->sys_args
[0],
5289 (long)pri
->sys_args
[1]);
5292 if (!err
&& pri
->sys_nargs
> 0)
5293 show_timestruc(pri
, (long)pri
->sys_args
[0], "cpu time");
5296 if (!err
&& pri
->sys_nargs
> 1)
5297 show_int(pri
, (long)pri
->sys_args
[1], "lwpid");
5299 case SYS_lwp_mutex_wakeup
:
5300 case SYS_lwp_mutex_unlock
:
5301 case SYS_lwp_mutex_trylock
:
5302 case SYS_lwp_mutex_register
:
5303 if (pri
->sys_nargs
> 0)
5304 show_mutex(pri
, (long)pri
->sys_args
[0]);
5306 case SYS_lwp_mutex_timedlock
:
5307 if (pri
->sys_nargs
> 0)
5308 show_mutex(pri
, (long)pri
->sys_args
[0]);
5309 if (pri
->sys_nargs
> 1)
5310 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5312 case SYS_lwp_cond_wait
:
5313 if (pri
->sys_nargs
> 0)
5314 show_condvar(pri
, (long)pri
->sys_args
[0]);
5315 if (pri
->sys_nargs
> 1)
5316 show_mutex(pri
, (long)pri
->sys_args
[1]);
5317 if (pri
->sys_nargs
> 2)
5318 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5320 case SYS_lwp_cond_signal
:
5321 case SYS_lwp_cond_broadcast
:
5322 if (pri
->sys_nargs
> 0)
5323 show_condvar(pri
, (long)pri
->sys_args
[0]);
5325 case SYS_lwp_sema_trywait
:
5326 case SYS_lwp_sema_post
:
5327 if (pri
->sys_nargs
> 0)
5328 show_sema(pri
, (long)pri
->sys_args
[0]);
5330 case SYS_lwp_sema_timedwait
:
5331 if (pri
->sys_nargs
> 0)
5332 show_sema(pri
, (long)pri
->sys_args
[0]);
5333 if (pri
->sys_nargs
> 1)
5334 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5336 case SYS_lwp_rwlock_sys
:
5337 if (pri
->sys_nargs
> 1)
5338 show_rwlock(pri
, (long)pri
->sys_args
[1]);
5339 if (pri
->sys_nargs
> 2 &&
5340 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 1))
5341 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5343 case SYS_lwp_create
:
5344 /* XXX print some values in ucontext ??? */
5345 if (!err
&& pri
->sys_nargs
> 2)
5346 show_int(pri
, (long)pri
->sys_args
[2], "lwpid");
5349 if (pri
->sys_args
[0] == AIOWAIT
&& !err
&& pri
->sys_nargs
> 1)
5350 show_timeval(pri
, (long)pri
->sys_args
[1], "timeout");
5353 if (pri
->sys_nargs
> 0)
5354 show_timestruc(pri
, (long)pri
->sys_args
[0], "tmout");
5355 if (pri
->sys_nargs
> 1 && (err
== 0 || err
== EINTR
))
5356 show_timestruc(pri
, (long)pri
->sys_args
[1], "resid");
5359 switch (pri
->sys_args
[0]) {
5360 case PRIVSYS_SETPPRIV
:
5361 case PRIVSYS_GETPPRIV
:
5363 show_privset(pri
, (long)pri
->sys_args
[3],
5364 (size_t)pri
->sys_args
[4], "");
5368 switch (pri
->sys_args
[0]) {
5369 case UCREDSYS_UCREDGET
:
5370 case UCREDSYS_GETPEERUCRED
:
5372 show_ucred(pri
, (long)pri
->sys_args
[2]);
5378 if (pri
->sys_nargs
> 2)
5379 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5380 0, (long)pri
->sys_args
[2]);
5383 if (pri
->sys_nargs
> 5)
5384 show_sockaddr(pri
, "to", (long)pri
->sys_args
[4], 0,
5388 if (!err
&& pri
->sys_nargs
> 2)
5389 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5390 (long)pri
->sys_args
[2], 0);
5392 case SYS_getsockname
:
5393 case SYS_getpeername
:
5394 if (!err
&& pri
->sys_nargs
> 2)
5395 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5396 (long)pri
->sys_args
[2], 0);
5399 if (!err
&& pri
->sys_nargs
> 5)
5400 show_sockaddr(pri
, "from", (long)pri
->sys_args
[4],
5401 (long)pri
->sys_args
[5], 0);
5408 if (pri
->sys_nargs
<= 2)
5412 show_msghdr(pri
, pri
->sys_args
[1]);
5414 show_msghdr32(pri
, pri
->sys_args
[1]);
5416 show_msghdr(pri
, pri
->sys_args
[1]);
5423 if (pri
->sys_nargs
!= 5)
5426 if (pri
->sys_args
[0] == SENDFILEV
) {
5427 show_sendfilevec(pri
, (int)pri
->sys_args
[1],
5428 (sendfilevec_t
*)pri
->sys_args
[2],
5429 (int)pri
->sys_args
[3]);
5430 } else if (pri
->sys_args
[0] == SENDFILEV64
) {
5431 show_sendfilevec64(pri
, (int)pri
->sys_args
[1],
5432 (sendfilevec64_t
*)pri
->sys_args
[2],
5433 (int)pri
->sys_args
[3]);
5441 * subcode 0: lwp_park(timespec_t *, id_t)
5442 * subcode 4: lwp_set_park(timespec_t *, id_t)
5444 if (pri
->sys_nargs
> 1 &&
5445 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 4))
5446 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5447 /* subcode 2: lwp_unpark_all(id_t *, int) */
5448 if (pri
->sys_nargs
> 2 && pri
->sys_args
[0] == 2)
5449 show_ids(pri
, (long)pri
->sys_args
[1],
5450 (int)pri
->sys_args
[2]);
5452 case SYS_ntp_gettime
:
5454 show_ntp_gettime(pri
);
5456 case SYS_ntp_adjtime
:
5458 show_ntp_adjtime(pri
);
5462 if (pri
->sys_args
[0] == _RUSAGESYS_GETRUSAGE
) {
5465 show_getrusage32(pri
->sys_args
[1]);
5468 show_getrusage(pri
->sys_args
[1]);
5483 case SYS_sockconfig
:
5484 show_sockconfig(pri
);