Transmit sessiond uuid to consumerd on launch
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 14 Dec 2018 21:04:44 +0000 (16:04 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 20:39:13 +0000 (16:39 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/consumer.h
src/bin/lttng-sessiond/manage-consumer.c
src/common/consumer/consumer.c

index 7277c405ec38bd0da71556a0c4a56c4035d47b6a..caa076c8993a8157ca634c06a8dde1ab61fe7b02 100644 (file)
@@ -314,5 +314,7 @@ int consumer_check_rotation_pending_relay(struct consumer_socket *socket,
 int consumer_mkdir(struct consumer_socket *socket, uint64_t session_id,
                const struct consumer_output *output, const char *path,
                uid_t uid, gid_t gid);
+int consumer_init(struct consumer_socket *socket,
+               const lttng_uuid sessiond_uuid);
 
 #endif /* _CONSUMER_H */
index fa802adc91e33cd7e3ba92edfc1546a5f50b9016..c87a43f6e1315cab8289c3e52bff0555b68b90e1 100644 (file)
@@ -242,8 +242,8 @@ void *thread_consumer_management(void *data)
        health_code_update();
 
        /*
-        * Transfer the write-end of the channel monitoring and rotate pipe
-        * to the consumer by issuing a SET_CHANNEL_MONITOR_PIPE command.
+        * Transfer the write-end of the channel monitoring pipe to the consumer
+        * by issuing a SET_CHANNEL_MONITOR_PIPE command.
         */
        cmd_socket_wrapper = consumer_allocate_socket(&consumer_data->cmd_sock);
        if (!cmd_socket_wrapper) {
@@ -252,6 +252,16 @@ void *thread_consumer_management(void *data)
        }
        cmd_socket_wrapper->lock = &consumer_data->lock;
 
+       pthread_mutex_lock(cmd_socket_wrapper->lock);
+       ret = consumer_init(cmd_socket_wrapper, sessiond_uuid);
+       if (ret) {
+               ERR("Failed to send sessiond uuid to consumer daemon");
+               mark_thread_intialization_as_failed(notifiers);
+               pthread_mutex_unlock(cmd_socket_wrapper->lock);
+               goto error;
+       }
+       pthread_mutex_unlock(cmd_socket_wrapper->lock);
+
        ret = consumer_send_channel_monitor_pipe(cmd_socket_wrapper,
                        consumer_data->channel_monitor_pipe);
        if (ret) {
index 32a2d7a4a08c36f1aad2665172a8014b2c4122b0..3c20c57bda9d68ac1967de0cf433901ab8cce7e6 100644 (file)
@@ -4491,6 +4491,7 @@ enum lttcomm_return_code lttng_consumer_init_command(
                const lttng_uuid sessiond_uuid)
 {
        enum lttcomm_return_code ret;
+       char uuid_str[UUID_STR_LEN];
 
        if (ctx->sessiond_uuid.is_set) {
                ret = LTTCOMM_CONSUMERD_ALREADY_SET;
@@ -4500,6 +4501,8 @@ enum lttcomm_return_code lttng_consumer_init_command(
        ctx->sessiond_uuid.is_set = true;
        memcpy(ctx->sessiond_uuid.value, sessiond_uuid, sizeof(lttng_uuid));
        ret = LTTCOMM_CONSUMERD_SUCCESS;
+       lttng_uuid_to_str(sessiond_uuid, uuid_str);
+       DBG("Received session daemon UUID: %s", uuid_str);
 end:
        return ret;
 }
This page took 0.030346 seconds and 4 git commands to generate.