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 #include "nacl_io/devfs/tty_node.h" | 5 #include "nacl_io/devfs/tty_node.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <stdio.h> | 10 #include <stdio.h> |
11 #include <string.h> | 11 #include <string.h> |
12 #include <sys/ioctl.h> | 12 #include <sys/ioctl.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 | 14 |
15 #include <algorithm> | 15 #include <algorithm> |
16 | 16 |
17 #include "nacl_io/filesystem.h" | 17 #include "nacl_io/filesystem.h" |
18 #include "nacl_io/ioctl.h" | 18 #include "nacl_io/ioctl.h" |
19 #include "nacl_io/kernel_handle.h" | 19 #include "nacl_io/kernel_handle.h" |
20 #include "nacl_io/kernel_intercept.h" | 20 #include "nacl_io/kernel_intercept.h" |
21 #include "nacl_io/pepper_interface.h" | 21 #include "nacl_io/pepper_interface.h" |
22 #include "sdk_util/auto_lock.h" | 22 #include "sdk_util/auto_lock.h" |
23 | 23 |
24 #define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS.c_lflag & FLAG) | 24 #define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS.c_lflag& FLAG) |
25 | 25 |
26 #define IS_ECHO CHECK_LFLAG(termios_, ECHO) | 26 #define IS_ECHO CHECK_LFLAG(termios_, ECHO) |
27 #define IS_ECHOE CHECK_LFLAG(termios_, ECHOE) | 27 #define IS_ECHOE CHECK_LFLAG(termios_, ECHOE) |
28 #define IS_ECHONL CHECK_LFLAG(termios_, ECHONL) | 28 #define IS_ECHONL CHECK_LFLAG(termios_, ECHONL) |
29 #define IS_ECHOCTL CHECK_LFLAG(termios_, ECHOCTL) | 29 #define IS_ECHOCTL CHECK_LFLAG(termios_, ECHOCTL) |
30 #define IS_ICANON CHECK_LFLAG(termios_, ICANON) | 30 #define IS_ICANON CHECK_LFLAG(termios_, ICANON) |
31 | 31 |
32 #define DEFAULT_TTY_COLS 80 | 32 #define DEFAULT_TTY_COLS 80 |
33 #define DEFAULT_TTY_ROWS 30 | 33 #define DEFAULT_TTY_ROWS 30 |
34 | 34 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 termios_.c_cc[VSTOP] = 19; | 69 termios_.c_cc[VSTOP] = 19; |
70 termios_.c_cc[VSUSP] = 26; | 70 termios_.c_cc[VSUSP] = 26; |
71 termios_.c_cc[VEOL] = 0; | 71 termios_.c_cc[VEOL] = 0; |
72 termios_.c_cc[VREPRINT] = 18; | 72 termios_.c_cc[VREPRINT] = 18; |
73 termios_.c_cc[VDISCARD] = 15; | 73 termios_.c_cc[VDISCARD] = 15; |
74 termios_.c_cc[VWERASE] = 23; | 74 termios_.c_cc[VWERASE] = 23; |
75 termios_.c_cc[VLNEXT] = 22; | 75 termios_.c_cc[VLNEXT] = 22; |
76 termios_.c_cc[VEOL2] = 0; | 76 termios_.c_cc[VEOL2] = 0; |
77 } | 77 } |
78 | 78 |
79 EventEmitter* TtyNode::GetEventEmitter() { return emitter_.get(); } | 79 EventEmitter* TtyNode::GetEventEmitter() { |
| 80 return emitter_.get(); |
| 81 } |
80 | 82 |
81 Error TtyNode::Write(const HandleAttr& attr, | 83 Error TtyNode::Write(const HandleAttr& attr, |
82 const void* buf, | 84 const void* buf, |
83 size_t count, | 85 size_t count, |
84 int* out_bytes) { | 86 int* out_bytes) { |
85 AUTO_LOCK(output_lock_); | 87 AUTO_LOCK(output_lock_); |
86 *out_bytes = 0; | 88 *out_bytes = 0; |
87 | 89 |
88 // No handler registered. | 90 // No handler registered. |
89 if (output_handler_.handler == NULL) | 91 if (output_handler_.handler == NULL) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 292 } |
291 | 293 |
292 Error TtyNode::Tcsetattr(int optional_actions, | 294 Error TtyNode::Tcsetattr(int optional_actions, |
293 const struct termios* termios_p) { | 295 const struct termios* termios_p) { |
294 AUTO_LOCK(node_lock_); | 296 AUTO_LOCK(node_lock_); |
295 termios_ = *termios_p; | 297 termios_ = *termios_p; |
296 return 0; | 298 return 0; |
297 } | 299 } |
298 | 300 |
299 } // namespace nacl_io | 301 } // namespace nacl_io |
OLD | NEW |