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

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

Issue 12319067: Handle legacy epoll event on Linux. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add assert Created 7 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 | « no previous file | tests/standalone/standalone.status » ('j') | tests/standalone/standalone.status » ('J')
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 308
309 // On pipes EPOLLHUP is reported without EPOLLIN when there is no 309 // On pipes EPOLLHUP is reported without EPOLLIN when there is no
310 // more data to read. 310 // more data to read.
311 if (sd->IsPipe()) { 311 if (sd->IsPipe()) {
312 if (((events & EPOLLIN) == 0) && 312 if (((events & EPOLLIN) == 0) &&
313 ((events & EPOLLHUP) != 0)) { 313 ((events & EPOLLHUP) != 0)) {
314 event_mask = (1 << kCloseEvent); 314 event_mask = (1 << kCloseEvent);
315 sd->MarkClosedRead(); 315 sd->MarkClosedRead();
316 } 316 }
317 } else {
318 // Assert we never get a EPOLLHUP on a non-piping socket.
Mads Ager (google) 2013/02/22 09:39:00 non-pipe file descriptor
Søren Gjesse 2013/02/22 09:39:05 a -> an
Anders Johnsen 2013/06/11 12:14:54 Done.
Anders Johnsen 2013/06/11 12:14:54 Done.
319 ASSERT(events != EPOLLHUP);
317 } 320 }
318 321
319 if ((events & EPOLLOUT) != 0) { 322 if ((events & EPOLLOUT) != 0) {
320 if ((events & EPOLLERR) != 0) { 323 if ((events & EPOLLERR) != 0) {
321 event_mask = (1 << kErrorEvent); 324 event_mask = (1 << kErrorEvent);
322 sd->MarkClosedWrite(); 325 sd->MarkClosedWrite();
323 } else { 326 } else {
324 event_mask |= (1 << kOutEvent); 327 event_mask |= (1 << kOutEvent);
325 } 328 }
326 } 329 }
330
331 if (events == (EPOLLHUP | EPOLLERR)) {
332 event_mask = (1 << kErrorEvent);
333 sd->MarkClosedWrite();
334 sd->MarkClosedRead();
335 }
327 } 336 }
328 337
329 return event_mask; 338 return event_mask;
330 } 339 }
331 340
332 341
333 void EventHandlerImplementation::HandleEvents(struct epoll_event* events, 342 void EventHandlerImplementation::HandleEvents(struct epoll_event* events,
334 int size) { 343 int size) {
335 for (int i = 0; i < size; i++) { 344 for (int i = 0; i < size; i++) {
336 if (events[i].data.ptr != NULL) { 345 if (events[i].data.ptr != NULL) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 return reinterpret_cast<void*>(fd + 1); 434 return reinterpret_cast<void*>(fd + 1);
426 } 435 }
427 436
428 437
429 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) { 438 uint32_t EventHandlerImplementation::GetHashmapHashFromFd(intptr_t fd) {
430 // The hashmap does not support keys with value 0. 439 // The hashmap does not support keys with value 0.
431 return dart::Utils::WordHash(fd + 1); 440 return dart::Utils::WordHash(fd + 1);
432 } 441 }
433 442
434 #endif // defined(TARGET_OS_LINUX) 443 #endif // defined(TARGET_OS_LINUX)
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/standalone.status » ('j') | tests/standalone/standalone.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698