+ /* Get the right path name destination */
+ if (consumer->type == CONSUMER_DST_LOCAL) {
+ /* Set application path to the destination path */
+ ret = snprintf(tmp_path, sizeof(tmp_path), "%s/%s",
+ consumer->dst.trace_path, consumer->subdir);
+ if (ret < 0) {
+ PERROR("snprintf metadata path");
+ goto error;
+ }
+ pathname = tmp_path;
+
+ /* Create directory */
+ ret = run_as_mkdir_recursive(pathname, S_IRWXU | S_IRWXG,
+ session->uid, session->gid);
+ if (ret < 0) {
+ if (ret != -EEXIST) {
+ ERR("Trace directory creation error");
+ goto error;
+ }
+ }
+ DBG3("Kernel local consumer tracefile path: %s", pathname);
+ } else {
+ ret = snprintf(tmp_path, sizeof(tmp_path), "%s", consumer->subdir);
+ if (ret < 0) {
+ PERROR("snprintf metadata path");
+ goto error;
+ }
+ pathname = tmp_path;
+ DBG3("Kernel network consumer subdir path: %s", pathname);
+ }
+
+ /* Prep channel message structure */
+ consumer_init_channel_comm_msg(&lkm,
+ LTTNG_CONSUMER_ADD_CHANNEL,
+ channel->fd,
+ session->id,
+ pathname,
+ session->uid,
+ session->gid,
+ consumer->net_seq_index,
+ channel->channel->name,
+ channel->stream_count,
+ channel->channel->attr.output,
+ CONSUMER_CHANNEL_TYPE_DATA);
+
+ health_code_update();