EPOLL_WAIT(3C) Standard C Library Functions EPOLL_WAIT(3C)
NAME
epoll_wait, epoll_pwait - wait for epoll events
SYNOPSIS
#include <sys/epoll.h>
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);
DESCRIPTION
The
epoll_wait() function waits for events on the
epoll(7) 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).
RETURN VALUES
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 error.
ERRORS
The
epoll_wait() and
epoll_pwait() functions will fail if:
EBADF epfd is not a valid file descriptor.
EFAULT The memory associated with
events was not mapped or was not
writable.
EINTR A signal was received during the
epoll_wait() or
epoll_pwait().
EINVAL Either
epfd is not a valid
epoll(7) instance or
maxevents is not greater than zero.
NOTES
The
epoll(7) 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(7) for
compatibility details and restrictions.
SEE ALSO
epoll_create(3C),
epoll_ctl(3C),
port_associate(3C),
port_create(3C),
port_get(3C),
pselect(3C),
epoll(7) April 17, 2014 EPOLL_WAIT(3C)