power: let init manage the service directly
We don't need minijail to stick around just to waitpid() us when init
can do it for us. Pass -i to tell minijail to exit immediately.
BUG=None
TEST=restart powerd works, and minijail parent no longer exists
Change-Id: I88935018a501a224698f528938c7f2de7fced77f
Reviewed-on: https://chromium-review.googlesource.com/393086
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
diff --git a/power_manager/init/powerd.conf b/power_manager/init/powerd.conf
index 0268d5a..69fbb09 100644
--- a/power_manager/init/powerd.conf
+++ b/power_manager/init/powerd.conf
@@ -9,6 +9,7 @@
# Please do not change it without also changing that reference.
start on started boot-services
stop on stopping boot-services
+expect fork
respawn
respawn limit 3 10 # if the job respawns 3 times in 10 seconds, stop trying.
@@ -34,7 +35,7 @@
# at $PATH. Also, do not set capabilities here using minijail0's -c flag;
# doing so will prevent powerd_setuid_helper from running correctly when
# executed by powerd.
-exec minijail0 -u power -g power -G -- \
+exec minijail0 -u power -g power -G -i -- \
/usr/bin/powerd \
--prefs_dir=${PREFS_DIR} \
--default_prefs_dir=${DEFAULT_PREFS_DIR} \
diff --git a/power_manager/init/powerd.service b/power_manager/init/powerd.service
index 00bdb17..ee3adae 100644
--- a/power_manager/init/powerd.service
+++ b/power_manager/init/powerd.service
@@ -29,7 +29,8 @@
ExecStartPre=/bin/sh -u /usr/share/cros/init/powerd-pre-start.sh
-ExecStart=/sbin/minijail0 -u power -g power -G -- \
+ExecStart=/sbin/minijail0 -u power -g power -G -i \
+ -- \
/usr/bin/powerd \
--prefs_dir="${PREFS_DIR}" \
--default_prefs_dir="${DEFAULT_PREFS_DIR}" \