mirror of https://github.com/mkerrisk/man-pages
nfds should be prototyped as nfds_t; as per Debian bug 322934
Some wording and formatting improvements.
This commit is contained in:
parent
7dfefab847
commit
96296ef0fa
43
man2/poll.2
43
man2/poll.2
|
@ -30,21 +30,23 @@ poll \- wait for some event on a file descriptor
|
|||
.SH SYNOPSIS
|
||||
.B #include <sys/poll.h>
|
||||
.sp
|
||||
.BI "int poll(struct pollfd *" ufds ", unsigned int " nfds ", int " timeout );
|
||||
.BI "int poll(struct pollfd *" ufds ", nfds_t " nfds ", int " timeout );
|
||||
.SH DESCRIPTION
|
||||
.B poll
|
||||
.BR poll ()
|
||||
is a variation on the theme of
|
||||
.BR select .
|
||||
.BR select ().
|
||||
It specifies an array of
|
||||
.I nfds
|
||||
structures of type
|
||||
.br
|
||||
.nf
|
||||
struct pollfd {
|
||||
int fd; /* file descriptor */
|
||||
short events; /* requested events */
|
||||
short revents; /* returned events */
|
||||
};
|
||||
|
||||
struct pollfd {
|
||||
int fd; /* file descriptor */
|
||||
short events; /* requested events */
|
||||
short revents; /* returned events */
|
||||
};
|
||||
|
||||
.fi
|
||||
and a
|
||||
.I timeout
|
||||
|
@ -75,40 +77,45 @@ If none of the events requested (and no error) has occurred for any
|
|||
of the file descriptors, the kernel waits for
|
||||
.I timeout
|
||||
milliseconds for one of these events to occur.
|
||||
The following possible bits in these masks are defined in <sys/poll.h>
|
||||
The following possible bits in these masks are defined in <sys/poll.h>:
|
||||
.br
|
||||
.nf
|
||||
|
||||
#define POLLIN 0x0001 /* There is data to read */
|
||||
#define POLLPRI 0x0002 /* There is urgent data to read */
|
||||
#define POLLOUT 0x0004 /* Writing now will not block */
|
||||
#define POLLERR 0x0008 /* Error condition */
|
||||
#define POLLHUP 0x0010 /* Hung up */
|
||||
#define POLLNVAL 0x0020 /* Invalid request: fd not open */
|
||||
|
||||
.fi
|
||||
When compiling XPG4.2 source one also has
|
||||
When compiling XPG4.2 source one also has:
|
||||
.br
|
||||
.nf
|
||||
#ifdef _XOPEN_SOURCE
|
||||
|
||||
#ifdef _XOPEN_SOURCE
|
||||
#define POLLRDNORM 0x0040 /* Normal data may be read */
|
||||
#define POLLRDBAND 0x0080 /* Priority data may be read */
|
||||
#define POLLWRNORM 0x0100 /* Writing now will not block */
|
||||
#define POLLWRBAND 0x0200 /* Priority data may be written */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
.fi
|
||||
Finally, Linux knows about
|
||||
Finally, Linux knows about:
|
||||
.br
|
||||
.nf
|
||||
#ifdef _GNU_SOURCE
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define POLLMSG 0x0400
|
||||
#endif
|
||||
#endif
|
||||
.fi
|
||||
.SH "RETURN VALUE"
|
||||
On success, a positive number is returned, where the number returned
|
||||
is the number of structures which have non-zero
|
||||
On success, a positive number is returned; this is
|
||||
the number of structures which have non-zero
|
||||
.I revents
|
||||
fields (in other words, those descriptors with events or errors reported).
|
||||
A value of 0 indicates that the call timed out and no file
|
||||
descriptors have been selected. On error, \-1 is returned, and
|
||||
descriptors were ready. On error, \-1 is returned, and
|
||||
.I errno
|
||||
is set appropriately.
|
||||
.SH ERRORS
|
||||
|
|
Loading…
Reference in New Issue