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.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/sim/syscall_emul.cc') 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; } -- cgit v1.2.3