relayd: implement file and session rotation on top of trace chunks
[lttng-tools.git] / src / bin / lttng-relayd / session.c
index e087b51c3b71ceece2d66d71faa6b3d62d905810..0997fdd6579469098f0db94eb8d31fbfc0ef183c 100644 (file)
@@ -74,10 +74,15 @@ end:
  * Return allocated session or else NULL.
  */
 struct relay_session *session_create(const char *session_name,
-               const char *hostname, uint32_t live_timer,
-               bool snapshot, const lttng_uuid sessiond_uuid,
-               uint64_t *id_sessiond, uint64_t *current_chunk_id,
-               uint32_t major, uint32_t minor)
+               const char *hostname,
+               uint32_t live_timer,
+               bool snapshot,
+               const lttng_uuid sessiond_uuid,
+               const uint64_t *id_sessiond,
+               const uint64_t *current_chunk_id,
+               const time_t *creation_time,
+               uint32_t major,
+               uint32_t minor)
 {
        int ret;
        struct relay_session *session;
@@ -156,6 +161,9 @@ struct relay_session *session_create(const char *session_name,
        }
 
        lttng_ht_add_unique_u64(sessions_ht, &session->session_n);
+       if (creation_time) {
+               LTTNG_OPTIONAL_SET(&session->creation_time, *creation_time);
+       }
        return session;
 
 error:
@@ -236,11 +244,10 @@ static void destroy_session(struct relay_session *session)
        ret = session_delete(session);
        assert(!ret);
        lttng_trace_chunk_put(session->current_trace_chunk);
+       session->current_trace_chunk = NULL;
        ret = sessiond_trace_chunk_registry_session_destroyed(
                        sessiond_trace_chunk_registry, session->sessiond_uuid);
        assert(!ret);
-       lttng_trace_chunk_put(session->current_trace_chunk);
-       session->current_trace_chunk = NULL;
        call_rcu(&session->rcu_node, rcu_destroy_session);
 }
 
This page took 0.023406 seconds and 4 git commands to generate.