From 4f23c58345539eee2e44ae370c31dd6202de2d58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 3 Apr 2018 10:07:32 -0400 Subject: [PATCH] Add initial "no rotation" state to session rotation states MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ltt_session structures are initialized in the LTTNG_ROTATION_sTATE_COMPLETED state which is unexpected for users of the get_info API. Signed-off-by: Jérémie Galarneau --- include/lttng/rotation.h | 12 ++++++++---- src/bin/lttng-sessiond/session.c | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/lttng/rotation.h b/include/lttng/rotation.h index 00d68d7e5..0b4b2ad2f 100644 --- a/include/lttng/rotation.h +++ b/include/lttng/rotation.h @@ -29,15 +29,19 @@ extern "C" { * Return codes for lttng_rotation_handle_get_state() */ enum lttng_rotation_state { + /* + * Session has not been rotated. + */ + LTTNG_ROTATION_STATE_NO_ROTATION = 0, /* * Rotation is ongoing, but has not been completed yet. */ - LTTNG_ROTATION_STATE_ONGOING = 0, + LTTNG_ROTATION_STATE_ONGOING = 1, /* * Rotation has been completed and the resulting chunk * can now safely be read. */ - LTTNG_ROTATION_STATE_COMPLETED = 1, + LTTNG_ROTATION_STATE_COMPLETED = 2, /* * The rotation has expired. * @@ -48,11 +52,11 @@ enum lttng_rotation_state { * Note that this state does not guarantee the the rotation was * completed successfully. */ - LTTNG_ROTATION_STATE_EXPIRED = 2, + LTTNG_ROTATION_STATE_EXPIRED = 3, /* * The rotation could not be completed due to an error. */ - LTTNG_ROTATION_STATE_ERROR = 3, + LTTNG_ROTATION_STATE_ERROR = 4, }; enum lttng_rotation_status { diff --git a/src/bin/lttng-sessiond/session.c b/src/bin/lttng-sessiond/session.c index 39c5611d7..2b7d65eaa 100644 --- a/src/bin/lttng-sessiond/session.c +++ b/src/bin/lttng-sessiond/session.c @@ -401,6 +401,7 @@ int session_create(char *name, uid_t uid, gid_t gid) } new_session->rotate_pending = false; + new_session->rotation_state = LTTNG_ROTATION_STATE_NO_ROTATION; new_session->rotate_pending_relay = false; new_session->rotate_relay_pending_timer_enabled = false; new_session->rotate_timer = false; -- 2.34.1