LibIPC: Get client/server PIDs using getsockopt(SO_PEERCRED)

Instead of passing the PIDs back and forth in a handshake "Greet"
message, just use getsockopt(SO_PEERCRED) on both sides to get the same
information from the kernel.

This is a nice little simplification of the IPC protocol, although it
does not get rid of the handshake since we still have to pass the
"client ID" from the server to each client so they know how to refer
to themselves. This might not be necessary and we might be able to get
rid of this later on.
This commit is contained in:
Andreas Kling 2019-12-06 18:39:59 +01:00
parent 23e802518d
commit f93c0dc489
Notes: sideshowbarker 2024-07-19 10:57:18 +09:00
11 changed files with 27 additions and 20 deletions

View file

@ -12,8 +12,7 @@ Client::Client()
void Client::handshake()
{
auto response = send_sync<ProtocolServer::Greet>(getpid());
set_server_pid(response->server_pid());
auto response = send_sync<ProtocolServer::Greet>();
set_my_client_id(response->client_id());
}