diff options
author | Nathan Binkert <binkertn@umich.edu> | 2006-11-16 12:43:11 -0800 |
---|---|---|
committer | Nathan Binkert <binkertn@umich.edu> | 2006-11-16 12:43:11 -0800 |
commit | 31d829d388824c6795009afa55610ea5f5a22b0c (patch) | |
tree | 58ca15d687725129a376d0fd075d40252f4e5739 /src/sim/syscall_emul.hh | |
parent | dbdf2f14ae6b586efd31b73aa4548a38ecee263f (diff) | |
download | gem5-31d829d388824c6795009afa55610ea5f5a22b0c.tar.xz |
Implement current working directory for LiveProcesses
--HG--
extra : convert_revision : a2d3cf29ab65c61af27d82a8c421a41a19fd5aeb
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r-- | src/sim/syscall_emul.hh | 22 |
1 files changed, 22 insertions, 0 deletions
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) |