summaryrefslogtreecommitdiff
path: root/src/sim/syscall_emul.hh
diff options
context:
space:
mode:
authorMichael Adler <Michael.Adler@intel.com>2008-07-24 16:31:33 -0700
committerMichael Adler <Michael.Adler@intel.com>2008-07-24 16:31:33 -0700
commitf3a3ab7f2cfdae687a1dc07dff10c7fa4bde921c (patch)
treea8ad66be5ea82dfd69c31bb34629dce3ca506673 /src/sim/syscall_emul.hh
parent5f42bfcd56c84f6fe938b88411265359fc702110 (diff)
downloadgem5-f3a3ab7f2cfdae687a1dc07dff10c7fa4bde921c.tar.xz
syscall: Fix TTY emulation in fstat() user-mode simulation for fd 1 (stdout).
The code didn't set S_IFCHR in the st_mode
Diffstat (limited to 'src/sim/syscall_emul.hh')
-rw-r--r--src/sim/syscall_emul.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index 6dafee34c..caf269918 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -380,6 +380,11 @@ convertStatBuf(target_stat &tgt, host_stat *host, bool fakeTTY = false)
tgt->st_ino = host->st_ino;
tgt->st_ino = htog(tgt->st_ino);
tgt->st_mode = host->st_mode;
+ if (fakeTTY) {
+ // Claim to be a character device
+ tgt->st_mode &= ~S_IFMT; // Clear S_IFMT
+ tgt->st_mode |= S_IFCHR; // Set S_IFCHR
+ }
tgt->st_mode = htog(tgt->st_mode);
tgt->st_nlink = host->st_nlink;
tgt->st_nlink = htog(tgt->st_nlink);