Add jul.c/.h to sessiond code
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index c80d5e772de8c48e913b5399f23be7af785241c5..b64597599caaaa9e127306f0c1b0bee806c508f0 100644 (file)
@@ -191,6 +191,7 @@ error:
  */
 struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 {
+       int ret;
        struct ltt_ust_session *lus;
 
        /* Allocate a new ltt ust session */
@@ -218,6 +219,10 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 
        /* Alloc UST global domain channels' HT */
        lus->domain_global.channels = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
+       ret = jul_init_domain(&lus->domain_jul);
+       if (ret < 0) {
+               goto error_consumer;
+       }
 
        lus->consumer = consumer_create_output(CONSUMER_DST_LOCAL);
        if (lus->consumer == NULL) {
@@ -238,6 +243,7 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 
 error_consumer:
        ht_cleanup_push(lus->domain_global.channels);
+       jul_destroy_domain(&lus->domain_jul);
        free(lus);
 error:
        return NULL;
@@ -289,6 +295,8 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan)
 
        /* Init node */
        lttng_ht_node_init_str(&luc->node, luc->name);
+       CDS_INIT_LIST_HEAD(&luc->ctx_list);
+
        /* Alloc hash tables */
        luc->events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
        luc->ctx = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
@@ -463,6 +471,7 @@ struct ltt_ust_context *trace_ust_create_context(
 
        uctx->ctx.ctx = utype;
        lttng_ht_node_init_ulong(&uctx->node, (unsigned long) uctx->ctx.ctx);
+       CDS_INIT_LIST_HEAD(&uctx->list);
 
        return uctx;
 
@@ -491,11 +500,16 @@ static void destroy_contexts(struct lttng_ht *ht)
        int ret;
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
+       struct ltt_ust_context *ctx;
 
        assert(ht);
 
        rcu_read_lock();
        cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
+               /* Remove from ordered list. */
+               ctx = caa_container_of(node, struct ltt_ust_context, node);
+               cds_list_del(&ctx->list);
+               /* Remove from channel's hash table. */
                ret = lttng_ht_del(ht, &iter);
                if (!ret) {
                        call_rcu(&node->head, destroy_context_rcu);
@@ -669,6 +683,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
 
        /* Cleaning up UST domain */
        destroy_domain_global(&session->domain_global);
+       jul_destroy_domain(&session->domain_jul);
 
        /* Cleanup UID buffer registry object(s). */
        cds_list_for_each_entry_safe(reg, sreg, &session->buffer_reg_uid_list,
This page took 0.024156 seconds and 4 git commands to generate.