better traps; handle broken pipes (head)

This commit is contained in:
Brendan Gregg
2014-07-14 23:40:52 -07:00
parent e332605bce
commit 07942abfb3
2 changed files with 6 additions and 6 deletions

View File

@@ -41,7 +41,7 @@
tracing=/sys/kernel/debug/tracing
opt_duration=0; duration=; opt_interval=0; interval=999999; opt_timestamp=0
opt_tail=0; tcmd=cat; ttext=
trap 'end=1' SIGINT
trap 'end=1' INT QUIT TERM PIPE # sends execution to end tracing section
function usage {
cat <<-END >&2
@@ -133,7 +133,7 @@ while (( !end && (!opt_duration || secs < duration) )); do
done
### end tracing
echo
echo "Ending tracing..."
echo 2>/dev/null
echo "Ending tracing..." 2>/dev/null
warn "echo 0 > function_profile_enabled"
warn "echo > set_ftrace_filter"

View File

@@ -60,7 +60,7 @@
tracing=/sys/kernel/debug/tracing
flock=/var/tmp/.ftrace-lock
opt_duration=0; duration=; opt_pid=0; pid=; pidtext=
trap ':' SIGINT
trap ':' INT QUIT TERM PIPE # sends execution to end tracing section
function usage {
cat <<-END >&2
@@ -148,8 +148,8 @@ else
fi
### end tracing
echo
echo "Ending tracing..."
echo 2>/dev/null
echo "Ending tracing..." 2>/dev/null
warn "echo nop > current_tracer"
(( opt_pid )) && warn "echo > set_ftrace_pid"
warn "echo > set_ftrace_filter"