mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 18:28:10 +00:00
LibCore: Allow LibCore to be compiled on macOS host
Compiling LibCore on macOS is needed if one wants to compile host tools (like IPCCompiler) on a non Linux host. These changes could be possibly reverted once "event loop" functionality and "base library" (Vector, String etc.) will be split in two separate libraries, updating all relevant projects.
This commit is contained in:
parent
aab412bd85
commit
1222b94ab8
3 changed files with 30 additions and 0 deletions
|
@ -5,6 +5,9 @@
|
|||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#ifndef SOCK_NONBLOCK
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
CLocalServer::CLocalServer(CObject* parent)
|
||||
: CObject(parent)
|
||||
|
@ -71,7 +74,14 @@ bool CLocalServer::listen(const String& address)
|
|||
|
||||
int rc;
|
||||
|
||||
#ifdef SOCK_NONBLOCK
|
||||
m_fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
m_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
|
||||
int option = 1;
|
||||
ioctl(m_fd, FIONBIO, &option);
|
||||
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
ASSERT(m_fd >= 0);
|
||||
|
||||
auto socket_address = CSocketAddress::local(address);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue