mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
Build: Make Lagom build under macOS (#2341)
Lagom now builds under macOS. Only two minor adjustments were required: * LibCore TCP/UDP code can't use `SOCK_{NONBLOCK,CLOEXEC}` on macOS, use ioctl() and fcntl() instead * LibJS `Heap` code pthread usage ported to MacOS
This commit is contained in:
parent
dd924b730a
commit
c21dc21f36
5 changed files with 51 additions and 1 deletions
|
@ -32,12 +32,22 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef SOCK_NONBLOCK
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
namespace Core {
|
||||
|
||||
TCPServer::TCPServer(Object* parent)
|
||||
: Object(parent)
|
||||
{
|
||||
#ifdef SOCK_NONBLOCK
|
||||
m_fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
|
||||
#else
|
||||
m_fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
int option = 1;
|
||||
ioctl(m_fd, FIONBIO, &option);
|
||||
fcntl(m_fd, F_SETFD, FD_CLOEXEC);
|
||||
#endif
|
||||
ASSERT(m_fd >= 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue