X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-consumer.c;h=9715c426f468f5b24cf76bf64726b0cf218d5af3;hb=8c93562f396a3e785c5193ca32b40f1f16599a6a;hp=9f3557cd0d02efa77f0e41be54bcc06d670b210e;hpb=10a5031171c7bca5b4498c871b119e5a88b6a3fb;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-consumer.c b/src/bin/lttng-sessiond/ust-consumer.c index 9f3557cd0..9715c426f 100644 --- a/src/bin/lttng-sessiond/ust-consumer.c +++ b/src/bin/lttng-sessiond/ust-consumer.c @@ -28,7 +28,7 @@ #include #include "consumer.h" -#include "health.h" +#include "health-sessiond.h" #include "ust-consumer.h" #include "buffer-registry.h" #include "session.h" @@ -102,7 +102,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess, struct ust_app_channel *ua_chan, struct consumer_output *consumer, struct consumer_socket *socket, struct ust_registry_session *registry) { - int ret; + int ret, output; uint32_t chan_id; uint64_t key, chan_reg_key; char *pathname = NULL; @@ -141,13 +141,21 @@ static int ask_channel_creation(struct ust_app_session *ua_sess, chan_id = chan_reg->chan_id; } + switch (ua_chan->attr.output) { + case LTTNG_UST_MMAP: + default: + output = LTTNG_EVENT_MMAP; + break; + } + consumer_init_ask_channel_comm_msg(&msg, ua_chan->attr.subbuf_size, ua_chan->attr.num_subbuf, ua_chan->attr.overwrite, ua_chan->attr.switch_timer_interval, ua_chan->attr.read_timer_interval, - (int) ua_chan->attr.output, + ua_sess->live_timer_interval, + output, (int) ua_chan->attr.type, ua_sess->tracing_id, pathname, @@ -161,11 +169,12 @@ static int ask_channel_creation(struct ust_app_session *ua_sess, ua_chan->tracefile_size, ua_chan->tracefile_count, ua_sess->id, - ua_sess->output_traces); + ua_sess->output_traces, + ua_sess->uid); health_code_update(); - ret = lttcomm_send_unix_sock(socket->fd, &msg, sizeof(msg)); + ret = consumer_socket_send(socket, &msg, sizeof(msg)); if (ret < 0) { goto error; } @@ -206,7 +215,6 @@ int ust_consumer_ask_channel(struct ust_app_session *ua_sess, assert(ua_chan); assert(consumer); assert(socket); - assert(socket->fd >= 0); assert(registry); if (!consumer->enabled) { @@ -241,8 +249,8 @@ int ust_consumer_get_channel(struct consumer_socket *socket, assert(ua_chan); assert(socket); - assert(socket->fd >= 0); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_GET_CHANNEL; msg.u.get_channel.key = ua_chan->key; @@ -256,11 +264,11 @@ int ust_consumer_get_channel(struct consumer_socket *socket, } /* First, get the channel from consumer. */ - ret = ustctl_recv_channel_from_consumer(socket->fd, &ua_chan->obj); + ret = ustctl_recv_channel_from_consumer(*socket->fd_ptr, &ua_chan->obj); if (ret < 0) { if (ret != -EPIPE) { ERR("Error recv channel from consumer %d with ret %d", - socket->fd, ret); + *socket->fd_ptr, ret); } else { DBG3("UST app recv channel from consumer. Consumer is dead."); } @@ -279,7 +287,7 @@ int ust_consumer_get_channel(struct consumer_socket *socket, } /* Stream object is populated by this call if successful. */ - ret = ustctl_recv_stream_from_consumer(socket->fd, &stream->obj); + ret = ustctl_recv_stream_from_consumer(*socket->fd_ptr, &stream->obj); if (ret < 0) { free(stream); if (ret == -LTTNG_UST_ERR_NOENT) { @@ -289,7 +297,7 @@ int ust_consumer_get_channel(struct consumer_socket *socket, } if (ret != -EPIPE) { ERR("Recv stream from consumer %d with ret %d", - socket->fd, ret); + *socket->fd_ptr, ret); } else { DBG3("UST app recv stream from consumer. Consumer is dead."); } @@ -336,8 +344,8 @@ int ust_consumer_destroy_channel(struct consumer_socket *socket, assert(ua_chan); assert(socket); - assert(socket->fd >= 0); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL; msg.u.destroy_channel.key = ua_chan->key; @@ -444,10 +452,8 @@ int ust_consumer_metadata_request(struct consumer_socket *socket) health_code_update(); /* Wait for a metadata request */ - ret = lttcomm_recv_unix_sock(socket->fd, &request, sizeof(request)); - if (ret <= 0) { - ERR("Consumer closed the metadata socket"); - ret = -1; + ret = consumer_socket_recv(socket, &request, sizeof(request)); + if (ret < 0) { goto end; } @@ -465,6 +471,7 @@ int ust_consumer_metadata_request(struct consumer_socket *socket) DBG("PID registry not found for session id %" PRIu64, request.session_id_per_pid); + memset(&msg, 0, sizeof(msg)); msg.cmd_type = LTTNG_ERR_UND; (void) consumer_send_msg(socket, &msg); /*