From 0c6296b282d40c4e39f0af6ddde0d6f74e477147 Mon Sep 17 00:00:00 2001 From: fche Date: Thu, 8 Dec 2005 23:49:23 +0000 Subject: 2005-12-08 Frank Ch. Eigler 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 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. --- buildrun.cxx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'buildrun.cxx') 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 } @@ -41,6 +42,17 @@ lex_cast_qstring(IN const & in) } +template +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 -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; -- cgit