X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=ce3e5da9adda44d3481c4bb07785a30f76ac14f5;hb=8c93562f396a3e785c5193ca32b40f1f16599a6a;hp=f0870e6b0c0abcf2ae50e83c32df5ef2b162a33e;hpb=d3e2ba59faddb31870e2ce29b6a881f7ad5ad883;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index f0870e6b0..ce3e5da9a 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -31,7 +31,7 @@ #include #include "consumer.h" -#include "health.h" +#include "health-sessiond.h" #include "ust-app.h" #include "utils.h" @@ -142,7 +142,7 @@ int consumer_recv_status_reply(struct consumer_socket *sock) goto end; } - if (reply.ret_code == LTTNG_OK) { + if (reply.ret_code == LTTCOMM_CONSUMERD_SUCCESS) { /* All good. */ ret = 0; } else { @@ -178,13 +178,14 @@ int consumer_recv_status_channel(struct consumer_socket *sock, } /* An error is possible so don't touch the key and stream_count. */ - if (reply.ret_code != LTTNG_OK) { + if (reply.ret_code != LTTCOMM_CONSUMERD_SUCCESS) { ret = -1; goto end; } *key = reply.key; *stream_count = reply.stream_count; + ret = 0; end: return ret; @@ -206,6 +207,7 @@ int consumer_send_destroy_relayd(struct consumer_socket *sock, DBG2("Sending destroy relayd command to consumer sock %d", *sock->fd_ptr); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_DESTROY_RELAYD; msg.u.destroy_relayd.net_seq_idx = consumer->net_seq_index; @@ -905,6 +907,19 @@ void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg, msg->u.stream.cpu = cpu; } +void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *msg, + enum lttng_consumer_command cmd, + uint64_t channel_key, uint64_t net_seq_idx) +{ + assert(msg); + + memset(msg, 0, sizeof(struct lttcomm_consumer_msg)); + + msg->cmd_type = cmd; + msg->u.sent_streams.channel_key = channel_key; + msg->u.sent_streams.net_seq_idx = net_seq_idx; +} + /* * Send stream communication structure to the consumer. */ @@ -951,6 +966,7 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, assert(consumer); assert(consumer_sock); + memset(&msg, 0, sizeof(msg)); /* Bail out if consumer is disabled */ if (!consumer->enabled) { ret = LTTNG_OK; @@ -960,7 +976,8 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, if (type == LTTNG_STREAM_CONTROL) { ret = relayd_create_session(rsock, &msg.u.relayd_sock.relayd_session_id, - session_name, hostname, session_live_timer); + session_name, hostname, session_live_timer, + consumer->snapshot); if (ret < 0) { /* Close the control socket. */ (void) relayd_close(rsock); @@ -1063,12 +1080,12 @@ int consumer_is_data_pending(uint64_t session_id, assert(consumer); - msg.cmd_type = LTTNG_CONSUMER_DATA_PENDING; + DBG3("Consumer data pending for id %" PRIu64, session_id); + memset(&msg, 0, sizeof(msg)); + msg.cmd_type = LTTNG_CONSUMER_DATA_PENDING; msg.u.data_pending.session_id = session_id; - DBG3("Consumer data pending for id %" PRIu64, session_id); - /* Send command for each consumer */ rcu_read_lock(); cds_lfht_for_each_entry(consumer->socks->ht, &iter.iter, socket, @@ -1121,6 +1138,7 @@ int consumer_flush_channel(struct consumer_socket *socket, uint64_t key) DBG2("Consumer flush channel key %" PRIu64, key); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_FLUSH_CHANNEL; msg.u.flush_channel.key = key; @@ -1153,6 +1171,7 @@ int consumer_close_metadata(struct consumer_socket *socket, DBG2("Consumer close metadata channel key %" PRIu64, metadata_key); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_CLOSE_METADATA; msg.u.close_metadata.key = metadata_key; @@ -1185,6 +1204,7 @@ int consumer_setup_metadata(struct consumer_socket *socket, DBG2("Consumer setup metadata channel key %" PRIu64, metadata_key); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_SETUP_METADATA; msg.u.setup_metadata.key = metadata_key; @@ -1218,6 +1238,7 @@ int consumer_push_metadata(struct consumer_socket *socket, DBG2("Consumer push metadata to consumer socket %d", *socket->fd_ptr); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_PUSH_METADATA; msg.u.push_metadata.key = metadata_key; msg.u.push_metadata.target_offset = target_offset;