X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fmain.c;h=8fe3dd96deabe322f7e634bbd51aa78ffcfd70d0;hp=a3e2509d2865f733fc81675c1272a92136eae4c3;hb=2fdaeb7e6ba9952cc083027fbe591fd6b69cbe80;hpb=62bad3bf0aaade7f80ba4e536e1b9e734ec2e051 diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index a3e2509d2..8fe3dd96d 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -58,7 +59,7 @@ #include #include #include -#include +#include #include "cmd.h" #include "ctf-trace.h" @@ -2127,6 +2128,8 @@ static int relay_rotate_session_streams( const size_t header_len = sizeof(struct lttcomm_relayd_rotate_streams); struct lttng_trace_chunk *next_trace_chunk = NULL; struct lttng_buffer_view stream_positions; + char chunk_id_buf[MAX_INT_DEC_LEN(uint64_t)]; + const char *chunk_id_str = "none"; if (!session || !conn->version_check_done) { ERR("Trying to rotate a stream before version check"); @@ -2180,8 +2183,20 @@ static int relay_rotate_session_streams( ret = -1; goto end; } + + ret = snprintf(chunk_id_buf, sizeof(chunk_id_buf), "%" PRIu64, + rotate_streams.new_chunk_id.value); + if (ret < 0 || ret >= sizeof(chunk_id_buf)) { + chunk_id_str = "formatting error"; + } else { + chunk_id_str = chunk_id_buf; + } } + DBG("Rotate %" PRIu32 " streams of session \"%s\" to chunk \"%s\"", + rotate_streams.stream_count, session->session_name, + chunk_id_str); + stream_positions = lttng_buffer_view_from_view(payload, sizeof(rotate_streams), -1); if (!stream_positions.data || @@ -2237,6 +2252,7 @@ end: ret = -1; } + ret = 0; end_no_reply: lttng_trace_chunk_put(next_trace_chunk); return ret;