• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1EPOLL_WAIT(2)              Linux Programmer's Manual             EPOLL_WAIT(2)
2
3
4
5NAME
6       epoll_wait - wait for an I/O event on an epoll file descriptor
7
8SYNOPSIS
9       #include <sys/epoll.h>
10
11       int  epoll_wait(int  epfd,  struct epoll_event * events, int maxevents,
12       int timeout)
13
14DESCRIPTION
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
42RETURN 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
48ERRORS
49       EBADF  epfd is not a valid file descriptor.
50
51       EINVAL The supplied  file  descriptor,  epfd,  is  not  an  epoll  file
52              descriptor,  or the maxevents parameter is less than or equal to
53              zero.
54
55       EFAULT The memory area pointed to by  events  is  not  accessible  with
56              write permissions.
57
58CONFORMING TO
59       epoll_wait(2)  is  a  new  API  introduced in Linux kernel 2.5.44.  The
60       interface should be finalized by Linux kernel 2.5.66.
61
62SEE ALSO
63       epoll(4) epoll_create(2) epoll_ctl(2)
64
65
66
67
68Linux                           23 October 2002                  EPOLL_WAIT(2)
69