From: Alfred Agrell <floating(a)muncher.se> Fixes: 87ca5db40e2c1b37423bdc25101a5c5e39e67e6f --- server/fd.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/fd.c b/server/fd.c index e1b969a0439..bb0e90d99d0 100644 --- a/server/fd.c +++ b/server/fd.c @@ -566,6 +566,9 @@ static inline void main_loop_epoll(void) int i, ret, timeout; struct timespec ts; struct epoll_event events[128]; +#ifdef HAVE_EPOLL_PWAIT2 + static int failed_epoll_pwait2 = 0; +#endif assert( POLLIN == EPOLLIN ); assert( POLLOUT == EPOLLOUT ); @@ -582,10 +585,15 @@ static inline void main_loop_epoll(void) if (epoll_fd == -1) break; /* an error occurred with epoll */ #ifdef HAVE_EPOLL_PWAIT2 - ret = epoll_pwait2( epoll_fd, events, ARRAY_SIZE( events ), timeout == -1 ? NULL : &ts, NULL ); -#else - ret = epoll_wait( epoll_fd, events, ARRAY_SIZE( events ), timeout ); + if (!failed_epoll_pwait2) + { + ret = epoll_pwait2( epoll_fd, events, ARRAY_SIZE( events ), timeout == -1 ? NULL : &ts, NULL ); + if (ret == -1 && errno == ENOSYS) + failed_epoll_pwait2 = 1; + } + if (failed_epoll_pwait2) #endif + ret = epoll_wait( epoll_fd, events, ARRAY_SIZE( events ), timeout ); set_current_time(); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/7640