diff options
author | fche <fche> | 2005-12-08 23:49:23 +0000 |
---|---|---|
committer | fche <fche> | 2005-12-08 23:49:23 +0000 |
commit | 0c6296b282d40c4e39f0af6ddde0d6f74e477147 (patch) | |
tree | 2830a3731c452553a7af3d8e0a309f6ac37bdddf /buildrun.cxx | |
parent | 99675700179e2a22adf8a9492b73864ff8755add (diff) | |
download | systemtap-steved-0c6296b282d40c4e39f0af6ddde0d6f74e477147.tar.gz systemtap-steved-0c6296b282d40c4e39f0af6ddde0d6f74e477147.tar.xz systemtap-steved-0c6296b282d40c4e39f0af6ddde0d6f74e477147.zip |
2005-12-08 Frank Ch. Eigler <fche@elastic.org>
PR 1937
* buildrun.cxx (run_pass): Pass new "-d PID" option to stpd.
Set SIGHUP to SIG_IGN too.
2005-12-08 Frank Ch. Eigler <fche@elastic.org>
PR 1937
* stpd.c (main): Support new "-d" option.
(usage): Document it.
* librelay.c (driver_poll): New function to react to death of
driver process.
(stp_main_loop): Call it if "-d PID" given. Treat SIGHUP like others.
Diffstat (limited to 'buildrun.cxx')
-rw-r--r-- | buildrun.cxx | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index ade972be..05d903d5 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -14,6 +14,7 @@ extern "C" { #include "signal.h" +#include <sys/wait.h> } @@ -41,6 +42,17 @@ lex_cast_qstring(IN const & in) } +template <typename T> +static string +stringify(T t) +{ + ostringstream s; + s << t; + return s.str (); +} + + + int compile_pass (systemtap_session& s) { @@ -117,16 +129,6 @@ compile_pass (systemtap_session& s) } -template <typename T> -static string -stringify(T t) -{ - ostringstream s; - s << t; - return s.str (); -} - - int run_pass (systemtap_session& s) { @@ -141,9 +143,6 @@ run_pass (systemtap_session& s) } else // real run { - // leave parent process alone - sighandler_t oldsig = signal (SIGINT, SIG_IGN); - // for now, just spawn stpd string stpd_cmd = string("sudo ") + string(PKGLIBDIR) + "/stpd " @@ -151,6 +150,8 @@ run_pass (systemtap_session& s) + (s.verbose ? "" : "-q ") + (s.output_file.empty() ? "" : "-o " + s.output_file + " "); + stpd_cmd += "-d " + stringify(getpid()) + " "; + if (s.cmd != "") stpd_cmd += "-c \"" + s.cmd + "\" "; @@ -163,9 +164,10 @@ run_pass (systemtap_session& s) stpd_cmd += s.tmpdir + "/" + s.module_name + ".ko"; if (s.verbose) clog << "Running " << stpd_cmd << endl; + + signal (SIGHUP, SIG_IGN); + signal (SIGINT, SIG_IGN); rc = system (stpd_cmd.c_str ()); - - signal (SIGINT, oldsig); } return rc; |