From 5e9ab969028261c059ea0264521c9892247380a2 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 12 Feb 2019 10:57:18 -0500 Subject: [PATCH] Kernel-ctl: Expose kernel clear buffer operation Signed-off-by: Jonathan Rajotte --- src/common/kernel-ctl/kernel-ctl.c | 5 +++++ src/common/kernel-ctl/kernel-ctl.h | 1 + src/common/kernel-ctl/kernel-ioctl.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 6a256fefd..6186e6f4f 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -413,6 +413,11 @@ int kernctl_buffer_flush_empty(int fd) return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_FLUSH_EMPTY); } +int kernctl_buffer_clear(int fd) +{ + return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_CLEAR); +} + /* returns the version of the metadata. */ int kernctl_get_metadata_version(int fd, uint64_t *version) { diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h index d88f5e765..1a448c8e1 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -94,6 +94,7 @@ int kernctl_put_subbuf(int fd); int kernctl_buffer_flush(int fd); int kernctl_buffer_flush_empty(int fd); +int kernctl_buffer_clear(int fd); int kernctl_get_metadata_version(int fd, uint64_t *version); /* index */ diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h index 3c4f4129e..3f3e2ad87 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -59,6 +59,8 @@ #define RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS _IO(0xF6, 0x0E) /* Flush the current sub-buffer, even if empty. */ #define RING_BUFFER_FLUSH_EMPTY _IO(0xF6, 0x0F) +/* Clear ring buffer content */ +#define RING_BUFFER_CLEAR _IO(0xF6, 0x11) /* returns the timestamp begin of the current sub-buffer */ #define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) -- 2.34.1