diff options
author | Tom Cherry <tomcherry@google.com> | 2019-04-23 15:11:07 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2019-04-24 08:50:10 -0700 |
commit | fe8154175c411b0dba6bbc881cf9dfe501be74c5 (patch) | |
tree | 4deb71126bdc4cb6719dba116281b93c837a3e19 /init/sigchld_handler.cpp | |
parent | 1a043459a93192d52ef03ca730cfafccda1d227d (diff) |
init: simplify async restorecon
In the future, property service may run in its own thread or process,
which means that PropertyChildReap() needs to be refactored to not run
as part of the init signal handler.
The new method spawns a new thread that handles the queue of paths
that require restorecon. It then communicates back to property service
via android::base::SetProperty(). Property service distinguishes the
thread from other callers of SetProperty() by checking the pid in the
credentials for the socket connection, thus avoiding dependencies on
the rest of init.
The new method also drops the genericness, since restorecon is the
only function that we should ever need to run asynchronously
Test: async restorecon works, including with queued requests
Change-Id: I2ca00459969e77b1820776dac23d0a0d974e330b
Diffstat (limited to 'init/sigchld_handler.cpp')
-rw-r--r-- | init/sigchld_handler.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/init/sigchld_handler.cpp b/init/sigchld_handler.cpp index 0b0332429..987b2f98c 100644 --- a/init/sigchld_handler.cpp +++ b/init/sigchld_handler.cpp @@ -29,7 +29,6 @@ #include <android-base/stringprintf.h> #include "init.h" -#include "property_service.h" #include "service.h" using android::base::StringPrintf; @@ -61,9 +60,7 @@ static bool ReapOneProcess() { std::string wait_string; Service* service = nullptr; - if (PropertyChildReap(pid)) { - name = "Async property child"; - } else if (SubcontextChildReap(pid)) { + if (SubcontextChildReap(pid)) { name = "Subcontext"; } else { service = ServiceList::GetInstance().FindService(pid, &Service::pid); |