Propagate trace format all the way to the consumer
[lttng-tools.git] / src / bin / lttng-sessiond / consumer.cpp
index c0f8eb5894e8fae8cb070109d4820ebec62ddff2..a482dde8aff041cee9502cd7be23cb1f73f5ee43 100644 (file)
 
 #include <common/common.hpp>
 #include <common/defaults.hpp>
-#include <common/uri.hpp>
 #include <common/relayd/relayd.hpp>
 #include <common/string-utils/format.hpp>
+#include <common/uri.hpp>
+#include <lttng/trace-format-descriptor-internal.hpp>
 
 #include "consumer.hpp"
 #include "health-sessiond.hpp"
@@ -935,7 +936,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                const char *root_shm_path,
                const char *shm_path,
                struct lttng_trace_chunk *trace_chunk,
-               const struct lttng_credentials *buffer_credentials)
+               const struct lttng_credentials *buffer_credentials,
+               const lttng::trace_format_descriptor& trace_format)
 {
        LTTNG_ASSERT(msg);
 
@@ -978,6 +980,11 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.ask_channel.monitor = monitor;
        msg->u.ask_channel.ust_app_uid = ust_app_uid;
        msg->u.ask_channel.blocking_timeout = blocking_timeout;
+       if (trace_format.type() == LTTNG_TRACE_FORMAT_DESCRIPTOR_TYPE_CTF_1) {
+               msg->u.ask_channel.trace_format = 1;
+       } else {
+               msg->u.ask_channel.trace_format = 2;
+       }
 
        std::copy(uuid.begin(), uuid.end(), msg->u.ask_channel.uuid);
 
@@ -1020,7 +1027,8 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                unsigned int live_timer_interval,
                bool is_in_live_session,
                unsigned int monitor_timer_interval,
-               struct lttng_trace_chunk *trace_chunk)
+               struct lttng_trace_chunk *trace_chunk,
+               const lttng::trace_format_descriptor& trace_format)
 {
        LTTNG_ASSERT(msg);
 
@@ -1050,6 +1058,11 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
        msg->u.channel.live_timer_interval = live_timer_interval;
        msg->u.channel.is_live = is_in_live_session;
        msg->u.channel.monitor_timer_interval = monitor_timer_interval;
+       if (trace_format.type() == LTTNG_TRACE_FORMAT_DESCRIPTOR_TYPE_CTF_1) {
+               msg->u.channel.trace_format = 1;
+       } else {
+               msg->u.channel.trace_format = 2;
+       }
 
        strncpy(msg->u.channel.pathname, pathname,
                        sizeof(msg->u.channel.pathname));
This page took 0.025077 seconds and 5 git commands to generate.