1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

SharedBuffer: Split the creation and share steps

This allows us to seal a buffer *before* anyone else has access to it
(well, ok, the creating process still does, but you can't win them all).

It also means that a SharedBuffer can be shared with multiple clients:
all you need is to have access to it to share it on again.
This commit is contained in:
Robin Burchell 2019-07-18 09:52:22 +02:00 committed by Andreas Kling
parent f60d7e5d1f
commit b907608e46
12 changed files with 58 additions and 22 deletions

View file

@ -423,9 +423,15 @@ int read_tsc(unsigned* lsw, unsigned* msw)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int create_shared_buffer(pid_t peer_pid, int size, void** buffer)
int create_shared_buffer(int size, void** buffer)
{
int rc = syscall(SC_create_shared_buffer, peer_pid, size, buffer);
int rc = syscall(SC_create_shared_buffer, size, buffer);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int share_buffer_with(int shared_buffer_id, pid_t peer_pid)
{
int rc = syscall(SC_share_buffer_with, shared_buffer_id, peer_pid);
__RETURN_WITH_ERRNO(rc, rc, -1);
}