summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-03-30 21:18:30 +0200
committerMark Wielaard <mjw@redhat.com>2009-03-30 21:20:55 +0200
commitbcc2b3536d6efb5857c16704f99b772655981cdd (patch)
tree04a637e11a980401466f5acfba7cb919c9202b7f
parent267a544424be10825c57ea3eaa4d908c818211c7 (diff)
downloadsystemtap-steved-bcc2b3536d6efb5857c16704f99b772655981cdd.tar.gz
systemtap-steved-bcc2b3536d6efb5857c16704f99b772655981cdd.tar.xz
systemtap-steved-bcc2b3536d6efb5857c16704f99b772655981cdd.zip
PR10016: systemtap kills all processes in process group on signal.
* main.cxx (main): Make sure we run in our own process group.
-rw-r--r--main.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/main.cxx b/main.cxx
index 055c56b8..23b182eb 100644
--- a/main.cxx
+++ b/main.cxx
@@ -845,6 +845,16 @@ main (int argc, char * const argv [])
// directory.
s.translated_source = string(s.tmpdir) + "/" + s.module_name + ".c";
+ // We want a new process group so we can use kill (0, sig) to send a
+ // signal to all children (but not the parent). As done in
+ // handle_interrupt (). Unless we are already the process group leader.
+ if (getpgrp() != getpid() && setpgrp() != 0)
+ {
+ const char* e = strerror (errno);
+ if (! s.suppress_warnings)
+ cerr << "Warning: failed to set new process group: " << e << endl;
+ }
+
// Set up our handler to catch routine signals, to allow clean
// and reasonably timely exit.
setup_signals(&handle_interrupt);