Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

libbpf-rs: Add wrapper for ringbuffer__epoll_fd #254

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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