- if (!stream->metadata_flag) {
- ret = get_index_values(&index, infd);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
- }
- ret = update_stream_stats(stream);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
- }
- } else {
- write_index = 0;
- ret = metadata_stream_check_version(infd, stream);
- if (ret < 0) {
- err = kernctl_put_subbuf(infd);
- if (err != 0) {
- if (err == -EFAULT) {
- PERROR("Error in unreserving sub buffer\n");
- } else if (err == -EIO) {
- /* Should never happen with newer LTTng versions */
- PERROR("Reader has been pushed by the writer, last sub-buffer corrupted.");
- }
- ret = err;
- goto error;
- }
- goto error;
+static
+int put_next_subbuffer(struct lttng_consumer_stream *stream,
+ struct stream_subbuffer *subbuffer)
+{
+ const int ret = kernctl_put_next_subbuf(stream->wait_fd);
+
+ if (ret) {
+ if (ret == -EFAULT) {
+ PERROR("Error in unreserving sub buffer");
+ } else if (ret == -EIO) {
+ /* Should never happen with newer LTTng versions */
+ PERROR("Reader has been pushed by the writer, last sub-buffer corrupted");