Add exclusion matching logic to trace_ust_ht_match_event
authorJP Ikaheimonen <jp_ikaheimonen@mentor.com>
Mon, 4 Nov 2013 13:00:30 +0000 (15:00 +0200)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 14 Nov 2013 18:40:57 +0000 (13:40 -0500)
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.027041 seconds and 4 git commands to generate.