diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-05-16 11:04:30 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-05-16 11:04:30 -0400 |
commit | 29f04ba18bbff32225559ee93463eb0f9e16bf6a (patch) | |
tree | 7762156a510bf5e712bf44116c3e8071ab41c161 | |
parent | f4da2654099dc4e8bcabe15519078db9ca7650a4 (diff) | |
parent | 3972b443751ef6d0a441bae53ffa57d8a798aee4 (diff) | |
download | systemtap-steved-29f04ba18bbff32225559ee93463eb0f9e16bf6a.tar.gz systemtap-steved-29f04ba18bbff32225559ee93463eb0f9e16bf6a.tar.xz systemtap-steved-29f04ba18bbff32225559ee93463eb0f9e16bf6a.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
* 'master' of ssh://sources.redhat.com/git/systemtap:
Ignores signals when removing the temporary directory.
Add appropriate ChangeLog entry for earlier checkin.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | main.cxx | 33 | ||||
-rw-r--r-- | testsuite/systemtap.examples/ChangeLog | 6 |
3 files changed, 41 insertions, 4 deletions
@@ -1,3 +1,9 @@ +2008-05-15 David Smith <dsmith@redhat.com> + + * main.cxx (setup_signals): New function. + (main): Calls setup_signals() to setup signal handling. When + removing the temporary directory, ignore signals. + 2008-05-13 Ananth N Mavinakayanahalli <ananth@in.ibm.com> PR 5955. * parse.cxx (parser::parse_global): accept ";" terminated globals @@ -261,6 +261,30 @@ void handle_interrupt (int /* sig */) } +void +setup_signals (sighandler_t handler) +{ + struct sigaction sa; + + sa.sa_handler = handler; + sigemptyset (&sa.sa_mask); + if (handler != SIG_IGN) + { + sigaddset (&sa.sa_mask, SIGHUP); + sigaddset (&sa.sa_mask, SIGPIPE); + sigaddset (&sa.sa_mask, SIGINT); + sigaddset (&sa.sa_mask, SIGTERM); + } + sa.sa_flags = 0; + sa.sa_restorer = NULL; + + sigaction (SIGHUP, &sa, NULL); + sigaction (SIGPIPE, &sa, NULL); + sigaction (SIGINT, &sa, NULL); + sigaction (SIGTERM, &sa, NULL); +} + + int main (int argc, char * const argv []) { @@ -698,10 +722,7 @@ main (int argc, char * const argv []) // Set up our handler to catch routine signals, to allow clean // and reasonably timely exit. - signal (SIGHUP, handle_interrupt); - signal (SIGPIPE, handle_interrupt); - signal (SIGINT, handle_interrupt); - signal (SIGTERM, handle_interrupt); + setup_signals(&handle_interrupt); struct tms tms_before; times (& tms_before); @@ -1022,6 +1043,10 @@ pass_5: clog << "Keeping temporary directory \"" << s.tmpdir << "\"" << endl; else { + // Ignore signals while we're deleting the temporary directory. + setup_signals (SIG_IGN); + + // Remove the temporary directory. string cleanupcmd = "rm -rf "; cleanupcmd += s.tmpdir; if (s.verbose>1) clog << "Running " << cleanupcmd << endl; diff --git a/testsuite/systemtap.examples/ChangeLog b/testsuite/systemtap.examples/ChangeLog index 8d8c2ca1..41b70135 100644 --- a/testsuite/systemtap.examples/ChangeLog +++ b/testsuite/systemtap.examples/ChangeLog @@ -1,3 +1,9 @@ +2008-05-09 William Cohen <wcohen@redhat.com> + + * syscalls_by_pid.meta, syscalls_by_proc.meta: + * sigmon.meta, sig_by_pid.meta, sig_by_proc.meta: + * socket-trace.meta: New. + 2008-05-08 William Cohen <wcohen@redhat.com> * iotime.meta: New. |