1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

Services: Add InspectorServer to reverse the direction of Inspector

This service daemon will act as an intermediary between the Inspector
program and the inspectable programs it wants to inspect.

Programs can make themselves available for inspection by connecting
to /tmp/portal/inspectables using the Core::EventLoop RPC protocol.
This commit is contained in:
Andreas Kling 2021-05-13 22:34:57 +02:00
parent 3c3b384c80
commit 3d3a5b431f
11 changed files with 332 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibCore/LocalSocket.h>
namespace InspectorServer {
class InspectableProcess {
public:
InspectableProcess(pid_t, NonnullRefPtr<Core::LocalSocket>);
~InspectableProcess();
void send_request(JsonObject const& request);
String wait_for_response();
static InspectableProcess* from_pid(pid_t);
private:
pid_t m_pid { 0 };
NonnullRefPtr<Core::LocalSocket> m_socket;
};
extern HashMap<pid_t, NonnullOwnPtr<InspectorServer::InspectableProcess>> g_processes;
}