From 41dc93d9df7c6bba1e1fb765d726700c9eafb144 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 28 Apr 2020 21:40:12 -0400 Subject: [PATCH] kerner-ctl: add RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add a wrapper for RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK which gets the next metadata subbuffer and returns a boolean flag indicating whether the metadata is guaranteed to be in a consistent state at the end of this sub-buffer (can be parsed). Signed-off-by: Jérémie Galarneau Change-Id: I13fbdfe51c3c4ef04581409e0fbc9837ed6d555d --- src/common/kernel-ctl/kernel-ctl.c | 7 +++++++ src/common/kernel-ctl/kernel-ctl.h | 3 +++ src/common/kernel-ctl/kernel-ioctl.h | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index caae421fc..10e281d69 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -510,6 +510,13 @@ int kernctl_buffer_clear(int fd) return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_CLEAR); } +int kernctl_get_next_subbuf_metadata_check(int fd, bool *consistent) +{ + return LTTNG_IOCTL_NO_CHECK(fd, + RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK, + consistent); +} + /* 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 60fcabd6e..49925ea6c 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -9,6 +9,8 @@ #ifndef _LTTNG_KERNEL_CTL_H #define _LTTNG_KERNEL_CTL_H +#include + #include #include #include @@ -94,6 +96,7 @@ int kernctl_buffer_flush_empty(int fd); int kernctl_buffer_clear(int fd); int kernctl_get_metadata_version(int fd, uint64_t *version); int kernctl_metadata_cache_dump(int fd); +int kernctl_get_next_subbuf_metadata_check(int fd, bool *consistent); /* index */ int kernctl_get_timestamp_begin(int fd, uint64_t *timestamp_begin); diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h index 59d71191f..ed6555e10 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -53,9 +53,10 @@ * Reset the position of what has been consumed from the metadata cache to 0 * so it can be read again. */ -#define RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) +#define RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) /* Clear ring buffer content */ -#define RING_BUFFER_CLEAR _IO(0xF6, 0x11) +#define RING_BUFFER_CLEAR _IO(0xF6, 0x11) +#define RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK _IOR(0xF6, 0x12, uint32_t) /* returns the timestamp begin of the current sub-buffer */ #define LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN _IOR(0xF6, 0x20, uint64_t) -- 2.34.1