From 0aaf677efbf70fd173d241c01632b4eacc8226e5 Mon Sep 17 00:00:00 2001 From: fche Date: Fri, 19 Aug 2005 15:55:39 +0000 Subject: 2005-08-19 Frank Ch. Eigler * librelay.c (modpath): New global. Use it for insmod only. * stpd.c (main): Set both modpath and modname, to support modules specified by full path name. --- runtime/stpd/ChangeLog | 6 ++++++ runtime/stpd/librelay.c | 5 +++-- runtime/stpd/stpd.c | 11 ++++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) (limited to 'runtime/stpd') diff --git a/runtime/stpd/ChangeLog b/runtime/stpd/ChangeLog index c1f1530e..e9b1a793 100644 --- a/runtime/stpd/ChangeLog +++ b/runtime/stpd/ChangeLog @@ -1,3 +1,9 @@ +2005-08-19 Frank Ch. Eigler + + * librelay.c (modpath): New global. Use it for insmod only. + * stpd.c (main): Set both modpath and modname, to support + modules specified by full path name. + 2005-08-19 Martin Hunt * stpd.c (main): Simplify buffer size code. diff --git a/runtime/stpd/librelay.c b/runtime/stpd/librelay.c index fabbd145..6bceb99f 100644 --- a/runtime/stpd/librelay.c +++ b/runtime/stpd/librelay.c @@ -84,6 +84,7 @@ static int control_channel; extern int print_only, quiet, merge, verbose; extern unsigned int buffer_size; extern char *modname; +extern char *modpath; /* per-cpu buffer info */ static struct buf_status @@ -424,7 +425,7 @@ int init_stp(const char *relay_filebase, int print_summary) perror ("vfork"); exit(-1); } else if (pid == 0) { - if (execl("/sbin/insmod", "insmod", modname, buf, NULL) < 0) + if (execl("/sbin/insmod", "insmod", modpath, buf, NULL) < 0) exit(-1); } if (waitpid(pid, &rstatus, 0) < 0) { @@ -432,7 +433,7 @@ int init_stp(const char *relay_filebase, int print_summary) exit(-1); } if (WIFEXITED(rstatus) && WEXITSTATUS(rstatus)) { - fprintf(stderr, "ERROR, couldn't insmod probe module %s\n", modname); + fprintf(stderr, "ERROR, couldn't insmod probe module %s\n", modpath); return -1; } diff --git a/runtime/stpd/stpd.c b/runtime/stpd/stpd.c index db0f328e..0a4cf57a 100644 --- a/runtime/stpd/stpd.c +++ b/runtime/stpd/stpd.c @@ -37,6 +37,7 @@ int merge = 1; int verbose = 0; unsigned int buffer_size = 0; char *modname = NULL; +char *modpath = NULL; /* relayfs base file name */ static char stpd_filebase[1024]; @@ -104,7 +105,15 @@ int main(int argc, char **argv) } if (optind < argc) - modname = argv[optind++]; + { + /* Collect both full path and just the trailing module name. */ + modpath = argv[optind++]; + modname = rindex (modpath, '/'); + if (modname == NULL) + modname = modpath; + else + modname++; /* skip over / */ + } if (!modname) { fprintf (stderr, "Cannot invoke daemon without probe module\n"); -- cgit