Add initial "no rotation" state to session rotation states
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 14:07:32 +0000 (10:07 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 16:12:29 +0000 (12:12 -0400)
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 <jeremie.galarneau@efficios.com>
include/lttng/rotation.h
src/bin/lttng-sessiond/session.c

index 00d68d7e5c5015a71982f1fe3d5690eca205f135..0b4b2ad2f5eb8f92c01e60f9a484e8d23c3b19fd 100644 (file)
@@ -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 {
index 39c5611d77777d475be4a6b9d838c4fb815d7fca..2b7d65eaa1b61fbae82a230ee2a6b7247505d0ac 100644 (file)
@@ -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;
This page took 0.027411 seconds and 4 git commands to generate.