summaryrefslogtreecommitdiff
path: root/src/kern
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/kern
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/kern')
-rw-r--r--src/kern/linux/linux.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/kern/linux/linux.hh b/src/kern/linux/linux.hh
index 5721e5a58..bc3da60e4 100644
--- a/src/kern/linux/linux.hh
+++ b/src/kern/linux/linux.hh
@@ -147,6 +147,32 @@ class Linux : public OperatingSystem
uint64_t iov_len;
};
+ //@{
+ /// ioctl() command codes.
+ static const unsigned TGT_TCGETS = 0x5401;
+ static const unsigned TGT_TCGETA = 0x5405;
+ static const unsigned TGT_TCSETAW = 0x5407;
+ static const unsigned TGT_FIONREAD = 0x541B;
+ //@}
+
+ /// Return true for the ioctl codes for which we return ENOTTY
+ /// *without* printing a warning, since we know that ENOTTY is the
+ /// correct thing to return (and not just a sign that we don't
+ /// recognize the ioctl code.
+ static bool
+ isTtyReq(unsigned req)
+ {
+ switch (req) {
+ case TGT_FIONREAD:
+ case TGT_TCSETAW:
+ case TGT_TCGETS:
+ case TGT_TCGETA:
+ return true;
+ default:
+ return false;
+ }
+ }
+
/// For getrusage().
struct rusage {