Add the trace chunk and trace chunk registry interfaces
[lttng-tools.git] / src / common / consumer / consumer.c
index 10273e66a18fe496d98b1407a30a2ae9c840c1ea..9d25d83a341e2c853026f2fb6a4b4a25b10bd2dc 100644 (file)
@@ -393,6 +393,10 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
        iter.iter.node = &channel->node.node;
        ret = lttng_ht_del(consumer_data.channel_ht, &iter);
        assert(!ret);
+
+       iter.iter.node = &channel->channels_by_session_id_ht_node.node;
+       ret = lttng_ht_del(consumer_data.channels_by_session_id_ht, &iter);
+       assert(!ret);
        rcu_read_unlock();
 
        call_rcu(&channel->node.head, free_channel_rcu);
@@ -1035,6 +1039,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        }
 
        lttng_ht_node_init_u64(&channel->node, channel->key);
+       lttng_ht_node_init_u64(&channel->channels_by_session_id_ht_node,
+                       channel->session_id);
 
        channel->wait_fd = -1;
 
@@ -1067,6 +1073,8 @@ int consumer_add_channel(struct lttng_consumer_channel *channel,
 
        rcu_read_lock();
        lttng_ht_add_unique_u64(consumer_data.channel_ht, &channel->node);
+       lttng_ht_add_u64(consumer_data.channels_by_session_id_ht,
+                       &channel->channels_by_session_id_ht_node);
        rcu_read_unlock();
 
        pthread_mutex_unlock(&channel->timer_lock);
@@ -1225,6 +1233,7 @@ void lttng_consumer_cleanup(void)
        rcu_read_unlock();
 
        lttng_ht_destroy(consumer_data.channel_ht);
+       lttng_ht_destroy(consumer_data.channels_by_session_id_ht);
 
        cleanup_relayd_ht();
 
@@ -2396,11 +2405,6 @@ restart:
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
-                       if (!revents) {
-                               /* No activity for this FD (poll implementation). */
-                               continue;
-                       }
-
                        if (pollfd == lttng_pipe_get_readfd(ctx->consumer_metadata_pipe)) {
                                if (revents & LPOLLIN) {
                                        ssize_t pipe_len;
@@ -2990,11 +2994,6 @@ restart:
                        revents = LTTNG_POLL_GETEV(&events, i);
                        pollfd = LTTNG_POLL_GETFD(&events, i);
 
-                       if (!revents) {
-                               /* No activity for this FD (poll implementation). */
-                               continue;
-                       }
-
                        if (pollfd == ctx->consumer_channel_pipe[0]) {
                                if (revents & LPOLLIN) {
                                        enum consumer_channel_action action;
@@ -3433,6 +3432,12 @@ int lttng_consumer_init(void)
                goto error;
        }
 
+       consumer_data.channels_by_session_id_ht =
+                       lttng_ht_new(0, LTTNG_HT_TYPE_U64);
+       if (!consumer_data.channels_by_session_id_ht) {
+               goto error;
+       }
+
        consumer_data.relayd_ht = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
        if (!consumer_data.relayd_ht) {
                goto error;
This page took 0.027028 seconds and 4 git commands to generate.