| 1 |
#! stap -u -p2 |
| 2 |
|
| 3 |
function trace (s) { return 0 } |
| 4 |
|
| 5 |
# define some aliases which resolve to kernel functions |
| 6 |
|
| 7 |
probe pipe_read = kernel.function("pipe_read") |
| 8 |
{ |
| 9 |
fname = "pipe_read" |
| 10 |
reading_from_pipe = 1 |
| 11 |
} |
| 12 |
|
| 13 |
probe pipe_write = kernel.function("pipe_write") |
| 14 |
{ |
| 15 |
fname = "pipe_write" |
| 16 |
reading_from_pipe = 0 |
| 17 |
} |
| 18 |
|
| 19 |
# use the aliases, including variables defined in them |
| 20 |
|
| 21 |
probe pipe_read, pipe_write |
| 22 |
{ |
| 23 |
if (reading_from_pipe) |
| 24 |
trace("reading from pipe in " . fname) |
| 25 |
else |
| 26 |
trace("writing to pipe in " . fname) |
| 27 |
} |