summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/staprun/ChangeLog9
-rw-r--r--runtime/staprun/ctl.c4
-rw-r--r--runtime/staprun/mainloop.c39
3 files changed, 14 insertions, 38 deletions
diff --git a/runtime/staprun/ChangeLog b/runtime/staprun/ChangeLog
index 6aabd983..cebaeb2c 100644
--- a/runtime/staprun/ChangeLog
+++ b/runtime/staprun/ChangeLog
@@ -1,3 +1,12 @@
+2007-09-14 Martin Hunt <hunt@redhat.com>
+
+ * ctl.c (init_ctl_channel): Return 1 if the ctl file opened
+ was for the old relayfs transport.
+
+ * mainloop.c (init_stapio): Don't call using_old_transport().
+ Use the return of init_ctl_channel() instead.
+ (using_old_transport): Deleted.
+
2007-08-31 Martin Hunt <hunt@redhat.com>
* mainloop.c (start_cmd): Set the priority to
diff --git a/runtime/staprun/ctl.c b/runtime/staprun/ctl.c
index 72592bdf..d0b07260 100644
--- a/runtime/staprun/ctl.c
+++ b/runtime/staprun/ctl.c
@@ -16,11 +16,13 @@ int init_ctl_channel(void)
{
char buf[PATH_MAX];
struct statfs st;
+ int old_transport = 0;
if (statfs("/sys/kernel/debug", &st) == 0 && (int) st.f_type == (int) DEBUGFS_MAGIC) {
if (sprintf_chk(buf, "/sys/kernel/debug/systemtap/%s/cmd", modname))
return -1;
} else {
+ old_transport = 1;
if (sprintf_chk(buf, "/proc/systemtap/%s/cmd", modname))
return -1;
}
@@ -34,7 +36,7 @@ int init_ctl_channel(void)
perr("Couldn't open control channel '%s'", buf);
return -1;
}
- return 0;
+ return old_transport;
}
void close_ctl_channel(void)
diff --git a/runtime/staprun/mainloop.c b/runtime/staprun/mainloop.c
index f0952f86..d919164f 100644
--- a/runtime/staprun/mainloop.c
+++ b/runtime/staprun/mainloop.c
@@ -118,38 +118,6 @@ void system_cmd(char *cmd)
}
}
-static int using_old_transport(void)
-{
- struct utsname utsbuf;
- int i;
- long int kver[3];
- char *start, *end;
-
- if (uname(&utsbuf) != 0) {
- _perr("Unable to determine kernel version, uname failed");
- return -1;
- }
-
- start = utsbuf.release;
- for (i = 0; i < 3; i++) {
- errno = 0;
- kver[i] = strtol(start, &end, 10);
- if (errno != 0) {
- _perr("Unable to parse kernel version, strtol failed");
- return -1;
- }
- start = end;
- start++;
- }
-
- if (KERNEL_VERSION(kver[0], kver[1], kver[2])
- <= KERNEL_VERSION(2, 6, 15)) {
- dbug(2, "Using OLD TRANSPORT\n");
- return 1;
- }
- return 0;
-}
-
/* This is only used in the old relayfs code */
static void read_buffer_info(void)
{
@@ -195,12 +163,9 @@ int init_stapio(void)
{
dbug(2, "init_stapio\n");
- use_old_transport = using_old_transport();
- if (use_old_transport < 0)
- return -1;
-
/* create control channel */
- if (init_ctl_channel() < 0) {
+ use_old_transport = init_ctl_channel();
+ if (use_old_transport < 0) {
err("Failed to initialize control channel.\n");
return -1;
}