changeset 2707e7b63f53 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=2707e7b63f53
description:
SysCalls: Implement truncate64 system call
This uses the new stack-based argument infrastructure.
Tested on x86 and x86_64.
diffstat:
2 files changed, 23 insertions(+)
src/sim/syscall_emul.cc | 19 +++++++++++++++++++
src/sim/syscall_emul.hh | 4 ++++
diffs (43 lines):
diff -r 21f032e2ee9b -r 2707e7b63f53 src/sim/syscall_emul.cc
--- a/src/sim/syscall_emul.cc Sat Oct 31 13:20:22 2009 -0700
+++ b/src/sim/syscall_emul.cc Fri Oct 30 12:31:55 2009 -0400
@@ -451,6 +451,25 @@
}
SyscallReturn
+truncate64Func(SyscallDesc *desc, int num,
+ LiveProcess *process, ThreadContext *tc)
+{
+ int index = 0;
+ string path;
+
+ if (!tc->getMemPort()->tryReadString(path, process->getSyscallArg(tc,
index)))
+ return -EFAULT;
+
+ loff_t length = process->getSyscallArg(tc, index, 64);
+
+ // Adjust path for current working directory
+ path = process->fullPath(path);
+
+ int result = truncate64(path.c_str(), length);
+ return (result == -1) ? -errno : result;
+}
+
+SyscallReturn
ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *process, ThreadContext *tc)
{
diff -r 21f032e2ee9b -r 2707e7b63f53 src/sim/syscall_emul.hh
--- a/src/sim/syscall_emul.hh Sat Oct 31 13:20:22 2009 -0700
+++ b/src/sim/syscall_emul.hh Fri Oct 30 12:31:55 2009 -0400
@@ -260,6 +260,10 @@
LiveProcess *p, ThreadContext *tc);
+/// Target truncate64() handler.
+SyscallReturn truncate64Func(SyscallDesc *desc, int num,
+ LiveProcess *p, ThreadContext *tc);
+
/// Target ftruncate64() handler.
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num,
LiveProcess *p, ThreadContext *tc);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev