Skip to content

Conversation

@d-e-s-o
Copy link
Collaborator

@d-e-s-o d-e-s-o commented Sep 5, 2025

Add the Program::attach_iter_with_opts() method to allow for iterator attachment with support for providing additional options.

Add the Program::attach_iter_with_opts() method to allow for iterator
attachment with support for providing additional options.

Signed-off-by: Daniel Müller <deso@posteo.net>
@d-e-s-o
Copy link
Collaborator Author

d-e-s-o commented Sep 5, 2025

And I see that bpf_iter_link_info is a union, so we probably want to model that a tad differently then.

@tyrone-wu
Copy link
Contributor

Heyo o/

This was how I ended up implementing the iter variants when I implemented link_info in aya.
https://github.com/tyrone-wu/aya/blob/aya/link-info/aya/src/links/info.rs#L118

It's kind old code (about a yearish ago) that I ended up not having the time & energy to get merged to upstream aya, and probly won't get around to since i'm kinda moving away from aya. 🫠 so it's been sitting in limbo ever since.

If it's still the same today, the .target_name should map to the bpf_iter_link_info variants:

  • "bpf_map_elem" | "bpf_sk_storage_map" to map
  • "cgroup" to cgroup
  • "task" | "task_file" | "task_vma" to task

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

This pull request is considered stale because it has been open 30 days with no activity. Remove stale label or comment or it will be closed in 5 days.

@github-actions github-actions bot added the Stale label Nov 3, 2025
@d-e-s-o d-e-s-o added blocked and removed Stale labels Nov 3, 2025
@d-e-s-o d-e-s-o marked this pull request as ready for review November 3, 2025 22:22
@d-e-s-o d-e-s-o removed the blocked label Nov 3, 2025
@d-e-s-o
Copy link
Collaborator Author

d-e-s-o commented Nov 3, 2025

This was how I ended up implementing the iter variants when I implemented link_info in aya.
https://github.com/tyrone-wu/aya/blob/aya/link-info/aya/src/links/info.rs#L118

Thanks for the pointer. Based on my understanding, this looks to be more about the querying part, right? Whereas this change is about the attachment configuration.

Be that as it may, the change at hand seems like a reasonable extension of what we already have and should fit in with the other attachment methods. That, and I got confirmation that it works for the intended use case, so I think we can finally move this along.

@d-e-s-o d-e-s-o merged commit f1069f5 into libbpf:master Nov 3, 2025
15 checks passed
@d-e-s-o d-e-s-o deleted the topic/iter-opts branch November 3, 2025 22:30
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