4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
26 * Copyright 2015 Joyent, Inc.
29 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
30 /* All Rights Reserved */
38 #include <sys/types.h>
43 #include <sys/statfs.h>
44 #include <sys/times.h>
45 #include <sys/timex.h>
46 #include <sys/utssys.h>
47 #include <sys/utsname.h>
49 #include <sys/ipc_impl.h>
51 #include <sys/msg_impl.h>
53 #include <sys/sem_impl.h>
55 #include <sys/shm_impl.h>
56 #include <sys/dirent.h>
60 #include <sys/termios.h>
61 #include <sys/termiox.h>
62 #include <sys/termio.h>
63 #include <sys/ttold.h>
64 #include <sys/jioctl.h>
65 #include <sys/filio.h>
69 #include <sys/resource.h>
70 #include <sys/statvfs.h>
73 #include <sys/socket.h>
74 #include <netinet/in.h>
76 #include <sys/byteorder.h>
77 #include <arpa/inet.h>
78 #include <sys/audioio.h>
79 #include <sys/cladm.h>
80 #include <sys/synch.h>
81 #include <sys/synch32.h>
82 #include <sys/sysmacros.h>
83 #include <sys/sendfile.h>
86 #include <sys/ucred.h>
87 #include <sys/port_impl.h>
89 #include <sys/priv_impl.h>
91 #include <sys/nvpair.h>
92 #include <libnvpair.h>
93 #include <sys/rctl_impl.h>
94 #include <sys/socketvar.h>
95 #include <sys/fs/zfs.h>
96 #include <sys/zfs_ioctl.h>
102 void show_sigset(private_t
*, long, const char *);
103 void show_ioctl(private_t
*, int, long);
104 void show_zfs_ioc(private_t
*, long);
107 mk_ctime(char *str
, size_t maxsize
, time_t value
)
109 (void) strftime(str
, maxsize
, "%b %e %H:%M:%S %Z %Y",
114 prtime(private_t
*pri
, const char *name
, time_t value
)
118 mk_ctime(str
, sizeof (str
), value
);
119 (void) printf("%s\t%s%s [ %lu ]\n",
127 prtimeval(private_t
*pri
, const char *name
, struct timeval
*value
)
131 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
132 (void) printf("%s\t%s%s [ %lu.%6.6lu ]\n",
141 prtimestruc(private_t
*pri
, const char *name
, timestruc_t
*value
)
145 mk_ctime(str
, sizeof (str
), value
->tv_sec
);
146 (void) printf("%s\t%s%s [ %lu.%9.9lu ]\n",
155 show_utimens(private_t
*pri
, long offset
)
165 if (data_model
== PR_MODEL_NATIVE
) {
166 if (Pread(Proc
, &utimbuf
, sizeof (utimbuf
), offset
)
175 if (Pread(Proc
, &utimbuf32
, sizeof (utimbuf32
), offset
)
176 != sizeof (utimbuf32
))
179 TIMESPEC32_TO_TIMESPEC(&utimbuf
.atime
, &utimbuf32
.atime
);
180 TIMESPEC32_TO_TIMESPEC(&utimbuf
.mtime
, &utimbuf32
.mtime
);
183 /* print access and modification times */
184 if (utimbuf
.atime
.tv_nsec
== UTIME_OMIT
)
185 (void) printf("%s\tat = UTIME_OMIT\n", pri
->pname
);
186 else if (utimbuf
.atime
.tv_nsec
== UTIME_NOW
)
187 (void) printf("%s\tat = UTIME_NOW\n", pri
->pname
);
189 prtimestruc(pri
, "at = ", &utimbuf
.atime
);
190 if (utimbuf
.mtime
.tv_nsec
== UTIME_OMIT
)
191 (void) printf("%s\tmt = UTIME_OMIT\n", pri
->pname
);
192 else if (utimbuf
.mtime
.tv_nsec
== UTIME_NOW
)
193 (void) printf("%s\tmt = UTIME_NOW\n", pri
->pname
);
195 prtimestruc(pri
, "mt = ", &utimbuf
.mtime
);
199 show_timeofday(private_t
*pri
)
204 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
207 if (data_model
== PR_MODEL_NATIVE
) {
208 if (Pread(Proc
, &tod
, sizeof (tod
), offset
)
212 struct timeval32 tod32
;
214 if (Pread(Proc
, &tod32
, sizeof (tod32
), offset
)
218 TIMEVAL32_TO_TIMEVAL(&tod
, &tod32
);
221 prtimeval(pri
, "time: ", &tod
);
225 show_itimerval(private_t
*pri
, long offset
, const char *name
)
227 struct itimerval itimerval
;
232 if (data_model
== PR_MODEL_NATIVE
) {
233 if (Pread(Proc
, &itimerval
, sizeof (itimerval
), offset
)
234 != sizeof (itimerval
))
237 struct itimerval32 itimerval32
;
239 if (Pread(Proc
, &itimerval32
, sizeof (itimerval32
), offset
)
240 != sizeof (itimerval32
))
243 ITIMERVAL32_TO_ITIMERVAL(&itimerval
, &itimerval32
);
247 "%s\t%s: interval: %4ld.%6.6ld sec value: %4ld.%6.6ld sec\n",
250 itimerval
.it_interval
.tv_sec
,
251 itimerval
.it_interval
.tv_usec
,
252 itimerval
.it_value
.tv_sec
,
253 itimerval
.it_value
.tv_usec
);
257 show_timeval(private_t
*pri
, long offset
, const char *name
)
259 struct timeval timeval
;
264 if (data_model
== PR_MODEL_NATIVE
) {
265 if (Pread(Proc
, &timeval
, sizeof (timeval
), offset
)
269 struct timeval32 timeval32
;
271 if (Pread(Proc
, &timeval32
, sizeof (timeval32
), offset
)
272 != sizeof (timeval32
))
275 TIMEVAL32_TO_TIMEVAL(&timeval
, &timeval32
);
279 "%s\t%s: %ld.%6.6ld sec\n",
287 show_timestruc(private_t
*pri
, long offset
, const char *name
)
289 timestruc_t timestruc
;
294 if (data_model
== PR_MODEL_NATIVE
) {
295 if (Pread(Proc
, ×truc
, sizeof (timestruc
), offset
)
296 != sizeof (timestruc
))
299 timestruc32_t timestruc32
;
301 if (Pread(Proc
, ×truc32
, sizeof (timestruc32
), offset
)
302 != sizeof (timestruc32
))
305 TIMESPEC32_TO_TIMESPEC(×truc
, ×truc32
);
309 "%s\t%s: %ld.%9.9ld sec\n",
317 show_stime(private_t
*pri
)
319 if (pri
->sys_nargs
>= 1) {
320 /* print new system time */
321 prtime(pri
, "systime = ", (time_t)pri
->sys_args
[0]);
326 show_times(private_t
*pri
)
328 long hz
= sysconf(_SC_CLK_TCK
);
332 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
335 if (data_model
== PR_MODEL_NATIVE
) {
336 if (Pread(Proc
, &tms
, sizeof (tms
), offset
)
342 if (Pread(Proc
, &tms32
, sizeof (tms32
), offset
)
347 * This looks a bit odd (since the values are actually
348 * signed), but we need to suppress sign extension to
349 * preserve compatibility (we've always printed these
350 * numbers as unsigned quantities).
352 tms
.tms_utime
= (unsigned)tms32
.tms_utime
;
353 tms
.tms_stime
= (unsigned)tms32
.tms_stime
;
354 tms
.tms_cutime
= (unsigned)tms32
.tms_cutime
;
355 tms
.tms_cstime
= (unsigned)tms32
.tms_cstime
;
359 "%s\tutim=%-6lu stim=%-6lu cutim=%-6lu cstim=%-6lu (HZ=%ld)\n",
369 show_uname(private_t
*pri
, long offset
)
372 * Old utsname buffer (no longer accessible in <sys/utsname.h>).
382 if (offset
!= NULL
&&
383 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
385 "%s\tsys=%-9.9snod=%-9.9srel=%-9.9sver=%-9.9smch=%.9s\n",
395 /* XX64 -- definition of 'struct ustat' is strange -- check out the defn */
397 show_ustat(private_t
*pri
, long offset
)
401 if (offset
!= NULL
&&
402 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
404 "%s\ttfree=%-6ld tinode=%-5lu fname=%-6.6s fpack=%-.6s\n",
415 show_ustat32(private_t
*pri
, long offset
)
419 if (offset
!= NULL
&&
420 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
422 "%s\ttfree=%-6d tinode=%-5u fname=%-6.6s fpack=%-.6s\n",
433 show_fusers(private_t
*pri
, long offset
, long nproc
)
436 int serial
= (nproc
> 4);
441 /* enter region of lengthy output */
446 Pread(Proc
, &fubuf
, sizeof (fubuf
), offset
) == sizeof (fubuf
)) {
447 (void) printf("%s\tpid=%-5d uid=%-5u flags=%s\n",
451 fuflags(pri
, fubuf
.fu_flags
));
453 offset
+= sizeof (fubuf
);
456 /* exit region of lengthy output */
462 show_utssys(private_t
*pri
, long r0
)
464 if (pri
->sys_nargs
>= 3) {
465 switch (pri
->sys_args
[2]) {
467 show_uname(pri
, (long)pri
->sys_args
[0]);
470 show_ustat(pri
, (long)pri
->sys_args
[0]);
473 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
481 show_utssys32(private_t
*pri
, long r0
)
483 if (pri
->sys_nargs
>= 3) {
484 switch (pri
->sys_args
[2]) {
486 show_uname(pri
, (long)pri
->sys_args
[0]);
489 show_ustat32(pri
, (long)pri
->sys_args
[0]);
492 show_fusers(pri
, (long)pri
->sys_args
[3], r0
);
500 show_cladm(private_t
*pri
, int code
, int function
, long offset
)
507 case CL_GET_BOOTFLAG
:
508 if (Pread(Proc
, &arg
, sizeof (arg
), offset
)
510 if (arg
& CLUSTER_CONFIGURED
)
511 (void) printf("%s\tbootflags="
512 "CLUSTER_CONFIGURED", pri
->pname
);
513 if (arg
& CLUSTER_BOOTED
)
514 (void) printf("|CLUSTER_BOOTED\n");
522 case CL_HIGHEST_NODEID
:
523 if (Pread(Proc
, &arg
, sizeof (arg
), offset
)
525 (void) printf("%s\tnodeid=%d\n",
532 #define ALL_LOCK_TYPES \
533 (USYNC_PROCESS | LOCK_ERRORCHECK | LOCK_RECURSIVE | \
534 LOCK_PRIO_INHERIT | LOCK_PRIO_PROTECT | LOCK_ROBUST | \
535 USYNC_PROCESS_ROBUST)
537 /* return cv and mutex types */
539 synch_type(private_t
*pri
, uint_t type
)
541 char *str
= pri
->code_buf
;
543 if (type
& USYNC_PROCESS
)
544 (void) strcpy(str
, "USYNC_PROCESS");
546 (void) strcpy(str
, "USYNC_THREAD");
548 if (type
& LOCK_ERRORCHECK
)
549 (void) strcat(str
, "|LOCK_ERRORCHECK");
550 if (type
& LOCK_RECURSIVE
)
551 (void) strcat(str
, "|LOCK_RECURSIVE");
552 if (type
& LOCK_PRIO_INHERIT
)
553 (void) strcat(str
, "|LOCK_PRIO_INHERIT");
554 if (type
& LOCK_PRIO_PROTECT
)
555 (void) strcat(str
, "|LOCK_PRIO_PROTECT");
556 if (type
& LOCK_ROBUST
)
557 (void) strcat(str
, "|LOCK_ROBUST");
558 if (type
& USYNC_PROCESS_ROBUST
)
559 (void) strcat(str
, "|USYNC_PROCESS_ROBUST");
561 if ((type
&= ~ALL_LOCK_TYPES
) != 0)
562 (void) sprintf(str
+ strlen(str
), "|0x%.4X", type
);
564 return ((const char *)str
);
568 show_mutex(private_t
*pri
, long offset
)
572 if (Pread(Proc
, &mutex
, sizeof (mutex
), offset
) == sizeof (mutex
)) {
573 (void) printf("%s\tmutex type: %s\n",
575 synch_type(pri
, mutex
.mutex_type
));
580 show_condvar(private_t
*pri
, long offset
)
584 if (Pread(Proc
, &condvar
, sizeof (condvar
), offset
)
585 == sizeof (condvar
)) {
586 (void) printf("%s\tcondvar type: %s\n",
588 synch_type(pri
, condvar
.cond_type
));
593 show_sema(private_t
*pri
, long offset
)
597 if (Pread(Proc
, &sema
, sizeof (sema
), offset
) == sizeof (sema
)) {
598 (void) printf("%s\tsema type: %s count = %u\n",
600 synch_type(pri
, sema
.sema_type
),
606 show_rwlock(private_t
*pri
, long offset
)
610 if (Pread(Proc
, &rwlock
, sizeof (rwlock
), offset
) == sizeof (rwlock
)) {
611 (void) printf("%s\trwlock type: %s readers = %d\n",
613 synch_type(pri
, rwlock
.rwlock_type
),
614 rwlock
.rwlock_readers
);
618 /* represent character as itself ('c') or octal (012) */
620 show_char(char *buf
, int c
)
624 if (c
>= ' ' && c
< 0177)
629 (void) sprintf(buf
, fmt
, c
&0xff);
634 show_termio(private_t
*pri
, long offset
)
636 struct termio termio
;
640 if (Pread(Proc
, &termio
, sizeof (termio
), offset
) == sizeof (termio
)) {
642 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o line=%d\n",
649 (void) printf("%s\t cc: ", pri
->pname
);
650 for (i
= 0; i
< NCC
; i
++)
652 show_char(cbuf
, (int)termio
.c_cc
[i
]));
653 (void) fputc('\n', stdout
);
658 show_termios(private_t
*pri
, long offset
)
660 struct termios termios
;
664 if (Pread(Proc
, &termios
, sizeof (termios
), offset
)
665 == sizeof (termios
)) {
667 "%s\tiflag=0%.6o oflag=0%.6o cflag=0%.6o lflag=0%.6o\n",
673 (void) printf("%s\t cc: ", pri
->pname
);
674 for (i
= 0; i
< NCCS
; i
++) {
675 if (i
== NCC
) /* show new chars on new line */
676 (void) printf("\n%s\t\t", pri
->pname
);
678 show_char(cbuf
, (int)termios
.c_cc
[i
]));
680 (void) fputc('\n', stdout
);
685 show_termiox(private_t
*pri
, long offset
)
687 struct termiox termiox
;
690 if (Pread(Proc
, &termiox
, sizeof (termiox
), offset
)
691 == sizeof (termiox
)) {
692 (void) printf("%s\thflag=0%.3o cflag=0%.3o rflag=0%.3o",
697 for (i
= 1; i
< NFF
; i
++)
698 (void) printf(",0%.3o", termiox
.x_rflag
[i
]);
699 (void) printf(" sflag=0%.3o\n",
705 show_sgttyb(private_t
*pri
, long offset
)
707 struct sgttyb sgttyb
;
709 if (Pread(Proc
, &sgttyb
, sizeof (sgttyb
), offset
) == sizeof (sgttyb
)) {
714 "%s\tispeed=%-2d ospeed=%-2d erase=%s kill=%s flags=0x%.8x\n",
716 sgttyb
.sg_ispeed
&0xff,
717 sgttyb
.sg_ospeed
&0xff,
718 show_char(erase
, sgttyb
.sg_erase
),
719 show_char(kill
, sgttyb
.sg_kill
),
725 show_ltchars(private_t
*pri
, long offset
)
727 struct ltchars ltchars
;
732 if (Pread(Proc
, <chars
, sizeof (ltchars
), offset
)
733 == sizeof (ltchars
)) {
734 (void) printf("%s\t cc: ", pri
->pname
);
735 for (p
= (char *)<chars
, i
= 0; i
< sizeof (ltchars
); i
++)
736 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
737 (void) fputc('\n', stdout
);
742 show_tchars(private_t
*pri
, long offset
)
744 struct tchars tchars
;
749 if (Pread(Proc
, &tchars
, sizeof (tchars
), offset
) == sizeof (tchars
)) {
750 (void) printf("%s\t cc: ", pri
->pname
);
751 for (p
= (char *)&tchars
, i
= 0; i
< sizeof (tchars
); i
++)
752 (void) printf(" %s", show_char(cbuf
, (int)*p
++));
753 (void) fputc('\n', stdout
);
758 show_termcb(private_t
*pri
, long offset
)
760 struct termcb termcb
;
762 if (Pread(Proc
, &termcb
, sizeof (termcb
), offset
) == sizeof (termcb
)) {
764 "%s\tflgs=0%.2o termt=%d crow=%d ccol=%d vrow=%d lrow=%d\n",
767 termcb
.st_termt
&0xff,
771 termcb
.st_lrow
&0xff);
775 /* integer value pointed to by ioctl() arg */
777 show_strint(private_t
*pri
, int code
, long offset
)
781 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
782 const char *s
= NULL
;
784 switch (code
) { /* interpret these symbolically */
789 s
= strevents(pri
, val
);
792 s
= tiocflush(pri
, val
);
797 (void) printf("%s\t0x%.8lX: %d\n",
798 pri
->pname
, offset
, val
);
800 (void) printf("%s\t0x%.8lX: %s\n",
801 pri
->pname
, offset
, s
);
806 show_strioctl(private_t
*pri
, long offset
)
808 struct strioctl strioctl
;
810 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
813 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
815 ioctlname(pri
, strioctl
.ic_cmd
),
818 (long)strioctl
.ic_dp
);
820 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
821 show_ioctl(pri
, strioctl
.ic_cmd
,
822 (long)strioctl
.ic_dp
);
829 show_strioctl32(private_t
*pri
, long offset
)
831 struct strioctl32 strioctl
;
833 if (Pread(Proc
, &strioctl
, sizeof (strioctl
), offset
) ==
836 "%s\tcmd=%s timout=%d len=%d dp=0x%.8lX\n",
838 ioctlname(pri
, strioctl
.ic_cmd
),
841 (long)strioctl
.ic_dp
);
843 if (pri
->recur
++ == 0) /* avoid indefinite recursion */
844 show_ioctl(pri
, strioctl
.ic_cmd
,
845 (long)strioctl
.ic_dp
);
852 print_strbuf(private_t
*pri
, struct strbuf
*sp
, const char *name
, int dump
)
855 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
862 * Should we show the buffer contents?
863 * Keyed to the '-r fds' and '-w fds' options?
865 if (sp
->buf
== NULL
|| sp
->len
<= 0)
866 (void) fputc('\n', stdout
);
868 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
872 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
873 (void) strcpy(obuf
, ": \"");
874 showbytes(buffer
, nb
, obuf
+3);
877 (const char *)"\"" : (const char *)"\"..");
878 (void) fputs(obuf
, stdout
);
880 (void) fputc('\n', stdout
);
881 if (dump
&& sp
->len
> 8)
882 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
888 print_strbuf32(private_t
*pri
, struct strbuf32
*sp
, const char *name
, int dump
)
891 "%s\t%s: maxlen=%-4d len=%-4d buf=0x%.8lX",
898 * Should we show the buffer contents?
899 * Keyed to the '-r fds' and '-w fds' options?
901 if (sp
->buf
== NULL
|| sp
->len
<= 0)
902 (void) fputc('\n', stdout
);
904 int nb
= (sp
->len
> 8)? 8 : sp
->len
;
908 if (Pread(Proc
, buffer
, (size_t)nb
, (long)sp
->buf
) == nb
) {
909 (void) strcpy(obuf
, ": \"");
910 showbytes(buffer
, nb
, obuf
+3);
913 (const char *)"\"" : (const char *)"\"..");
914 (void) fputs(obuf
, stdout
);
916 (void) fputc('\n', stdout
);
917 if (dump
&& sp
->len
> 8)
918 showbuffer(pri
, (long)sp
->buf
, (long)sp
->len
);
923 /* strpeek and strfdinsert flags word */
925 strflags(private_t
*pri
, int flags
)
937 (void) sprintf(pri
->code_buf
, "0x%.4X", flags
);
945 show_strpeek(private_t
*pri
, long offset
)
947 struct strpeek strpeek
;
949 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
950 == sizeof (strpeek
)) {
952 print_strbuf(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
953 print_strbuf(pri
, &strpeek
.databuf
, "dat", FALSE
);
955 (void) printf("%s\tflags=%s\n",
957 strflags(pri
, strpeek
.flags
));
963 show_strpeek32(private_t
*pri
, long offset
)
965 struct strpeek32 strpeek
;
967 if (Pread(Proc
, &strpeek
, sizeof (strpeek
), offset
)
968 == sizeof (strpeek
)) {
970 print_strbuf32(pri
, &strpeek
.ctlbuf
, "ctl", FALSE
);
971 print_strbuf32(pri
, &strpeek
.databuf
, "dat", FALSE
);
973 (void) printf("%s\tflags=%s\n",
975 strflags(pri
, strpeek
.flags
));
981 show_strfdinsert(private_t
*pri
, long offset
)
983 struct strfdinsert strfdinsert
;
985 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
986 sizeof (strfdinsert
)) {
988 print_strbuf(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
989 print_strbuf(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
991 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
993 strflags(pri
, strfdinsert
.flags
),
1001 show_strfdinsert32(private_t
*pri
, long offset
)
1003 struct strfdinsert32 strfdinsert
;
1005 if (Pread(Proc
, &strfdinsert
, sizeof (strfdinsert
), offset
) ==
1006 sizeof (strfdinsert
)) {
1008 print_strbuf32(pri
, &strfdinsert
.ctlbuf
, "ctl", FALSE
);
1009 print_strbuf32(pri
, &strfdinsert
.databuf
, "dat", FALSE
);
1011 (void) printf("%s\tflags=%s fildes=%d offset=%d\n",
1013 strflags(pri
, strfdinsert
.flags
),
1015 strfdinsert
.offset
);
1021 show_strrecvfd(private_t
*pri
, long offset
)
1023 struct strrecvfd strrecvfd
;
1025 if (Pread(Proc
, &strrecvfd
, sizeof (strrecvfd
), offset
) ==
1026 sizeof (strrecvfd
)) {
1028 "%s\tfd=%-5d uid=%-5u gid=%u\n",
1037 show_strlist(private_t
*pri
, long offset
)
1039 struct str_list strlist
;
1040 struct str_mlist list
;
1043 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
1045 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1048 (long)strlist
.sl_modlist
);
1050 count
= strlist
.sl_nmods
;
1051 offset
= (long)strlist
.sl_modlist
;
1052 while (!interrupt
&& --count
>= 0) {
1053 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
1056 (void) printf("%s\t\t\"%.*s\"\n",
1058 (int)sizeof (list
.l_name
),
1060 offset
+= sizeof (struct str_mlist
);
1067 show_strlist32(private_t
*pri
, long offset
)
1069 struct str_list32 strlist
;
1070 struct str_mlist list
;
1073 if (Pread(Proc
, &strlist
, sizeof (strlist
), offset
) ==
1075 (void) printf("%s\tnmods=%d modlist=0x%.8lX\n",
1078 (long)strlist
.sl_modlist
);
1080 count
= strlist
.sl_nmods
;
1081 offset
= (long)strlist
.sl_modlist
;
1082 while (!interrupt
&& --count
>= 0) {
1083 if (Pread(Proc
, &list
, sizeof (list
), offset
) !=
1086 (void) printf("%s\t\t\"%.*s\"\n",
1088 (int)sizeof (list
.l_name
),
1090 offset
+= sizeof (struct str_mlist
);
1097 show_jwinsize(private_t
*pri
, long offset
)
1099 struct jwinsize jwinsize
;
1101 if (Pread(Proc
, &jwinsize
, sizeof (jwinsize
), offset
) ==
1102 sizeof (jwinsize
)) {
1104 "%s\tbytesx=%-3u bytesy=%-3u bitsx=%-3u bitsy=%-3u\n",
1106 (unsigned)jwinsize
.bytesx
,
1107 (unsigned)jwinsize
.bytesy
,
1108 (unsigned)jwinsize
.bitsx
,
1109 (unsigned)jwinsize
.bitsy
);
1114 show_winsize(private_t
*pri
, long offset
)
1116 struct winsize winsize
;
1118 if (Pread(Proc
, &winsize
, sizeof (winsize
), offset
)
1119 == sizeof (winsize
)) {
1121 "%s\trow=%-3d col=%-3d xpixel=%-3d ypixel=%-3d\n",
1130 struct audio_stuff
{
1135 const struct audio_stuff audio_output_ports
[] = {
1136 { AUDIO_SPEAKER
, "SPEAKER" },
1137 { AUDIO_HEADPHONE
, "HEADPHONE" },
1138 { AUDIO_LINE_OUT
, "LINE_OUT" },
1139 { AUDIO_SPDIF_OUT
, "SPDIF_OUT" },
1140 { AUDIO_AUX1_OUT
, "AUX1_OUT" },
1141 { AUDIO_AUX2_OUT
, "AUX2_OUT" },
1145 const struct audio_stuff audio_input_ports
[] = {
1146 { AUDIO_MICROPHONE
, "MICROPHONE" },
1147 { AUDIO_LINE_IN
, "LINE_IN" },
1149 { AUDIO_SPDIF_IN
, "SPDIF_IN" },
1150 { AUDIO_AUX1_IN
, "AUX1_IN" },
1151 { AUDIO_AUX2_IN
, "AUX2_IN" },
1152 { AUDIO_CODEC_LOOPB_IN
, "CODEC_LOOPB_IN" },
1153 { AUDIO_SUNVTS
, "SUNVTS" },
1157 static const struct audio_stuff audio_hw_features
[] = {
1158 { AUDIO_HWFEATURE_DUPLEX
, "DUPLEX" },
1159 { AUDIO_HWFEATURE_MSCODEC
, "MSCODEC" },
1160 { AUDIO_HWFEATURE_IN2OUT
, "IN2OUT" },
1161 { AUDIO_HWFEATURE_PLAY
, "PLAY" },
1162 { AUDIO_HWFEATURE_RECORD
, "RECORD" },
1166 static const struct audio_stuff audio_sw_features
[] = {
1167 { AUDIO_SWFEATURE_MIXER
, "MIXER" },
1172 show_audio_features(const private_t
*pri
,
1173 const struct audio_stuff
*audio_porttab
, uint_t features
,
1176 (void) printf("%s\t%s=", pri
->pname
, name
);
1177 if (features
== 0) {
1178 (void) printf("0\n");
1182 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1183 if (features
& audio_porttab
->bit
) {
1184 (void) printf(audio_porttab
->str
);
1185 features
&= ~audio_porttab
->bit
;
1187 (void) putchar('|');
1191 (void) printf("0x%x", features
);
1192 (void) putchar('\n');
1196 show_audio_ports(private_t
*pri
, const char *mode
,
1197 const char *field
, uint_t ports
)
1199 const struct audio_stuff
*audio_porttab
;
1201 (void) printf("%s\t%s\t%s=", pri
->pname
, mode
, field
);
1203 (void) printf("0\n");
1207 audio_porttab
= audio_output_ports
;
1209 audio_porttab
= audio_input_ports
;
1210 for (; audio_porttab
->bit
!= 0; ++audio_porttab
) {
1211 if (ports
& audio_porttab
->bit
) {
1212 (void) printf(audio_porttab
->str
);
1213 ports
&= ~audio_porttab
->bit
;
1215 (void) putchar('|');
1219 (void) printf("0x%x", ports
);
1220 (void) putchar('\n');
1224 show_audio_prinfo(private_t
*pri
, const char *mode
, struct audio_prinfo
*au_pr
)
1229 * The following values describe the audio data encoding.
1232 (void) printf("%s\t%s\tsample_rate=%u channels=%u precision=%u\n",
1239 switch (au_pr
->encoding
) {
1240 case AUDIO_ENCODING_NONE
: s
= "NONE"; break;
1241 case AUDIO_ENCODING_ULAW
: s
= "ULAW"; break;
1242 case AUDIO_ENCODING_ALAW
: s
= "ALAW"; break;
1243 case AUDIO_ENCODING_LINEAR
: s
= "LINEAR"; break;
1244 case AUDIO_ENCODING_DVI
: s
= "DVI"; break;
1245 case AUDIO_ENCODING_LINEAR8
: s
= "LINEAR8"; break;
1248 (void) printf("%s\t%s\tencoding=%s\n", pri
->pname
, mode
, s
);
1250 (void) printf("%s\t%s\tencoding=%u\n",
1251 pri
->pname
, mode
, au_pr
->encoding
);
1255 * The following values control audio device configuration
1259 "%s\t%s\tgain=%u buffer_size=%u\n",
1262 au_pr
->buffer_size
);
1263 show_audio_ports(pri
, mode
, "port", au_pr
->port
);
1264 show_audio_ports(pri
, mode
, "avail_ports", au_pr
->avail_ports
);
1265 show_audio_ports(pri
, mode
, "mod_ports", au_pr
->mod_ports
);
1268 * The following values describe driver state
1271 (void) printf("%s\t%s\tsamples=%u eof=%u pause=%u error=%u\n",
1277 (void) printf("%s\t%s\twaiting=%u balance=%u minordev=%u\n",
1284 * The following values are read-only state flags
1286 (void) printf("%s\t%s\topen=%u active=%u\n",
1293 show_audio_info(private_t
*pri
, long offset
)
1295 struct audio_info au
;
1297 if (Pread(Proc
, &au
, sizeof (au
), offset
) == sizeof (au
)) {
1298 show_audio_prinfo(pri
, "play", &au
.play
);
1299 show_audio_prinfo(pri
, "record", &au
.record
);
1300 (void) printf("%s\tmonitor_gain=%u output_muted=%u\n",
1301 pri
->pname
, au
.monitor_gain
, au
.output_muted
);
1302 show_audio_features(pri
, audio_hw_features
, au
.hw_features
,
1304 show_audio_features(pri
, audio_sw_features
, au
.sw_features
,
1306 show_audio_features(pri
, audio_sw_features
,
1307 au
.sw_features_enabled
, "sw_features_enabled");
1312 show_ioctl(private_t
*pri
, int code
, long offset
)
1314 int lp64
= (data_model
== PR_MODEL_LP64
);
1315 int err
= pri
->Errno
; /* don't display output parameters */
1316 /* for a failed system call */
1332 show_termio(pri
, offset
);
1341 show_termios(pri
, offset
);
1350 show_termiox(pri
, offset
);
1358 show_sgttyb(pri
, offset
);
1365 show_ltchars(pri
, offset
);
1372 show_tchars(pri
, offset
);
1379 show_termcb(pri
, offset
);
1381 /* streams ioctl()s */
1383 /* these are displayed as strings in the arg list */
1384 /* by prt_ioa(). don't display them again here */
1388 /* these are displayed as decimal in the arg list */
1389 /* by prt_ioa(). don't display them again here */
1393 /* these are displayed symbolically in the arg list */
1394 /* by prt_ioa(). don't display them again here */
1399 /* this one just ignores the argument */
1403 /* these return something in an int pointed to by arg */
1415 /* these pass something in an int pointed to by arg */
1421 show_strint(pri
, code
, offset
);
1423 /* these all point to structures */
1427 show_strioctl(pri
, offset
);
1429 show_strioctl32(pri
, offset
);
1431 show_strioctl(pri
, offset
);
1437 show_strpeek(pri
, offset
);
1439 show_strpeek32(pri
, offset
);
1441 show_strpeek(pri
, offset
);
1447 show_strfdinsert(pri
, offset
);
1449 show_strfdinsert32(pri
, offset
);
1451 show_strfdinsert(pri
, offset
);
1457 show_strrecvfd(pri
, offset
);
1464 show_strlist(pri
, offset
);
1466 show_strlist32(pri
, offset
);
1468 show_strlist(pri
, offset
);
1474 show_jwinsize(pri
, offset
);
1481 show_winsize(pri
, offset
);
1484 case (int)AUDIO_SETINFO
:
1485 show_audio_info(pri
, offset
);
1489 if ((code
& ~0xff) == ZFS_IOC
) {
1490 show_zfs_ioc(pri
, offset
);
1494 if (code
& IOC_INOUT
) {
1495 const char *str
= ioctldatastruct(code
);
1497 (void) printf("\t\t%s",
1498 (code
& IOC_INOUT
) == IOC_INOUT
? "write/read" :
1499 code
& IOC_IN
? "write" : "read");
1501 (void) printf(" (struct %s)\n", str
);
1503 (void) printf(" %d bytes\n",
1504 (code
>> 16) & IOCPARM_MASK
);
1511 show_statvfs(private_t
*pri
)
1514 struct statvfs statvfs
;
1517 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1518 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1519 == sizeof (statvfs
)) {
1521 "%s\tbsize=%-10lu frsize=%-9lu blocks=%-8llu bfree=%-9llu\n",
1525 (u_longlong_t
)statvfs
.f_blocks
,
1526 (u_longlong_t
)statvfs
.f_bfree
);
1528 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1530 (u_longlong_t
)statvfs
.f_bavail
,
1531 (u_longlong_t
)statvfs
.f_files
,
1532 (u_longlong_t
)statvfs
.f_ffree
,
1533 (u_longlong_t
)statvfs
.f_favail
);
1535 "%s\tfsid=0x%-9.4lX basetype=%-7.16s namemax=%ld\n",
1539 (long)statvfs
.f_namemax
);
1543 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1544 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1545 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1548 (void) printf("%s\tfstr=\"%.*s\"\n",
1550 (int)sizeof (statvfs
.f_fstr
),
1557 show_statvfs32(private_t
*pri
)
1560 struct statvfs32 statvfs
;
1563 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1564 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1565 == sizeof (statvfs
)) {
1567 "%s\tbsize=%-10u frsize=%-9u blocks=%-8u bfree=%-9u\n",
1574 "%s\tbavail=%-9u files=%-10u ffree=%-9u favail=%-9u\n",
1581 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1585 (int)statvfs
.f_namemax
);
1589 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1590 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1591 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1594 (void) printf("%s\tfstr=\"%.*s\"\n",
1596 (int)sizeof (statvfs
.f_fstr
),
1603 show_statvfs64(private_t
*pri
)
1606 struct statvfs64_32 statvfs
;
1609 if (pri
->sys_nargs
> 1 && (offset
= pri
->sys_args
[1]) != NULL
&&
1610 Pread(Proc
, &statvfs
, sizeof (statvfs
), offset
)
1611 == sizeof (statvfs
)) {
1613 "%s\tbsize=%-10u frsize=%-9u blocks=%-8llu bfree=%-9llu\n",
1617 (u_longlong_t
)statvfs
.f_blocks
,
1618 (u_longlong_t
)statvfs
.f_bfree
);
1620 "%s\tbavail=%-9llu files=%-10llu ffree=%-9llu favail=%-9llu\n",
1622 (u_longlong_t
)statvfs
.f_bavail
,
1623 (u_longlong_t
)statvfs
.f_files
,
1624 (u_longlong_t
)statvfs
.f_ffree
,
1625 (u_longlong_t
)statvfs
.f_favail
);
1627 "%s\tfsid=0x%-9.4X basetype=%-7.16s namemax=%d\n",
1631 (int)statvfs
.f_namemax
);
1635 svfsflags(pri
, (ulong_t
)statvfs
.f_flag
));
1636 cp
= statvfs
.f_fstr
+ strlen(statvfs
.f_fstr
);
1637 if (cp
< statvfs
.f_fstr
+ sizeof (statvfs
.f_fstr
) - 1 &&
1640 (void) printf("%s\tfstr=\"%.*s\"\n",
1642 (int)sizeof (statvfs
.f_fstr
),
1648 show_statfs(private_t
*pri
)
1651 struct statfs statfs
;
1653 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
&&
1654 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1656 "%s\tfty=%d bsz=%ld fsz=%ld blk=%ld bfr=%ld fil=%lu ffr=%lu\n",
1665 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1674 show_statfs32(private_t
*pri
)
1677 struct statfs32 statfs
;
1679 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
&&
1680 Pread(Proc
, &statfs
, sizeof (statfs
), offset
) == sizeof (statfs
)) {
1682 "%s\tfty=%d bsz=%d fsz=%d blk=%d bfr=%d fil=%u ffr=%u\n",
1691 (void) printf("%s\t fname=%.6s fpack=%.6s\n",
1700 show_flock32(private_t
*pri
, long offset
)
1702 struct flock32 flock
;
1704 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1705 const char *str
= NULL
;
1707 (void) printf("%s\ttyp=", pri
->pname
);
1709 switch (flock
.l_type
) {
1721 (void) printf("%s", str
);
1723 (void) printf("%-7d", flock
.l_type
);
1725 str
= whencearg(flock
.l_whence
);
1727 (void) printf(" whence=%s", str
);
1729 (void) printf(" whence=%-8u", flock
.l_whence
);
1732 " start=%-5d len=%-5d sys=%-2u pid=%d\n",
1741 show_flock64(private_t
*pri
, long offset
)
1743 struct flock64 flock
;
1745 if (Pread(Proc
, &flock
, sizeof (flock
), offset
) == sizeof (flock
)) {
1746 const char *str
= NULL
;
1748 (void) printf("%s\ttyp=", pri
->pname
);
1750 switch (flock
.l_type
) {
1762 (void) printf("%s", str
);
1764 (void) printf("%-7d", flock
.l_type
);
1766 str
= whencearg(flock
.l_whence
);
1768 (void) printf(" whence=%s", str
);
1770 (void) printf(" whence=%-8u", flock
.l_whence
);
1773 " start=%-5lld len=%-5lld sys=%-2u pid=%d\n",
1774 (long long)flock
.l_start
,
1775 (long long)flock
.l_len
,
1782 show_share(private_t
*pri
, long offset
)
1784 struct fshare fshare
;
1786 if (Pread(Proc
, &fshare
, sizeof (fshare
), offset
) == sizeof (fshare
)) {
1787 const char *str
= NULL
;
1790 (void) printf("%s\taccess=", pri
->pname
);
1792 switch (fshare
.f_access
) {
1804 (void) printf("%s", str
);
1806 (void) printf("%-7d", fshare
.f_access
);
1809 if (fshare
.f_deny
& F_MANDDNY
) {
1810 fshare
.f_deny
&= ~F_MANDDNY
;
1813 switch (fshare
.f_deny
) {
1832 (void) printf(" deny=F_MANDDNY|%s", str
);
1834 (void) printf(" deny=%s", str
);
1836 (void) printf(" deny=0x%x", manddny
?
1837 fshare
.f_deny
| F_MANDDNY
: fshare
.f_deny
);
1840 (void) printf(" id=%x\n", fshare
.f_id
);
1845 show_ffg(private_t
*pri
)
1847 (void) putchar('\t');
1848 (void) putchar('\t');
1849 prt_ffg(pri
, 0, pri
->Rval1
);
1850 (void) puts(pri
->sys_string
);
1853 /* print values in fcntl() pointed-to structure */
1855 show_fcntl(private_t
*pri
)
1859 if (pri
->sys_nargs
>= 2 && pri
->sys_args
[1] == F_GETFL
) {
1864 if (pri
->sys_nargs
< 3 || (offset
= pri
->sys_args
[2]) == NULL
)
1867 switch (pri
->sys_args
[1]) {
1874 case F_SETLK_NBMAND
:
1880 if (data_model
== PR_MODEL_LP64
)
1881 show_flock64(pri
, offset
);
1883 show_flock32(pri
, offset
);
1885 case 33: /* F_GETLK64 */
1886 case 34: /* F_SETLK64 */
1887 case 35: /* F_SETLKW64 */
1888 case 27: /* F_FREESP64 */
1889 case 28: /* F_ALLOCSP64 */
1890 case 44: /* F_SETLK64_NBMAND */
1891 case 50: /* F_OFD_GETLK64 */
1892 case 51: /* F_OFD_SETLK64 */
1893 case 52: /* F_OFD_SETLKW64 */
1894 case 55: /* F_FLOCK64 */
1895 case 56: /* F_FLOCKW64 */
1896 show_flock64(pri
, offset
);
1904 case F_SETLK_NBMAND
:
1905 show_flock32(pri
, offset
);
1912 case F_SETLK64_NBMAND
:
1915 case F_OFD_SETLKW64
:
1918 show_flock64(pri
, offset
);
1923 show_share(pri
, offset
);
1929 show_strbuf(private_t
*pri
, long offset
, const char *name
, int dump
)
1931 struct strbuf strbuf
;
1933 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1934 print_strbuf(pri
, &strbuf
, name
, dump
);
1939 show_strbuf32(private_t
*pri
, long offset
, const char *name
, int dump
)
1941 struct strbuf32 strbuf
;
1943 if (Pread(Proc
, &strbuf
, sizeof (strbuf
), offset
) == sizeof (strbuf
))
1944 print_strbuf32(pri
, &strbuf
, name
, dump
);
1949 show_gp_msg(private_t
*pri
, int what
)
1953 int fdp1
= pri
->sys_args
[0] + 1;
1958 if (pri
->Errno
== 0 && prismember(&readfd
, fdp1
))
1963 if (prismember(&writefd
, fdp1
))
1968 /* enter region of lengthy output */
1973 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
) {
1974 if (data_model
== PR_MODEL_LP64
)
1975 show_strbuf(pri
, offset
, "ctl", dump
);
1977 show_strbuf32(pri
, offset
, "ctl", dump
);
1979 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != NULL
) {
1980 if (data_model
== PR_MODEL_LP64
)
1981 show_strbuf(pri
, offset
, "dat", dump
);
1983 show_strbuf32(pri
, offset
, "dat", dump
);
1986 if (pri
->sys_nargs
>= 2 && (offset
= pri
->sys_args
[1]) != NULL
)
1987 show_strbuf(pri
, offset
, "ctl", dump
);
1988 if (pri
->sys_nargs
>= 3 && (offset
= pri
->sys_args
[2]) != NULL
)
1989 show_strbuf(pri
, offset
, "dat", dump
);
1992 /* exit region of lengthy output */
1998 show_int(private_t
*pri
, long offset
, const char *name
)
2003 Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
2004 (void) printf("%s\t%s:\t%d\n",
2011 show_hhex_int(private_t
*pri
, long offset
, const char *name
)
2015 if (Pread(Proc
, &value
, sizeof (value
), offset
) == sizeof (value
))
2016 (void) printf("%s\t%s:\t0x%.4X\n",
2022 #define ALL_POLL_FLAGS (POLLIN|POLLPRI|POLLOUT| \
2023 POLLRDNORM|POLLRDBAND|POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
2026 pollevent(private_t
*pri
, int arg
)
2028 char *str
= pri
->code_buf
;
2032 if (arg
& ~ALL_POLL_FLAGS
) {
2033 (void) sprintf(str
, "0x%-5X", arg
);
2034 return ((const char *)str
);
2039 (void) strcat(str
, "|POLLIN");
2041 (void) strcat(str
, "|POLLPRI");
2043 (void) strcat(str
, "|POLLOUT");
2044 if (arg
& POLLRDNORM
)
2045 (void) strcat(str
, "|POLLRDNORM");
2046 if (arg
& POLLRDBAND
)
2047 (void) strcat(str
, "|POLLRDBAND");
2048 if (arg
& POLLWRBAND
)
2049 (void) strcat(str
, "|POLLWRBAND");
2051 (void) strcat(str
, "|POLLERR");
2053 (void) strcat(str
, "|POLLHUP");
2055 (void) strcat(str
, "|POLLNVAL");
2057 return ((const char *)(str
+1));
2061 show_one_pollfd(private_t
*pri
, struct pollfd
*ppollfd
)
2064 * can't print both events and revents in same printf.
2065 * pollevent() returns a pointer to a TSD location.
2067 (void) printf("%s\tfd=%-2d ev=%s",
2068 pri
->pname
, ppollfd
->fd
, pollevent(pri
, ppollfd
->events
));
2069 (void) printf(" rev=%s\n", pollevent(pri
, ppollfd
->revents
));
2073 show_all_pollfds(private_t
*pri
, long offset
, int nfds
)
2075 struct pollfd pollfd
[2];
2078 for (; nfds
&& !interrupt
; nfds
--, offset
+= sizeof (struct pollfd
)) {
2079 if (Pread(Proc
, &pollfd
[0], sizeof (struct pollfd
), offset
) !=
2080 sizeof (struct pollfd
))
2083 if (skip
>= 0 && pollfd
[0].fd
== pollfd
[1].fd
&&
2084 pollfd
[0].events
== pollfd
[1].events
&&
2085 pollfd
[0].revents
== pollfd
[1].revents
) {
2091 (void) printf("%s\t...last pollfd structure"
2092 " repeated %d time%s...\n",
2093 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2096 show_one_pollfd(pri
, &pollfd
[0]);
2097 pollfd
[1] = pollfd
[0];
2102 "%s\t...last pollfd structure repeated %d time%s...\n",
2103 pri
->pname
, skip
, (skip
== 1 ? "" : "s"));
2107 show_pollsys(private_t
*pri
)
2113 if (pri
->sys_nargs
< 2)
2116 offset
= pri
->sys_args
[0];
2117 nfds
= pri
->sys_args
[1];
2119 /* enter region of lengthy output */
2120 if (offset
!= NULL
&& nfds
> 32) {
2125 if (offset
!= NULL
&& nfds
> 0)
2126 show_all_pollfds(pri
, offset
, nfds
);
2128 if (pri
->sys_nargs
> 2)
2129 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
2131 if (pri
->sys_nargs
> 3)
2132 show_sigset(pri
, (long)pri
->sys_args
[3], "sigmask");
2134 /* exit region of lengthy output */
2140 show_perm64(private_t
*pri
, struct ipc_perm64
*ip
)
2142 (void) printf("%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u z=%-5d "
2143 "m=0%.6o key=%d projid=%-5d\n",
2149 (int)ip
->ipcx_zoneid
,
2150 (unsigned int)ip
->ipcx_mode
,
2152 (int)ip
->ipcx_projid
);
2156 show_perm(private_t
*pri
, struct ipc_perm
*ip
)
2159 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2172 show_perm32(private_t
*pri
, struct ipc_perm32
*ip
)
2175 "%s\tu=%-5u g=%-5u cu=%-5u cg=%-5u m=0%.6o seq=%u key=%d\n",
2188 show_msgctl64(private_t
*pri
, long offset
)
2190 struct msqid_ds64 msgq
;
2192 if (offset
!= NULL
&&
2193 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2194 show_perm64(pri
, &msgq
.msgx_perm
);
2196 (void) printf("%s\tbytes=%-5llu msgs=%-5llu maxby=%-5llu "
2197 "lspid=%-5d lrpid=%-5d\n", pri
->pname
,
2198 (unsigned long long)msgq
.msgx_cbytes
,
2199 (unsigned long long)msgq
.msgx_qnum
,
2200 (unsigned long long)msgq
.msgx_qbytes
,
2201 (int)msgq
.msgx_lspid
,
2202 (int)msgq
.msgx_lrpid
);
2204 prtime(pri
, " st = ", (time_t)msgq
.msgx_stime
);
2205 prtime(pri
, " rt = ", (time_t)msgq
.msgx_rtime
);
2206 prtime(pri
, " ct = ", (time_t)msgq
.msgx_ctime
);
2211 show_msgctl(private_t
*pri
, long offset
)
2213 struct msqid_ds msgq
;
2215 if (offset
!= NULL
&&
2216 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2217 show_perm(pri
, &msgq
.msg_perm
);
2220 "%s\tbytes=%-5lu msgs=%-5lu maxby=%-5lu lspid=%-5u lrpid=%-5u\n",
2225 (int)msgq
.msg_lspid
,
2226 (int)msgq
.msg_lrpid
);
2228 prtime(pri
, " st = ", msgq
.msg_stime
);
2229 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2230 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2236 show_msgctl32(private_t
*pri
, long offset
)
2238 struct msqid_ds32 msgq
;
2240 if (offset
!= NULL
&&
2241 Pread(Proc
, &msgq
, sizeof (msgq
), offset
) == sizeof (msgq
)) {
2242 show_perm32(pri
, &msgq
.msg_perm
);
2245 "%s\tbytes=%-5u msgs=%-5u maxby=%-5u lspid=%-5u lrpid=%-5u\n",
2253 prtime(pri
, " st = ", msgq
.msg_stime
);
2254 prtime(pri
, " rt = ", msgq
.msg_rtime
);
2255 prtime(pri
, " ct = ", msgq
.msg_ctime
);
2261 show_msgbuf(private_t
*pri
, long offset
, long msgsz
)
2265 if (offset
!= NULL
&&
2266 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2267 sizeof (msgb
.mtype
)) {
2268 /* enter region of lengthy output */
2269 if (msgsz
> MYBUFSIZ
/ 4)
2272 (void) printf("%s\tmtype=%lu mtext[]=\n",
2276 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2278 /* exit region of lengthy output */
2279 if (msgsz
> MYBUFSIZ
/ 4)
2286 show_msgbuf32(private_t
*pri
, long offset
, long msgsz
)
2288 struct ipcmsgbuf32 msgb
;
2290 if (offset
!= NULL
&&
2291 Pread(Proc
, &msgb
, sizeof (msgb
.mtype
), offset
) ==
2292 sizeof (msgb
.mtype
)) {
2293 /* enter region of lengthy output */
2294 if (msgsz
> MYBUFSIZ
/ 4)
2297 (void) printf("%s\tmtype=%u mtext[]=\n",
2301 (long)(offset
+ sizeof (msgb
.mtype
)), msgsz
);
2303 /* exit region of lengthy output */
2304 if (msgsz
> MYBUFSIZ
/ 4)
2312 show_msgsys(private_t
*pri
, long msgsz
)
2314 switch (pri
->sys_args
[0]) {
2315 case 0: /* msgget() */
2317 case 1: /* msgctl() */
2318 if (pri
->sys_nargs
> 3) {
2319 switch (pri
->sys_args
[2]) {
2325 if (data_model
== PR_MODEL_LP64
)
2327 (long)pri
->sys_args
[3]);
2330 (long)pri
->sys_args
[3]);
2337 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2342 case 2: /* msgrcv() */
2343 if (!pri
->Errno
&& pri
->sys_nargs
> 2) {
2344 if (data_model
== PR_MODEL_LP64
)
2345 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2347 show_msgbuf32(pri
, pri
->sys_args
[2], msgsz
);
2350 case 3: /* msgsnd() */
2351 if (pri
->sys_nargs
> 3) {
2352 if (data_model
== PR_MODEL_LP64
)
2353 show_msgbuf(pri
, pri
->sys_args
[2],
2356 show_msgbuf32(pri
, pri
->sys_args
[2],
2360 case 4: /* msgids() */
2361 case 5: /* msgsnap() */
2362 default: /* unexpected subcode */
2368 show_msgsys(private_t
*pri
, long msgsz
)
2370 switch (pri
->sys_args
[0]) {
2371 case 0: /* msgget() */
2373 case 1: /* msgctl() */
2374 if (pri
->sys_nargs
> 3) {
2375 switch (pri
->sys_args
[2]) {
2381 show_msgctl(pri
, (long)pri
->sys_args
[3]);
2388 show_msgctl64(pri
, (long)pri
->sys_args
[3]);
2393 case 2: /* msgrcv() */
2394 if (!pri
->Errno
&& pri
->sys_nargs
> 2)
2395 show_msgbuf(pri
, pri
->sys_args
[2], msgsz
);
2397 case 3: /* msgsnd() */
2398 if (pri
->sys_nargs
> 3)
2399 show_msgbuf(pri
, pri
->sys_args
[2],
2402 case 4: /* msgids() */
2403 case 5: /* msgsnap() */
2404 default: /* unexpected subcode */
2411 show_semctl64(private_t
*pri
, long offset
)
2413 struct semid_ds64 semds
;
2415 if (offset
!= NULL
&&
2416 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2417 show_perm64(pri
, &semds
.semx_perm
);
2419 (void) printf("%s\tnsems=%u\n", pri
->pname
, semds
.semx_nsems
);
2421 prtime(pri
, " ot = ", (time_t)semds
.semx_otime
);
2422 prtime(pri
, " ct = ", (time_t)semds
.semx_ctime
);
2427 show_semctl(private_t
*pri
, long offset
)
2429 struct semid_ds semds
;
2431 if (offset
!= NULL
&&
2432 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2433 show_perm(pri
, &semds
.sem_perm
);
2435 (void) printf("%s\tnsems=%u\n",
2439 prtime(pri
, " ot = ", semds
.sem_otime
);
2440 prtime(pri
, " ct = ", semds
.sem_ctime
);
2446 show_semctl32(private_t
*pri
, long offset
)
2448 struct semid_ds32 semds
;
2450 if (offset
!= NULL
&&
2451 Pread(Proc
, &semds
, sizeof (semds
), offset
) == sizeof (semds
)) {
2452 show_perm32(pri
, &semds
.sem_perm
);
2454 (void) printf("%s\tnsems=%u\n",
2458 prtime(pri
, " ot = ", semds
.sem_otime
);
2459 prtime(pri
, " ct = ", semds
.sem_ctime
);
2465 show_semop(private_t
*pri
, long offset
, long nsops
, long timeout
)
2467 struct sembuf sembuf
;
2473 if (nsops
> 40) /* let's not be ridiculous */
2476 for (; nsops
> 0 && !interrupt
; --nsops
, offset
+= sizeof (sembuf
)) {
2477 if (Pread(Proc
, &sembuf
, sizeof (sembuf
), offset
) !=
2481 (void) printf("%s\tsemnum=%-5u semop=%-5d semflg=",
2486 if (sembuf
.sem_flg
== 0)
2487 (void) printf("0\n");
2488 else if ((str
= semflags(pri
, sembuf
.sem_flg
)) != NULL
)
2489 (void) printf("%s\n", str
);
2491 (void) printf("0%.6o\n", sembuf
.sem_flg
);
2494 show_timestruc(pri
, timeout
, "timeout");
2498 show_semsys(private_t
*pri
)
2500 switch (pri
->sys_args
[0]) {
2501 case 0: /* semctl() */
2502 if (pri
->sys_nargs
> 4) {
2503 switch (pri
->sys_args
[3]) {
2510 if (data_model
== PR_MODEL_LP64
)
2512 (long)pri
->sys_args
[4]);
2515 (long)pri
->sys_args
[4]);
2517 show_semctl(pri
, (long)pri
->sys_args
[4]);
2525 show_semctl64(pri
, (long)pri
->sys_args
[4]);
2530 case 1: /* semget() */
2532 case 2: /* semop() */
2533 if (pri
->sys_nargs
> 3)
2534 show_semop(pri
, (long)pri
->sys_args
[2],
2535 pri
->sys_args
[3], 0);
2537 case 3: /* semids() */
2539 case 4: /* semtimedop() */
2540 if (pri
->sys_nargs
> 4)
2541 show_semop(pri
, (long)pri
->sys_args
[2],
2542 pri
->sys_args
[3], pri
->sys_args
[4]);
2544 default: /* unexpected subcode */
2550 show_shmctl64(private_t
*pri
, long offset
)
2552 struct shmid_ds64 shmds
;
2554 if (offset
!= NULL
&&
2555 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2556 show_perm64(pri
, &shmds
.shmx_perm
);
2559 "%s\tsize=%-6llu lpid=%-5d cpid=%-5d na=%-5llu cna=%llu\n",
2561 (unsigned long long)shmds
.shmx_segsz
,
2562 (int)shmds
.shmx_lpid
,
2563 (int)shmds
.shmx_cpid
,
2564 (unsigned long long)shmds
.shmx_nattch
,
2565 (unsigned long long)shmds
.shmx_cnattch
);
2567 prtime(pri
, " at = ", (time_t)shmds
.shmx_atime
);
2568 prtime(pri
, " dt = ", (time_t)shmds
.shmx_dtime
);
2569 prtime(pri
, " ct = ", (time_t)shmds
.shmx_ctime
);
2574 show_shmctl(private_t
*pri
, long offset
)
2576 struct shmid_ds shmds
;
2578 if (offset
!= NULL
&&
2579 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2580 show_perm(pri
, &shmds
.shm_perm
);
2583 "%s\tsize=%-6lu lpid=%-5u cpid=%-5u na=%-5lu cna=%lu\n",
2585 (ulong_t
)shmds
.shm_segsz
,
2586 (int)shmds
.shm_lpid
,
2587 (int)shmds
.shm_cpid
,
2591 prtime(pri
, " at = ", shmds
.shm_atime
);
2592 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2593 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2599 show_shmctl32(private_t
*pri
, long offset
)
2601 struct shmid_ds32 shmds
;
2603 if (offset
!= NULL
&&
2604 Pread(Proc
, &shmds
, sizeof (shmds
), offset
) == sizeof (shmds
)) {
2605 show_perm32(pri
, &shmds
.shm_perm
);
2608 "%s\tsize=%-6u lpid=%-5u cpid=%-5u na=%-5u cna=%u\n",
2616 prtime(pri
, " at = ", shmds
.shm_atime
);
2617 prtime(pri
, " dt = ", shmds
.shm_dtime
);
2618 prtime(pri
, " ct = ", shmds
.shm_ctime
);
2624 show_shmsys(private_t
*pri
)
2626 switch (pri
->sys_args
[0]) {
2627 case 0: /* shmat() */
2629 case 1: /* shmctl() */
2630 if (pri
->sys_nargs
> 3) {
2631 switch (pri
->sys_args
[2]) {
2638 if (data_model
== PR_MODEL_LP64
)
2640 (long)pri
->sys_args
[3]);
2643 (long)pri
->sys_args
[3]);
2645 show_shmctl(pri
, (long)pri
->sys_args
[3]);
2653 show_shmctl64(pri
, (long)pri
->sys_args
[3]);
2658 case 2: /* shmdt() */
2659 case 3: /* shmget() */
2660 case 4: /* shmids() */
2661 default: /* unexpected subcode */
2667 show_groups(private_t
*pri
, long offset
, long count
)
2674 if (count
> 0 && offset
!= NULL
&&
2675 Pread(Proc
, &groups
[0], count
*sizeof (int), offset
) ==
2676 count
*sizeof (int)) {
2679 (void) printf("%s\t", pri
->pname
);
2680 for (n
= 0; !interrupt
&& n
< count
; n
++) {
2681 if (n
!= 0 && n
%10 == 0)
2682 (void) printf("\n%s\t", pri
->pname
);
2683 (void) printf(" %5d", groups
[n
]);
2685 (void) fputc('\n', stdout
);
2690 * This assumes that a sigset_t is simply an array of ints.
2693 sigset_string(private_t
*pri
, sigset_t
*sp
)
2695 char *s
= pri
->code_buf
;
2696 int n
= sizeof (*sp
) / sizeof (int32_t);
2697 int32_t *lp
= (int32_t *)sp
;
2700 int32_t val
= *lp
++;
2703 s
+= sprintf(s
, " 0");
2705 s
+= sprintf(s
, " 0x%.8X", val
);
2708 return (pri
->code_buf
);
2712 show_sigset(private_t
*pri
, long offset
, const char *name
)
2716 if (offset
!= NULL
&&
2717 Pread(Proc
, &sigset
, sizeof (sigset
), offset
) == sizeof (sigset
)) {
2718 (void) printf("%s\t%s =%s\n",
2719 pri
->pname
, name
, sigset_string(pri
, &sigset
));
2725 show_sigaltstack32(private_t
*pri
, long offset
, const char *name
)
2727 struct sigaltstack32 altstack
;
2729 if (offset
!= NULL
&&
2730 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2731 sizeof (altstack
)) {
2732 (void) printf("%s\t%s: sp=0x%.8X size=%u flags=0x%.4X\n",
2743 show_sigaltstack(private_t
*pri
, long offset
, const char *name
)
2745 struct sigaltstack altstack
;
2748 if (data_model
!= PR_MODEL_LP64
) {
2749 show_sigaltstack32(pri
, offset
, name
);
2753 if (offset
!= NULL
&&
2754 Pread(Proc
, &altstack
, sizeof (altstack
), offset
) ==
2755 sizeof (altstack
)) {
2756 (void) printf("%s\t%s: sp=0x%.8lX size=%lu flags=0x%.4X\n",
2759 (ulong_t
)altstack
.ss_sp
,
2760 (ulong_t
)altstack
.ss_size
,
2767 show_sigaction32(private_t
*pri
, long offset
, const char *name
, long odisp
)
2769 struct sigaction32 sigaction
;
2771 if (offset
!= NULL
&&
2772 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2773 sizeof (sigaction
)) {
2774 /* This is stupid, we shouldn't have to do this */
2776 sigaction
.sa_handler
= (caddr32_t
)odisp
;
2778 "%s %s: hand = 0x%.8X mask =%s flags = 0x%.4X\n",
2781 sigaction
.sa_handler
,
2782 sigset_string(pri
, (sigset_t
*)&sigaction
.sa_mask
),
2783 sigaction
.sa_flags
);
2789 show_sigaction(private_t
*pri
, long offset
, const char *name
, long odisp
)
2791 struct sigaction sigaction
;
2794 if (data_model
!= PR_MODEL_LP64
) {
2795 show_sigaction32(pri
, offset
, name
, odisp
);
2799 if (offset
!= NULL
&&
2800 Pread(Proc
, &sigaction
, sizeof (sigaction
), offset
) ==
2801 sizeof (sigaction
)) {
2802 /* This is stupid, we shouldn't have to do this */
2804 sigaction
.sa_handler
= (void (*)())odisp
;
2806 "%s %s: hand = 0x%.8lX mask =%s flags = 0x%.4X\n",
2809 (long)sigaction
.sa_handler
,
2810 sigset_string(pri
, &sigaction
.sa_mask
),
2811 sigaction
.sa_flags
);
2817 print_siginfo32(private_t
*pri
, const siginfo32_t
*sip
)
2819 const char *code
= NULL
;
2821 (void) printf("%s siginfo: %s", pri
->pname
,
2822 signame(pri
, sip
->si_signo
));
2824 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2825 (void) printf(" pid=%d uid=%d", sip
->si_pid
, sip
->si_uid
);
2826 if (sip
->si_code
!= 0)
2827 (void) printf(" code=%d", sip
->si_code
);
2828 (void) fputc('\n', stdout
);
2832 switch (sip
->si_signo
) {
2834 (void) fputc('\n', stdout
);
2848 switch (sip
->si_signo
) {
2850 switch (sip
->si_code
) {
2851 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
2852 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
2853 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
2854 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
2855 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
2856 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
2857 case ILL_COPROC
: code
= "ILL_COPROC"; break;
2858 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
2862 switch (sip
->si_code
) {
2863 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
2864 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
2865 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
2866 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
2867 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
2868 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
2872 switch (sip
->si_code
) {
2873 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
2874 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
2875 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
2876 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
2877 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
2878 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
2879 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
2880 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
2881 #if defined(FPE_FLTDEN)
2882 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
2887 switch (sip
->si_code
) {
2888 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
2889 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
2893 switch (sip
->si_code
) {
2895 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
2897 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
2901 switch (sip
->si_code
) {
2902 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
2903 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
2904 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
2908 switch (sip
->si_code
) {
2909 case CLD_EXITED
: code
= "CLD_EXITED"; break;
2910 case CLD_KILLED
: code
= "CLD_KILLED"; break;
2911 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
2912 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
2913 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
2914 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
2918 switch (sip
->si_code
) {
2919 case POLL_IN
: code
= "POLL_IN"; break;
2920 case POLL_OUT
: code
= "POLL_OUT"; break;
2921 case POLL_MSG
: code
= "POLL_MSG"; break;
2922 case POLL_ERR
: code
= "POLL_ERR"; break;
2923 case POLL_PRI
: code
= "POLL_PRI"; break;
2924 case POLL_HUP
: code
= "POLL_HUP"; break;
2930 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
2931 code
= (const char *)pri
->code_buf
;
2934 switch (sip
->si_signo
) {
2941 (void) printf(" %s addr=0x%.8X",
2946 (void) printf(" %s pid=%d status=0x%.4X",
2953 (void) printf(" %s fd=%d band=%d",
2960 if (sip
->si_errno
!= 0) {
2961 const char *ename
= errname(sip
->si_errno
);
2963 (void) printf(" errno=%d", sip
->si_errno
);
2965 (void) printf("(%s)", ename
);
2968 (void) fputc('\n', stdout
);
2973 print_siginfo(private_t
*pri
, const siginfo_t
*sip
)
2975 const char *code
= NULL
;
2977 (void) printf("%s siginfo: %s", pri
->pname
,
2978 signame(pri
, sip
->si_signo
));
2980 if (sip
->si_signo
!= 0 && SI_FROMUSER(sip
) && sip
->si_pid
!= 0) {
2981 (void) printf(" pid=%d uid=%u",
2984 if (sip
->si_code
!= 0)
2985 (void) printf(" code=%d", sip
->si_code
);
2986 (void) fputc('\n', stdout
);
2990 switch (sip
->si_signo
) {
2992 (void) fputc('\n', stdout
);
3006 switch (sip
->si_signo
) {
3008 switch (sip
->si_code
) {
3009 case ILL_ILLOPC
: code
= "ILL_ILLOPC"; break;
3010 case ILL_ILLOPN
: code
= "ILL_ILLOPN"; break;
3011 case ILL_ILLADR
: code
= "ILL_ILLADR"; break;
3012 case ILL_ILLTRP
: code
= "ILL_ILLTRP"; break;
3013 case ILL_PRVOPC
: code
= "ILL_PRVOPC"; break;
3014 case ILL_PRVREG
: code
= "ILL_PRVREG"; break;
3015 case ILL_COPROC
: code
= "ILL_COPROC"; break;
3016 case ILL_BADSTK
: code
= "ILL_BADSTK"; break;
3020 switch (sip
->si_code
) {
3021 case TRAP_BRKPT
: code
= "TRAP_BRKPT"; break;
3022 case TRAP_TRACE
: code
= "TRAP_TRACE"; break;
3023 case TRAP_RWATCH
: code
= "TRAP_RWATCH"; break;
3024 case TRAP_WWATCH
: code
= "TRAP_WWATCH"; break;
3025 case TRAP_XWATCH
: code
= "TRAP_XWATCH"; break;
3026 case TRAP_DTRACE
: code
= "TRAP_DTRACE"; break;
3030 switch (sip
->si_code
) {
3031 case FPE_INTDIV
: code
= "FPE_INTDIV"; break;
3032 case FPE_INTOVF
: code
= "FPE_INTOVF"; break;
3033 case FPE_FLTDIV
: code
= "FPE_FLTDIV"; break;
3034 case FPE_FLTOVF
: code
= "FPE_FLTOVF"; break;
3035 case FPE_FLTUND
: code
= "FPE_FLTUND"; break;
3036 case FPE_FLTRES
: code
= "FPE_FLTRES"; break;
3037 case FPE_FLTINV
: code
= "FPE_FLTINV"; break;
3038 case FPE_FLTSUB
: code
= "FPE_FLTSUB"; break;
3039 #if defined(FPE_FLTDEN)
3040 case FPE_FLTDEN
: code
= "FPE_FLTDEN"; break;
3045 switch (sip
->si_code
) {
3046 case SEGV_MAPERR
: code
= "SEGV_MAPERR"; break;
3047 case SEGV_ACCERR
: code
= "SEGV_ACCERR"; break;
3051 switch (sip
->si_code
) {
3053 case EMT_TAGOVF
: code
= "EMT_TAGOVF"; break;
3055 case EMT_CPCOVF
: code
= "EMT_CPCOVF"; break;
3059 switch (sip
->si_code
) {
3060 case BUS_ADRALN
: code
= "BUS_ADRALN"; break;
3061 case BUS_ADRERR
: code
= "BUS_ADRERR"; break;
3062 case BUS_OBJERR
: code
= "BUS_OBJERR"; break;
3066 switch (sip
->si_code
) {
3067 case CLD_EXITED
: code
= "CLD_EXITED"; break;
3068 case CLD_KILLED
: code
= "CLD_KILLED"; break;
3069 case CLD_DUMPED
: code
= "CLD_DUMPED"; break;
3070 case CLD_TRAPPED
: code
= "CLD_TRAPPED"; break;
3071 case CLD_STOPPED
: code
= "CLD_STOPPED"; break;
3072 case CLD_CONTINUED
: code
= "CLD_CONTINUED"; break;
3076 switch (sip
->si_code
) {
3077 case POLL_IN
: code
= "POLL_IN"; break;
3078 case POLL_OUT
: code
= "POLL_OUT"; break;
3079 case POLL_MSG
: code
= "POLL_MSG"; break;
3080 case POLL_ERR
: code
= "POLL_ERR"; break;
3081 case POLL_PRI
: code
= "POLL_PRI"; break;
3082 case POLL_HUP
: code
= "POLL_HUP"; break;
3088 (void) sprintf(pri
->code_buf
, "code=%d", sip
->si_code
);
3089 code
= (const char *)pri
->code_buf
;
3092 switch (sip
->si_signo
) {
3099 (void) printf(" %s addr=0x%.8lX",
3101 (long)sip
->si_addr
);
3104 (void) printf(" %s pid=%d status=0x%.4X",
3111 (void) printf(" %s fd=%d band=%ld",
3118 if (sip
->si_errno
!= 0) {
3119 const char *ename
= errname(sip
->si_errno
);
3121 (void) printf(" errno=%d", sip
->si_errno
);
3123 (void) printf("(%s)", ename
);
3126 (void) fputc('\n', stdout
);
3131 show_siginfo32(private_t
*pri
, long offset
)
3133 struct siginfo32 siginfo
;
3135 if (offset
!= NULL
&&
3136 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3137 print_siginfo32(pri
, &siginfo
);
3142 show_siginfo(private_t
*pri
, long offset
)
3144 struct siginfo siginfo
;
3147 if (data_model
!= PR_MODEL_LP64
) {
3148 show_siginfo32(pri
, offset
);
3152 if (offset
!= NULL
&&
3153 Pread(Proc
, &siginfo
, sizeof (siginfo
), offset
) == sizeof (siginfo
))
3154 print_siginfo(pri
, &siginfo
);
3158 show_bool(private_t
*pri
, long offset
, int count
)
3160 int serial
= (count
> MYBUFSIZ
/ 4);
3162 /* enter region of lengthy output */
3168 int nb
= (count
< 32)? count
: 32;
3171 if (Pread(Proc
, buf
, (size_t)nb
, offset
) != nb
)
3174 (void) printf("%s ", pri
->pname
);
3175 for (i
= 0; i
< nb
; i
++)
3176 (void) printf(" %d", buf
[i
]);
3177 (void) fputc('\n', stdout
);
3183 /* exit region of lengthy output */
3190 show_iovec32(private_t
*pri
, long offset
, int niov
, int showbuf
, long count
)
3192 iovec32_t iovec
[16];
3195 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3197 if (niov
> 16) /* is this the real limit? */
3200 if (offset
!= NULL
&& niov
> 0 &&
3201 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec32_t
), offset
)
3202 == niov
*sizeof (iovec32_t
)) {
3203 /* enter region of lengthy output */
3207 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3208 (void) printf("%s\tiov_base = 0x%.8X iov_len = %d\n",
3212 if ((nb
= count
) > 0) {
3213 if (nb
> ip
->iov_len
)
3218 if (showbuf
&& nb
> 0)
3219 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3222 /* exit region of lengthy output */
3230 show_iovec(private_t
*pri
, long offset
, long niov
, int showbuf
, long count
)
3235 int serial
= (count
> MYBUFSIZ
/ 4 && showbuf
);
3238 if (data_model
!= PR_MODEL_LP64
) {
3239 show_iovec32(pri
, offset
, niov
, showbuf
, count
);
3243 if (niov
> 16) /* is this the real limit? */
3246 if (offset
!= NULL
&& niov
> 0 &&
3247 Pread(Proc
, &iovec
[0], niov
*sizeof (iovec_t
), offset
)
3248 == niov
*sizeof (iovec_t
)) {
3249 /* enter region of lengthy output */
3253 for (ip
= &iovec
[0]; niov
-- && !interrupt
; ip
++) {
3254 (void) printf("%s\tiov_base = 0x%.8lX iov_len = %lu\n",
3258 if ((nb
= count
) > 0) {
3259 if (nb
> ip
->iov_len
)
3264 if (showbuf
&& nb
> 0)
3265 showbuffer(pri
, (long)ip
->iov_base
, nb
);
3268 /* exit region of lengthy output */
3275 show_dents32(private_t
*pri
, long offset
, long count
)
3277 long buf
[MYBUFSIZ
/ sizeof (long)];
3278 struct dirent32
*dp
;
3279 int serial
= (count
> 100);
3284 /* enter region of lengthy output */
3288 while (count
> 0 && !interrupt
) {
3289 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3291 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3294 dp
= (struct dirent32
*)&buf
[0];
3295 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3297 if ((unsigned)nb
< dp
->d_reclen
) {
3298 /* getdents() error? */
3300 "%s ino=%-5u off=%-4d rlen=%-3d\n",
3308 while (!interrupt
&&
3309 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3310 (unsigned)nb
>= dp
->d_reclen
) {
3312 "%s ino=%-5u off=%-4d rlen=%-3d \"%.*s\"\n",
3317 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3320 count
-= dp
->d_reclen
;
3321 offset
+= dp
->d_reclen
;
3322 /* LINTED improper alignment */
3323 dp
= (struct dirent32
*)((char *)dp
+ dp
->d_reclen
);
3327 /* exit region of lengthy output */
3333 show_dents64(private_t
*pri
, long offset
, long count
)
3335 long long buf
[MYBUFSIZ
/ sizeof (long long)];
3336 struct dirent64
*dp
;
3337 int serial
= (count
> 100);
3342 /* enter region of lengthy output */
3346 while (count
> 0 && !interrupt
) {
3347 int nb
= count
< MYBUFSIZ
? (int)count
: MYBUFSIZ
;
3349 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) <= 0)
3352 dp
= (struct dirent64
*)&buf
[0];
3353 if (nb
< (int)(dp
->d_name
- (char *)dp
))
3355 if ((unsigned)nb
< dp
->d_reclen
) {
3356 /* getdents() error? */
3358 "%s ino=%-5llu off=%-4lld rlen=%-3d\n",
3360 (long long)dp
->d_ino
,
3361 (long long)dp
->d_off
,
3366 while (!interrupt
&&
3367 nb
>= (int)(dp
->d_name
- (char *)dp
) &&
3368 (unsigned)nb
>= dp
->d_reclen
) {
3370 "%s ino=%-5llu off=%-4lld rlen=%-3d \"%.*s\"\n",
3372 (long long)dp
->d_ino
,
3373 (long long)dp
->d_off
,
3375 dp
->d_reclen
- (int)(dp
->d_name
- (char *)dp
),
3378 count
-= dp
->d_reclen
;
3379 offset
+= dp
->d_reclen
;
3380 /* LINTED improper alignment */
3381 dp
= (struct dirent64
*)((char *)dp
+ dp
->d_reclen
);
3385 /* exit region of lengthy output */
3391 show_rlimit32(private_t
*pri
, long offset
)
3393 struct rlimit32 rlimit
;
3395 if (offset
!= NULL
&&
3396 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3397 (void) printf("%s\t", pri
->pname
);
3398 switch (rlimit
.rlim_cur
) {
3399 case RLIM32_INFINITY
:
3400 (void) fputs("cur = RLIM_INFINITY", stdout
);
3402 case RLIM32_SAVED_MAX
:
3403 (void) fputs("cur = RLIM_SAVED_MAX", stdout
);
3405 case RLIM32_SAVED_CUR
:
3406 (void) fputs("cur = RLIM_SAVED_CUR", stdout
);
3409 (void) printf("cur = %lu", (long)rlimit
.rlim_cur
);
3412 switch (rlimit
.rlim_max
) {
3413 case RLIM32_INFINITY
:
3414 (void) fputs(" max = RLIM_INFINITY\n", stdout
);
3416 case RLIM32_SAVED_MAX
:
3417 (void) fputs(" max = RLIM_SAVED_MAX\n", stdout
);
3419 case RLIM32_SAVED_CUR
:
3420 (void) fputs(" max = RLIM_SAVED_CUR\n", stdout
);
3423 (void) printf(" max = %lu\n", (long)rlimit
.rlim_max
);
3430 show_rlimit64(private_t
*pri
, long offset
)
3432 struct rlimit64 rlimit
;
3434 if (offset
!= NULL
&&
3435 Pread(Proc
, &rlimit
, sizeof (rlimit
), offset
) == sizeof (rlimit
)) {
3436 (void) printf("%s\t", pri
->pname
);
3437 switch (rlimit
.rlim_cur
) {
3438 case RLIM64_INFINITY
:
3439 (void) fputs("cur = RLIM64_INFINITY", stdout
);
3441 case RLIM64_SAVED_MAX
:
3442 (void) fputs("cur = RLIM64_SAVED_MAX", stdout
);
3444 case RLIM64_SAVED_CUR
:
3445 (void) fputs("cur = RLIM64_SAVED_CUR", stdout
);
3448 (void) printf("cur = %llu",
3449 (unsigned long long)rlimit
.rlim_cur
);
3452 switch (rlimit
.rlim_max
) {
3453 case RLIM64_INFINITY
:
3454 (void) fputs(" max = RLIM64_INFINITY\n", stdout
);
3456 case RLIM64_SAVED_MAX
:
3457 (void) fputs(" max = RLIM64_SAVED_MAX\n", stdout
);
3459 case RLIM64_SAVED_CUR
:
3460 (void) fputs(" max = RLIM64_SAVED_CUR\n", stdout
);
3463 (void) printf(" max = %llu\n",
3464 (unsigned long long)rlimit
.rlim_max
);
3471 show_nuname(private_t
*pri
, long offset
)
3473 struct utsname ubuf
;
3475 if (offset
!= NULL
&&
3476 Pread(Proc
, &ubuf
, sizeof (ubuf
), offset
) == sizeof (ubuf
)) {
3478 "%s\tsys=%s nod=%s rel=%s ver=%s mch=%s\n",
3489 show_adjtime(private_t
*pri
, long off1
, long off2
)
3491 show_timeval(pri
, off1
, " delta");
3492 show_timeval(pri
, off2
, "olddelta");
3496 show_sockaddr(private_t
*pri
,
3497 const char *str
, long addroff
, long lenoff
, long len
)
3500 * A buffer large enough for PATH_MAX size AF_UNIX address, which is
3501 * also large enough to store a sockaddr_in or a sockaddr_in6.
3503 long buf
[(sizeof (short) + PATH_MAX
+ sizeof (long) - 1)
3505 struct sockaddr
*sa
= (struct sockaddr
*)buf
;
3506 struct sockaddr_in
*sin
= (struct sockaddr_in
*)buf
;
3507 struct sockaddr_un
*soun
= (struct sockaddr_un
*)buf
;
3508 struct sockaddr_in6
*sin6
= (struct sockaddr_in6
*)buf
;
3509 char addrbuf
[INET6_ADDRSTRLEN
];
3513 if (Pread(Proc
, &ilen
, sizeof (ilen
), lenoff
) != sizeof (ilen
))
3518 if (len
>= sizeof (buf
)) /* protect against ridiculous length */
3519 len
= sizeof (buf
) - 1;
3520 if (Pread(Proc
, buf
, len
, addroff
) != len
)
3523 switch (sa
->sa_family
) {
3525 (void) printf("%s\tAF_INET6 %s = %s port = %u\n",
3527 inet_ntop(AF_INET6
, &sin6
->sin6_addr
, addrbuf
,
3529 ntohs(sin6
->sin6_port
));
3530 (void) printf("%s\tscope id = %u source id = 0x%x\n"
3531 "%s\tflow class = 0x%02x flow label = 0x%05x\n",
3532 pri
->pname
, ntohl(sin6
->sin6_scope_id
),
3533 ntohl(sin6
->__sin6_src_id
),
3535 ntohl((sin6
->sin6_flowinfo
& IPV6_FLOWINFO_TCLASS
) >> 20),
3536 ntohl(sin6
->sin6_flowinfo
& IPV6_FLOWINFO_FLOWLABEL
));
3539 (void) printf("%s\tAF_%s %s = %s port = %u\n",
3541 str
, inet_ntop(AF_INET
, &sin
->sin_addr
, addrbuf
,
3542 sizeof (addrbuf
)), ntohs(sin
->sin_port
));
3545 len
-= sizeof (soun
->sun_family
);
3547 /* Null terminate */
3548 soun
->sun_path
[len
] = NULL
;
3549 (void) printf("%s\tAF_UNIX %s = %s\n", pri
->pname
,
3550 str
, soun
->sun_path
);
3557 show_msghdr(private_t
*pri
, long offset
)
3559 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3560 int what
= Lsp
->pr_what
;
3561 int err
= pri
->Errno
;
3563 int showbuf
= FALSE
;
3564 int i
= pri
->sys_args
[0]+1;
3565 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3567 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3570 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3571 show_sockaddr(pri
, "msg_name",
3572 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3575 * Print the iovec if the syscall was successful and the fd is
3576 * part of the set being traced.
3578 if ((what
== SYS_recvmsg
&& !err
&&
3579 prismember(&readfd
, i
)) ||
3580 (what
== SYS_sendmsg
&&
3581 prismember(&writefd
, i
)))
3584 show_iovec(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3590 show_msghdr32(private_t
*pri
, long offset
)
3594 uint32_t msg_namelen
;
3598 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
3599 int what
= Lsp
->pr_what
;
3600 int err
= pri
->Errno
;
3601 int showbuf
= FALSE
;
3602 int i
= pri
->sys_args
[0]+1;
3603 long nb
= (what
== SYS_recvmsg
)? pri
->Rval1
: 32*1024;
3605 if (Pread(Proc
, &msg
, sizeof (msg
), offset
) != sizeof (msg
))
3608 if (msg
.msg_name
!= NULL
&& msg
.msg_namelen
!= 0)
3609 show_sockaddr(pri
, "msg_name",
3610 (long)msg
.msg_name
, 0, (long)msg
.msg_namelen
);
3612 * Print the iovec if the syscall was successful and the fd is
3613 * part of the set being traced.
3615 if ((what
== SYS_recvmsg
&& !err
&&
3616 prismember(&readfd
, i
)) ||
3617 (what
== SYS_sendmsg
&&
3618 prismember(&writefd
, i
)))
3621 show_iovec32(pri
, (long)msg
.msg_iov
, msg
.msg_iovlen
, showbuf
, nb
);
3627 show_doorargs(private_t
*pri
, long offset
)
3631 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3632 (void) printf("%s\tdata_ptr=0x%lX data_size=%lu\n",
3634 (ulong_t
)args
.data_ptr
,
3635 (ulong_t
)args
.data_size
);
3636 (void) printf("%s\tdesc_ptr=0x%lX desc_num=%u\n",
3638 (ulong_t
)args
.desc_ptr
,
3640 (void) printf("%s\trbuf=0x%lX rsize=%lu\n",
3643 (ulong_t
)args
.rsize
);
3648 show_ucred_privsets(private_t
*pri
, ucred_t
*uc
)
3651 const priv_set_t
*s
;
3655 while ((sn
= priv_getsetbynum(i
++)) != NULL
) {
3656 s
= ucred_getprivset(uc
, sn
);
3661 (void) printf("%s\t%c: %s\n",
3664 str
= priv_set_to_str(s
, ',', PRIV_STR_SHORT
));
3671 show_ucred(private_t
*pri
, long offset
)
3673 ucred_t
*uc
= _ucred_alloc();
3679 sz
= Pread(Proc
, uc
, uc
->uc_size
, offset
);
3682 * A new uc_size is read, it could be smaller than the previously
3683 * value. We accept short reads that fill the whole header.
3685 if (sz
>= sizeof (ucred_t
) && sz
>= uc
->uc_size
) {
3686 (void) printf("%s\teuid=%u egid=%u\n",
3690 (void) printf("%s\truid=%u rgid=%u\n",
3694 (void) printf("%s\tpid=%d zoneid=%d\n",
3696 (int)ucred_getpid(uc
),
3697 (int)ucred_getzoneid(uc
));
3698 show_ucred_privsets(pri
, uc
);
3704 show_privset(private_t
*pri
, long offset
, size_t size
, char *label
)
3706 priv_set_t
*tmp
= priv_allocset();
3712 sz
= Pread(Proc
, tmp
, size
, offset
);
3715 char *str
= priv_set_to_str(tmp
, ',', PRIV_STR_SHORT
);
3717 (void) printf("%s\t%s%s\n", pri
->pname
, label
, str
);
3725 show_doorinfo(private_t
*pri
, long offset
)
3730 if (Pread(Proc
, &info
, sizeof (info
), offset
) != sizeof (info
))
3732 (void) printf("%s\ttarget=%d proc=0x%llX data=0x%llX\n",
3734 (int)info
.di_target
,
3737 attr
= info
.di_attributes
;
3738 (void) printf("%s\tattributes=%s\n", pri
->pname
, door_flags(pri
, attr
));
3739 (void) printf("%s\tuniquifier=%llu\n", pri
->pname
, info
.di_uniquifier
);
3743 show_doorparam(private_t
*pri
, long offset
)
3747 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3748 (void) printf("%s\tvalue=%lu\n",
3757 show_doorargs32(private_t
*pri
, long offset
)
3759 struct door_arg32 args
;
3761 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3762 (void) printf("%s\tdata_ptr=%X data_size=%u\n",
3766 (void) printf("%s\tdesc_ptr=0x%X desc_num=%u\n",
3770 (void) printf("%s\trbuf=0x%X rsize=%u\n",
3778 show_doorparam32(private_t
*pri
, long offset
)
3782 if (Pread(Proc
, &val
, sizeof (val
), offset
) == sizeof (val
)) {
3783 (void) printf("%s\tvalue=%u\n",
3792 show_doors(private_t
*pri
)
3794 switch (pri
->sys_args
[5]) {
3797 if (data_model
== PR_MODEL_LP64
)
3798 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3800 show_doorargs32(pri
, (long)pri
->sys_args
[1]);
3802 show_doorargs(pri
, (long)pri
->sys_args
[1]);
3807 show_ucred(pri
, (long)pri
->sys_args
[0]);
3811 show_doorinfo(pri
, (long)pri
->sys_args
[1]);
3816 if (data_model
== PR_MODEL_LP64
)
3817 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3819 show_doorparam32(pri
, (long)pri
->sys_args
[2]);
3821 show_doorparam(pri
, (long)pri
->sys_args
[2]);
3829 show_portargs(private_t
*pri
, long offset
)
3833 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3834 (void) printf("%s\tevents=0x%x source=%u\n",
3837 args
.portev_source
);
3838 (void) printf("%s\tobject=0x%p user=0x%p\n",
3840 (void *)args
.portev_object
,
3841 (void *)args
.portev_user
);
3849 show_portargs32(private_t
*pri
, long offset
)
3851 port_event32_t args
;
3853 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
3854 (void) printf("%s\tevents=0x%x source=%u\n",
3857 args
.portev_source
);
3858 (void) printf("%s\tobject=0x%x user=0x%x\n",
3868 show_ports(private_t
*pri
)
3870 switch (pri
->sys_args
[0]) {
3873 if (data_model
== PR_MODEL_LP64
)
3874 show_portargs(pri
, (long)pri
->sys_args
[2]);
3876 show_portargs32(pri
, (long)pri
->sys_args
[2]);
3878 show_portargs(pri
, (long)pri
->sys_args
[2]);
3884 #define MAX_SNDFL_PRD 16
3889 show_ksendfilevec32(private_t
*pri
, int fd
,
3890 ksendfilevec32_t
*sndvec
, int sfvcnt
)
3892 ksendfilevec32_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3896 while (sfvcnt
> 0) {
3897 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3899 cpy_rqst
*= sizeof (snd
[0]);
3901 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3908 "sfv_fd=%d\tsfv_flag=0x%x\t"
3909 "sfv_off=%d\tsfv_len=%u\n",
3915 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3916 prismember(&writefd
, fd
)) {
3918 (long)snd_ptr
->sfv_off
& 0xffffffff,
3919 (long)snd_ptr
->sfv_len
);
3922 cpy_rqst
-= sizeof (snd
[0]);
3926 sndvec
+= MAX_SNDFL_PRD
;
3932 show_ksendfilevec64(private_t
*pri
, int fd
,
3933 ksendfilevec64_t
*sndvec
, int sfvcnt
)
3935 ksendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3939 while (sfvcnt
> 0) {
3940 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3942 cpy_rqst
*= sizeof (snd
[0]);
3944 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
3951 "sfv_fd=%d\tsfv_flag=0x%x\t"
3952 "sfv_off=%ld\tsfv_len=%u\n",
3958 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
3959 prismember(&writefd
, fd
)) {
3961 (long)snd_ptr
->sfv_off
& 0xffffffff,
3962 (long)snd_ptr
->sfv_len
);
3965 cpy_rqst
-= sizeof (snd
[0]);
3969 sndvec
+= MAX_SNDFL_PRD
;
3978 show_sendfilevec(private_t
*pri
, int fd
, sendfilevec_t
*sndvec
, int sfvcnt
)
3980 sendfilevec_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
3984 if (data_model
!= PR_MODEL_LP64
) {
3985 show_ksendfilevec32(pri
, fd
,
3986 (ksendfilevec32_t
*)sndvec
, sfvcnt
);
3991 while (sfvcnt
> 0) {
3992 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
3994 cpy_rqst
*= sizeof (snd
[0]);
3996 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
4003 "sfv_fd=%d\tsfv_flag=0x%x\t"
4004 "sfv_off=%ld\tsfv_len=%lu\n",
4008 (ulong_t
)snd_ptr
->sfv_len
);
4010 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
4011 prismember(&writefd
, fd
)) {
4012 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
4013 (long)snd_ptr
->sfv_len
);
4016 cpy_rqst
-= sizeof (snd
[0]);
4020 sndvec
+= MAX_SNDFL_PRD
;
4027 show_sendfilevec64(private_t
*pri
, int fd
, sendfilevec64_t
*sndvec
, int sfvcnt
)
4029 sendfilevec64_t
*snd_ptr
, snd
[MAX_SNDFL_PRD
];
4033 if (data_model
!= PR_MODEL_LP64
) {
4034 show_ksendfilevec64(pri
, fd
,
4035 (ksendfilevec64_t
*)sndvec
, sfvcnt
);
4041 while (sfvcnt
> 0) {
4042 cpy_rqst
= MIN(sfvcnt
, MAX_SNDFL_PRD
);
4044 cpy_rqst
*= sizeof (snd
[0]);
4046 if (Pread(Proc
, snd
, cpy_rqst
, (uintptr_t)sndvec
) != cpy_rqst
)
4054 "sfv_fd=%d\tsfv_flag=0x%x\t"
4055 "sfv_off=%ld\tsfv_len=%lu\n",
4057 "sfv_fd=%d\tsfv_flag=0x%x\t"
4058 "sfv_off=%lld\tsfv_len=%lu\n",
4063 (ulong_t
)snd_ptr
->sfv_len
);
4065 if (snd_ptr
->sfv_fd
== SFV_FD_SELF
&&
4066 prismember(&writefd
, fd
)) {
4067 showbuffer(pri
, (long)snd_ptr
->sfv_off
,
4068 (long)snd_ptr
->sfv_len
);
4071 cpy_rqst
-= sizeof (snd
[0]);
4075 sndvec
+= MAX_SNDFL_PRD
;
4081 show_memcntl_mha(private_t
*pri
, long offset
)
4083 struct memcntl_mha mha
;
4084 const char *s
= NULL
;
4086 if (Pread(Proc
, &mha
, sizeof (mha
), offset
) == sizeof (mha
)) {
4087 switch (mha
.mha_cmd
) {
4088 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4089 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4090 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4093 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4094 " mha_pagesize=%lu\n",
4095 pri
->pname
, s
, mha
.mha_flags
,
4096 (ulong_t
)mha
.mha_pagesize
);
4098 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4099 " mha_pagesize=%lu\n",
4100 pri
->pname
, mha
.mha_cmd
, mha
.mha_flags
,
4101 (ulong_t
)mha
.mha_pagesize
);
4108 show_memcntl_mha32(private_t
*pri
, long offset
)
4110 struct memcntl_mha32 mha32
;
4111 const char *s
= NULL
;
4113 if (Pread(Proc
, &mha32
, sizeof (mha32
), offset
) ==
4115 switch (mha32
.mha_cmd
) {
4116 case MHA_MAPSIZE_VA
: s
= "MHA_MAPSIZE_VA"; break;
4117 case MHA_MAPSIZE_BSSBRK
: s
= "MHA_MAPSIZE_BSSBRK"; break;
4118 case MHA_MAPSIZE_STACK
: s
= "MHA_MAPSIZE_STACK"; break;
4121 (void) printf("%s\tmha_cmd=%s mha_flags=0x%x"
4122 " mha_pagesize=%u\n",
4123 pri
->pname
, s
, mha32
.mha_flags
, mha32
.mha_pagesize
);
4125 (void) printf("%s\tmha_cmd=0x%.8x mha_flags=0x%x"
4126 " mha_pagesize=%u\n",
4127 pri
->pname
, mha32
.mha_cmd
, mha32
.mha_flags
,
4128 mha32
.mha_pagesize
);
4135 show_memcntl(private_t
*pri
)
4138 if ((int)pri
->sys_args
[2] != MC_HAT_ADVISE
)
4141 if (data_model
== PR_MODEL_LP64
)
4142 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4144 show_memcntl_mha32(pri
, (long)pri
->sys_args
[3]);
4146 show_memcntl_mha(pri
, (long)pri
->sys_args
[3]);
4151 show_ids(private_t
*pri
, long offset
, int count
)
4153 id_t buf
[MYBUFSIZ
/ sizeof (id_t
)];
4155 int serial
= (count
> MYBUFSIZ
/ 48);
4160 /* enter region of lengthy output */
4164 while (count
> 0 && !interrupt
) {
4165 ssize_t nb
= (count
* sizeof (id_t
) < MYBUFSIZ
)?
4166 count
* sizeof (id_t
) : MYBUFSIZ
;
4168 if ((nb
= Pread(Proc
, &buf
[0], (size_t)nb
, offset
)) < 0 ||
4173 while (!interrupt
&& nb
>= sizeof (id_t
)) {
4174 (void) printf("%s\t%8d\n", pri
->pname
, (int)*idp
);
4175 offset
+= sizeof (id_t
);
4176 nb
-= sizeof (id_t
);
4182 /* exit region of lengthy output */
4188 show_ntp_gettime(private_t
*pri
)
4190 struct ntptimeval ntv
;
4193 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
4196 if (data_model
== PR_MODEL_NATIVE
) {
4197 if (Pread(Proc
, &ntv
, sizeof (ntv
), offset
)
4201 struct ntptimeval32 ntv32
;
4203 if (Pread(Proc
, &ntv32
, sizeof (ntv32
), offset
)
4207 TIMEVAL32_TO_TIMEVAL(&ntv
.time
, &ntv32
.time
);
4208 ntv
.maxerror
= ntv32
.maxerror
;
4209 ntv
.esterror
= ntv32
.esterror
;
4212 (void) printf("\ttime: %ld.%6.6ld sec\n",
4213 ntv
.time
.tv_sec
, ntv
.time
.tv_usec
);
4214 (void) printf("\tmaxerror: %11d usec\n", ntv
.maxerror
);
4215 (void) printf("\testerror: %11d usec\n", ntv
.esterror
);
4219 get_timex_modes(private_t
*pri
, uint32_t val
)
4221 char *str
= pri
->code_buf
;
4225 if (val
& MOD_OFFSET
)
4226 used
= strlcat(str
, "|MOD_OFFSET", sizeof (pri
->code_buf
));
4227 if (val
& MOD_FREQUENCY
)
4228 used
= strlcat(str
, "|MOD_FREQUENCY", sizeof (pri
->code_buf
));
4229 if (val
& MOD_MAXERROR
)
4230 used
= strlcat(str
, "|MOD_MAXERROR", sizeof (pri
->code_buf
));
4231 if (val
& MOD_ESTERROR
)
4232 used
= strlcat(str
, "|MOD_ESTERROR", sizeof (pri
->code_buf
));
4233 if (val
& MOD_STATUS
)
4234 used
= strlcat(str
, "|MOD_STATUS", sizeof (pri
->code_buf
));
4235 if (val
& MOD_TIMECONST
)
4236 used
= strlcat(str
, "|MOD_TIMECONST", sizeof (pri
->code_buf
));
4238 used
= strlcat(str
, "|MOD_CLKB", sizeof (pri
->code_buf
));
4240 used
= strlcat(str
, "|MOD_CLKA", sizeof (pri
->code_buf
));
4242 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4243 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4249 get_timex_status(private_t
*pri
, int32_t val
)
4251 char *str
= pri
->code_buf
;
4256 used
= strlcat(str
, "|STA_PLL", sizeof (pri
->code_buf
));
4257 if (val
& STA_PPSFREQ
)
4258 used
= strlcat(str
, "|STA_PPSFREQ", sizeof (pri
->code_buf
));
4259 if (val
& STA_PPSTIME
)
4260 used
= strlcat(str
, "|STA_PPSTIME", sizeof (pri
->code_buf
));
4262 used
= strlcat(str
, "|STA_FLL", sizeof (pri
->code_buf
));
4265 used
= strlcat(str
, "|STA_INS", sizeof (pri
->code_buf
));
4267 used
= strlcat(str
, "|STA_DEL", sizeof (pri
->code_buf
));
4268 if (val
& STA_UNSYNC
)
4269 used
= strlcat(str
, "|STA_UNSYNC", sizeof (pri
->code_buf
));
4270 if (val
& STA_FREQHOLD
)
4271 used
= strlcat(str
, "|STA_FREQHOLD", sizeof (pri
->code_buf
));
4273 if (val
& STA_PPSSIGNAL
)
4274 used
= strlcat(str
, "|STA_PPSSIGNAL", sizeof (pri
->code_buf
));
4275 if (val
& STA_PPSJITTER
)
4276 used
= strlcat(str
, "|STA_PPSJITTER", sizeof (pri
->code_buf
));
4277 if (val
& STA_PPSWANDER
)
4278 used
= strlcat(str
, "|STA_PPSWANDER", sizeof (pri
->code_buf
));
4279 if (val
& STA_PPSERROR
)
4280 used
= strlcat(str
, "|STA_PPSERROR", sizeof (pri
->code_buf
));
4282 if (val
& STA_CLOCKERR
)
4283 used
= strlcat(str
, "|STA_CLOCKERR", sizeof (pri
->code_buf
));
4285 if (used
== 0 || used
>= sizeof (pri
->code_buf
))
4286 (void) snprintf(str
, sizeof (pri
->code_buf
), " 0x%.4x", val
);
4292 show_ntp_adjtime(private_t
*pri
)
4297 if (pri
->sys_nargs
< 1 || (offset
= pri
->sys_args
[0]) == NULL
)
4300 if (Pread(Proc
, &timex
, sizeof (timex
), offset
) != sizeof (timex
))
4303 (void) printf("\tmodes: %s\n", get_timex_modes(pri
, timex
.modes
));
4304 (void) printf("\toffset: %11d usec\n", timex
.offset
);
4305 (void) printf("\tfreq: %11d scaled ppm\n", timex
.freq
);
4306 (void) printf("\tmaxerror: %11d usec\n", timex
.maxerror
);
4307 (void) printf("\testerror: %11d usec\n", timex
.esterror
);
4308 (void) printf("\tstatus: %s\n", get_timex_status(pri
, timex
.status
));
4309 (void) printf("\tconstant: %11d\n", timex
.constant
);
4310 (void) printf("\tprecision: %11d usec\n", timex
.precision
);
4311 (void) printf("\ttolerance: %11d scaled ppm\n", timex
.tolerance
);
4312 (void) printf("\tppsfreq: %11d scaled ppm\n", timex
.ppsfreq
);
4313 (void) printf("\tjitter: %11d usec\n", timex
.jitter
);
4314 (void) printf("\tshift: %11d sec\n", timex
.shift
);
4315 (void) printf("\tstabil: %11d scaled ppm\n", timex
.stabil
);
4316 (void) printf("\tjitcnt: %11d\n", timex
.jitcnt
);
4317 (void) printf("\tcalcnt: %11d\n", timex
.calcnt
);
4318 (void) printf("\terrcnt: %11d\n", timex
.errcnt
);
4319 (void) printf("\tstbcnt: %11d\n", timex
.stbcnt
);
4323 show_getrusage(long offset
)
4326 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4328 (void) printf("\t user time: %ld.%6.6ld sec\n",
4330 r
.ru_utime
.tv_usec
);
4331 (void) printf("\t system time: %ld.%6.6ld sec\n",
4333 r
.ru_stime
.tv_usec
);
4334 (void) printf("\t max rss: <unimpl> %ld\n",
4336 (void) printf("\t shared data: <unimpl> %ld\n",
4338 (void) printf("\t unshared data: <unimpl> %ld\n",
4340 (void) printf("\t unshared stack: <unimpl> %ld\n",
4342 (void) printf("\t minor faults: %ld\n",
4344 (void) printf("\t major faults: %ld\n",
4346 (void) printf("\t # of swaps: %ld\n",
4348 (void) printf("\t blocked inputs: %ld\n",
4350 (void) printf("\t blocked outputs: %ld\n",
4352 (void) printf("\t msgs sent: %ld\n",
4354 (void) printf("\t msgs rcv'd: %ld\n",
4356 (void) printf("\t signals rcv'd: %ld\n",
4358 (void) printf("\tvol cntxt swtchs: %ld\n",
4360 (void) printf("\tinv cntxt swtchs: %ld\n",
4366 show_getrusage32(long offset
)
4369 if (Pread(Proc
, &r
, sizeof (r
), offset
) != sizeof (r
))
4371 (void) printf("\t user time: %d.%6.6d sec\n",
4373 r
.ru_utime
.tv_usec
);
4374 (void) printf("\t system time: %d.%6.6d sec\n",
4376 r
.ru_stime
.tv_usec
);
4377 (void) printf("\t max rss: <unimpl> %d\n",
4379 (void) printf("\t shared data: <unimpl> %d\n",
4381 (void) printf("\t unshared data: <unimpl> %d\n",
4383 (void) printf("\t unshared stack: <unimpl> %d\n",
4385 (void) printf("\t minor faults: %d\n",
4387 (void) printf("\t major faults: %d\n",
4389 (void) printf("\t # of swaps: %d\n",
4391 (void) printf("\t blocked inputs: %d\n",
4393 (void) printf("\t blocked outputs: %d\n",
4395 (void) printf("\t msgs sent: %d\n",
4397 (void) printf("\t msgs rcv'd: %d\n",
4399 (void) printf("\t signals rcv'd: %d\n",
4401 (void) printf("\tvol cntxt swtchs: %d\n",
4403 (void) printf("\tinv cntxt swtchs: %d\n",
4409 * Utility function to print a packed nvlist by unpacking
4410 * and calling the libnvpair pretty printer. Frees all
4411 * allocated memory internally.
4414 show_packed_nvlist(private_t
*pri
, uintptr_t offset
, size_t size
)
4416 nvlist_t
*nvl
= NULL
;
4420 if ((offset
== 0) || (size
== 0)) {
4424 buf
= my_malloc(size
, "nvlist decode buffer");
4425 readsize
= Pread(Proc
, buf
, size
, offset
);
4426 if (readsize
!= size
) {
4427 (void) printf("%s\t<?>", pri
->pname
);
4431 result
= nvlist_unpack(buf
, size
, &nvl
, 0);
4433 dump_nvlist(nvl
, 8);
4436 (void) printf("%s\tunpack of nvlist"
4437 " failed: %d\n", pri
->pname
, result
);
4444 show_zone_create_args(private_t
*pri
, long offset
)
4447 char zone_name
[ZONENAME_MAX
];
4448 char zone_root
[MAXPATHLEN
];
4449 char *zone_zfs
= NULL
;
4451 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4453 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4454 (uintptr_t)args
.zone_name
) == -1)
4455 (void) strcpy(zone_name
, "<?>");
4457 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4458 (uintptr_t)args
.zone_root
) == -1)
4459 (void) strcpy(zone_root
, "<?>");
4461 if (args
.zfsbufsz
> 0) {
4462 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4463 if (zone_zfs
!= NULL
) {
4464 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4465 (uintptr_t)args
.zfsbuf
) == -1)
4466 (void) strcpy(zone_zfs
, "<?>");
4472 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4474 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4477 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4478 args
.zone_privssz
, " zone_privs: ");
4480 (void) printf("%s\t rctlbuf: 0x%p\n", pri
->pname
,
4481 (void *)args
.rctlbuf
);
4482 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4483 (ulong_t
)args
.rctlbufsz
);
4485 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4488 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4490 (void) printf("%s\textended_error: 0x%p\n", pri
->pname
,
4491 (void *)args
.extended_error
);
4493 if (args
.zfsbufsz
> 0)
4502 show_zone_create_args32(private_t
*pri
, long offset
)
4505 char zone_name
[ZONENAME_MAX
];
4506 char zone_root
[MAXPATHLEN
];
4507 char *zone_zfs
= NULL
;
4509 if (Pread(Proc
, &args
, sizeof (args
), offset
) == sizeof (args
)) {
4511 if (Pread_string(Proc
, zone_name
, sizeof (zone_name
),
4512 (uintptr_t)args
.zone_name
) == -1)
4513 (void) strcpy(zone_name
, "<?>");
4515 if (Pread_string(Proc
, zone_root
, sizeof (zone_root
),
4516 (uintptr_t)args
.zone_root
) == -1)
4517 (void) strcpy(zone_root
, "<?>");
4519 if (args
.zfsbufsz
> 0) {
4520 zone_zfs
= malloc(MIN(4, args
.zfsbufsz
));
4521 if (zone_zfs
!= NULL
) {
4522 if (Pread(Proc
, zone_zfs
, args
.zfsbufsz
,
4523 (uintptr_t)args
.zfsbuf
) == -1)
4524 (void) strcpy(zone_zfs
, "<?>");
4530 (void) printf("%s\t zone_name: %s\n", pri
->pname
,
4532 (void) printf("%s\t zone_root: %s\n", pri
->pname
,
4535 show_privset(pri
, (uintptr_t)args
.zone_privs
,
4536 args
.zone_privssz
, " zone_privs: ");
4538 (void) printf("%s\t rctlbuf: 0x%x\n", pri
->pname
,
4539 (caddr32_t
)args
.rctlbuf
);
4540 (void) printf("%s\t rctlbufsz: %lu\n", pri
->pname
,
4541 (ulong_t
)args
.rctlbufsz
);
4543 show_packed_nvlist(pri
, (uintptr_t)args
.rctlbuf
,
4546 (void) printf("%s\t zfs: %s\n", pri
->pname
, zone_zfs
);
4548 (void) printf("%s\textended_error: 0x%x\n", pri
->pname
,
4549 (caddr32_t
)args
.extended_error
);
4551 if (args
.zfsbufsz
> 0)
4559 show_zones(private_t
*pri
)
4561 switch (pri
->sys_args
[0]) {
4564 if (data_model
== PR_MODEL_LP64
)
4565 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4567 show_zone_create_args32(pri
, (long)pri
->sys_args
[1]);
4569 show_zone_create_args(pri
, (long)pri
->sys_args
[1]);
4576 show_rctlblk(private_t
*pri
, long _rctlblk
)
4579 int size
= rctlblk_size();
4583 blk
= my_malloc(size
, "rctlblk decode buffer");
4584 readsize
= Pread(Proc
, blk
, size
, _rctlblk
);
4585 if (readsize
!= size
) {
4586 (void) printf("%s\t\t<?>", pri
->pname
);
4588 (void) printf("%s\t\t Privilege: 0x%x\n",
4590 rctlblk_get_privilege(blk
));
4591 (void) printf("%s\t\t Value: %lld\n",
4593 rctlblk_get_value(blk
));
4594 (void) printf("%s\t\tEnforced Value: %lld\n",
4596 rctlblk_get_enforced_value(blk
));
4600 act
= rctlblk_get_local_action(blk
, &sig
);
4602 s
= rctl_local_action(pri
, act
);
4604 (void) printf("%s\t\t Local action: 0x%x\n",
4607 (void) printf("%s\t\t Local action: %s\n",
4611 if (act
& RCTL_LOCAL_SIGNAL
) {
4612 (void) printf("%s\t\t "
4614 pri
->pname
, signame(pri
, sig
));
4618 s
= rctl_local_flags(pri
, rctlblk_get_local_flags(blk
));
4620 (void) printf("%s\t\t Local flags: 0x%x\n",
4621 pri
->pname
, rctlblk_get_local_flags(blk
));
4623 (void) printf("%s\t\t Local flags: %s\n",
4628 (void) printf("%s\t\t Recipient PID: %d\n",
4630 rctlblk_get_recipient_pid(blk
));
4632 (void) printf("%s\t\t Recipient PID: %ld\n",
4634 rctlblk_get_recipient_pid(blk
));
4636 (void) printf("%s\t\t Firing Time: %lld\n",
4638 rctlblk_get_firing_time(blk
));
4644 show_rctls(private_t
*pri
)
4648 switch (pri
->sys_args
[0]) {
4649 case 0: /* getrctl */
4650 case 1: /* setrctl */
4652 * If these offsets look a little odd, remember that they're
4653 * into the _raw_ system call
4655 (void) printf("%s\tOld rctlblk: 0x%lx\n", pri
->pname
,
4657 if (pri
->sys_args
[2] != NULL
) {
4658 show_rctlblk(pri
, pri
->sys_args
[2]);
4660 (void) printf("%s\tNew rctlblk: 0x%lx\n", pri
->pname
,
4662 if (pri
->sys_args
[3] != NULL
) {
4663 show_rctlblk(pri
, pri
->sys_args
[3]);
4666 case 4: /* setprojrctl */
4667 for (entry
= 0; entry
< pri
->sys_args
[4]; entry
++) {
4668 (void) printf("%s\tNew rctlblk[%d]: 0x%lx\n",
4670 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4671 if (RCTLBLK_INC(pri
->sys_args
[3], entry
) != NULL
) {
4673 (long)RCTLBLK_INC(pri
->sys_args
[3], entry
));
4680 show_utimesys(private_t
*pri
)
4682 switch (pri
->sys_args
[0]) {
4683 case 0: /* futimens() */
4684 if (pri
->sys_nargs
> 2)
4685 show_utimens(pri
, (long)pri
->sys_args
[2]);
4687 case 1: /* utimensat */
4688 if (pri
->sys_nargs
> 3)
4689 show_utimens(pri
, (long)pri
->sys_args
[3]);
4691 default: /* unexpected subcode */
4698 show_sockconfig_filter_prop32(private_t
*pri
, long addr
)
4700 struct sockconfig_filter_props32 props
;
4701 const char *s
= NULL
;
4702 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4703 sof_socktuple32_t
*tup
;
4707 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4708 if (Pread_string(Proc
, buf
, sizeof (buf
),
4709 (uintptr_t)props
.sfp_modname
) == -1)
4710 (void) strcpy(buf
, "<?>");
4711 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4712 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4713 props
.sfp_autoattach
? "automatic" : "progammatic");
4714 if (props
.sfp_autoattach
) {
4716 switch (props
.sfp_hint
) {
4717 case SOF_HINT_TOP
: s
= "top"; break;
4718 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4719 case SOF_HINT_BEFORE
:
4720 case SOF_HINT_AFTER
:
4721 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4723 if (Pread_string(Proc
, buf
, sizeof (buf
),
4724 (uintptr_t)props
.sfp_hintarg
) == -1)
4725 (void) strcpy(buf
, "<?>");
4728 (void) printf(", placement: %s %s", s
, buf
);
4731 (void) printf("\n");
4732 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4733 if (props
.sfp_socktuple_cnt
== 0) {
4734 (void) printf("\t\t<empty>\n");
4737 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4738 tup
= my_malloc(sz
, "socket tuple buffer");
4739 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4740 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4742 "\t\tfamily: %d, type: %d, proto: %d\n",
4743 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4744 tup
[i
].sofst_protocol
);
4750 show_sockconfig_filter_prop(private_t
*pri
, long addr
)
4752 struct sockconfig_filter_props props
;
4753 const char *s
= NULL
;
4754 char buf
[MAX(FILNAME_MAX
, MODMAXNAMELEN
)];
4755 sof_socktuple_t
*tup
;
4759 if (Pread(Proc
, &props
, sizeof (props
), addr
) == sizeof (props
)) {
4760 if (Pread_string(Proc
, buf
, sizeof (buf
),
4761 (uintptr_t)props
.sfp_modname
) == -1)
4762 (void) strcpy(buf
, "<?>");
4763 (void) printf("%s\tmodule name: %s\n", pri
->pname
, buf
);
4764 (void) printf("%s\tattach semantics: %s", pri
->pname
,
4765 props
.sfp_autoattach
? "automatic" : "progammatic");
4766 if (props
.sfp_autoattach
) {
4768 switch (props
.sfp_hint
) {
4769 case SOF_HINT_TOP
: s
= "top"; break;
4770 case SOF_HINT_BOTTOM
: s
= "bottom"; break;
4771 case SOF_HINT_BEFORE
:
4772 case SOF_HINT_AFTER
:
4773 s
= (props
.sfp_hint
== SOF_HINT_BEFORE
) ?
4775 if (Pread_string(Proc
, buf
, sizeof (buf
),
4776 (uintptr_t)props
.sfp_hintarg
) == -1)
4777 (void) strcpy(buf
, "<?>");
4780 (void) printf(", placement: %s", s
);
4783 (void) printf("\n");
4784 (void) printf("%s\tsocket tuples:\n", pri
->pname
);
4785 if (props
.sfp_socktuple_cnt
== 0) {
4786 (void) printf("\t\t<empty>\n");
4789 sz
= props
.sfp_socktuple_cnt
* sizeof (*tup
);
4790 tup
= my_malloc(sz
, "socket tuple buffer");
4791 if (Pread(Proc
, tup
, sz
, (uintptr_t)props
.sfp_socktuple
) == sz
)
4792 for (i
= 0; i
< props
.sfp_socktuple_cnt
; i
++) {
4794 "\t\tfamily: %d, type: %d, proto: %d\n",
4795 tup
[i
].sofst_family
, tup
[i
].sofst_type
,
4796 tup
[i
].sofst_protocol
);
4802 show_sockconfig(private_t
*pri
)
4804 switch (pri
->sys_args
[0]) {
4805 case SOCKCONFIG_ADD_FILTER
:
4807 if (data_model
== PR_MODEL_LP64
)
4808 show_sockconfig_filter_prop(pri
,
4809 (long)pri
->sys_args
[2]);
4811 show_sockconfig_filter_prop32(pri
,
4812 (long)pri
->sys_args
[2]);
4814 show_sockconfig_filter_prop(pri
, (long)pri
->sys_args
[2]);
4823 show_zfs_ioc(private_t
*pri
, long addr
)
4825 static const zfs_share_t zero_share
= {0};
4826 static const dmu_objset_stats_t zero_objstats
= {0};
4827 static const struct drr_begin zero_drrbegin
= {0};
4828 static const zinject_record_t zero_injectrec
= {0};
4829 static const zfs_stat_t zero_zstat
= {0};
4832 if (Pread(Proc
, &zc
, sizeof (zc
), addr
) != sizeof (zc
)) {
4833 (void) printf(" zfs_ioctl read failed\n");
4838 (void) printf(" zc_name=%s\n", zc
.zc_name
);
4840 (void) printf(" zc_value=%s\n", zc
.zc_value
);
4841 if (zc
.zc_string
[0])
4842 (void) printf(" zc_string=%s\n", zc
.zc_string
);
4843 if (zc
.zc_guid
!= 0) {
4844 (void) printf(" zc_guid=%llu\n",
4845 (u_longlong_t
)zc
.zc_guid
);
4847 if (zc
.zc_nvlist_conf_size
) {
4848 (void) printf(" nvlist_conf:\n");
4849 show_packed_nvlist(pri
, zc
.zc_nvlist_conf
,
4850 zc
.zc_nvlist_conf_size
);
4852 if (zc
.zc_nvlist_src_size
) {
4853 (void) printf(" nvlist_src:\n");
4854 show_packed_nvlist(pri
, zc
.zc_nvlist_src
,
4855 zc
.zc_nvlist_src_size
);
4857 if (zc
.zc_nvlist_dst_size
) {
4858 (void) printf(" nvlist_dst:\n");
4859 show_packed_nvlist(pri
, zc
.zc_nvlist_dst
,
4860 zc
.zc_nvlist_dst_size
);
4862 if (zc
.zc_cookie
!= 0) {
4863 (void) printf(" zc_cookie=%llu\n",
4864 (u_longlong_t
)zc
.zc_cookie
);
4866 if (zc
.zc_objset_type
!= 0) {
4867 (void) printf(" zc_objset_type=%llu\n",
4868 (u_longlong_t
)zc
.zc_objset_type
);
4870 if (zc
.zc_perm_action
!= 0) {
4871 (void) printf(" zc_perm_action=%llu\n",
4872 (u_longlong_t
)zc
.zc_perm_action
);
4874 if (zc
.zc_history
!= 0) {
4875 (void) printf(" zc_history=%llu\n",
4876 (u_longlong_t
)zc
.zc_history
);
4878 if (zc
.zc_obj
!= 0) {
4879 (void) printf(" zc_obj=%llu\n",
4880 (u_longlong_t
)zc
.zc_obj
);
4882 if (zc
.zc_iflags
!= 0) {
4883 (void) printf(" zc_obj=0x%llx\n",
4884 (u_longlong_t
)zc
.zc_iflags
);
4887 if (memcmp(&zc
.zc_share
, &zero_share
, sizeof (zc
.zc_share
))) {
4888 zfs_share_t
*z
= &zc
.zc_share
;
4889 (void) printf(" zc_share:\n");
4890 if (z
->z_exportdata
) {
4891 (void) printf("\tz_exportdata=0x%llx\n",
4892 (u_longlong_t
)z
->z_exportdata
);
4894 if (z
->z_sharedata
) {
4895 (void) printf("\tz_sharedata=0x%llx\n",
4896 (u_longlong_t
)z
->z_sharedata
);
4898 if (z
->z_sharetype
) {
4899 (void) printf("\tz_sharetype=%llu\n",
4900 (u_longlong_t
)z
->z_sharetype
);
4902 if (z
->z_sharemax
) {
4903 (void) printf("\tz_sharemax=%llu\n",
4904 (u_longlong_t
)z
->z_sharemax
);
4908 if (memcmp(&zc
.zc_objset_stats
, &zero_objstats
,
4909 sizeof (zc
.zc_objset_stats
))) {
4910 dmu_objset_stats_t
*dds
= &zc
.zc_objset_stats
;
4911 (void) printf(" zc_objset_stats:\n");
4912 if (dds
->dds_num_clones
) {
4913 (void) printf("\tdds_num_clones=%llu\n",
4914 (u_longlong_t
)dds
->dds_num_clones
);
4916 if (dds
->dds_creation_txg
) {
4917 (void) printf("\tdds_creation_txg=%llu\n",
4918 (u_longlong_t
)dds
->dds_creation_txg
);
4920 if (dds
->dds_guid
) {
4921 (void) printf("\tdds_guid=%llu\n",
4922 (u_longlong_t
)dds
->dds_guid
);
4925 (void) printf("\tdds_type=%u\n", dds
->dds_type
);
4926 if (dds
->dds_is_snapshot
) {
4927 (void) printf("\tdds_is_snapshot=%u\n",
4928 dds
->dds_is_snapshot
);
4930 if (dds
->dds_inconsistent
) {
4931 (void) printf("\tdds_inconsitent=%u\n",
4932 dds
->dds_inconsistent
);
4934 if (dds
->dds_origin
[0]) {
4935 (void) printf("\tdds_origin=%s\n", dds
->dds_origin
);
4939 if (memcmp(&zc
.zc_begin_record
, &zero_drrbegin
,
4940 sizeof (zc
.zc_begin_record
))) {
4941 struct drr_begin
*drr
= &zc
.zc_begin_record
.drr_u
.drr_begin
;
4942 (void) printf(" zc_begin_record:\n");
4943 if (drr
->drr_magic
) {
4944 (void) printf("\tdrr_magic=%llu\n",
4945 (u_longlong_t
)drr
->drr_magic
);
4947 if (drr
->drr_versioninfo
) {
4948 (void) printf("\tdrr_versioninfo=%llu\n",
4949 (u_longlong_t
)drr
->drr_versioninfo
);
4951 if (drr
->drr_creation_time
) {
4952 (void) printf("\tdrr_creation_time=%llu\n",
4953 (u_longlong_t
)drr
->drr_creation_time
);
4956 (void) printf("\tdrr_type=%u\n", drr
->drr_type
);
4958 (void) printf("\tdrr_flags=0x%x\n", drr
->drr_flags
);
4959 if (drr
->drr_toguid
) {
4960 (void) printf("\tdrr_toguid=%llu\n",
4961 (u_longlong_t
)drr
->drr_toguid
);
4963 if (drr
->drr_fromguid
) {
4964 (void) printf("\tdrr_fromguid=%llu\n",
4965 (u_longlong_t
)drr
->drr_fromguid
);
4967 if (drr
->drr_toname
[0]) {
4968 (void) printf("\tdrr_toname=%s\n", drr
->drr_toname
);
4972 if (memcmp(&zc
.zc_inject_record
, &zero_injectrec
,
4973 sizeof (zc
.zc_inject_record
))) {
4974 zinject_record_t
*zi
= &zc
.zc_inject_record
;
4975 (void) printf(" zc_inject_record:\n");
4976 if (zi
->zi_objset
) {
4977 (void) printf("\tzi_objset=%llu\n",
4978 (u_longlong_t
)zi
->zi_objset
);
4980 if (zi
->zi_object
) {
4981 (void) printf("\tzi_object=%llu\n",
4982 (u_longlong_t
)zi
->zi_object
);
4985 (void) printf("\tzi_start=%llu\n",
4986 (u_longlong_t
)zi
->zi_start
);
4989 (void) printf("\tzi_end=%llu\n",
4990 (u_longlong_t
)zi
->zi_end
);
4993 (void) printf("\tzi_guid=%llu\n",
4994 (u_longlong_t
)zi
->zi_guid
);
4997 (void) printf("\tzi_level=%lu\n",
4998 (ulong_t
)zi
->zi_level
);
5001 (void) printf("\tzi_error=%lu\n",
5002 (ulong_t
)zi
->zi_error
);
5005 (void) printf("\tzi_type=%llu\n",
5006 (u_longlong_t
)zi
->zi_type
);
5009 (void) printf("\tzi_freq=%lu\n",
5010 (ulong_t
)zi
->zi_freq
);
5012 if (zi
->zi_failfast
) {
5013 (void) printf("\tzi_failfast=%lu\n",
5014 (ulong_t
)zi
->zi_failfast
);
5017 (void) printf("\tzi_func=%s\n", zi
->zi_func
);
5018 if (zi
->zi_iotype
) {
5019 (void) printf("\tzi_iotype=%lu\n",
5020 (ulong_t
)zi
->zi_iotype
);
5022 if (zi
->zi_duration
) {
5023 (void) printf("\tzi_duration=%ld\n",
5024 (long)zi
->zi_duration
);
5027 (void) printf("\tzi_timer=%llu\n",
5028 (u_longlong_t
)zi
->zi_timer
);
5032 if (zc
.zc_defer_destroy
) {
5033 (void) printf(" zc_defer_destroy=%d\n",
5034 (int)zc
.zc_defer_destroy
);
5037 (void) printf(" zc_flags=0x%x\n",
5040 if (zc
.zc_action_handle
) {
5041 (void) printf(" zc_action_handle=%llu\n",
5042 (u_longlong_t
)zc
.zc_action_handle
);
5044 if (zc
.zc_cleanup_fd
>= 0)
5045 (void) printf(" zc_cleanup_fd=%d\n", zc
.zc_cleanup_fd
);
5046 if (zc
.zc_sendobj
) {
5047 (void) printf(" zc_sendobj=%llu\n",
5048 (u_longlong_t
)zc
.zc_sendobj
);
5050 if (zc
.zc_fromobj
) {
5051 (void) printf(" zc_fromobj=%llu\n",
5052 (u_longlong_t
)zc
.zc_fromobj
);
5054 if (zc
.zc_createtxg
) {
5055 (void) printf(" zc_createtxg=%llu\n",
5056 (u_longlong_t
)zc
.zc_createtxg
);
5059 if (memcmp(&zc
.zc_stat
, &zero_zstat
, sizeof (zc
.zc_stat
))) {
5060 zfs_stat_t
*zs
= &zc
.zc_stat
;
5061 (void) printf(" zc_stat:\n");
5063 (void) printf("\tzs_gen=%llu\n",
5064 (u_longlong_t
)zs
->zs_gen
);
5067 (void) printf("\tzs_mode=%llu\n",
5068 (u_longlong_t
)zs
->zs_mode
);
5071 (void) printf("\tzs_links=%llu\n",
5072 (u_longlong_t
)zs
->zs_links
);
5074 if (zs
->zs_ctime
[0]) {
5075 (void) printf("\tzs_ctime[0]=%llu\n",
5076 (u_longlong_t
)zs
->zs_ctime
[0]);
5078 if (zs
->zs_ctime
[1]) {
5079 (void) printf("\tzs_ctime[1]=%llu\n",
5080 (u_longlong_t
)zs
->zs_ctime
[1]);
5085 /* expound verbosely upon syscall arguments */
5088 expound(private_t
*pri
, long r0
, int raw
)
5090 const lwpstatus_t
*Lsp
= pri
->lwpstat
;
5091 int lp64
= (data_model
== PR_MODEL_LP64
);
5092 int what
= Lsp
->pr_what
;
5093 int err
= pri
->Errno
; /* don't display output parameters */
5094 /* for a failed system call */
5096 /* We are a 32-bit truss; we can't grok a 64-bit process */
5100 /* for reporting sleeping system calls */
5101 if (what
== 0 && (Lsp
->pr_flags
& (PR_ASLEEP
|PR_VFORKP
)))
5102 what
= Lsp
->pr_syscall
;
5105 case SYS_gettimeofday
:
5107 show_timeofday(pri
);
5110 if (!err
&& pri
->sys_nargs
> 1)
5111 show_itimerval(pri
, (long)pri
->sys_args
[1],
5115 if (pri
->sys_nargs
> 1)
5116 show_itimerval(pri
, (long)pri
->sys_args
[1],
5118 if (!err
&& pri
->sys_nargs
> 2)
5119 show_itimerval(pri
, (long)pri
->sys_args
[2],
5134 show_utssys(pri
, r0
);
5136 show_utssys32(pri
, r0
);
5138 show_utssys(pri
, r0
);
5142 if (pri
->sys_nargs
>= 3) /* each case must decide for itself */
5143 show_ioctl(pri
, pri
->sys_args
[1],
5144 (long)pri
->sys_args
[2]);
5147 if (!err
&& pri
->sys_nargs
>= 3)
5148 show_stat(pri
, (long)pri
->sys_args
[2]);
5151 if (!err
&& pri
->sys_nargs
>= 3)
5152 show_stat64_32(pri
, (long)pri
->sys_args
[2]);
5157 if (!err
&& pri
->sys_nargs
>= 2)
5158 show_stat(pri
, (long)pri
->sys_args
[1]);
5163 if (!err
&& pri
->sys_nargs
>= 2)
5164 show_stat64_32(pri
, (long)pri
->sys_args
[1]);
5172 show_statvfs32(pri
);
5179 case SYS_fstatvfs64
:
5182 show_statvfs64(pri
);
5201 show_msgsys(pri
, r0
); /* each case must decide for itself */
5204 show_semsys(pri
); /* each case must decide for itself */
5207 show_shmsys(pri
); /* each case must decide for itself */
5210 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5214 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5219 show_dents32(pri
, (long)pri
->sys_args
[1], r0
);
5222 case SYS_getdents64
:
5223 if (err
|| pri
->sys_nargs
<= 1 || r0
<= 0)
5225 show_dents64(pri
, (long)pri
->sys_args
[1], r0
);
5228 show_gp_msg(pri
, what
);
5229 if (pri
->sys_nargs
> 3)
5230 show_hhex_int(pri
, (long)pri
->sys_args
[3], "flags");
5233 show_gp_msg(pri
, what
);
5234 if (pri
->sys_nargs
> 3)
5235 show_hhex_int(pri
, (long)pri
->sys_args
[3], "band");
5236 if (pri
->sys_nargs
> 4)
5237 show_hhex_int(pri
, (long)pri
->sys_args
[4], "flags");
5241 show_gp_msg(pri
, what
);
5247 if (pri
->sys_nargs
> 1 && (r0
= pri
->sys_args
[0]) > 0)
5248 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5251 if (!err
&& pri
->sys_nargs
> 1 && pri
->sys_args
[0] > 0)
5252 show_groups(pri
, (long)pri
->sys_args
[1], r0
);
5254 case SYS_sigprocmask
:
5255 if (pri
->sys_nargs
> 1)
5256 show_sigset(pri
, (long)pri
->sys_args
[1], " set");
5257 if (!err
&& pri
->sys_nargs
> 2)
5258 show_sigset(pri
, (long)pri
->sys_args
[2], "oset");
5260 case SYS_sigsuspend
:
5261 case SYS_sigtimedwait
:
5262 if (pri
->sys_nargs
> 0)
5263 show_sigset(pri
, (long)pri
->sys_args
[0], "sigmask");
5264 if (!err
&& pri
->sys_nargs
> 1)
5265 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5266 if (pri
->sys_nargs
> 2)
5267 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5269 case SYS_sigaltstack
:
5270 if (pri
->sys_nargs
> 0)
5271 show_sigaltstack(pri
, (long)pri
->sys_args
[0],
5273 if (!err
&& pri
->sys_nargs
> 1)
5274 show_sigaltstack(pri
, (long)pri
->sys_args
[1],
5278 if (pri
->sys_nargs
> 1)
5279 show_sigaction(pri
, (long)pri
->sys_args
[1],
5281 if (!err
&& pri
->sys_nargs
> 2)
5282 show_sigaction(pri
, (long)pri
->sys_args
[2],
5286 if (pri
->sys_nargs
> 1)
5287 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5290 if (pri
->sys_nargs
> 1)
5291 show_siginfo(pri
, (long)pri
->sys_args
[1]);
5292 if (pri
->sys_nargs
> 2)
5293 show_sigset(pri
, (long)pri
->sys_args
[2], "sigmask");
5295 case SYS_sigpending
:
5296 if (!err
&& pri
->sys_nargs
> 1)
5297 show_sigset(pri
, (long)pri
->sys_args
[1], "sigmask");
5300 if (!err
&& pri
->sys_nargs
> 2)
5301 show_siginfo(pri
, (long)pri
->sys_args
[2]);
5303 case SYS_sigsendsys
:
5304 if (pri
->sys_nargs
> 0)
5305 show_procset(pri
, (long)pri
->sys_args
[0]);
5307 case SYS_priocntlsys
:
5308 if (pri
->sys_nargs
> 1)
5309 show_procset(pri
, (long)pri
->sys_args
[1]);
5312 if (!err
&& pri
->sys_nargs
> 2)
5313 show_bool(pri
, (long)pri
->sys_args
[2],
5314 (pri
->sys_args
[1] + pagesize
- 1) / pagesize
);
5318 if (pri
->sys_nargs
> 2) {
5319 int i
= pri
->sys_args
[0]+1;
5320 int showbuf
= FALSE
;
5321 long nb
= (what
== SYS_readv
)? r0
: 32*1024;
5323 if ((what
== SYS_readv
&& !err
&&
5324 prismember(&readfd
, i
)) ||
5325 (what
== SYS_writev
&&
5326 prismember(&writefd
, i
)))
5328 show_iovec(pri
, (long)pri
->sys_args
[1],
5329 pri
->sys_args
[2], showbuf
, nb
);
5337 if (pri
->sys_nargs
<= 1)
5341 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5343 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5345 show_rlimit32(pri
, (long)pri
->sys_args
[1]);
5348 case SYS_getrlimit64
:
5352 case SYS_setrlimit64
:
5353 if (pri
->sys_nargs
<= 1)
5355 show_rlimit64(pri
, (long)pri
->sys_args
[1]);
5358 if (!err
&& pri
->sys_nargs
> 0)
5359 show_nuname(pri
, (long)pri
->sys_args
[0]);
5362 if (!err
&& pri
->sys_nargs
> 1)
5363 show_adjtime(pri
, (long)pri
->sys_args
[0],
5364 (long)pri
->sys_args
[1]);
5367 if (!err
&& pri
->sys_nargs
> 0)
5368 show_timestruc(pri
, (long)pri
->sys_args
[0], "cpu time");
5371 if (!err
&& pri
->sys_nargs
> 1)
5372 show_int(pri
, (long)pri
->sys_args
[1], "lwpid");
5374 case SYS_lwp_mutex_wakeup
:
5375 case SYS_lwp_mutex_unlock
:
5376 case SYS_lwp_mutex_trylock
:
5377 case SYS_lwp_mutex_register
:
5378 if (pri
->sys_nargs
> 0)
5379 show_mutex(pri
, (long)pri
->sys_args
[0]);
5381 case SYS_lwp_mutex_timedlock
:
5382 if (pri
->sys_nargs
> 0)
5383 show_mutex(pri
, (long)pri
->sys_args
[0]);
5384 if (pri
->sys_nargs
> 1)
5385 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5387 case SYS_lwp_cond_wait
:
5388 if (pri
->sys_nargs
> 0)
5389 show_condvar(pri
, (long)pri
->sys_args
[0]);
5390 if (pri
->sys_nargs
> 1)
5391 show_mutex(pri
, (long)pri
->sys_args
[1]);
5392 if (pri
->sys_nargs
> 2)
5393 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5395 case SYS_lwp_cond_signal
:
5396 case SYS_lwp_cond_broadcast
:
5397 if (pri
->sys_nargs
> 0)
5398 show_condvar(pri
, (long)pri
->sys_args
[0]);
5400 case SYS_lwp_sema_trywait
:
5401 case SYS_lwp_sema_post
:
5402 if (pri
->sys_nargs
> 0)
5403 show_sema(pri
, (long)pri
->sys_args
[0]);
5405 case SYS_lwp_sema_timedwait
:
5406 if (pri
->sys_nargs
> 0)
5407 show_sema(pri
, (long)pri
->sys_args
[0]);
5408 if (pri
->sys_nargs
> 1)
5409 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5411 case SYS_lwp_rwlock_sys
:
5412 if (pri
->sys_nargs
> 1)
5413 show_rwlock(pri
, (long)pri
->sys_args
[1]);
5414 if (pri
->sys_nargs
> 2 &&
5415 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 1))
5416 show_timestruc(pri
, (long)pri
->sys_args
[2], "timeout");
5418 case SYS_lwp_create
:
5419 /* XXX print some values in ucontext ??? */
5420 if (!err
&& pri
->sys_nargs
> 2)
5421 show_int(pri
, (long)pri
->sys_args
[2], "lwpid");
5424 if (pri
->sys_args
[0] == AIOWAIT
&& !err
&& pri
->sys_nargs
> 1)
5425 show_timeval(pri
, (long)pri
->sys_args
[1], "timeout");
5428 if (pri
->sys_nargs
> 0)
5429 show_timestruc(pri
, (long)pri
->sys_args
[0], "tmout");
5430 if (pri
->sys_nargs
> 1 && (err
== 0 || err
== EINTR
))
5431 show_timestruc(pri
, (long)pri
->sys_args
[1], "resid");
5434 switch (pri
->sys_args
[0]) {
5435 case PRIVSYS_SETPPRIV
:
5436 case PRIVSYS_GETPPRIV
:
5438 show_privset(pri
, (long)pri
->sys_args
[3],
5439 (size_t)pri
->sys_args
[4], "");
5443 switch (pri
->sys_args
[0]) {
5444 case UCREDSYS_UCREDGET
:
5445 case UCREDSYS_GETPEERUCRED
:
5447 show_ucred(pri
, (long)pri
->sys_args
[2]);
5453 if (pri
->sys_nargs
> 2)
5454 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5455 0, (long)pri
->sys_args
[2]);
5458 if (pri
->sys_nargs
> 5)
5459 show_sockaddr(pri
, "to", (long)pri
->sys_args
[4], 0,
5463 if (!err
&& pri
->sys_nargs
> 2)
5464 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5465 (long)pri
->sys_args
[2], 0);
5467 case SYS_getsockname
:
5468 case SYS_getpeername
:
5469 if (!err
&& pri
->sys_nargs
> 2)
5470 show_sockaddr(pri
, "name", (long)pri
->sys_args
[1],
5471 (long)pri
->sys_args
[2], 0);
5474 if (!err
&& pri
->sys_nargs
> 2)
5475 show_cladm(pri
, pri
->sys_args
[0], pri
->sys_args
[1],
5476 (long)pri
->sys_args
[2]);
5479 if (!err
&& pri
->sys_nargs
> 5)
5480 show_sockaddr(pri
, "from", (long)pri
->sys_args
[4],
5481 (long)pri
->sys_args
[5], 0);
5488 if (pri
->sys_nargs
<= 2)
5492 show_msghdr(pri
, pri
->sys_args
[1]);
5494 show_msghdr32(pri
, pri
->sys_args
[1]);
5496 show_msghdr(pri
, pri
->sys_args
[1]);
5503 if (pri
->sys_nargs
!= 5)
5506 if (pri
->sys_args
[0] == SENDFILEV
) {
5507 show_sendfilevec(pri
, (int)pri
->sys_args
[1],
5508 (sendfilevec_t
*)pri
->sys_args
[2],
5509 (int)pri
->sys_args
[3]);
5510 } else if (pri
->sys_args
[0] == SENDFILEV64
) {
5511 show_sendfilevec64(pri
, (int)pri
->sys_args
[1],
5512 (sendfilevec64_t
*)pri
->sys_args
[2],
5513 (int)pri
->sys_args
[3]);
5521 * subcode 0: lwp_park(timespec_t *, id_t)
5522 * subcode 4: lwp_set_park(timespec_t *, id_t)
5524 if (pri
->sys_nargs
> 1 &&
5525 (pri
->sys_args
[0] == 0 || pri
->sys_args
[0] == 4))
5526 show_timestruc(pri
, (long)pri
->sys_args
[1], "timeout");
5527 /* subcode 2: lwp_unpark_all(id_t *, int) */
5528 if (pri
->sys_nargs
> 2 && pri
->sys_args
[0] == 2)
5529 show_ids(pri
, (long)pri
->sys_args
[1],
5530 (int)pri
->sys_args
[2]);
5532 case SYS_ntp_gettime
:
5534 show_ntp_gettime(pri
);
5536 case SYS_ntp_adjtime
:
5538 show_ntp_adjtime(pri
);
5542 if (pri
->sys_args
[0] == _RUSAGESYS_GETRUSAGE
) {
5545 show_getrusage32(pri
->sys_args
[1]);
5548 show_getrusage(pri
->sys_args
[1]);
5563 case SYS_sockconfig
:
5564 show_sockconfig(pri
);