UserspaceEmulator: Add support for chmod

This commit is contained in:
AnotherTest 2020-10-24 11:24:19 +03:30 committed by Andreas Kling
parent b1d36243e5
commit 41aa78f6de
Notes: sideshowbarker 2024-07-19 01:45:27 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -349,6 +349,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return virt$dbgputstr(arg1, arg2);
case SC_dbgputch:
return virt$dbgputch(arg1);
case SC_chmod:
return virt$chmod(arg1, arg2, arg3);
case SC_fchmod:
return virt$fchmod(arg1, arg2);
case SC_accept:
@ -492,6 +494,12 @@ int Emulator::virt$dbgputstr(FlatPtr characters, int length)
return 0;
}
int Emulator::virt$chmod(FlatPtr path_addr, size_t path_length, mode_t mode)
{
auto path = mmu().copy_buffer_from_vm(path_addr, path_length);
return syscall(SC_chmod, path.data(), path.size(), mode);
}
int Emulator::virt$fchmod(int fd, mode_t mode)
{
return syscall(SC_fchmod, fd, mode);