summaryrefslogtreecommitdiff
path: root/DevTools/UserspaceEmulator/Emulator.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-10-24 11:24:19 +0330
committerAndreas Kling <kling@serenityos.org>2020-10-25 10:13:03 +0100
commit41aa78f6dec4d788c213de142a6a037297b7c8a8 (patch)
treef5726212042d1208d5a875ac1ec597048911a1cf /DevTools/UserspaceEmulator/Emulator.cpp
parentb1d36243e5026f9e8dcff4f19b18181311a639b2 (diff)
downloadserenity-41aa78f6dec4d788c213de142a6a037297b7c8a8.zip
UserspaceEmulator: Add support for chmod
Diffstat (limited to 'DevTools/UserspaceEmulator/Emulator.cpp')
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp
index ce88544dae..e39b4a2480 100644
--- a/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/DevTools/UserspaceEmulator/Emulator.cpp
@@ -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);