This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Printing all opened files
- From: "Gui,Jian" <guij at cn dot ibm dot com>
- To: Jean-Eric Cuendet <jec at rptec dot ch>
- Cc: systemtap at sourceware dot org
- Date: Wed, 16 Aug 2006 20:18:58 +0800
- Subject: Re: Printing all opened files
- References: <44E2E6D0.4050205@rptec.ch>
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)
}