X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fust-consumer%2Fust-consumer.c;h=192217b4e0eea6557e02e25d4df648bc12c81987;hb=d3e2ba59faddb31870e2ce29b6a881f7ad5ad883;hp=c794b93f8e9e9574036bd4cef79468be9a853f1a;hpb=309167d2a6f59d0c8cbf64eb23ba912cdea76a34;p=lttng-tools.git diff --git a/src/common/ust-consumer/ust-consumer.c b/src/common/ust-consumer/ust-consumer.c index c794b93f8..192217b4e 100644 --- a/src/common/ust-consumer/ust-consumer.c +++ b/src/common/ust-consumer/ust-consumer.c @@ -117,14 +117,15 @@ static struct lttng_consumer_channel *allocate_channel(uint64_t session_id, const char *pathname, const char *name, uid_t uid, gid_t gid, uint64_t relayd_id, uint64_t key, enum lttng_event_output output, uint64_t tracefile_size, uint64_t tracefile_count, - uint64_t session_id_per_pid, unsigned int monitor) + uint64_t session_id_per_pid, unsigned int monitor, + unsigned int live_timer_interval) { assert(pathname); assert(name); return consumer_allocate_channel(key, session_id, pathname, name, uid, gid, relayd_id, output, tracefile_size, - tracefile_count, session_id_per_pid, monitor); + tracefile_count, session_id_per_pid, monitor, live_timer_interval); } /* @@ -1119,7 +1120,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, /* Session daemon status message are handled in the following call. */ ret = consumer_add_relayd_socket(msg.u.relayd_sock.net_index, msg.u.relayd_sock.type, ctx, sock, consumer_sockpoll, - &msg.u.relayd_sock.sock, msg.u.relayd_sock.session_id); + &msg.u.relayd_sock.sock, msg.u.relayd_sock.session_id, + msg.u.relayd_sock.relayd_session_id); goto end_nosignal; } case LTTNG_CONSUMER_DESTROY_RELAYD: @@ -1194,7 +1196,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, msg.u.ask_channel.tracefile_size, msg.u.ask_channel.tracefile_count, msg.u.ask_channel.session_id_per_pid, - msg.u.ask_channel.monitor); + msg.u.ask_channel.monitor, + msg.u.ask_channel.live_timer_interval); if (!channel) { goto end_channel_error; } @@ -1252,6 +1255,8 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, attr.switch_timer_interval = 0; } + consumer_timer_live_start(channel, msg.u.ask_channel.live_timer_interval); + /* * Add the channel to the internal state AFTER all streams were created * and successfully sent to session daemon. This way, all streams must @@ -1267,6 +1272,9 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, } consumer_metadata_cache_destroy(channel); } + if (channel->live_timer_enabled == 1) { + consumer_timer_live_stop(channel); + } goto end_channel_error; } @@ -1662,7 +1670,7 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, struct lttng_consumer_local_data *ctx) { unsigned long len, subbuf_size, padding; - int err, write_index = 0; + int err, write_index = 1; long ret = 0; char dummy; struct ustctl_consumer_stream *ustream; @@ -1678,11 +1686,6 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, /* Ease our life for what's next. */ ustream = stream->ustream; - /* Indicate that for this stream we have to write the index. */ - if (stream->index_fd >= 0) { - write_index = 1; - } - /* We can consume the 1 byte written into the wait_fd by UST */ if (stream->monitor && !stream->hangup_flush_done) { ssize_t readlen; @@ -1741,12 +1744,14 @@ retry: } assert(stream->chan->output == CONSUMER_CHANNEL_MMAP); - if (!stream->metadata_flag && write_index) { + if (!stream->metadata_flag) { index.offset = htobe64(stream->out_fd_offset); ret = get_index_values(&index, ustream); if (ret < 0) { goto end; } + } else { + write_index = 0; } /* Get the full padded subbuffer size */ @@ -1786,12 +1791,14 @@ retry: assert(err == 0); /* Write index if needed. */ - if (write_index) { - err = index_write(stream->index_fd, &index, sizeof(index)); - if (err < 0) { - ret = -1; - goto end; - } + if (!write_index) { + goto end; + } + + assert(!stream->metadata_flag); + err = consumer_stream_write_index(stream, &index); + if (err < 0) { + goto end; } end: