summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nick Kralevich <nnk@google.com> 2018-12-15 11:59:30 -0800
committer Nick Kralevich <nnk@google.com> 2018-12-15 11:59:30 -0800
commitfcf1b2bcce9fd9d1997745d35c6ac36ddd2448a9 (patch)
treea1696bdd02216ccc5c6d13ffbc544f3ae2609741
parent0dd82d8da5aa41dd41744fd35a1b94352796fb38 (diff)
use epoll_create1
epoll_create leaks file descriptors. Use epoll_create1(EPOLL_CLOEXEC) instead. Bug: 120983106 Test: compiles and boots Change-Id: I59cebb997de9d8b99804cc45a962751976d07ce6
-rw-r--r--libs/binder/tests/binderLibTest.cpp2
-rw-r--r--libs/vr/libbufferhubqueue/include/private/dvr/epoll_file_descriptor.h2
-rw-r--r--libs/vr/libvrflinger/epoll_event_dispatcher.cpp2
-rw-r--r--services/inputflinger/EventHub.cpp2
4 files changed, 4 insertions, 4 deletions
diff --git a/libs/binder/tests/binderLibTest.cpp b/libs/binder/tests/binderLibTest.cpp
index 73c2eba1d5..2dd86ba7e1 100644
--- a/libs/binder/tests/binderLibTest.cpp
+++ b/libs/binder/tests/binderLibTest.cpp
@@ -1295,7 +1295,7 @@ int run_server(int index, int readypipefd, bool usePoll)
}
IPCThreadState::self()->flushCommands(); // flush BC_ENTER_LOOPER
- epoll_fd = epoll_create1(0);
+ epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (epoll_fd == -1) {
return 1;
}
diff --git a/libs/vr/libbufferhubqueue/include/private/dvr/epoll_file_descriptor.h b/libs/vr/libbufferhubqueue/include/private/dvr/epoll_file_descriptor.h
index 6e303a5e5a..2f14f7cd91 100644
--- a/libs/vr/libbufferhubqueue/include/private/dvr/epoll_file_descriptor.h
+++ b/libs/vr/libbufferhubqueue/include/private/dvr/epoll_file_descriptor.h
@@ -28,7 +28,7 @@ class EpollFileDescriptor {
return -EALREADY;
}
- fd_.reset(epoll_create(64));
+ fd_.reset(epoll_create1(EPOLL_CLOEXEC));
if (fd_.get() < 0)
return -errno;
diff --git a/libs/vr/libvrflinger/epoll_event_dispatcher.cpp b/libs/vr/libvrflinger/epoll_event_dispatcher.cpp
index 962c7459fd..1cf5f17f62 100644
--- a/libs/vr/libvrflinger/epoll_event_dispatcher.cpp
+++ b/libs/vr/libvrflinger/epoll_event_dispatcher.cpp
@@ -11,7 +11,7 @@ namespace android {
namespace dvr {
EpollEventDispatcher::EpollEventDispatcher() {
- epoll_fd_.Reset(epoll_create(64));
+ epoll_fd_.Reset(epoll_create1(EPOLL_CLOEXEC));
if (!epoll_fd_) {
ALOGE("Failed to create epoll fd: %s", strerror(errno));
return;
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 4d9a2a0254..ccc24b950e 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -206,7 +206,7 @@ EventHub::EventHub(void) :
mPendingEventCount(0), mPendingEventIndex(0), mPendingINotify(false) {
acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID);
- mEpollFd = epoll_create(EPOLL_SIZE_HINT);
+ mEpollFd = epoll_create1(EPOLL_CLOEXEC);
LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno);
mINotifyFd = inotify_init();