From 871ef7a73570a9af55af770437922fd229156c83 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sun, 12 Sep 2021 09:06:33 -0700 Subject: [PATCH] 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`. --- AK/Random.h | 4 ++-- AK/StackInfo.cpp | 5 +++-- Userland/Libraries/LibCore/LocalServer.cpp | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/AK/Random.h b/AK/Random.h index b4fe621d8b..398fff64b3 100644 --- a/AK/Random.h +++ b/AK/Random.h @@ -17,7 +17,7 @@ # include #endif -#if defined(__APPLE__) +#if defined(AK_OS_MACOS) # include #endif @@ -28,7 +28,7 @@ inline void fill_with_random([[maybe_unused]] void* buffer, [[maybe_unused]] siz #if defined(__serenity__) arc4random_buf(buffer, length); #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); #endif } diff --git a/AK/StackInfo.cpp b/AK/StackInfo.cpp index 2f029b7c8b..c7bd8aea41 100644 --- a/AK/StackInfo.cpp +++ b/AK/StackInfo.cpp @@ -5,13 +5,14 @@ */ #include +#include #include #include #include #ifdef __serenity__ # include -#elif defined(__linux__) or defined(__APPLE__) +#elif defined(__linux__) or defined(AK_OS_MACOS) # include #endif @@ -36,7 +37,7 @@ StackInfo::StackInfo() VERIFY_NOT_REACHED(); } 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! FlatPtr top_of_stack = (FlatPtr)pthread_get_stackaddr_np(pthread_self()); m_size = (size_t)pthread_get_stacksize_np(pthread_self()); diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp index 1acb063cf1..2f423a56f5 100644 --- a/Userland/Libraries/LibCore/LocalServer.cpp +++ b/Userland/Libraries/LibCore/LocalServer.cpp @@ -104,7 +104,7 @@ bool LocalServer::listen(const String& address) fcntl(m_fd, F_SETFD, FD_CLOEXEC); #endif VERIFY(m_fd >= 0); -#ifndef __APPLE__ +#ifndef AK_OS_MACOS rc = fchmod(m_fd, 0600); if (rc < 0) { perror("fchmod");