]> git.ipfire.org Git - thirdparty/systemd.git/commit
shutdown: correctly wait for processes we killed in the killall spree
authorLennart Poettering <lennart@poettering.net>
Mon, 1 Apr 2013 20:48:40 +0000 (22:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 1 Apr 2013 23:28:01 +0000 (01:28 +0200)
commitaaf7eb81be912e7bed939f31e3bc4c631b2552b3
tree92f52fdb3635e99d1449d4e79c96872066668d38
parentceca950145f35f06938acba62af0c678f896e87d
shutdown: correctly wait for processes we killed in the killall spree

Previously we simply counted how many processes we killed and expected
as many waitpid() calls to succeed. That however is incorrect to do.

As we might kill processes that are not our immediate children, and as
there might be left-over processes in the waitpid() queue from earlier
the we might get more ore less waitpid() events that we expect.

Hence: keep precise track of the processes we kill, remove the ones we
get waitpid() for, and after each time we get SIGCHLD check if all
others still exist. We use getpgid() to check if a PID still exists.

This should fix issues with journald not setting journal files offline
correctly on shutdown, because we'd too quickly proceed from SIGTERM to
SIGKILL because some left-over process was in our waitpid() queue.
src/core/killall.c