delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/18/03:38:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Alfred Minarik" <alfred DOT minarik AT aon DOT at>
To: <cygwin AT cygwin DOT com>
Subject: bug: pipe + O_NONBLOCK
Date: Sun, 18 Sep 2005 09:36:57 +0200
Message-ID: <000101c5bc23$bf83cb90$8c00000a@w2k>
MIME-Version: 1.0

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019