public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: systemtap@sourceware.org
Cc: "Frank Ch. Eigler" <fche@redhat.com>,
	Josh Stone <jistone@redhat.com>,
	       Jonathan Lebon <jlebon@redhat.com>,
	       Stefan Hajnoczi <stefanha@redhat.com>
Subject: [PATCH 1/2] initscript: copy uprobes.ko to cache directory
Date: Fri, 08 Aug 2014 06:33:00 -0000	[thread overview]
Message-ID: <1407479623-30970-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1407479623-30970-1-git-send-email-stefanha@redhat.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

  reply	other threads:[~2014-08-08  6:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08  6:33 [PATCH 0/2] initscript: add support for uprobes scripts Stefan Hajnoczi
2014-08-08  6:33 ` Stefan Hajnoczi [this message]
2014-08-08  6:33 ` [PATCH 2/2] initscript: allow scripts to load uprobes Stefan Hajnoczi
2014-08-08  7:24 ` [PATCH 0/2] initscript: add support for uprobes scripts Masami Hiramatsu
2014-08-11 13:45   ` Stefan Hajnoczi
2014-08-08 17:21 ` Josh Stone
2014-08-11 13:20   ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407479623-30970-2-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=fche@redhat.com \
    --cc=jistone@redhat.com \
    --cc=jlebon@redhat.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).