public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Unable to probe filp_open and target variables therein
@ 2006-05-26 22:55 Gaurav Poothia
  2006-05-30 17:25 ` Jim Keniston
  0 siblings, 1 reply; 2+ messages in thread
From: Gaurav Poothia @ 2006-05-26 22:55 UTC (permalink / raw)
  To: systemtap

Hi!

I am new to system tap and am trying out some simple stuff like a script
to print all files opened using flip_open in the kernel. The reason I
chose flip_open over the open system call was because some chaps call this
api when accessing files from INSIDE the kernel.


So I wrote this script which uses 2 target variables: $flags and $filename

---------------------------------------------------------------------------
probe kernel.function("filp_open")
{
        if($flags & 1)  // O_WRONLY passed
        {
        readOrWrite = "write"
        }
        else    //O_RDONLY flag maybe passed
        {
        readOrWrite = "read"
        }
        if($flags & 2)  //O_RDWR flag
        {
        readOrWrite = "read and write"
        }

        printf("%s app with pid %d: opening file %s for %s\n", execname(), pid(), $filename, readOrWrite)
}

probe timer.ms(100000) #after 100 sec
{
        exit()
}
--------------------------------------------------------------------------
which refused to run with the following errors:
--------------------------------------------------------------------------
Pass 1: parsed user script and 11 library script(s) in 90usr/0sys/93real ms.
semantic error: unresolved target-symbol expression: identifier '$flags' at ./test.stp:3:5
semantic error: unresolved target-symbol expression: identifier '$flags' at ./test.stp:11:12
semantic error: unresolved target-symbol expression: identifier '$filename' at ./test.stp:16:76
semantic error: unresolved target-symbol expression: identifier '$flags' at ./test.stp:3:5
semantic error: unresolved target-symbol expression: identifier '$flags' at ./test.stp:11:12
semantic error: unresolved target-symbol expression: identifier '$filename' at ./test.stp:16:76
Pass 2: analyzed script: 2 probe(s), 3 function(s), 0 global(s) in 190usr/90sys/302real ms.
Pass 2: analysis failed.
--------------------------------------------------------------------------

Then I tried a less ambitious script:
-------------------------------------------------------------------------
probe kernel.function("filp_open")
{

        printf("%s app with pid %d: opening\n", execname(), pid())
}

probe timer.ms(100000) #after 100 sec
{
        exit()
}
------------------------------------------------------------------------

Now this one produces no output whatsoever (but no errors either)


How can I get this stuff to work? Any ideas?

Thanks
-Gaurav

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-05-30 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-26 22:55 Unable to probe filp_open and target variables therein Gaurav Poothia
2006-05-30 17:25 ` Jim Keniston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).