summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorTimothy M. Jones <tjones1@inf.ed.ac.uk>2009-10-24 10:53:58 -0700
committerTimothy M. Jones <tjones1@inf.ed.ac.uk>2009-10-24 10:53:58 -0700
commitc32d919bc07d87e5fc59d98cb58e9143182c1aef (patch)
treec25ea1020ee460c75c2ff03693e81149c5ece57e /src/sim/syscall_emul.cc
parent7cdd5316abaf91755edd9186d3836ff371902146 (diff)
downloadgem5-c32d919bc07d87e5fc59d98cb58e9143182c1aef.tar.xz
syscall: Implementation of the ftruncate64 system call.
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc16
1 files changed, 16 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