This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH 1/2] initscript: copy uprobes.ko to cache directory
- From: Stefan Hajnoczi <stefanha at redhat dot com>
- To: systemtap at sourceware dot org
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>, Josh Stone <jistone at redhat dot com>, Jonathan Lebon <jlebon at redhat dot com>, Stefan Hajnoczi <stefanha at redhat dot com>
- Date: Fri, 8 Aug 2014 07:33:42 +0100
- Subject: [PATCH 1/2] initscript: copy uprobes.ko to cache directory
- Authentication-results: sourceware.org; auth=none
- References: <1407479623-30970-1-git-send-email-stefanha at redhat dot com>
If the uprobes.ko module was built then it will be needed at staprun
time. Copy the module into the cache directory alongside compiled
scripts.
This patch uses the stap -k option to keep the temporary build directory
around. The uprobes.ko module file can be found in there.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
initscript/systemtap.in | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/initscript/systemtap.in b/initscript/systemtap.in
index 2d770e4..7e9c680 100755
--- a/initscript/systemtap.in
+++ b/initscript/systemtap.in
@@ -457,7 +457,7 @@ prepare_stat_dir () {
}
compile_script () { # script checkcache
- local opts f tmpdir ret
+ local opts f tmpdir ret stap_tmpdir
eval f="$SCRIPT_PATH/$1.stp"
if [ ! -f "$f" ]; then
if [ $ALLOW_CACHEONLY -eq 1 ]; then
@@ -489,8 +489,19 @@ compile_script () { # script checkcache
return 1
fi
pushd "$tmpdir" &> /dev/null
- logex $STAP -m "$1" -p4 -r $KRELEASE $opts "$f"
+ log "Exec: $STAP -m \"$1\" -p4 -r $KRELEASE -k $opts \"$f\""
+ $STAP -m "$1" -p4 -r $KRELEASE -k $opts "$f" >stap.outerr 2>&1
ret=$?
+ cat stap.outerr >> "$LOG_FILE"
+ stap_tmpdir=$(grep 'Keeping temporary directory' stap.outerr | \
+ sed 's/^Keeping temporary directory "\([^"]*\)"/\1/')
+ if [ $ret -eq 0 ]; then
+ if [ -f "$stap_tmpdir/uprobes/uprobes.ko" ]; then
+ logex mkdir -p "$CACHE_PATH/uprobes"
+ logex mv "$stap_tmpdir/uprobes/uprobes.ko" "$CACHE_PATH/uprobes/"
+ ret=$?
+ fi
+ fi
if [ $ret -eq 0 ]; then
$UNAME -a > "$1.opts"
echo $opts >> "$1.opts"
@@ -500,6 +511,7 @@ compile_script () { # script checkcache
slog "Failed to compile script($1)."
fi
popd &> /dev/null
+ [ -n "$stap_tmpdir" ] && rm -rf "$stap_tmpdir"
rm -rf $tmpdir
[ $ret -eq 0 ] && clog "done" || clog "error"
return $ret
--
1.9.3