Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tcp module uses `poll' unconditionally.
- X-seq: zsh-workers 15886
- From: Clint Adams <clint@xxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: tcp module uses `poll' unconditionally.
- Date: Thu, 27 Sep 2001 11:34:18 -0400
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- In-reply-to: <3851.1001587467@xxxxxxx>; from pws@xxxxxxx on Thu, Sep 27, 2001 at 11:44:27AM +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <3851.1001587467@xxxxxxx>
> 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
{
Messages sorted by:
Reverse Date,
Date,
Thread,
Author