diff options
author | Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it> | 2009-06-19 00:27:45 +0200 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-06-18 16:31:21 -0700 |
commit | eeb77fbbbd6494ec8b4496cb4e12104cb1c0e4e2 (patch) | |
tree | 260820eb91c5f6795a00639bf3985dde5ac6947b /tapset/target_set.stp | |
parent | ed35c8ac5bc2da83fedfb53d0c283ee8c5c77f39 (diff) | |
download | systemtap-steved-eeb77fbbbd6494ec8b4496cb4e12104cb1c0e4e2.tar.gz systemtap-steved-eeb77fbbbd6494ec8b4496cb4e12104cb1c0e4e2.tar.xz systemtap-steved-eeb77fbbbd6494ec8b4496cb4e12104cb1c0e4e2.zip |
Fix target_set tapset.
Revise acquiring of pid and ppid in fork.return probe -- use returnval()
and pid() instead of pid() and ppid() respectively. Add pid removal on
exit syscall. Use dwarfless syscall probe aliases. Correct formatting.
Signed-off-by: Josh Stone <jistone@redhat.com>
Diffstat (limited to 'tapset/target_set.stp')
-rw-r--r-- | tapset/target_set.stp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tapset/target_set.stp b/tapset/target_set.stp index c7878c52..9a4beced 100644 --- a/tapset/target_set.stp +++ b/tapset/target_set.stp @@ -3,25 +3,33 @@ global _target_set # map: target-set-pid -> ancestor-pid function target_set_pid (pid) { - return ([pid] in _target_set) + return ([pid] in _target_set) } probe begin { - if (target()) _target_set [target()] = stp_pid() + if (target()) + _target_set[target()] = stp_pid() } -probe syscall.fork.return +probe nd_syscall.fork.return { - pid=pid() - if (pid in _target_set) next - ppid=ppid() - if (ppid in _target_set) _target_set[pid]=ppid + pid = returnval() + if (pid in _target_set) + next + ppid = pid() + if (ppid in _target_set) + _target_set[pid] = ppid +} + +probe nd_syscall.exit +{ + delete _target_set[pid()] } function target_set_report () { - printf("target set:\n") - foreach (pid in _target_set+) - printf("%d begat %d\n", _target_set[pid], pid) + printf("target set:\n") + foreach (pid in _target_set+) + printf("%d begat %d\n", _target_set[pid], pid) } |