Add exclusion data to trace_ust_create_event
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 8363ae2954912482900e2aa5f3eeeeb4cd7bd26f..21197171c567c2215e81557427318ca66f56bc84 100644 (file)
@@ -75,7 +75,7 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
        event = caa_container_of(node, struct ltt_ust_event, node.node);
        key = _key;
 
-       /* Match the 3 elements of the key: name, filter and loglevel. */
+       /* Match the 4 elements of the key: name, filter, loglevel, exclusions. */
 
        /* Event name */
        if (strncmp(event->attr.name, key->name, sizeof(event->attr.name)) != 0) {
@@ -111,6 +111,19 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_key)
                }
        }
 
+       /* If only one of the exclusions is NULL, fail. */
+       if ((key->exclusion && !event->exclusion) || (!key->exclusion && event->exclusion)) {
+               goto no_match;
+       }
+
+       if (key->exclusion && event->exclusion) {
+               /* Both exclusions exist; check count followed by names. */
+               if (event->exclusion->count != key->exclusion->count ||
+                               memcmp(event->exclusion->names, key->exclusion->names,
+                                       event->exclusion->count * LTTNG_SYMBOL_NAME_LEN) != 0) {
+                       goto no_match;
+               }
+       }
        /* Match. */
        return 1;
 
@@ -191,6 +204,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 +232,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 +256,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;
@@ -311,7 +330,8 @@ error:
  * Return pointer to structure or NULL.
  */
 struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
-               struct lttng_filter_bytecode *filter)
+               struct lttng_filter_bytecode *filter,
+               struct lttng_event_exclusion *exclusion)
 {
        struct ltt_ust_event *lue;
 
@@ -365,6 +385,7 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
 
        /* Same layout. */
        lue->filter = (struct lttng_ust_filter_bytecode *) filter;
+       lue->exclusion = (struct lttng_event_exclusion *) exclusion;
 
        /* Init node */
        lttng_ht_node_init_str(&lue->node, lue->attr.name);
@@ -677,6 +698,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.024166 seconds and 4 git commands to generate.