+ return pathname;
+
+error:
+ free(pathname);
+ return NULL;
+}
+
+/*
+ * Sending a single channel to the consumer with command ADD_CHANNEL.
+ */
+int kernel_consumer_add_channel(struct consumer_socket *sock,
+ struct ltt_kernel_channel *channel, struct ltt_kernel_session *session,
+ unsigned int monitor)
+{
+ int ret;
+ char *pathname;
+ struct lttcomm_consumer_msg lkm;
+ struct consumer_output *consumer;
+
+ /* Safety net */
+ assert(channel);
+ assert(session);
+ assert(session->consumer);
+
+ consumer = session->consumer;
+
+ DBG("Kernel consumer adding channel %s to kernel consumer",
+ channel->channel->name);
+
+ if (monitor) {
+ pathname = create_channel_path(consumer, session->uid, session->gid);
+ if (!pathname) {
+ ret = -1;
+ goto error;
+ }
+ } else {
+ /* Empty path. */
+ pathname = "";
+ }
+