summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-05 19:48:44 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-05 22:34:50 +0200
commite0e3e5b9b10dc3cdea6d7b252a88992f024a57ce (patch)
tree4e86adfa8cf6ba313780ecf1b5bd5f46c61d5c81 /DevTools
parentc497603177383d29258b5ff93ba1d58479513b9c (diff)
downloadserenity-e0e3e5b9b10dc3cdea6d7b252a88992f024a57ce.zip
UserspaceEmulator: Add the access syscall
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/UserspaceEmulator/Emulator.cpp8
-rw-r--r--DevTools/UserspaceEmulator/Emulator.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp
index 0a55d3934c..0727bf69d3 100644
--- a/DevTools/UserspaceEmulator/Emulator.cpp
+++ b/DevTools/UserspaceEmulator/Emulator.cpp
@@ -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);
+}
+
}
diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h
index b6c6d7a108..d83e5270b2 100644
--- a/DevTools/UserspaceEmulator/Emulator.h
+++ b/DevTools/UserspaceEmulator/Emulator.h
@@ -77,6 +77,7 @@ private:
int virt$fork();
int virt$execve(FlatPtr);
+ int virt$access(FlatPtr, size_t, int);
int virt$sigaction(int, FlatPtr, FlatPtr);
int virt$sigreturn();
int virt$get_dir_entries(int fd, FlatPtr buffer, ssize_t);