Curious behavior of fifo on cygwin 1.7.5

Etienne Carriere etienne.carriere@gmail.com
Tue Aug 17 17:25:00 GMT 2010


Hello,

I currently have a curious behavior with fifo (named pipes on cygwin
1.7.5) . I first discovered when using Nagios on cygwin but I achieved
to simplify it . The scenario is the following :
- Creating a fifo with mkfifo /tmp/fifo.cmd
- In a C program (attached)
- open in text read mode
- Read with fgets
- In a second shell, echo "foo" >/tmp/fifo.cmd

The behavior is :
- The first fgets is a blocking read up to a write in the path (with
echo) => expected behavior
- It seems that the text is red 2 times
- The following fgets are not more blocking read
- The following write (with echo) are blocked as if there is no reading process.
- The fgets do not find the written elements in the fifo

I execute the same command on linux (RHEL 4) and I had a more
conventional behavior
- blocking read
- No problems with following write (2nd, 3rd echo)

Attached :
- Consumer of fifo : consume_fifo.c
- Producer of fifo : produce_fifo.sh
- System report : cygcheck.out

In the mailing list, I saw some problems with select and fifo but I
didn't achieve to link to this issue . So
1) Is this behavior linked to an already known bug ?
2) Is there workaround to have the Linux behavior ?

Thanks in advance,

Best Regards,

Etienne Carrière
-------------- next part --------------
A non-text attachment was scrubbed...
Name: produce_fifo.sh
Type: application/x-sh
Size: 26 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100817/dec55f4c/attachment.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cygcheck.out
Type: application/octet-stream
Size: 101878 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100817/dec55f4c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: consume_fifo.c
Type: application/octet-stream
Size: 311 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20100817/dec55f4c/attachment-0001.obj>
-------------- next part --------------
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


More information about the Cygwin mailing list