From 83c5b5febc674ae0810e8dfde55af1d91a2b0b80 Mon Sep 17 00:00:00 2001 From: hunt Date: Tue, 8 May 2007 20:38:10 +0000 Subject: 2007-05-08 Martin Hunt Signal handler cleanup. * mainloop.c (fatal_handler): New. Cleanly handle unexpected fatal signals. (setup_main_signals): New. Set signals once mainloop is entered. (setup_signals): New. Block certain signals during initialization. Set handler for fatal signals. * relay.c (reader_thread): Use ppoll(). Terminate on SIGUSR2 after reading any remaining data. (close_relayfs): Remove sleep hack. Send SIGUSR2 to all threads. Runtime debug messages. * staprun.h: Change dbug() to accept a debuglevel and enable it. * *.c: Modify dbug() calls. --- runtime/staprun/staprun.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/staprun/staprun.c') diff --git a/runtime/staprun/staprun.c b/runtime/staprun/staprun.c index 4ead7018..f40f676d 100644 --- a/runtime/staprun/staprun.c +++ b/runtime/staprun/staprun.c @@ -65,7 +65,7 @@ static void usage(char *prog) { fprintf(stderr, "\n%s [-v] [-c cmd ] [-x pid] [-u user]\n" "\t[-A modname]] [-L] [-b bufsize] [-o FILE] kmod-name [kmod-options]\n", prog); - fprintf(stderr, "-v Verbose.\n"); + fprintf(stderr, "-v increase Verbosity.\n"); fprintf(stderr, "-c cmd. Command \'cmd\' will be run and staprun will exit when it does.\n"); fprintf(stderr, " _stp_target will contain the pid for the command.\n"); fprintf(stderr, "-x pid. Sets _stp_target to pid.\n"); @@ -84,10 +84,12 @@ int main(int argc, char **argv) { int c; + setup_signals(); + while ((c = getopt(argc, argv, "ALvb:t:d:c:o:u:x:")) != EOF) { switch (c) { case 'v': - verbose = 1; + verbose++; break; case 'b': { @@ -136,7 +138,7 @@ int main(int argc, char **argv) if (optind < argc) { modpath = argv[optind++]; path_parse_modname(modpath); - dbug("modpath=\"%s\", modname=\"%s\"\n", modpath, modname); + dbug(2, "modpath=\"%s\", modname=\"%s\"\n", modpath, modname); } if (optind < argc) { -- cgit