X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=ccdc50f1dbbb0e23b769f6b3fe2bbcd73059577b;hb=3735745270b83fc911d8ee39c8437256b3af4e3d;hp=16dd9ab5dd10d58365f1b04558edf37afcccb71a;hpb=b551a063b85ebdf0accaf2bbe06d0231a7b50f23;p=lttng-tools.git diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 16dd9ab5d..ccdc50f1d 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1057,6 +1057,12 @@ static void *thread_manage_apps(void *data) goto error; } + /* + * Add channel(s) and event(s) to newly registered apps + * from lttng global UST domain. + */ + update_ust_app(ust_cmd.sock); + ret = ustctl_register_done(ust_cmd.sock); if (ret < 0) { /* @@ -1078,11 +1084,6 @@ static void *thread_manage_apps(void *data) ust_cmd.sock); } - /* - * Add channel(s) and event(s) to newly registered apps - * from lttng global UST domain. - */ - update_ust_app(ust_cmd.sock); break; } } else { @@ -1097,7 +1098,7 @@ static void *thread_manage_apps(void *data) goto error; } - /* Socket closed */ + /* Socket closed on remote end. */ ust_app_unregister(pollfd); break; } @@ -1878,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; @@ -2046,7 +2048,7 @@ static int cmd_enable_channel(struct ltt_session *session, int ret; struct ltt_ust_session *usess = session->ust_session; - DBG("Enabling channel %s for session %s", session->name, attr->name); + DBG("Enabling channel %s for session %s", attr->name, session->name); switch (domain->type) { case LTTNG_DOMAIN_KERNEL: @@ -2084,6 +2086,7 @@ static int cmd_enable_channel(struct ltt_session *session, ret = LTTCOMM_UST_CHAN_FAIL; goto error; } + rcu_read_lock(); hashtable_add_unique(usess->domain_global.channels, &uchan->node); rcu_read_unlock(); @@ -2095,10 +2098,12 @@ static int cmd_enable_channel(struct ltt_session *session, /* Add channel to all registered applications */ ret = ust_app_add_channel_all(usess, uchan); - if (ret != LTTCOMM_OK) { + if (ret != 0) { goto error; } + uchan->enabled = 1; + break; } case LTTNG_DOMAIN_UST_PID: @@ -2352,6 +2357,7 @@ static int cmd_enable_event(struct ltt_session *session, int domain, ret = LTTCOMM_FATAL; goto error; } + } ret = ust_app_add_event_all(usess, uchan, uevent); @@ -2360,9 +2366,15 @@ static int cmd_enable_event(struct ltt_session *session, int domain, goto error; } + /* Add ltt ust event to channel */ rcu_read_lock(); 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; } case LTTNG_DOMAIN_UST_EXEC_NAME: @@ -2492,10 +2504,11 @@ static int cmd_start_trace(struct ltt_session *session) { int ret; struct ltt_kernel_session *ksession; - struct ltt_ust_session *usess = session->ust_session; + struct ltt_ust_session *usess; /* Short cut */ ksession = session->kernel_session; + usess = session->ust_session; /* Kernel tracing */ if (ksession != NULL) { @@ -2552,12 +2565,14 @@ static int cmd_start_trace(struct ltt_session *session) } /* Flag session that trace should start automatically */ - usess->start_trace = 1; + if (usess) { + usess->start_trace = 1; - ret = ust_app_start_trace_all(usess); - if (ret < 0) { - ret = LTTCOMM_UST_START_FAIL; - goto error; + ret = ust_app_start_trace_all(usess); + if (ret < 0) { + ret = LTTCOMM_UST_START_FAIL; + goto error; + } } ret = LTTCOMM_OK;