diff options
author | Brendan Coles <bcoles@gmail.com> | 2020-12-16 22:53:00 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-17 00:02:03 +0100 |
commit | c8fb00fe4d99e16816871ed96f0fcfd758529e0f (patch) | |
tree | 27e540260c70fa051105e181db5317c0d4ec3bee /DevTools/UserspaceEmulator | |
parent | c4176b0da1000d1cba663fc5cb0f34efb1df394a (diff) | |
download | serenity-c8fb00fe4d99e16816871ed96f0fcfd758529e0f.zip |
UserspaceEmulator: Implement geteuid, getegid, ptsname syscalls
Diffstat (limited to 'DevTools/UserspaceEmulator')
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.cpp | 22 | ||||
-rw-r--r-- | DevTools/UserspaceEmulator/Emulator.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/Emulator.cpp b/DevTools/UserspaceEmulator/Emulator.cpp index f3c131ddaf..f60b265d3a 100644 --- a/DevTools/UserspaceEmulator/Emulator.cpp +++ b/DevTools/UserspaceEmulator/Emulator.cpp @@ -408,8 +408,12 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$unveil(arg1); case SC_getuid: return virt$getuid(); + case SC_geteuid: + return virt$geteuid(); case SC_getgid: return virt$getgid(); + case SC_getegid: + return virt$getegid(); case SC_setuid: return virt$setuid(arg1); case SC_setgid: @@ -505,6 +509,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3) return virt$clock_nanosleep(arg1); case SC_readlink: return virt$readlink(arg1); + case SC_ptsname: + return virt$ptsname(arg1, arg2, arg3); case SC_allocate_tls: return virt$allocate_tls(arg1); case SC_beep: @@ -1061,11 +1067,21 @@ uid_t Emulator::virt$getuid() return getuid(); } +uid_t Emulator::virt$geteuid() +{ + return geteuid(); +} + gid_t Emulator::virt$getgid() { return getgid(); } +gid_t Emulator::virt$getegid() +{ + return getegid(); +} + int Emulator::virt$setuid(uid_t uid) { return syscall(SC_setuid, uid); @@ -1690,6 +1706,12 @@ u32 Emulator::virt$allocate_tls(size_t size) return tls_base; } +int Emulator::virt$ptsname(int fd, FlatPtr buffer, size_t buffer_size) +{ + auto pts = mmu().copy_buffer_from_vm(buffer, buffer_size); + return syscall(SC_ptsname, fd, pts.data(), pts.size()); +} + int Emulator::virt$beep() { return syscall(SC_beep); diff --git a/DevTools/UserspaceEmulator/Emulator.h b/DevTools/UserspaceEmulator/Emulator.h index 9e9ddcba0f..67e8943817 100644 --- a/DevTools/UserspaceEmulator/Emulator.h +++ b/DevTools/UserspaceEmulator/Emulator.h @@ -105,7 +105,9 @@ private: u32 virt$unveil(u32); u32 virt$pledge(u32); uid_t virt$getuid(); + uid_t virt$geteuid(); gid_t virt$getgid(); + gid_t virt$getegid(); int virt$setuid(uid_t); int virt$setgid(gid_t); u32 virt$read(int, FlatPtr, ssize_t); @@ -163,6 +165,7 @@ private: int virt$watch_file(FlatPtr, size_t); int virt$readlink(FlatPtr); u32 virt$allocate_tls(size_t); + int virt$ptsname(int fd, FlatPtr buffer, size_t buffer_size); int virt$beep(); FlatPtr allocate_vm(size_t size, size_t alignment); |