activate: improve SIGCHLD handler
authorEvgeny Vereshchagin <evvers@ya.ru>
Tue, 5 Apr 2016 00:27:15 +0000 (00:27 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Tue, 5 Apr 2016 14:34:04 +0000 (14:34 +0000)
commit5488e52d285314c7535c87ee9aecadbc169db006
treef34e5caeb53640c058bc15f390bae9c5d219bdbd
parent0ffebd5abfa53945c83c03ba4442c61cc46a6f31
activate: improve SIGCHLD handler

* Don't lose children exit codes

* Don't receive notification when child processes stop
Eliminates annoying "Child died"-messages:
$ ./systemd-socket-activate -l 2000 --inetd -a cat
^Z
[1]+  Stopped                 ./systemd-socket-activate -l 2000 --inetd -a cat

$ bg %1
[1]+ ./systemd-socket-activate -l 2000 --inetd -a cat &
Child 15657 died with code 20

$ ps u 15657
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
ubuntu   15657  0.0  0.0   4540   680 pts/2    S    00:34   0:00 cat

* Don't fail to reap some zombie children
Fixes
$ ./systemd-socket-activate -l 2000 --inetd -a cat &
$ for i in {1..1000}; do echo a | nc localhost 2000 & done
$ ps f
...
18235 pts/2    Ss     0:01 -bash
15849 pts/2    S      0:00  \_ ./systemd-socket-activate -l 2000 --inetd
-a cat
16081 pts/2    Z      0:00  |   \_ [cat] <defunct>
16381 pts/2    Z      0:00  |   \_ [cat] <defunct>
and many more zombies
...
src/activate/activate.c