summaryrefslogtreecommitdiff
path: root/usr.bin/kdump/kdump.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-24 09:19:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-05-24 09:19:35 +0000
commit3785633180c4028130916211f7d7d8bcfda3cb36 (patch)
tree5a2ee088af473b071940abbb9b406863f4a7f7cb /usr.bin/kdump/kdump.c
parenta039326947bcd3e9cfebda958408f946b8bbcbf2 (diff)
Decode unknown ioctl commands to _IO{R,W,}('c',x[,y]), instead of 0xabcdef00
Diffstat (limited to 'usr.bin/kdump/kdump.c')
-rw-r--r--usr.bin/kdump/kdump.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 0e868d38877..f119f7f0f52 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -41,7 +41,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$NetBSD: kdump.c,v 1.12 1995/08/31 23:18:33 jtc Exp $";
+static char *rcsid = "$NetBSD: kdump.c,v 1.13 1996/05/13 21:12:25 christos Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -278,6 +278,25 @@ dumpheader(kth)
(void)printf("%s ", type);
}
+void
+ioctldecode(cmd)
+ u_long cmd;
+{
+ char dirbuf[4], *dir = dirbuf;
+
+ if (cmd & IOC_OUT)
+ *dir++ = 'W';
+ if (cmd & IOC_IN)
+ *dir++ = 'R';
+ *dir = '\0';
+
+ printf(decimal ? ",_IO%s('%c',%ld" : ",_IO%s('%c',%#lx",
+ dirbuf, (cmd >> 8) & 0xff, cmd & 0xff);
+ if ((cmd & IOC_VOID) == 0)
+ printf(decimal ? ",%ld)" : ",%#lx)", (cmd >> 16) & 0xff);
+ else
+ printf(")");
+}
ktrsyscall(ktr)
register struct ktr_syscall *ktr;
@@ -304,14 +323,8 @@ ktrsyscall(ktr)
argsize -= sizeof(register_t);
if ((cp = ioctlname(*ap)) != NULL)
(void)printf(",%s", cp);
- else {
- if (decimal)
- (void)printf(",%ld",
- (long)*ap);
- else
- (void)printf(",%#lx ",
- (long)*ap);
- }
+ else
+ ioctldecode(*ap);
c = ',';
ap++;
argsize -= sizeof(register_t);