diff --git a/core/epoll.cc b/core/epoll.cc index 71530483c2..3978d19d78 100644 --- a/core/epoll.cc +++ b/core/epoll.cc @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -338,6 +339,16 @@ int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout_ return epo->wait(events, maxevents, timeout_ms); } +int epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout_ms, + const sigset_t *sigmask) +{ + sigset_t origmask; + sigprocmask(SIG_SETMASK, sigmask, &origmask); + auto ret = epoll_wait(epfd, events, maxevents, timeout_ms); + sigprocmask(SIG_SETMASK, &origmask, NULL); + return ret; +} + void epoll_file_closed(epoll_ptr ptr) { ptr.epoll->del(ptr.key); diff --git a/linux.cc b/linux.cc index 420feba634..2892ede06b 100644 --- a/linux.cc +++ b/linux.cc @@ -353,18 +353,6 @@ static int pselect6(int nfds, fd_set *readfds, fd_set *writefds, return pselect(nfds, readfds, writefds, exceptfds, timeout_ts, NULL); } -static int epoll_pwait(int epfd, struct epoll_event *events, int maxevents, - int timeout_ms, void *sig) -{ - if(sig) { - WARN_ONCE("epoll_pwait(): unimplemented with not-null sigmask\n"); - errno = ENOSYS; - return -1; - } - - return epoll_wait(epfd, events, maxevents, timeout_ms); -} - long syscall(long number, ...) { // Save FPU state and restore it at the end of this function @@ -424,7 +412,7 @@ long syscall(long number, ...) SYSCALL4(pread64, int, void *, size_t, off_t); SYSCALL2(ftruncate, int, off_t); SYSCALL1(fsync, int); - SYSCALL5(epoll_pwait, int, struct epoll_event *, int, int, void*); + SYSCALL5(epoll_pwait, int, struct epoll_event *, int, int, const sigset_t*); SYSCALL3(getrandom, char *, size_t, unsigned int); SYSCALL2(nanosleep, const struct timespec*, struct timespec *); SYSCALL4(fstatat, int, const char *, struct stat *, int);