#include "session.h"
#include "lttng-sessiond.h"
-static char *create_channel_path(struct consumer_output *consumer)
+static char *create_channel_path(struct consumer_output *consumer,
+ size_t *consumer_path_offset)
{
int ret;
char tmp_path[PATH_MAX];
assert(consumer);
/* Get the right path name destination */
- if (consumer->type == CONSUMER_DST_LOCAL) {
+ if (consumer->type == CONSUMER_DST_LOCAL ||
+ (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",
consumer->domain_subdir);
goto error;
}
+ *consumer_path_offset = strlen(consumer->domain_subdir);
DBG3("Kernel local consumer trace path relative to current trace chunk: \"%s\"",
pathname);
} else {
- /* Network output. */
+ /* Network output, relayd < 2.11. */
ret = snprintf(tmp_path, sizeof(tmp_path), "%s%s",
consumer->dst.net.base_dir,
consumer->domain_subdir);
PERROR("lttng_strndup");
goto error;
}
+ *consumer_path_offset = 0;
DBG3("Kernel network consumer subdir path: %s", pathname);
}
struct ltt_session *session = NULL;
struct lttng_channel_extended *channel_attr_extended;
bool is_local_trace;
+ size_t consumer_path_offset = 0;
/* Safety net */
assert(channel);
channel->channel->name);
is_local_trace = consumer->net_seq_index == -1ULL;
- pathname = create_channel_path(consumer);
+ pathname = create_channel_path(consumer, &consumer_path_offset);
if (!pathname) {
ret = -1;
goto error;
consumer_init_add_channel_comm_msg(&lkm,
channel->key,
ksession->id,
- pathname,
+ &pathname[consumer_path_offset],
ksession->uid,
ksession->gid,
consumer->net_seq_index,
consumer_init_add_channel_comm_msg(&lkm,
ksession->metadata->key,
ksession->id,
- DEFAULT_KERNEL_TRACE_DIR,
+ "",
ksession->uid,
ksession->gid,
consumer->net_seq_index,