diff -uNr wayland-1.24.0/meson.build source/meson.build --- clean-wayland/meson.build 2025-07-06 13:11:26.000000000 +0100 +++ patched-wayland/meson.build 2026-04-29 18:06:17.250269176 +0100 @@ -80,8 +80,8 @@ ffi_dep = dependency('libffi') decls = [ - { 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' }, - { 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' }, + { 'header': 'signal.h', 'symbol': 'SIG_BLOCK' }, + { 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' }, { 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' }, ] diff -uNr wayland-1.24.0/src/connection.c source/src/connection.c --- clean-wayland/src/connection.c 2025-07-06 13:11:26.000000000 +0100 +++ patched-wayland/src/connection.c 2026-04-29 18:06:00.540467363 +0100 @@ -40,6 +40,17 @@ #include #include +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif +#include +#include +#ifndef _RELIBC_STDIO_H +static FILE *open_memstream(char **bufp, size_t *sizep) { + *bufp = NULL; *sizep = 0; return NULL; +} +#endif + #include "wayland-util.h" #include "wayland-private.h" #include "wayland-os.h" diff -uNr wayland-1.24.0/src/event-loop.c source/src/event-loop.c --- clean-wayland/src/event-loop.c 2025-07-06 13:11:26.000000000 +0100 +++ patched-wayland/src/event-loop.c 2026-04-29 18:05:40.684702870 +0100 @@ -35,9 +35,58 @@ #include #include #include -#include -#include +/* #include */ +/* #include */ #include + +#ifndef SFD_CLOEXEC +#define SFD_CLOEXEC O_CLOEXEC +#endif +#ifndef SFD_NONBLOCK +#define SFD_NONBLOCK O_NONBLOCK +#endif +#ifndef TFD_CLOEXEC +#define TFD_CLOEXEC O_CLOEXEC +#endif +#ifndef TFD_NONBLOCK +#define TFD_NONBLOCK O_NONBLOCK +#endif +#ifndef TFD_TIMER_ABSTIME +#define TFD_TIMER_ABSTIME 0x1 +#endif + +#ifndef _RELIBC_SIGNAL_H +struct signalfd_siginfo { uint8_t pad[128]; }; +#endif +static int signalfd_impl(int fd, const sigset_t *mask, uintptr_t masksize, int flags) { + int oflag = O_RDWR; + if (flags & SFD_CLOEXEC) oflag |= O_CLOEXEC; + if (flags & SFD_NONBLOCK) oflag |= O_NONBLOCK; + if (fd == -1) { fd = open("/scheme/event", oflag); if (fd < 0) return -1; } + else { if (flags & SFD_CLOEXEC) fcntl(fd, F_SETFD, FD_CLOEXEC); } + sigprocmask(SIG_BLOCK, mask, NULL); + return fd; +} +int signalfd(int fd, const sigset_t *mask, uintptr_t masksize) { return signalfd_impl(fd, mask, masksize, 0); } +static int timerfd_create(int clockid, int flags) { + int oflag = O_RDWR; + if (flags & TFD_CLOEXEC) oflag |= O_CLOEXEC; + if (flags & TFD_NONBLOCK) oflag |= O_NONBLOCK; + char path[64]; + snprintf(path, sizeof(path), "/scheme/time/%d", clockid); + return open(path, oflag); +} +int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itimerspec *old_value) { + if (new_value == NULL) { errno = EFAULT; return -1; } + ssize_t r = write(fd, &new_value->it_value, sizeof(struct timespec)); + return (r == sizeof(struct timespec)) ? 0 : -1; +} +int timerfd_gettime(int fd, struct itimerspec *curr) { + if (curr == NULL) { errno = EFAULT; return -1; } + curr->it_interval = (struct timespec){0}; + ssize_t r = read(fd, &curr->it_value, sizeof(struct timespec)); + return (r == sizeof(struct timespec)) ? 0 : -1; +} #include "timespec-util.h" #include "wayland-util.h" #include "wayland-private.h" diff -uNr wayland-1.24.0/src/meson.build source/src/meson.build --- clean-wayland/src/meson.build 2025-07-06 13:11:26.000000000 +0100 +++ patched-wayland/src/meson.build 2026-04-29 18:06:30.380113462 +0100 @@ -81,8 +81,7 @@ endif if meson.is_cross_build() or not get_option('scanner') - scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version()) - wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner')) +wayland_scanner_for_build = find_program('wayland-scanner', native: true) else wayland_scanner_for_build = wayland_scanner endif diff -uNr wayland-1.24.0/src/wayland-server.c source/src/wayland-server.c --- clean-wayland/src/wayland-server.c 2025-07-06 13:11:26.000000000 +0100 +++ patched-wayland/src/wayland-server.c 2026-04-29 18:06:46.390923573 +0100 @@ -39,7 +39,24 @@ #include #include #include -#include +/* #include */ +#ifndef EFD_CLOEXEC +#define EFD_CLOEXEC O_CLOEXEC +#endif +#ifndef EFD_NONBLOCK +#define EFD_NONBLOCK O_NONBLOCK +#endif +#ifndef EFD_SEMAPHORE +#define EFD_SEMAPHORE 0x1 +#endif +static int eventfd(unsigned int initval, int flags) { + int oflag = O_RDWR; + if (flags & EFD_CLOEXEC) oflag |= O_CLOEXEC; + if (flags & EFD_NONBLOCK) oflag |= O_NONBLOCK; + char path[64]; + snprintf(path, sizeof(path), "/scheme/event/eventfd/%u/%d", initval, (flags & EFD_SEMAPHORE) ? 1 : 0); + return open(path, oflag); +} #include #include