This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On Thu, Mar 20, 2008 at 11:01:14AM -0700, Jim Keniston wrote:
> On Thu, 2008-03-20 at 12:24 -0500, dave-systemtap@skeptech.org wrote:
> ...
> >
> > This happens to be 2.6.16.19. I'm curious, how often do systemtap
> > scripts need to change in practice because of data struture changes in
> > the kernel?
>
> It's not uncommon, but the tapset maintainers try to shield tapset users
> from this. Grep for "kernel_v" and "LINUX_VERSION_CODE" in
> src/tapset/*.stp to get an idea.
Excellent thank you.
> ...
> > Cool thanks. So based on that code I've chopped out the following function:
> >
> > function get_path:string (dentry:dentry *,vsmnt:vsmount *) %{
> > char *page = (char *)__get_free_page(GFP_KERNEL);
> > sprintf("%s",d_path(dentry, vfsmnt, page, PAGE_SIZE));
> > free_page((unsigned long)page);
> > %}
>
> 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?
> 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);
%}
Thanks again guys, you rock.
--dave
> > ...
> >
> > Thanks
> >
> > --dave
>
> Jim Keniston
>
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |