zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <clint@zsh.org>
To: Peter Stephenson <pws@csr.com>
Cc: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: tcp module uses `poll' unconditionally.
Date: Thu, 27 Sep 2001 11:34:18 -0400	[thread overview]
Message-ID: <20010927113418.B8879@dman.com> (raw)
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
     {


      reply	other threads:[~2001-09-27 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27 10:44 Peter Stephenson
2001-09-27 15:34 ` Clint Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010927113418.B8879@dman.com \
    --to=clint@zsh.org \
    --cc=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).