Fix: allow enabling same events for two channels
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Mar 2013 19:24:55 +0000 (15:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 21 Mar 2013 19:24:55 +0000 (15:24 -0400)
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 <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-events.c

index d5597ca6d787ac4470538231e4a355649ac7e564..ca8587306c2c37b6c6f93ac7ff7cc39a2bfb13c7 100644 (file)
@@ -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)
This page took 0.026502 seconds and 4 git commands to generate.