This is the mail archive of the
mailing list for the Cygwin project.
Re: 1.7.8: write fails with EAGAIN
On Wed, Mar 09, 2011 at 08:46:43PM +0100, Robert Wruck wrote:
>>> I replaced the cygwin1.dll with cygwin1-20110309.dll and now a single
>>> write() with 78 MB never returns but seems to write repeatedly to the
>>> pipe (file was 5GB when I hit Ctrl-C).
>Just terminating the loop after write_overlapped_fallback is not enough.
>When the size to write exceeds MAX_OVERLAPPED_WRITE_LEN and WriteFile
>fails for MAX_OVERLAPPED_WRITE_LEN, write() will always return 0.
>In case of overlapped_error, nbytes should be set to -1.
In theory that's a situation that the caller would never see but I
will fix that.
>I'd suggest to remove write_overlapped_fallback and instead decrement
>'len' on each failure. Since write is not guaranteed to write the whole
>data, this should be OK.
The goal is to emulate what Linux does. Linux succeeds when writing
huge blocks to a non-blocking pipe. Since the code is already there
(modulo the bugs that you've noted) to do the same thing with Cygwin I'm
not going to back out what I've done and reduce the functionality.
I'm going to fix the bugs.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple