1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

AK+Lagom: Make it possible to build for iOS

This commit makes it possible to build AK and most of Lagom for iOS,
based on the work for the Ladybird build demoed on discord:
https://discord.com/channels/830522505605283862/830525031720943627/1211987732646068314
This commit is contained in:
Filiph Siitam Sandström 2024-02-27 14:32:29 +01:00 committed by Andrew Kaster
parent 2dce453f11
commit fd694e8672
17 changed files with 44 additions and 31 deletions

View file

@ -81,7 +81,7 @@ bool LocalServer::listen(ByteString const& address)
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
#endif
VERIFY(m_fd >= 0);
#ifndef AK_OS_MACOS
#if !defined(AK_OS_MACOS) && !defined(AK_OS_IOS)
rc = fchmod(m_fd, 0600);
if (rc < 0) {
perror("fchmod");
@ -118,7 +118,7 @@ ErrorOr<NonnullOwnPtr<LocalSocket>> LocalServer::accept()
VERIFY(m_listening);
sockaddr_un un;
socklen_t un_size = sizeof(un);
#if !defined(AK_OS_MACOS) && !defined(AK_OS_HAIKU)
#if !defined(AK_OS_MACOS) && !defined(AK_OS_IOS) && !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);
}
#if defined(AK_OS_MACOS) || defined(AK_OS_HAIKU)
#if defined(AK_OS_MACOS) || defined(AK_OS_IOS) || defined(AK_OS_HAIKU)
int option = 1;
ioctl(m_fd, FIONBIO, &option);
(void)fcntl(accepted_fd, F_SETFD, FD_CLOEXEC);