Debian Codegraph @

testsuite/systemtap.examples/general/regex.stp

raw
1 #!/usr/bin/env stap
2 # regex.stp
3 # Uses the regex functionality to detect opened files whose names
4 # match a pattern given on the command line. If no command line
5 # parameter is given, demonstrate by filtering for files that end with
6 # an extension showing them to be an archive.
7
8 probe syscall.open {
9 if (filename =~ %($# == 0 %?
10 "(\\.tar\\.(gz|bz2|xz)|\\.zip|\\.tgz|\\.tbz)$"
11 %: @1 %) ) {
12 printf ("opened %s\n", filename)
13 }
14 }