summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorsef <sef@FreeBSD.org>1997-12-06 06:51:14 +0000
committersef <sef@FreeBSD.org>1997-12-06 06:51:14 +0000
commit40d07bddd6e5d2da1a856c36e20f8bda224ae794 (patch)
tree2fad8874848954f2f5016f51c43663641bfe4000 /usr.bin/truss
parent515aa624c8329ae08ec354ac58842d19e6d0c6d2 (diff)
downloadFreeBSD-src-40d07bddd6e5d2da1a856c36e20f8bda224ae794.zip
FreeBSD-src-40d07bddd6e5d2da1a856c36e20f8bda224ae794.tar.gz
First cut at printing out ioctl names intelligently. Note that this doesn't
handle linux ioctls (yet?). This uses the mkioctl script from kdump, bless its little heart. Reviewed by: Mike Smith
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/Makefile8
-rw-r--r--usr.bin/truss/syscall.h5
-rw-r--r--usr.bin/truss/syscalls.c14
3 files changed, 22 insertions, 5 deletions
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
index a34501a0..63172a8 100644
--- a/usr.bin/truss/Makefile
+++ b/usr.bin/truss/Makefile
@@ -1,8 +1,9 @@
PROG= truss
SRCS= main.c setup.c i386-fbsd.c i386-linux.c \
- syscalls.c linux_syscalls.h syscalls.h
+ syscalls.c linux_syscalls.h syscalls.h ioctl.c
CFLAGS+= -I${.CURDIR} -I.
-CLEANFILES+=i386l-syscalls.master syscalls.master linux_syscalls.h syscalls.h
+CLEANFILES+=i386l-syscalls.master syscalls.master linux_syscalls.h \
+ syscalls.h ioctl.c
.SUFFIXES: .master
@@ -20,4 +21,7 @@ syscalls.h: syscalls.master
/bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh syscalls.master \
${.CURDIR}/i386.conf
+ioctl.c: ${.CURDIR}/../../usr.bin/kdump/mkioctls
+ /bin/sh ${.CURDIR}/../../usr.bin/kdump/mkioctls > ioctl.c
+
.include <bsd.prog.mk>
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 74f8334..5e84178 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -9,16 +9,17 @@
* Ptr -- pointer to some specific structure. Just print as hex for now.
* Quad -- a double-word value. e.g., lseek(int, offset_t, int)
* Stat -- a pointer to a stat buffer. Currently unused.
+ * Ioctl -- an ioctl command. Woefully limited.
*
* In addition, the pointer types (String, Ptr) may have OUT masked in --
* this means that the data is set on *return* from the system call -- or
* IN (meaning that the data is passed *into* the system call).
*/
/*
- * $Id$
+ * $Id: syscall.h,v 1.1 1997/12/06 05:23:07 sef Exp $
*/
-enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Quad };
+enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad };
#define ARG_MASK 0xff
#define OUT 0x100
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 98dadca..06baed5 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -3,7 +3,7 @@
* arguments.
*/
/*
- * $Id$
+ * $Id: syscalls.c,v 1.1 1997/12/06 05:23:10 sef Exp $
*/
#include <stdio.h>
@@ -39,6 +39,8 @@ struct syscall syscalls[] = {
{ { Int, 0 }, { Ptr | OUT, 1 }}},
{ "write", 1, 3,
{ { Int, 0}, { Ptr | IN, 1 }, { Int, 2 }}},
+ { "ioctl", 1, 3,
+ { { Int, 0}, { Ioctl, 1 }, { Hex, 2 }}},
{ "break", 1, 1, { { Hex, 0 }}},
{ "exit", 0, 1, { { Hex, 0 }}},
{ 0, 0, 0, { 0, 0 } },
@@ -168,6 +170,16 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) {
tmp = malloc(12);
sprintf(tmp, "0x%x", args[sc->offset]);
break;
+ case Ioctl:
+ {
+ char *temp = ioctlname(args[sc->offset]);
+ if (temp)
+ tmp = strdup(temp);
+ else {
+ tmp = malloc(12);
+ sprintf(tmp, "0x%x", args[sc->offset]);
+ }
+ }
}
return tmp;
}
OpenPOWER on IntegriCloud