epoll_create

Name

epoll_create -- open an epoll file descriptor

Synopsis

#include <sys/epoll.h>

int epoll_create(int size);

Description

The epoll API, which consists of the interfaces epoll_create(), epoll_ctl(), and epoll_wait(), shall support all file descriptors compatible with poll(). These interfaces shall be usable in either level-triggered or edge-triggered mode. In level-triggered mode, epoll has similar semantics to poll(), and can be used as a faster replacement for it. In edge-triggered mode, epoll shall only report events for a file descriptor when changes occur on it.

The epoll_create() interface shall open an epoll file descriptor by allocating an event backing store of approximately size size. The size parameter is a hint to the kernel about how large the event storage should be, not a rigidly-defined maximum size.

Return Value

On success, epoll_create() shall return the file descriptor, a non-negative integer that shall be used for subsequent epoll calls. It should be closed with the close() function.

On failure, epoll_create() shall return -1 and set errno as follows.

Errors

EINVAL 

The size parameter is not positive.

ENFILE 

The maximum number of open files has been reached by the system.

ENOMEM 

Not enough memory to create the kernel object.

See Also

close(), epoll_ctl(), epoll_wait(), poll().