diff options
author | Brendan Jackman <jackmanb@google.com> | 2020-12-14 11:38:12 +0000 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2020-12-14 10:04:55 -0800 |
commit | a4d2a7ad86834092b327082004ead755d2603376 (patch) | |
tree | cd9f4fbeb3e30944e85d23381ec9b8d4f88ace12 /tools/lib/bpf/ringbuf.c | |
parent | 2e33f831fccd2df83836a8e255755f85d364aaeb (diff) | |
download | linux-a4d2a7ad86834092b327082004ead755d2603376.tar.gz |
libbpf: Expose libbpf ring_buffer epoll_fd
This provides a convenient perf ringbuf -> libbpf ringbuf migration
path for users of external polling systems. It is analogous to
perf_buffer__epoll_fd.
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201214113812.305274-1-jackmanb@google.com
Diffstat (limited to 'tools/lib/bpf/ringbuf.c')
-rw-r--r-- | tools/lib/bpf/ringbuf.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c index 5c6522c89af1..a8f997d47adf 100644 --- a/tools/lib/bpf/ringbuf.c +++ b/tools/lib/bpf/ringbuf.c @@ -282,3 +282,9 @@ int ring_buffer__poll(struct ring_buffer *rb, int timeout_ms) } return cnt < 0 ? -errno : res; } + +/* Get an fd that can be used to sleep until data is available in the ring(s) */ +int ring_buffer__epoll_fd(const struct ring_buffer *rb) +{ + return rb->epoll_fd; +} |