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

AK+LibCore: Standardize on AK_OS_MACOS instead of __APPLE__

We use our custom platform definitions in most places, remove
the few remaining places we weren't using `AK_OS_MACOS`.
This commit is contained in:
Brian Gianforcaro 2021-09-12 09:06:33 -07:00 committed by Andreas Kling
parent 51da5d03da
commit 871ef7a735
3 changed files with 6 additions and 5 deletions

View file

@ -17,7 +17,7 @@
# include <unistd.h> # include <unistd.h>
#endif #endif
#if defined(__APPLE__) #if defined(AK_OS_MACOS)
# include <sys/random.h> # include <sys/random.h>
#endif #endif
@ -28,7 +28,7 @@ inline void fill_with_random([[maybe_unused]] void* buffer, [[maybe_unused]] siz
#if defined(__serenity__) #if defined(__serenity__)
arc4random_buf(buffer, length); arc4random_buf(buffer, length);
#elif defined(OSS_FUZZ) #elif defined(OSS_FUZZ)
#elif defined(__unix__) or defined(__APPLE__) #elif defined(__unix__) or defined(AK_OS_MACOS)
[[maybe_unused]] int rc = getentropy(buffer, length); [[maybe_unused]] int rc = getentropy(buffer, length);
#endif #endif
} }

View file

@ -5,13 +5,14 @@
*/ */
#include <AK/Assertions.h> #include <AK/Assertions.h>
#include <AK/Platform.h>
#include <AK/StackInfo.h> #include <AK/StackInfo.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef __serenity__ #ifdef __serenity__
# include <serenity.h> # include <serenity.h>
#elif defined(__linux__) or defined(__APPLE__) #elif defined(__linux__) or defined(AK_OS_MACOS)
# include <pthread.h> # include <pthread.h>
#endif #endif
@ -36,7 +37,7 @@ StackInfo::StackInfo()
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
} }
pthread_attr_destroy(&attr); pthread_attr_destroy(&attr);
#elif __APPLE__ #elif defined(AK_OS_MACOS)
// NOTE: !! On MacOS, pthread_get_stackaddr_np gives the TOP of the stack, not the bottom! // NOTE: !! On MacOS, pthread_get_stackaddr_np gives the TOP of the stack, not the bottom!
FlatPtr top_of_stack = (FlatPtr)pthread_get_stackaddr_np(pthread_self()); FlatPtr top_of_stack = (FlatPtr)pthread_get_stackaddr_np(pthread_self());
m_size = (size_t)pthread_get_stacksize_np(pthread_self()); m_size = (size_t)pthread_get_stacksize_np(pthread_self());

View file

@ -104,7 +104,7 @@ bool LocalServer::listen(const String& address)
fcntl(m_fd, F_SETFD, FD_CLOEXEC); fcntl(m_fd, F_SETFD, FD_CLOEXEC);
#endif #endif
VERIFY(m_fd >= 0); VERIFY(m_fd >= 0);
#ifndef __APPLE__ #ifndef AK_OS_MACOS
rc = fchmod(m_fd, 0600); rc = fchmod(m_fd, 0600);
if (rc < 0) { if (rc < 0) {
perror("fchmod"); perror("fchmod");