This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Printing all opened files


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)
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]