From: JP Ikaheimonen Date: Mon, 4 Nov 2013 13:00:30 +0000 (+0200) Subject: Add exclusion matching logic to trace_ust_ht_match_event X-Git-Tag: v2.4.0-rc1~37 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=f19e9f8b954a884f51b2138f6305c6a82292924b Add exclusion matching logic to trace_ust_ht_match_event --- diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index b64597599..c0fc3a025 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -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;