mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
Kernel: Merge the shbuf_get_size() syscall into shbuf_get()
Add an extra out-parameter to shbuf_get() that receives the size of the shared buffer. That way we don't need to make a separate syscall to get the size, which we always did immediately after.
This commit is contained in:
parent
a1514369d7
commit
dcd619bd46
6 changed files with 13 additions and 36 deletions
|
@ -67,16 +67,12 @@ bool SharedBuffer::share_globally()
|
|||
|
||||
RefPtr<SharedBuffer> SharedBuffer::create_from_shbuf_id(int shbuf_id)
|
||||
{
|
||||
void* data = shbuf_get(shbuf_id);
|
||||
size_t size = 0;
|
||||
void* data = shbuf_get(shbuf_id, &size);
|
||||
if (data == (void*)-1) {
|
||||
perror("shbuf_get");
|
||||
return nullptr;
|
||||
}
|
||||
int size = shbuf_get_size(shbuf_id);
|
||||
if (size < 0) {
|
||||
perror("shbuf_get_size");
|
||||
return nullptr;
|
||||
}
|
||||
return adopt(*new SharedBuffer(shbuf_id, size, data));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue