From 31d829d388824c6795009afa55610ea5f5a22b0c Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Thu, 16 Nov 2006 12:43:11 -0800 Subject: Implement current working directory for LiveProcesses --HG-- extra : convert_revision : a2d3cf29ab65c61af27d82a8c421a41a19fd5aeb --- src/sim/syscall_emul.hh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/sim/syscall_emul.hh') diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index e79712a19..07689ef06 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -500,6 +500,9 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process, hostFlags |= O_BINARY; #endif + // Adjust path for current working directory + path = process->fullPath(path); + DPRINTF(SyscallVerbose, "opening file %s\n", path.c_str()); // open the file @@ -526,6 +529,9 @@ chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process, // XXX translate mode flags via OS::something??? hostMode = mode; + // Adjust path for current working directory + path = process->fullPath(path); + // do the chmod int result = chmod(path.c_str(), hostMode); if (result < 0) @@ -573,6 +579,9 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process, if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) return -EFAULT; + // Adjust path for current working directory + path = process->fullPath(path); + struct stat hostBuf; int result = stat(path.c_str(), &hostBuf); @@ -626,6 +635,9 @@ lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) return -EFAULT; + // Adjust path for current working directory + path = process->fullPath(path); + struct stat hostBuf; int result = lstat(path.c_str(), &hostBuf); @@ -648,6 +660,9 @@ lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) return -EFAULT; + // Adjust path for current working directory + path = process->fullPath(path); + #if NO_STAT64 struct stat hostBuf; int result = lstat(path.c_str(), &hostBuf); @@ -701,6 +716,9 @@ statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process, if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0))) return -EFAULT; + // Adjust path for current working directory + path = process->fullPath(path); + struct statfs hostBuf; int result = statfs(path.c_str(), &hostBuf); @@ -896,6 +914,10 @@ utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, hostTimeval[i].tv_sec = gtoh((*tp)[i].tv_sec); hostTimeval[i].tv_usec = gtoh((*tp)[i].tv_usec); } + + // Adjust path for current working directory + path = process->fullPath(path); + int result = utimes(path.c_str(), hostTimeval); if (result < 0) -- cgit v1.2.3