This poll behavior returns POLLIN in situations where there is
actually no event to read, which causes read to block when it
should not.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I59e56cd4da9907b6f9ccdc14c6037f0f72e4505e
const struct lib_ring_buffer_config *config = &chan->backend.config;
int finalized, disabled;
unsigned long consumed, offset;
+ size_t subbuffer_header_size = config->cb.subbuffer_header_size();
if (filp->f_mode & FMODE_READ) {
poll_wait_set_exclusive(wait);
/*
* If there is a non-empty subbuffer, flush and try again.
*/
- if (subbuf_offset(offset, chan) != 0) {
+ if (subbuf_offset(offset, chan) > subbuffer_header_size) {
lib_ring_buffer_switch_remote(buf);
goto retry;
}