From d55115936e0711422c6d708572b391e15432bec1 Mon Sep 17 00:00:00 2001 From: Marc Orr Date: Mon, 6 Aug 2012 16:52:40 -0700 Subject: 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. --- src/sim/syscall_emul.hh | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/sim') 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 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. -- cgit v1.2.3