-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add path() call #29
Comments
This is ultimately useful @brendangregg , I was trying to access
|
@fntlnz - a path() call to print the absolute path of a file would be fantastic. You actually raise something here that I'm looking at now. The `vfs_{read()/write()' calls take a 'struct file' as their first parameter and it looks like its kernel definition isn't exported so what you would really like to do is:
However, bpftrace currently doesn't let you cast to an integral type. I'm looking at that now as it would make this and many other similar things much easier to do. |
@fntlnz - your script won't work as it is anyway as you need to pad out the first 16 bytes as explaiend above. Something like this will work:
|
@tyroguru after some reading of kernel source code I've been able to resolve that struct in this way
Output:
|
@fntlnz - sigh... My bad - I was missing the declaration of 'struct file' in fs.h and only picking up the forward declaration provided in file.h. Thanks for the pointer. |
@brendangregg, did this, or something like it, ever come to pass? Converting either a Or are we still waiting for the underlying function(s) that would unwind an absolute path to be added to BCC first, then implemented in bpftrace? |
Looks like work is being done on a helper for this iovisor/bcc#2544 But it has not been merged yet (https://patchwork.ozlabs.org/patch/1211861/) so it will be a while before this will be available. |
Thanks, It's just not clear (to me) whether that could be leveraged directly to convert a Like, for instance, if you're going to This would imply that another helper would be needed for such cases where the file being manipulated doesn't have an associated file descriptor open at the time. Or I'm just missing something. |
The absolute path is very useful in some performance trace cases, expect this feature. :) |
This was done in #1492, although it only works for a very limited set of kernel functions. |
prototype:
So that this would work:
(or trace kprobe:__vfs_read) and it would print the full path.
For this to work, it may require a new BPF function added to the kernel to make this sane.
The text was updated successfully, but these errors were encountered: