From 7ee3cc563d8512f73f9f7379510ebf1673eb88a8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 6 Dec 2011 09:07:10 -0500 Subject: [PATCH] loglevel enable fix: enable event names, not loglevel Signed-off-by: Mathieu Desnoyers --- liblttng-ust/ltt-events.c | 15 ++++++++++----- liblttng-ust/ltt-probes.c | 21 ++++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index e3fd3f79..b2c3a46f 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -135,6 +135,7 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc) size_t name_len = strlen(name) + 1; uint32_t hash = jhash(name, name_len - 1, 0); int ret = 0; + struct lttng_ust_event event_param; /* * For this event, we need to lookup the loglevel. If active (in @@ -154,15 +155,19 @@ int pending_probe_fix_events(const struct lttng_event_desc *desc) struct ltt_event *ev; int ret; + memcpy(&event_param, &sl->event_param, + sizeof(event_param)); + memcpy(event_param.name, + desc->name, + sizeof(event_param.name)); /* create event */ ret = ltt_event_create(sl->chan, - &sl->event_param, NULL, + &event_param, NULL, &ev); - /* - * TODO: report error. - */ - if (ret) + if (ret) { + DBG("Error creating event"); continue; + } cds_list_add(&ev->loglevel_list, &sl->events); } diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index 8571c84d..25eb3f60 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -239,28 +239,35 @@ void _probes_create_loglevel_events(struct loglevel_entry *entry, struct session_loglevel *loglevel) { struct lttng_probe_desc *probe_desc; + struct lttng_ust_event event_param; int i; cds_list_for_each_entry(probe_desc, &probe_list, head) { for (i = 0; i < probe_desc->nr_events; i++) { const struct tracepoint_loglevel_entry *ev_ll; + const struct lttng_event_desc *event_desc; - if (!(probe_desc->event_desc[i]->loglevel)) + event_desc = probe_desc->event_desc[i]; + if (!(event_desc->loglevel)) continue; - ev_ll = *probe_desc->event_desc[i]->loglevel; + ev_ll = *event_desc->loglevel; if (!strcmp(ev_ll->identifier, entry->name)) { struct ltt_event *ev; int ret; + memcpy(&event_param, &loglevel->event_param, + sizeof(event_param)); + memcpy(event_param.name, + event_desc->name, + sizeof(event_param.name)); /* create event */ ret = ltt_event_create(loglevel->chan, - &loglevel->event_param, NULL, + &event_param, NULL, &ev); - /* - * TODO: report error. - */ - if (ret) + if (ret) { + DBG("Error creating event"); continue; + } cds_list_add(&ev->loglevel_list, &loglevel->events); } -- 2.34.1