X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fcommon%2Frelayd%2Frelayd.cpp;h=f2a19050574667d05c5f00a07542453ec2e416c2;hb=23083fa05cee494d938b0db84140dd661a30c4dc;hp=5ca919f23c517ace58b8de3cf59f126a6766a4d9;hpb=55caead7396fa6d4337db7fa8c64a1036393be9f;p=lttng-tools.git diff --git a/src/common/relayd/relayd.cpp b/src/common/relayd/relayd.cpp index 5ca919f23..f2a190505 100644 --- a/src/common/relayd/relayd.cpp +++ b/src/common/relayd/relayd.cpp @@ -12,16 +12,16 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include "relayd.h" +#include "relayd.hpp" static bool relayd_supports_chunks(const struct lttcomm_relayd_sock *sock) @@ -65,7 +65,7 @@ static int send_command(struct lttcomm_relayd_sock *rsock, buf_size += size; } - buf = (char *) zmalloc(buf_size); + buf = calloc(buf_size); if (buf == NULL) { PERROR("zmalloc relayd send command buf"); ret = -1; @@ -86,11 +86,13 @@ static int send_command(struct lttcomm_relayd_sock *rsock, memcpy(buf + sizeof(header), data, size); } - DBG3("Relayd sending command %d of size %" PRIu64, (int) cmd, buf_size); + DBG3("Relayd sending command %s of size %" PRIu64, + lttcomm_relayd_command_str(cmd), buf_size); ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags); if (ret < 0) { - PERROR("Failed to send command %d of size %" PRIu64, - (int) cmd, buf_size); + PERROR("Failed to send command %s of size %" PRIu64, + lttcomm_relayd_command_str(cmd), buf_size); + ret = rsock->sock.ops->sendmsg(&rsock->sock, buf, buf_size, flags); ret = -errno; goto error; } @@ -142,7 +144,7 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock, const char *session_name, const char *hostname, const char *base_path, int session_live_timer, unsigned int snapshot, uint64_t sessiond_session_id, - const lttng_uuid sessiond_uuid, const uint64_t *current_chunk_id, + const lttng_uuid& sessiond_uuid, const uint64_t *current_chunk_id, time_t creation_time, bool session_name_contains_creation_time, struct lttcomm_relayd_create_session_reply_2_11 *reply, char *output_path) @@ -164,7 +166,7 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock, base_path_len = strlen(base_path) + 1; msg_length = sizeof(*msg) + session_name_len + hostname_len + base_path_len; - msg = (lttcomm_relayd_create_session_2_11 *) zmalloc(msg_length); + msg = zmalloc(msg_length); if (!msg) { PERROR("zmalloc create_session_2_11 command message"); ret = -1; @@ -199,7 +201,7 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock, msg->live_timer = htobe32(session_live_timer); msg->snapshot = !!snapshot; - lttng_uuid_copy(msg->sessiond_uuid, sessiond_uuid); + std::copy(sessiond_uuid.begin(), sessiond_uuid.end(), msg->sessiond_uuid); msg->session_id = htobe64(sessiond_session_id); msg->session_name_contains_creation_time = session_name_contains_creation_time; if (current_chunk_id) { @@ -314,7 +316,7 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock, const char *session_name, const char *hostname, const char *base_path, int session_live_timer, unsigned int snapshot, uint64_t sessiond_session_id, - const lttng_uuid sessiond_uuid, + const lttng_uuid& sessiond_uuid, const uint64_t *current_chunk_id, time_t creation_time, bool session_name_contains_creation_time, char *output_path) @@ -444,7 +446,7 @@ static int relayd_add_stream_2_11(struct lttcomm_relayd_sock *rsock, pathname_len = strlen(pathname) + 1; msg_length = sizeof(*msg) + channel_name_len + pathname_len; - msg = (lttcomm_relayd_add_stream_2_11 *) zmalloc(msg_length); + msg = zmalloc(msg_length); if (!msg) { PERROR("zmalloc add_stream_2_11 command message"); ret = -1;