diff options
-rw-r--r-- | Base/usr/share/man/man1/Inspector.md | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibCore/EventLoop.cpp | 16 |
2 files changed, 12 insertions, 7 deletions
diff --git a/Base/usr/share/man/man1/Inspector.md b/Base/usr/share/man/man1/Inspector.md index d6e30dd8b0..092a2983be 100644 --- a/Base/usr/share/man/man1/Inspector.md +++ b/Base/usr/share/man/man1/Inspector.md @@ -18,7 +18,8 @@ $ Inspector [pid] Inspector facilitates process inspection via RPC. -The inspected process must have previously allowed the +To inspect a process, it must have `MAKE_INSPECTABLE=1` in its environment, +and it must have previously allowed the [`accept`(2)](help://man/2/accept) system call with [`pledge`(2)](help://man/2/pledge) to allow inspection via UNIX socket. diff --git a/Userland/Libraries/LibCore/EventLoop.cpp b/Userland/Libraries/LibCore/EventLoop.cpp index 0c79cce1d5..e9f8e98b4c 100644 --- a/Userland/Libraries/LibCore/EventLoop.cpp +++ b/Userland/Libraries/LibCore/EventLoop.cpp @@ -330,12 +330,16 @@ EventLoop::EventLoop([[maybe_unused]] MakeInspectable make_inspectable) s_event_loop_stack->append(*this); #ifdef __serenity__ - if (getuid() != 0 - && make_inspectable == MakeInspectable::Yes - // FIXME: Deadlock potential; though the main loop and inspector server connection are rarely used in conjunction - && !s_inspector_server_connection.with_locked([](auto inspector_server_connection) { return inspector_server_connection; })) { - if (!connect_to_inspector_server()) - dbgln("Core::EventLoop: Failed to connect to InspectorServer"); + if (getuid() != 0) { + if (getenv("MAKE_INSPECTABLE") == "1"sv) + make_inspectable = Core::EventLoop::MakeInspectable::Yes; + + if (make_inspectable == MakeInspectable::Yes + // FIXME: Deadlock potential; though the main loop and inspector server connection are rarely used in conjunction + && !s_inspector_server_connection.with_locked([](auto inspector_server_connection) { return inspector_server_connection; })) { + if (!connect_to_inspector_server()) + dbgln("Core::EventLoop: Failed to connect to InspectorServer"); + } } #endif } |