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

Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY

Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
This commit is contained in:
Andrew Kaster 2022-10-09 15:23:23 -06:00 committed by Linus Groh
parent 896d4e8dc1
commit 828441852f
46 changed files with 118 additions and 113 deletions

View file

@ -36,7 +36,7 @@
#include <time.h>
#include <unistd.h>
#ifdef __serenity__
#ifdef AK_OS_SERENITY
# include <LibCore/Account.h>
extern bool s_global_initializers_ran;
@ -160,7 +160,7 @@ private:
return allocator->allocate();
}))
{
#ifdef __serenity__
#ifdef AK_OS_SERENITY
m_socket->on_ready_to_read = [this] {
u32 length;
auto maybe_bytes_read = m_socket->read({ (u8*)&length, sizeof(length) });
@ -236,7 +236,7 @@ public:
JsonObject response;
response.set("type", type);
response.set("pid", getpid());
#ifdef __serenity__
#ifdef AK_OS_SERENITY
char buffer[1024];
if (get_process_name(buffer, sizeof(buffer)) >= 0) {
response.set("process_name", buffer);
@ -312,7 +312,7 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
: m_wake_pipe_fds(&s_wake_pipe_fds)
, m_private(make<Private>())
{
#ifdef __serenity__
#ifdef AK_OS_SERENITY
if (!s_global_initializers_ran) {
// NOTE: Trying to have an event loop as a global variable will lead to initialization-order fiascos,
// as the event loop constructor accesses and/or sets other global variables.
@ -334,7 +334,7 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable)
s_pid = getpid();
s_event_loop_stack->append(*this);
#ifdef __serenity__
#ifdef AK_OS_SERENITY
if (getuid() != 0) {
if (getenv("MAKE_INSPECTABLE") == "1"sv)
make_inspectable = Core::EventLoop::MakeInspectable::Yes;
@ -361,7 +361,7 @@ EventLoop::~EventLoop()
bool connect_to_inspector_server()
{
#ifdef __serenity__
#ifdef AK_OS_SERENITY
auto maybe_path = SessionManagement::parse_path_with_sid("/tmp/session/%sid/portal/inspectables"sv);
if (maybe_path.is_error()) {
dbgln("connect_to_inspector_server: {}", maybe_path.error());