public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it>
To: systemtap@sourceware.org
Subject: [PATCH] Fix target_set tapset.
Date: Sat, 13 Jun 2009 23:46:00 -0000	[thread overview]
Message-ID: <1244936781.212635.16785@debian> (raw)

Add pid removal on exit syscall. Use dwarfless syscall probe aliases.
Correct formatting.
---
 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 c7878c5..e27c3c7 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 = pid()
+	if (pid in _target_set)
+		next
+	ppid = ppid()
+	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)
 }
-- 
1.5.6.5

             reply	other threads:[~2009-06-13 23:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 23:46 Przemyslaw Pawelczyk [this message]
2009-06-15 19:11 ` Josh Stone
2009-06-16 23:13   ` Przemysław Pawełczyk
2009-06-17  1:19     ` Josh Stone
2009-06-17 19:02       ` Frank Ch. Eigler
2009-06-17 19:05       ` Przemysław Pawełczyk
2009-06-17 21:47         ` Josh Stone
2009-06-18 22:58 ` [PATCH 1/2] " Przemyslaw Pawelczyk
2009-06-19  1:01   ` Josh Stone
     [not found]     ` <076001c9f07e$e4a73a40$adf5aec0$@ac.cn>
     [not found]       ` <4A3AF41B.7090804@redhat.com>
2009-07-09  1:04         ` how to get one process's resource usage by systemtap tgh
2009-06-18 22:58 ` [PATCH 2/2] Add test for target_set tapset Przemyslaw Pawelczyk
2009-06-19  1:56   ` Josh Stone
2009-06-19 21:26     ` Przemysław Pawełczyk
2009-06-19 21:27 ` [PATCH v2] " Przemyslaw Pawelczyk
2009-06-20  1:00   ` Przemysław Pawełczyk
2009-06-20  0:33 ` [PATCH v2.5][DRAFT] " Przemyslaw Pawelczyk
2009-06-20 13:43 ` [PATCH v3] " Przemyslaw Pawelczyk
2009-06-22 21:06   ` Josh Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244936781.212635.16785@debian \
    --to=przemyslaw@pawelczyk.it \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).