[systemd-commits] src/core src/shared
Kay Sievers
kay at kemper.freedesktop.org
Tue Jul 24 15:18:14 PDT 2012
src/core/main.c | 9 +++++++++
src/shared/missing.h | 4 ++++
2 files changed, 13 insertions(+)
New commits:
commit d4447f4d955d5bfbdec6feec8e332b8c126f474a
Author: Auke Kok <auke-jan.h.kok at intel.com>
Date: Wed Jul 25 00:13:11 2012 +0200
main: set PR_SET_CHILD_REAPER for MANAGER_USER
Become the reaper for all children part of the user session. Tested
with several forking services.
diff --git a/src/core/main.c b/src/core/main.c
index c7a7a87..1326b94 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1500,6 +1500,15 @@ int main(int argc, char *argv[]) {
}
}
+ 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));
diff --git a/src/shared/missing.h b/src/shared/missing.h
index e600acc..df3fd0e 100644
--- a/src/shared/missing.h
+++ b/src/shared/missing.h
@@ -190,3 +190,7 @@ static inline pid_t gettid(void) {
#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
More information about the systemd-commits
mailing list