kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* System Tap help
@ 2012-04-12  5:08 V.Ravikumar
  2012-04-12  5:32 ` V.Ravikumar
  0 siblings, 1 reply; 2+ messages in thread
From: V.Ravikumar @ 2012-04-12  5:08 UTC (permalink / raw)
  To: kernelnewbies

Hi all,
I'm probing sys_write system call using system tap to get modified file
name along with UID.
Here is code snippet.

probe kernel.function ("vfs_write")
{

        filename = user_string($file->f_dentry->d_name->name)  // for
2.6.18 kernel.
        printf ("%d %s\n",uid,filename)
}
I got sample program to get inode number as below
inode_nr = $file->f_path->dentry->d_inode->i_ino . This I changed to get
file name, I'm getting file name as empty.

With above program i'm getting file name as unknown.
My question is does above code snippet is correct to get file name ? If not
could somebody please let me know the correct implementation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120412/784c4cd4/attachment.html 

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

* System Tap help
  2012-04-12  5:08 System Tap help V.Ravikumar
@ 2012-04-12  5:32 ` V.Ravikumar
  0 siblings, 0 replies; 2+ messages in thread
From: V.Ravikumar @ 2012-04-12  5:32 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Apr 12, 2012 at 10:38 AM, V.Ravikumar
<ravikumar.vallabhu@gmail.com>wrote:

> Hi all,
> I'm probing sys_write system call using system tap to get modified file
> name along with UID.
> Here is code snippet.
>
> probe kernel.function ("vfs_write")
> {
>
>         filename = user_string($file->f_dentry->d_name->name)  // for
> 2.6.18 kernel.
>         printf ("%d %s\n",uid,filename)
> }
> I got sample program to get inode number as below
> inode_nr = $file->f_path->dentry->d_inode->i_ino . This I changed to get
> file name, I'm getting file name as empty.
>
> With above program i'm getting file name as unknown.
> My question is does above code snippet is correct to get file name ? If
> not could somebody please let me know the correct implementation.
>
>
I got how to get file name properly.

> filename = user_string($file->f_dentry->d_name->name)  // for 2.6.18
  Here I need to use kernel_string instead of user_string

Regards,
Ravi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120412/4770e93f/attachment.html 

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

end of thread, other threads:[~2012-04-12  5:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-12  5:08 System Tap help V.Ravikumar
2012-04-12  5:32 ` V.Ravikumar

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 NNTP newsgroup(s).