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_SETLK_NBMAND
:
1838 show_flock32(pri
, offset
);
1845 case F_SETLK64_NBMAND
:
1848 case F_OFD_SETLKW64
:
1851 show_flock64(pri
, offset
);
1856 show_share(pri
, offset
);
1862 show_strbuf(private_t
*pri
, long offset
, const char *name
, int dump
)
1864 struct strbuf strbuf
;
1866 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1867 print_strbuf(pri
, &strbuf
, name
, dump
);
1872 show_strbuf32(private_t
*pri
, long offset
, const char *name
, int dump
)
1874 struct strbuf32 strbuf
;
1876 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1877 print_strbuf32(pri
, &strbuf
, name
, dump
);
1882 show_gp_msg(private_t
*pri
, int what
)
1886 int fdp1
= pri
->sys_args
[0] + 1;
1891 if (pri
->Errno
== 0 && prismember(&readfd
, fdp1
))
1896 if (prismember(&writefd
, fdp1
))
1901 /* enter region of lengthy output */
1906 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0) {
1907 if (data_model
== PR_MODEL_LP64
)
1908 show_strbuf(pri
, offset
, "ctl", dump
);
1910 show_strbuf32(pri
, offset
, "ctl", dump
);
1912 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != 0) {
1913 if (data_model
== PR_MODEL_LP64
)
1914 show_strbuf(pri
, offset
, "dat", dump
);
1916 show_strbuf32(pri
, offset
, "dat", dump
);
1919 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != 0)
1920 show_strbuf(pri
, offset
, "ctl", dump
);
1921 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != 0)
1922 show_strbuf(pri
, offset
, "dat", dump
);
1925 /* exit region of lengthy output */
1931 show_int(private_t
*pri
, long offset
, const char *name
)
1936 Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
1937 (void) printf("%s\t%s:\t%d\n",
1944 show_hhex_int(private_t
*pri
, long offset
, const char *name
)
1948 if (Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
1949 (void) printf("%s\t%s:\t0x%.4X\n",
1955 #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \
1956 POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
1959 pollevent(private_t
*pri
, int arg
)
1961 char *str
= pri
->code_buf
;
1965 if (arg
& ~ALL_POLL_FLAGS
) {
1966 (void) sprintf(str
, "0x%-5X", arg
);
1967 return ((const char *)str
);
1972 (void) strcat(str
, "|POLLIN");
1974 (void) strcat(str
, "|POLLPRI");
1976 (void) strcat(str
, "|POLLOUT");
1977 if (arg
& POLLRDNORM
)
1978 (void) strcat(str
, "|POLLRDNORM");
1979 if (arg
& POLLRDBAND
)
1980 (void) strcat(str
, "|POLLRDBAND");
1981 if (arg
& POLLWRBAND
)
1982 (void) strcat(str
, "|POLLWRBAND");
1984 (void) strcat(str
, "|POLLERR");
1986 (void) strcat(str
, "|POLLHUP");
1988 (void) strcat(str
, "|POLLNVAL");
1990 return ((const char *)(str
+1));
1994 show_one_pollfd(private_t
*pri
, struct pollfd
*ppollfd
)
1997 * can't print both events and revents in same printf.
1998 * pollevent() returns a pointer to a TSD location.
2000 (void) printf("%s\tfd=%-2d ev=%s",
2001 pri
->pname
, ppollfd
->fd
, pollevent(pri
, ppollfd
->events
));
2002 (void) printf(" rev=%s\n", pollevent(pri
, ppollfd
->revents
));
2006 show_all_pollfds(private_t
*pri
, long offset
, int nfds
)
2008 struct pollfd pollfd
[2];
2011 for (; nfds
&& !interrupt
; nfds
--, offset
+= sizeof (struct pollfd
)) {
2012 if (Pread(Proc
, &pollfd
[0], sizeof (struct pollfd
), offset
) !=
2013 sizeof (struct pollfd
))
2016 if (skip
>= 0 && pollfd
[0].fd
== pollfd
[1].fd
&&
2017 pollfd
[0].events
== pollfd
[1].events
&&
2018 pollfd
[0].revents
== pollfd
[1].revents
) {
2024 (void) printf("%s\t...last pollfd structure"
2025 " repeated %d time%s...\n",
2026 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2029 show_one_pollfd(pri
, &pollfd
[0]);
2030 pollfd
[1] = pollfd
[0];
2035 "%s\t...last pollfd structure repeated %d time%s...\n",
2036 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2040 show_pollsys(private_t
*pri
)
2046 if (pri
->sys_nargs
< 2)
2049 offset
= pri
->sys_args
[0];
2050 nfds
= pri
->sys_args
[1];
2052 /* enter region of lengthy output */
2053 if (offset
!= 0 && nfds
> 32) {
2058 if (offset
!= 0 && nfds
> 0)
2059 show_all_pollfds(pri
, offset
, nfds
);
2061 if (pri
->sys_nargs
> 2)
2062 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
2064 if (pri
->sys_nargs
> 3)
2065 show_sigset(pri
, (long)pri
->sys_args
[3], "sigmask");
2067 /* exit region of lengthy output */
2073 show_perm64(private_t
*pri
, struct ipc_perm64
*ip
)
2075 (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
2076 "m=0%.6o key=%d projid=%-5d\n",
2082 (int)ip
->ipcx_zoneid
,
2083 (unsigned int)ip
->ipcx_mode
,
2085 (int)ip
->ipcx_projid
);
2089 show_perm(private_t
*pri
, struct ipc_perm
*ip
)
2092 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2105 show_perm32(private_t
*pri
, struct ipc_perm32
*ip
)
2108 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2121 show_msgctl64(private_t
*pri
, long offset
)
2123 struct msqid_ds64 msgq
;
2126 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2127 show_perm64(pri
, &msgq
.msgx_perm
);
2129 (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
2130 "lspid=%-5d lrpid=%-5d\n", pri
->pname
,
2131 (unsigned long long)msgq
.msgx_cbytes
,
2132 (unsigned long long)msgq
.msgx_qnum
,
2133 (unsigned long long)msgq
.msgx_qbytes
,
2134 (int)msgq
.msgx_lspid
,
2135 (int)msgq
.msgx_lrpid
);
2137 prtime(pri
, " st = ", (time_t)msgq
.msgx_stime
);
2138 prtime(pri
, " rt = ", (time_t)msgq
.msgx_rtime
);
2139 prtime(pri
, " ct = ", (time_t)msgq
.msgx_ctime
);
2144 show_msgctl(private_t
*pri
, long offset
)
2146 struct msqid_ds msgq
;
2149 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2150 show_perm(pri
, &msgq
.msg_perm
);
2153 "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2158 (int)msgq
.msg_lspid
,
2159 (int)msgq
.msg_lrpid
);
2161 prtime(pri
, " st = ", msgq
.msg_stime
);
2162 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2163 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2169 show_msgctl32(private_t
*pri
, long offset
)
2171 struct msqid_ds32 msgq
;
2174 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2175 show_perm32(pri
, &msgq
.msg_perm
);
2178 "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2186 prtime(pri
, " st = ", msgq
.msg_stime
);
2187 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2188 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2194 show_msgbuf(private_t
*pri
, long offset
, long msgsz
)
2199 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2200 sizeof (msgb
.mtype
)) {
2201 /* enter region of lengthy output */
2202 if (msgsz
> MYBUFSIZ
/ 4)
2205 (void) printf("%s\tmtype=%lu mtext[]=\n",
2209 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2211 /* exit region of lengthy output */
2212 if (msgsz
> MYBUFSIZ
/ 4)
2219 show_msgbuf32(private_t
*pri
, long offset
, long msgsz
)
2221 struct ipcmsgbuf32 msgb
;
2224 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2225 sizeof (msgb
.mtype
)) {
2226 /* enter region of lengthy output */
2227 if (msgsz
> MYBUFSIZ
/ 4)
2230 (void) printf("%s\tmtype=%u mtext[]=\n",
2234 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2236 /* exit region of lengthy output */
2237 if (msgsz
> MYBUFSIZ
/ 4)
2245 show_msgsys(private_t
*pri
, long msgsz
)
2247 switch (pri
->sys_args
[0]) {
2248 case 0: /* msgget() */
2250 case 1: /* msgctl() */
2251 if (pri
->sys_nargs
> 3) {
2252 switch (pri
->sys_args
[2]) {
2258 if (data_model
== PR_MODEL_LP64
)
2260 (long)pri
->sys_args
[3]);
2263 (long)pri
->sys_args
[3]);
2270 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2275 case 2: /* msgrcv() */
2276 if (!pri
->Errno
&& pri
->sys_nargs
> 2) {
2277 if (data_model
== PR_MODEL_LP64
)
2278 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2280 show_msgbuf32(pri
, pri
->sys_args
[2], msgsz
);
2283 case 3: /* msgsnd() */
2284 if (pri
->sys_nargs
> 3) {
2285 if (data_model
== PR_MODEL_LP64
)
2286 show_msgbuf(pri
, pri
->sys_args
[2],
2289 show_msgbuf32(pri
, pri
->sys_args
[2],
2293 case 4: /* msgids() */
2294 case 5: /* msgsnap() */
2295 default: /* unexpected subcode */
2301 show_msgsys(private_t
*pri
, long msgsz
)
2303 switch (pri
->sys_args
[0]) {
2304 case 0: /* msgget() */
2306 case 1: /* msgctl() */
2307 if (pri
->sys_nargs
> 3) {
2308 switch (pri
->sys_args
[2]) {
2314 show_msgctl(pri
, (long)pri
->sys_args
[3]);
2321 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2326 case 2: /* msgrcv() */
2327 if (!pri
->Errno
&& pri
->sys_nargs
> 2)
2328 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2330 case 3: /* msgsnd() */
2331 if (pri
->sys_nargs
> 3)
2332 show_msgbuf(pri
, pri
->sys_args
[2],
2335 case 4: /* msgids() */
2336 case 5: /* msgsnap() */
2337 default: /* unexpected subcode */
2344 show_semctl64(private_t
*pri
, long offset
)
2346 struct semid_ds64 semds
;
2349 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2350 show_perm64(pri
, &semds
.semx_perm
);
2352 (void) printf("%s\tnsems=%u\n", pri
->pname
, semds
.semx_nsems
);
2354 prtime(pri
, " ot = ", (time_t)semds
.semx_otime
);
2355 prtime(pri
, " ct = ", (time_t)semds
.semx_ctime
);
2360 show_semctl(private_t
*pri
, long offset
)
2362 struct semid_ds semds
;
2365 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2366 show_perm(pri
, &semds
.sem_perm
);
2368 (void) printf("%s\tnsems=%u\n",
2372 prtime(pri
, " ot = ", semds
.sem_otime
);
2373 prtime(pri
, " ct = ", semds
.sem_ctime
);
2379 show_semctl32(private_t
*pri
, long offset
)
2381 struct semid_ds32 semds
;
2384 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2385 show_perm32(pri
, &semds
.sem_perm
);
2387 (void) printf("%s\tnsems=%u\n",
2391 prtime(pri
, " ot = ", semds
.sem_otime
);
2392 prtime(pri
, " ct = ", semds
.sem_ctime
);
2398 show_semop(private_t
*pri
, long offset
, long nsops
, long timeout
)
2400 struct sembuf sembuf
;
2406 if (nsops
> 40) /* let's not be ridiculous */
2409 for (; nsops
> 0 && !interrupt
; --nsops
, offset
+= sizeof (sembuf
)) {
2410 if (Pread(Proc
, &sembuf
, sizeof (sembuf
), offset
) !=
2414 (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2419 if (sembuf
.sem_flg
== 0)
2420 (void) printf("0\n");
2421 else if ((str
= semflags(pri
, sembuf
.sem_flg
)) != NULL
)
2422 (void) printf("%s\n", str
);
2424 (void) printf("0%.6o\n", sembuf
.sem_flg
);
2427 show_timestruc(pri
, timeout
, "timeout");
2431 show_semsys(private_t
*pri
)
2433 switch (pri
->sys_args
[0]) {
2434 case 0: /* semctl() */
2435 if (pri
->sys_nargs
> 4) {
2436 switch (pri
->sys_args
[3]) {
2443 if (data_model
== PR_MODEL_LP64
)
2445 (long)pri
->sys_args
[4]);
2448 (long)pri
->sys_args
[4]);
2450 show_semctl(pri
, (long)pri
->sys_args
[4]);
2458 show_semctl64(pri
, (long)pri
->sys_args
[4]);
2463 case 1: /* semget() */
2465 case 2: /* semop() */
2466 if (pri
->sys_nargs
> 3)
2467 show_semop(pri
, (long)pri
->sys_args
[2],
2468 pri
->sys_args
[3], 0);
2470 case 3: /* semids() */
2472 case 4: /* semtimedop() */
2473 if (pri
->sys_nargs
> 4)
2474 show_semop(pri
, (long)pri
->sys_args
[2],
2475 pri
->sys_args
[3], pri
->sys_args
[4]);
2477 default: /* unexpected subcode */
2483 show_shmctl64(private_t
*pri
, long offset
)
2485 struct shmid_ds64 shmds
;
2488 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2489 show_perm64(pri
, &shmds
.shmx_perm
);
2492 "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
2494 (unsigned long long)shmds
.shmx_segsz
,
2495 (int)shmds
.shmx_lpid
,
2496 (int)shmds
.shmx_cpid
,
2497 (unsigned long long)shmds
.shmx_nattch
,
2498 (unsigned long long)shmds
.shmx_cnattch
);
2500 prtime(pri
, " at = ", (time_t)shmds
.shmx_atime
);
2501 prtime(pri
, " dt = ", (time_t)shmds
.shmx_dtime
);
2502 prtime(pri
, " ct = ", (time_t)shmds
.shmx_ctime
);
2507 show_shmctl(private_t
*pri
, long offset
)
2509 struct shmid_ds shmds
;
2512 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2513 show_perm(pri
, &shmds
.shm_perm
);
2516 "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2518 (ulong_t
)shmds
.shm_segsz
,
2519 (int)shmds
.shm_lpid
,
2520 (int)shmds
.shm_cpid
,
2524 prtime(pri
, " at = ", shmds
.shm_atime
);
2525 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2526 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2532 show_shmctl32(private_t
*pri
, long offset
)
2534 struct shmid_ds32 shmds
;
2537 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2538 show_perm32(pri
, &shmds
.shm_perm
);
2541 "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2549 prtime(pri
, " at = ", shmds
.shm_atime
);
2550 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2551 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2557 show_shmsys(private_t
*pri
)
2559 switch (pri
->sys_args
[0]) {
2560 case 0: /* shmat() */
2562 case 1: /* shmctl() */
2563 if (pri
->sys_nargs
> 3) {
2564 switch (pri
->sys_args
[2]) {
2571 if (data_model
== PR_MODEL_LP64
)
2573 (long)pri
->sys_args
[3]);
2576 (long)pri
->sys_args
[3]);
2578 show_shmctl(pri
, (long)pri
->sys_args
[3]);
2586 show_shmctl64(pri
, (long)pri
->sys_args
[3]);
2591 case 2: /* shmdt() */
2592 case 3: /* shmget() */
2593 case 4: /* shmids() */
2594 default: /* unexpected subcode */
2600 show_groups(private_t
*pri
, long offset
, long count
)
2607 if (count
> 0 && offset
!= 0 &&
2608 Pread(Proc
, &groups
[0], count
*sizeof (int), offset
) ==
2609 count
*sizeof (int)) {
2612 (void) printf("%s\t", pri
->pname
);
2613 for (n
= 0; !interrupt
&& n
< count
; n
++) {
2614 if (n
!= 0 && n
%10 == 0)
2615 (void) printf("\n%s\t", pri
->pname
);
2616 (void) printf(" %5d", groups
[n
]);
2618 (void) fputc('\n', stdout
);
2623 * This assumes that a sigset_t is simply an array of ints.
2626 sigset_string(private_t
*pri
, sigset_t
*sp
)
2628 char *s
= pri
->code_buf
;
2629 int n
= sizeof (*sp
) / sizeof (int32_t);
2630 int32_t *lp
= (int32_t *)sp
;
2633 int32_t val
= *lp
++;
2636 s
+= sprintf(s
, " 0");
2638 s
+= sprintf(s
, " 0x%.8X", val
);
2641 return (pri
->code_buf
);
2645 show_sigset(private_t
*pri
, long offset
, const char *name
)
2650 Pread(Proc
, &sigset
, sizeof (sigset
), offset
) == sizeof (sigset
)) {
2651 (void) printf("%s\t%s =%s\n",
2652 pri
->pname
, name
, sigset_string(pri
, &sigset
));
2658 show_sigaltstack32(private_t
*pri
, long offset
, const char *name
)
2660 struct sigaltstack32 altstack
;
2663 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2664 sizeof (altstack
)) {
2665 (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2676 show_sigaltstack(private_t
*pri
, long offset
, const char *name
)
2678 struct sigaltstack altstack
;
2681 if (data_model
!= PR_MODEL_LP64
) {
2682 show_sigaltstack32(pri
, offset
, name
);
2687 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2688 sizeof (altstack
)) {
2689 (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2692 (ulong_t
)altstack
.ss_sp
,
2693 (ulong_t
)altstack
.ss_size
,
2700 show_sigaction32(private_t
*pri
, long offset
, const char *name
, long odisp
)
2702 struct sigaction32 sigaction
;
2705 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2706 sizeof (sigaction
)) {
2707 /* This is stupid, we shouldn't have to do this */
2709 sigaction
.sa_handler
= (caddr32_t
)odisp
;
2711 "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2714 sigaction
.sa_handler
,
2715 sigset_string(pri
, (sigset_t
*)&sigaction
.sa_mask
),
2716 sigaction
.sa_flags
);
2722 show_sigaction(private_t
*pri
, long offset
, const char *name
, long odisp
)
2724 struct sigaction sigaction
;
2727 if (data_model
!= PR_MODEL_LP64
) {
2728 show_sigaction32(pri
, offset
, name
, odisp
);
2733 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2734 sizeof (sigaction
)) {
2735 /* This is stupid, we shouldn't have to do this */
2737 sigaction
.sa_handler
= (void (*)())odisp
;
2739 "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2742 (long)sigaction
.sa_handler
,
2743 sigset_string(pri
, &sigaction
.sa_mask
),
2744 sigaction
.sa_flags
);
2750 print_siginfo32(private_t
*pri
, const siginfo32_t
*sip
)
2752 const char *code
= NULL
;
2754 (void) printf("%s siginfo: %s", pri
->pname
,
2755 signame(pri
, sip
->si_signo
));
2757 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2758 (void) printf(" pid=%d uid=%d", sip
->si_pid
, sip
->si_uid
);
2759 if (sip
->si_code
!= 0)
2760 (void) printf(" code=%d", sip
->si_code
);
2761 (void) fputc('\n', stdout
);
2765 switch (sip
->si_signo
) {
2767 (void) fputc('\n', stdout
);
2781 switch (sip
->si_signo
) {
2783 switch (sip
->si_code
) {
2784 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2785 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2786 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2787 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2788 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2789 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2790 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2791 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2795 switch (sip
->si_code
) {
2796 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2797 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2798 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2799 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2800 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2801 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2805 switch (sip
->si_code
) {
2806 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2807 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2808 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2809 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2810 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2811 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2812 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2813 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2814 #if defined(FPE_FLTDEN)
2815 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2820 switch (sip
->si_code
) {
2821 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2822 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2826 switch (sip
->si_code
) {
2828 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2830 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2834 switch (sip
->si_code
) {
2835 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2836 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2837 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2841 switch (sip
->si_code
) {
2842 case CLD_EXITED
: code
= "CLD_EXITED"; break;
2843 case CLD_KILLED
: code
= "CLD_KILLED"; break;
2844 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
2845 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
2846 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
2847 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
2851 switch (sip
->si_code
) {
2852 case POLL_IN
: code
= "POLL_IN"; break;
2853 case POLL_OUT
: code
= "POLL_OUT"; break;
2854 case POLL_MSG
: code
= "POLL_MSG"; break;
2855 case POLL_ERR
: code
= "POLL_ERR"; break;
2856 case POLL_PRI
: code
= "POLL_PRI"; break;
2857 case POLL_HUP
: code
= "POLL_HUP"; break;
2863 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
2864 code
= (const char *)pri
->code_buf
;
2867 switch (sip
->si_signo
) {
2874 (void) printf(" %s addr=0x%.8X",
2879 (void) printf(" %s pid=%d status=0x%.4X",
2886 (void) printf(" %s fd=%d band=%d",
2893 if (sip
->si_errno
!= 0) {
2894 const char *ename
= errname(sip
->si_errno
);
2896 (void) printf(" errno=%d", sip
->si_errno
);
2898 (void) printf("(%s)", ename
);
2901 (void) fputc('\n', stdout
);
2906 print_siginfo(private_t
*pri
, const siginfo_t
*sip
)
2908 const char *code
= NULL
;
2910 (void) printf("%s siginfo: %s", pri
->pname
,
2911 signame(pri
, sip
->si_signo
));
2913 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2914 (void) printf(" pid=%d uid=%u",
2917 if (sip
->si_code
!= 0)
2918 (void) printf(" code=%d", sip
->si_code
);
2919 (void) fputc('\n', stdout
);
2923 switch (sip
->si_signo
) {
2925 (void) fputc('\n', stdout
);
2939 switch (sip
->si_signo
) {
2941 switch (sip
->si_code
) {
2942 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2943 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2944 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2945 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2946 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2947 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2948 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2949 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2953 switch (sip
->si_code
) {
2954 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2955 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2956 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2957 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2958 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2959 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2963 switch (sip
->si_code
) {
2964 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2965 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2966 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2967 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2968 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2969 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2970 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2971 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2972 #if defined(FPE_FLTDEN)
2973 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2978 switch (sip
->si_code
) {
2979 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2980 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2984 switch (sip
->si_code
) {
2986 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2988 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2992 switch (sip
->si_code
) {
2993 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2994 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2995 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2999 switch (sip
->si_code
) {
3000 case CLD_EXITED
: code
= "CLD_EXITED"; break;
3001 case CLD_KILLED
: code
= "CLD_KILLED"; break;
3002 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
3003 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
3004 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
3005 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
3009 switch (sip
->si_code
) {
3010 case POLL_IN
: code
= "POLL_IN"; break;
3011 case POLL_OUT
: code
= "POLL_OUT"; break;
3012 case POLL_MSG
: code
= "POLL_MSG"; break;
3013 case POLL_ERR
: code
= "POLL_ERR"; break;
3014 case POLL_PRI
: code
= "POLL_PRI"; break;
3015 case POLL_HUP
: code
= "POLL_HUP"; break;
3021 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
3022 code
= (const char *)pri
->code_buf
;
3025 switch (sip
->si_signo
) {
3032 (void) printf(" %s addr=0x%.8lX",
3034 (long)sip
->si_addr
);
3037 (void) printf(" %s pid=%d status=0x%.4X",
3044 (void) printf(" %s fd=%d band=%ld",
3051 if (sip
->si_errno
!= 0) {
3052 const char *ename
= errname(sip
->si_errno
);
3054 (void) printf(" errno=%d", sip
->si_errno
);
3056 (void) printf("(%s)", ename
);
3059 (void) fputc('\n', stdout
);
3064 show_siginfo32(private_t
*pri
, long offset
)
3066 struct siginfo32 siginfo
;
3069 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3070 print_siginfo32(pri
, &siginfo
);
3075 show_siginfo(private_t
*pri
, long offset
)
3077 struct siginfo siginfo
;
3080 if (data_model
!= PR_MODEL_LP64
) {
3081 show_siginfo32(pri
, offset
);
3086 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3087 print_siginfo(pri
, &siginfo
);
3091 show_bool(private_t
*pri
, long offset
, int count
)
3093 int serial
= (count
> MYBUFSIZ
/ 4);
3095 /* enter region of lengthy output */
3101 int nb
= (count
< 32)? count
: 32;
3104 if (Pread(Proc
, buf
, (size_t)nb
, offset
) != nb
)
3107 (void) printf("%s ", pri
->pname
);
3108 for (i
= 0; i
< nb
; i
++)
3109 (void) printf(" %d", buf
[i
]);
3110 (void) fputc('\n', stdout
);
3116 /* exit region of lengthy output */
3123 show_iovec32(private_t
*pri
, long offset
, int niov
, int showbuf
, long count
)
3125 iovec32_t iovec
[16];
3128 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3130 if (niov
> 16) /* is this the real limit? */
3133 if (offset
!= 0 && niov
> 0 &&
3134 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec32_t
), offset
)
3135 == niov
*sizeof (iovec32_t
)) {
3136 /* enter region of lengthy output */
3140 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3141 (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n",
3145 if ((nb
= count
) > 0) {
3146 if (nb
> ip
->iov_len
)
3151 if (showbuf
&& nb
> 0)
3152 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3155 /* exit region of lengthy output */
3163 show_iovec(private_t
*pri
, long offset
, long niov
, int showbuf
, long count
)
3168 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3171 if (data_model
!= PR_MODEL_LP64
) {
3172 show_iovec32(pri
, offset
, niov
, showbuf
, count
);
3176 if (niov
> 16) /* is this the real limit? */
3179 if (offset
!= 0 && niov
> 0 &&
3180 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec_t
), offset
)
3181 == niov
*sizeof (iovec_t
)) {
3182 /* enter region of lengthy output */
3186 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3187 (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n",
3191 if ((nb
= count
) > 0) {
3192 if (nb
> ip
->iov_len
)
3197 if (showbuf
&& nb
> 0)
3198 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3201 /* exit region of lengthy output */
3208 show_dents32(private_t
*pri
, long offset
, long count
)
3210 long buf
[MYBUFSIZ
/ sizeof (long)];
3211 struct dirent32
*dp
;
3212 int serial
= (count
> 100);
3217 /* enter region of lengthy output */
3221 while (count
> 0 && !interrupt
) {
3222 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3224 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3227 dp
= (struct dirent32
*)&buf
[0];
3228 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3230 if ((unsigned)nb
< dp
->d_reclen
) {
3231 /* getdents() error? */
3233 "%s ino=%-5u off=%-4d rlen=%-3d\n",
3241 while (!interrupt
&&
3242 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3243 (unsigned)nb
>= dp
->d_reclen
) {
3245 "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3250 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3253 count
-= dp
->d_reclen
;
3254 offset
+= dp
->d_reclen
;
3255 /* LINTED improper alignment */
3256 dp
= (struct dirent32
*)((char *)dp
+ dp
->d_reclen
);
3260 /* exit region of lengthy output */
3266 show_dents64(private_t
*pri
, long offset
, long count
)
3268 long long buf
[MYBUFSIZ
/ sizeof (long long)];
3269 struct dirent64
*dp
;
3270 int serial
= (count
> 100);
3275 /* enter region of lengthy output */
3279 while (count
> 0 && !interrupt
) {
3280 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3282 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3285 dp
= (struct dirent64
*)&buf
[0];
3286 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3288 if ((unsigned)nb
< dp
->d_reclen
) {
3289 /* getdents() error? */
3291 "%s ino=%-5llu off=%-4lld rlen=%-3d\n",
3293 (long long)dp
->d_ino
,
3294 (long long)dp
->d_off
,
3299 while (!interrupt
&&
3300 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3301 (unsigned)nb
>= dp
->d_reclen
) {
3303 "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3305 (long long)dp
->d_ino
,
3306 (long long)dp
->d_off
,
3308 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3311 count
-= dp
->d_reclen
;
3312 offset
+= dp
->d_reclen
;
3313 /* LINTED improper alignment */
3314 dp
= (struct dirent64
*)((char *)dp
+ dp
->d_reclen
);
3318 /* exit region of lengthy output */
3324 show_rlimit32(private_t
*pri
, long offset
)
3326 struct rlimit32 rlimit
;
3329 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3330 (void) printf("%s\t", pri
->pname
);
3331 switch (rlimit
.rlim_cur
) {
3332 case RLIM32_INFINITY
:
3333 (void) fputs("cur = RLIM_INFINITY", stdout
);
3335 case RLIM32_SAVED_MAX
:
3336 (void) fputs("cur = RLIM_SAVED_MAX", stdout
);
3338 case RLIM32_SAVED_CUR
:
3339 (void) fputs("cur = RLIM_SAVED_CUR", stdout
);
3342 (void) printf("cur = %lu", (long)rlimit
.rlim_cur
);
3345 switch (rlimit
.rlim_max
) {
3346 case RLIM32_INFINITY
:
3347 (void) fputs(" max = RLIM_INFINITY\n", stdout
);
3349 case RLIM32_SAVED_MAX
:
3350 (void) fputs(" max = RLIM_SAVED_MAX\n", stdout
);
3352 case RLIM32_SAVED_CUR
:
3353 (void) fputs(" max = RLIM_SAVED_CUR\n", stdout
);
3356 (void) printf(" max = %lu\n", (long)rlimit
.rlim_max
);
3363 show_rlimit64(private_t
*pri
, long offset
)
3365 struct rlimit64 rlimit
;
3368 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3369 (void) printf("%s\t", pri
->pname
);
3370 switch (rlimit
.rlim_cur
) {
3371 case RLIM64_INFINITY
:
3372 (void) fputs("cur = RLIM64_INFINITY", stdout
);
3374 case RLIM64_SAVED_MAX
:
3375 (void) fputs("cur = RLIM64_SAVED_MAX", stdout
);
3377 case RLIM64_SAVED_CUR
:
3378 (void) fputs("cur = RLIM64_SAVED_CUR", stdout
);
3381 (void) printf("cur = %llu",
3382 (unsigned long long)rlimit
.rlim_cur
);
3385 switch (rlimit
.rlim_max
) {
3386 case RLIM64_INFINITY
:
3387 (void) fputs(" max = RLIM64_INFINITY\n", stdout
);
3389 case RLIM64_SAVED_MAX
:
3390 (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout
);
3392 case RLIM64_SAVED_CUR
:
3393 (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout
);
3396 (void) printf(" max = %llu\n",
3397 (unsigned long long)rlimit
.rlim_max
);
3404 show_uname(private_t
*pri
, long offset
)
3406 struct utsname ubuf
;
3409 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
3411 "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3422 show_adjtime(private_t
*pri
, long off1
, long off2
)
3424 show_timeval(pri
, off1
, " delta");
3425 show_timeval(pri
, off2
, "olddelta");
3429 show_sockaddr(private_t
*pri
,
3430 const char *str
, long addroff
, long lenoff
, long len
)
3433 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
3434 * also large enough to store a sockaddr_in or a sockaddr_in6.
3436 long buf
[(sizeof (short) + PATH_MAX
+ sizeof (long) - 1)
3438 struct sockaddr
*sa
= (struct sockaddr
*)buf
;
3439 struct sockaddr_in
*sin
= (struct sockaddr_in
*)buf
;
3440 struct sockaddr_un
*soun
= (struct sockaddr_un
*)buf
;
3441 struct sockaddr_in6
*sin6
= (struct sockaddr_in6
*)buf
;
3442 char addrbuf
[INET6_ADDRSTRLEN
];
3446 if (Pread(Proc
, &ilen
, sizeof (ilen
), lenoff
) != sizeof (ilen
))
3451 if (len
>= sizeof (buf
)) /* protect against ridiculous length */
3452 len
= sizeof (buf
) - 1;
3453 if (Pread(Proc
, buf
, len
, addroff
) != len
)
3456 switch (sa
->sa_family
) {
3458 (void) printf("%s\tAF_INET6 %s = %s port = %u\n",
3460 inet_ntop(AF_INET6
, &sin6
->sin6_addr
, addrbuf
,
3462 ntohs(sin6
->sin6_port
));
3463 (void) printf("%s\tscope id = %u source id = 0x%x\n"
3464 "%s\tflow class = 0x%02x flow label = 0x%05x\n",
3465 pri
->pname
, ntohl(sin6
->sin6_scope_id
),
3466 ntohl(sin6
->__sin6_src_id
),
3468 ntohl((sin6
->sin6_flowinfo
& IPV6_FLOWINFO_TCLASS
) >> 20),
3469 ntohl(sin6
->sin6_flowinfo
& IPV6_FLOWINFO_FLOWLABEL
));
3472 (void) printf("%s\tAF_%s %s = %s port = %u\n",
3474 str
, inet_ntop(AF_INET
, &sin
->sin_addr
, addrbuf
,
3475 sizeof (addrbuf
)), ntohs(sin
->sin_port
));
3478 len
-= sizeof (soun
->sun_family
);
3480 /* Null terminate */
3481 soun
->sun_path
[len
] = '\0';
3482 (void) printf("%s\tAF_UNIX %s = %s\n", pri
->pname
,
3483 str
, soun
->sun_path
);
3490 show_msghdr(private_t
*pri
, long offset
)
3492 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3493 int what
= Lsp
->pr_what
;
3494 int err
= pri
->Errno
;
3496 int showbuf
= FALSE
;
3497 int i
= pri
->sys_args
[0]+1;
3498 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3500 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3503 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3504 show_sockaddr(pri
, "msg_name",
3505 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3508 * Print the iovec if the syscall was successful and the fd is
3509 * part of the set being traced.
3511 if ((what
== SYS_recvmsg
&& !err
&&
3512 prismember(&readfd
, i
)) ||
3513 (what
== SYS_sendmsg
&&
3514 prismember(&writefd
, i
)))
3517 show_iovec(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3523 show_msghdr32(private_t
*pri
, long offset
)
3527 uint32_t msg_namelen
;
3531 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3532 int what
= Lsp
->pr_what
;
3533 int err
= pri
->Errno
;
3534 int showbuf
= FALSE
;
3535 int i
= pri
->sys_args
[0]+1;
3536 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3538 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3541 if (msg
.msg_name
!= 0 && msg
.msg_namelen
!= 0)
3542 show_sockaddr(pri
, "msg_name",
3543 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3545 * Print the iovec if the syscall was successful and the fd is
3546 * part of the set being traced.
3548 if ((what
== SYS_recvmsg
&& !err
&&
3549 prismember(&readfd
, i
)) ||
3550 (what
== SYS_sendmsg
&&
3551 prismember(&writefd
, i
)))
3554 show_iovec32(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3560 show_doorargs(private_t
*pri
, long offset
)
3564 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3565 (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
3567 (ulong_t
)args
.data_ptr
,
3568 (ulong_t
)args
.data_size
);
3569 (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
3571 (ulong_t
)args
.desc_ptr
,
3573 (void) printf("%s\trbuf=0x%lX rsize=%lu\n",
3576 (ulong_t
)args
.rsize
);
3581 show_ucred_privsets(private_t
*pri
, ucred_t
*uc
)
3584 const priv_set_t
*s
;
3588 while ((sn
= priv_getsetbynum(i
++)) != NULL
) {
3589 s
= ucred_getprivset(uc
, sn
);
3594 (void) printf("%s\t%c: %s\n",
3597 str
= priv_set_to_str(s
, ',', PRIV_STR_SHORT
));
3604 show_ucred(private_t
*pri
, long offset
)
3606 ucred_t
*uc
= _ucred_alloc();
3612 sz
= Pread(Proc
, uc
, uc
->uc_size
, offset
);
3615 * A new uc_size is read, it could be smaller than the previously
3616 * value. We accept short reads that fill the whole header.
3618 if (sz
>= sizeof (ucred_t
) && sz
>= uc
->uc_size
) {
3619 (void) printf("%s\teuid=%u egid=%u\n",
3623 (void) printf("%s\truid=%u rgid=%u\n",
3627 (void) printf("%s\tpid=%d zoneid=%d\n",
3629 (int)ucred_getpid(uc
),
3630 (int)ucred_getzoneid(uc
));
3631 show_ucred_privsets(pri
, uc
);
3637 show_privset(private_t
*pri
, long offset
, size_t size
, char *label
)
3639 priv_set_t
*tmp
= priv_allocset();
3645 sz
= Pread(Proc
, tmp
, size
, offset
);
3648 char *str
= priv_set_to_str(tmp
, ',', PRIV_STR_SHORT
);
3650 (void) printf("%s\t%s%s\n", pri
->pname
, label
, str
);
3658 show_doorinfo(private_t
*pri
, long offset
)
3663 if (Pread(Proc
, &info
, sizeof (info
), offset
) != sizeof (info
))
3665 (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
3667 (int)info
.di_target
,
3670 attr
= info
.di_attributes
;
3671 (void) printf("%s\tattributes=%s\n", pri
->pname
, door_flags(pri
, attr
));
3672 (void) printf("%s\tuniquifier=%llu\n", pri
->pname
, info
.di_uniquifier
);
3676 show_doorparam(private_t
*pri
, long offset
)
3680 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3681 (void) printf("%s\tvalue=%lu\n",
3690 show_doorargs32(private_t
*pri
, long offset
)
3692 struct door_arg32 args
;
3694 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3695 (void) printf("%s\tdata_ptr=%X data_size=%u\n",
3699 (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
3703 (void) printf("%s\trbuf=0x%X rsize=%u\n",
3711 show_doorparam32(private_t
*pri
, long offset
)
3715 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3716 (void) printf("%s\tvalue=%u\n",
3725 show_doors(private_t
*pri
)
3727 switch (pri
->sys_args
[5]) {
3730 if (data_model
== PR_MODEL_LP64
)
3731 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3733 show_doorargs32(pri
, (long)pri
->sys_args
[1]);
3735 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3740 show_ucred(pri
, (long)pri
->sys_args
[0]);
3744 show_doorinfo(pri
, (long)pri
->sys_args
[1]);
3749 if (data_model
== PR_MODEL_LP64
)
3750 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3752 show_doorparam32(pri
, (long)pri
->sys_args
[2]);
3754 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3762 show_portargs(private_t
*pri
, long offset
)
3766 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3767 (void) printf("%s\tevents=0x%x source=%u\n",
3770 args
.portev_source
);
3771 (void) printf("%s\tobject=0x%p user=0x%p\n",
3773 (void *)args
.portev_object
,
3774 (void *)args
.portev_user
);
3782 show_portargs32(private_t
*pri
, long offset
)
3784 port_event32_t args
;
3786 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3787 (void) printf("%s\tevents=0x%x source=%u\n",
3790 args
.portev_source
);
3791 (void) printf("%s\tobject=0x%x user=0x%x\n",
3801 show_ports(private_t
*pri
)
3803 switch (pri
->sys_args
[0]) {
3806 if (data_model
== PR_MODEL_LP64
)
3807 show_portargs(pri
, (long)pri
->sys_args
[2]);
3809 show_portargs32(pri
, (long)pri
->sys_args
[2]);
3811 show_portargs(pri
, (long)pri
->sys_args
[2]);
3817 #define MAX_SNDFL_PRD 16
3822 show_ksendfilevec32(private_t
*pri
, int fd
,
3823 ksendfilevec32_t
*sndvec
, int sfvcnt
)
3825 ksendfilevec32_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3829 while (sfvcnt
> 0) {
3830 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3832 cpy_rqst
*= sizeof (snd
[0]);
3834 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3841 "sfv_fd=%d\tsfv_flag=0x%x\t"
3842 "sfv_off=%d\tsfv_len=%u\n",
3848 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3849 prismember(&writefd
, fd
)) {
3851 (long)snd_ptr
->sfv_off
& 0xffffffff,
3852 (long)snd_ptr
->sfv_len
);
3855 cpy_rqst
-= sizeof (snd
[0]);
3859 sndvec
+= MAX_SNDFL_PRD
;
3865 show_ksendfilevec64(private_t
*pri
, int fd
,
3866 ksendfilevec64_t
*sndvec
, int sfvcnt
)
3868 ksendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3872 while (sfvcnt
> 0) {
3873 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3875 cpy_rqst
*= sizeof (snd
[0]);
3877 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3884 "sfv_fd=%d\tsfv_flag=0x%x\t"
3885 "sfv_off=%ld\tsfv_len=%u\n",
3891 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3892 prismember(&writefd
, fd
)) {
3894 (long)snd_ptr
->sfv_off
& 0xffffffff,
3895 (long)snd_ptr
->sfv_len
);
3898 cpy_rqst
-= sizeof (snd
[0]);
3902 sndvec
+= MAX_SNDFL_PRD
;
3911 show_sendfilevec(private_t
*pri
, int fd
, sendfilevec_t
*sndvec
, int sfvcnt
)
3913 sendfilevec_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3917 if (data_model
!= PR_MODEL_LP64
) {
3918 show_ksendfilevec32(pri
, fd
,
3919 (ksendfilevec32_t
*)sndvec
, sfvcnt
);
3924 while (sfvcnt
> 0) {
3925 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3927 cpy_rqst
*= sizeof (snd
[0]);
3929 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3936 "sfv_fd=%d\tsfv_flag=0x%x\t"
3937 "sfv_off=%ld\tsfv_len=%lu\n",
3941 (ulong_t
)snd_ptr
->sfv_len
);
3943 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3944 prismember(&writefd
, fd
)) {
3945 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
3946 (long)snd_ptr
->sfv_len
);
3949 cpy_rqst
-= sizeof (snd
[0]);
3953 sndvec
+= MAX_SNDFL_PRD
;
3960 show_sendfilevec64(private_t
*pri
, int fd
, sendfilevec64_t
*sndvec
, int sfvcnt
)
3962 sendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3966 if (data_model
!= PR_MODEL_LP64
) {
3967 show_ksendfilevec64(pri
, fd
,
3968 (ksendfilevec64_t
*)sndvec
, sfvcnt
);
3974 while (sfvcnt
> 0) {
3975 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3977 cpy_rqst
*= sizeof (snd
[0]);
3979 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3987 "sfv_fd=%d\tsfv_flag=0x%x\t"
3988 "sfv_off=%ld\tsfv_len=%lu\n",
3990 "sfv_fd=%d\tsfv_flag=0x%x\t"
3991 "sfv_off=%lld\tsfv_len=%lu\n",
3996 (ulong_t
)snd_ptr
->sfv_len
);
3998 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3999 prismember(&writefd
, fd
)) {
4000 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
4001 (long)snd_ptr
->sfv_len
);
4004 cpy_rqst
-= sizeof (snd
[0]);
4008 sndvec
+= MAX_SNDFL_PRD
;
4014 show_memcntl_mha(private_t
*pri
, long offset
)
4016 struct memcntl_mha mha
;
4017 const char *s
= NULL
;
4019 if (Pread(Proc
, &mha
, sizeof (mha
), offset
) == sizeof (mha
)) {
4020 switch (mha
.mha_cmd
) {
4021 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4022 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4023 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4026 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4027 " mha_pagesize=%lu\n",
4028 pri
->pname
, s
, mha
.mha_flags
,
4029 (ulong_t
)mha
.mha_pagesize
);
4031 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4032 " mha_pagesize=%lu\n",
4033 pri
->pname
, mha
.mha_cmd
, mha
.mha_flags
,
4034 (ulong_t
)mha
.mha_pagesize
);
4041 show_memcntl_mha32(private_t
*pri
, long offset
)
4043 struct memcntl_mha32 mha32
;
4044 const char *s
= NULL
;
4046 if (Pread(Proc
, &mha32
, sizeof (mha32
), offset
) ==
4048 switch (mha32
.mha_cmd
) {
4049 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4050 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4051 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4054 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4055 " mha_pagesize=%u\n",
4056 pri
->pname
, s
, mha32
.mha_flags
, mha32
.mha_pagesize
);
4058 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4059 " mha_pagesize=%u\n",
4060 pri
->pname
, mha32
.mha_cmd
, mha32
.mha_flags
,
4061 mha32
.mha_pagesize
);
4068 show_memcntl(private_t
*pri
)
4071 if ((int)pri
->sys_args
[2] != MC_HAT_ADVISE
)
4074 if (data_model
== PR_MODEL_LP64
)
4075 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4077 show_memcntl_mha32(pri
, (long)pri
->sys_args
[3]);
4079 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4084 show_ids(private_t
*pri
, long offset
, int count
)
4086 id_t buf
[MYBUFSIZ
/ sizeof (id_t
)];
4088 int serial
= (count
> MYBUFSIZ
/ 48);
4093 /* enter region of lengthy output */
4097 while (count
> 0 && !interrupt
) {
4098 ssize_t nb
= (count
* sizeof (id_t
) < MYBUFSIZ
)?
4099 count
* sizeof (id_t
) : MYBUFSIZ
;
4101 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) < 0 ||
4106 while (!interrupt
&& nb
>= sizeof (id_t
)) {
4107 (void) printf("%s\t%8d\n", pri
->pname
, (int)*idp
);
4108 offset
+= sizeof (id_t
);
4109 nb
-= sizeof (id_t
);
4115 /* exit region of lengthy output */
4121 show_ntp_gettime(private_t
*pri
)
4123 struct ntptimeval ntv
;
4126 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
4129 if (data_model
== PR_MODEL_NATIVE
) {
4130 if (Pread(Proc
, &ntv
, sizeof (ntv
), offset
)
4134 struct ntptimeval32 ntv32
;
4136 if (Pread(Proc
, &ntv32
, sizeof (ntv32
), offset
)
4140 TIMEVAL32_TO_TIMEVAL(&ntv
.time
, &ntv32
.time
);
4141 ntv
.maxerror
= ntv32
.maxerror
;
4142 ntv
.esterror
= ntv32
.esterror
;
4145 (void) printf("\ttime: %ld.%6.6ld sec\n",
4146 ntv
.time
.tv_sec
, ntv
.time
.tv_usec
);
4147 (void) printf("\tmaxerror: %11d usec\n", ntv
.maxerror
);
4148 (void) printf("\testerror: %11d usec\n", ntv
.esterror
);
4152 get_timex_modes(private_t
*pri
, uint32_t val
)
4154 char *str
= pri
->code_buf
;
4158 if (val
& MOD_OFFSET
)
4159 used
= strlcat(str
, "|MOD_OFFSET", sizeof (pri
->code_buf
));
4160 if (val
& MOD_FREQUENCY
)
4161 used
= strlcat(str
, "|MOD_FREQUENCY", sizeof (pri
->code_buf
));
4162 if (val
& MOD_MAXERROR
)
4163 used
= strlcat(str
, "|MOD_MAXERROR", sizeof (pri
->code_buf
));
4164 if (val
& MOD_ESTERROR
)
4165 used
= strlcat(str
, "|MOD_ESTERROR", sizeof (pri
->code_buf
));
4166 if (val
& MOD_STATUS
)
4167 used
= strlcat(str
, "|MOD_STATUS", sizeof (pri
->code_buf
));
4168 if (val
& MOD_TIMECONST
)
4169 used
= strlcat(str
, "|MOD_TIMECONST", sizeof (pri
->code_buf
));
4171 used
= strlcat(str
, "|MOD_CLKB", sizeof (pri
->code_buf
));
4173 used
= strlcat(str
, "|MOD_CLKA", sizeof (pri
->code_buf
));
4175 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4176 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4182 get_timex_status(private_t
*pri
, int32_t val
)
4184 char *str
= pri
->code_buf
;
4189 used
= strlcat(str
, "|STA_PLL", sizeof (pri
->code_buf
));
4190 if (val
& STA_PPSFREQ
)
4191 used
= strlcat(str
, "|STA_PPSFREQ", sizeof (pri
->code_buf
));
4192 if (val
& STA_PPSTIME
)
4193 used
= strlcat(str
, "|STA_PPSTIME", sizeof (pri
->code_buf
));
4195 used
= strlcat(str
, "|STA_FLL", sizeof (pri
->code_buf
));
4198 used
= strlcat(str
, "|STA_INS", sizeof (pri
->code_buf
));
4200 used
= strlcat(str
, "|STA_DEL", sizeof (pri
->code_buf
));
4201 if (val
& STA_UNSYNC
)
4202 used
= strlcat(str
, "|STA_UNSYNC", sizeof (pri
->code_buf
));
4203 if (val
& STA_FREQHOLD
)
4204 used
= strlcat(str
, "|STA_FREQHOLD", sizeof (pri
->code_buf
));
4206 if (val
& STA_PPSSIGNAL
)
4207 used
= strlcat(str
, "|STA_PPSSIGNAL", sizeof (pri
->code_buf
));
4208 if (val
& STA_PPSJITTER
)
4209 used
= strlcat(str
, "|STA_PPSJITTER", sizeof (pri
->code_buf
));
4210 if (val
& STA_PPSWANDER
)
4211 used
= strlcat(str
, "|STA_PPSWANDER", sizeof (pri
->code_buf
));
4212 if (val
& STA_PPSERROR
)
4213 used
= strlcat(str
, "|STA_PPSERROR", sizeof (pri
->code_buf
));
4215 if (val
& STA_CLOCKERR
)
4216 used
= strlcat(str
, "|STA_CLOCKERR", sizeof (pri
->code_buf
));
4218 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4219 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4225 show_ntp_adjtime(private_t
*pri
)
4230 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == 0)
4233 if (Pread(Proc
, &timex
, sizeof (timex
), offset
) != sizeof (timex
))
4236 (void) printf("\tmodes: %s\n", get_timex_modes(pri
, timex
.modes
));
4237 (void) printf("\toffset: %11d usec\n", timex
.offset
);
4238 (void) printf("\tfreq: %11d scaled ppm\n", timex
.freq
);
4239 (void) printf("\tmaxerror: %11d usec\n", timex
.maxerror
);
4240 (void) printf("\testerror: %11d usec\n", timex
.esterror
);
4241 (void) printf("\tstatus: %s\n", get_timex_status(pri
, timex
.status
));
4242 (void) printf("\tconstant: %11d\n", timex
.constant
);
4243 (void) printf("\tprecision: %11d usec\n", timex
.precision
);
4244 (void) printf("\ttolerance: %11d scaled ppm\n", timex
.tolerance
);
4245 (void) printf("\tppsfreq: %11d scaled ppm\n", timex
.ppsfreq
);
4246 (void) printf("\tjitter: %11d usec\n", timex
.jitter
);
4247 (void) printf("\tshift: %11d sec\n", timex
.shift
);
4248 (void) printf("\tstabil: %11d scaled ppm\n", timex
.stabil
);
4249 (void) printf("\tjitcnt: %11d\n", timex
.jitcnt
);
4250 (void) printf("\tcalcnt: %11d\n", timex
.calcnt
);
4251 (void) printf("\terrcnt: %11d\n", timex
.errcnt
);
4252 (void) printf("\tstbcnt: %11d\n", timex
.stbcnt
);
4256 show_getrusage(long offset
)
4259 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4261 (void) printf("\t user time: %ld.%6.6ld sec\n",
4263 r
.ru_utime
.tv_usec
);
4264 (void) printf("\t system time: %ld.%6.6ld sec\n",
4266 r
.ru_stime
.tv_usec
);
4267 (void) printf("\t max rss: <unimpl> %ld\n",
4269 (void) printf("\t shared data: <unimpl> %ld\n",
4271 (void) printf("\t unshared data: <unimpl> %ld\n",
4273 (void) printf("\t unshared stack: <unimpl> %ld\n",
4275 (void) printf("\t minor faults: %ld\n",
4277 (void) printf("\t major faults: %ld\n",
4279 (void) printf("\t # of swaps: %ld\n",
4281 (void) printf("\t blocked inputs: %ld\n",
4283 (void) printf("\t blocked outputs: %ld\n",
4285 (void) printf("\t msgs sent: %ld\n",
4287 (void) printf("\t msgs rcv'd: %ld\n",
4289 (void) printf("\t signals rcv'd: %ld\n",
4291 (void) printf("\tvol cntxt swtchs: %ld\n",
4293 (void) printf("\tinv cntxt swtchs: %ld\n",
4299 show_getrusage32(long offset
)
4302 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4304 (void) printf("\t user time: %d.%6.6d sec\n",
4306 r
.ru_utime
.tv_usec
);
4307 (void) printf("\t system time: %d.%6.6d sec\n",
4309 r
.ru_stime
.tv_usec
);
4310 (void) printf("\t max rss: <unimpl> %d\n",
4312 (void) printf("\t shared data: <unimpl> %d\n",
4314 (void) printf("\t unshared data: <unimpl> %d\n",
4316 (void) printf("\t unshared stack: <unimpl> %d\n",
4318 (void) printf("\t minor faults: %d\n",
4320 (void) printf("\t major faults: %d\n",
4322 (void) printf("\t # of swaps: %d\n",
4324 (void) printf("\t blocked inputs: %d\n",
4326 (void) printf("\t blocked outputs: %d\n",
4328 (void) printf("\t msgs sent: %d\n",
4330 (void) printf("\t msgs rcv'd: %d\n",
4332 (void) printf("\t signals rcv'd: %d\n",
4334 (void) printf("\tvol cntxt swtchs: %d\n",
4336 (void) printf("\tinv cntxt swtchs: %d\n",
4342 * Utility function to print a packed nvlist by unpacking
4343 * and calling the libnvpair pretty printer. Frees all
4344 * allocated memory internally.
4347 show_packed_nvlist(private_t
*pri
, uintptr_t offset
, size_t size
)
4349 nvlist_t
*nvl
= NULL
;
4353 if ((offset
== 0) || (size
== 0)) {
4357 buf
= my_malloc(size
, "nvlist decode buffer");
4358 readsize
= Pread(Proc
, buf
, size
, offset
);
4359 if (readsize
!= size
) {
4360 (void) printf("%s\t<?>", pri
->pname
);
4364 result
= nvlist_unpack(buf
, size
, &nvl
, 0);
4366 dump_nvlist(nvl
, 8);
4369 (void) printf("%s\tunpack of nvlist"
4370 " failed: %d\n", pri
->pname
, result
);
4377 show_zone_create_args(private_t
*pri
, long offset
)
4380 char zone_name
[ZONENAME_MAX
];
4381 char zone_root
[MAXPATHLEN
];
4382 char *zone_zfs
= NULL
;
4384 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4386 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4387 (uintptr_t)args
.zone_name
) == -1)
4388 (void) strcpy(zone_name
, "<?>");
4390 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4391 (uintptr_t)args
.zone_root
) == -1)
4392 (void) strcpy(zone_root
, "<?>");
4394 if (args
.zfsbufsz
> 0) {
4395 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4396 if (zone_zfs
!= NULL
) {
4397 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4398 (uintptr_t)args
.zfsbuf
) == -1)
4399 (void) strcpy(zone_zfs
, "<?>");
4405 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4407 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4410 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4411 args
.zone_privssz
, " zone_privs: ");
4413 (void) printf("%s\t rctlbuf: 0x%p\n", pri
->pname
,
4414 (void *)args
.rctlbuf
);
4415 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4416 (ulong_t
)args
.rctlbufsz
);
4418 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4421 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4423 (void) printf("%s\textended_error: 0x%p\n", pri
->pname
,
4424 (void *)args
.extended_error
);
4426 if (args
.zfsbufsz
> 0)
4435 show_zone_create_args32(private_t
*pri
, long offset
)
4438 char zone_name
[ZONENAME_MAX
];
4439 char zone_root
[MAXPATHLEN
];
4440 char *zone_zfs
= NULL
;
4442 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4444 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4445 (uintptr_t)args
.zone_name
) == -1)
4446 (void) strcpy(zone_name
, "<?>");
4448 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4449 (uintptr_t)args
.zone_root
) == -1)
4450 (void) strcpy(zone_root
, "<?>");
4452 if (args
.zfsbufsz
> 0) {
4453 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4454 if (zone_zfs
!= NULL
) {
4455 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4456 (uintptr_t)args
.zfsbuf
) == -1)
4457 (void) strcpy(zone_zfs
, "<?>");
4463 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4465 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4468 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4469 args
.zone_privssz
, " zone_privs: ");
4471 (void) printf("%s\t rctlbuf: 0x%x\n", pri
->pname
,
4472 (caddr32_t
)args
.rctlbuf
);
4473 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4474 (ulong_t
)args
.rctlbufsz
);
4476 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4479 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4481 (void) printf("%s\textended_error: 0x%x\n", pri
->pname
,
4482 (caddr32_t
)args
.extended_error
);
4484 if (args
.zfsbufsz
> 0)
4492 show_zones(private_t
*pri
)
4494 switch (pri
->sys_args
[0]) {
4497 if (data_model
== PR_MODEL_LP64
)
4498 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4500 show_zone_create_args32(pri
, (long)pri
->sys_args
[1]);
4502 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4509 show_rctlblk(private_t
*pri
, long _rctlblk
)
4512 int size
= rctlblk_size();
4516 blk
= my_malloc(size
, "rctlblk decode buffer");
4517 readsize
= Pread(Proc
, blk
, size
, _rctlblk
);
4518 if (readsize
!= size
) {
4519 (void) printf("%s\t\t<?>", pri
->pname
);
4521 (void) printf("%s\t\t Privilege: 0x%x\n",
4523 rctlblk_get_privilege(blk
));
4524 (void) printf("%s\t\t Value: %lld\n",
4526 rctlblk_get_value(blk
));
4527 (void) printf("%s\t\tEnforced Value: %lld\n",
4529 rctlblk_get_enforced_value(blk
));
4533 act
= rctlblk_get_local_action(blk
, &sig
);
4535 s
= rctl_local_action(pri
, act
);
4537 (void) printf("%s\t\t Local action: 0x%x\n",
4540 (void) printf("%s\t\t Local action: %s\n",
4544 if (act
& RCTL_LOCAL_SIGNAL
) {
4545 (void) printf("%s\t\t "
4547 pri
->pname
, signame(pri
, sig
));
4551 s
= rctl_local_flags(pri
, rctlblk_get_local_flags(blk
));
4553 (void) printf("%s\t\t Local flags: 0x%x\n",
4554 pri
->pname
, rctlblk_get_local_flags(blk
));
4556 (void) printf("%s\t\t Local flags: %s\n",
4561 (void) printf("%s\t\t Recipient PID: %d\n",
4563 rctlblk_get_recipient_pid(blk
));
4565 (void) printf("%s\t\t Recipient PID: %ld\n",
4567 rctlblk_get_recipient_pid(blk
));
4569 (void) printf("%s\t\t Firing Time: %lld\n",
4571 rctlblk_get_firing_time(blk
));
4577 show_rctls(private_t
*pri
)
4581 switch (pri
->sys_args
[0]) {
4582 case 0: /* getrctl */
4583 case 1: /* setrctl */
4585 * If these offsets look a little odd, remember that they're
4586 * into the _raw_ system call
4588 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri
->pname
,
4590 if (pri
->sys_args
[2] != 0) {
4591 show_rctlblk(pri
, pri
->sys_args
[2]);
4593 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri
->pname
,
4595 if (pri
->sys_args
[3] != 0) {
4596 show_rctlblk(pri
, pri
->sys_args
[3]);
4599 case 4: /* setprojrctl */
4600 for (entry
= 0; entry
< pri
->sys_args
[4]; entry
++) {
4601 (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4603 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4604 if (RCTLBLK_INC(pri
->sys_args
[3], entry
) != NULL
) {
4606 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4613 show_utimesys(private_t
*pri
)
4615 switch (pri
->sys_args
[0]) {
4616 case 0: /* futimens() */
4617 if (pri
->sys_nargs
> 2)
4618 show_utimens(pri
, (long)pri
->sys_args
[2]);
4620 case 1: /* utimensat */
4621 if (pri
->sys_nargs
> 3)
4622 show_utimens(pri
, (long)pri
->sys_args
[3]);
4624 default: /* unexpected subcode */
4631 show_sockconfig_filter_prop32(private_t
*pri
, long addr
)
4633 struct sockconfig_filter_props32 props
;
4634 const char *s
= NULL
;
4635 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4636 sof_socktuple32_t
*tup
;
4640 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4641 if (Pread_string(Proc
, buf
, sizeof (buf
),
4642 (uintptr_t)props
.sfp_modname
) == -1)
4643 (void) strcpy(buf
, "<?>");
4644 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4645 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4646 props
.sfp_autoattach
? "automatic" : "progammatic");
4647 if (props
.sfp_autoattach
) {
4649 switch (props
.sfp_hint
) {
4650 case SOF_HINT_TOP
: s
= "top"; break;
4651 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4652 case SOF_HINT_BEFORE
:
4653 case SOF_HINT_AFTER
:
4654 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4656 if (Pread_string(Proc
, buf
, sizeof (buf
),
4657 (uintptr_t)props
.sfp_hintarg
) == -1)
4658 (void) strcpy(buf
, "<?>");
4661 (void) printf(", placement: %s %s", s
, buf
);
4664 (void) printf("\n");
4665 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4666 if (props
.sfp_socktuple_cnt
== 0) {
4667 (void) printf("\t\t<empty>\n");
4670 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4671 tup
= my_malloc(sz
, "socket tuple buffer");
4672 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4673 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4675 "\t\tfamily: %d, type: %d, proto: %d\n",
4676 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4677 tup
[i
].sofst_protocol
);
4683 show_sockconfig_filter_prop(private_t
*pri
, long addr
)
4685 struct sockconfig_filter_props props
;
4686 const char *s
= NULL
;
4687 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4688 sof_socktuple_t
*tup
;
4692 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4693 if (Pread_string(Proc
, buf
, sizeof (buf
),
4694 (uintptr_t)props
.sfp_modname
) == -1)
4695 (void) strcpy(buf
, "<?>");
4696 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4697 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4698 props
.sfp_autoattach
? "automatic" : "progammatic");
4699 if (props
.sfp_autoattach
) {
4701 switch (props
.sfp_hint
) {
4702 case SOF_HINT_TOP
: s
= "top"; break;
4703 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4704 case SOF_HINT_BEFORE
:
4705 case SOF_HINT_AFTER
:
4706 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4708 if (Pread_string(Proc
, buf
, sizeof (buf
),
4709 (uintptr_t)props
.sfp_hintarg
) == -1)
4710 (void) strcpy(buf
, "<?>");
4713 (void) printf(", placement: %s", s
);
4716 (void) printf("\n");
4717 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4718 if (props
.sfp_socktuple_cnt
== 0) {
4719 (void) printf("\t\t<empty>\n");
4722 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4723 tup
= my_malloc(sz
, "socket tuple buffer");
4724 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4725 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4727 "\t\tfamily: %d, type: %d, proto: %d\n",
4728 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4729 tup
[i
].sofst_protocol
);
4735 show_sockconfig(private_t
*pri
)
4737 switch (pri
->sys_args
[0]) {
4738 case SOCKCONFIG_ADD_FILTER
:
4740 if (data_model
== PR_MODEL_LP64
)
4741 show_sockconfig_filter_prop(pri
,
4742 (long)pri
->sys_args
[2]);
4744 show_sockconfig_filter_prop32(pri
,
4745 (long)pri
->sys_args
[2]);
4747 show_sockconfig_filter_prop(pri
, (long)pri
->sys_args
[2]);
4756 show_zfs_ioc(private_t
*pri
, long addr
)
4758 static const zfs_share_t zero_share
= {0};
4759 static const dmu_objset_stats_t zero_objstats
= {0};
4760 static const struct drr_begin zero_drrbegin
= {0};
4761 static const zinject_record_t zero_injectrec
= {0};
4762 static const zfs_stat_t zero_zstat
= {0};
4765 if (Pread(Proc
, &zc
, sizeof (zc
), addr
) != sizeof (zc
)) {
4766 (void) printf(" zfs_ioctl read failed\n");
4771 (void) printf(" zc_name=%s\n", zc
.zc_name
);
4773 (void) printf(" zc_value=%s\n", zc
.zc_value
);
4774 if (zc
.zc_string
[0])
4775 (void) printf(" zc_string=%s\n", zc
.zc_string
);
4776 if (zc
.zc_guid
!= 0) {
4777 (void) printf(" zc_guid=%llu\n",
4778 (u_longlong_t
)zc
.zc_guid
);
4780 if (zc
.zc_nvlist_conf_size
) {
4781 (void) printf(" nvlist_conf:\n");
4782 show_packed_nvlist(pri
, zc
.zc_nvlist_conf
,
4783 zc
.zc_nvlist_conf_size
);
4785 if (zc
.zc_nvlist_src_size
) {
4786 (void) printf(" nvlist_src:\n");
4787 show_packed_nvlist(pri
, zc
.zc_nvlist_src
,
4788 zc
.zc_nvlist_src_size
);
4790 if (zc
.zc_nvlist_dst_size
) {
4791 (void) printf(" nvlist_dst:\n");
4792 show_packed_nvlist(pri
, zc
.zc_nvlist_dst
,
4793 zc
.zc_nvlist_dst_size
);
4795 if (zc
.zc_cookie
!= 0) {
4796 (void) printf(" zc_cookie=%llu\n",
4797 (u_longlong_t
)zc
.zc_cookie
);
4799 if (zc
.zc_objset_type
!= 0) {
4800 (void) printf(" zc_objset_type=%llu\n",
4801 (u_longlong_t
)zc
.zc_objset_type
);
4803 if (zc
.zc_perm_action
!= 0) {
4804 (void) printf(" zc_perm_action=%llu\n",
4805 (u_longlong_t
)zc
.zc_perm_action
);
4807 if (zc
.zc_history
!= 0) {
4808 (void) printf(" zc_history=%llu\n",
4809 (u_longlong_t
)zc
.zc_history
);
4811 if (zc
.zc_obj
!= 0) {
4812 (void) printf(" zc_obj=%llu\n",
4813 (u_longlong_t
)zc
.zc_obj
);
4815 if (zc
.zc_iflags
!= 0) {
4816 (void) printf(" zc_obj=0x%llx\n",
4817 (u_longlong_t
)zc
.zc_iflags
);
4820 if (memcmp(&zc
.zc_share
, &zero_share
, sizeof (zc
.zc_share
))) {
4821 zfs_share_t
*z
= &zc
.zc_share
;
4822 (void) printf(" zc_share:\n");
4823 if (z
->z_exportdata
) {
4824 (void) printf("\tz_exportdata=0x%llx\n",
4825 (u_longlong_t
)z
->z_exportdata
);
4827 if (z
->z_sharedata
) {
4828 (void) printf("\tz_sharedata=0x%llx\n",
4829 (u_longlong_t
)z
->z_sharedata
);
4831 if (z
->z_sharetype
) {
4832 (void) printf("\tz_sharetype=%llu\n",
4833 (u_longlong_t
)z
->z_sharetype
);
4835 if (z
->z_sharemax
) {
4836 (void) printf("\tz_sharemax=%llu\n",
4837 (u_longlong_t
)z
->z_sharemax
);
4841 if (memcmp(&zc
.zc_objset_stats
, &zero_objstats
,
4842 sizeof (zc
.zc_objset_stats
))) {
4843 dmu_objset_stats_t
*dds
= &zc
.zc_objset_stats
;
4844 (void) printf(" zc_objset_stats:\n");
4845 if (dds
->dds_num_clones
) {
4846 (void) printf("\tdds_num_clones=%llu\n",
4847 (u_longlong_t
)dds
->dds_num_clones
);
4849 if (dds
->dds_creation_txg
) {
4850 (void) printf("\tdds_creation_txg=%llu\n",
4851 (u_longlong_t
)dds
->dds_creation_txg
);
4853 if (dds
->dds_guid
) {
4854 (void) printf("\tdds_guid=%llu\n",
4855 (u_longlong_t
)dds
->dds_guid
);
4858 (void) printf("\tdds_type=%u\n", dds
->dds_type
);
4859 if (dds
->dds_is_snapshot
) {
4860 (void) printf("\tdds_is_snapshot=%u\n",
4861 dds
->dds_is_snapshot
);
4863 if (dds
->dds_inconsistent
) {
4864 (void) printf("\tdds_inconsitent=%u\n",
4865 dds
->dds_inconsistent
);
4867 if (dds
->dds_origin
[0]) {
4868 (void) printf("\tdds_origin=%s\n", dds
->dds_origin
);
4872 if (memcmp(&zc
.zc_begin_record
, &zero_drrbegin
,
4873 sizeof (zc
.zc_begin_record
))) {
4874 struct drr_begin
*drr
= &zc
.zc_begin_record
.drr_u
.drr_begin
;
4875 (void) printf(" zc_begin_record:\n");
4876 if (drr
->drr_magic
) {
4877 (void) printf("\tdrr_magic=%llu\n",
4878 (u_longlong_t
)drr
->drr_magic
);
4880 if (drr
->drr_versioninfo
) {
4881 (void) printf("\tdrr_versioninfo=%llu\n",
4882 (u_longlong_t
)drr
->drr_versioninfo
);
4884 if (drr
->drr_creation_time
) {
4885 (void) printf("\tdrr_creation_time=%llu\n",
4886 (u_longlong_t
)drr
->drr_creation_time
);
4889 (void) printf("\tdrr_type=%u\n", drr
->drr_type
);
4891 (void) printf("\tdrr_flags=0x%x\n", drr
->drr_flags
);
4892 if (drr
->drr_toguid
) {
4893 (void) printf("\tdrr_toguid=%llu\n",
4894 (u_longlong_t
)drr
->drr_toguid
);
4896 if (drr
->drr_fromguid
) {
4897 (void) printf("\tdrr_fromguid=%llu\n",
4898 (u_longlong_t
)drr
->drr_fromguid
);
4900 if (drr
->drr_toname
[0]) {
4901 (void) printf("\tdrr_toname=%s\n", drr
->drr_toname
);
4905 if (memcmp(&zc
.zc_inject_record
, &zero_injectrec
,
4906 sizeof (zc
.zc_inject_record
))) {
4907 zinject_record_t
*zi
= &zc
.zc_inject_record
;
4908 (void) printf(" zc_inject_record:\n");
4909 if (zi
->zi_objset
) {
4910 (void) printf("\tzi_objset=%llu\n",
4911 (u_longlong_t
)zi
->zi_objset
);
4913 if (zi
->zi_object
) {
4914 (void) printf("\tzi_object=%llu\n",
4915 (u_longlong_t
)zi
->zi_object
);
4918 (void) printf("\tzi_start=%llu\n",
4919 (u_longlong_t
)zi
->zi_start
);
4922 (void) printf("\tzi_end=%llu\n",
4923 (u_longlong_t
)zi
->zi_end
);
4926 (void) printf("\tzi_guid=%llu\n",
4927 (u_longlong_t
)zi
->zi_guid
);
4930 (void) printf("\tzi_level=%lu\n",
4931 (ulong_t
)zi
->zi_level
);
4934 (void) printf("\tzi_error=%lu\n",
4935 (ulong_t
)zi
->zi_error
);
4938 (void) printf("\tzi_type=%llu\n",
4939 (u_longlong_t
)zi
->zi_type
);
4942 (void) printf("\tzi_freq=%lu\n",
4943 (ulong_t
)zi
->zi_freq
);
4945 if (zi
->zi_failfast
) {
4946 (void) printf("\tzi_failfast=%lu\n",
4947 (ulong_t
)zi
->zi_failfast
);
4950 (void) printf("\tzi_func=%s\n", zi
->zi_func
);
4951 if (zi
->zi_iotype
) {
4952 (void) printf("\tzi_iotype=%lu\n",
4953 (ulong_t
)zi
->zi_iotype
);
4955 if (zi
->zi_duration
) {
4956 (void) printf("\tzi_duration=%ld\n",
4957 (long)zi
->zi_duration
);
4960 (void) printf("\tzi_timer=%llu\n",
4961 (u_longlong_t
)zi
->zi_timer
);
4965 if (zc
.zc_defer_destroy
) {
4966 (void) printf(" zc_defer_destroy=%d\n",
4967 (int)zc
.zc_defer_destroy
);
4970 (void) printf(" zc_flags=0x%x\n",
4973 if (zc
.zc_action_handle
) {
4974 (void) printf(" zc_action_handle=%llu\n",
4975 (u_longlong_t
)zc
.zc_action_handle
);
4977 if (zc
.zc_cleanup_fd
>= 0)
4978 (void) printf(" zc_cleanup_fd=%d\n", zc
.zc_cleanup_fd
);
4979 if (zc
.zc_sendobj
) {
4980 (void) printf(" zc_sendobj=%llu\n",
4981 (u_longlong_t
)zc
.zc_sendobj
);
4983 if (zc
.zc_fromobj
) {
4984 (void) printf(" zc_fromobj=%llu\n",
4985 (u_longlong_t
)zc
.zc_fromobj
);
4987 if (zc
.zc_createtxg
) {
4988 (void) printf(" zc_createtxg=%llu\n",
4989 (u_longlong_t
)zc
.zc_createtxg
);
4992 if (memcmp(&zc
.zc_stat
, &zero_zstat
, sizeof (zc
.zc_stat
))) {
4993 zfs_stat_t
*zs
= &zc
.zc_stat
;
4994 (void) printf(" zc_stat:\n");
4996 (void) printf("\tzs_gen=%llu\n",
4997 (u_longlong_t
)zs
->zs_gen
);
5000 (void) printf("\tzs_mode=%llu\n",
5001 (u_longlong_t
)zs
->zs_mode
);
5004 (void) printf("\tzs_links=%llu\n",
5005 (u_longlong_t
)zs
->zs_links
);
5007 if (zs
->zs_ctime
[0]) {
5008 (void) printf("\tzs_ctime[0]=%llu\n",
5009 (u_longlong_t
)zs
->zs_ctime
[0]);
5011 if (zs
->zs_ctime
[1]) {
5012 (void) printf("\tzs_ctime[1]=%llu\n",
5013 (u_longlong_t
)zs
->zs_ctime
[1]);
5018 /* expound verbosely upon syscall arguments */
5021 expound(private_t
*pri
, long r0
, int raw
)
5023 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
5024 int lp64
= (data_model
== PR_MODEL_LP64
);
5025 int what
= Lsp
->pr_what
;
5026 int err
= pri
->Errno
; /* don't display output parameters */
5027 /* for a failed system call */
5029 /* We are a 32-bit truss; we can't grok a 64-bit process */
5033 /* for reporting sleeping system calls */
5034 if (what
== 0 && (Lsp
->pr_flags
& (PR_ASLEEP
|PR_VFORKP
)))
5035 what
= Lsp
->pr_syscall
;
5038 case SYS_gettimeofday
:
5040 show_timeofday(pri
);
5043 if (!err
&& pri
->sys_nargs
> 1)
5044 show_itimerval(pri
, (long)pri
->sys_args
[1],
5048 if (pri
->sys_nargs
> 1)
5049 show_itimerval(pri
, (long)pri
->sys_args
[1],
5051 if (!err
&& pri
->sys_nargs
> 2)
5052 show_itimerval(pri
, (long)pri
->sys_args
[2],
5067 show_utssys(pri
, r0
);
5069 show_utssys32(pri
, r0
);
5071 show_utssys(pri
, r0
);
5075 if (pri
->sys_nargs
>= 3) /* each case must decide for itself */
5076 show_ioctl(pri
, pri
->sys_args
[1],
5077 (long)pri
->sys_args
[2]);
5080 if (!err
&& pri
->sys_nargs
>= 3)
5081 show_stat(pri
, (long)pri
->sys_args
[2]);
5084 if (!err
&& pri
->sys_nargs
>= 3)
5085 show_stat64_32(pri
, (long)pri
->sys_args
[2]);
5090 if (!err
&& pri
->sys_nargs
>= 2)
5091 show_stat(pri
, (long)pri
->sys_args
[1]);
5096 if (!err
&& pri
->sys_nargs
>= 2)
5097 show_stat64_32(pri
, (long)pri
->sys_args
[1]);
5105 show_statvfs32(pri
);
5112 case SYS_fstatvfs64
:
5115 show_statvfs64(pri
);
5134 show_msgsys(pri
, r0
); /* each case must decide for itself */
5137 show_semsys(pri
); /* each case must decide for itself */
5140 show_shmsys(pri
); /* each case must decide for itself */
5143 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5147 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5152 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5155 case SYS_getdents64
:
5156 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5158 show_dents64(pri
, (long)pri
->sys_args
[1], r0
);
5161 show_gp_msg(pri
, what
);
5162 if (pri
->sys_nargs
> 3)
5163 show_hhex_int(pri
, (long)pri
->sys_args
[3], "flags");
5166 show_gp_msg(pri
, what
);
5167 if (pri
->sys_nargs
> 3)
5168 show_hhex_int(pri
, (long)pri
->sys_args
[3], "band");
5169 if (pri
->sys_nargs
> 4)
5170 show_hhex_int(pri
, (long)pri
->sys_args
[4], "flags");
5174 show_gp_msg(pri
, what
);
5180 if (pri
->sys_nargs
> 1 && (r0
= pri
->sys_args
[0]) > 0)
5181 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5184 if (!err
&& pri
->sys_nargs
> 1 && pri
->sys_args
[0] > 0)
5185 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5187 case SYS_sigprocmask
:
5188 if (pri
->sys_nargs
> 1)
5189 show_sigset(pri
, (long)pri
->sys_args
[1], " set");
5190 if (!err
&& pri
->sys_nargs
> 2)
5191 show_sigset(pri
, (long)pri
->sys_args
[2], "oset");
5193 case SYS_sigsuspend
:
5194 case SYS_sigtimedwait
:
5195 if (pri
->sys_nargs
> 0)
5196 show_sigset(pri
, (long)pri
->sys_args
[0], "sigmask");
5197 if (!err
&& pri
->sys_nargs
> 1)
5198 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5199 if (pri
->sys_nargs
> 2)
5200 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5202 case SYS_sigaltstack
:
5203 if (pri
->sys_nargs
> 0)
5204 show_sigaltstack(pri
, (long)pri
->sys_args
[0],
5206 if (!err
&& pri
->sys_nargs
> 1)
5207 show_sigaltstack(pri
, (long)pri
->sys_args
[1],
5211 if (pri
->sys_nargs
> 1)
5212 show_sigaction(pri
, (long)pri
->sys_args
[1],
5214 if (!err
&& pri
->sys_nargs
> 2)
5215 show_sigaction(pri
, (long)pri
->sys_args
[2],
5219 if (pri
->sys_nargs
> 1)
5220 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5223 if (pri
->sys_nargs
> 1)
5224 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5225 if (pri
->sys_nargs
> 2)
5226 show_sigset(pri
, (long)pri
->sys_args
[2], "sigmask");
5228 case SYS_sigpending
:
5229 if (!err
&& pri
->sys_nargs
> 1)
5230 show_sigset(pri
, (long)pri
->sys_args
[1], "sigmask");
5233 if (!err
&& pri
->sys_nargs
> 2)
5234 show_siginfo(pri
, (long)pri
->sys_args
[2]);
5236 case SYS_sigsendsys
:
5237 if (pri
->sys_nargs
> 0)
5238 show_procset(pri
, (long)pri
->sys_args
[0]);
5240 case SYS_priocntlsys
:
5241 if (pri
->sys_nargs
> 1)
5242 show_procset(pri
, (long)pri
->sys_args
[1]);
5245 if (!err
&& pri
->sys_nargs
> 2)
5246 show_bool(pri
, (long)pri
->sys_args
[2],
5247 (pri
->sys_args
[1] + pagesize
- 1) / pagesize
);
5251 if (pri
->sys_nargs
> 2) {
5252 int i
= pri
->sys_args
[0]+1;
5253 int showbuf
= FALSE
;
5254 long nb
= (what
== SYS_readv
)? r0
: 32*1024;
5256 if ((what
== SYS_readv
&& !err
&&
5257 prismember(&readfd
, i
)) ||
5258 (what
== SYS_writev
&&
5259 prismember(&writefd
, i
)))
5261 show_iovec(pri
, (long)pri
->sys_args
[1],
5262 pri
->sys_args
[2], showbuf
, nb
);
5270 if (pri
->sys_nargs
<= 1)
5274 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5276 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5278 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5281 case SYS_getrlimit64
:
5285 case SYS_setrlimit64
:
5286 if (pri
->sys_nargs
<= 1)
5288 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5291 if (!err
&& pri
->sys_nargs
> 0)
5292 show_uname(pri
, (long)pri
->sys_args
[0]);
5295 if (!err
&& pri
->sys_nargs
> 1)
5296 show_adjtime(pri
, (long)pri
->sys_args
[0],
5297 (long)pri
->sys_args
[1]);
5300 if (!err
&& pri
->sys_nargs
> 0)
5301 show_timestruc(pri
, (long)pri
->sys_args
[0], "cpu time");
5304 if (!err
&& pri
->sys_nargs
> 1)
5305 show_int(pri
, (long)pri
->sys_args
[1], "lwpid");
5307 case SYS_lwp_mutex_wakeup
:
5308 case SYS_lwp_mutex_unlock
:
5309 case SYS_lwp_mutex_trylock
:
5310 case SYS_lwp_mutex_register
:
5311 if (pri
->sys_nargs
> 0)
5312 show_mutex(pri
, (long)pri
->sys_args
[0]);
5314 case SYS_lwp_mutex_timedlock
:
5315 if (pri
->sys_nargs
> 0)
5316 show_mutex(pri
, (long)pri
->sys_args
[0]);
5317 if (pri
->sys_nargs
> 1)
5318 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5320 case SYS_lwp_cond_wait
:
5321 if (pri
->sys_nargs
> 0)
5322 show_condvar(pri
, (long)pri
->sys_args
[0]);
5323 if (pri
->sys_nargs
> 1)
5324 show_mutex(pri
, (long)pri
->sys_args
[1]);
5325 if (pri
->sys_nargs
> 2)
5326 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5328 case SYS_lwp_cond_signal
:
5329 case SYS_lwp_cond_broadcast
:
5330 if (pri
->sys_nargs
> 0)
5331 show_condvar(pri
, (long)pri
->sys_args
[0]);
5333 case SYS_lwp_sema_trywait
:
5334 case SYS_lwp_sema_post
:
5335 if (pri
->sys_nargs
> 0)
5336 show_sema(pri
, (long)pri
->sys_args
[0]);
5338 case SYS_lwp_sema_timedwait
:
5339 if (pri
->sys_nargs
> 0)
5340 show_sema(pri
, (long)pri
->sys_args
[0]);
5341 if (pri
->sys_nargs
> 1)
5342 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5344 case SYS_lwp_rwlock_sys
:
5345 if (pri
->sys_nargs
> 1)
5346 show_rwlock(pri
, (long)pri
->sys_args
[1]);
5347 if (pri
->sys_nargs
> 2 &&
5348 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 1))
5349 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5351 case SYS_lwp_create
:
5352 /* XXX print some values in ucontext ??? */
5353 if (!err
&& pri
->sys_nargs
> 2)
5354 show_int(pri
, (long)pri
->sys_args
[2], "lwpid");
5357 if (pri
->sys_args
[0] == AIOWAIT
&& !err
&& pri
->sys_nargs
> 1)
5358 show_timeval(pri
, (long)pri
->sys_args
[1], "timeout");
5361 if (pri
->sys_nargs
> 0)
5362 show_timestruc(pri
, (long)pri
->sys_args
[0], "tmout");
5363 if (pri
->sys_nargs
> 1 && (err
== 0 || err
== EINTR
))
5364 show_timestruc(pri
, (long)pri
->sys_args
[1], "resid");
5367 switch (pri
->sys_args
[0]) {
5368 case PRIVSYS_SETPPRIV
:
5369 case PRIVSYS_GETPPRIV
:
5371 show_privset(pri
, (long)pri
->sys_args
[3],
5372 (size_t)pri
->sys_args
[4], "");
5376 switch (pri
->sys_args
[0]) {
5377 case UCREDSYS_UCREDGET
:
5378 case UCREDSYS_GETPEERUCRED
:
5380 show_ucred(pri
, (long)pri
->sys_args
[2]);
5386 if (pri
->sys_nargs
> 2)
5387 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5388 0, (long)pri
->sys_args
[2]);
5391 if (pri
->sys_nargs
> 5)
5392 show_sockaddr(pri
, "to", (long)pri
->sys_args
[4], 0,
5396 if (!err
&& pri
->sys_nargs
> 2)
5397 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5398 (long)pri
->sys_args
[2], 0);
5400 case SYS_getsockname
:
5401 case SYS_getpeername
:
5402 if (!err
&& pri
->sys_nargs
> 2)
5403 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5404 (long)pri
->sys_args
[2], 0);
5407 if (!err
&& pri
->sys_nargs
> 5)
5408 show_sockaddr(pri
, "from", (long)pri
->sys_args
[4],
5409 (long)pri
->sys_args
[5], 0);
5416 if (pri
->sys_nargs
<= 2)
5420 show_msghdr(pri
, pri
->sys_args
[1]);
5422 show_msghdr32(pri
, pri
->sys_args
[1]);
5424 show_msghdr(pri
, pri
->sys_args
[1]);
5431 if (pri
->sys_nargs
!= 5)
5434 if (pri
->sys_args
[0] == SENDFILEV
) {
5435 show_sendfilevec(pri
, (int)pri
->sys_args
[1],
5436 (sendfilevec_t
*)pri
->sys_args
[2],
5437 (int)pri
->sys_args
[3]);
5438 } else if (pri
->sys_args
[0] == SENDFILEV64
) {
5439 show_sendfilevec64(pri
, (int)pri
->sys_args
[1],
5440 (sendfilevec64_t
*)pri
->sys_args
[2],
5441 (int)pri
->sys_args
[3]);
5449 * subcode 0: lwp_park(timespec_t *, id_t)
5450 * subcode 4: lwp_set_park(timespec_t *, id_t)
5452 if (pri
->sys_nargs
> 1 &&
5453 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 4))
5454 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5455 /* subcode 2: lwp_unpark_all(id_t *, int) */
5456 if (pri
->sys_nargs
> 2 && pri
->sys_args
[0] == 2)
5457 show_ids(pri
, (long)pri
->sys_args
[1],
5458 (int)pri
->sys_args
[2]);
5460 case SYS_ntp_gettime
:
5462 show_ntp_gettime(pri
);
5464 case SYS_ntp_adjtime
:
5466 show_ntp_adjtime(pri
);
5470 if (pri
->sys_args
[0] == _RUSAGESYS_GETRUSAGE
) {
5473 show_getrusage32(pri
->sys_args
[1]);
5476 show_getrusage(pri
->sys_args
[1]);
5491 case SYS_sockconfig
:
5492 show_sockconfig(pri
);