diff --git a/src/wayland-client.c b/src/wayland-client.c index fe14a6b1..5f72ec24 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #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; diff --git a/src/wayland-os.c b/src/wayland-os.c index aa44f091..9f0f6fb1 100644 --- a/src/wayland-os.c +++ b/src/wayland-os.c @@ -39,6 +39,9 @@ #ifdef HAVE_SYS_UCRED_H #include #endif +#if defined(__APPLE__) && !defined(EPOLL_SHIM_DISABLE_WRAPPER_MACROS) +#include +#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); +} diff --git a/src/wayland-os.h b/src/wayland-os.h index 068fd2fe..3f9d02bc 100644 --- a/src/wayland-os.h +++ b/src/wayland-os.h @@ -28,6 +28,7 @@ #include #include +#include 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.