diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-05-17 18:32:37 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-05-17 18:32:37 -0400 |
commit | 332ddc9f7354fe51c32c504087575b3ea2b70990 (patch) | |
tree | 63a82b6d7fbf7ed591b9c3746e05a724aff8e2af /main.cxx | |
parent | 0fe2b97c7b967d833b5588dbf1ef763bb4440ed3 (diff) | |
parent | 277f2b79b02bf69a1d72d05b06086b07bcc6a113 (diff) | |
download | systemtap-steved-332ddc9f7354fe51c32c504087575b3ea2b70990.tar.gz systemtap-steved-332ddc9f7354fe51c32c504087575b3ea2b70990.tar.xz systemtap-steved-332ddc9f7354fe51c32c504087575b3ea2b70990.zip |
Merge commit 'origin/master' into pr6429-comp-unwindsyms
* commit 'origin/master':
suppress "pass-2 failed" messages from "stap -l FOOBAR"; just produce empty output
make the mod_cu_function_cache a hash_map instead of map for more go-go
PR5643: function caching for much faster syscall.* pass-2 processing
Fixed PR 6499 (utrace probe crash).
note "make installcheck" in post-build checkout
Ignores signals when removing the temporary directory.
Add appropriate ChangeLog entry for earlier checkin.
Diffstat (limited to 'main.cxx')
-rw-r--r-- | main.cxx | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -253,7 +253,7 @@ printscript(systemtap_session& s, ostream& o) } } } - } +} int pending_interrupts; @@ -272,6 +272,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 []) { @@ -713,10 +737,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); @@ -1037,6 +1058,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; |