From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5938 invoked by alias); 13 Jun 2009 23:46:30 -0000 Received: (qmail 5931 invoked by uid 22791); 13 Jun 2009 23:46:29 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_50 X-Spam-Check-By: sourceware.org Received: from mail-bw0-f213.google.com (HELO mail-bw0-f213.google.com) (209.85.218.213) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 13 Jun 2009 23:46:23 +0000 Received: by bwz9 with SMTP id 9so3288116bwz.24 for ; Sat, 13 Jun 2009 16:46:20 -0700 (PDT) Received: by 10.103.165.18 with SMTP id s18mr670826muo.104.1244936779927; Sat, 13 Jun 2009 16:46:19 -0700 (PDT) Received: from debian (chello089079179132.chello.pl [89.79.179.132]) by mx.google.com with ESMTPS id j2sm2493077mue.42.2009.06.13.16.46.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 13 Jun 2009 16:46:19 -0700 (PDT) Mail-From: b27fd52e0b5b653309e0c0f3cbf1b5e80f598a89 Mon Sep 17 00:00:00 2001 From: Przemyslaw Pawelczyk Date: Sat, 13 Jun 2009 23:46:00 -0000 Subject: [PATCH] Fix target_set tapset. To: systemtap@sourceware.org Message-Id: <1244936781.212635.16785@debian> X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00878.txt.bz2 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