Skip to content

Commit eaa131d

Browse files
libbpf-rs: Add wrapper for ringbuffer__epoll_fd
As part of the initiative to reach feature-parity with libbpf-1.0, this commit adds a wrapper for the ringbuffer__epoll_fd API.
1 parent 40d25f5 commit eaa131d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libbpf-rs/src/ringbuf.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ impl<'a> RingBuffer<'a> {
146146

147147
util::parse_ret(ret)
148148
}
149+
150+
/// Get an fd that can be used to sleep until data is available
151+
pub fn epoll_fd(&self) -> i32 {
152+
assert!(!self.ptr.is_null());
153+
154+
unsafe { libbpf_sys::ring_buffer__epoll_fd(self.ptr) }
155+
}
149156
}
150157

151158
impl<'a> Drop for RingBuffer<'a> {

0 commit comments

Comments
 (0)