core: only watch processes when it's really necessary
authorFranck Bui <fbui@suse.com>
Tue, 19 Mar 2019 09:59:26 +0000 (10:59 +0100)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Mon, 21 Oct 2019 14:37:15 +0000 (16:37 +0200)
commit25b93538eba0275d35ef4b0792c2cd63d63d5e8d
tree693720a6b95b853fc88c91e9ec7c7bb91a9fb129
parent79e9566ec0a61d887ab63f17192dbd71aae36ee0
core: only watch processes when it's really necessary

If we know that main pid is our child then it's unnecessary to watch all
other processes of a unit since in this case we will get SIGCHLD when the main
process will exit and will act upon accordingly.

So let's watch all processes only if the main process is not our child since in
this case we need to detect when the cgroup will become empty in order to
figure out when the service becomes dead. This is only needed by cgroupv1.

Thanks Renaud Métrich for backporting this to RHEL.
Resolves: #1744972
src/core/service.c