Skip to content

Commit

Permalink
libbpf-rs: Add wrapper for ringbuffer__epoll_fd
Browse files Browse the repository at this point in the history
As part of the initiative to reach feature-parity with libbpf-1.0, this
commit adds a wrapper for the ringbuffer__epoll_fd API.
  • Loading branch information
insearchoflosttime committed Jul 28, 2022
1 parent 40d25f5 commit eaa131d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libbpf-rs/src/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ impl<'a> RingBuffer<'a> {

util::parse_ret(ret)
}

/// Get an fd that can be used to sleep until data is available
pub fn epoll_fd(&self) -> i32 {
assert!(!self.ptr.is_null());

unsafe { libbpf_sys::ring_buffer__epoll_fd(self.ptr) }
}
}

impl<'a> Drop for RingBuffer<'a> {
Expand Down

0 comments on commit eaa131d

Please # to comment.