From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5119 invoked from network); 27 Sep 2001 15:34:26 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Sep 2001 15:34:26 -0000 Received: (qmail 19379 invoked by alias); 27 Sep 2001 15:34:22 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15886 Received: (qmail 19362 invoked from network); 27 Sep 2001 15:34:20 -0000 Date: Thu, 27 Sep 2001 11:34:18 -0400 From: Clint Adams To: Peter Stephenson Cc: Zsh hackers list Subject: Re: tcp module uses `poll' unconditionally. Message-ID: <20010927113418.B8879@dman.com> References: <3851.1001587467@csr.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3851.1001587467@csr.com>; from pws@csr.com on Thu, Sep 27, 2001 at 11:44:27AM +0100 > tcp.c uses poll() at line 546. It should test HAVE_POLL and if that fails > use select(). This screws up (my version of) cygwin. Ah, yes, I meant to do this a while ago. Index: Src/Modules/tcp.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/tcp.c,v retrieving revision 1.14 diff -u -r1.14 tcp.c --- Src/Modules/tcp.c 2001/09/10 19:19:16 1.14 +++ Src/Modules/tcp.c 2001/09/27 15:31:08 @@ -538,6 +538,8 @@ } if(test) { +#if defined(HAVE_POLL) || defined(HAVE_SELECT) +# ifdef HAVE_POLL struct pollfd pfd; int ret; @@ -549,7 +551,29 @@ zwarnnam(nam, "poll error: %e", NULL, errno); return 1; } - +# else + fd_set rfds; + struct timeval tv; + int ret; + + FD_ZERO(&rfds); + FD_SET(lfd, &rfds); + tv.tv_sec = 0; + tv.tv_usec = 0; + + if(ret = select(lfd+1, &rfds, NULL, NULL, &tv)) return 1; + else if (ret == -1) + { + zwarnnam(nam, "select error: %e", NULL, errno); + return 1; + } + +# endif + +#else + zwarnnam(nam, "not currently supported", NULL, 0); + return 1; +#endif } sess = zts_alloc(ZTCP_INBOUND); @@ -572,7 +596,6 @@ if(verbose) fprintf(shout, "%d is on fd %d\n", ntohs(sess->peer.in.sin_port), sess->fd); - } else {