Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_node_tty.cc

Issue 23075013: [NaCl SDK] Enable select/poll on TTY nodes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 222 }
223 } 223 }
224 224
225 if (!skip) 225 if (!skip)
226 input_buffer_.push_back(c); 226 input_buffer_.push_back(c);
227 227
228 if (c == '\n' || c == termios_.c_cc[VEOF] || !IS_ICANON) 228 if (c == '\n' || c == termios_.c_cc[VEOF] || !IS_ICANON)
229 is_readable_ = true; 229 is_readable_ = true;
230 } 230 }
231 231
232 if (is_readable_) 232 if (is_readable_) {
233 RaiseEvent(POLLIN);
233 pthread_cond_broadcast(&is_readable_cond_); 234 pthread_cond_broadcast(&is_readable_cond_);
235 }
234 return 0; 236 return 0;
235 } 237 }
236 238
237 Error MountNodeTty::Ioctl(int request, char* arg) { 239 Error MountNodeTty::Ioctl(int request, char* arg) {
238 if (request == TIOCNACLPREFIX) { 240 if (request == TIOCNACLPREFIX) {
239 // This ioctl is used to change the prefix for this tty node. 241 // This ioctl is used to change the prefix for this tty node.
240 // The prefix is used to distinguish messages intended for this 242 // The prefix is used to distinguish messages intended for this
241 // tty node from all the other messages cluttering up the 243 // tty node from all the other messages cluttering up the
242 // javascript postMessage() channel. 244 // javascript postMessage() channel.
243 AUTO_LOCK(node_lock_); 245 AUTO_LOCK(node_lock_);
(...skipping 18 matching lines...) Expand all
262 } 264 }
263 265
264 Error MountNodeTty::Tcsetattr(int optional_actions, 266 Error MountNodeTty::Tcsetattr(int optional_actions,
265 const struct termios *termios_p) { 267 const struct termios *termios_p) {
266 AUTO_LOCK(node_lock_); 268 AUTO_LOCK(node_lock_);
267 termios_ = *termios_p; 269 termios_ = *termios_p;
268 return 0; 270 return 0;
269 } 271 }
270 272
271 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698