epoll

TOC  Previous  Next

The epoll API

epoll System Calls

Three system calls:





epollfd = epoll_create(int size)

Create an epoll file descriptor.


epoll_ctl(int epollfd, int op, int fd,
            struct epoll_event ev)

Manipulate the interest list of epollfd.

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