diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-06-07 06:12:38 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2016-06-07 06:12:38 +0000 |
commit | 30141f41ce1aad36ca5129ef222f09489b53a0c2 (patch) | |
tree | cb8cc33295f660da0d6bef84de644e7d9965288b /usr.bin/kdump | |
parent | 3a506d1eb7b6731c6f22862e19865bc0bdd6fd43 (diff) |
ktrace support for pollfd[] arrays
ok guenther
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r-- | usr.bin/kdump/kdump_subr.h | 3 | ||||
-rw-r--r-- | usr.bin/kdump/ktrstruct.c | 27 | ||||
-rw-r--r-- | usr.bin/kdump/mksubr | 3 |
3 files changed, 30 insertions, 3 deletions
diff --git a/usr.bin/kdump/kdump_subr.h b/usr.bin/kdump/kdump_subr.h index 44880781509..571dbc78c95 100644 --- a/usr.bin/kdump/kdump_subr.h +++ b/usr.bin/kdump/kdump_subr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump_subr.h,v 1.19 2016/03/22 16:45:07 guenther Exp $ */ +/* $OpenBSD: kdump_subr.h,v 1.20 2016/06/07 06:12:37 deraadt Exp $ */ /* * Copyright(c) 2006 2006 David Kirchner <dpk@dpk.net> * @@ -95,6 +95,7 @@ void itimername(int); void evfiltername(int); void evflagsname(int); void evfflagsname(int, int); +void pollfdeventname(int); void syslogflagname(int); extern int decimal, fancy, basecol, arg1; diff --git a/usr.bin/kdump/ktrstruct.c b/usr.bin/kdump/ktrstruct.c index 0f91dc2caf5..9c6c87fb274 100644 --- a/usr.bin/kdump/ktrstruct.c +++ b/usr.bin/kdump/ktrstruct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrstruct.c,v 1.20 2016/06/07 01:34:39 tedu Exp $ */ +/* $OpenBSD: ktrstruct.c,v 1.21 2016/06/07 06:12:37 deraadt Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -430,6 +430,27 @@ ktrevent(const char *data, int count) } static void +ktrpollfd(const char *data, int count) +{ + struct pollfd pfd; + int i; + + printf("struct pollfd"); + if (count > 1) + printf(" [%d]", count); + for (i = 0; i < count; i++) { + memcpy(&pfd, data, sizeof(pfd)); + data += sizeof(pfd); + printf(" { fd=%d, events=", pfd.fd); + pollfdeventname(pfd.events); + printf(", revents="); + pollfdeventname(pfd.revents); + printf(" }"); + } + printf("\n"); +} + +static void ktrcmsghdr(char *data, socklen_t len) { struct msghdr msg; @@ -594,6 +615,10 @@ ktrstruct(char *buf, size_t buflen) if (datalen % sizeof(struct kevent)) goto invalid; ktrevent(data, datalen / sizeof(struct kevent)); + } else if (strcmp(name, "pollfd") == 0) { + if (datalen % sizeof(struct pollfd)) + goto invalid; + ktrpollfd(data, datalen / sizeof(struct pollfd)); } else if (strcmp(name, "cmsghdr") == 0) { char *cmsg; diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr index 8fe3caff5e7..039d93d880d 100644 --- a/usr.bin/kdump/mksubr +++ b/usr.bin/kdump/mksubr @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: mksubr,v 1.30 2016/03/22 16:45:07 guenther Exp $ +# $OpenBSD: mksubr,v 1.31 2016/06/07 06:12:37 deraadt Exp $ # # Copyright (c) 2006 David Kirchner <dpk@dpk.net> # @@ -359,6 +359,7 @@ auto_switch_type "sockoptname" "SO_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_orz_type "ktracefacname" "KTRFAC_[^M][[:alnum:]_]+" "sys/ktrace.h" auto_switch_type "itimername" "ITIMER_[[:alnum:]_]+" "sys/time.h" auto_switch_type "evfiltername" "EVFILT_[[:alnum:]_]+[[:space:]]+[(]" "sys/event.h" +auto_orz_type "pollfdeventname" "POLL[^_][[:alnum:]_]+[[:space:]]+0x" "sys/poll.h" # exclude EV_{SYSFLAGS,FLAG1} auto_orz_type "evflagsname" "EV_[^S][A-Z]+[[:space:]]+0x" "sys/event.h" auto_orz_type "syslogflagname" "LOG_[A-Z]+[[:space:]]+0x0*[1248]0*[[:space:]]" "sys/syslog.h" |