diff --git a/libc/src/sys/epoll/linux/epoll_wait.cpp b/libc/src/sys/epoll/linux/epoll_wait.cpp index 54927faaf8629..0c43edf764545 100644 --- a/libc/src/sys/epoll/linux/epoll_wait.cpp +++ b/libc/src/sys/epoll/linux/epoll_wait.cpp @@ -10,11 +10,11 @@ #include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" - #include "src/errno/libc_errno.h" #include // For syscall numbers. // TODO: Use this include once the include headers are also using quotes. +// #include "include/llvm-libc-types/sigset_t.h" // #include "include/llvm-libc-types/struct_epoll_event.h" #include @@ -24,9 +24,16 @@ namespace LIBC_NAMESPACE { LLVM_LIBC_FUNCTION(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout)) { +#ifdef SYS_epoll_wait int ret = LIBC_NAMESPACE::syscall_impl( SYS_epoll_wait, epfd, reinterpret_cast(events), maxevents, timeout); - +#elif defined(SYS_epoll_pwait) + int ret = LIBC_NAMESPACE::syscall_impl( + SYS_epoll_pwait, epfd, reinterpret_cast(events), maxevents, timeout, + reinterpret_cast(nullptr), sizeof(sigset_t)); +#else +#error "epoll_wait and epoll_pwait are unavailable. Unable to build epoll_wait." +#endif // A negative return value indicates an error with the magnitude of the // value being the error code. if (ret < 0) {