[patch] poll() return value is actually that of select()
Thu Dec 13 10:57:00 GMT 2007
On Dec 12 23:12, Craig MacGregor wrote:
> On Dec 12, 2007 1:57 PM, Corinna Vinschen wrote:
> > Works for me. How does it break the build for you? Patch?
> I get the following error making cygserver... i set up my dev env in a
> rush and just wanted a clean build, so i rolled back string.h to 1.8
> for a quick fix:
Oh, right. I didn't check outside of the cygwin subdir. Hmpf.
Thanks, I'll applied a fix.
> > it. I'll rather have the `ir = 1' expressions standalone on a single
> > line and curly brackets. I'll apply it tomorrow.
> I changed as few lines as possible to avoid the next point :)
I applied a (IMHO) simpler solution which doesn't require any new
variable, along these lines:
RCS file: /cvs/src/src/winsup/cygwin/poll.cc,v
retrieving revision 1.48
diff -u -p -b -r1.48 poll.cc
--- poll.cc 31 Jul 2006 14:27:56 -0000 1.48
+++ poll.cc 13 Dec 2007 10:37:54 -0000
@@ -1,6 +1,6 @@
/* poll.cc. Implements poll(2) via usage of select(2) call.
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
+ Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
This file is part of Cygwin.
@@ -76,9 +76,14 @@ poll (struct pollfd *fds, nfds_t nfds, i
- int ret = cygwin_select (max_fd + 1, read_fds, write_fds, except_fds, timeout < 0 ? NULL : &tv);
+ int ret = cygwin_select (max_fd + 1, read_fds, write_fds, except_fds,
+ timeout < 0 ? NULL : &tv);
+ if (ret <= 0)
+ return ret;
- if (ret > 0)
+ /* Set revents fields and count fds with non-zero revents fields for
+ return value. */
+ ret = 0;
for (unsigned int i = 0; i < nfds; ++i)
if (fds[i].fd >= 0)
@@ -112,6 +117,8 @@ poll (struct pollfd *fds, nfds_t nfds, i
fds[i].revents |= POLLPRI;
+ if (fds[i].revents)
The actual patch is just bigger due to the changed indentation. Please
have a look if I didn't miss anything.
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
More information about the Cygwin-patches