mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +00:00
LibCore: Use accept instead of accept4 on Haiku
This commit is contained in:
parent
ee5b851f70
commit
0816bbe727
4 changed files with 6 additions and 6 deletions
|
@ -118,7 +118,7 @@ ErrorOr<NonnullOwnPtr<LocalSocket>> 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<NonnullOwnPtr<LocalSocket>> 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);
|
||||
|
|
|
@ -380,7 +380,7 @@ ErrorOr<Optional<struct spwd>> getspnam(StringView name)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef AK_OS_MACOS
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU)
|
||||
ErrorOr<int> accept4(int sockfd, sockaddr* address, socklen_t* address_length, int flags)
|
||||
{
|
||||
auto fd = ::accept4(sockfd, address, address_length, flags);
|
||||
|
|
|
@ -105,7 +105,7 @@ ErrorOr<Optional<struct spwd>> getspent();
|
|||
ErrorOr<Optional<struct spwd>> getspnam(StringView name);
|
||||
#endif
|
||||
|
||||
#ifndef AK_OS_MACOS
|
||||
#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU)
|
||||
ErrorOr<int> accept4(int sockfd, struct sockaddr*, socklen_t*, int flags);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ ErrorOr<NonnullOwnPtr<TCPSocket>> 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<NonnullOwnPtr<TCPSocket>> 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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue