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

Side by Side Diff: runtime/bin/eventhandler_linux.cc

Issue 9360040: Handle stdio redirection in standalone VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revert test change Created 8 years, 10 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
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/file.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/eventhandler.h" 5 #include "bin/eventhandler.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <pthread.h> 8 #include <pthread.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string.h> 10 #include <string.h>
11 #include <sys/epoll.h> 11 #include <sys/epoll.h>
12 #include <sys/stat.h>
12 #include <sys/time.h> 13 #include <sys/time.h>
13 #include <unistd.h> 14 #include <unistd.h>
14 15
15 #include "bin/dartutils.h" 16 #include "bin/dartutils.h"
16 #include "bin/fdutils.h" 17 #include "bin/fdutils.h"
17 #include "bin/hashmap.h" 18 #include "bin/hashmap.h"
18 #include "platform/utils.h" 19 #include "platform/utils.h"
19 20
20 21
21 int64_t GetCurrentTimeMilliseconds() { 22 int64_t GetCurrentTimeMilliseconds() {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 sd->fd(), 81 sd->fd(),
81 &event)); 82 &event));
82 } else { 83 } else {
83 status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_, 84 status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_,
84 EPOLL_CTL_ADD, 85 EPOLL_CTL_ADD,
85 sd->fd(), 86 sd->fd(),
86 &event)); 87 &event));
87 sd->set_tracked_by_epoll(true); 88 sd->set_tracked_by_epoll(true);
88 } 89 }
89 if (status == -1) { 90 if (status == -1) {
90 FATAL("Failed updating epoll instance"); 91 FATAL1("Failed updating epoll instance: %s", strerror(errno));
91 } 92 }
92 } 93 }
93 } 94 }
94 95
95 96
96 EventHandlerImplementation::EventHandlerImplementation() 97 EventHandlerImplementation::EventHandlerImplementation()
97 : socket_map_(&HashMap::SamePointerValue, 16) { 98 : socket_map_(&HashMap::SamePointerValue, 16) {
98 intptr_t result; 99 intptr_t result;
99 result = TEMP_FAILURE_RETRY(pipe(interrupt_fds_)); 100 result = TEMP_FAILURE_RETRY(pipe(interrupt_fds_));
100 if (result != 0) { 101 if (result != 0) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) { 403 void* EventHandlerImplementation::GetHashmapKeyFromFd(intptr_t fd) {
403 // The hashmap does not support keys with value 0. 404 // The hashmap does not support keys with value 0.
404 return reinterpret_cast<void*>(fd + 1); 405 return reinterpret_cast<void*>(fd + 1);
405 } 406 }
406 407
407 408
408 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 409 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
409 // The hashmap does not support keys with value 0. 410 // The hashmap does not support keys with value 0.
410 return dart::Utils::WordHash(fd + 1); 411 return dart::Utils::WordHash(fd + 1);
411 } 412 }
OLDNEW
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698