fnctl nonblocking still blocking
Corinna Vinschen
corinna@vinschen.de
Sun Jun 11 02:05:00 GMT 2000
First of all, please don't post HTML mail to the mailing list.
Use plain text mail instead. Thanks.
> Robert Collins wrote:
> Hi,
> I am working on porting Squid to cygwin, I posted before about a
> problem with accept() stopping on the second call to it.
>
> I have tracked it down to the socket still blocking on io when there
> is no pending connection, even though the earlier call to fnctl was
> successful.
>
> The call made is (fcntl(fd, F_SETFL, flags | SQUID_NONBLOCK) < 0),
> where flags was retrieved by a prior call to F_GETFL, and
> SQUID_NONBLOCK is #defined to be O_NONBLOCK, I have also tried
> O_NDELAY with the same results.
>
> My question(s) are:
> what is the official status of non-blocking accept() calls in cygwin
> 1.1.2?
> where in the winsup source is fcntl implemented? I found a call to
> _fcntl but could find where that has been implemented to follow
> through...
Unfortunately, the current fcntl implementation is useless
for what you want to do. It still needs some effort to extend
fcntl's functionality. You have two different chances for a
short term solution, AFAICS:
- Either you change Squid to call `accept' only if a previous
call to `select' succeeds in finding a connection request
- or you change the affected fcntl call to
#ifdef __CYGWIN__
int nonblocking = TRUE;
ioctl(socket, FIONBIO, &nonblocking);
#else
fcntl(socket,...
#endif
Hope, that helps,
Corinna
--
Corinna Vinschen
Cygwin Developer
Cygnus Solutions, a Red Hat company
More information about the Cygwin-apps
mailing list