mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-31 13:48:25 +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:
committed by
GitHub
parent
dd924b730a
commit
c21dc21f36
@@ -28,6 +28,10 @@
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifndef SOCK_NONBLOCK
|
||||
# include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
namespace Core {
|
||||
|
||||
UDPSocket::UDPSocket(int fd, Object* parent)
|
||||
@@ -43,7 +47,14 @@ UDPSocket::UDPSocket(int fd, Object* parent)
|
||||
UDPSocket::UDPSocket(Object* parent)
|
||||
: Socket(Socket::Type::UDP, parent)
|
||||
{
|
||||
#ifdef SOCK_NONBLOCK
|
||||
int fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
|
||||
#else
|
||||
int fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
int option = 1;
|
||||
ioctl(fd, FIONBIO, &option);
|
||||
#endif
|
||||
|
||||
if (fd < 0) {
|
||||
set_error(errno);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user