Skip to content

Commit a83354f

Browse files
committed
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 <[email protected]> Signed-off-by: Andrew Clayton <[email protected]>
1 parent b7f1d72 commit a83354f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

auto/isolation

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,19 @@ nxt_feature_test="#include <sys/prctl.h>
102102
. auto/feature
103103

104104

105+
nxt_feature="prctl(PR_SET_CHILD_SUBREAPER)"
106+
nxt_feature_name=NXT_HAVE_PR_SET_CHILD_SUBREAPER
107+
nxt_feature_run=no
108+
nxt_feature_incs=
109+
nxt_feature_libs=
110+
nxt_feature_test="#include <sys/prctl.h>
111+
112+
int main(void) {
113+
return PR_SET_CHILD_SUBREAPER;
114+
}"
115+
. auto/feature
116+
117+
105118
nxt_feature="Linux mount()"
106119
nxt_feature_name=NXT_HAVE_LINUX_MOUNT
107120
nxt_feature_run=no

0 commit comments

Comments
 (0)