summaryrefslogtreecommitdiffstats
path: root/buildrun.cxx
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@elastic.org>2009-08-21 16:00:27 -0400
committerFrank Ch. Eigler <fche@elastic.org>2009-08-21 16:00:27 -0400
commit36ef6d6a310d7a4a35a3c505d041e9fbd11125fa (patch)
tree46233e0e37d3407a05b9c4e5c3f60c6393171806 /buildrun.cxx
parentb6921d5942950cb988318c36ee0e0792311f1ccc (diff)
downloadsystemtap-steved-36ef6d6a310d7a4a35a3c505d041e9fbd11125fa.tar.gz
systemtap-steved-36ef6d6a310d7a4a35a3c505d041e9fbd11125fa.tar.xz
systemtap-steved-36ef6d6a310d7a4a35a3c505d041e9fbd11125fa.zip
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.
Diffstat (limited to 'buildrun.cxx')
-rw-r--r--buildrun.cxx32
1 files changed, 7 insertions, 25 deletions
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);
}