diff options
author | ats <ats@FreeBSD.org> | 1994-08-28 15:49:55 +0000 |
---|---|---|
committer | ats <ats@FreeBSD.org> | 1994-08-28 15:49:55 +0000 |
commit | 6f4fdb72c187027894b619aa628053bb2557eccf (patch) | |
tree | 456aa2bdc130a99f87055430cbc1dda42c8f3b4a /usr.bin/ktrace | |
parent | 0be9e2c6549cada3a129b621a02ae734501a4361 (diff) | |
download | FreeBSD-src-6f4fdb72c187027894b619aa628053bb2557eccf.zip FreeBSD-src-6f4fdb72c187027894b619aa628053bb2557eccf.tar.gz |
Reviewed by:
Submitted by:
Put in a signal handler to catch the SIGSYS signal that indicates that
ktrace was not built into the kernel and prevent ktrace to core dump
somewhere.
Diffstat (limited to 'usr.bin/ktrace')
-rw-r--r-- | usr.bin/ktrace/ktrace.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c index 26606d7..a57c4f4 100644 --- a/usr.bin/ktrace/ktrace.c +++ b/usr.bin/ktrace/ktrace.c @@ -49,8 +49,15 @@ static char sccsid[] = "@(#)ktrace.c 8.1 (Berkeley) 6/6/93"; #include <sys/uio.h> #include <sys/ktrace.h> #include <stdio.h> +#include <signal.h> #include "ktrace.h" +void noktrace() { + (void)fprintf(stderr, "ktrace: ktrace not enabled in kernel,to use ktrace\n"); + (void)fprintf(stderr, "you need to add a line \"options KTRACE\" to your kernel\n"); + exit(1); +} + main(argc, argv) int argc; char **argv; @@ -65,6 +72,9 @@ main(argc, argv) append = ops = pidset = inherit = 0; trpoints = DEF_POINTS; tracefile = DEF_TRACEFILE; + /* set up a signal handler for SIGSYS, this indicates that ktrace + is not enabled in the kernel */ + signal(SIGSYS, noktrace); while ((ch = getopt(argc,argv,"aCcdf:g:ip:t:")) != EOF) switch((char)ch) { case 'a': |