Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/target_set.stp

raw
1 probe begin
2 {
3 stp_pid = stp_pid()
4 printf("%d\n%d begat %d\n", stp_pid, stp_pid, target())
5 }
6
7 # In the below code, why is the following necessary?
8 #
9 # user_long(&@cast($rqtp, "struct timespec")->tv_sec)
10 #
11 # Why not just do '$rqtp->tv_sec'? On s390x and ppc64, because of
12 # syscall wrappers, req_uaddr gets turned into a long. So, 'req_uaddr->tv_sec'
13 # won't work everywhere.
14 #
15 # Why not do '@cast(req_uaddr, "struct timespec")->tv_sec'? The pointer
16 # isn't to kernel memory, but to user memory, so we have to read it
17 # properly.
18
19 probe syscall.nanosleep
20 {
21 if (target_set_pid(pid())
22 && user_long(&@cast(req_uaddr, "struct timespec", "kernel")->tv_sec) == $1)
23 target_set_report()
24 }
25 probe syscall.compat_nanosleep ?
26 {
27 if (target_set_pid(pid())
28 && user_long(&@cast(req_uaddr, "struct compat_timespec", "kernel")->tv_sec) == $1)
29 target_set_report()
30 }
31
32 probe end
33 {
34 target_set_report()
35 }