kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ravikumar.vallabhu@gmail.com (V.Ravikumar)
To: kernelnewbies@lists.kernelnewbies.org
Subject: System Tap help
Date: Thu, 12 Apr 2012 11:02:17 +0530	[thread overview]
Message-ID: <CA+CftcH92ujFVM30+96eExJfrWLZKcGoxspkR=L=myh1a=n0+g@mail.gmail.com> (raw)
In-Reply-To: <CA+CftcG2xhjTq-REqM14Mv3dS5H4+FjrbyBGhZH1Xvz+Z8e=SQ@mail.gmail.com>

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 

      reply	other threads:[~2012-04-12  5:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12  5:08 System Tap help V.Ravikumar
2012-04-12  5:32 ` V.Ravikumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+CftcH92ujFVM30+96eExJfrWLZKcGoxspkR=L=myh1a=n0+g@mail.gmail.com' \
    --to=ravikumar.vallabhu@gmail.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).