From: Mathieu Desnoyers Date: Thu, 21 Mar 2013 19:24:55 +0000 (-0400) Subject: Fix: allow enabling same events for two channels X-Git-Tag: v2.2.0-rc1~40 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d970f72ef97cd5f1e5e0152ce48a4c6b28eccfb2;p=lttng-ust.git Fix: allow enabling same events for two channels Fix the following use-case: 593 lttng create 594 lttng enable-channel test1 -u 595 lttng enable-event -u -a 596 lttng enable-event -u -a -c test1 597 lttng start run ./demo-trace 598 lttng stop 600 lttng view |wc -l Previously, we were seeing only 8 events (number of events written in a single stream), but now we see 16 events (each event is dispatched into two streams). Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-events.c b/liblttng-ust/lttng-events.c index d5597ca6..ca858730 100644 --- a/liblttng-ust/lttng-events.c +++ b/liblttng-ust/lttng-events.c @@ -371,9 +371,9 @@ int lttng_event_create(const struct lttng_event_desc *desc, head = &chan->session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE - 1)]; cds_hlist_for_each_entry(event, node, head, hlist) { assert(event->desc); - if (!strncmp(event->desc->name, - desc->name, - LTTNG_UST_SYM_NAME_LEN - 1)) { + if (!strncmp(event->desc->name, desc->name, + LTTNG_UST_SYM_NAME_LEN - 1) + && chan == event->chan) { ret = -EEXIST; goto exist; } @@ -505,7 +505,11 @@ static int lttng_event_match_enabler(struct lttng_event *event, struct lttng_enabler *enabler) { - return lttng_desc_match_enabler(event->desc, enabler); + if (lttng_desc_match_enabler(event->desc, enabler) + && event->chan == enabler->chan) + return 1; + else + return 0; } static @@ -563,7 +567,8 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler) hash = jhash(event_name, name_len, 0); head = &session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE - 1)]; cds_hlist_for_each_entry(event, node, head, hlist) { - if (event->desc == desc) + if (event->desc == desc + && event->chan == enabler->chan) found = 1; } if (found)