Add exclusion matching logic to trace_ust_ht_match_event
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index b64597599caaaa9e127306f0c1b0bee806c508f0..c0fc3a0253fe7c630b5abd5ed0db86a3c1272d9c 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;
 
This page took 0.024432 seconds and 5 git commands to generate.