This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: dereferencing filenames from a vfs_write probe
On Thu, 2008-03-20 at 16:04 -0500, dave@skeptech.org wrote:
...
> >
> > Keep in mind that a handler mustn't sleep, so you should use GFP_ATOMIC
> > rather than GFP_KERNEL.
>
> Thanks. I'd be lying if I said I understood the distinction. Can anyone
> reccommend a book/site to help a sysadmin familiar with C get up to speed on
> the kernel internals?
Don't ask me about books. I'm still using "Understanding the Linux
Kernel" by Boven & Cesati (published by O'Reilly). The edition I have
on hand is old -- each chapter has a section called "Anticipating Linux
2.4" -- but much of the info is still relevant.
In the kernel source, cd Documentation, and fire away with ls, find, and
grep. On the web, www.kroah.com/linux has some good stuff.
http://kernelnewbies.org is another possibility.
>
> > And yeah, the dentry and vsmnt args should be declared long and cast to
> > the appropriate pointer types.
>
> So below is the resultant (fully operational) function. Hopefully this
> is resonably safe to use?
>
> function get_path:string (da:long, va:long) %{
> char *page = (char *)__get_free_page(GFP_ATOMIC);
> struct dentry *dentry = (struct dentry *)((long)THIS->da);
> struct vfsmount *vfsmnt = (struct vfsmount *)((long)THIS->va);
> snprintf(THIS->__retvalue, MAXSTRINGLEN, "%s", d_path(dentry, vfsmnt, page, PAGE_SIZE));
> free_page((unsigned long)page);
> %}
That looks correct to me.
>
> Thanks again guys, you rock.
This will be news to my children. :-)
>
> --dave
Jim