Fix UST channel/stream output assignation
[lttng-tools.git] / src / common / consumer.c
index 0565f54dfad4da97503a6eb6575e4c51110edc32..0518f44ca902e8b55054d93a28a17314b89a740f 100644 (file)
@@ -769,6 +769,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                enum lttng_event_output output,
                uint64_t tracefile_size,
                uint64_t tracefile_count,
+               uint64_t session_id_per_pid,
                unsigned int monitor)
 {
        struct lttng_consumer_channel *channel;
@@ -782,6 +783,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        channel->key = key;
        channel->refcount = 0;
        channel->session_id = session_id;
+       channel->session_id_per_pid = session_id_per_pid;
        channel->uid = uid;
        channel->gid = gid;
        channel->relayd_id = relayd_id;
@@ -803,20 +805,6 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                channel->refcount = 1;
        }
 
-       switch (output) {
-       case LTTNG_EVENT_SPLICE:
-               channel->output = CONSUMER_CHANNEL_SPLICE;
-               break;
-       case LTTNG_EVENT_MMAP:
-               channel->output = CONSUMER_CHANNEL_MMAP;
-               break;
-       default:
-               ERR("Allocate channel output unknown %d", output);
-               free(channel);
-               channel = NULL;
-               goto end;
-       }
-
        strncpy(channel->pathname, pathname, sizeof(channel->pathname));
        channel->pathname[sizeof(channel->pathname) - 1] = '\0';
 
@@ -3107,6 +3095,7 @@ int consumer_add_relayd_socket(int net_seq_idx, int sock_type,
 
                /* Assign new file descriptor */
                relayd->control_sock.sock.fd = fd;
+               fd = -1;        /* For error path */
                /* Assign version values. */
                relayd->control_sock.major = relayd_sock->major;
                relayd->control_sock.minor = relayd_sock->minor;
@@ -3152,6 +3141,7 @@ int consumer_add_relayd_socket(int net_seq_idx, int sock_type,
 
                /* Assign new file descriptor */
                relayd->data_sock.sock.fd = fd;
+               fd = -1;        /* for eventual error paths */
                /* Assign version values. */
                relayd->data_sock.major = relayd_sock->major;
                relayd->data_sock.minor = relayd_sock->minor;
This page took 0.0292 seconds and 4 git commands to generate.