X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fcmd.c;h=9b7306b794668b0b75831306a0a3eeacc9f20625;hb=d39829a1f4d1e656561e05bcd9c4d43d9e9a5579;hp=4fcd6a4feafdf2eae0b1e4393dd69ecfd6716d5e;hpb=dec56f6cc894de41b312354d360b6a4c09fc199d;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 4fcd6a4fe..9b7306b79 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -110,7 +110,7 @@ static int build_network_session_path(char *dst, size_t size, tmp_urls, kdata_port, tmp_uurl, udata_port); } else { int dport; - if (kuri) { + if (kuri || (!kuri && !uuri)) { dport = kdata_port; } else { /* No kernel URI, use the UST port. */ @@ -754,7 +754,7 @@ static int start_kernel_session(struct ltt_kernel_session *ksess, int wpipe) /* Setup kernel consumer socket and send fds to it */ ret = init_kernel_tracing(ksess); - if (ret < 0) { + if (ret != 0) { ret = LTTNG_ERR_KERN_START_FAIL; goto error; } @@ -1106,7 +1106,7 @@ int cmd_add_context(struct ltt_session *session, int domain, if (chan_count == 0) { struct lttng_channel *attr; /* Create default channel */ - attr = channel_new_default_attr(domain); + attr = channel_new_default_attr(domain, usess->buffer_type); if (attr == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -1166,7 +1166,8 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, kchan = trace_kernel_get_channel_by_name(channel_name, session->kernel_session); if (kchan == NULL) { - attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL); + attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, + LTTNG_BUFFER_GLOBAL); if (attr == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -1216,7 +1217,8 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, channel_name); if (uchan == NULL) { /* Create default channel */ - attr = channel_new_default_attr(LTTNG_DOMAIN_UST); + attr = channel_new_default_attr(LTTNG_DOMAIN_UST, + usess->buffer_type); if (attr == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -1286,7 +1288,8 @@ int cmd_enable_event_all(struct ltt_session *session, session->kernel_session); if (kchan == NULL) { /* Create default channel */ - attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL); + attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, + LTTNG_BUFFER_GLOBAL); if (attr == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -1350,7 +1353,8 @@ int cmd_enable_event_all(struct ltt_session *session, channel_name); if (uchan == NULL) { /* Create default channel */ - attr = channel_new_default_attr(LTTNG_DOMAIN_UST); + attr = channel_new_default_attr(LTTNG_DOMAIN_UST, + usess->buffer_type); if (attr == NULL) { ret = LTTNG_ERR_FATAL; goto error; @@ -1549,7 +1553,7 @@ int cmd_stop_trace(struct ltt_session *session) session->enabled = 0; /* Kernel tracer */ - if (ksession) { + if (ksession && ksession->started) { DBG("Stop kernel tracing"); /* Flush metadata if exist */ @@ -1579,7 +1583,7 @@ int cmd_stop_trace(struct ltt_session *session) ksession->started = 0; } - if (usess) { + if (usess && usess->start_trace) { usess->start_trace = 0; ret = ust_app_stop_trace_all(usess); @@ -1827,7 +1831,7 @@ int cmd_register_consumer(struct ltt_session *session, int domain, const char *sock_path, struct consumer_data *cdata) { int ret, sock; - struct consumer_socket *socket; + struct consumer_socket *socket = NULL; assert(session); assert(cdata); @@ -1887,9 +1891,12 @@ int cmd_register_consumer(struct ltt_session *session, int domain, goto error; } - ret = LTTNG_OK; + return LTTNG_OK; error: + if (socket) { + consumer_destroy_socket(socket); + } return ret; }