X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.cpp;h=b87e1d73d2d065ef21ee19c4a015b2c00946c396;hb=328c2fe7297c941aa9cbcfa4ce944fca1bd7300f;hp=f76dffa7eb787e537e72b57637b1e4af0f94d462;hpb=1c9a0b0e83c7e073c4e576c0bed95de335b0e502;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/consumer.cpp b/src/bin/lttng-sessiond/consumer.cpp index f76dffa7e..b87e1d73d 100644 --- a/src/bin/lttng-sessiond/consumer.cpp +++ b/src/bin/lttng-sessiond/consumer.cpp @@ -15,17 +15,17 @@ #include #include -#include -#include -#include -#include -#include - -#include "consumer.h" -#include "health-sessiond.h" -#include "ust-app.h" -#include "utils.h" -#include "lttng-sessiond.h" +#include +#include +#include +#include +#include + +#include "consumer.hpp" +#include "health-sessiond.hpp" +#include "ust-app.hpp" +#include "utils.hpp" +#include "lttng-sessiond.hpp" /* * Return allocated full pathname of the session using the consumer trace path @@ -49,7 +49,7 @@ char *setup_channel_trace_path(struct consumer_output *consumer, * Allocate the string ourself to make sure we never exceed * LTTNG_PATH_MAX. */ - pathname = (char *) zmalloc(LTTNG_PATH_MAX); + pathname = calloc(LTTNG_PATH_MAX); if (!pathname) { goto error; } @@ -429,7 +429,7 @@ struct consumer_socket *consumer_allocate_socket(int *fd) LTTNG_ASSERT(fd); - socket = (consumer_socket *) zmalloc(sizeof(struct consumer_socket)); + socket = zmalloc(); if (socket == NULL) { PERROR("zmalloc consumer socket"); goto error; @@ -520,7 +520,7 @@ struct consumer_output *consumer_create_output(enum consumer_dst_type type) { struct consumer_output *output = NULL; - output = (consumer_output *) zmalloc(sizeof(struct consumer_output)); + output = zmalloc(); if (output == NULL) { PERROR("zmalloc consumer_output"); goto error; @@ -924,7 +924,7 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, const char *name, uint64_t relayd_id, uint64_t key, - unsigned char *uuid, + const lttng_uuid& uuid, uint32_t chan_id, uint64_t tracefile_size, uint64_t tracefile_count, @@ -979,7 +979,7 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, msg->u.ask_channel.ust_app_uid = ust_app_uid; msg->u.ask_channel.blocking_timeout = blocking_timeout; - memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid)); + std::copy(uuid.begin(), uuid.end(), msg->u.ask_channel.uuid); if (pathname) { strncpy(msg->u.ask_channel.pathname, pathname, @@ -1782,7 +1782,7 @@ error_socket: } int consumer_init(struct consumer_socket *socket, - const lttng_uuid sessiond_uuid) + const lttng_uuid& sessiond_uuid) { int ret; struct lttcomm_consumer_msg msg = { @@ -1793,7 +1793,7 @@ int consumer_init(struct consumer_socket *socket, LTTNG_ASSERT(socket); DBG("Sending consumer initialization command"); - lttng_uuid_copy(msg.u.init.sessiond_uuid, sessiond_uuid); + std::copy(sessiond_uuid.begin(), sessiond_uuid.end(), msg.u.init.sessiond_uuid); health_code_update(); ret = consumer_send_msg(socket, &msg);