summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-11-16 12:43:11 -0800
committerNathan Binkert <binkertn@umich.edu>2006-11-16 12:43:11 -0800
commit31d829d388824c6795009afa55610ea5f5a22b0c (patch)
tree58ca15d687725129a376d0fd075d40252f4e5739 /src/sim/syscall_emul.cc
parentdbdf2f14ae6b586efd31b73aa4548a38ecee263f (diff)
downloadgem5-31d829d388824c6795009afa55610ea5f5a22b0c.tar.xz
Implement current working directory for LiveProcesses
--HG-- extra : convert_revision : a2d3cf29ab65c61af27d82a8c421a41a19fd5aeb
Diffstat (limited to 'src/sim/syscall_emul.cc')
-rw-r--r--src/sim/syscall_emul.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index 9028d590b..ab44c0a35 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -214,6 +214,9 @@ unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
if (!tc->getMemPort()->tryReadString(path, tc->getSyscallArg(0)))
return (TheISA::IntReg)-EFAULT;
+ // Adjust path for current working directory
+ path = p->fullPath(path);
+
int result = unlink(path.c_str());
return (result == -1) ? -errno : result;
}
@@ -231,6 +234,10 @@ renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
if (!tc->getMemPort()->tryReadString(new_name, tc->getSyscallArg(1)))
return -EFAULT;
+ // Adjust path for current working directory
+ old_name = p->fullPath(old_name);
+ new_name = p->fullPath(new_name);
+
int64_t result = rename(old_name.c_str(), new_name.c_str());
return (result == -1) ? -errno : result;
}
@@ -245,6 +252,9 @@ truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
off_t length = tc->getSyscallArg(1);
+ // Adjust path for current working directory
+ path = p->fullPath(path);
+
int result = truncate(path.c_str(), length);
return (result == -1) ? -errno : result;
}
@@ -277,6 +287,9 @@ chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
uint32_t group = tc->getSyscallArg(2);
gid_t hostGroup = group;
+ // Adjust path for current working directory
+ path = p->fullPath(path);
+
int result = chown(path.c_str(), hostOwner, hostGroup);
return (result == -1) ? -errno : result;
}