1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:27:35 +00:00

UserspaceEmulator: Add the chdir syscall

This commit is contained in:
Andreas Kling 2020-08-07 18:44:51 +02:00
parent ee5e8081da
commit 5dce5fa7c2
2 changed files with 9 additions and 0 deletions

View file

@ -251,6 +251,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_chdir:
return virt$chdir(arg1, arg2);
case SC_access:
return virt$access(arg1, arg2, arg3);
case SC_waitid:
@ -1338,4 +1340,10 @@ int Emulator::virt$waitid(FlatPtr params_addr)
return rc;
}
int Emulator::virt$chdir(FlatPtr path, size_t path_length)
{
auto host_path = mmu().copy_buffer_from_vm(path, path_length);
return syscall(SC_chdir, host_path.data(), host_path.size());
}
}