1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_TTY_H_
6 #define LIBRARIES_NACL_IO_MOUNT_NODE_TTY_H_
13 #include "nacl_io/ioctl.h"
14 #include "nacl_io/mount_node_char.h"
15 #include "nacl_io/ostermios.h"
20 class MountNodeTty : public MountNodeCharDevice {
22 explicit MountNodeTty(Mount* mount);
24 virtual EventEmitter* GetEventEmitter();
26 virtual Error VIoctl(int request, va_list args);
28 virtual Error Read(const HandleAttr& attr,
33 virtual Error Write(const HandleAttr& attr,
38 virtual Error Tcgetattr(struct termios* termios_p);
39 virtual Error Tcsetattr(int optional_actions,
40 const struct termios *termios_p);
43 ScopedEventEmitter emitter_;
45 Error ProcessInput(struct tioc_nacl_input_string* message);
46 Error Echo(const char* string, int count);
49 std::deque<char> input_buffer_;
50 struct termios termios_;
52 /// Current height of terminal in rows. Set via ioctl(2).
54 /// Current width of terminal in columns. Set via ioctl(2).
57 // Output handler for TTY. This is set via ioctl(2).
58 struct tioc_nacl_output output_handler_;
59 // Lock to protect output_handler_. This lock gets aquired whenever
60 // output_handler_ is used or set.
61 sdk_util::SimpleLock output_lock_;