Introduce trigger hash table with tracer token as key
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread.c
index 3ae8741d65b10a346bec2c965c1581873c8ea155..1a7a16119972b3cebc45e7b3098e03a83fc81bef 100644 (file)
@@ -17,7 +17,6 @@
 #include <common/utils.h>
 #include <common/align.h>
 #include <common/time.h>
-#include <sys/eventfd.h>
 #include <sys/stat.h>
 #include <time.h>
 #include <signal.h>
@@ -135,6 +134,7 @@ struct notification_thread_handle *notification_thread_handle_create(
        } else {
                handle->channel_monitoring_pipes.kernel_consumer = -1;
        }
+
 end:
        return handle;
 error:
@@ -363,6 +363,14 @@ void fini_thread_state(struct notification_thread_state *state)
                ret = cds_lfht_destroy(state->sessions_ht, NULL);
                assert(!ret);
        }
+       if (state->triggers_by_name_uid_ht) {
+               ret = cds_lfht_destroy(state->triggers_by_name_uid_ht, NULL);
+               assert(!ret);
+       }
+       if (state->trigger_tokens_ht) {
+               ret = cds_lfht_destroy(state->trigger_tokens_ht, NULL);
+               assert(!ret);
+       }
        /*
         * Must be destroyed after all channels have been destroyed.
         * See comment in struct lttng_session_trigger_list.
@@ -375,6 +383,9 @@ void fini_thread_state(struct notification_thread_state *state)
                notification_channel_socket_destroy(
                                state->notification_channel_socket);
        }
+
+       assert(cds_list_empty(&state->tracer_event_sources_list));
+
        if (state->executor) {
                action_executor_destroy(state->executor);
        }
@@ -404,6 +415,7 @@ int init_thread_state(struct notification_thread_handle *handle,
 
        memset(state, 0, sizeof(*state));
        state->notification_channel_socket = -1;
+       state->trigger_id.next_tracer_token = 1;
        lttng_poll_init(&state->events);
 
        ret = notification_channel_socket_create();
@@ -476,6 +488,19 @@ int init_thread_state(struct notification_thread_handle *handle,
        if (!state->triggers_ht) {
                goto error;
        }
+       state->triggers_by_name_uid_ht = cds_lfht_new(DEFAULT_HT_SIZE,
+                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       if (!state->triggers_by_name_uid_ht) {
+               goto error;
+       }
+
+       state->trigger_tokens_ht = cds_lfht_new(DEFAULT_HT_SIZE,
+                       1, 0, CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
+       if (!state->trigger_tokens_ht) {
+               goto error;
+       }
+
+       CDS_INIT_LIST_HEAD(&state->tracer_event_sources_list);
 
        state->executor = action_executor_create(handle);
        if (!state->executor) {
This page took 0.024961 seconds and 4 git commands to generate.