| 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 #include "nacl_io/mount_node_tty.h" | 5 #include "nacl_io/mount_node_tty.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/ioctl.h" | 17 #include "nacl_io/ioctl.h" |
| 18 #include "nacl_io/kernel_handle.h" | 18 #include "nacl_io/kernel_handle.h" |
| 19 #include "nacl_io/kernel_intercept.h" |
| 19 #include "nacl_io/mount.h" | 20 #include "nacl_io/mount.h" |
| 20 #include "nacl_io/pepper_interface.h" | 21 #include "nacl_io/pepper_interface.h" |
| 21 #include "sdk_util/auto_lock.h" | 22 #include "sdk_util/auto_lock.h" |
| 22 | 23 |
| 23 #define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS .c_lflag & FLAG) | 24 #define CHECK_LFLAG(TERMIOS, FLAG) (TERMIOS .c_lflag & FLAG) |
| 24 | 25 |
| 25 #define IS_ECHO CHECK_LFLAG(termios_, ECHO) | 26 #define IS_ECHO CHECK_LFLAG(termios_, ECHO) |
| 26 #define IS_ECHOE CHECK_LFLAG(termios_, ECHOE) | 27 #define IS_ECHOE CHECK_LFLAG(termios_, ECHOE) |
| 27 #define IS_ECHONL CHECK_LFLAG(termios_, ECHONL) | 28 #define IS_ECHONL CHECK_LFLAG(termios_, ECHONL) |
| 28 #define IS_ECHOCTL CHECK_LFLAG(termios_, ECHOCTL) | 29 #define IS_ECHOCTL CHECK_LFLAG(termios_, ECHOCTL) |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 256 } |
| 256 case TIOCSWINSZ: { | 257 case TIOCSWINSZ: { |
| 257 struct winsize* size = va_arg(args, struct winsize*); | 258 struct winsize* size = va_arg(args, struct winsize*); |
| 258 { | 259 { |
| 259 AUTO_LOCK(node_lock_); | 260 AUTO_LOCK(node_lock_); |
| 260 if (rows_ == size->ws_row && cols_ == size->ws_col) | 261 if (rows_ == size->ws_row && cols_ == size->ws_col) |
| 261 return 0; | 262 return 0; |
| 262 rows_ = size->ws_row; | 263 rows_ = size->ws_row; |
| 263 cols_ = size->ws_col; | 264 cols_ = size->ws_col; |
| 264 } | 265 } |
| 265 kill(getpid(), SIGWINCH); | 266 ki_kill(getpid(), SIGWINCH); |
| 266 { | 267 { |
| 267 // Wake up any thread waiting on Read with POLLERR then immediate | 268 // Wake up any thread waiting on Read with POLLERR then immediate |
| 268 // clear it to signal EINTR. | 269 // clear it to signal EINTR. |
| 269 AUTO_LOCK(emitter_->GetLock()) | 270 AUTO_LOCK(emitter_->GetLock()) |
| 270 emitter_->RaiseEvents_Locked(POLLERR); | 271 emitter_->RaiseEvents_Locked(POLLERR); |
| 271 emitter_->ClearEvents_Locked(POLLERR); | 272 emitter_->ClearEvents_Locked(POLLERR); |
| 272 } | 273 } |
| 273 return 0; | 274 return 0; |
| 274 } | 275 } |
| 275 case TIOCGWINSZ: { | 276 case TIOCGWINSZ: { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 290 } | 291 } |
| 291 | 292 |
| 292 Error MountNodeTty::Tcsetattr(int optional_actions, | 293 Error MountNodeTty::Tcsetattr(int optional_actions, |
| 293 const struct termios *termios_p) { | 294 const struct termios *termios_p) { |
| 294 AUTO_LOCK(node_lock_); | 295 AUTO_LOCK(node_lock_); |
| 295 termios_ = *termios_p; | 296 termios_ = *termios_p; |
| 296 return 0; | 297 return 0; |
| 297 } | 298 } |
| 298 | 299 |
| 299 } | 300 } |
| OLD | NEW |