xref: /titanic_51/usr/src/man/man3c/epoll_wait.3c (revision 3e0c804466b61d42dc6a3e1cb114c11681ef181a)
te
Copyright (c) 2014, Joyent, Inc. All Rights Reserved.
This file and its contents are supplied under the terms of the
Common Development and Distribution License ("CDDL"), version 1.0.
You may only use this file in accordance with the terms of version
1.0 of the CDDL.

A full copy of the text of the CDDL should have accompanied this
source. A copy of the CDDL is also available via the Internet at
http://www.illumos.org/license/CDDL.
EPOLL_WAIT 3C "Apr 17, 2014"
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(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).

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(5) instance or maxevents is not greater than zero.

NOTES

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.

SEE ALSO

epoll_create(3C), epoll_ctl(3C), port_create(3C), port_associate(3C), port_get(3C), pselect(3C), epoll(5)