mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-08 08:21:16 -04:00
build: Fix build and tests on macOS
This commit addresses several compatibility issues that prevented Wayland from building and passing its test suite on macOS Core and Compatibility changes: - Emulate Linux behavior by explicitly setting O_NONBLOCK on connections (fixes blocking sendmsg issues on macOS). - Fix compilation on platforms missing SOCK_CLOEXEC and MSG_CMSG_CLOEXEC. - Implement wl_os_socket_peercred() using LOCAL_PEERPID for macOS. - Ensure availability of struct itimerspec (required for POSIX Timers API). Test suite fixes: - Add socketpair_cloexec() wrapper to handle platforms without atomic SOCK_CLOEXEC support. - Add implementation of memrchr() for platforms that do not provide it. - Implement is_debugger_attached() for macOS to handle test timeouts. - Fix tests to handle Mach-O binary format (instead of ELF). - Update egl-symbols-check to support macOS *.dylib Mach-O libraries. Build system: - Add meson option 'xml_catalog' to allow specifying custom catalog paths. Signed-off-by: Martin Lopatář <lopin@dataplex.cz>
This commit is contained in:
parent
53509f09ba
commit
6ef7947c93
16 changed files with 179 additions and 23 deletions
|
|
@ -61,10 +61,12 @@ socket_wrapper(int domain, int type, int protocol)
|
|||
{
|
||||
wrapped_calls_socket++;
|
||||
|
||||
#ifdef SOCK_CLOEXEC
|
||||
if (fall_back && (type & SOCK_CLOEXEC)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return socket(domain, type, protocol);
|
||||
}
|
||||
|
|
@ -110,10 +112,12 @@ recvmsg_wrapper(int sockfd, struct msghdr *msg, int flags)
|
|||
{
|
||||
wrapped_calls_recvmsg++;
|
||||
|
||||
#ifdef MSG_CMSG_CLOEXEC
|
||||
if (fall_back && (flags & MSG_CMSG_CLOEXEC)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return recvmsg(sockfd, msg, flags);
|
||||
}
|
||||
|
|
@ -170,12 +174,14 @@ TEST(os_wrappers_socket_cloexec)
|
|||
do_os_wrappers_socket_cloexec(0);
|
||||
}
|
||||
|
||||
#ifdef MSG_CMSG_CLOEXEC
|
||||
TEST(os_wrappers_socket_cloexec_fallback)
|
||||
{
|
||||
/* forced fallback */
|
||||
init_fallbacks(1);
|
||||
do_os_wrappers_socket_cloexec(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_os_wrappers_dupfd_cloexec(int n)
|
||||
|
|
@ -232,8 +238,7 @@ struct marshal_data {
|
|||
static void
|
||||
setup_marshal_data(struct marshal_data *data)
|
||||
{
|
||||
assert(socketpair(AF_UNIX,
|
||||
SOCK_STREAM | SOCK_CLOEXEC, 0, data->s) == 0);
|
||||
assert(socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, data->s) == 0);
|
||||
|
||||
data->read_connection = wl_connection_create(data->s[0],
|
||||
WL_BUFFER_DEFAULT_MAX_SIZE);
|
||||
|
|
@ -350,11 +355,13 @@ TEST(os_wrappers_recvmsg_cloexec)
|
|||
do_os_wrappers_recvmsg_cloexec(0);
|
||||
}
|
||||
|
||||
#ifdef MSG_CMSG_CLOEXEC
|
||||
TEST(os_wrappers_recvmsg_cloexec_fallback)
|
||||
{
|
||||
init_fallbacks(1);
|
||||
do_os_wrappers_recvmsg_cloexec(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
do_os_wrappers_epoll_create_cloexec(int n)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue