summaryrefslogtreecommitdiffstats
path: root/init/init.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2017-08-25 10:36:52 -0700
committerTom Cherry <tomcherry@google.com>2017-08-25 11:01:52 -0700
commit702ca9ada2ac3c5d61bd7ae4e13a0e986a472fcb (patch)
tree44de14089904da4c986e1feb1952c6ebe949ddd4 /init/init.cpp
parent2732a7e0232d77efbf19d7053f5e5d5d39719910 (diff)
downloadsystem_core-702ca9ada2ac3c5d61bd7ae4e13a0e986a472fcb.tar.gz
system_core-702ca9ada2ac3c5d61bd7ae4e13a0e986a472fcb.tar.bz2
system_core-702ca9ada2ac3c5d61bd7ae4e13a0e986a472fcb.zip
init: log all failures of Service::Start()
The move to returning Result from Service::Start() for better context when starting process through init's builtins stops Service::Start() failures from being logged from other contexts. This change adds those logs along with their context. Test: boot bullhead, fail to start services via `setprop ctl.start`, see the expected error in dmesg Change-Id: I45294f6abf00852f3d4c549a32eaf4920a51e6f0
Diffstat (limited to 'init/init.cpp')
-rw-r--r--init/init.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/init/init.cpp b/init/init.cpp
index e1bd3a2cb..4a8459f1d 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -177,7 +177,9 @@ static std::optional<boot_clock::time_point> RestartProcesses() {
auto restart_time = s->time_started() + 5s;
if (boot_clock::now() > restart_time) {
- s->Start();
+ if (auto result = s->Start(); !result) {
+ LOG(ERROR) << "Could not restart process '" << s->name() << "': " << result.error();
+ }
} else {
if (!next_process_restart_time || restart_time < *next_process_restart_time) {
next_process_restart_time = restart_time;
@@ -195,7 +197,9 @@ void handle_control_message(const std::string& msg, const std::string& name) {
}
if (msg == "start") {
- svc->Start();
+ if (auto result = svc->Start(); !result) {
+ LOG(ERROR) << "Could not ctl.start service '" << name << "': " << result.error();
+ }
} else if (msg == "stop") {
svc->Stop();
} else if (msg == "restart") {