diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-12-06 18:39:59 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-12-06 18:39:59 +0100 |
commit | f93c0dc4894546ec71fe9677f7eaab153708ba0c (patch) | |
tree | 45185708172d2d181c462bdc178b8103e93c5881 /Servers/AudioServer | |
parent | 23e802518d6508a9e4a38d727655e5a7e668306e (diff) | |
download | serenity-f93c0dc4894546ec71fe9677f7eaab153708ba0c.zip |
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.
Diffstat (limited to 'Servers/AudioServer')
-rw-r--r-- | Servers/AudioServer/ASClientConnection.cpp | 5 | ||||
-rw-r--r-- | Servers/AudioServer/AudioServer.ipc | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/Servers/AudioServer/ASClientConnection.cpp b/Servers/AudioServer/ASClientConnection.cpp index 5dd25f94fa..caf64d6479 100644 --- a/Servers/AudioServer/ASClientConnection.cpp +++ b/Servers/AudioServer/ASClientConnection.cpp @@ -48,10 +48,9 @@ void ASClientConnection::did_change_muted_state(Badge<ASMixer>, bool muted) post_message(AudioClient::MutedStateChanged(muted)); } -OwnPtr<AudioServer::GreetResponse> ASClientConnection::handle(const AudioServer::Greet& message) +OwnPtr<AudioServer::GreetResponse> ASClientConnection::handle(const AudioServer::Greet&) { - set_client_pid(message.client_pid()); - return make<AudioServer::GreetResponse>(getpid(), client_id()); + return make<AudioServer::GreetResponse>(client_id()); } OwnPtr<AudioServer::GetMainMixVolumeResponse> ASClientConnection::handle(const AudioServer::GetMainMixVolume&) diff --git a/Servers/AudioServer/AudioServer.ipc b/Servers/AudioServer/AudioServer.ipc index b48cbc6c06..b48dcd7e46 100644 --- a/Servers/AudioServer/AudioServer.ipc +++ b/Servers/AudioServer/AudioServer.ipc @@ -1,7 +1,7 @@ endpoint AudioServer = 85 { // Basic protocol - Greet(i32 client_pid) => (i32 server_pid, i32 client_id) + Greet() => (i32 client_id) // Mixer functions SetMuted(bool muted) => () |