zsh-workers
 help / color / mirror / code / Atom feed
* tcp module uses `poll' unconditionally.
@ 2001-09-27 10:44 Peter Stephenson
  2001-09-27 15:34 ` Clint Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2001-09-27 10:44 UTC (permalink / raw)
  To: Zsh hackers list

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.

zftp has a fallback to do something more limited if neither poll() nor
select() is available, tcp should probably do the same.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: tcp module uses `poll' unconditionally.
  2001-09-27 10:44 tcp module uses `poll' unconditionally Peter Stephenson
@ 2001-09-27 15:34 ` Clint Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 2001-09-27 15:34 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

> 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
     {


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-27 15:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-27 10:44 tcp module uses `poll' unconditionally Peter Stephenson
2001-09-27 15:34 ` Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).