[lttng-dev] [PATCH lttng-tools 14/28] Compare also exclusions in ht_match_ust_app_event

JP Ikaheimonen jp_ikaheimonen at mentor.com
Thu Nov 7 05:21:38 EST 2013


In ht_match_ust_app_event, one of the matching criteria is
that the exclusions must match also. Add the code that checks if
exclusions match.

Signed-off-by: JP Ikaheimonen <jp_ikaheimonen at mentor.com>
---
 src/bin/lttng-sessiond/ust-app.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
index 11b588f..cc611fc 100644
--- a/src/bin/lttng-sessiond/ust-app.c
+++ b/src/bin/lttng-sessiond/ust-app.c
@@ -104,7 +104,7 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
 	event = caa_container_of(node, struct ust_app_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) {
@@ -140,6 +140,21 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
 		}
 	}
 
+	/* 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 exists, check count followed by the names. */
+		if (event->exclusion->count != key->exclusion->count ||
+				memcmp(event->exclusion->names, key->exclusion->names,
+					event->exclusion->count * LTTNG_UST_SYM_NAME_LEN) != 0) {
+			goto no_match;
+		}
+	}
+
+
 	/* Match. */
 	return 1;
 
-- 
1.8.1.2




More information about the lttng-dev mailing list