This is the mail archive of the cygwin-apps@sourceware.cygnus.com 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]

Re: fnctl nonblocking still blocking


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


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