Skip to content

Commit

Permalink
fixup! Add bindings for querying BPF program information
Browse files Browse the repository at this point in the history
  • Loading branch information
d-e-s-o committed Oct 18, 2024
1 parent e59224b commit c17ba60
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kernel/bpf/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ mod tests {
/// Check that we can iterate over all active BPF programs.
#[test]
fn prog_iteration() {
let mut obj = test_object("getpid.bpf.o");
let prog = prog_mut(&mut obj, "handle__getpid");
let _link = prog
.attach_tracepoint("syscalls", "sys_enter_getpid")
.expect("failed to attach prog");

let mut next_prog_id = 0;
while let Ok(prog_id) = bpf_prog_get_next_id(next_prog_id) {
let fd = bpf_prog_get_fd_from_id(prog_id).unwrap();
Expand Down

0 comments on commit c17ba60

Please sign in to comment.