From 82737beff97256e26a40cd9cee9c1d3f3e5ac4fa Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 17 Jul 2008 14:54:30 -0400 Subject: PR6030: control signal relay and accept deferred re-reception --- main.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'main.cxx') diff --git a/main.cxx b/main.cxx index c6c5f479..8c99cf7e 100644 --- a/main.cxx +++ b/main.cxx @@ -260,11 +260,16 @@ printscript(systemtap_session& s, ostream& o) int pending_interrupts; extern "C" -void handle_interrupt (int sig) +void handle_interrupt (int sig) { + if (pending_interrupts == 0) + kill (0, sig); // Forward signals to child processes if any. + pending_interrupts ++; - kill (0, sig); // forward signals to child processes if any - if (pending_interrupts > 1) // XXX: should be configurable? time-based? + // NB: the "2" below is intended to skip the effect of the self-induced + // deferred signal coming from the kill() above. + + if (pending_interrupts > 2) // XXX: should be configurable? time-based? { char msg[] = "Too many interrupts received, exiting.\n"; int rc = write (2, msg, sizeof(msg)-1); -- cgit