This is the mail archive of the
cygwin-apps@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: fnctl nonblocking still blocking
- To: Robert Collins <robert dot collins at itdomain dot com dot au>
- Subject: Re: fnctl nonblocking still blocking
- From: Corinna Vinschen <corinna at vinschen dot de>
- Date: Sun, 11 Jun 2000 11:03:06 +0200
- CC: cygwin-apps at sourceware dot cygnus dot com
- Organization: Cygnus Solutions, a Red Hat company
- References: <006301bfd338$a964d450$f7c723cb@lifelesswks>
- Reply-To: cygapp <cygwin-apps at sourceware dot cygnus dot com>
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