epoll_wait(2) System Calls Manual epoll_wait(2) epoll_wait, epoll_pwait, epoll_pwait2 - / epoll (libc -lc) #include int epoll_wait(int n; int epfd, struct epoll_event events[n], int n, int timeout); int epoll_pwait(int n; int epfd, struct epoll_event events[n], int n, int timeout, const sigset_t *_Nullable sigmask); int epoll_pwait2(int n; int epfd, struct epoll_event events[n], int n, const struct timespec *_Nullable timeout, const sigset_t *_Nullable sigmask); epoll_wait() epoll(7) epfd. events . epoll_wait() n . n . timeout epoll_wait(). CLOCK_MONOTONIC. epoll_wait() : o o o timeout. timeout . timeout -1 epoll_wait() timeout epoll_wait() . struct epoll_event epoll_event(3type). data epoll_event epoll_ctl(2) (EPOLL_CTL_ADD EPOLL_CTL_MOD) . events . epoll_ctl(2) . epoll_pwait() epoll_wait() epoll_pwait() select(2) pselect(2): pselect(2) epoll_pwait() . epoll_pwait() : ready = epoll_pwait(epfd, &events, n, timeout, &sigmask); : sigset_t origmask; pthread_sigmask(SIG_SETMASK, &sigmask, &origmask); ready = epoll_wait(epfd, &events, n, timeout); pthread_sigmask(SIG_SETMASK, &origmask, NULL); sigmask NULL epoll_pwait() epoll_wait(). epoll_pwait2() epoll_pwait2() epoll_pwait() timeout. timespec . pselect(2) ppoll(2). timeout NULL epoll_pwait2() . epoll_wait() / timeout . epoll_wait() -1 errno . EBADF epfd . EFAULT events . EINTR (1) (2) timeout signal(7). EINVAL epfd epoll n . . epoll_wait() 2.6 glibc 2.3.2. epoll_pwait() 2.6.19 glibc 2.6. epoll_pwait2() 5.11. epoll_wait() epoll . epoll_wait(). n epoll_wait() epoll_wait() . . epoll_wait() epoll ( ). ( ) . C epoll_pwait() epoll_pwait2() size_t sigsetsize sigmask. glibc epoll_pwait() ( sizeof(sigset_t)). 2.6.37 timeout LONG_MAX / HZ -1 ( ). sizeof(long) 4 HZ 1000 35.79 . epoll_create(2) epoll_ctl(2) epoll(7) 3 . . : . 6.18 8 2026 epoll_wait(2)