diff options
author | Mark Wielaard <mjw@redhat.com> | 2009-03-30 21:18:30 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2009-03-30 21:20:55 +0200 |
commit | bcc2b3536d6efb5857c16704f99b772655981cdd (patch) | |
tree | 04a637e11a980401466f5acfba7cb919c9202b7f /main.cxx | |
parent | 267a544424be10825c57ea3eaa4d908c818211c7 (diff) | |
download | systemtap-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.
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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); |