UserspaceEmulator: Implement the ftruncate and umask syscalls

It's now possible to copy files with FileManager running in UE. :^)
This commit is contained in:
Andreas Kling 2021-01-11 12:01:42 +01:00
parent 723effd051
commit cf3d2411fa
Notes: sideshowbarker 2024-07-18 23:56:34 +09:00
2 changed files with 16 additions and 0 deletions

View file

@ -534,6 +534,10 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return virt$allocate_tls(arg1);
case SC_beep:
return virt$beep();
case SC_ftruncate:
return virt$ftruncate(arg1, arg2);
case SC_umask:
return virt$umask(arg1);
default:
reportln("\n=={}== \033[31;1mUnimplemented syscall: {}\033[0m, {:p}", getpid(), Syscall::to_string((Syscall::Function)function), function);
dump_backtrace();
@ -708,6 +712,16 @@ int Emulator::virt$get_stack_bounds(FlatPtr base, FlatPtr size)
return 0;
}
int Emulator::virt$ftruncate(int fd, off_t length)
{
return syscall(SC_ftruncate, fd, length);
}
mode_t Emulator::virt$umask(mode_t mask)
{
return syscall(SC_umask, mask);
}
int Emulator::virt$accept(int sockfd, FlatPtr address, FlatPtr address_length)
{
socklen_t host_address_length = 0;

View file

@ -173,6 +173,8 @@ private:
u32 virt$allocate_tls(size_t);
int virt$ptsname(int fd, FlatPtr buffer, size_t buffer_size);
int virt$beep();
int virt$ftruncate(int fd, off_t);
mode_t virt$umask(mode_t);
FlatPtr allocate_vm(size_t size, size_t alignment);
bool find_malloc_symbols(const MmapRegion& libc_text);