This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]