changeset 0a78638881d7 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=0a78638881d7
description:
sim: Use NULL instead of None for testing filenames.
The filenames are initialized with NULL. So the test should be
checking for them to be == NULL instead == None.
diffstat:
src/sim/process.cc | 15 ++++++++-------
src/sim/process.hh | 2 +-
2 files changed, 9 insertions(+), 8 deletions(-)
diffs (72 lines):
diff -r 024af426b59a -r 0a78638881d7 src/sim/process.cc
--- a/src/sim/process.cc Mon Apr 13 17:33:57 2015 -0500
+++ b/src/sim/process.cc Mon Apr 13 17:33:57 2015 -0500
@@ -272,7 +272,8 @@
// generate new target fd for sim_fd
int
-Process::alloc_fd(int sim_fd, string filename, int flags, int mode, bool pipe)
+Process::alloc_fd(int sim_fd, const string& filename, int flags, int mode,
+ bool pipe)
{
// in case open() returns an error, don't allocate a new fd
if (sim_fd == -1)
@@ -384,7 +385,7 @@
if (in == "stdin" || in == "cin")
stdin_fd = STDIN_FILENO;
- else if (in == "None")
+ else if (in == "NULL")
stdin_fd = -1;
else {
// open standard in and seek to the right location
@@ -397,7 +398,7 @@
stdout_fd = STDOUT_FILENO;
else if (out == "stderr" || out == "cerr")
stdout_fd = STDERR_FILENO;
- else if (out == "None")
+ else if (out == "NULL")
stdout_fd = -1;
else {
stdout_fd = Process::openOutputFile(out);
@@ -409,7 +410,7 @@
stderr_fd = STDOUT_FILENO;
else if (err == "stderr" || err == "cerr")
stderr_fd = STDERR_FILENO;
- else if (err == "None")
+ else if (err == "NULL")
stderr_fd = -1;
else if (err == out)
stderr_fd = stdout_fd;
@@ -456,7 +457,7 @@
fdo->fd = fd;
//Seek to correct location before checkpoint
- if (lseek(fd,fdo->fileOffset, SEEK_SET) < 0)
+ if (lseek(fd, fdo->fileOffset, SEEK_SET) < 0)
panic("Unable to seek to correct location in file: %s",
fdo->filename);
}
@@ -472,8 +473,8 @@
if (fdo->fd != -1) {
fdo->fileOffset = lseek(fdo->fd, 0, SEEK_CUR);
} else {
- fdo->filename = "NULL";
- fdo->fileOffset = 0;
+ fdo->filename = "NULL";
+ fdo->fileOffset = 0;
}
}
}
diff -r 024af426b59a -r 0a78638881d7 src/sim/process.hh
--- a/src/sim/process.hh Mon Apr 13 17:33:57 2015 -0500
+++ b/src/sim/process.hh Mon Apr 13 17:33:57 2015 -0500
@@ -189,7 +189,7 @@
void dup_fd(int sim_fd, int tgt_fd);
// generate new target fd for sim_fd
- int alloc_fd(int sim_fd, std::string filename, int flags, int mode,
+ int alloc_fd(int sim_fd, const std::string& filename, int flags, int mode,
bool pipe);
// free target fd (e.g., after close)
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev