]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
prctl.2, PR_SET_CHILD_SUBREAPER.2const: Split PR_SET_CHILD_SUBREAPER from prctl(2)
authorAlejandro Colomar <alx@kernel.org>
Sun, 26 May 2024 15:48:39 +0000 (17:48 +0200)
committerAlejandro Colomar <alx@kernel.org>
Thu, 30 May 2024 13:31:14 +0000 (15:31 +0200)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
man/man2/prctl.2
man/man2const/PR_SET_CHILD_SUBREAPER.2const [new file with mode: 0644]

index 2583ec246e6d5f0bcbcb88572e6068e3feb16208..2a6a43dad637d67946fae4e7c5a96a78f26e272b 100644 (file)
@@ -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 (file)
index 0000000..14386e2
--- /dev/null
@@ -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)