summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorMarc Orr <marc.orr@gmail.com>2012-08-06 16:52:40 -0700
committerMarc Orr <marc.orr@gmail.com>2012-08-06 16:52:40 -0700
commitd55115936e0711422c6d708572b391e15432bec1 (patch)
tree13c179e67d6aff1273a56edc8bcc20cddef6b380 /src/sim
parent62425b7a0724033bbd50170400ad2ff83ad57429 (diff)
downloadgem5-d55115936e0711422c6d708572b391e15432bec1.tar.xz
syscall emulation: Clean up ioctl handling, and implement for x86.
Enable different whitelists for different OS/arch combinations, since some use the generic Linux definitions only, and others use definitions inherited from earlier Unix flavors on those architectures. Also update x86 function pointers so ioctl is no longer unimplemented on that platform. This patch is a revised version of Vince Weaver's earlier patch.
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/syscall_emul.hh22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index c174fde57..0627d8d91 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -567,7 +567,8 @@ copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr,
/// Target ioctl() handler. For the most part, programs call ioctl()
/// only to find out if their stdout is a tty, to determine whether to
-/// do line or block buffering.
+/// do line or block buffering. We always claim that output fds are
+/// not TTYs to provide repeatable results.
template <class OS>
SyscallReturn
ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
@@ -584,22 +585,13 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process,
return -EBADF;
}
- switch (req) {
- case OS::TIOCISATTY_:
- case OS::TIOCGETP_:
- case OS::TIOCSETP_:
- case OS::TIOCSETN_:
- case OS::TIOCSETC_:
- case OS::TIOCGETC_:
- case OS::TIOCGETS_:
- case OS::TIOCGETA_:
- case OS::TCSETAW_:
+ if (OS::isTtyReq(req)) {
return -ENOTTY;
-
- default:
- fatal("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ \n",
- fd, req, tc->pcState());
}
+
+ warn("Unsupported ioctl call: ioctl(%d, 0x%x, ...) @ \n",
+ fd, req, tc->pcState());
+ return -ENOTTY;
}
/// Target open() handler.