1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +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:
Marcin Gasperowicz 2020-05-23 15:31:30 +02:00 committed by GitHub
parent dd924b730a
commit c21dc21f36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 1 deletions

View file

@ -37,7 +37,7 @@
#ifdef __serenity__
# include <serenity.h>
#elif __linux__
#elif __linux__ or __MACH__
# include <pthread.h>
#endif
@ -157,6 +157,14 @@ void Heap::gather_conservative_roots(HashTable<Cell*>& roots)
ASSERT_NOT_REACHED();
}
pthread_attr_destroy(&attr);
#elif __MACH__
stack_base = (FlatPtr)pthread_get_stackaddr_np(pthread_self());
pthread_attr_t attr = {};
if (int rc = pthread_attr_getstacksize(&attr, &stack_size) != 0) {
fprintf(stderr, "pthread_attr_getstacksize: %s\n", strerror(-rc));
ASSERT_NOT_REACHED();
}
pthread_attr_destroy(&attr);
#endif
FlatPtr stack_reference = reinterpret_cast<FlatPtr>(&dummy);