doc/SystemTap_Beginners_Guide/testsuite/systemtap.bpf/bpf_tests/context_vars2.stp
raw| 1 | global res |
| 2 | probe begin { |
| 3 | printf("BEGIN\n") |
| 4 | } |
| 5 | |
| 6 | probe kernel.function("vfs_read") { |
| 7 | if ($file != 0 && $file->f_cred->usage->counter > 0 && $buf != 0) |
| 8 | res = 1 |
| 9 | } |
| 10 | |
| 11 | probe kernel.function("vfs_read").return { |
| 12 | if (res && $return != 0) |
| 13 | exit() |
| 14 | } |
| 15 | |
| 16 | probe end { |
| 17 | printf("END PASS\n") |
| 18 | } |