diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-08-06 12:06:06 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-08-06 12:06:06 -0400 |
commit | 3c4371661f144c331dd55ee6be8dab57ec2323c8 (patch) | |
tree | 217ccf5864840f14670138b592d90eceacc75fa3 /stap-server | |
parent | 44ab6f3be72e7b5eeaa2514cea0553b87007ee9c (diff) | |
parent | 0317fad416059781b7a152296c1d8b5a012bf925 (diff) | |
download | systemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.tar.gz systemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.tar.xz systemtap-steved-3c4371661f144c331dd55ee6be8dab57ec2323c8.zip |
Merge commit 'origin/master' into pr4225
* commit 'origin/master':
Use relative instead of absolute line. (bug 6611)
move post-0.7 news tidbit to the top
Add test for $$vars, $$params, $$locals.
typographical tweaks for embedded script code
Add $$vars, $$parms, $$locals
Rename $path to $pathname of syscall tapset for 2.6.27
Correct several tests for 2.6.27
c code generation: assert C indentation/nesting cancels out at appropriate points
Tweak test_installcheck for helloworld.meta and traceio2.meta.
Run both tests for installcheck tests.
No need for random suffix file cmdline and sysinfo files in the
Ensure that a systemtap server is available if 'server' is specified
session.h (struct systemtap_session): Added itrace_derived_probe
* syscalls2.stp: Add sys_unlinkat.
Fix on_each_cpu() call for kernels >2.6.26.
Remove unused STAPCONF_MODULE_NSECTIONS
Diffstat (limited to 'stap-server')
-rwxr-xr-x | stap-server | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/stap-server b/stap-server index 16ffe8ee..e825c49a 100755 --- a/stap-server +++ b/stap-server @@ -13,6 +13,9 @@ # contained in the unpacked tree to build the requested systemtap kernel module. # This module is then written to stdout. +# Catch ctrl-c and other termination signals +trap 'terminate' SIGTERM SIGINT + #----------------------------------------------------------------------------- # Helper functions. #----------------------------------------------------------------------------- @@ -143,20 +146,20 @@ function check_compatibility { # function: read_data_file PREFIX # -# Find a file whose name matches '$1.??????' whose first line +# Find a file whose name is '$1' and whose first line # contents are '$1: .*'. Read and echo the first line. function read_data_file { - for f in `ls $1.??????` - do - read < $f - line=$REPLY - data=`expr "$line" : "$1: \\\(.*\\\)"` - if test "X$data" != "X"; then - echo $data - return - fi - done - fatal "ERROR: Data file for $1 not found" + test -f $1 || \ + fatal "ERROR: Data file $1 not found" + + read < $1 + line=$REPLY + data=`expr "$line" : "$1: \\\(.*\\\)"` + if test "X$data" != "X"; then + echo $data + return + fi + fatal "ERROR: Data in file $1 is incorrect" } # function: parse_options [ STAP-OPTIONS ] @@ -312,6 +315,7 @@ function call_stap { else server_p_phase=$p_phase fi + eval stap $cmdline -k -p $server_p_phase \ >> $tmpdir_server/stdout \ 2>> $tmpdir_server/stderr @@ -328,19 +332,21 @@ function create_response { tmpdir_line=`cat stderr | grep "Keeping temp"` tmpdir_stap=`expr "$tmpdir_line" : '.*"\(.*\)".*'` - # Remove the message about keeping th<e stap temp directory from stderr, unless + # Remove the message about keeping the stap temp directory from stderr, unless # the user did request to keep it. - if test $keep_temps != 1; then - sed -i "/^Keeping temp/d" stderr + if test "X$tmpdir_stap" != "X"; then + if test $keep_temps != 1; then + sed -i "/^Keeping temp/d" stderr + fi + + # Add the contents of the stap temp directory to the server output directory + ln -s $tmpdir_stap `basename $tmpdir_stap` fi # If the user specified -p5, remove the name of the kernel module from stdout. if test $p_phase = 5; then sed -i '/\.ko$/d' stdout fi - - # Add the contents of the stap temp directory to the server output directory - ln -s $tmpdir_stap `basename $tmpdir_stap` } # function: package_response @@ -404,6 +410,15 @@ function cleanup { fi } +# function: terminate +# +# Terminate gracefully. +function terminate { + # Clean up + cleanup + exit +} + #----------------------------------------------------------------------------- # Beginning of main line execution. #----------------------------------------------------------------------------- |