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/relay_old.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/staprun/relay_old.c') diff --git a/runtime/staprun/relay_old.c b/runtime/staprun/relay_old.c index b0d2e43d..11a73cd7 100644 --- a/runtime/staprun/relay_old.c +++ b/runtime/staprun/relay_old.c @@ -57,7 +57,7 @@ void close_oldrelayfs(int detach) if (!bulkmode) return; - dbug("detach=%d, ncpus=%d\n", detach, ncpus); + dbug(2, "detach=%d, ncpus=%d\n", detach, ncpus); if (detach) { for (i = 0; i < ncpus; i++) @@ -91,7 +91,7 @@ static int open_relayfs_files(int cpu, const char *relay_filebase, const char *p } sprintf(tmp, "%s%d", proc_filebase, cpu); - dbug("Opening %s.\n", tmp); + dbug(2, "Opening %s.\n", tmp); proc_fd[cpu] = open(tmp, O_RDWR | O_NONBLOCK); if (proc_fd[cpu] < 0) { fprintf(stderr, "ERROR: couldn't open proc file %s: errcode = %s\n", tmp, strerror(errno)); @@ -221,7 +221,7 @@ int init_oldrelayfs(void) struct statfs st; char relay_filebase[128], proc_filebase[128]; - dbug("initializing relayfs.n_subbufs=%d subbuf_size=%d\n", n_subbufs, subbuf_size); + dbug(2, "initializing relayfs.n_subbufs=%d subbuf_size=%d\n", n_subbufs, subbuf_size); if (n_subbufs) bulkmode = 1; @@ -265,7 +265,7 @@ int init_oldrelayfs(void) } ncpus = i; - dbug("ncpus=%d\n", ncpus); + dbug(2, "ncpus=%d\n", ncpus); for (i = 0; i < ncpus; i++) { /* create a thread for each per-cpu buffer */ -- cgit