diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 9e8caee223..6051526213 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -118,7 +118,7 @@ ErrorOr> LocalServer::accept() VERIFY(m_listening); sockaddr_un un; socklen_t un_size = sizeof(un); -#ifndef AK_OS_MACOS +#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU) int accepted_fd = ::accept4(m_fd, (sockaddr*)&un, &un_size, SOCK_NONBLOCK | SOCK_CLOEXEC); #else int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size); @@ -127,7 +127,7 @@ ErrorOr> LocalServer::accept() return Error::from_syscall("accept"sv, -errno); } -#ifdef AK_OS_MACOS +#if defined(AK_OS_MACOS) || defined(AK_OS_HAIKU) int option = 1; ioctl(m_fd, FIONBIO, &option); (void)fcntl(accepted_fd, F_SETFD, FD_CLOEXEC); diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 6b3e50eb95..e1a46eda49 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -380,7 +380,7 @@ ErrorOr> getspnam(StringView name) } #endif -#ifndef AK_OS_MACOS +#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU) ErrorOr accept4(int sockfd, sockaddr* address, socklen_t* address_length, int flags) { auto fd = ::accept4(sockfd, address, address_length, flags); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 7e987e0bd8..9baf178154 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -105,7 +105,7 @@ ErrorOr> getspent(); ErrorOr> getspnam(StringView name); #endif -#ifndef AK_OS_MACOS +#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU) ErrorOr accept4(int sockfd, struct sockaddr*, socklen_t*, int flags); #endif diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp index 421dcb6897..4835a61fa7 100644 --- a/Userland/Libraries/LibCore/TCPServer.cpp +++ b/Userland/Libraries/LibCore/TCPServer.cpp @@ -80,7 +80,7 @@ ErrorOr> TCPServer::accept() VERIFY(m_listening); sockaddr_in in; socklen_t in_size = sizeof(in); -#ifndef AK_OS_MACOS +#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU) int accepted_fd = TRY(Core::System::accept4(m_fd, (sockaddr*)&in, &in_size, SOCK_NONBLOCK | SOCK_CLOEXEC)); #else int accepted_fd = TRY(Core::System::accept(m_fd, (sockaddr*)&in, &in_size)); @@ -88,7 +88,7 @@ ErrorOr> TCPServer::accept() auto socket = TRY(TCPSocket::adopt_fd(accepted_fd)); -#ifdef AK_OS_MACOS +#if defined(AK_OS_MACOS) || defined(AK_OS_HAIKU) // FIXME: Ideally, we should let the caller decide whether it wants the // socket to be nonblocking or not, but there are currently places // which depend on this.