On Mon, 30 Jan 2017 09:38:38 -0800 Mitar <mmi...@gmail.com> wrote: > Hi! > > I would like to ask if runsvdir could by default be defined as a > subreaper on Linux. If it is already a PID 1, then there is no > difference, but sometimes it is not. In that case when an orphan > process happens under it, then it would be re-parented under the > runsvdir, mimicking the behavior when runsvdir runs as a PID 1. > > runit is often used in Docker containers and sometimes you have a > wrapper script which spawns runsvdir as a child. In that case runsvdir > does not run as PID 1.
Hi Mitar, As far as I know, runsvdir from the runit project is never PID1: It's called from an sv that's forked by PID1. On my computer, the program called runit is PID1, and its child is runsvdir. The runit program reaps zombies. You might want to do a ps axjf | less on your Docker to see what's really acting as PID1, and see if you can reap zombies there. Check out the PID1 code at the bottom of http://ewontfix.com/14/ . Note the following code: for (;;) wait(&status); The preceding reaps zombies. Perhaps you could start up runsvdir with that. But wait,there's more. The folks at Suckless Tools wrote a better version of the ewontfix.com code that also handles signals: http://core.suckless.org/sinit http://git.suckless.org/sinit/ If you have control over the Docker container, and if you're initting via runit, you almost certainly have a distinct PID1 that does little but reap zombies, listen for signals, and fork the sv system which of course spawns runsvdir. So if I understand your request, it should be doable via the existing PID1, or via a PID1 you substitute or add code to. SteveT Steve Litt January 2017 featured book: Troubleshooting: Just the Facts http://www.troubleshooters.com/tjust