Printing all opened files

Gui,Jian guij@cn.ibm.com
Wed Aug 16 12:19:00 GMT 2006


Jean-Eric Cuendet wrote:
> probe.function("sys_open")
> {
>     print ("Called\n");
> }
> which is called often. But how do I get the file name that was opened to 
> print it out?
> 
You can use the following code to print the filename argument:
probe kernel.function("sys_open")
{
         printf("%s\n", user_string($filename))
}

But it is recommended to reuse the systemtap tapset to avoid writing
your code from the scratch, e.g.
probe syscall.open
{
	printf("%s\n", filename)
}




More information about the Systemtap mailing list