This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: More user-space probes
On Thursday 24 April 2008 11:25:40 pm David Smith wrote:
> Srinivasa D S wrote:
> > On Tuesday 22 April 2008 07:10:32 pm David Smith wrote:
> >>> (Internally, these are implemented using utrace. These probe types
> >>> also
> >>
> >> use the new "task_finder" framework, which provides the support by
> >> probing by PID or by PATH. Eventually, the existing uprobes probes (and
> >> the future itrace probes) should be converted to use the "task_finder"
> >> framework.)
> >>
> >> Feel free to try out the new probe types and let me know if you find any
> >> issues.
> >
> > I hit a compilation error while testing new probes mentioned in the
> > mail on my 2.6.25-rc6 ppc system.
> >
> > In file included from
> > /tmp/stapTlEH0O/stap_eaf6c06588419104dbe101b4d46dbe00_410.c:108:
> > /usr/local/share/systemtap/runtime/task_finder.c: In function
> > '__stp_get_mm_path':
> > /usr/local/share/systemtap/runtime/task_finder.c:158: warning: passing
> > argument 1 of 'd_path' from incompatible pointer type
> > /usr/local/share/systemtap/runtime/task_finder.c:158: warning: passing
> > argument 2 of 'd_path' from incompatible pointer type
> > /usr/local/share/systemtap/runtime/task_finder.c:158: warning: passing
> > argument 3 of 'd_path' makes integer from pointer without a cast
> > /usr/local/share/systemtap/runtime/task_finder.c:158: error: too many
> > arguments to function 'd_path'
> >
> > With below fix, It worked for me, But Iam not sure about holding
> > reference (through mntget(),dget()) dentry and mnt object while calling
> > d_path. Please let me know your comments on this.
> >
> >
> > ---
> > runtime/task_finder.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > Index: src/runtime/task_finder.c
> > ===================================================================
> > --- src.orig/runtime/task_finder.c
> > +++ src/runtime/task_finder.c
> > @@ -153,11 +153,8 @@ __stp_get_mm_path(struct mm_struct *mm,
> > vma = vma->vm_next;
> > }
> > if (vma) {
> > - struct vfsmount *mnt = mntget(vma->vm_file->f_vfsmnt);
> > - struct dentry *dentry = dget(vma->vm_file->f_dentry);
> > - rc = d_path(dentry, mnt, buf, buflen);
> > - dput(dentry);
> > - mntput(mnt);
> > + struct path p = vma->vm_file->f_path;
> > + rc = d_path(&p, buf, buflen);
> > }
> > else {
> > *buf = '\0';
>
> Here's what I just checked in. Can you check and see if it works for you?
>
No, It didn't worked for me. I did a small change to it and now it works.
---
runtime/task_finder.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
Index: src/runtime/task_finder.c
===================================================================
--- src.orig/runtime/task_finder.c
+++ src/runtime/task_finder.c
@@ -153,11 +153,16 @@ __stp_get_mm_path(struct mm_struct *mm,
vma = vma->vm_next;
}
if (vma) {
- struct vfsmount *mnt = mntget(vma->vm_file->f_vfsmnt);
- struct dentry *dentry = dget(vma->vm_file->f_dentry);
- rc = d_path(dentry, mnt, buf, buflen);
- dput(dentry);
- mntput(mnt);
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
+
+ ? ? ? ? ? ? ? rc = d_path(vma->vm_file->f_dentry,
+ vma->vm_file->f_vfsmnt, buf, buflen);
+
+ #else
+
+ rc = d_path(&(vma->vm_file->f_path), buf, buflen);
+
+ #endif
}
else {
*buf = '\0';