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

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

Issue 107143005: Don't make timerfd non-blocking and add errno to error-mesage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | « no previous file | no next file » | 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 "platform/globals.h" 5 #include "platform/globals.h"
6 #if defined(TARGET_OS_LINUX) 6 #if defined(TARGET_OS_LINUX)
7 7
8 #include "bin/eventhandler.h" 8 #include "bin/eventhandler.h"
9 9
10 #include <errno.h> // NOLINT 10 #include <errno.h> // NOLINT
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 struct epoll_event event; 127 struct epoll_event event;
128 event.events = EPOLLIN; 128 event.events = EPOLLIN;
129 event.data.ptr = NULL; 129 event.data.ptr = NULL;
130 int status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_, 130 int status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_,
131 EPOLL_CTL_ADD, 131 EPOLL_CTL_ADD,
132 interrupt_fds_[0], 132 interrupt_fds_[0],
133 &event)); 133 &event));
134 if (status == -1) { 134 if (status == -1) {
135 FATAL("Failed adding interrupt fd to epoll instance"); 135 FATAL("Failed adding interrupt fd to epoll instance");
136 } 136 }
137 timer_fd_ = TEMP_FAILURE_RETRY(timerfd_create(CLOCK_REALTIME, 137 timer_fd_ = TEMP_FAILURE_RETRY(timerfd_create(CLOCK_REALTIME, TFD_CLOEXEC));
138 TFD_NONBLOCK | TFD_CLOEXEC));
139 if (epoll_fd_ == -1) { 138 if (epoll_fd_ == -1) {
140 FATAL("Failed creating timerfd file descriptor"); 139 FATAL("Failed creating timerfd file descriptor");
141 } 140 }
142 // Register the timer_fd_ with the epoll instance. 141 // Register the timer_fd_ with the epoll instance.
143 event.events = EPOLLIN; 142 event.events = EPOLLIN;
144 event.data.fd = timer_fd_; 143 event.data.fd = timer_fd_;
145 status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_, 144 status = TEMP_FAILURE_RETRY(epoll_ctl(epoll_fd_,
146 EPOLL_CTL_ADD, 145 EPOLL_CTL_ADD,
147 timer_fd_, 146 timer_fd_,
148 &event)); 147 &event));
149 if (status == -1) { 148 if (status == -1) {
150 FATAL("Failed adding timerfd fd to epoll instance"); 149 FATAL2(
150 "Failed adding timerfd fd(%i) to epoll instance: %i", timer_fd_, errno);
151 } 151 }
152 } 152 }
153 153
154 154
155 EventHandlerImplementation::~EventHandlerImplementation() { 155 EventHandlerImplementation::~EventHandlerImplementation() {
156 TEMP_FAILURE_RETRY(close(epoll_fd_)); 156 TEMP_FAILURE_RETRY(close(epoll_fd_));
157 TEMP_FAILURE_RETRY(close(timer_fd_)); 157 TEMP_FAILURE_RETRY(close(timer_fd_));
158 TEMP_FAILURE_RETRY(close(interrupt_fds_[0])); 158 TEMP_FAILURE_RETRY(close(interrupt_fds_[0]));
159 TEMP_FAILURE_RETRY(close(interrupt_fds_[1])); 159 TEMP_FAILURE_RETRY(close(interrupt_fds_[1]));
160 } 160 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 444 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
445 // The hashmap does not support keys with value 0. 445 // The hashmap does not support keys with value 0.
446 return dart::Utils::WordHash(fd + 1); 446 return dart::Utils::WordHash(fd + 1);
447 } 447 }
448 448
449 } // namespace bin 449 } // namespace bin
450 } // namespace dart 450 } // namespace dart
451 451
452 #endif // defined(TARGET_OS_LINUX) 452 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698