summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2009-01-17 18:56:46 -0500
committerAli Saidi <saidi@eecs.umich.edu>2009-01-17 18:56:46 -0500
commitb4227bd7f697a1f29d25639864f5683d9ddcd41f (patch)
tree1bc2bc16736eea0244a858f70dd30f236b4d3fa6 /src/sim/syscall_emul.hh
parent140b4b891ec60496d8aa805fd694d45647ba083c (diff)
downloadgem5-b4227bd7f697a1f29d25639864f5683d9ddcd41f.tar.xz
Fix issue 326: glibc non-deterministic because it reads /proc
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 57403ab27..c334c1e26 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -537,10 +537,18 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
DPRINTF(SyscallVerbose, "opening file %s\n", path.c_str());
- // open the file
- int fd = open(path.c_str(), hostFlags, mode);
+ int fd;
+ if (!path.compare(0, 6, "/proc/") || !path.compare(0, 8, "/system/") ||
+ !path.compare(0, 10, "/platform/") || !path.compare(0, 5, "/sys/")) {
+ // It's a proc/sys entery and requires special handling
+ fd = OS::openSpecialFile(path, process, tc);
+ return (fd == -1) ? -1 : process->alloc_fd(fd,path.c_str(),hostFlags,mode, false);
+ } else {
+ // open the file
+ fd = open(path.c_str(), hostFlags, mode);
+ return (fd == -1) ? -errno : process->alloc_fd(fd,path.c_str(),hostFlags,mode, false);
+ }
- return (fd == -1) ? -errno : process->alloc_fd(fd,path.c_str(),hostFlags,mode, false);
}