diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-05-26 17:48:39 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-05-30 15:31:14 +0200 |
| commit | d25280f1e81b08bd92ff327f6afa4c6fa915cfef (patch) | |
| tree | dd37075f5f0c4914037b2ae47eee7655a57ec413 | |
| parent | fe09bbd6f3d3dd679365c514c28f1bef203155e0 (diff) | |
| download | man-pages-d25280f1e81b08bd92ff327f6afa4c6fa915cfef.tar.gz | |
prctl.2, PR_SET_CHILD_SUBREAPER.2const: Split PR_SET_CHILD_SUBREAPER from prctl(2)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
| -rw-r--r-- | man/man2/prctl.2 | 58 | ||||
| -rw-r--r-- | man/man2const/PR_SET_CHILD_SUBREAPER.2const | 80 |
2 files changed, 87 insertions, 51 deletions
diff --git a/man/man2/prctl.2 b/man/man2/prctl.2 index 2583ec246e..2a6a43dad6 100644 --- a/man/man2/prctl.2 +++ b/man/man2/prctl.2 @@ -31,7 +31,7 @@ .\" 2012-10-25 Michael Kerrisk, Document PR_SET_TIMERSLACK and .\" PR_GET_TIMERSLACK .\" 2013-01-10 Kees Cook, document PR_SET_PTRACER -.\" 2012-02-04 Michael Kerrisk, document PR_{SET,GET}_CHILD_SUBREAPER +.\" 2012-02-04 Michael Kerrisk, document PR_GET_CHILD_SUBREAPER .\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT .\" .\" @@ -69,53 +69,8 @@ The first argument can be: .B PR_CAPBSET_READ .TQ .B PR_CAPBSET_DROP -.\" prctl PR_SET_CHILD_SUBREAPER -.TP -.BR PR_SET_CHILD_SUBREAPER " (since Linux 3.4)" -.\" commit ebec18a6d3aa1e7d84aab16225e87fd25170ec2b -If -.I arg2 -is nonzero, -set the "child subreaper" attribute of the calling process; -if -.I arg2 -is zero, unset the attribute. -.IP -A subreaper fulfills the role of -.BR init (1) -for its descendant processes. -When a process becomes orphaned -(i.e., its immediate parent terminates), -then that process will be reparented to -the nearest still living ancestor subreaper. -Subsequently, calls to -.BR getppid (2) -in the orphaned process will now return the PID of the subreaper process, -and when the orphan terminates, it is the subreaper process that -will receive a -.B SIGCHLD -signal and will be able to -.BR wait (2) -on the process to discover its termination status. -.IP -The setting of the "child subreaper" attribute -is not inherited by children created by -.BR fork (2) -and -.BR clone (2). -The setting is preserved across -.BR execve (2). -.IP -Establishing a subreaper process is useful in session management frameworks -where a hierarchical group of processes is managed by a subreaper process -that needs to be informed when one of the processes\[em]for example, -a double-forked daemon\[em]terminates -(perhaps so that it can restart that process). -Some -.BR init (1) -frameworks (e.g., -.BR systemd (1)) -employ a subreaper process for similar reasons. +.TQ +.B PR_SET_CHILD_SUBREAPER .\" prctl PR_GET_CHILD_SUBREAPER .TP .BR PR_GET_CHILD_SUBREAPER " (since Linux 3.4)" @@ -972,9 +927,9 @@ rather than after all of the threads in the parent process terminate. .IP The parent-death signal is sent upon subsequent termination of the parent thread and also upon termination of each subreaper process -(see the description of -.B PR_SET_CHILD_SUBREAPER -above) to which the caller is subsequently reparented. +(see +.BR PR_SET_CHILD_SUBREAPER (2const)) +to which the caller is subsequently reparented. If the parent thread and all ancestor subreapers have already terminated by the time of the .B PR_SET_PDEATHSIG @@ -2356,4 +2311,5 @@ glibc 2.0.6 .BR PR_CAP_AMBIENT (2const), .BR PR_CAPBSET_READ (2const), .BR PR_CAPBSET_DROP (2const), +.BR PR_SET_CHILD_SUBREAPER (2const), .BR core (5) diff --git a/man/man2const/PR_SET_CHILD_SUBREAPER.2const b/man/man2const/PR_SET_CHILD_SUBREAPER.2const new file mode 100644 index 0000000000..14386e2993 --- /dev/null +++ b/man/man2const/PR_SET_CHILD_SUBREAPER.2const @@ -0,0 +1,80 @@ +.\" Copyright 2012, 2013, 2015, Michael Kerrisk <mtk.manpages@gmail.com> +.\" +.\" SPDX-License-Identifier: Linux-man-pages-copyleft +.\" +.\" 2012-02-04 Michael Kerrisk, document PR_SET_CHILD_SUBREAPER +.\" +.TH PR_SET_CHILD_SUBREAPER 2const (date) "Linux man-pages (unreleased)" +.SH NAME +PR_SET_CHILD_SUBREAPER +\- +set/unset the "child subreaper" attribute of the calling process +.SH LIBRARY +Standard C library +.RI ( libc ", " \-lc ) +.SH SYNOPSIS +.nf +.B #include <sys/prctl.h> +.P +.BI "int prctl(int " op ", ..." +.BI " \fR/*\fP unsigned long " arg2 ", unsigned long " arg3 , +.BI " unsigned long " arg4 ", unsigned long " arg5 " \fR*/\fP );" +.fi +.SH DESCRIPTION +.TP +.BR PR_SET_CHILD_SUBREAPER " (since Linux 3.4)" +.\" commit ebec18a6d3aa1e7d84aab16225e87fd25170ec2b +If +.I arg2 +is nonzero, +set the "child subreaper" attribute of the calling process; +if +.I arg2 +is zero, unset the attribute. +.IP +A subreaper fulfills the role of +.BR init (1) +for its descendant processes. +When a process becomes orphaned +(i.e., its immediate parent terminates), +then that process will be reparented to +the nearest still living ancestor subreaper. +Subsequently, calls to +.BR getppid (2) +in the orphaned process will now return the PID of the subreaper process, +and when the orphan terminates, it is the subreaper process that +will receive a +.B SIGCHLD +signal and will be able to +.BR wait (2) +on the process to discover its termination status. +.IP +The setting of the "child subreaper" attribute +is not inherited by children created by +.BR fork (2) +and +.BR clone (2). +The setting is preserved across +.BR execve (2). +.IP +Establishing a subreaper process is useful in session management frameworks +where a hierarchical group of processes is managed by a subreaper process +that needs to be informed when one of the processes\[em]for example, +a double-forked daemon\[em]terminates +(perhaps so that it can restart that process). +Some +.BR init (1) +frameworks (e.g., +.BR systemd (1)) +employ a subreaper process for similar reasons. +.SH RETURN VALUE +On success, +values return 0 on success. +On error, \-1 is returned, and +.I errno +is set to indicate the error. +.SH STANDARDS +Linux. +.SH HISTORY +.SH SEE ALSO +.BR prctl (2) |
