summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-04-22 17:46:37 -0700
committerTom Cherry <tomcherry@google.com>2019-08-26 17:08:41 -0700
commit8efca4bbb378ff5bd3af06d8511ea75a7ed49f99 (patch)
tree6581b531b039c688547511960bb886a6306c3bad /init/builtins.cpp
parenta033693a9e5e39725be039140851756d88e7cc1b (diff)
Reland: "init: run property service in a thread"
It's been a long standing issue that init cannot respond to property set messages when it is running a builtin command. This is particularly problematic when the commands involve IPC to vold or other daemons, as it prevents them from being able to set properties. This change has init run property service in a thread, which eliminates the above issue. This change may also serve as a starting block to running property service in an entirely different process to better isolate init from handling property requests. Test: CF boots, walleye boots, properties are set appropriately Change-Id: I13b8bf240c9fcb1d2d5890a8be2f0ef74efd4adf
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index e17e8993c..3573e34cf 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -80,6 +80,7 @@
using namespace std::literals::string_literals;
using android::base::Basename;
+using android::base::StartsWith;
using android::base::unique_fd;
using android::fs_mgr::Fstab;
using android::fs_mgr::ReadFstabFromFile;
@@ -687,6 +688,15 @@ static Result<void> do_swapon_all(const BuiltinArguments& args) {
}
static Result<void> do_setprop(const BuiltinArguments& args) {
+ if (StartsWith(args[1], "ctl.")) {
+ return Error() << "InitPropertySet: Do not set ctl. properties from init; call the Service "
+ "functions directly";
+ }
+ if (args[1] == kRestoreconProperty) {
+ return Error() << "InitPropertySet: Do not set '" << kRestoreconProperty
+ << "' from init; use the restorecon builtin directly";
+ }
+
property_set(args[1], args[2]);
return {};
}