| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 5 #ifndef LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| 6 #define LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 6 #define LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| 7 | 7 |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 virtual Error Write(const HandleAttr& attr, | 32 virtual Error Write(const HandleAttr& attr, |
| 33 const void* buf, | 33 const void* buf, |
| 34 size_t count, | 34 size_t count, |
| 35 int* out_bytes); | 35 int* out_bytes); |
| 36 | 36 |
| 37 virtual Error Tcgetattr(struct termios* termios_p); | 37 virtual Error Tcgetattr(struct termios* termios_p); |
| 38 virtual Error Tcsetattr(int optional_actions, | 38 virtual Error Tcsetattr(int optional_actions, |
| 39 const struct termios* termios_p); | 39 const struct termios* termios_p); |
| 40 | 40 |
| 41 virtual bool IsaTTY() { return true; } |
| 42 |
| 41 private: | 43 private: |
| 42 ScopedEventEmitter emitter_; | 44 ScopedEventEmitter emitter_; |
| 43 | 45 |
| 44 Error ProcessInput(struct tioc_nacl_input_string* message); | 46 Error ProcessInput(struct tioc_nacl_input_string* message); |
| 45 Error Echo(const char* string, int count); | 47 Error Echo(const char* string, int count); |
| 46 void InitTermios(); | 48 void InitTermios(); |
| 47 | 49 |
| 48 std::deque<char> input_buffer_; | 50 std::deque<char> input_buffer_; |
| 49 struct termios termios_; | 51 struct termios termios_; |
| 50 | 52 |
| 51 /// Current height of terminal in rows. Set via ioctl(2). | 53 /// Current height of terminal in rows. Set via ioctl(2). |
| 52 int rows_; | 54 int rows_; |
| 53 /// Current width of terminal in columns. Set via ioctl(2). | 55 /// Current width of terminal in columns. Set via ioctl(2). |
| 54 int cols_; | 56 int cols_; |
| 55 | 57 |
| 56 // Output handler for TTY. This is set via ioctl(2). | 58 // Output handler for TTY. This is set via ioctl(2). |
| 57 struct tioc_nacl_output output_handler_; | 59 struct tioc_nacl_output output_handler_; |
| 58 // Lock to protect output_handler_. This lock gets aquired whenever | 60 // Lock to protect output_handler_. This lock gets aquired whenever |
| 59 // output_handler_ is used or set. | 61 // output_handler_ is used or set. |
| 60 sdk_util::SimpleLock output_lock_; | 62 sdk_util::SimpleLock output_lock_; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 } // namespace nacl_io | 65 } // namespace nacl_io |
| 64 | 66 |
| 65 #endif // LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ | 67 #endif // LIBRARIES_NACL_IO_DEVFS_TTY_NODE_H_ |
| OLD | NEW |