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.
This commit is contained in:
Andreas Schulz 1994-08-28 15:49:55 +00:00
parent 80c02d5983
commit b013076737
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2354

View File

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