Expand description
Wait for one of the events in poll_fd_p
to happen, or the time limit to run out if any.
Unlike the function family of select()
which are basically AND’S,
poll()
’s act like OR’s for polling the files.
Arguments
poll_fd
: The USER pointer to the array of file descriptors to be pollednfds
: The number stored in the previous array.time_spec
: The time, seetimer::TimeSpec
for information. NOT SUPPORTED and will be ignored!sigmask
: The pointer to the sigmask in use during the poll.
Note
POLLHUP
,POLLNVAL
andPOLLERR
are ALWAYS polled for all given files, regardless of whether it is set in the array.
Unsupported Features
- Timeout is not yet supported.
- Other implementations are supported by specific files and may not be used by
- Currently only user space structs are supported.
Return Conditions
The call will block until either:
- a file descriptor becomes ready;
- the call is interrupted by a signal handler; or
- the timeout expires.
Return Values and Side-effects
- On success, a positive number is returned; this is the number of structures which have nonzero 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 were ready.
- On error, -1 is returned, and errno is set appropriately.
- The observed event is written back to the array, with others cleared.