Three system calls:
epollfd = epoll_create(int size)
Create an epoll file descriptor.
- size is an estimate of the number of file descriptors to be placed in interest list.
epoll_ctl(int epollfd,
int op, int fd,
struct epoll_event ev)
Manipulate the interest list of epollfd.
- op selects one of the following:
- add fd to the interest list (EPOLL_CTL_ADD);
- modify interest list associated with fd (EPOLL_CTL_MOD);
- remove fd from the interest list (EPOLL_CTL_DEL).
- ev specifies "event mask" and "data" to be associated with fd.
struct epoll_event { uint32_t events; /* Epoll events (bit mask) */ epoll_data_t data; /* User data (union) */ }; typedef union epoll_data { void *ptr; /* Pointer to user-defined data */ int fd; /* File descriptor */ uint32_t u32; /* 32-bit integer */ uint64_t u64; /* 64-bit integer */ } epoll_data_t;
nready = epoll_wait(int epollfd,
struct epoll_event *evlist, int maxevents,
int millisec_timeout)
Fetch up to maxevents items from the ready list associated with epollfd and place them into evlist.
(C) 2006, Michael Kerrisk