summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/ctl.c
diff options
context:
space:
mode:
authorMartin Hunt <hunt@redhat.com>2008-04-21 16:50:52 -0400
committerMartin Hunt <hunt@redhat.com>2008-04-21 16:50:52 -0400
commitb197bf0b2a6267b73edcdbf68c73d259bf6a6e6a (patch)
tree0daf7bc638ce8f095cbb2251726e71cb52c1fdc3 /runtime/staprun/ctl.c
parent159cb10989a9d6c1d28fc5d1fa5506a75046a9f7 (diff)
downloadsystemtap-steved-b197bf0b2a6267b73edcdbf68c73d259bf6a6e6a.tar.gz
systemtap-steved-b197bf0b2a6267b73edcdbf68c73d259bf6a6e6a.tar.xz
systemtap-steved-b197bf0b2a6267b73edcdbf68c73d259bf6a6e6a.zip
Change staprun to exec stapio. Add "-d" option to staprun.
Diffstat (limited to 'runtime/staprun/ctl.c')
-rw-r--r--runtime/staprun/ctl.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/runtime/staprun/ctl.c b/runtime/staprun/ctl.c
index af7e6c1a..15c5c3d3 100644
--- a/runtime/staprun/ctl.c
+++ b/runtime/staprun/ctl.c
@@ -12,38 +12,35 @@
#include "staprun.h"
-int init_ctl_channel(int symbols)
+int init_ctl_channel(const char *name, int verb)
{
- char *cname, buf[PATH_MAX];
+ char buf[PATH_MAX];
struct statfs st;
int old_transport = 0;
-
- if (symbols)
- cname = ".symbols";
- else
- cname = ".cmd";
- if (statfs("/sys/kernel/debug", &st) == 0 && (int) st.f_type == (int) DEBUGFS_MAGIC) {
- if (sprintf_chk(buf, "/sys/kernel/debug/systemtap/%s/%s", modname, cname))
+ if (statfs("/sys/kernel/debug", &st) == 0 && (int)st.f_type == (int)DEBUGFS_MAGIC) {
+ if (sprintf_chk(buf, "/sys/kernel/debug/systemtap/%s/.cmd", name))
return -1;
} else {
old_transport = 1;
- if (sprintf_chk(buf, "/proc/systemtap/%s/%s", modname, cname))
+ if (sprintf_chk(buf, "/proc/systemtap/%s/.cmd", name))
return -1;
}
-
- dbug(2, "Opening %s\n", buf);
+
+ dbug(2, "Opening %s\n", buf);
control_channel = open(buf, O_RDWR);
if (control_channel < 0) {
- if (attach_mod && errno == ENOENT)
- err("ERROR: Can not attach. Module %s not running.\n", modname);
- else
- perr("Couldn't open control channel '%s'", buf);
+ if (verb) {
+ if (attach_mod && errno == ENOENT)
+ err("ERROR: Can not attach. Module %s not running.\n", name);
+ else
+ perr("Couldn't open control channel '%s'", buf);
+ }
return -1;
}
if (set_clexec(control_channel) < 0)
return -1;
-
+
return old_transport;
}