/usr/share/systemtap/tapset/target_set.stp is in systemtap-common 1.6-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 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()
}
%( arch != "ia64" && kernel_v >= "2.6.18" %?
probe nd_syscall.fork.return
{
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()]
}
%:
# ia64 systems and pre-2.6.18 systems don't support dwarfless probes,
# so we'll use 'syscall' probes instead of 'nd_syscall' probes.
probe syscall.fork.return
{
pid = $return
if (pid in _target_set)
next
ppid = pid()
if (ppid in _target_set)
_target_set[pid] = ppid
}
probe 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)
}
|