Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

epoll_wait - wait for events (epoll instance)

&pagelevel(4)&pagelevel

Syntax

#include <sys/epoll.h>
int epoll_wait (int epfd, struct epoll_event *events, int maxevents, int timeout)

Description

The epoll_wait() system call waits for events on the epoll instance referred to by the
file descriptor epfd. The memory area pointed to by events will contain the events that will
be available for the caller. It must be an array of struct epoll_event structures and the
number of array members must be specified in maxevents. The maxevents argument
must be greater than zero. For each file descriptor for that an event occured, the
epoll_wait() system call provides a structure in that array. The system call return events
for up to maxevents file descriptors.

The call will block until one of the following events occurs:

  • a file descriptor delivers an event

  • the call is intrrupte by a signal
    or

  • the time specified by timeout expires.

The timeout argument specifies the number of milliseconds that epoll_wait() will block.

Specifying a timeout of -1 causes epoll_wait() to block indefinitely, while specifying a
timeout equal to zero causes epoll_wait() to return immediately , even if no events are
available.

The data of each returned structure will contain the same data the user set with an
epoll_ctl() while the events member will contain the returned event bit field.

Return val.

Number of file descriptors ready for the requested I/O



if successful.

 

0

if no file descriptor became ready until time spezified by timeout expires.

 

1

if an error occurs; errno is set to indicate the error.

Errors

epoll_wait() will fail if:

EBADF

EINVAL

epfd is not a valid file descriptor.

epfd is not an epoll file descriptor,or maxevents is less than or equal zero.

EFAULT

EINTR

The memory area pointed to by events is not accessible with write permissions.

The call was interrupted by a signal handler bevor either any of the requested events occurred or the timeout expired

See also   epoll_create(), epoll_ctl()