From c32d919bc07d87e5fc59d98cb58e9143182c1aef Mon Sep 17 00:00:00 2001 From: "Timothy M. Jones" Date: Sat, 24 Oct 2009 10:53:58 -0700 Subject: syscall: Implementation of the ftruncate64 system call. --- src/sim/syscall_emul.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/sim/syscall_emul.cc') 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 @@ -404,6 +404,22 @@ ftruncateFunc(SyscallDesc *desc, int num, return (result == -1) ? -errno : result; } +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) { -- cgit v1.2.3