1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:18:11 +00:00

UserspaceEmulator: Add the access syscall

This commit is contained in:
Andreas Kling 2020-08-05 19:48:44 +02:00
parent c497603177
commit e0e3e5b9b1
2 changed files with 9 additions and 0 deletions

View file

@ -250,6 +250,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
dbgprintf("Syscall: %s (%x)\n", Syscall::to_string((Syscall::Function)function), function);
#endif
switch (function) {
case SC_access:
return virt$access(arg1, arg2, arg3);
case SC_getcwd:
return virt$getcwd(arg1, arg2);
case SC_ttyname:
@ -1268,4 +1270,10 @@ int Emulator::virt$getcwd(FlatPtr buffer, size_t buffer_size)
return rc;
}
int Emulator::virt$access(FlatPtr path, size_t path_length, int type)
{
auto host_path = mmu().copy_buffer_from_vm(path, path_length);
return syscall(SC_access, host_path.data(), host_path.size(), type);
}
}