summaryrefslogtreecommitdiffstats
path: root/main.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2008-07-17 14:54:30 -0400
committerFrank Ch. Eigler <fche@elastic.org>2008-07-17 14:54:30 -0400
commit82737beff97256e26a40cd9cee9c1d3f3e5ac4fa (patch)
tree4b9cc5fd6f8ec9970f66ddf8fd427dd33d776ca4 /main.cxx
parent8a3fc6c9f5336d2a4c8b776799e4ed4fabc5be35 (diff)
downloadsystemtap-steved-82737beff97256e26a40cd9cee9c1d3f3e5ac4fa.tar.gz
systemtap-steved-82737beff97256e26a40cd9cee9c1d3f3e5ac4fa.tar.xz
systemtap-steved-82737beff97256e26a40cd9cee9c1d3f3e5ac4fa.zip
PR6030: control signal relay and accept deferred re-reception
Diffstat (limited to 'main.cxx')
-rw-r--r--main.cxx11
1 files changed, 8 insertions, 3 deletions
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);