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]

Re: Problem with poll function

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

> ---	2005-11-13 09:05:20.640625000 +0300
> +++	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

Thanks for the report,

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

Unsubscribe info:
Problem reports:

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