summaryrefslogtreecommitdiff
path: root/sim/process.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-01-18 15:48:38 -0500
committerKevin Lim <ktlim@umich.edu>2005-01-18 15:48:38 -0500
commitc389c2e327cc3ee1c988855b05505660c6670172 (patch)
tree7861dcb3ed07f03850ee922db9c0c33b038265e4 /sim/process.cc
parent42f3b4ffb3fedcb70e9ff068ed7160dc6020b8c4 (diff)
parent25f54857c9356b7f8608be8d45fec17d6c26bce5 (diff)
downloadgem5-c389c2e327cc3ee1c988855b05505660c6670172.tar.xz
Merge zizzer.eecs.umich.edu:/bk/m5/
into zamp.eecs.umich.edu:/z/ktlim2/m5 --HG-- extra : convert_revision : c8b7f46e9d0dbff2a12a7375d361098fba352647
Diffstat (limited to 'sim/process.cc')
-rw-r--r--sim/process.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/sim/process.cc b/sim/process.cc
index bd1a2d8fd..c725d3b1c 100644
--- a/sim/process.cc
+++ b/sim/process.cc
@@ -397,19 +397,29 @@ END_INIT_SIM_OBJECT_PARAMS(LiveProcess)
CREATE_SIM_OBJECT(LiveProcess)
{
+ string in = input;
+ string out = output;
+
// initialize file descriptors to default: same as simulator
- int stdin_fd = input.isValid() ? Process::openInputFile(input) : 0;
- int stdout_fd = output.isValid() ? Process::openOutputFile(output) : 1;
- int stderr_fd = output.isValid() ? stdout_fd : 2;
+ int stdin_fd, stdout_fd, stderr_fd;
+
+ if (in == "stdin" || in == "cin")
+ stdin_fd = STDIN_FILENO;
+ else
+ stdin_fd = Process::openInputFile(input);
- // dummy for default env
- vector<string> null_vec;
+ if (out == "stdout" || out == "cout")
+ stdout_fd = STDOUT_FILENO;
+ else if (out == "stderr" || out == "cerr")
+ stdout_fd = STDERR_FILENO;
+ else
+ stdout_fd = Process::openOutputFile(out);
+
+ stderr_fd = (stdout_fd != STDOUT_FILENO) ? stdout_fd : STDERR_FILENO;
return LiveProcess::create(getInstanceName(),
stdin_fd, stdout_fd, stderr_fd,
- cmd,
- env.isValid() ? env : null_vec);
+ cmd, env);
}
-
REGISTER_SIM_OBJECT("LiveProcess", LiveProcess)