From: Lennart Poettering Date: Mon, 2 Oct 2017 10:57:03 +0000 (+0200) Subject: service: add explanatory comments to control_pid_good() and cgroup_good() X-Git-Tag: v235~41^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07697d7ec501ccca25281b30c26b4b2dcbc357e7;p=thirdparty%2Fsystemd.git service: add explanatory comments to control_pid_good() and cgroup_good() Let's add a similar comment to each as we already have for main_pid_good(), emphasizing that these functions are supposed to be have very similar. --- diff --git a/src/core/service.c b/src/core/service.c index b6f929051e2..56e07de69e0 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -1425,6 +1425,10 @@ static int main_pid_good(Service *s) { _pure_ static int control_pid_good(Service *s) { assert(s); + /* Returns 0 if the control PID is dead, > 0 if it is good. We never actually return < 0 here, but in order to + * make this function as similar as possible to main_pid_good() and cgroup_good(), we pretend that < 0 also + * means: we can't figure it out. */ + return s->control_pid > 0; } @@ -1433,6 +1437,9 @@ static int cgroup_good(Service *s) { assert(s); + /* Returns 0 if the cgroup is empty or doesn't exist, > 0 if it is exists and is populated, < 0 if we can't + * figure it out */ + if (!UNIT(s)->cgroup_path) return 0;