| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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_MOUNT_NODE_TTY_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_TTY_H_ |
| 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_TTY_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_TTY_H_ |
| 7 | 7 |
| 8 #include <poll.h> | 8 #include <poll.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const struct termios *termios_p); | 40 const struct termios *termios_p); |
| 41 | 41 |
| 42 virtual uint32_t GetEventStatus() { | 42 virtual uint32_t GetEventStatus() { |
| 43 uint32_t status = POLLOUT; | 43 uint32_t status = POLLOUT; |
| 44 if (is_readable_) | 44 if (is_readable_) |
| 45 status |= POLLIN; | 45 status |= POLLIN; |
| 46 return status; | 46 return status; |
| 47 } | 47 } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 virtual Error Write(size_t offs, | |
| 51 const void* buf, | |
| 52 size_t count, | |
| 53 int* out_bytes, | |
| 54 bool locked); | |
| 55 Error ProcessInput(struct tioc_nacl_input_string* message); | 50 Error ProcessInput(struct tioc_nacl_input_string* message); |
| 56 Error Echo(const char* string, int count); | 51 Error Echo(const char* string, int count); |
| 57 void InitTermios(); | 52 void InitTermios(); |
| 58 | 53 |
| 59 std::deque<char> input_buffer_; | 54 std::deque<char> input_buffer_; |
| 60 bool is_readable_; | 55 bool is_readable_; |
| 56 bool did_resize_; |
| 61 pthread_cond_t is_readable_cond_; | 57 pthread_cond_t is_readable_cond_; |
| 62 std::string prefix_; | |
| 63 struct termios termios_; | 58 struct termios termios_; |
| 59 |
| 60 /// Current height of terminal in rows. Set via ioctl(2). |
| 61 int rows_; |
| 62 /// Current width of terminal in columns. Set via ioctl(2). |
| 63 int cols_; |
| 64 |
| 65 // Output handler for TTY. This is set via ioctl(2). |
| 66 struct tioc_nacl_output output_handler_; |
| 67 // Lock to protect output_handler_. This lock gets aquired whenever |
| 68 // output_handler_ is used or set. |
| 69 sdk_util::SimpleLock output_lock_; |
| 64 }; | 70 }; |
| 65 | 71 |
| 66 } | 72 } |
| 67 | 73 |
| 68 #endif | 74 #endif |
| OLD | NEW |