From: Przemyslaw Pawelczyk <przemyslaw@pawelczyk.it>
To: systemtap@sourceware.org
Subject: [PATCH 1/2] Fix target_set tapset.
Date: Thu, 18 Jun 2009 22:58:00 -0000 [thread overview]
Message-ID: <1245365905.663140.941@debian> (raw)
In-Reply-To: <1244936781.212635.16785@debian>
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.
---
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..9a4bece 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)
}
--
1.5.6.5
next prev parent reply other threads:[~2009-06-18 22:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-13 23:46 [PATCH] " Przemyslaw Pawelczyk
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 ` Przemyslaw Pawelczyk [this message]
2009-06-19 1:01 ` [PATCH 1/2] " 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=1245365905.663140.941@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).