#include <unistd.h>
#include <inttypes.h>
-#include <common/compat/errno.h>
-#include <common/common.h>
-#include <common/consumer/consumer.h>
-#include <common/defaults.h>
-
-#include "consumer.h"
-#include "health-sessiond.h"
-#include "ust-consumer.h"
-#include "lttng-ust-error.h"
-#include "buffer-registry.h"
-#include "session.h"
-#include "lttng-sessiond.h"
+#include <common/compat/errno.hpp>
+#include <common/common.hpp>
+#include <common/consumer/consumer.hpp>
+#include <common/defaults.hpp>
+
+#include "consumer.hpp"
+#include "health-sessiond.hpp"
+#include "ust-consumer.hpp"
+#include "lttng-ust-error.hpp"
+#include "buffer-registry.hpp"
+#include "session.hpp"
+#include "lttng-sessiond.hpp"
+
+namespace lsu = lttng::sessiond::ust;
/*
* Send a single channel to the consumer using command ASK_CHANNEL_CREATION.
struct ust_app_channel *ua_chan,
struct consumer_output *consumer,
struct consumer_socket *socket,
- struct ust_registry_session *registry,
+ lsu::registry_session *registry,
struct lttng_trace_chunk *trace_chunk)
{
int ret, output;
uint64_t key, chan_reg_key;
char *pathname = NULL;
struct lttcomm_consumer_msg msg;
- struct ust_registry_channel *ust_reg_chan;
char shm_path[PATH_MAX] = "";
char root_shm_path[PATH_MAX] = "";
bool is_local_trace;
* those buffer files.
*/
} else {
- ust_reg_chan = ust_registry_channel_find(registry, chan_reg_key);
- LTTNG_ASSERT(ust_reg_chan);
- chan_id = ust_reg_chan->chan_id;
+ {
+ auto locked_registry = registry->lock();
+ auto& ust_reg_chan = registry->get_channel(chan_reg_key);
+
+ chan_id = ust_reg_chan.id;
+ }
+
if (ua_sess->shm_path[0]) {
strncpy(shm_path, ua_sess->shm_path, sizeof(shm_path));
shm_path[sizeof(shm_path) - 1] = '\0';
break;
}
- consumer_init_ask_channel_comm_msg(&msg,
- ua_chan->attr.subbuf_size,
- ua_chan->attr.num_subbuf,
- ua_chan->attr.overwrite,
- ua_chan->attr.switch_timer_interval,
- ua_chan->attr.read_timer_interval,
- ua_sess->live_timer_interval,
- ua_sess->live_timer_interval != 0,
- ua_chan->monitor_timer_interval,
- output,
- (int) ua_chan->attr.type,
- ua_sess->tracing_id,
- &pathname[consumer_path_offset],
- ua_chan->name,
- consumer->net_seq_index,
- ua_chan->key,
- registry->uuid,
- chan_id,
- ua_chan->tracefile_size,
- ua_chan->tracefile_count,
- ua_sess->id,
+ consumer_init_ask_channel_comm_msg(&msg, ua_chan->attr.subbuf_size,
+ ua_chan->attr.num_subbuf, ua_chan->attr.overwrite,
+ ua_chan->attr.switch_timer_interval, ua_chan->attr.read_timer_interval,
+ ua_sess->live_timer_interval, ua_sess->live_timer_interval != 0,
+ ua_chan->monitor_timer_interval, output, (int) ua_chan->attr.type,
+ ua_sess->tracing_id, &pathname[consumer_path_offset], ua_chan->name,
+ consumer->net_seq_index, ua_chan->key, registry->uuid, chan_id,
+ ua_chan->tracefile_size, ua_chan->tracefile_count, ua_sess->id,
ua_sess->output_traces,
lttng_credentials_get_uid(&ua_sess->real_credentials),
- ua_chan->attr.blocking_timeout,
- root_shm_path, shm_path,
- trace_chunk,
- &ua_sess->effective_credentials);
+ ua_chan->attr.blocking_timeout, root_shm_path, shm_path, trace_chunk,
+ &ua_sess->effective_credentials, *ua_sess->trace_format);
health_code_update();
struct ust_app_channel *ua_chan,
struct consumer_output *consumer,
struct consumer_socket *socket,
- struct ust_registry_session *registry,
+ lsu::registry_session *registry,
struct lttng_trace_chunk * trace_chunk)
{
int ret;
ssize_t ret_push;
struct lttcomm_metadata_request_msg request;
struct buffer_reg_uid *reg_uid;
- struct ust_registry_session *ust_reg;
+ lsu::registry_session *ust_reg;
struct lttcomm_consumer_msg msg;
LTTNG_ASSERT(socket);
}
LTTNG_ASSERT(ust_reg);
- pthread_mutex_lock(&ust_reg->lock);
- ret_push = ust_app_push_metadata(ust_reg, socket, 1);
- pthread_mutex_unlock(&ust_reg->lock);
+ {
+ auto locked_ust_reg = ust_reg->lock();
+ ret_push = ust_app_push_metadata(locked_ust_reg, socket, 1);
+ }
if (ret_push == -EPIPE) {
DBG("Application or relay closed while pushing metadata");
} else if (ret_push < 0) {