Fix: define _LGPL_SOURCE in C files
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 1f6fd52736abe4f8abde125fdc092601d491ec46..0e386aa0327f2f430806321766e2a4e2516b64dc 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -202,6 +203,9 @@ error:
 /*
  * Lookup an agent in the session agents hash table by domain type and return
  * the object if found else NULL.
+ *
+ * RCU read side lock must be acquired before calling and only released
+ * once the agent is no longer in scope or being used.
  */
 struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
                enum lttng_domain_type domain_type)
@@ -749,10 +753,12 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        /* Cleaning up UST domain */
        destroy_domain_global(&session->domain_global);
 
+       rcu_read_lock();
        cds_lfht_for_each_entry(session->agents->ht, &iter.iter, agt, node.node) {
                lttng_ht_del(session->agents, &iter);
                agent_destroy(agt);
        }
+       rcu_read_unlock();
 
        /* Cleanup UID buffer registry object(s). */
        cds_list_for_each_entry_safe(reg, sreg, &session->buffer_reg_uid_list,
This page took 0.025202 seconds and 5 git commands to generate.