delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/03/19/07:52:20

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Boris Schaeling" <boriss AT web DOT de>
To: "Corinna Vinschen" <cygwin AT cygwin DOT com>
Subject: AW: modified poll() patch
Date: Tue, 19 Mar 2002 13:35:51 +0100
Message-ID: <LOBBKDBPKEGJJFKNFHKBCEJHGKAA.boriss@web.de>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Importance: Normal
In-Reply-To: <20020319115450.T29574@cygbert.vinschen.de>

------=_NextPart_000_0002_01C1CF4A.FC83A520
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit



> -----Ursprüngliche Nachricht-----
> Von: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com]Im Auftrag
> von Corinna Vinschen
> Gesendet: Dienstag, 19. März 2002 11:55
> An: cygwin AT cygwin DOT com
> Betreff: Re: modified poll() patch

> [...]
> thanks for the patch but could you please send a diff related to
> the latest from current cvs?  I didn't back out your patch since

Hi Corinna,

I've attached patch and changelog.

Boris

------=_NextPart_000_0002_01C1CF4A.FC83A520
Content-Type: application/octet-stream;
	name="change.log2"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="change.log2"

2002-03-19  Boris Schaeling  <boriss AT web DOT de> =0A=
=0A=
	* poll.cc: add support for invalid descriptors =0A=
	(invalid means positive descriptors including 0 =0A=
	which are not open) =0A=

------=_NextPart_000_0002_01C1CF4A.FC83A520
Content-Type: application/octet-stream;
	name="poll.patch2"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="poll.patch2"

--- poll.cc	Tue Mar 19 13:23:26 2002=0A=
+++ newpoll2.cc	Sat Mar 16 02:06:24 2002=0A=
@@ -50,41 +50,51 @@ poll (struct pollfd *fds, unsigned int n=0A=
   memset (write_fds, 0, fds_size);=0A=
   memset (except_fds, 0, fds_size);=0A=
 =0A=
+  int invalid_fds =3D 0; =0A=
   for (unsigned int i =3D 0; i < nfds; ++i) =0A=
     { =0A=
       fds[i].revents =3D 0; =0A=
       if (!cygheap->fdtab.not_open(fds[i].fd)) =0A=
-	{ =0A=
-	  if (fds[i].events & POLLIN) =0A=
-	    FD_SET(fds[i].fd, read_fds); =0A=
-	  if (fds[i].events & POLLOUT) =0A=
-	    FD_SET(fds[i].fd, write_fds); =0A=
-	  if (fds[i].events & POLLPRI) =0A=
-	    FD_SET(fds[i].fd, except_fds); =0A=
-	} =0A=
+        { =0A=
+          if (fds[i].events & POLLIN) =0A=
+            FD_SET(fds[i].fd, read_fds); =0A=
+          if (fds[i].events & POLLOUT) =0A=
+            FD_SET(fds[i].fd, write_fds); =0A=
+          if (fds[i].events & POLLPRI) =0A=
+            FD_SET(fds[i].fd, except_fds); =0A=
+        } =0A=
+      else if (fds[i].fd >=3D 0) =0A=
+        { =0A=
+          ++invalid_fds; =0A=
+          fds[i].revents =3D POLLNVAL; =0A=
+        } =0A=
     } =0A=
 =0A=
-  int ret =3D cygwin_select (max_fd + 1, read_fds, write_fds, =
except_fds, timeout < 0 ? NULL : &tv);=0A=
+  if (invalid_fds) =0A=
+    return invalid_fds; =0A=
+=0A=
+  int ret =3D cygwin_select (max_fd + 1, read_fds, write_fds, =
except_fds, timeout < 0 ? NULL : &tv); =0A=
 =0A=
   if (ret > 0) =0A=
     for (unsigned int i =3D 0; i < nfds; ++i) =0A=
       { =0A=
-	if (fds[i].fd < 0) =0A=
-	  fds[i].revents =3D POLLNVAL; =0A=
-	else if (cygheap->fdtab.not_open(fds[i].fd)) =0A=
-	  fds[i].revents =3D POLLHUP; =0A=
-	else =0A=
-	  { =0A=
-	    if (FD_ISSET(fds[i].fd, read_fds)) =0A=
-	      fds[i].revents |=3D POLLIN; =0A=
-	    if (FD_ISSET(fds[i].fd, write_fds)) =0A=
-	      fds[i].revents |=3D POLLOUT; =0A=
-	    if (FD_ISSET(fds[i].fd, read_fds) && FD_ISSET(fds[i].fd, =
write_fds)) =0A=
-	      fds[i].revents |=3D POLLERR; =0A=
-	    if (FD_ISSET(fds[i].fd, except_fds)) =0A=
-	      fds[i].revents |=3D POLLPRI; =0A=
-	  } =0A=
+        if (fds[i].fd >=3D 0) =0A=
+          { =0A=
+            if (cygheap->fdtab.not_open(fds[i].fd)) =0A=
+              fds[i].revents =3D POLLHUP; =0A=
+            else =0A=
+              { =0A=
+                if (FD_ISSET(fds[i].fd, read_fds)) =0A=
+                  fds[i].revents |=3D POLLIN; =0A=
+                if (FD_ISSET(fds[i].fd, write_fds)) =0A=
+                  fds[i].revents |=3D POLLOUT; =0A=
+                if (FD_ISSET(fds[i].fd, read_fds) && =
FD_ISSET(fds[i].fd, write_fds)) =0A=
+                  fds[i].revents |=3D POLLERR; =0A=
+                if (FD_ISSET(fds[i].fd, except_fds)) =0A=
+                  fds[i].revents |=3D POLLPRI; =0A=
+              } =0A=
+          } =0A=
       } =0A=
 =0A=
   return ret; =0A=
-} =0A=
+} =0A=
\ No newline at end of file=0A=


------=_NextPart_000_0002_01C1CF4A.FC83A520
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_NextPart_000_0002_01C1CF4A.FC83A520--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019