1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:24:57 +00:00

UserspaceEmulator: Fix bogus use of "errno" in shbuf related syscalls

When we're making direct syscalls, there's no "errno" involved.
Thanks to Sergey for spotting these.
This commit is contained in:
Andreas Kling 2020-07-15 23:43:38 +02:00
parent 092f643119
commit 1873b8f3e4

View file

@ -308,7 +308,7 @@ int Emulator::virt$shbuf_create(int size, FlatPtr buffer)
u8* host_data = nullptr;
int shbuf_id = syscall(SC_shbuf_create, size, &host_data);
if (shbuf_id < 0)
return -errno;
return shbuf_id;
FlatPtr address = allocate_vm(size, PAGE_SIZE);
auto region = SharedBufferRegion::create_with_shbuf_id(address, size, shbuf_id, host_data);
m_mmu.add_region(move(region));
@ -321,7 +321,7 @@ FlatPtr Emulator::virt$shbuf_get(int shbuf_id, FlatPtr size_ptr)
size_t host_size = 0;
void* host_data = (void*)syscall(SC_shbuf_get, shbuf_id, &host_size);
if (host_data == (void*)-1)
return -errno;
return (FlatPtr)host_data;
FlatPtr address = allocate_vm(host_size, PAGE_SIZE);
auto region = SharedBufferRegion::create_with_shbuf_id(address, host_size, shbuf_id, (u8*)host_data);
m_mmu.add_region(move(region));