mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									23e802518d
								
							
						
					
					
						commit
						f93c0dc489
					
				
					 11 changed files with 27 additions and 20 deletions
				
			
		|  | @ -65,10 +65,9 @@ void PSClientConnection::did_progress_download(Badge<Download>, Download& downlo | |||
|     post_message(ProtocolClient::DownloadProgress(download.id(), download.total_size(), download.downloaded_size())); | ||||
| } | ||||
| 
 | ||||
| OwnPtr<ProtocolServer::GreetResponse> PSClientConnection::handle(const ProtocolServer::Greet& message) | ||||
| OwnPtr<ProtocolServer::GreetResponse> PSClientConnection::handle(const ProtocolServer::Greet&) | ||||
| { | ||||
|     set_client_pid(message.client_pid()); | ||||
|     return make<ProtocolServer::GreetResponse>(getpid(), client_id()); | ||||
|     return make<ProtocolServer::GreetResponse>(client_id()); | ||||
| } | ||||
| 
 | ||||
| OwnPtr<ProtocolServer::DisownSharedBufferResponse> PSClientConnection::handle(const ProtocolServer::DisownSharedBuffer& message) | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| endpoint ProtocolServer = 9 | ||||
| { | ||||
|     // Basic protocol | ||||
|     Greet(i32 client_pid) => (i32 server_pid, i32 client_id) | ||||
|     Greet() => (i32 client_id) | ||||
| 
 | ||||
|     // FIXME: It would be nice if the kernel provided a way to avoid this | ||||
|     DisownSharedBuffer(i32 shared_buffer_id) => () | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling