delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/11/13/11:24:56

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
Date: Sun, 13 Nov 2005 17:24:45 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problem with poll function
Message-ID: <20051113162445.GC3462@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4376E5AC DOT 9070400 AT narod DOT ru>
Mime-Version: 1.0
In-Reply-To: <4376E5AC.9070400@narod.ru>
User-Agent: Mutt/1.4.2i

On Nov 13 10:05, Eugene Kotlyarov wrote:
> Hello
> 
>   I've tried to build latest Curl on Cygwin and encountered problem reason 
> of which is very nicely summarized on the following page
> 
> http://www.greenend.org.uk/rjk/2001/06/poll.html
> 
> It shows that behaviour of cygwin poll when socket is closed (fourth column 
> in table) is only compatible with one old version of linux. Though curl 
> developer probably will make workaround for this, maybe fix it also in 
> Cygwin to avoid further problems. I've attached the patch for it.

> --- poll.cc.old	2005-11-13 09:05:20.640625000 +0300
> +++ poll.cc	2005-11-13 09:05:32.312500000 +0300
> @@ -119,7 +119,7 @@
>  				fds[i].revents |= POLLIN;
>  			      break;
>  			    case 0:  /* Closed on the read side. */
> -			      fds[i].revents |= POLLHUP;
> +			      fds[i].revents |= (POLLHUP | POLLIN);
>  			      break;
>  			    default:
>  			      fds[i].revents |= POLLIN;

Thanks for the path and the above URL.  It turns out that the patch
would result in another change in behaviour.  The problem is that
there's no way to distinguish between a normal close and a remote
shutdown(SHUT_WR).  As a result, the above patch would return (POLLHUP |
POLLIN) in the close case as well as in the SHUT_WR case.  What's
bugging me with this approach is the fact that Cygwin would really be
the only system returning (POLLHUP | POLLIN) in the SHUT_WR case, just
to be compatible with Linux in another case.

After some experimenting and thinking about this, I changed the
behaviour of poll() now so that it's OpenBSD compatible.  In all EOF
testcases, POLLIN alone is returned now.  This seems to comply best with
the SUSv3 description and it plays nicely with the underlying WinSock
calls.


Thanks for the report,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat, Inc.

--
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