Package: runit
Version: 2.1.2-3
Severity: wishlist
Tags: patch
Dear Maintainer,
When running a process who fork itself with runsv, like haproxy, it
detach from it's parent and is adopted by init (pid 1).
In some situations, when running in isolated environments like
docker / mesos-executor, or just to keep the process tree readable (ps
afx), it'll be better if runsv could adopt it's orphaned children.
Linux is providing since kernel 3.4 a subreaper feature, the following
patch enable this feature when available.
--- runsv.c.orig 2016-07-31 10:30:09.000000000 +0200
+++ runsv.c 2016-07-31 10:59:30.000000000 +0200
@@ -1,4 +1,9 @@
#include <sys/types.h>
+
+#if defined(__linux__)
+#include <sys/prctl.h>
+#endif
+
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
@@ -402,6 +407,10 @@
sig_block(sig_term);
sig_catch(sig_term, s_term);
+#ifdef PR_SET_CHILD_SUBREAPER
+ if(prctl(PR_SET_CHILD_SUBREAPER) == -1) fatal("Failed to register as
child subreaper");
+#endif
+
if (chdir(dir) == -1) fatal("unable to change to directory");
svd[0].pid =0;
svd[0].state =S_DOWN;
-- System Information:
Debian Release: 8.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.10.99-xenU-xfs-26-7336ef7-x86_64 (SMP w/3 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages runit depends on:
ii libc6 2.19-18+deb8u3
Versions of packages runit recommends:
ii fgetty 0.6-5
Versions of packages runit suggests:
ii socklog-run 2.1.0-8
-- no debconf information