summaryrefslogtreecommitdiff
path: root/src/sim/process.hh
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/process.hh
parentdbdf2f14ae6b586efd31b73aa4548a38ecee263f (diff)
downloadgem5-31d829d388824c6795009afa55610ea5f5a22b0c.tar.xz
Implement current working directory for LiveProcesses
--HG-- extra : convert_revision : a2d3cf29ab65c61af27d82a8c421a41a19fd5aeb
Diffstat (limited to 'src/sim/process.hh')
-rw-r--r--src/sim/process.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sim/process.hh b/src/sim/process.hh
index 5c37f725e..616c02c00 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -177,11 +177,13 @@ class LiveProcess : public Process
ObjectFile *objFile;
std::vector<std::string> argv;
std::vector<std::string> envp;
+ std::string cwd;
LiveProcess(const std::string &nm, ObjectFile *objFile,
System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
std::vector<std::string> &argv,
std::vector<std::string> &envp,
+ const std::string &cwd,
uint64_t _uid, uint64_t _euid,
uint64_t _gid, uint64_t _egid,
uint64_t _pid, uint64_t _ppid);
@@ -207,6 +209,20 @@ class LiveProcess : public Process
inline uint64_t pid() {return __pid;}
inline uint64_t ppid() {return __ppid;}
+ std::string
+ fullPath(const std::string &filename)
+ {
+ if (filename[0] == '/' || cwd.empty())
+ return filename;
+
+ std::string full = cwd;
+
+ if (cwd[cwd.size() - 1] != '/')
+ full += '/';
+
+ return full + filename;
+ }
+
virtual void syscall(int64_t callnum, ThreadContext *tc);
virtual SyscallDesc* getDesc(int callnum) = 0;
@@ -220,6 +236,7 @@ class LiveProcess : public Process
std::string executable,
std::vector<std::string> &argv,
std::vector<std::string> &envp,
+ const std::string &cwd,
uint64_t _uid, uint64_t _euid,
uint64_t _gid, uint64_t _egid,
uint64_t _pid, uint64_t _ppid);