From: Jérémie Galarneau Date: Wed, 29 Apr 2020 01:40:12 +0000 (-0400) Subject: kerner-ctl: add RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK X-Git-Tag: v2.11.5~35 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88be8d77519f987de53a8f1f17aeec296dddb283;p=lttng-tools.git kerner-ctl: add RING_RING_BUFFER_GET_NEXT_SUBBUF_METADATA_CHECK 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 --- diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c index 14d96b577..2efbfa19d 100644 --- a/src/common/kernel-ctl/kernel-ctl.c +++ b/src/common/kernel-ctl/kernel-ctl.c @@ -453,6 +453,13 @@ int kernctl_buffer_flush_empty(int fd) return LTTNG_IOCTL_CHECK(fd, RING_BUFFER_FLUSH_EMPTY); } +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 053e7df63..fb4838cc8 100644 --- a/src/common/kernel-ctl/kernel-ctl.h +++ b/src/common/kernel-ctl/kernel-ctl.h @@ -19,6 +19,8 @@ #ifndef _LTTNG_KERNEL_CTL_H #define _LTTNG_KERNEL_CTL_H +#include + #include #include #include @@ -99,6 +101,7 @@ int kernctl_buffer_flush(int fd); int kernctl_buffer_flush_empty(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 8d39abbe3..8a36f6352 100644 --- a/src/common/kernel-ctl/kernel-ioctl.h +++ b/src/common/kernel-ctl/kernel-ioctl.h @@ -64,6 +64,7 @@ * so it can be read again. */ #define RING_BUFFER_METADATA_CACHE_DUMP _IO(0xF6, 0x10) +#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)