l4re-core
l4re-core copied to clipboard
READ_STAT_DONE flag is not set on empty reads
READ_STAT_DONE flag is not set when vcon_read is called with size of 0. Example: CONS frontends stop outputting data even when nothing is read, because it checks for input with size=0.
--- a/l4re/util/include/vcon_svr
+++ b/l4re/util/include/vcon_svr
@@ -87,7 +87,7 @@ public:
l4_umword_t v = this_vcon()->vcon_read(buf, size);
unsigned bytes = v & L4_VCON_READ_SIZE_MASK;
- if (bytes < size)
+ if (bytes < size || (!bytes && !size))
v |= L4_VCON_READ_STAT_DONE;
m->mr[0] = v;
Hi, thanks for reporting this issue. Could you elaborate a little bit more on this issue? I am not sure what you mean when you say it "stops outputting data when nothing is read".
Thanks, Matthias.
I meant this behaviour: https://github.com/kernkonzept/cons/blob/48ee24dfda8d7bf3ff966a2e32499802ea4e08a9/server/src/mux_impl.cc#L205-209 It calls this: https://github.com/kernkonzept/cons/blob/48ee24dfda8d7bf3ff966a2e32499802ea4e08a9/server/src/vcon_fe_base.h#L41
If the previous comment was not clear, I meant that L4_VCON_READ_STAT_DONE flag in class L4Re::Util::Vcon_svr is not set on empty reads. As per Vcon_svr documentation:
* vcon_read() needs to update the status argument with the
* L4_vcon_read_stat flags, especially the L4_VCON_READ_STAT_DONE flag
* to indicate that there's nothing more to read for the other end.
In the case when size=0 and nothing is read (bytes=0) using vcon_read(), the L4_VCON_READ_STAT_DONE flag would be not set, thus failing to indicate that there is nothing more to read.
l4_umword_t v = this_vcon()->vcon_read(buf, size);
unsigned bytes = v & L4_VCON_READ_SIZE_MASK;
if (bytes < size)
v |= L4_VCON_READ_STAT_DONE;