Skip to content

Instantly share code, notes, and snippets.

@larytet
Last active August 24, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larytet/5c361b1a4ee967655f500909026978f9 to your computer and use it in GitHub Desktop.
Save larytet/5c361b1a4ee967655f500909026978f9 to your computer and use it in GitHub Desktop.
// Shorter version of the same, failed after 400 driver restarts
/*
Load and run:
scl enable devtoolset-4 bash
stap -g -p4 -m test_open -v -k test_open.stp
count=0;while [ 1 ];do echo $count;count=$(($count+1));sudo rmmod test_open;sudo staprun test_open.ko -L ;done;
*/
global ARRAY_FILENAME%
global ARRAY_TIMESTAMP%
function current_time:long()
%{ /* pure */
STAP_RETURN(0);
%}
probe syscall.open
{
tid = tid()
ARRAY_FILENAME[tid] = filename
ARRAY_TIMESTAMP[tid] = current_time()
}
probe syscall.open.return
{
tid = tid();
delete ARRAY_FILENAME[tid]
delete ARRAY_TIMESTAMP[tid]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment