X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng-sessiond%2Fmain.c;h=ec45c6676bed50b8934287130011a93b55fef0f8;hb=7885e399f12affe1933fcacce7f2dab311ed6761;hp=86112f4735eb0d49dc6c93cc9cd91d7e223a677a;hpb=90192ee7cea425e30bd065576612156dd6cf5608;p=lttng-tools.git diff --git a/lttng-sessiond/main.c b/lttng-sessiond/main.c index 86112f473..ec45c6676 100644 --- a/lttng-sessiond/main.c +++ b/lttng-sessiond/main.c @@ -1527,16 +1527,17 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data) switch (consumer_data->type) { case LTTNG_CONSUMER_KERNEL: /* - * Find out which consumerd to execute. We will first - * try the 64-bit path, then the 32-bit one, then - * fallback on sessiond's installation directory. + * Find out which consumerd to execute. We will + * first try the 64-bit path, then the + * sessiond's installation directory, and + * fallback on the 32-bit one, */ if (stat(consumerd64_bin, &st) == 0) { consumer_to_use = consumerd64_bin; - } else if (stat(consumerd32_bin, &st) == 0) { - consumer_to_use = consumerd32_bin; } else if (stat(INSTALL_BIN_PATH "/" CONSUMERD_FILE, &st) == 0) { consumer_to_use = INSTALL_BIN_PATH "/" CONSUMERD_FILE; + } else if (stat(consumerd32_bin, &st) == 0) { + consumer_to_use = consumerd32_bin; } else { break; } @@ -2204,29 +2205,20 @@ static int cmd_disable_channel(struct ltt_session *session, case LTTNG_DOMAIN_UST: { struct ltt_ust_channel *uchan; + struct cds_lfht *chan_ht; - /* Get channel in global UST domain HT */ - uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, - channel_name); + chan_ht = usess->domain_global.channels; + + uchan = trace_ust_find_channel_by_name(chan_ht, channel_name); if (uchan == NULL) { ret = LTTCOMM_UST_CHAN_NOT_FOUND; 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; + ret = channel_ust_disable(usess, domain, uchan); + if (ret != LTTCOMM_OK) { goto error; } - - uchan->enabled = 0; - break; } case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: @@ -2245,40 +2237,6 @@ error: return ret; } -/* - * Copy channel from attributes and set it in the application channel list. - */ -/* -static int copy_ust_channel_to_app(struct ltt_ust_session *usess, - struct lttng_channel *attr, struct ust_app *app) -{ - int ret; - struct ltt_ust_channel *uchan, *new_chan; - - uchan = trace_ust_get_channel_by_key(usess->channels, attr->name); - if (uchan == NULL) { - ret = LTTCOMM_FATAL; - goto error; - } - - new_chan = trace_ust_create_channel(attr, usess->path); - if (new_chan == NULL) { - PERROR("malloc ltt_ust_channel"); - ret = LTTCOMM_FATAL; - goto error; - } - - ret = channel_ust_copy(new_chan, uchan); - if (ret < 0) { - ret = LTTCOMM_FATAL; - goto error; - } - -error: - return ret; -} -*/ - /* * Command LTTNG_ENABLE_CHANNEL processed by the client thread. */ @@ -2287,6 +2245,7 @@ static int cmd_enable_channel(struct ltt_session *session, { int ret; struct ltt_ust_session *usess = session->ust_session; + struct cds_lfht *chan_ht; DBG("Enabling channel %s for session %s", attr->name, session->name); @@ -2315,49 +2274,14 @@ static int cmd_enable_channel(struct ltt_session *session, { struct ltt_ust_channel *uchan; - DBG2("Enabling channel for LTTNG_DOMAIN_UST"); + chan_ht = usess->domain_global.channels; - /* Get channel in global UST domain HT */ - uchan = trace_ust_find_channel_by_name(usess->domain_global.channels, - attr->name); + uchan = trace_ust_find_channel_by_name(chan_ht, attr->name); if (uchan == NULL) { - uchan = trace_ust_create_channel(attr, usess->pathname); - if (uchan == NULL) { - ret = LTTCOMM_UST_CHAN_FAIL; - goto error; - } - - /* 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); + ret = channel_ust_create(usess, domain, attr); } else { - /* If already enabled, everything is OK */ - if (uchan->enabled) { - break; - } - - ret = ust_app_enable_channel_glb(usess, uchan); - if (ret < 0) { - if (ret != -EEXIST) { - ret = LTTCOMM_UST_CHAN_ENABLE_FAIL; - goto error; - } else { - ret = LTTCOMM_OK; - } - } + ret = channel_ust_enable(usess, domain, uchan); } - - uchan->enabled = 1; - break; } case LTTNG_DOMAIN_UST_PID_FOLLOW_CHILDREN: @@ -2370,8 +2294,6 @@ static int cmd_enable_channel(struct ltt_session *session, goto error; } - ret = LTTCOMM_OK; - error: return ret; } @@ -2408,9 +2330,8 @@ static int cmd_disable_event(struct ltt_session *session, int domain, } case LTTNG_DOMAIN_UST: { - struct ltt_ust_session *usess; struct ltt_ust_channel *uchan; - struct ltt_ust_event *uevent; + struct ltt_ust_session *usess; usess = session->ust_session; @@ -2421,23 +2342,13 @@ static int cmd_disable_event(struct ltt_session *session, int domain, goto error; } - uevent = trace_ust_find_event_by_name(uchan->events, event_name); - if (uevent == NULL) { - ret = LTTCOMM_UST_EVENT_NOT_FOUND; - goto error; - } - - ret = ust_app_disable_event_glb(usess, uchan, uevent); - if (ret < 0) { - ret = LTTCOMM_UST_DISABLE_FAIL; + ret = event_ust_disable_tracepoint(usess, domain, uchan, event_name); + if (ret != LTTCOMM_OK) { goto error; } - uevent->enabled = 0; - - DBG2("Disable UST event %s in channel %s completed", event_name, + DBG3("Disable UST event %s in channel %s completed", event_name, channel_name); - break; } case LTTNG_DOMAIN_UST_EXEC_NAME: @@ -2498,13 +2409,12 @@ static int cmd_disable_event_all(struct ltt_session *session, int domain, goto error; } - ret = ust_app_disable_all_event_glb(usess, uchan); - if (ret < 0) { - ret = LTTCOMM_UST_DISABLE_FAIL; + ret = event_ust_disable_all_tracepoints(usess, domain, uchan); + if (ret != 0) { goto error; } - DBG2("Disable all UST event in channel %s completed", channel_name); + DBG3("Disable all UST events in channel %s completed", channel_name); break; } @@ -2640,8 +2550,7 @@ static int cmd_enable_event(struct ltt_session *session, int domain, snprintf(attr->name, NAME_MAX, "%s", channel_name); attr->name[NAME_MAX - 1] = '\0'; - /* Use the internal command enable channel */ - ret = cmd_enable_channel(session, domain, attr); + ret = channel_ust_create(usess, domain, attr); if (ret != LTTCOMM_OK) { free(attr); goto error; @@ -2762,7 +2671,7 @@ static int cmd_enable_event_all(struct ltt_session *session, int domain, attr->name[NAME_MAX - 1] = '\0'; /* Use the internal command enable channel */ - ret = cmd_enable_channel(session, domain, attr); + ret = channel_ust_create(usess, domain, attr); if (ret != LTTCOMM_OK) { free(attr); goto error;