Skip to contentSkip to conversation

New: incorrect sentence in the description of struct pollfd's events field

Bug 61911 bugzilla-daemon-590EEB7GvNiWaY/[email protected] 1 participant 2 messages Sep 23, 2013 – Nov 7, 2013 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=61911

Bug ID: 61911
Summary: incorrect sentence in the description of struct
pollfd's events field
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: man-pages
Assignee: documentation_man-pages-ztI5WcYan/[email protected]
Reporter: bonzini-mXXj517/[email protected]
Regression: No

The manual page says:

The field events is an input parameter, a bit mask specifying the events the application is interested in for the file descriptor fd. If this field is specified as zero, then all events are ignored for fd and revents returns zero.

However, this is not what happens. POLLHUP and POLLERR are always reported (as one would expect, actually).

Test case 1:

#include <poll.h>
int main(void)

{
    struct pollfd pfd = { .fd = 0 };
    sleep(1);
    poll(&pfd, 1, 0);
}
$ echo x > fifo & strace -e poll ./a.out < fifo
poll([{fd=0, events=0}], 1, 0) = 1 ([{fd=0, revents=POLLHUP}])

Test case 2:

#include <poll.h>
int main(void)

{
    struct pollfd pfd = { .fd = 1 };
    sleep(1);
    poll(&pfd, 1, 0);
}
$ :< fifo & strace -e poll ./a.out > fifo
poll([{fd=1, events=0}], 1, 0) = 1 ([{fd=1, revents=POLLERR}])
Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): bug-61911-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/

#2 lore raw

[Bug 61911] incorrect sentence in the description of struct pollfd's events field

https://bugzilla.kernel.org/show_bug.cgi?id=61911

Michael Kerrisk <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |CODE_FIX

--- Comment #1 from Michael Kerrisk <[email protected]> --- Thanks, Paolo. I'm not sure what I was thinking of when I wrote that text. I applied the patch below.

man2/poll.2 +8 -5
index b0159d2..0a70065 100644
@@ -89,12 +89,15 @@ The field
 is an input parameter, a bit mask specifying the events the application
 is interested in for the file descriptor
 .IR fd .
-If this field is specified as zero,
-then all events are ignored for
-.IR fd
-and
+This field may be specified as zero,
+in which case the only events that can be returned in
 .I revents
-returns zero.
+are
+.BR POLLHUP ,
+.BR POLLERR ,
+and
+.B POLLNVAL
+(see below).
 
 The field
 .I revents
Signature · 6 lines
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html