Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jdesfossez@efficios.com (Julien Desfossez)
Subject: [lttng-dev] [BABELTRACE PATCH 3/3] Handle empty streams on iterator init
Date: Wed, 27 Nov 2013 10:06:03 -0500	[thread overview]
Message-ID: <1385564763-1374-3-git-send-email-jdesfossez@efficios.com> (raw)
In-Reply-To: <1385564763-1374-1-git-send-email-jdesfossez@efficios.com>

In live trace streaming, we can create an iterator with inactive
streams. This patch allows inactive streams to be considered as valid.

Signed-off-by: Julien Desfossez <jdesfossez at efficios.com>
---
 lib/iterator.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/iterator.c b/lib/iterator.c
index 155fcbe..3280f4a 100644
--- a/lib/iterator.c
+++ b/lib/iterator.c
@@ -725,7 +725,7 @@ int bt_iter_init(struct bt_iter *iter,
 				if (ret == EOF) {
 					ret = 0;
 					continue;
-				} else if (ret) {
+				} else if (ret != 0 && ret != EAGAIN) {
 					goto error;
 				}
 				/* Add to heap */
@@ -821,6 +821,13 @@ reinsert:
 	removed = bt_heap_replace_max(iter->stream_heap, file_stream);
 	assert(removed == file_stream);
 
+	file_stream = bt_heap_maximum(iter->stream_heap);
+	if (file_stream->pos.content_size == 0) {
+		ret = EAGAIN;
+	} else {
+		ret = 0;
+	}
+
 end:
 	return ret;
 }
-- 
1.8.3.2




  parent reply	other threads:[~2013-11-27 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 15:06 [lttng-dev] [BABELTRACE PATCH 1/3] Handle the inactive streams Julien Desfossez
2013-11-27 15:06 ` [lttng-dev] [BABELTRACE PATCH 2/3] Handle packets containing only a header Julien Desfossez
2013-11-27 15:06 ` Julien Desfossez [this message]
2013-11-27 16:40 [lttng-dev] [BABELTRACE PATCH 1/3] Handle the inactive streams Julien Desfossez
2013-11-27 16:40 ` [lttng-dev] [BABELTRACE PATCH 3/3] Handle empty streams on iterator init Julien Desfossez
2013-11-27 17:41   ` Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1385564763-1374-3-git-send-email-jdesfossez@efficios.com \
    --to=jdesfossez@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox