1 EPOLL_WAIT(3C) Standard C Library Functions EPOLL_WAIT(3C) 2 3 4 5 NAME 6 epoll_wait, epoll_pwait - wait for epoll events 7 8 SYNOPSIS 9 #include <sys/epoll.h> 10 11 int epoll_wait(int epfd, struct epoll_event *events, 12 int maxevents, int timeout); 13 14 15 int epoll_pwait(int epfd, struct epoll_event *events, 16 int maxevents, int timeout, 17 const sigset_t *sigmask); 18 19 20 DESCRIPTION 21 The epoll_wait() function waits for events on the epoll(5) instance 22 specified by epfd. The events parameter must point to an array of 23 maxevents epoll_event structures to be filled in with pending events. 24 The timeout argument specifies the number of milliseconds to wait for 25 an event if none is pending. A timeout of -1 denotes an infinite 26 timeout. 27 28 The epoll_pwait() is similar to epoll_wait(), but takes an additional 29 sigmask argument that specifies the desired signal mask when 30 epoll_pwait() is blocked. It is equivalent to atomically setting the 31 signal mask, calling epoll_wait(), and restoring the signal mask upon 32 return, and is therefore similar to the relationship between select(3C) 33 and pselect(3C). 34 35 36 RETURN VALUES 37 Upon successful completion, epoll_wait() and epoll_pwait() return the 38 number of events, or 0 if none was pending and timeout milliseconds 39 elapsed. If an error occurs, -1 is returned and errno is set to 40 indicate the error. 41 42 43 ERRORS 44 The epoll_wait() and epoll_pwait() functions will fail if: 45 46 EBADF 47 epfd is not a valid file descriptor. 48 49 50 EFAULT 51 The memory associated with events was not mapped or was not 52 writable. 53 54 55 EINTR 56 A signal was received during the epoll_wait() or 57 epoll_pwait(). 58 59 60 EINVAL 61 Either epfd is not a valid epoll(5) instance or maxevents is 62 not greater than zero. 63 64 65 66 NOTES 67 The epoll(5) facility is implemented for purposes of offering 68 compatibility for Linux-borne applications; native applications should 69 continue to prefer using event ports via the port_create(3C), 70 port_associate(3C) and port_get(3C) interfaces. See epoll(5) for 71 compatibility details and restrictions. 72 73 74 SEE ALSO 75 epoll_create(3C), epoll_ctl(3C), port_create(3C), port_associate(3C), 76 port_get(3C), pselect(3C), epoll(5) 77 78 79 80 April 17, 2014 EPOLL_WAIT(3C)