summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rwxr-xr-xconfigure38
-rw-r--r--configure.ac13
-rw-r--r--runtime/stpd/ChangeLog4
-rw-r--r--runtime/stpd/stpd.c10
-rw-r--r--runtime/transport/ChangeLog23
-rw-r--r--runtime/transport/procfs.c52
-rw-r--r--runtime/transport/relayfs-config.h.in2
-rw-r--r--runtime/transport/relayfs.c104
-rw-r--r--runtime/transport/relayfs.h22
-rw-r--r--runtime/transport/transport.c12
-rwxr-xr-xstp_check.in48
12 files changed, 275 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 16c5032b..abb124db 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-15 Tom Zanussi <zanussi@us.ibm.com>
+
+ * configure.ac: Add check for relayfs version.
+ * configure: Regenerated.
+ * stp_check.in: Remove bundled relayfs loading/compilation, add
+ check for relay (vs relayfs).
+
2006-03-13 Josh Stone <joshua.i.stone@intel.com>
* safety/safety.py: Support IA64 disassembly matching.
diff --git a/configure b/configure
index ad70dbc9..5c566cd0 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CPP EGREP U ANSI2KNR RANLIB ac_ct_RANLIB BUILD_ELFUTILS_TRUE BUILD_ELFUTILS_FALSE stap_LIBS DATE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CPP EGREP U ANSI2KNR RANLIB ac_ct_RANLIB BUILD_ELFUTILS_TRUE BUILD_ELFUTILS_FALSE stap_LIBS DATE RELAYFS_VERSION_GE_4 LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -5203,9 +5203,41 @@ _ACEOF
DATE="$date"
+uname_r=`uname -r`
+relayfs_version_ge_4=0
+as_ac_File=`echo "ac_cv_file_/lib/modules/$uname_r/build/include/linux/relayfs_fs.h" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for /lib/modules/$uname_r/build/include/linux/relayfs_fs.h" >&5
+echo $ECHO_N "checking for /lib/modules/$uname_r/build/include/linux/relayfs_fs.h... $ECHO_C" >&6
+if eval "test \"\${$as_ac_File+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ test "$cross_compiling" = yes &&
+ { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
+echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
+ { (exit 1); exit 1; }; }
+if test -r "/lib/modules/$uname_r/build/include/linux/relayfs_fs.h"; then
+ eval "$as_ac_File=yes"
+else
+ eval "$as_ac_File=no"
+fi
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
+if test `eval echo '${'$as_ac_File'}'` = yes; then
+
+ # grep needs the two tabs in the following line
+ if grep "RELAYFS_CHANNEL_VERSION [456]" /lib/modules/$uname_r/build/include/linux/relayfs_fs.h >/dev/null; then
+ relayfs_version_ge_4=1
+ fi
+
+fi
+
+RELAYFS_VERSION_GE_4="$relayfs_version_ge_4"
+
+
ac_config_headers="$ac_config_headers config.h:config.in"
- ac_config_files="$ac_config_files Makefile systemtap.spec stp_check stap.1 stapprobes.5 stapfuncs.5 stapex.5"
+ ac_config_files="$ac_config_files Makefile systemtap.spec stp_check stap.1 stapprobes.5 stapfuncs.5 stapex.5 runtime/transport/relayfs-config.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -5791,6 +5823,7 @@ do
"stapprobes.5" ) CONFIG_FILES="$CONFIG_FILES stapprobes.5" ;;
"stapfuncs.5" ) CONFIG_FILES="$CONFIG_FILES stapfuncs.5" ;;
"stapex.5" ) CONFIG_FILES="$CONFIG_FILES stapex.5" ;;
+ "runtime/transport/relayfs-config.h" ) CONFIG_FILES="$CONFIG_FILES runtime/transport/relayfs-config.h" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
"config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
@@ -5936,6 +5969,7 @@ s,@BUILD_ELFUTILS_TRUE@,$BUILD_ELFUTILS_TRUE,;t t
s,@BUILD_ELFUTILS_FALSE@,$BUILD_ELFUTILS_FALSE,;t t
s,@stap_LIBS@,$stap_LIBS,;t t
s,@DATE@,$DATE,;t t
+s,@RELAYFS_VERSION_GE_4@,$RELAYFS_VERSION_GE_4,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
diff --git a/configure.ac b/configure.ac
index 99f2916c..e593233d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,8 +52,19 @@ date=`date +%Y-%m-%d`
AC_DEFINE_UNQUOTED(DATE, "$date", [Configuration/build date])
AC_SUBST(DATE, "$date")
+uname_r=`uname -r`
+relayfs_version_ge_4=0
+AC_CHECK_FILE(/lib/modules/$uname_r/build/include/linux/relayfs_fs.h,
+[
+ # grep needs the two tabs in the following line
+ if grep "RELAYFS_CHANNEL_VERSION [[456]]" /lib/modules/$uname_r/build/include/linux/relayfs_fs.h >/dev/null; then
+ relayfs_version_ge_4=1
+ fi
+])
+AC_SUBST(RELAYFS_VERSION_GE_4, "$relayfs_version_ge_4")
+
AC_CONFIG_HEADERS([config.h:config.in])
-AC_CONFIG_FILES(Makefile systemtap.spec stp_check stap.1 stapprobes.5 stapfuncs.5 stapex.5)
+AC_CONFIG_FILES(Makefile systemtap.spec stp_check stap.1 stapprobes.5 stapfuncs.5 stapex.5 runtime/transport/relayfs-config.h)
AC_OUTPUT
if test $build_elfutils = yes; then
diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog
index dfaf199b..8151f5be 100644
--- a/runtime/stpd/ChangeLog
+++ b/runtime/stpd/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-15 Tom Zanussi <zanussi@us.ibm.com>
+
+ * stpd.c (main): Add runtime check for relayfs vs relay-on-proc.
+
2006-03-06 Martin Hunt <hunt@redhat.com>
* librelay.c (start_cmd): Set proper uid/gid before execing
diff --git a/runtime/stpd/stpd.c b/runtime/stpd/stpd.c
index bb1a81e0..e99f4b47 100644
--- a/runtime/stpd/stpd.c
+++ b/runtime/stpd/stpd.c
@@ -23,8 +23,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <strings.h>
+#include <string.h>
#include <sys/wait.h>
+#include <sys/statfs.h>
#include <pwd.h>
#include "librelay.h"
@@ -88,6 +89,7 @@ int main(int argc, char **argv)
{
int c, status;
pid_t pid;
+ struct statfs st;
while ((c = getopt(argc, argv, "mpqrb:n:t:d:c:vo:u:")) != EOF)
{
@@ -210,7 +212,11 @@ int main(int argc, char **argv)
outfile_name = DEFAULT_OUTFILE_NAME;
}
- sprintf(stpd_filebase, "/mnt/relay/%d/cpu", getpid());
+ if (statfs("/mnt/relay", &st) < 0)
+ sprintf(stpd_filebase, "/proc/systemtap/stap_%d/cpu", driver_pid);
+ else
+ sprintf(stpd_filebase, "/mnt/relay/%d/cpu", getpid());
+
if (init_stp(stpd_filebase, !quiet)) {
//fprintf(stderr, "Couldn't initialize stpd. Exiting.\n");
exit(1);
diff --git a/runtime/transport/ChangeLog b/runtime/transport/ChangeLog
index d3b29e37..36667ecc 100644
--- a/runtime/transport/ChangeLog
+++ b/runtime/transport/ChangeLog
@@ -1,3 +1,26 @@
+2006-03-15 Tom Zanussi <zanussi@us.ibm.com>
+
+ * procfs.c (_stp_proc_read): Add ifdef for CONFIG_RELAY.
+ (_stp_get_proc_root): New function.
+ (_stp_force_dir_create): New function.
+ (_stp_register_procfs): Add support for CONFIG_RELAY files in
+ proc.
+
+ * relayfs.c (_stp_subbuf_start): Fix ppc64 compilation error
+ mentioned in bug #2406.
+ (_stp_create_buf_file): New function.
+ (_stp_remove_buf_file): New function.
+ (_stp_relayfs_close): Add support for CONFIG_RELAY.
+ (_stp_relayfs_open): Add support for CONFIG_RELAY.
+
+ * relayfs.h: Add support for CONFIG_RELAY and
+ RELAYFS_VERSION_GE_4.
+ * transport.c (_stp_handle_buf_info.c): Add support for
+ CONFIG_RELAY.
+ * transport (_stp_transport_open.c): Add support for CONFIG_RELAY.
+
+ * relayfs-config.h.in: New file.
+
2006-03-15 Martin Hunt <hunt@redhat.com>
* procfs.c (STP_DEFAULT_BUFFERS): Bump up to 256.
diff --git a/runtime/transport/procfs.c b/runtime/transport/procfs.c
index 96337466..22b14046 100644
--- a/runtime/transport/procfs.c
+++ b/runtime/transport/procfs.c
@@ -31,13 +31,13 @@ _stp_proc_read (struct file *file, char __user *buf, size_t count, loff_t *ppos)
return -EINVAL;
out.cpu = cpu;
-#ifdef RELAYFS_VERSION_GE_4
+#if RELAYFS_VERSION_GE_4 || defined (CONFIG_RELAY)
out.produced = _stp_chan->buf[cpu]->subbufs_produced;
out.consumed = _stp_chan->buf[cpu]->subbufs_consumed;
#else
out.produced = atomic_read(&_stp_chan->buf[cpu]->subbufs_produced);
out.consumed = atomic_read(&_stp_chan->buf[cpu]->subbufs_consumed);
-#endif /* RELAYFS_VERSION_GE_4 */
+#endif /* RELAYFS_VERSION_GE_4 || CONFIG_RELAY */
num = sizeof(out);
if (copy_to_user(buf, &out, num))
@@ -262,6 +262,38 @@ err:
return _stp_current_buffers;
}
+#if defined (STP_RELAYFS) && defined(CONFIG_RELAY)
+struct dentry *module_dir_dentry;
+
+static inline struct dentry *_stp_get_proc_root(void)
+{
+ struct file_system_type *procfs_type;
+ struct super_block *procfs_sb;
+
+ procfs_type = get_fs_type("proc");
+ if (!procfs_type || list_empty(&procfs_type->fs_supers))
+ return NULL;
+ procfs_sb = list_entry(procfs_type->fs_supers.next,
+ struct super_block, s_instances);
+ return procfs_sb->s_root;
+}
+
+static inline struct dentry *_stp_force_dir_creation(const char *dirname, struct dentry *parent)
+{
+ struct dentry *dir_dentry;
+
+ mutex_lock(&parent->d_inode->i_mutex);
+ dir_dentry = lookup_one_len(dirname, parent, strlen(dirname));
+ mutex_unlock(&parent->d_inode->i_mutex);
+ if (IS_ERR(dir_dentry)) {
+ dir_dentry = NULL;
+ remove_proc_entry(dirname, NULL);
+ }
+
+ return dir_dentry;
+}
+#endif /* STP_RELAYFS && CONFIG_RELAY */
+
static int _stp_register_procfs (void)
{
int i;
@@ -270,6 +302,10 @@ static int _stp_register_procfs (void)
int j;
char buf[8];
#endif
+#if defined (CONFIG_RELAY)
+ struct dentry *proc_root_dentry;
+ struct dentry *systemtap_dir_dentry;
+#endif /* CONFIG_RELAY */
struct proc_dir_entry *de;
struct list_head *p, *tmp;
@@ -301,11 +337,23 @@ static int _stp_register_procfs (void)
goto err0;
}
+#if defined (STP_RELAYFS) && defined (CONFIG_RELAY)
+ proc_root_dentry = _stp_get_proc_root();
+ systemtap_dir_dentry = _stp_force_dir_creation(dirname, proc_root_dentry);
+ if (!systemtap_dir_dentry)
+ goto err0;
+#endif /* STP_RELAYFS && CONFIG_RELAY */
/* now create /proc/systemtap/module_name */
_stp_proc_mod = proc_mkdir (THIS_MODULE->name, _stp_proc_root);
if (_stp_proc_mod == NULL)
goto err0;
+#if defined (STP_RELAYFS) && defined (CONFIG_RELAY)
+ module_dir_dentry = _stp_force_dir_creation(THIS_MODULE->name, systemtap_dir_dentry);
+ if (!module_dir_dentry)
+ goto err0;
+#endif /* STP_RELAYFS && CONFIG_RELAY */
+
#ifdef STP_RELAYFS
/* now for each cpu "n", create /proc/systemtap/module_name/n */
for_each_cpu(i) {
diff --git a/runtime/transport/relayfs-config.h.in b/runtime/transport/relayfs-config.h.in
new file mode 100644
index 00000000..57fcc053
--- /dev/null
+++ b/runtime/transport/relayfs-config.h.in
@@ -0,0 +1,2 @@
+/* relayfs version ge 4 */
+#define RELAYFS_VERSION_GE_4 @RELAYFS_VERSION_GE_4@
diff --git a/runtime/transport/relayfs.c b/runtime/transport/relayfs.c
index 0754d320..6cf240fd 100644
--- a/runtime/transport/relayfs.c
+++ b/runtime/transport/relayfs.c
@@ -20,7 +20,7 @@
#include "relayfs.h"
-#ifdef RELAYFS_VERSION_GE_4
+#if RELAYFS_VERSION_GE_4 || defined (CONFIG_RELAY)
/**
* _stp_subbuf_start - subbuf_start() relayfs callback implementation
@@ -28,7 +28,7 @@
static int _stp_subbuf_start(struct rchan_buf *buf,
void *subbuf,
void *prev_subbuf,
- unsigned int prev_padding)
+ size_t prev_padding)
{
if (relay_buf_full(buf))
return 0;
@@ -36,7 +36,7 @@ static int _stp_subbuf_start(struct rchan_buf *buf,
if (prev_subbuf)
*((unsigned *)prev_subbuf) = prev_padding;
- subbuf_start_reserve(buf, sizeof(prev_padding));
+ subbuf_start_reserve(buf, sizeof(unsigned int));
return 1;
}
@@ -69,22 +69,83 @@ static void _stp_buf_full(struct rchan_buf *buf,
*((unsigned *)subbuf) = padding;
}
-#endif /* RELAYFS_VERSION_GE_4 */
+#endif /* RELAYFS_VERSION_GE_4 || CONFIG_RELAY */
+
+#if defined (CONFIG_RELAY)
+static struct dentry *_stp_create_buf_file(const char *filename,
+ struct dentry *parent,
+ int mode,
+ struct rchan_buf *buf,
+ int *is_global)
+{
+ struct proc_dir_entry *pde;
+ struct dentry *dentry;
+ struct proc_dir_entry *parent_pde = NULL;
+
+ if (parent)
+ parent_pde = PDE(parent->d_inode);
+ pde = create_proc_entry(filename, S_IFREG|S_IRUSR, parent_pde);
+ if (unlikely(!pde))
+ return NULL;
+ pde->proc_fops = &relay_file_operations;
+
+ mutex_lock(&parent->d_inode->i_mutex);
+ dentry = lookup_one_len(filename, parent, strlen(filename));
+ mutex_unlock(&parent->d_inode->i_mutex);
+ if (IS_ERR(dentry))
+ remove_proc_entry(filename, parent_pde);
+
+ dentry->d_inode->u.generic_ip = buf;
+
+ return dentry;
+}
+
+static int _stp_remove_buf_file(struct dentry *dentry)
+{
+ struct proc_dir_entry *pde = PDE(dentry->d_inode);
+
+ remove_proc_entry(pde->name, pde->parent);
+
+ return 0;
+}
+#endif /* CONFIG_RELAY */
/* relayfs callback functions */
+#if defined (CONFIG_RELAY)
+static struct rchan_callbacks stp_rchan_callbacks =
+{
+ .subbuf_start = _stp_subbuf_start,
+ .create_buf_file = _stp_create_buf_file,
+ .remove_buf_file = _stp_remove_buf_file,
+};
+#else
static struct rchan_callbacks stp_rchan_callbacks =
{
.subbuf_start = _stp_subbuf_start,
-#ifndef RELAYFS_VERSION_GE_4
+#if !RELAYFS_VERSION_GE_4
.buf_full = _stp_buf_full,
-#endif /* RELAYFS_VERSION_GE_4 */
+#endif /* !RELAYFS_VERSION_GE_4 */
};
+#endif /* CONFIG_RELAY */
/**
* _stp_relayfs_close - destroys relayfs channel
* @chan: the relayfs channel
* @dir: the directory containing the relayfs files
*/
+#if defined (CONFIG_RELAY)
+void _stp_relayfs_close(struct rchan *chan, struct dentry *dir)
+{
+ if (!chan)
+ return;
+
+ relay_close(chan);
+ if (dir) {
+ struct proc_dir_entry *pde = PDE(dir->d_inode);
+ remove_proc_entry(pde->name, pde->parent);
+ }
+}
+#else
void _stp_relayfs_close(struct rchan *chan, struct dentry *dir)
{
if (!chan)
@@ -94,6 +155,7 @@ void _stp_relayfs_close(struct rchan *chan, struct dentry *dir)
if (dir)
relayfs_remove_dir(dir);
}
+#endif /* CONFIG_RELAY */
/**
* _stp_relayfs_open - create relayfs channel
@@ -101,11 +163,38 @@ void _stp_relayfs_close(struct rchan *chan, struct dentry *dir)
* @subbuf_size: size of relayfs sub-buffers
* @pid: daemon pid
* @outdir: receives directory dentry
+ * @parentdir: parent directory dentry
*
* Returns relay channel, NULL on failure
*
* Creates relayfs files as /systemtap/pid/cpuX in relayfs root
*/
+#if defined (CONFIG_RELAY)
+extern struct dentry *module_dentry;
+struct rchan *_stp_relayfs_open(unsigned n_subbufs,
+ unsigned subbuf_size,
+ int pid,
+ struct dentry **outdir,
+ struct dentry *parent_dir)
+{
+ char dirname[16];
+ struct rchan *chan;
+ struct dentry* dir = NULL;
+
+ sprintf(dirname, "%d", pid);
+
+ /* TODO: need to create systemtap dir */
+ chan = relay_open("cpu", parent_dir, subbuf_size,
+ n_subbufs, &stp_rchan_callbacks);
+ if (!chan) {
+ printk("STP: couldn't create relayfs channel.\n");
+ if (dir)
+ remove_proc_entry(dirname, NULL);
+ }
+ *outdir = dir;
+ return chan;
+}
+#else
struct rchan *_stp_relayfs_open(unsigned n_subbufs,
unsigned subbuf_size,
int pid,
@@ -124,7 +213,7 @@ struct rchan *_stp_relayfs_open(unsigned n_subbufs,
return NULL;
}
-#ifdef RELAYFS_VERSION_GE_4
+#if RELAYFS_VERSION_GE_4
chan = relay_open("cpu", dir, subbuf_size,
n_subbufs, &stp_rchan_callbacks);
#else
@@ -141,6 +230,7 @@ struct rchan *_stp_relayfs_open(unsigned n_subbufs,
*outdir = dir;
return chan;
}
+#endif /* CONFIG_RELAY */
#endif /* _TRANSPORT_RELAYFS_C_ */
diff --git a/runtime/transport/relayfs.h b/runtime/transport/relayfs.h
index 5ca174e4..aafb26b2 100644
--- a/runtime/transport/relayfs.h
+++ b/runtime/transport/relayfs.h
@@ -5,16 +5,30 @@
* @brief Header file for relayfs transport
*/
-#ifdef RELAYFS_VERSION_GE_4
-#include <linux/relayfs_fs.h>
+#include "relayfs-config.h"
+
+#if defined (CONFIG_RELAYFS_FS) || defined (CONFIG_RELAYFS_FS_MODULE)
+# include <linux/relayfs_fs.h>
+#elif defined (CONFIG_RELAY)
+# include <linux/relay.h>
+# include <linux/namei.h>
#else
-#include "../relayfs/linux/relayfs_fs.h"
-#endif /* RELAYFS_VERSION_GE_4 */
+# undef STP_RELAYFS
+#endif
+#if defined (CONFIG_RELAY)
+struct rchan *_stp_relayfs_open(unsigned n_subbufs,
+ unsigned subbuf_size,
+ int pid,
+ struct dentry **outdir,
+ struct dentry *parent_dir);
+#else
struct rchan *_stp_relayfs_open(unsigned n_subbufs,
unsigned subbuf_size,
int pid,
struct dentry **outdir);
+#endif
+
void _stp_relayfs_close(struct rchan *chan, struct dentry *dir);
#endif /* _TRANSPORT_RELAYFS_H_ */
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index a38d1f56..01bab497 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -82,13 +82,13 @@ static void _stp_handle_buf_info(int *cpuptr)
struct buf_info out;
out.cpu = *cpuptr;
-#ifdef RELAYFS_VERSION_GE_4
+#if RELAYFS_VERSION_GE_4 || defined (CONFIG_RELAY)
out.produced = _stp_chan->buf[*cpuptr]->subbufs_produced;
out.consumed = _stp_chan->buf[*cpuptr]->subbufs_consumed;
#else
out.produced = atomic_read(&_stp_chan->buf[*cpuptr]->subbufs_produced);
out.consumed = atomic_read(&_stp_chan->buf[*cpuptr]->subbufs_consumed);
-#endif /* RELAYFS_VERSION_GE_4 */
+#endif /* RELAYFS_VERSION_GE_4 || CONFIG_RELAY */
_stp_transport_send(STP_BUF_INFO, &out, sizeof(out));
}
@@ -190,6 +190,10 @@ void _stp_transport_close()
kbug("---- CLOSED ----\n");
}
+#if defined (STP_RELAYFS) && defined (CONFIG_RELAY)
+extern struct dentry *module_dir_dentry;
+#endif /* STP_RELAYFS && CONFIG_RELAY */
+
/**
* _stp_transport_open - open proc and relayfs channels
* with proper parameters
@@ -223,7 +227,11 @@ int _stp_transport_open(struct transport_info *info)
info->n_subbufs = n_subbufs;
info->subbuf_size = subbuf_size;
+#if defined (CONFIG_RELAY)
+ _stp_chan = _stp_relayfs_open(n_subbufs, subbuf_size, _stp_pid, &_stp_dir, module_dir_dentry);
+#else
_stp_chan = _stp_relayfs_open(n_subbufs, subbuf_size, _stp_pid, &_stp_dir);
+#endif /* CONFIG_RELAY */
if (!_stp_chan) {
_stp_unregister_procfs();
return -ENOMEM;
diff --git a/stp_check.in b/stp_check.in
index defc0a62..6e429b91 100755
--- a/stp_check.in
+++ b/stp_check.in
@@ -1,46 +1,9 @@
#!/bin/bash
-load_module()
-{
- ret=1
- if [ -e "$MODULE" ]
- then
- /sbin/insmod $MODULE
- ret=$?
- fi
-
- if [ "$ret" -ne 0 ]
- then
- echo "$MODULE_NAME not in kernel and not built. Compiling..."
- mkdir -p $MODULE_DIR
- cp -dpr $SRC_DIR/* $MODULE_DIR
- make -w -C $MODULE_DIR
- if [ "$?" -ne 0 ]
- then
- echo "Failed to load module $MODULE_NAME."
- exit $?
- fi
-
- /sbin/insmod $MODULE
- if [ "$?" -ne 0 ]
- then
- echo "Failed to load module $MODULE_NAME."
- exit $?
- fi
- fi
-}
-
-prefix=@prefix@
-VAR_DIR=@localstatedir@/cache/systemtap
-
-RELAYFS=`grep relayfs /proc/filesystems`
-if [ -z "$RELAYFS" ]
+RELAY=`grep sysfs_create_relay_file /proc/kallsyms`
+if [ -n "$RELAY" ]
then
- MODULE_NAME=relayfs
- MODULE_DIR=$VAR_DIR/relayfs
- MODULE=$MODULE_DIR/relayfs.ko
- SRC_DIR=@datadir@/systemtap/runtime/relayfs
- load_module
+ exit 0
fi
if [ ! -d "/mnt/relay" ]
@@ -54,3 +17,8 @@ then
mount -t relayfs relayfs /mnt/relay
fi
+RELAYFS_FS=`grep relayfs /proc/kallsyms`
+if [ -z "$RELAYFS_FS" ]
+then
+ exit 1
+fi