X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=56a12518ec97821a6810135e02a8bf1849f17df7;hb=8b366481a27ae38bce4099ac17817511e0cd5425;hp=7e4000a0fd1183365a9ccc7746e47297f0cb9d66;hpb=35a9059d90ff33b4cfd57ad613969e333dba23a1;p=lttng-tools.git diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 7e4000a0f..56a12518e 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1532,7 +1532,7 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) break; case LTTNG_CONSUMER64_UST: { - char *tmpnew; + char *tmpnew = NULL; if (consumerd64_libdir[0] != '\0') { char *tmp; @@ -2191,6 +2191,12 @@ static int cmd_disable_channel(struct ltt_session *session, goto error; } + /* Already disabled */ + if (!uchan->enabled) { + DBG2("UST channel %s already disabled", channel_name); + break; + } + ret = ust_app_disable_channel_glb(usess, uchan); if (ret < 0) { ret = LTTCOMM_UST_DISABLE_FAIL; @@ -2299,28 +2305,32 @@ static int cmd_enable_channel(struct ltt_session *session, goto error; } - rcu_read_lock(); - hashtable_add_unique(usess->domain_global.channels, &uchan->node); - rcu_read_unlock(); - DBG2("UST channel %s added to global domain HT", attr->name); - /* Add channel to all registered applications */ ret = ust_app_create_channel_glb(usess, uchan); if (ret != 0) { ret = LTTCOMM_UST_CHAN_FAIL; goto error; } + + rcu_read_lock(); + hashtable_add_unique(usess->domain_global.channels, &uchan->node); + rcu_read_unlock(); + + DBG2("UST channel %s added to global domain HT", attr->name); } else { /* If already enabled, everything is OK */ if (uchan->enabled) { - ret = LTTCOMM_OK; - goto error; + break; } ret = ust_app_enable_channel_glb(usess, uchan); if (ret < 0) { - ret = LTTCOMM_UST_ENABLE_FAIL; - goto error; + if (ret != -EEXIST) { + ret = LTTCOMM_UST_CHAN_ENABLE_FAIL; + goto error; + } else { + ret = LTTCOMM_OK; + } } } @@ -2509,21 +2519,18 @@ static int cmd_add_context(struct ltt_session *session, int domain, break; case LTTNG_DOMAIN_UST: { - /* - struct ltt_ust_session *usess; + struct ltt_ust_session *usess = session->ust_session; - cds_list_for_each_entry(usess, &session->ust_session_list.head, list) { - ret = context_ust_add(usess, ctx, - event_name, channel_name, domain); - if (ret != LTTCOMM_OK) { - goto error; - } + ret = context_ust_add(usess, domain, ctx, event_name, channel_name); + if (ret != LTTCOMM_OK) { + goto error; } break; - */ } + case LTTNG_DOMAIN_UST_EXEC_NAME: + case LTTNG_DOMAIN_UST_PID: + case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: default: - /* TODO: UST other domains */ ret = LTTCOMM_NOT_IMPLEMENTED; goto error; }