init: separate out epoll into a class
Test: init_tests
Bug: 64114943
Change-Id: I5f03314773b02b9e30e8e21895b6bdcfd4909e88
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 47e45ef..32cf0ee 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -56,6 +56,7 @@
#include <selinux/label.h>
#include <selinux/selinux.h>
+#include "epoll.h"
#include "init.h"
#include "persistent_properties.h"
#include "property_type.h"
@@ -808,7 +809,7 @@
selinux_android_restorecon(kPropertyInfosPath, 0);
}
-void start_property_service() {
+void StartPropertyService(Epoll* epoll) {
selinux_callback cb;
cb.func_audit = SelinuxAuditCallback;
selinux_set_callback(SELINUX_CB_AUDIT, cb);
@@ -823,7 +824,9 @@
listen(property_set_fd, 8);
- register_epoll_handler(property_set_fd, handle_property_set_fd);
+ if (auto result = epoll->RegisterHandler(property_set_fd, handle_property_set_fd); !result) {
+ PLOG(FATAL) << result.error();
+ }
}
} // namespace init