Index: runtime/bin/eventhandler_linux.cc |
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc |
index bd61e80801878420fc2d86cd18d1171515a97501..fd410fece963efeb0dbf82db849ec03da3ea1299 100644 |
--- a/runtime/bin/eventhandler_linux.cc |
+++ b/runtime/bin/eventhandler_linux.cc |
@@ -10,15 +10,15 @@ |
#include "bin/eventhandler.h" |
#include "bin/eventhandler_linux.h" |
-#include <errno.h> // NOLINT |
-#include <fcntl.h> // NOLINT |
-#include <pthread.h> // NOLINT |
-#include <stdio.h> // NOLINT |
-#include <string.h> // NOLINT |
-#include <sys/epoll.h> // NOLINT |
-#include <sys/stat.h> // NOLINT |
+#include <errno.h> // NOLINT |
+#include <fcntl.h> // NOLINT |
+#include <pthread.h> // NOLINT |
+#include <stdio.h> // NOLINT |
+#include <string.h> // NOLINT |
+#include <sys/epoll.h> // NOLINT |
+#include <sys/stat.h> // NOLINT |
#include <sys/timerfd.h> // NOLINT |
-#include <unistd.h> // NOLINT |
+#include <unistd.h> // NOLINT |
#include "bin/dartutils.h" |
#include "bin/fdutils.h" |
@@ -47,12 +47,8 @@ intptr_t DescriptorInfo::GetPollEvents() { |
// Unregister the file descriptor for a DescriptorInfo structure with |
// epoll. |
-static void RemoveFromEpollInstance(intptr_t epoll_fd_, |
- DescriptorInfo* di) { |
- VOID_NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
- EPOLL_CTL_DEL, |
- di->fd(), |
- NULL)); |
+static void RemoveFromEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { |
+ VOID_NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, di->fd(), NULL)); |
} |
@@ -63,10 +59,8 @@ static void AddToEpollInstance(intptr_t epoll_fd_, DescriptorInfo* di) { |
event.events |= EPOLLET; |
} |
event.data.ptr = di; |
- int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
- EPOLL_CTL_ADD, |
- di->fd(), |
- &event)); |
+ int status = |
+ NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, di->fd(), &event)); |
if (status == -1) { |
// TODO(dart:io): Verify that the dart end is handling this correctly. |
@@ -102,10 +96,8 @@ EventHandlerImplementation::EventHandlerImplementation() |
struct epoll_event event; |
event.events = EPOLLIN; |
event.data.ptr = NULL; |
- int status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
- EPOLL_CTL_ADD, |
- interrupt_fds_[0], |
- &event)); |
+ int status = NO_RETRY_EXPECTED( |
+ epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupt_fds_[0], &event)); |
if (status == -1) { |
FATAL("Failed adding interrupt fd to epoll instance"); |
} |
@@ -116,13 +108,11 @@ EventHandlerImplementation::EventHandlerImplementation() |
// Register the timer_fd_ with the epoll instance. |
event.events = EPOLLIN; |
event.data.fd = timer_fd_; |
- status = NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, |
- EPOLL_CTL_ADD, |
- timer_fd_, |
- &event)); |
+ status = |
+ NO_RETRY_EXPECTED(epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &event)); |
if (status == -1) { |
- FATAL2( |
- "Failed adding timerfd fd(%i) to epoll instance: %i", timer_fd_, errno); |
+ FATAL2("Failed adding timerfd fd(%i) to epoll instance: %i", timer_fd_, |
+ errno); |
} |
} |
@@ -144,7 +134,7 @@ EventHandlerImplementation::~EventHandlerImplementation() { |
void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, |
- DescriptorInfo *di) { |
+ DescriptorInfo* di) { |
intptr_t new_mask = di->Mask(); |
if ((old_mask != 0) && (new_mask == 0)) { |
RemoveFromEpollInstance(epoll_fd_, di); |
@@ -159,10 +149,11 @@ void EventHandlerImplementation::UpdateEpollInstance(intptr_t old_mask, |
DescriptorInfo* EventHandlerImplementation::GetDescriptorInfo( |
- intptr_t fd, bool is_listening) { |
+ intptr_t fd, |
+ bool is_listening) { |
ASSERT(fd >= 0); |
- HashMap::Entry* entry = socket_map_.Lookup( |
- GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd), true); |
+ HashMap::Entry* entry = socket_map_.Lookup(GetHashmapKeyFromFd(fd), |
+ GetHashmapHashFromFd(fd), true); |
ASSERT(entry != NULL); |
DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(entry->value); |
if (di == NULL) { |
@@ -224,8 +215,8 @@ void EventHandlerImplementation::HandleInterruptFd() { |
} else { |
ASSERT((msg[i].data & COMMAND_MASK) != 0); |
- DescriptorInfo* di = GetDescriptorInfo( |
- msg[i].id, IS_LISTENING_SOCKET(msg[i].data)); |
+ DescriptorInfo* di = |
+ GetDescriptorInfo(msg[i].id, IS_LISTENING_SOCKET(msg[i].data)); |
if (IS_COMMAND(msg[i].data, kShutdownReadCommand)) { |
ASSERT(!di->IsListeningSocket()); |
// Close the socket for reading. |
@@ -248,7 +239,7 @@ void EventHandlerImplementation::HandleInterruptFd() { |
// We only close the socket file descriptor from the operating |
// system if there are no other dart socket objects which |
// are listening on the same (address, port) combination. |
- ListeningSocketRegistry *registry = |
+ ListeningSocketRegistry* registry = |
ListeningSocketRegistry::Instance(); |
MutexLocker locker(registry->mutex()); |
@@ -262,8 +253,7 @@ void EventHandlerImplementation::HandleInterruptFd() { |
} |
} else { |
ASSERT(new_mask == 0); |
- socket_map_.Remove( |
- GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
+ socket_map_.Remove(GetHashmapKeyFromFd(fd), GetHashmapHashFromFd(fd)); |
di->Close(); |
delete di; |
} |
@@ -311,8 +301,8 @@ static void PrintEventMask(intptr_t fd, intptr_t events) { |
if ((events & EPOLLRDHUP) != 0) { |
Log::Print("EPOLLRDHUP "); |
} |
- int all_events = EPOLLIN | EPOLLPRI | EPOLLOUT | |
- EPOLLERR | EPOLLHUP | EPOLLRDHUP; |
+ int all_events = |
+ EPOLLIN | EPOLLPRI | EPOLLOUT | EPOLLERR | EPOLLHUP | EPOLLRDHUP; |
if ((events & ~all_events) != 0) { |
Log::Print("(and %08x) ", events & ~all_events); |
} |