Mailing-List: contact cygwin-apps-help AT sourceware DOT cygnus DOT com; run by ezmlm list-help: list-post: Sender: cygwin-apps-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin-apps AT sourceware DOT cygnus DOT com Sender: corinna AT cvhp DOT vinschen DOT de Message-ID: <394355CA.E1447AEA@vinschen.de> Date: Sun, 11 Jun 2000 11:03:06 +0200 From: Corinna Vinschen Reply-To: cygapp Organization: Cygnus Solutions, a Red Hat company X-Mailer: Mozilla 4.73 [en] (X11; I; Linux 2.2.14 i686) X-Accept-Language: de, en MIME-Version: 1.0 To: Robert Collins CC: cygwin-apps AT sourceware DOT cygnus DOT com Subject: Re: fnctl nonblocking still blocking References: <006301bfd338$a964d450$f7c723cb AT lifelesswks> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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