X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=dcb5da5f44864a84af1004669c760b6a77e5f06a;hb=4ce514c43483ba24fd935024da5b7aca681a7e52;hp=f2043df9cb9c25bf364fb96b08b86340cadc7b1a;hpb=4d2a627b679e1f5be7761c71db9e118782cf7627;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index f2043df9c..dcb5da5f4 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -463,7 +463,7 @@ static int init_kernel_tracing(struct ltt_kernel_session *session) cds_lfht_for_each_entry(session->consumer->socks->ht, &iter.iter, socket, node.node) { /* Code flow error */ - assert(socket->fd >= 0); + assert(socket->fd); pthread_mutex_lock(socket->lock); ret = kernel_consumer_send_session(socket, session); @@ -675,7 +675,7 @@ int cmd_setup_relayd(struct ltt_session *session) cds_lfht_for_each_entry(usess->consumer->socks->ht, &iter.iter, socket, node.node) { /* Code flow error */ - assert(socket->fd >= 0); + assert(socket->fd); pthread_mutex_lock(socket->lock); ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id, @@ -694,7 +694,7 @@ int cmd_setup_relayd(struct ltt_session *session) cds_lfht_for_each_entry(ksess->consumer->socks->ht, &iter.iter, socket, node.node) { /* Code flow error */ - assert(socket->fd >= 0); + assert(socket->fd); pthread_mutex_lock(socket->lock); ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id, @@ -1124,17 +1124,6 @@ int cmd_add_context(struct ltt_session *session, int domain, case LTTNG_DOMAIN_KERNEL: assert(session->kernel_session); - /* - * If a non-default channel has been created in the - * session, explicitely require that -c chan_name needs - * to be provided. - */ - if (session->kernel_session->has_non_default_channel - && channel_name[0] == '\0') { - ret = LTTNG_ERR_NEED_CHANNEL_NAME; - goto error; - } - if (session->kernel_session->channel_count == 0) { /* Create default channel */ ret = channel_kernel_create(session->kernel_session, NULL, kwpipe); @@ -1156,16 +1145,6 @@ int cmd_add_context(struct ltt_session *session, int domain, assert(usess); - /* - * If a non-default channel has been created in the - * session, explicitely require that -c chan_name needs - * to be provided. - */ - if (usess->has_non_default_channel && channel_name[0] == '\0') { - ret = LTTNG_ERR_NEED_CHANNEL_NAME; - goto error; - } - chan_count = lttng_ht_get_count(usess->domain_global.channels); if (chan_count == 0) { struct lttng_channel *attr; @@ -2048,13 +2027,15 @@ int cmd_register_consumer(struct ltt_session *session, int domain, ret = LTTNG_ERR_CONNECT_FAIL; goto error; } + cdata->cmd_sock = sock; - socket = consumer_allocate_socket(sock); + socket = consumer_allocate_socket(&cdata->cmd_sock); if (socket == NULL) { ret = close(sock); if (ret < 0) { PERROR("close register consumer"); } + cdata->cmd_sock = -1; ret = LTTNG_ERR_FATAL; goto error; } @@ -2598,13 +2579,7 @@ static int record_kernel_snapshot(struct ltt_kernel_session *ksess, } ret = kernel_snapshot_record(ksess, output, wait, nb_streams); - if (ret < 0) { - if (ret == -EINVAL) { - ret = LTTNG_ERR_INVALID; - goto error_snapshot; - } - - ret = LTTNG_ERR_SNAPSHOT_FAIL; + if (ret != LTTNG_OK) { goto error_snapshot; } @@ -2857,6 +2832,8 @@ int cmd_snapshot_record(struct ltt_session *session, if (snapshot_success) { session->snapshot.nb_snapshot++; + } else { + ret = LTTNG_ERR_SNAPSHOT_FAIL; } error: