From 3735745270b83fc911d8ee39c8437256b3af4e3d Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 14 Nov 2011 16:56:58 -0500 Subject: [PATCH] Fix enabled state when listing UST events NOTE: When listing all UST events from all registered apps, the enabled state is set to -1 meaning that there is no enable/disable state semantic at this point. Signed-off-by: David Goulet --- lttng-sessiond/main.c | 5 +++++ lttng-sessiond/trace-ust.c | 4 ++-- lttng-sessiond/trace-ust.h | 2 ++ lttng-sessiond/ust-app.c | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index d52dcb945..ccdc50f1d 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1879,6 +1879,7 @@ static int list_lttng_ust_global_events(char *channel_name, cds_lfht_for_each_entry(uchan->events, &iter, uevent, node) { strncpy(tmp[i].name, uevent->attr.name, LTTNG_SYMBOL_NAME_LEN); tmp[i].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0'; + tmp[i].enabled = uevent->enabled; switch (uevent->attr.instrumentation) { case LTTNG_UST_TRACEPOINT: tmp[i].type = LTTNG_EVENT_TRACEPOINT; @@ -2101,6 +2102,8 @@ static int cmd_enable_channel(struct ltt_session *session, goto error; } + uchan->enabled = 1; + break; } case LTTNG_DOMAIN_UST_PID: @@ -2368,6 +2371,8 @@ static int cmd_enable_event(struct ltt_session *session, int domain, hashtable_add_unique(uchan->events, &uevent->node); rcu_read_unlock(); + uevent->enabled = 1; + DBG3("UST ltt event %s added to channel %s", uevent->attr.name, uchan->name); break; diff --git a/lttng-sessiond/trace-ust.c b/lttng-sessiond/trace-ust.c index bc73b7977..a0d3b1b41 100644 --- a/lttng-sessiond/trace-ust.c +++ b/lttng-sessiond/trace-ust.c @@ -137,7 +137,7 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan, int ret; struct ltt_ust_channel *luc; - luc = malloc(sizeof(struct ltt_ust_channel)); + luc = zmalloc(sizeof(struct ltt_ust_channel)); if (luc == NULL) { perror("ltt_ust_channel malloc"); goto error; @@ -194,7 +194,7 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev) { struct ltt_ust_event *lue; - lue = malloc(sizeof(struct ltt_ust_event)); + lue = zmalloc(sizeof(struct ltt_ust_event)); if (lue == NULL) { PERROR("ust event malloc"); goto error; diff --git a/lttng-sessiond/trace-ust.h b/lttng-sessiond/trace-ust.h index f2ec7405f..9235ca62c 100644 --- a/lttng-sessiond/trace-ust.h +++ b/lttng-sessiond/trace-ust.h @@ -43,6 +43,7 @@ struct ltt_ust_context { /* UST event */ struct ltt_ust_event { + unsigned int enabled; struct lttng_ust_event attr; struct cds_lfht *ctx; struct cds_lfht_node node; @@ -59,6 +60,7 @@ struct ltt_ust_stream { /* UST channel */ struct ltt_ust_channel { + unsigned int enabled; char name[LTTNG_UST_SYM_NAME_LEN]; char pathname[PATH_MAX]; struct lttng_ust_channel attr; diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index 0fc208311..6e25c5b3e 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -414,6 +414,7 @@ int ust_app_list_events(struct lttng_event **events) tmp[count].type = LTTNG_UST_TRACEPOINT; tmp[count].pid = app->key.pid; + tmp[count].enabled = -1; count++; } } -- 2.34.1