From 36ef6d6a310d7a4a35a3c505d041e9fbd11125fa Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 21 Aug 2009 16:00:27 -0400 Subject: PR10544: clean up stap child process error handling * util.cxx (stap_system): Take extra verbosity value. Standardize error handling / tracing. * util.h: Corresponding changes. * buildrun.cxx, main.cxx, modsign.cxx: Update callers. --- buildrun.cxx | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'buildrun.cxx') diff --git a/buildrun.cxx b/buildrun.cxx index be3d89ed..796663e0 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -63,11 +63,7 @@ run_make_cmd(systemtap_session& s, string& make_cmd) else make_cmd += " -s >/dev/null"; - if (s.verbose > 1) clog << "Running " << make_cmd << endl; - rc = stap_system (make_cmd.c_str()); - if (rc && s.verbose > 1) - clog << "Error " << rc << " " << strerror(rc) << endl; - return rc; + return stap_system (s.verbose, make_cmd); } static void @@ -253,10 +249,8 @@ kernel_built_uprobes (systemtap_session& s) { string grep_cmd = string ("/bin/grep -q unregister_uprobe ") + s.kernel_build_tree + string ("/Module.symvers"); - int rc = stap_system (grep_cmd.c_str()); - if (rc && s.verbose > 1) - clog << "Error " << rc << " " << strerror(rc) << endl; - return (rc == 0); + + return (stap_system (s.verbose, grep_cmd) == 0); } static bool @@ -306,10 +300,8 @@ copy_uprobes_symbols (systemtap_session& s) string uprobes_home = s.runtime_path + "/uprobes"; string cp_cmd = string("/bin/cp ") + uprobes_home + string("/Module.symvers ") + s.tmpdir; - int rc = stap_system (cp_cmd.c_str()); - if (rc && s.verbose > 1) - clog << "Error " << rc << " " << strerror(rc) << endl; - return rc; + + return stap_system (s.verbose, cp_cmd); } static int @@ -342,8 +334,6 @@ uprobes_pass (systemtap_session& s) int run_pass (systemtap_session& s) { - int rc = 0; - // for now, just spawn staprun string staprun_cmd = string(getenv("SYSTEMTAP_STAPRUN") ?: BINDIR "/staprun") + " " @@ -371,12 +361,7 @@ run_pass (systemtap_session& s) staprun_cmd += s.tmpdir + "/" + s.module_name + ".ko"; - if (s.verbose>1) clog << "Running " << staprun_cmd << endl; - - rc = stap_system (staprun_cmd.c_str ()); - if (rc && s.verbose > 1) - clog << "Error " << rc << " " << strerror(rc) << endl; - return rc; + return stap_system (s.verbose, staprun_cmd); } @@ -512,10 +497,7 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) + name + " -xc /dev/null -include " + header; if (s.verbose < 4) cmd += " >/dev/null 2>&1"; - int rc = stap_system (cmd.c_str()); - if (rc && s.verbose > 1) - clog << "Error " << rc << " " << strerror(rc) << endl; - return rc; + return stap_system (s.verbose, cmd); } -- cgit