LibCore: Make Core::System::{send,recv}fd work on macOS

All the required bits were already there. Also, this would probably
work on FreeBSD without modification but I don't currently have
a system to test this on.
This commit is contained in:
Gunnar Beutner 2022-10-07 18:41:22 +02:00 committed by Linus Groh
parent 35809ef400
commit 400cc41176
Notes: sideshowbarker 2024-07-17 06:10:48 +09:00

View File

@ -563,7 +563,7 @@ ErrorOr<int> LocalSocket::receive_fd(int flags)
{
#if defined(AK_OS_SERENITY)
return Core::System::recvfd(m_helper.fd(), flags);
#elif defined(AK_OS_LINUX)
#elif defined(AK_OS_LINUX) || defined(AK_OS_MACOS)
union {
struct cmsghdr cmsghdr;
char control[CMSG_SPACE(sizeof(int))];
@ -608,7 +608,7 @@ ErrorOr<void> LocalSocket::send_fd(int fd)
{
#if defined(AK_OS_SERENITY)
return Core::System::sendfd(m_helper.fd(), fd);
#elif defined(AK_OS_LINUX)
#elif defined(AK_OS_LINUX) || defined(AK_OS_MACOS)
char c = 'F';
struct iovec iov {
.iov_base = &c,