-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support for C-style string arguments #10
Comments
I could see this as some kind of |
So, should we pass the str or String in Rust to the probe right now? |
Seems the following code is ok let c_str= CString::new(path).unwrap();
probe::probe_lazy!(opendal, write_start, c_str.as_ptr()); |
Yeah, right now it will work with any argument that can cast |
A native support via something like probe_lazy!(proxy, h1, {
let uri = CString::new("/lol.txt").unwrap();
uri.as_ptr()
});
This happens with both let uri = CString::new("/lol.txt").unwrap();
probe_lazy!(proxy, h1, { uri.as_ptr() });
|
I think you can do this and still be lazy: let uri;
probe_lazy!(proxy, h1, {
uri = CString::new("/lol.txt").unwrap();
uri.as_ptr()
}); It doesn't even need |
Indeed that does the trick, thanks! |
While all probe arguments do have to be
i64
, it seems like addresses to null-terminated strings are supported both by the kernel and bybpftrace
. We may want to make users' lives a little easier by also acceptingCStr
arguments and turning them into their own address.The text was updated successfully, but these errors were encountered: