Fix: mmap write() for large subbuffers and handle EINTR (v2)
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 6 Jul 2012 14:13:05 +0000 (10:13 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 6 Jul 2012 17:00:36 +0000 (13:00 -0400)
With large subbuffer (packet) size, if write() returns before copying the
entire packet for mmap buffers, the consumerd restarts the write
infinitely, which is not good at all.

This affects both lttng-ust (in default mmap mode) and lttng-kernel (but
only for mmap buffers, which is not the default).

This issue would show up with large subbuffer size.

We need to handle this case, as well as EINTR errors (which need to restart
write).

Also fixing the return value of mmap read functions, which were returning
the amount of data written by the last invocation of write() rather than
the total number of bytes written. splice use had the same issue.

Also now consider a write() that returns more bytes than requested as an
error.

Moreover, assigning error = ret after failed splice and write was a
mistake: error is holding the actual error value. ret just holds -1.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>

No differences found
This page took 0.024844 seconds and 4 git commands to generate.