summaryrefslogtreecommitdiffstats
path: root/tapset/target_set.stp
diff options
context:
space:
mode:
authorfche <fche>2007-08-17 02:25:22 +0000
committerfche <fche>2007-08-17 02:25:22 +0000
commit1902aec1df32bb36c7e71b829a65543e9475ced3 (patch)
tree4dcf6e21beaa4c9a7eb74b83bd2165bc2c7d9961 /tapset/target_set.stp
parent7ab87febe805d86b81c393b13e8de69f2ab9b684 (diff)
downloadsystemtap-steved-1902aec1df32bb36c7e71b829a65543e9475ced3.tar.gz
systemtap-steved-1902aec1df32bb36c7e71b829a65543e9475ced3.tar.xz
systemtap-steved-1902aec1df32bb36c7e71b829a65543e9475ced3.zip
2007-08-16 Frank Ch. Eigler <fche@elastic.org>
PR 1315. * target_set.stp: New tapset file. * stapfuncs.5.in: Document new target_set tapset. * buildok/fortyfive.stp: New test.
Diffstat (limited to 'tapset/target_set.stp')
-rw-r--r--tapset/target_set.stp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tapset/target_set.stp b/tapset/target_set.stp
new file mode 100644
index 00000000..c7878c52
--- /dev/null
+++ b/tapset/target_set.stp
@@ -0,0 +1,27 @@
+
+global _target_set # map: target-set-pid -> ancestor-pid
+
+function target_set_pid (pid)
+{
+ return ([pid] in _target_set)
+}
+
+probe begin
+{
+ if (target()) _target_set [target()] = stp_pid()
+}
+
+probe syscall.fork.return
+{
+ pid=pid()
+ if (pid in _target_set) next
+ ppid=ppid()
+ if (ppid in _target_set) _target_set[pid]=ppid
+}
+
+function target_set_report ()
+{
+ printf("target set:\n")
+ foreach (pid in _target_set+)
+ printf("%d begat %d\n", _target_set[pid], pid)
+}