+#include "consumer.hpp"
+#include "health-sessiond.hpp"
+#include "kernel-consumer.hpp"
+#include "lttng-sessiond.hpp"
+#include "notification-thread-commands.hpp"
+#include "session.hpp"
+
+#include <common/common.hpp>
+#include <common/compat/string.hpp>
+#include <common/defaults.hpp>
+
+#include <inttypes.h>
-#include <common/common.h>
-#include <common/defaults.h>
-#include <common/compat/string.h>
-
-#include "consumer.h"
-#include "health-sessiond.h"
-#include "kernel-consumer.h"
-#include "notification-thread-commands.h"
-#include "session.h"
-#include "lttng-sessiond.h"
-
-static char *create_channel_path(struct consumer_output *consumer,
- size_t *consumer_path_offset)
+static char *create_channel_path(struct consumer_output *consumer, size_t *consumer_path_offset)
- (consumer->type == CONSUMER_DST_NET &&
- consumer->relay_major_version == 2 &&
- consumer->relay_minor_version >= 11)) {
+ (consumer->type == CONSUMER_DST_NET && consumer->relay_major_version == 2 &&
+ consumer->relay_minor_version >= 11)) {
pathname = strdup(consumer->domain_subdir);
if (!pathname) {
PERROR("Failed to copy domain subdirectory string %s",
pathname = strdup(consumer->domain_subdir);
if (!pathname) {
PERROR("Failed to copy domain subdirectory string %s",
goto error;
}
*consumer_path_offset = strlen(consumer->domain_subdir);
DBG3("Kernel local consumer trace path relative to current trace chunk: \"%s\"",
goto error;
}
*consumer_path_offset = strlen(consumer->domain_subdir);
DBG3("Kernel local consumer trace path relative to current trace chunk: \"%s\"",
- ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
- consumer->dst.net.base_dir,
- consumer->domain_subdir);
+ ret = snprintf(tmp_path,
+ sizeof(tmp_path),
+ "%s%s",
+ consumer->dst.net.base_dir,
+ consumer->domain_subdir);
if (ret < 0) {
PERROR("snprintf kernel metadata path");
goto error;
} else if (ret >= sizeof(tmp_path)) {
ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s\"",
if (ret < 0) {
PERROR("snprintf kernel metadata path");
goto error;
} else if (ret >= sizeof(tmp_path)) {
ERR("Kernel channel path exceeds the maximal allowed length of of %zu bytes (%i bytes required) with path \"%s%s\"",
- sizeof(tmp_path), ret,
- consumer->dst.net.base_dir,
- consumer->domain_subdir);
+ sizeof(tmp_path),
+ ret,
+ consumer->dst.net.base_dir,
+ consumer->domain_subdir);
-static
-int kernel_consumer_add_channel(struct consumer_socket *sock,
- struct ltt_kernel_channel *channel,
- struct ltt_kernel_session *ksession,
- unsigned int monitor)
+static int kernel_consumer_add_channel(struct consumer_socket *sock,
+ struct ltt_kernel_channel *channel,
+ struct ltt_kernel_session *ksession,
+ unsigned int monitor)
is_local_trace = consumer->net_seq_index == -1ULL;
pathname = create_channel_path(consumer, &consumer_path_offset);
is_local_trace = consumer->net_seq_index == -1ULL;
pathname = create_channel_path(consumer, &consumer_path_offset);
/* Prep channel message structure */
consumer_init_add_channel_comm_msg(&lkm,
/* Prep channel message structure */
consumer_init_add_channel_comm_msg(&lkm,
- channel->key,
- ksession->id,
- &pathname[consumer_path_offset],
- ksession->uid,
- ksession->gid,
- consumer->net_seq_index,
- channel->channel->name,
- channel->stream_count,
- channel->channel->attr.output,
- CONSUMER_CHANNEL_TYPE_DATA,
- channel->channel->attr.tracefile_size,
- channel->channel->attr.tracefile_count,
- monitor,
- channel->channel->attr.live_timer_interval,
- ksession->is_live_session,
- channel_attr_extended->monitor_timer_interval,
- ksession->current_trace_chunk);
+ channel->key,
+ ksession->id,
+ &pathname[consumer_path_offset],
+ consumer->net_seq_index,
+ channel->channel->name,
+ channel->stream_count,
+ channel->channel->attr.output,
+ CONSUMER_CHANNEL_TYPE_DATA,
+ channel->channel->attr.tracefile_size,
+ channel->channel->attr.tracefile_count,
+ monitor,
+ channel->channel->attr.live_timer_interval,
+ ksession->is_live_session,
+ channel_attr_extended->monitor_timer_interval,
+ ksession->current_trace_chunk);
- LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
- LTTNG_ASSERT(session_trylock_list());
-
- status = notification_thread_command_add_channel(
- the_notification_thread_handle, session->name,
- ksession->uid, ksession->gid, channel->channel->name,
- channel->key, LTTNG_DOMAIN_KERNEL,
- channel->channel->attr.subbuf_size *
- channel->channel->attr.num_subbuf);
+ ASSERT_LOCKED(session->lock);
+ ASSERT_SESSION_LIST_LOCKED();
+
+ status = notification_thread_command_add_channel(the_notification_thread_handle,
+ session->id,
+ channel->channel->name,
+ channel->key,
+ LTTNG_DOMAIN_KERNEL,
+ channel->channel->attr.subbuf_size *
+ channel->channel->attr.num_subbuf);
* The consumer socket lock must be held by the caller.
*/
int kernel_consumer_add_metadata(struct consumer_socket *sock,
* The consumer socket lock must be held by the caller.
*/
int kernel_consumer_add_metadata(struct consumer_socket *sock,
/* Get consumer output pointer */
consumer = ksession->consumer;
/* Prep channel message structure */
consumer_init_add_channel_comm_msg(&lkm,
/* Get consumer output pointer */
consumer = ksession->consumer;
/* Prep channel message structure */
consumer_init_add_channel_comm_msg(&lkm,
- ksession->metadata->key,
- ksession->id,
- "",
- ksession->uid,
- ksession->gid,
- consumer->net_seq_index,
- ksession->metadata->conf->name,
- 1,
- ksession->metadata->conf->attr.output,
- CONSUMER_CHANNEL_TYPE_METADATA,
- ksession->metadata->conf->attr.tracefile_size,
- ksession->metadata->conf->attr.tracefile_count,
- monitor,
- ksession->metadata->conf->attr.live_timer_interval,
- ksession->is_live_session,
- 0,
- ksession->current_trace_chunk);
+ ksession->metadata->key,
+ ksession->id,
+ "",
+ consumer->net_seq_index,
+ ksession->metadata->conf->name,
+ 1,
+ ksession->metadata->conf->attr.output,
+ CONSUMER_CHANNEL_TYPE_METADATA,
+ ksession->metadata->conf->attr.tracefile_size,
+ ksession->metadata->conf->attr.tracefile_count,
+ monitor,
+ ksession->metadata->conf->attr.live_timer_interval,
+ ksession->is_live_session,
+ 0,
+ ksession->current_trace_chunk);
/* Prep stream message structure */
consumer_init_add_stream_comm_msg(&lkm,
/* Prep stream message structure */
consumer_init_add_stream_comm_msg(&lkm,
- ksession->metadata->key,
- ksession->metadata_stream_fd,
- 0 /* CPU: 0 for metadata. */);
+ ksession->metadata->key,
+ ksession->metadata_stream_fd,
+ 0 /* CPU: 0 for metadata. */);
- ret = consumer_send_stream(sock, consumer, &lkm,
- &ksession->metadata_stream_fd, 1);
+ ret = consumer_send_stream(sock, consumer, &lkm, &ksession->metadata_stream_fd, 1);
-static
-int kernel_consumer_add_stream(struct consumer_socket *sock,
- struct ltt_kernel_channel *channel,
- struct ltt_kernel_stream *stream,
- struct ltt_kernel_session *session, unsigned int monitor)
+static int kernel_consumer_add_stream(struct consumer_socket *sock,
+ struct ltt_kernel_channel *channel,
+ struct ltt_kernel_stream *stream,
+ struct ltt_kernel_session *session)
/* Get consumer output pointer */
consumer = session->consumer;
/* Prep stream consumer message */
/* Get consumer output pointer */
consumer = session->consumer;
/* Prep stream consumer message */
* Sending the notification that all streams were sent with STREAMS_SENT.
*/
int kernel_consumer_streams_sent(struct consumer_socket *sock,
* Sending the notification that all streams were sent with STREAMS_SENT.
*/
int kernel_consumer_streams_sent(struct consumer_socket *sock,
- consumer_init_streams_sent_comm_msg(&lkm,
- LTTNG_CONSUMER_STREAMS_SENT,
- channel_key, consumer->net_seq_index);
+ consumer_init_streams_sent_comm_msg(
+ &lkm, LTTNG_CONSUMER_STREAMS_SENT, channel_key, consumer->net_seq_index);
* The consumer socket lock must be held by the caller.
*/
int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
* The consumer socket lock must be held by the caller.
*/
int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
- struct ltt_kernel_channel *channel, struct ltt_kernel_session *ksession,
- unsigned int monitor)
+ struct ltt_kernel_channel *channel,
+ struct ltt_kernel_session *ksession,
+ unsigned int monitor)
if (!channel->sent_to_consumer) {
ret = kernel_consumer_add_channel(sock, channel, ksession, monitor);
if (!channel->sent_to_consumer) {
ret = kernel_consumer_add_channel(sock, channel, ksession, monitor);
- ret = kernel_consumer_add_stream(sock, channel, stream,
- ksession, monitor);
+ ret = kernel_consumer_add_stream(sock, channel, stream, ksession);
- cds_list_for_each_entry(chan, &session->channel_list.head, list) {
- ret = kernel_consumer_send_channel_streams(sock, chan, session,
- monitor);
+ cds_list_for_each_entry (chan, &session->channel_list.head, list) {
+ ret = kernel_consumer_send_channel_streams(sock, chan, session, monitor);