summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-21 21:20:36 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-21 21:54:30 +0200
commited351c74937caa7e916b28e58919347a3938ae28 (patch)
treec0e0590f6869b3059d2cf853618c00644c105531
parent6bc40b20b840e12aa523cd183b00d510b904c5f7 (diff)
downloadserenity-ed351c74937caa7e916b28e58919347a3938ae28.zip
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.
-rw-r--r--Libraries/LibIPC/ClientConnection.h2
-rw-r--r--Libraries/LibIPC/ServerConnection.h2
2 files changed, 4 insertions, 0 deletions
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; }