X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.c;h=1bbee02f28c25ba64625cce77071ee8b8cfa0f2b;hb=1b0bebcb6f1a5230aedfcbab78623bb5eac633d5;hp=50d19b074cf09542eb1a757f68fa3aaaa135a1db;hpb=d295668767ac8234e83984e1812d342d03293d88;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/consumer.c b/src/bin/lttng-sessiond/consumer.c index 50d19b074..1bbee02f2 100644 --- a/src/bin/lttng-sessiond/consumer.c +++ b/src/bin/lttng-sessiond/consumer.c @@ -883,7 +883,8 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, int64_t blocking_timeout, const char *root_shm_path, const char *shm_path, - struct lttng_trace_chunk *trace_chunk) + struct lttng_trace_chunk *trace_chunk, + const struct lttng_credentials *buffer_credentials) { assert(msg); @@ -899,20 +900,13 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg, if (trace_chunk) { uint64_t chunk_id; enum lttng_trace_chunk_status chunk_status; - struct lttng_credentials chunk_credentials; chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id); assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK); LTTNG_OPTIONAL_SET(&msg->u.ask_channel.chunk_id, chunk_id); - - chunk_status = lttng_trace_chunk_get_credentials(trace_chunk, - &chunk_credentials); - assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK); - msg->u.ask_channel.buffer_credentials.uid = - chunk_credentials.uid; - msg->u.ask_channel.buffer_credentials.gid = - chunk_credentials.gid; } + msg->u.ask_channel.buffer_credentials.uid = buffer_credentials->uid; + msg->u.ask_channel.buffer_credentials.gid = buffer_credentials->gid; msg->cmd_type = LTTNG_CONSUMER_ASK_CHANNEL_CREATION; msg->u.ask_channel.subbuf_size = subbuf_size; @@ -1085,7 +1079,7 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, struct lttcomm_relayd_sock *rsock, struct consumer_output *consumer, enum lttng_stream_type type, uint64_t session_id, const char *session_name, const char *hostname, - int session_live_timer) + int session_live_timer, const uint64_t *current_chunk_id) { int ret; struct lttcomm_consumer_msg msg; @@ -1107,7 +1101,7 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock, &msg.u.relayd_sock.relayd_session_id, session_name, hostname, session_live_timer, consumer->snapshot, session_id, - sessiond_uuid); + sessiond_uuid, current_chunk_id); if (ret < 0) { /* Close the control socket. */ (void) relayd_close(rsock); @@ -1772,7 +1766,6 @@ int consumer_create_trace_chunk(struct consumer_socket *socket, goto error; } msg.u.create_trace_chunk.chunk_id = chunk_id; - /* Only used for logging purposes. */ if (chunk_has_local_output) { chunk_status = lttng_trace_chunk_get_chunk_directory_handle( @@ -1793,20 +1786,23 @@ int consumer_create_trace_chunk(struct consumer_socket *socket, chunk_dirfd = lttng_directory_handle_get_dirfd( chunk_directory_handle); assert(chunk_dirfd >= 0); - } - chunk_status = lttng_trace_chunk_get_credentials(chunk, - &chunk_credentials); - if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { - /* - * Not associating credentials to a sessiond chunk is a fatal - * internal error. - */ - ret = -LTTNG_ERR_FATAL; - goto error; + chunk_status = lttng_trace_chunk_get_credentials( + chunk, &chunk_credentials); + if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { + /* + * Not associating credentials to a sessiond chunk is a + * fatal internal error. + */ + ret = -LTTNG_ERR_FATAL; + goto error; + } + msg.u.create_trace_chunk.credentials.value.uid = + chunk_credentials.uid; + msg.u.create_trace_chunk.credentials.value.gid = + chunk_credentials.gid; + msg.u.create_trace_chunk.credentials.is_set = 1; } - msg.u.create_trace_chunk.credentials.uid = chunk_credentials.uid; - msg.u.create_trace_chunk.credentials.gid = chunk_credentials.gid; DBG("Sending consumer create trace chunk command: relayd_id = %" PRId64 ", session_id = %" PRIu64 ", chunk_id = %" PRIu64