diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sim/syscall_emul.cc | 16 | ||||
-rw-r--r-- | src/sim/syscall_emul.hh | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index bd66594af..9a797bcdb 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -405,6 +405,22 @@ ftruncateFunc(SyscallDesc *desc, int num, } SyscallReturn +ftruncate64Func(SyscallDesc *desc, int num, + LiveProcess *process, ThreadContext *tc) +{ + int fd = process->sim_fd(process->getSyscallArg(tc, 0)); + + if (fd < 0) + return -EBADF; + + // I'm not sure why, but the length argument is in arg reg 3 + loff_t length = process->getSyscallArg(tc, 3); + + int result = ftruncate64(fd, length); + return (result == -1) ? -errno : result; +} + +SyscallReturn umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) { // Letting the simulated program change the simulator's umask seems like diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 6937e35f0..f5e8a02e5 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -260,6 +260,11 @@ SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc); +/// Target ftruncate64() handler. +SyscallReturn ftruncate64Func(SyscallDesc *desc, int num, + LiveProcess *p, ThreadContext *tc); + + /// Target umask() handler. SyscallReturn umaskFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc); |