summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/ringbuf.c
diff options
context:
space:
mode:
authorMartin Kelly <martin.kelly@crowdstrike.com>2023-09-25 14:50:42 -0700
committerAndrii Nakryiko <andrii@kernel.org>2023-09-25 16:22:43 -0700
commitae769390377adaec2798bd1a69171f00d0a25be0 (patch)
treed871b46e6aecdf6713851c91925f019eb93f90dd /tools/lib/bpf/ringbuf.c
parentbb32dd2c8fec71990bbc231aac934e1c73a17341 (diff)
libbpf: Add ring__map_fd
Add ring__map_fd to get the file descriptor underlying a given ringbuffer. Signed-off-by: Martin Kelly <martin.kelly@crowdstrike.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230925215045.2375758-12-martin.kelly@crowdstrike.com
Diffstat (limited to 'tools/lib/bpf/ringbuf.c')
-rw-r--r--tools/lib/bpf/ringbuf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lib/bpf/ringbuf.c b/tools/lib/bpf/ringbuf.c
index 98d0767dbb50..8aec20216b7b 100644
--- a/tools/lib/bpf/ringbuf.c
+++ b/tools/lib/bpf/ringbuf.c
@@ -366,6 +366,11 @@ size_t ring__size(const struct ring *r)
return r->mask + 1;
}
+int ring__map_fd(const struct ring *r)
+{
+ return r->map_fd;
+}
+
static void user_ringbuf_unmap_ring(struct user_ring_buffer *rb)
{
if (rb->consumer_pos) {