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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/kernel_proxy.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/kernel_proxy.h" 5 #include "nacl_io/kernel_proxy.h"
6 6
7 7
8 #include <assert.h> 8 #include <assert.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 int ms_timeout; 784 int ms_timeout;
785 785
786 // NULL timeout signals wait forever. 786 // NULL timeout signals wait forever.
787 if (timeout == NULL) { 787 if (timeout == NULL) {
788 ms_timeout = -1; 788 ms_timeout = -1;
789 } else { 789 } else {
790 int64_t ms = timeout->tv_sec * 1000 + ((timeout->tv_usec + 500) / 1000); 790 int64_t ms = timeout->tv_sec * 1000 + ((timeout->tv_usec + 500) / 1000);
791 791
792 // If the timeout is invalid or too long (larger than signed 32 bit). 792 // If the timeout is invalid or too long (larger than signed 32 bit).
793 if ((timeout->tv_sec < 0) || (timeout->tv_sec >= (INT_MAX / 1000)) || 793 if ((timeout->tv_sec < 0) || (timeout->tv_sec >= (INT_MAX / 1000)) ||
794 (timeout->tv_usec < 0) || (timeout->tv_usec >= 1000) || 794 (timeout->tv_usec < 0) || (timeout->tv_usec >= 1000000) ||
795 (ms < 0) || (ms >= INT_MAX)) { 795 (ms < 0) || (ms >= INT_MAX)) {
796 errno = EINVAL; 796 errno = EINVAL;
797 return -1; 797 return -1;
798 } 798 }
799 799
800 ms_timeout = static_cast<int>(ms); 800 ms_timeout = static_cast<int>(ms);
801 } 801 }
802 802
803 events.resize(event_track); 803 events.resize(event_track);
804 listener->Wait(events.data(), event_track, ms_timeout, &ready_cnt); 804 listener->Wait(events.data(), event_track, ms_timeout, &ready_cnt);
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 errno = ENOTSOCK; 1246 errno = ENOTSOCK;
1247 return -1; 1247 return -1;
1248 } 1248 }
1249 1249
1250 return 0; 1250 return 0;
1251 } 1251 }
1252 1252
1253 #endif // PROVIDES_SOCKET_API 1253 #endif // PROVIDES_SOCKET_API
1254 1254
1255 } // namespace_nacl_io 1255 } // namespace_nacl_io
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/event_listener.cc ('k') | native_client_sdk/src/libraries/nacl_io/mount_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698