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
This commit is contained in:
Sean Eric Fagan 1997-12-06 06:51:14 +00:00
parent 1f4fb6dff8
commit 970649f9c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=31571
3 changed files with 22 additions and 5 deletions

View File

@ -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>

View File

@ -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

View File

@ -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;
}