1EPOLL_WAIT(2)              Linux Programmer's Manual             EPOLL_WAIT(2)
2
3
4

NAME

6       epoll_wait - wait for an I/O event on an epoll file descriptor
7

SYNOPSIS

9       #include <sys/epoll.h>
10
11       int epoll_wait(int epfd, struct epoll_event * events,
12                      int maxevents, int timeout);
13

DESCRIPTION

15       Wait for events on the epoll file descriptor epfd for a maximum time of
16       timeout milliseconds. The memory area pointed to by events will contain
17       the  events that will be available for the caller.  Up to maxevents are
18       returned by epoll_wait(2).  The maxevents  parameter  must  be  greater
19       than  zero. Specifying a timeout of -1 makes epoll_wait(2) wait indefiā€
20       nitely, while specifying a timeout equal to zero makes epoll_wait(2) to
21       return  immediately  even if no events are available (return code equal
22       to zero).  The struct epoll_event is defined as :
23
24
25           typedef union epoll_data {
26               void *ptr;
27               int fd;
28               __uint32_t u32;
29               __uint64_t u64;
30           } epoll_data_t;
31
32           struct epoll_event {
33               __uint32_t events;      /* Epoll events */
34               epoll_data_t data;      /* User data variable */
35           };
36
37
38       The data of each returned structure will contain the same data the user
39       set  with a epoll_ctl(2) (EPOLL_CTL_ADD,EPOLL_CTL_MOD) while the events
40       member will contain the returned event bit field.
41

RETURN VALUE

43       When successful, epoll_wait(2) returns the number of  file  descriptors
44       ready for the requested I/O, or zero if no file descriptor became ready
45       during the requested  timeout  milliseconds.   When  an  error  occurs,
46       epoll_wait(2) returns -1 and errno is set appropriately.
47

ERRORS

49       EBADF  epfd is not a valid file descriptor.
50
51       EFAULT The  memory  area  pointed  to  by events is not accessible with
52              write permissions.
53
54       EINTR  The call was interrupted by a signal handler before any  of  the
55              requested events occurred or the timeout expired.
56
57       EINVAL epfd  is not an epoll file descriptor, or maxevents is less than
58              or equal to zero.
59

CONFORMING TO

61       epoll_wait(2) is Linux specific, and was introduced in kernel 2.5.44.
62

SEE ALSO

64       epoll_create(2), epoll_ctl(2), epoll(7)
65
66
67
68Linux                           23 October 2002                  EPOLL_WAIT(2)
Impressum