| 1 |
#! /usr/bin/env stap |
| 2 |
|
| 3 |
// Provide a trace of uniqueish files being written to as per the |
| 4 |
// linux kernel VFS layer. "uniqueish" means best-effort removal |
| 5 |
// of duplicates. |
| 6 |
|
| 7 |
// Optionally, provide a regex on the command line for matching file |
| 8 |
// names of interest. |
| 9 |
|
| 10 |
global recently_written% // wraparound array |
| 11 |
|
| 12 |
probe vfs.write, vfs.writev { |
| 13 |
%( $# > 0 %? if (pathname !~ @1) next; %) |
| 14 |
if (pathname in recently_written) next; |
| 15 |
recently_written[pathname] = 1; |
| 16 |
println(pathname) |
| 17 |
} |