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.hh22
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)