summaryrefslogtreecommitdiffhomepage
path: root/auto/isolation
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2022-11-30 00:13:22 +0000
committerAndrew Clayton <a.clayton@nginx.com>2022-11-30 00:13:22 +0000
commita83354f47331db1214cba4dd8899f2a002295b2f (patch)
tree0f5190d2bcf829b0e8b6332a6f4e1741b8c51cb6 /auto/isolation
parentb7f1d7253a8f44f31c2e1a8d9c8962ef30be83e9 (diff)
downloadunit-a83354f47331db1214cba4dd8899f2a002295b2f.tar.gz
unit-a83354f47331db1214cba4dd8899f2a002295b2f.tar.bz2
Enable the PR_SET_CHILD_SUBREAPER prctl(2) option on Linux.
This prctl(2) option can be used to set the "child subreaper" attribute of the calling process. This allows a process to take on the role of 'init', which means the process will inherit descendant processes when their immediate parent terminates. This will be used in an upcoming commit that uses a double fork(2) + unshare(2) to create a new PID namespace. The parent from the second fork will terminate leaving the child process to be inherited by 'init'. Aside from it being better to maintain the parent/child relationships between the various unit processes, without setting this you need to ^C twice to fully quit unit when running in the foreground after the double fork. Reviewed-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--auto/isolation13
1 files changed, 13 insertions, 0 deletions
diff --git a/auto/isolation b/auto/isolation
index 27f44624..c535e80a 100644
--- a/auto/isolation
+++ b/auto/isolation
@@ -102,6 +102,19 @@ nxt_feature_test="#include <sys/prctl.h>
. auto/feature
+nxt_feature="prctl(PR_SET_CHILD_SUBREAPER)"
+nxt_feature_name=NXT_HAVE_PR_SET_CHILD_SUBREAPER
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs=
+nxt_feature_test="#include <sys/prctl.h>
+
+ int main(void) {
+ return PR_SET_CHILD_SUBREAPER;
+ }"
+. auto/feature
+
+
nxt_feature="Linux mount()"
nxt_feature_name=NXT_HAVE_LINUX_MOUNT
nxt_feature_run=no