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]

Re: More user-space probes


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?

diff --git a/runtime/task_finder.c b/runtime/task_finder.c

index d0a9a40..ffbc3d0 100644

--- a/runtime/task_finder.c

+++ b/runtime/task_finder.c

@@ -153,11 +153,12 @@ __stp_get_mm_path(struct mm_struct *mm, char *buf,
int bu\
flen)

                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, buf, buflen);

+#endif

        }

        else {

                *buf = '\0';

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]