From ed351c74937caa7e916b28e58919347a3938ae28 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 21 Jun 2020 21:20:36 +0200 Subject: [PATCH] LibIPC: Add setters for overriding the client/server PID if needed Since SO_PEERCRED can only tell us who originally accepted the socket on the other side, we'll sometimes need to negotiate PID info manually. --- Libraries/LibIPC/ClientConnection.h | 2 ++ Libraries/LibIPC/ServerConnection.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Libraries/LibIPC/ClientConnection.h b/Libraries/LibIPC/ClientConnection.h index 516fb7c0e0..f3675c1ff4 100644 --- a/Libraries/LibIPC/ClientConnection.h +++ b/Libraries/LibIPC/ClientConnection.h @@ -198,7 +198,9 @@ public: } int client_id() const { return m_client_id; } + pid_t client_pid() const { return m_client_pid; } + void set_client_pid(pid_t pid) { m_client_pid = pid; } virtual void die() = 0; diff --git a/Libraries/LibIPC/ServerConnection.h b/Libraries/LibIPC/ServerConnection.h index 9f9b6da918..931c02f5ad 100644 --- a/Libraries/LibIPC/ServerConnection.h +++ b/Libraries/LibIPC/ServerConnection.h @@ -75,6 +75,8 @@ public: virtual void handshake() = 0; pid_t server_pid() const { return m_server_pid; } + void set_server_pid(pid_t pid) { m_server_pid = pid; } + void set_my_client_id(int id) { m_my_client_id = id; } int my_client_id() const { return m_my_client_id; }