summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index a3d95b8ec..e2d13067c 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -604,6 +604,32 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
}
+/// Target stat64() handler.
+template <class OS>
+SyscallReturn
+stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process,
+ ThreadContext *tc)
+{
+ std::string path;
+
+ if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
+ return -EFAULT;
+
+ // Adjust path for current working directory
+ path = process->fullPath(path);
+
+ struct stat64 hostBuf;
+ int result = stat64(path.c_str(), &hostBuf);
+
+ if (result < 0)
+ return -errno;
+
+ copyOutStat64Buf<OS>(tc->getMemPort(), tc->getSyscallArg(1), &hostBuf);
+
+ return 0;
+}
+
+
/// Target fstat64() handler.
template <class OS>
SyscallReturn