Skip to content

query: add kprobe_multi & uprobe_multi link info fields that require second info call#1380

Merged
d-e-s-o merged 2 commits into
libbpf:masterfrom
ver-nyan:k/uprobe_multi-link-info
Apr 24, 2026
Merged

query: add kprobe_multi & uprobe_multi link info fields that require second info call#1380
d-e-s-o merged 2 commits into
libbpf:masterfrom
ver-nyan:k/uprobe_multi-link-info

Conversation

@ver-nyan
Copy link
Copy Markdown
Contributor

Added KprobeMultiLinkInfo & UprobeMultiLinkInfo fields that required a second info call.

@d-e-s-o
Copy link
Copy Markdown
Collaborator

d-e-s-o commented Apr 20, 2026

Sorry for the delay, will try and get to it tomorrow.

@d-e-s-o d-e-s-o self-requested a review April 20, 2026 17:11
@d-e-s-o d-e-s-o self-assigned this Apr 20, 2026
@ver-nyan
Copy link
Copy Markdown
Contributor Author

No worries! this feature isn't urgent me.

Copy link
Copy Markdown
Collaborator

@d-e-s-o d-e-s-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall seems reasonable to me. Few minor comments.

Comment thread libbpf-rs/src/query.rs Outdated
let ret = unsafe {
libbpf_sys::bpf_obj_get_info_by_fd(
fd.as_raw_fd(),
item_ptr as *mut c_void,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
item_ptr as *mut c_void,
item_ptr.cast(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And can you please rebase on top of master?

Comment thread libbpf-rs/src/query.rs Outdated
/// Size of the path.
pub path_size: u32,
/// The absolute file path of the binary being probed.
pub path: Option<CString>,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's a path should we make it a PathBuf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I think PathBuf makes sense. At least for my usecase i'm only displaying it, so it would be more convenient since PathBuf has display impl but not CString.

Comment thread libbpf-rs/src/query.rs Outdated
LinkTypeInfo::UprobeMulti(UprobeMultiLinkInfo {
path_size: unsafe { s.__bindgen_anon_1.uprobe_multi.path_size },
path: (path != 0)
.then_some(unsafe { CStr::from_ptr(path as *const c_char).to_owned() }),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume that if there is a path_size field that the string doesn't have to be NUL terminated but length determined by the size, no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah oops, that was meant to be path_size != 0.

@ver-nyan ver-nyan force-pushed the k/uprobe_multi-link-info branch from 0ec8db2 to 225bd53 Compare April 23, 2026 21:49
@d-e-s-o d-e-s-o merged commit 2ceda05 into libbpf:master Apr 24, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants