epoll_wait, epoll_pwait - wait for epoll events
int epoll_wait(int epfd, struct epoll_event *events,
int maxevents, int timeout);
int epoll_pwait(int epfd, struct epoll_event *events,
int maxevents, int timeout,
const sigset_t *sigmask);
The epoll_wait() function waits for events on the epoll(5)
instance specified by epfd. The events parameter must point to
an array of maxevents epoll_event structures to be filled in
with pending events. The timeout argument specifies the number of
milliseconds to wait for an event if none is pending. A timeout of -1
denotes an infinite timeout.
The epoll_pwait() is similar to epoll_wait(), but
takes an additional sigmask argument that specifies the desired
signal mask when epoll_pwait() is blocked. It is equivalent to
atomically setting the signal mask, calling epoll_wait(), and
restoring the signal mask upon return, and is therefore similar to the
relationship between select(3C) and pselect(3C).
Upon successful completion, epoll_wait() and epoll_pwait() return
the number of events, or 0 if none was pending and timeout milliseconds
elapsed. If an error occurs, -1 is returned and errno is set to indicate the
The epoll_wait() and epoll_pwait() functions will fail if:
epfd is not a valid file descriptor.
The memory associated with events was not mapped
or was not writable.
A signal was received during the epoll_wait() or
Either epfd is not a valid epoll(5)
instance or maxevents is not greater than zero.
The epoll(5) facility is implemented for purposes of offering
compatibility for Linux-borne applications; native applications should
continue to prefer using event ports via the port_create(3C),
port_associate(3C) and port_get(3C) interfaces. See
epoll(5) for compatibility details and restrictions.
epoll_create(3C), epoll_ctl(3C), port_create(3C),
port_associate(3C), port_get(3C), pselect(3C),