poll(2) DG/UX 4.30 poll(2)
NAME
poll - Check whether certain conditions exist on open
streams.
SYNOPSIS
#include <stropts.h>
#include <poll.h>
int poll (poll_descriptor_array, array_size, timeout)
struct pollfd poll_descriptor_array[];
unsigned long array_size;
int timeout;
PARAMETERS
poll_descriptor_array
A pointer to an array describing the desired
streams and the conditions to be checked for
each stream. On output, the conditions that
are actually true are filled in.
array_size The number of entries in the array.
timeout A value specifying the timeout interval.
DESCRIPTION
The poll system call tests whether certain conditions are
true for a stream. Each entry of poll_descriptor_array
describes a stream and the conditions to be checked for that
stream. An entry contains the following members:
* fd - A file descriptor to an open stream. If this
field is less than zero, events (see below) is ignored,
and revents (see below) is set to 0. If the descriptor
does not refer to a stream or is greater than the
configured limit on file descriptors, events is
ignored, and revents is set to POLLNVAL.
* events - A flag word describing the conditions for
which the stream is being checked. This field may be
any combination of the flags POLLIN, POLLPRI, and
POLLOUT. Any other flags are ignored.
* revents - Ignored on input. On output, this flag word
reports the conditions that have been true at some time
since the start of the system call. Note that the
conditions are not guaranteed to be true when the
system call returns. The conditions that may be
reported are those requested by the caller: POLLNVAL,
POLLERR, and POLLHUP. All of these conditions that
have been true since the start of the call are
reported. No other conditions are reported.
Licensed material--property of copyright holder(s) Page 1
poll(2) DG/UX 4.30 poll(2)
The poll conditions have the semantics described below:
* POLLIN - A message of type M_DATA, M_PROTO, or M_PASSFP
is at the front of the stream head's read queue.
* POLLPRI - A message of type M_PCPROTO is at the front
of the stream head's read queue.
* POLLOUT - The first downstream write queue in the
stream whose module has a service procedure is not
full. This implies that non-priority messages may be
sent downstream. (Priority messages may be sent at any
time.)
* POLLERR - An error message (M_ERROR) has arrived at the
stream head.
* POLLHUP - A hangup message (M_HANGUP) has arrived at
the stream head.
* POLLNVAL - The specified file descriptor does not
belong to an open stream, or the stream is linked under
a multiplexor.
Array_size must be less than the configured limit on the
number of active file descriptors.
Timeout specifies the timeout interval that is used if none
of the requested conditions, POLLNVAL, POLLERR, or POLLHUP
are true on any of the streams of interest. If timeout is
0, poll returns immediately. If timeout is negative, an
infinite timeout interval is used. In other words, poll
waits until one of the reportable conditions occurs or the
system call is interrupted. If timeout is positive, it
gives the number of milliseconds in the timeout interval.
Poll does not wait for the full timout interval to elapse if
one of the reportable conditions becomes true.
Poll is not affected by the O_NDELAY or O_NONBLOCK flags.
ACCESS CONTROL
None.
RETURN VALUE
0 Poll timed out and none of the reportable
conditions are true on the streams of
interest.
1 ... array_size
The number of streams for which one or more
conditions are reported.
Licensed material--property of copyright holder(s) Page 2
poll(2) DG/UX 4.30 poll(2)
-1 The poll failed. Errno indicates the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EAGAIN Memory was not available to do the poll.
EFAULT The poll descriptor array did not lie
entirely within the caller's readable and
writable address space.
EINTR A signal was caught during the poll call.
EINVAL array_size is less than zero or greater than
the configured number of file descriptors.
SEE ALSO
getmsg(2), putmsg(2), select(2).
Licensed material--property of copyright holder(s) Page 3