This is the mail archive of the
cygwin
mailing list for the Cygwin project.
bug: pipe + O_NONBLOCK
- From: "Alfred Minarik" <alfred dot minarik at aon dot at>
- To: <cygwin at cygwin dot com>
- Date: Sun, 18 Sep 2005 09:36:57 +0200
- Subject: bug: pipe + O_NONBLOCK
Hello,
Writing to full O_NONBLOCKed pipes should not block, but return -1 with
errno==EAGAIN.
This should print "filling" for a while, then print "full" and exit.
But at cygwin (1.5.18 on 2000/XP) it prints only "filling" and then
hangs.
--------
#include <unistd.h>
#include <fcntl.h>
int main()
{
int mypipe[2];
int data[60];
int ret;
pipe (mypipe);
fcntl(mypipe[1], F_SETFL, O_NONBLOCK);
for (;;)
{
ret=write (mypipe[1],data,57);
if (ret==-1)
{
printf("full\n");
exit(0);
}
else if (ret==57) printf("filling\n");
else printf("unexpected\n");
}
}
---------
Please take a look at this, thanks,
-Alfred
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/