Call epoll_shim_ppoll() instead of ppoll() on Darwin

This amends ddd348da7e .

Signed-off-by: Liang Qi <cavendish.qi@gmail.com>
This commit is contained in:
Liang Qi 2025-06-17 20:32:39 +02:00
parent f9c13de55d
commit f785060318
3 changed files with 23 additions and 2 deletions

View file

@ -38,7 +38,6 @@
#include <sys/un.h>
#include <ctype.h>
#include <fcntl.h>
#include <poll.h>
#include <pthread.h>
#include "wayland-util.h"
@ -1999,7 +1998,7 @@ wl_display_poll(struct wl_display *display,
timespec_sub_saturate(&result, &deadline, &now);
remaining_timeout = &result;
}
ret = ppoll(pfd, 1, remaining_timeout, NULL);
ret = wl_os_ppoll(pfd, 1, remaining_timeout, NULL);
} while (ret == -1 && errno == EINTR);
return ret;

View file

@ -39,6 +39,9 @@
#ifdef HAVE_SYS_UCRED_H
#include <sys/ucred.h>
#endif
#if defined(__APPLE__) && !defined(EPOLL_SHIM_DISABLE_WRAPPER_MACROS)
#include <epoll-shim/detail/poll.h>
#endif
#include "wayland-os.h"
@ -273,3 +276,18 @@ wl_os_mremap_maymove(int fd, void *old_data, ssize_t *old_size,
return result;
}
int
wl_os_ppoll(struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout_ts, const sigset_t *sigmask)
{
#if defined(__APPLE__)
#ifndef EPOLL_SHIM_DISABLE_WRAPPER_MACROS
return epoll_shim_ppoll(fds, nfds, timeout_ts, sigmask);
#else
return -1;
#endif
#endif
return ppoll(fds, nfds, timeout_ts, sigmask);
}

View file

@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
int
wl_os_socket_cloexec(int domain, int type, int protocol);
@ -51,6 +52,9 @@ void *
wl_os_mremap_maymove(int fd, void *old_data, ssize_t *old_size,
ssize_t new_size, int prot, int flags);
int
wl_os_ppoll(struct pollfd *fds, nfds_t nfds,
const struct timespec *timeout_ts, const sigset_t *sigmask);
/*
* The following are for wayland-os.c and the unit tests.