Become the reaper for all children part of the user session. Tested
with several forking services.
}
}
+ if (arg_running_as == MANAGER_USER) {
+ /* Become reaper of our children */
+ r = prctl(PR_SET_CHILD_SUBREAPER, 1);
+ if (r < 0)
+ log_error("Failed to prctl(PR_SET_CHILD_SUBREAPER): %s", strerror(-r));
+ if (r == -EINVAL)
+ log_error("Perhaps the kernel version is too old (< 3.4?)");
+ }
+
r = manager_new(arg_running_as, &m);
if (r < 0) {
log_error("Failed to allocate manager object: %s", strerror(-r));
#ifndef PR_SET_NO_NEW_PRIVS
#define PR_SET_NO_NEW_PRIVS 38
#endif
+
+#ifndef PR_SET_CHILD_SUBREAPER
+#define PR_SET_CHILD_SUBREAPER 36
+#endif