summaryrefslogtreecommitdiffstats
path: root/tapset/target_set.stp
blob: c7878c5225928d6710cb3db124d074b076458412 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
}