diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2015-12-25 02:11:48 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2015-12-25 02:11:48 +0000 |
commit | 2dbdcc289090befc38c73038522c100e01c1bda1 (patch) | |
tree | eec8d2cd17e0c4b590ac7641c4374470528a08c9 | |
parent | a305b21e11dd641675ab6dd02f491f862119e68f (diff) |
very basic kevent printing
-rw-r--r-- | usr.bin/kdump/ktrstruct.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.bin/kdump/ktrstruct.c b/usr.bin/kdump/ktrstruct.c index 609e6a4acc0..1f9b33015af 100644 --- a/usr.bin/kdump/ktrstruct.c +++ b/usr.bin/kdump/ktrstruct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ktrstruct.c,v 1.13 2015/10/18 05:03:22 guenther Exp $ */ +/* $OpenBSD: ktrstruct.c,v 1.14 2015/12/25 02:11:47 tedu Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -34,6 +34,7 @@ #include <sys/socket.h> #include <sys/stat.h> #include <sys/time.h> +#include <sys/event.h> #include <sys/un.h> #include <ufs/ufs/quota.h> #include <netinet/in.h> @@ -392,6 +393,23 @@ ktriovec(const char *data, int count) } static void +ktrevent(const char *data, int count) +{ + struct kevent kev; + int i; + + printf("struct kevent"); + if (count > 1) + printf(" [%d]", count); + for (i = 0; i < count; i++) { + memcpy(&kev, data, sizeof(kev)); + data += sizeof(kev); + printf(" { ident=%lu }", kev.ident); + } + printf("\n"); +} + +static void ktrcmsghdr(char *data, socklen_t len) { struct msghdr msg; @@ -552,6 +570,10 @@ ktrstruct(char *buf, size_t buflen) if (datalen % sizeof(struct iovec)) goto invalid; ktriovec(data, datalen / sizeof(struct iovec)); + } else if (strcmp(name, "kevent") == 0) { + if (datalen % sizeof(struct kevent)) + goto invalid; + ktrevent(data, datalen / sizeof(struct kevent)); } else if (strcmp(name, "cmsghdr") == 0) { char *cmsg; |