diff options
-rw-r--r-- | AK/StackInfo.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibCompress/BrotliDictionary.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/File.cpp | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/Stream.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.cpp | 14 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/System.h | 2 |
6 files changed, 18 insertions, 18 deletions
diff --git a/AK/StackInfo.cpp b/AK/StackInfo.cpp index 95384f1e08..7160f0e6a6 100644 --- a/AK/StackInfo.cpp +++ b/AK/StackInfo.cpp @@ -12,9 +12,9 @@ #ifdef AK_OS_SERENITY # include <serenity.h> -#elif defined(__linux__) or defined(AK_OS_MACOS) +#elif defined(AK_OS_LINUX) or defined(AK_OS_MACOS) # include <pthread.h> -#elif defined(__FreeBSD__) +#elif defined(AK_OS_FREEBSD) # include <pthread.h> # include <pthread_np.h> #endif @@ -28,12 +28,12 @@ StackInfo::StackInfo() perror("get_stack_bounds"); VERIFY_NOT_REACHED(); } -#elif defined(__linux__) or defined(__FreeBSD__) +#elif defined(AK_OS_LINUX) or defined(AK_OS_FREEBSD) int rc; pthread_attr_t attr; pthread_attr_init(&attr); -# ifdef __linux__ +# ifdef AK_OS_LINUX if ((rc = pthread_getattr_np(pthread_self(), &attr)) != 0) { fprintf(stderr, "pthread_getattr_np: %s\n", strerror(rc)); VERIFY_NOT_REACHED(); diff --git a/Userland/Libraries/LibCompress/BrotliDictionary.cpp b/Userland/Libraries/LibCompress/BrotliDictionary.cpp index 92fe8ccb02..577012647e 100644 --- a/Userland/Libraries/LibCompress/BrotliDictionary.cpp +++ b/Userland/Libraries/LibCompress/BrotliDictionary.cpp @@ -9,7 +9,7 @@ // Include the 119.9 KiB of dictionary data from a binary file extern u8 const brotli_dictionary_data[]; -#if defined(__APPLE__) +#if defined(AK_OS_MACOS) asm(".const_data\n" ".globl _brotli_dictionary_data\n" "_brotli_dictionary_data:\n"); diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp index 94014771d9..d3e08c4fea 100644 --- a/Userland/Libraries/LibCore/File.cpp +++ b/Userland/Libraries/LibCore/File.cpp @@ -22,7 +22,7 @@ #endif // On Linux distros that use glibc `basename` is defined as a macro that expands to `__xpg_basename`, so we undefine it -#if defined(__linux__) && defined(basename) +#if defined(AK_OS_LINUX) && defined(basename) # undef basename #endif diff --git a/Userland/Libraries/LibCore/Stream.cpp b/Userland/Libraries/LibCore/Stream.cpp index 6d8cd80fee..4b18310248 100644 --- a/Userland/Libraries/LibCore/Stream.cpp +++ b/Userland/Libraries/LibCore/Stream.cpp @@ -17,7 +17,7 @@ #ifdef AK_OS_SERENITY # include <serenity.h> #endif -#ifdef __FreeBSD__ +#ifdef AK_OS_FREEBSD # include <sys/ucred.h> #endif @@ -655,10 +655,10 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const #ifdef AK_OS_MACOS pid_t pid; socklen_t pid_size = sizeof(pid); -#elif defined(__FreeBSD__) +#elif defined(AK_OS_FREEBSD) struct xucred creds = {}; socklen_t creds_size = sizeof(creds); -#elif defined(__OpenBSD__) +#elif defined(AK_OS_OPENBSD) struct sockpeercred creds = {}; socklen_t creds_size = sizeof(creds); #else @@ -669,7 +669,7 @@ ErrorOr<pid_t> LocalSocket::peer_pid() const #ifdef AK_OS_MACOS TRY(System::getsockopt(m_helper.fd(), SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size)); return pid; -#elif defined(__FreeBSD__) +#elif defined(AK_OS_FREEBSD) TRY(System::getsockopt(m_helper.fd(), SOL_LOCAL, LOCAL_PEERCRED, &creds, &creds_size)); return creds.cr_pid; #else diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 6359b34d5d..fc49a9bc22 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -31,7 +31,7 @@ # include <serenity.h> #endif -#if defined(__linux__) && !defined(MFD_CLOEXEC) +#if defined(AK_OS_LINUX) && !defined(MFD_CLOEXEC) # include <linux/memfd.h> # include <sys/syscall.h> @@ -41,7 +41,7 @@ static int memfd_create(char const* name, unsigned int flags) } #endif -#if defined(__APPLE__) +#if defined(AK_OS_MACOS) # include <sys/mman.h> #endif @@ -54,7 +54,7 @@ static int memfd_create(char const* name, unsigned int flags) namespace Core::System { #ifndef HOST_NAME_MAX -# ifdef __APPLE__ +# ifdef AK_OS_MACOS # define HOST_NAME_MAX 255 # else # define HOST_NAME_MAX 64 @@ -222,7 +222,7 @@ ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigac return {}; } -#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(AK_OS_MACOS) || defined(AK_OS_OPENBSD) || defined(AK_OS_FREEBSD) ErrorOr<sig_t> signal(int signal, sig_t handler) #else ErrorOr<sighandler_t> signal(int signal, sighandler_t handler) @@ -284,7 +284,7 @@ ErrorOr<int> anon_create([[maybe_unused]] size_t size, [[maybe_unused]] int opti int fd = -1; #if defined(AK_OS_SERENITY) fd = ::anon_create(round_up_to_power_of_two(size, PAGE_SIZE), options); -#elif defined(__linux__) || defined(__FreeBSD__) +#elif defined(AK_OS_LINUX) || defined(AK_OS_FREEBSD) // FIXME: Support more options on Linux. auto linux_options = ((options & O_CLOEXEC) > 0) ? MFD_CLOEXEC : 0; fd = memfd_create("", linux_options); @@ -295,7 +295,7 @@ ErrorOr<int> anon_create([[maybe_unused]] size_t size, [[maybe_unused]] int opti TRY(close(fd)); return Error::from_errno(saved_errno); } -#elif defined(__APPLE__) +#elif defined(AK_OS_MACOS) struct timespec time; clock_gettime(CLOCK_REALTIME, &time); auto name = String::formatted("/shm-{}{}", (unsigned long)time.tv_sec, (unsigned long)time.tv_nsec); @@ -1033,7 +1033,7 @@ ErrorOr<void> exec(StringView filename, Span<StringView> arguments, SearchInPath envp[environment->size()] = nullptr; if (search_in_path == SearchInPath::Yes && !filename.contains('/')) { -# if defined(__APPLE__) || defined(__FreeBSD__) +# if defined(AK_OS_MACOS) || defined(AK_OS_FREEBSD) // These BSDs don't support execvpe(), so we'll have to manually search the PATH. ScopedValueRollback errno_rollback(errno); diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 36badbf244..12edc46638 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -87,7 +87,7 @@ ErrorOr<int> accept4(int sockfd, struct sockaddr*, socklen_t*, int flags); #endif ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action); -#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(AK_OS_MACOS) || defined(AK_OS_OPENBSD) || defined(AK_OS_FREEBSD) ErrorOr<sig_t> signal(int signal, sig_t handler); #else ErrorOr<sighandler_t> signal(int signal, sighandler_t handler); |