From: Mathieu Desnoyers Date: Fri, 6 Jul 2012 14:13:05 +0000 (-0400) Subject: Fix: mmap write() for large subbuffers and handle EINTR (v2) X-Git-Tag: v2.0.4~4 X-Git-Url: http://git.lttng.org/?a=commitdiff_plain;h=325933efee696f007b1981ac676ed7c8753b4cd2;hp=325933efee696f007b1981ac676ed7c8753b4cd2;p=lttng-tools.git Fix: mmap write() for large subbuffers and handle EINTR (v2) 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 Signed-off-by: David Goulet ---