| 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 <pthread.h> | 9 #include <pthread.h> |
| 9 | 10 |
| 10 #include <deque> | 11 #include <deque> |
| 11 | 12 |
| 12 #include "nacl_io/ioctl.h" | 13 #include "nacl_io/ioctl.h" |
| 13 #include "nacl_io/mount_node_char.h" | 14 #include "nacl_io/mount_node_char.h" |
| 14 #include "nacl_io/ostermios.h" | 15 #include "nacl_io/ostermios.h" |
| 15 | 16 |
| 16 | 17 |
| 17 namespace nacl_io { | 18 namespace nacl_io { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 31 | 32 |
| 32 virtual Error Write(size_t offs, | 33 virtual Error Write(size_t offs, |
| 33 const void* buf, | 34 const void* buf, |
| 34 size_t count, | 35 size_t count, |
| 35 int* out_bytes); | 36 int* out_bytes); |
| 36 | 37 |
| 37 virtual Error Tcgetattr(struct termios* termios_p); | 38 virtual Error Tcgetattr(struct termios* termios_p); |
| 38 virtual Error Tcsetattr(int optional_actions, | 39 virtual Error Tcsetattr(int optional_actions, |
| 39 const struct termios *termios_p); | 40 const struct termios *termios_p); |
| 40 | 41 |
| 42 virtual uint32_t GetEventStatus() { |
| 43 uint32_t status = POLLOUT; |
| 44 if (is_readable_) |
| 45 status |= POLLIN; |
| 46 return status; |
| 47 } |
| 48 |
| 41 private: | 49 private: |
| 42 virtual Error Write(size_t offs, | 50 virtual Error Write(size_t offs, |
| 43 const void* buf, | 51 const void* buf, |
| 44 size_t count, | 52 size_t count, |
| 45 int* out_bytes, | 53 int* out_bytes, |
| 46 bool locked); | 54 bool locked); |
| 47 Error ProcessInput(struct tioc_nacl_input_string* message); | 55 Error ProcessInput(struct tioc_nacl_input_string* message); |
| 48 Error Echo(const char* string, int count); | 56 Error Echo(const char* string, int count); |
| 49 void InitTermios(); | 57 void InitTermios(); |
| 50 | 58 |
| 51 std::deque<char> input_buffer_; | 59 std::deque<char> input_buffer_; |
| 52 bool is_readable_; | 60 bool is_readable_; |
| 53 pthread_cond_t is_readable_cond_; | 61 pthread_cond_t is_readable_cond_; |
| 54 std::string prefix_; | 62 std::string prefix_; |
| 55 struct termios termios_; | 63 struct termios termios_; |
| 56 }; | 64 }; |
| 57 | 65 |
| 58 } | 66 } |
| 59 | 67 |
| 60 #endif | 68 #endif |
| OLD | NEW |