summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>1999-08-10 16:57:37 +0000
committerdes <des@FreeBSD.org>1999-08-10 16:57:37 +0000
commit6b0342e396ad0a1933d3d62ee656723ffb36fb18 (patch)
treeb818decdb3538d81b6a6b20551c24c1d3a525978
parent371781a3f317245ab281255c4362ffa97bbed978 (diff)
downloadFreeBSD-src-6b0342e396ad0a1933d3d62ee656723ffb36fb18.zip
FreeBSD-src-6b0342e396ad0a1933d3d62ee656723ffb36fb18.tar.gz
Teach truss to print symbolic signal names (e.g. SIGHUP instead of 0x01).
-rw-r--r--usr.bin/truss/syscall.h5
-rw-r--r--usr.bin/truss/syscalls.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 026be11..5f3757c 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -18,10 +18,11 @@
* IN (meaning that the data is passed *into* the system call).
*/
/*
- * $Id: syscall.h,v 1.2 1997/12/06 06:51:13 sef Exp $
+ * $Id: syscall.h,v 1.3 1997/12/20 18:40:41 sef Exp $
*/
-enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad };
+enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad,
+ Signal };
#define ARG_MASK 0xff
#define OUT 0x100
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 134bae6..53865fd 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -31,7 +31,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: syscalls.c,v 1.6 1998/10/15 04:31:44 sef Exp $";
+ "$Id: syscalls.c,v 1.7 1999/08/05 12:03:50 des Exp $";
#endif /* not lint */
/*
@@ -45,6 +45,7 @@ static const char rcsid[] =
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
+#include <signal.h>
#include "syscall.h"
/*
@@ -80,6 +81,8 @@ struct syscall syscalls[] = {
{ "break", 1, 1, { { Hex, 0 }}},
{ "exit", 0, 1, { { Hex, 0 }}},
{ "access", 1, 2, { { String | IN, 0 }, { Int, 1 }}},
+ { "sigaction", 1, 3,
+ { { Signal, 0 }, { Ptr | IN, 1 }, { Ptr | OUT, 2 }}},
{ 0, 0, 0, { { 0, 0 }}},
};
@@ -217,6 +220,23 @@ print_arg(int fd, struct syscall_args *sc, unsigned long *args) {
sprintf(tmp, "0x%lx", args[sc->offset]);
}
}
+ break;
+ case Signal:
+ {
+ long sig;
+
+ sig = args[sc->offset];
+ tmp = malloc(12);
+ if (sig > 0 && sig < NSIG) {
+ int i;
+ sprintf(tmp, "sig%s", sys_signame[sig]);
+ for (i = 0; tmp[i] != '\0'; ++i)
+ tmp[i] = toupper(tmp[i]);
+ } else {
+ sprintf(tmp, "%ld", sig);
+ }
+ }
+ break;
}
return tmp;
}
OpenPOWER on IntegriCloud