Fix enabled state when listing UST events
authorDavid Goulet <david.goulet@polymtl.ca>
Mon, 14 Nov 2011 21:56:58 +0000 (16:56 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Mon, 14 Nov 2011 21:57:05 +0000 (16:57 -0500)
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 <david.goulet@polymtl.ca>
lttng-sessiond/main.c
lttng-sessiond/trace-ust.c
lttng-sessiond/trace-ust.h
lttng-sessiond/ust-app.c

index d52dcb945bfe3cfbbfbd69a29b8f78700ac794f8..ccdc50f1dbbb0e23b769f6b3fe2bbcd73059577b 100644 (file)
@@ -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';
                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;
                        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;
                }
 
                        goto error;
                }
 
+               uchan->enabled = 1;
+
                break;
        }
        case LTTNG_DOMAIN_UST_PID:
                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();
 
                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;
                DBG3("UST ltt event %s added to channel %s", uevent->attr.name,
                                uchan->name);
                break;
index bc73b79776780a0d64fe98ceb2e5c93b0bf83a44..a0d3b1b4165fc26fa87149db9f8a1bf3075a7613 100644 (file)
@@ -137,7 +137,7 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
        int ret;
        struct ltt_ust_channel *luc;
 
        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;
        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;
 
 {
        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;
        if (lue == NULL) {
                PERROR("ust event malloc");
                goto error;
index f2ec7405f83fe4ca4e35b418fba0724f2b02bf20..9235ca62c837e261e682b671a6a9e7262ea5fb84 100644 (file)
@@ -43,6 +43,7 @@ struct ltt_ust_context {
 
 /* UST event */
 struct ltt_ust_event {
 
 /* UST event */
 struct ltt_ust_event {
+       unsigned int enabled;
        struct lttng_ust_event attr;
        struct cds_lfht *ctx;
        struct cds_lfht_node node;
        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 {
 
 /* 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;
        char name[LTTNG_UST_SYM_NAME_LEN];
        char pathname[PATH_MAX];
        struct lttng_ust_channel attr;
index 0fc208311931846dcda77e3346c58f712dbb4079..6e25c5b3e13f907de0b08258c5ecb13dfe61cdf4 100644 (file)
@@ -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].type = LTTNG_UST_TRACEPOINT;
                        tmp[count].pid = app->key.pid;
+                       tmp[count].enabled = -1;
                        count++;
                }
        }
                        count++;
                }
        }
This page took 0.041875 seconds and 4 git commands to generate.