summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--stapfuncs.5.in9
-rw-r--r--tapset/ChangeLog5
-rw-r--r--tapset/target_set.stp27
-rw-r--r--testsuite/ChangeLog5
-rwxr-xr-xtestsuite/buildok/fortyfive.stp3
6 files changed, 54 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d50fe5d2..f11f2e10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2007-08-16 Frank Ch. Eigler <fche@elastic.org>
+ PR 1315.
+ * stapfuncs.5.in: Document new target_set tapset.
+
+2007-08-16 Frank Ch. Eigler <fche@elastic.org>
+
* Makefile.am (install-exec-hook): Only make staprun setuid if
"make install" is being run as root.
* Makefile.in: Regenerated.
diff --git a/stapfuncs.5.in b/stapfuncs.5.in
index 0a35b543..71af8c9b 100644
--- a/stapfuncs.5.in
+++ b/stapfuncs.5.in
@@ -204,6 +204,15 @@ Return the pid of the target process.
is_return:long ()
Return 1 if the probe point is a return probe. Deprecated.
+.SS TARGET_SET
+.TP
+target_set_pid:long (tid:long)
+Return whether the given process-id is within the "target set", that is whether
+it is a descendent of the top-level target() process.
+.TP
+target_set_report:unknown ()
+Print a report about the target set, and their ancestry.
+
.SS ERRNO
.TP
errno_str:string (e:long)
diff --git a/tapset/ChangeLog b/tapset/ChangeLog
index 87c3db0b..7c96175c 100644
--- a/tapset/ChangeLog
+++ b/tapset/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-16 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 1315.
+ * target_set.stp: New tapset file.
+
2007-08-16 Martin Hunt <hunt@redhat.com>
* aux_syscalls.stp (_sock_family_str):
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)
+}
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index 030848e5..db477c27 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-08-16 Frank Ch. Eigler <fche@elastic.org>
+
+ PR 1315.
+ * buildok/fortyfive.stp: New test.
+
2007-08-16 Josh Stone <joshua.i.stone@intel.com>
PR 4591
diff --git a/testsuite/buildok/fortyfive.stp b/testsuite/buildok/fortyfive.stp
new file mode 100755
index 00000000..0d5b82ed
--- /dev/null
+++ b/testsuite/buildok/fortyfive.stp
@@ -0,0 +1,3 @@
+#! stap -p4
+probe syscall.write { if (target_set_pid (pid())) printf ("%d (%d)\n", pid(), ppid()) }
+probe end { target_set_report () }