From 984dcc0f89d6e02c1d0a647352358dbc25c110ac Mon Sep 17 00:00:00 2001 From: trz Date: Tue, 4 Apr 2006 14:06:16 +0000 Subject: fix for bug #2511 --- ChangeLog | 4 ++++ runtime/stpd/ChangeLog | 4 ++++ runtime/stpd/stpd.c | 9 +++++---- stp_check.in | 5 +++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b00bba13..dc15a9d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-04 Tom Zanussi + + * stp_check: Change test for relay vs relayfs + 2006-03-30 Martin Hunt * tapsets.cxx (dwarf_derived_probe::emit_registrations): diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog index 8151f5be..9233ccd9 100644 --- a/runtime/stpd/ChangeLog +++ b/runtime/stpd/ChangeLog @@ -1,3 +1,7 @@ +2006-04-04 Tom Zanussi + + * stpd.c (main): Check that /mnt/relay is actually relayfs. + 2006-03-15 Tom Zanussi * stpd.c (main): Add runtime check for relayfs vs relay-on-proc. diff --git a/runtime/stpd/stpd.c b/runtime/stpd/stpd.c index e99f4b47..14107664 100644 --- a/runtime/stpd/stpd.c +++ b/runtime/stpd/stpd.c @@ -53,6 +53,7 @@ gid_t cmd_gid; /* relayfs base file name */ static char stpd_filebase[1024]; +#define RELAYFS_MAGIC 0xF0B4A981 /* if no output file name is specified, use this */ #define DEFAULT_OUTFILE_NAME "probe.out" @@ -211,11 +212,11 @@ int main(int argc, char **argv) if (!outfile_name) outfile_name = DEFAULT_OUTFILE_NAME; } - - if (statfs("/mnt/relay", &st) < 0) - sprintf(stpd_filebase, "/proc/systemtap/stap_%d/cpu", driver_pid); - else + + if ((statfs("/mnt/relay", &st) == 0) && (st.f_type == (long) RELAYFS_MAGIC)) sprintf(stpd_filebase, "/mnt/relay/%d/cpu", getpid()); + else + sprintf(stpd_filebase, "/proc/systemtap/stap_%d/cpu", driver_pid); if (init_stp(stpd_filebase, !quiet)) { //fprintf(stderr, "Couldn't initialize stpd. Exiting.\n"); diff --git a/stp_check.in b/stp_check.in index 6e429b91..91f641dc 100755 --- a/stp_check.in +++ b/stp_check.in @@ -1,7 +1,8 @@ #!/bin/bash -RELAY=`grep sysfs_create_relay_file /proc/kallsyms` -if [ -n "$RELAY" ] +RELAYFS_FS=`grep relayfs_create_dir /proc/kallsyms` +RELAY=`grep relay_open /proc/kallsyms` +if [ -n "$RELAY" -a -z "$RELAYFS_FS" ] then exit 0 fi -- cgit