From 6f4fdb72c187027894b619aa628053bb2557eccf Mon Sep 17 00:00:00 2001 From: ats Date: Sun, 28 Aug 1994 15:49:55 +0000 Subject: 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. --- usr.bin/ktrace/ktrace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'usr.bin/ktrace') 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 #include #include +#include #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': -- cgit v1.1