[PATCH fifo 0/2] Add support for duplex FIFOs

Ken Brown kbrown@cornell.edu
Fri Mar 29 18:05:00 GMT 2019

On 3/29/2019 3:17 AM, Achim Gratz wrote:
> Ken Brown writes:
>>> I'm pretty sure Ken would be happy about an STC.
>> Yes, please.  Barring that, is there any chance I could see the relevant code,
>> or at least enough of it so that I can see how FIFOs are being used?
> Well, I'm trying -- but got nothing so far.  As the individual FIFO seem
> to work and the error happens pretty early, I think it has something to
> do with either switching between different FIFO (which the original code
> does) or some race between fill and drain, possibly around a buffer
> boundary (in my limited testing it always seemed to happen in the same
> place for the same data).

I found a bug in my fhandler_fifo::raw_write code that could explain the 
problem.  The call to NtWriteFile in that function always returns immediately 
because the Windows named pipe underlying the FIFO is non-blocking.  If it can't 
write because the pipe buffer is full, raw_write returns -1 with error EAGAIN. 
That's wrong if the FIFO was opened in blocking mode.

I'll have to think about how to best handle this.  I think I might be able to 
imitate what's done in fhandler_socket_unix::sendmsg in the topic/af_unix branch.


More information about the Cygwin-patches mailing list