.\" 2014-11-10 Dave Hansen, document PR_MPX_{EN,DIS}ABLE_MANAGEMENT
.\"
.\"
-.TH PRCTL 2 2018-02-02 "Linux" "Linux Programmer's Manual"
+.TH PRCTL 2 2019-08-02 "Linux" "Linux Programmer's Manual"
.SH NAME
prctl \- operations on a process
.SH SYNOPSIS
and
.I arg5
must be specified as 0.
+.IP
+Higher-level interfaces layered on top of the above operations are
+provided in the
+.BR libcap (3)
+library in the form of
+.BR cap_get_ambient (3),
+.BR cap_set_ambient (3),
+and
+.BR cap_reset_ambient (3).
.TP
.BR PR_CAPBSET_READ " (since Linux 2.6.25)"
Return (as the function result) 1 if the capability specified in
.BR wait (2)
on the process to discover its termination status.
.IP
-The setting of this bit is not inherited by children created by
+The setting of the "child subreaper" attribute
+is not inherited by children created by
.BR fork (2)
and
.BR clone (2).
.TP
.BR PR_SET_KEEPCAPS " (since Linux 2.2.18)"
Set the state of the calling thread's "keep capabilities" flag.
-The effect if this flag is described in
+The effect of this flag is described in
.BR capabilities (7).
.I arg2
must be either 0 (clear the flag)
You can check whether the CPU supports MPX by looking for the 'mpx'
CPUID bit, like with the following command:
.IP
- cat /proc/cpuinfo | grep ' mpx '
+.in +4n
+.EX
+cat /proc/cpuinfo | grep ' mpx '
+.EE
+.in
.IP
A thread may not switch in or out of long (64-bit) mode while MPX is
enabled.
.BR PR_SET_NO_NEW_PRIVS " (since Linux 3.5)"
Set the calling thread's
.I no_new_privs
-bit to the value in
+attribute to the value in
.IR arg2 .
With
.I no_new_privs
call (for example,
rendering the set-user-ID and set-group-ID mode bits,
and file capabilities non-functional).
-Once set, this bit cannot be unset.
-The setting of this bit is inherited by children created by
+Once set, this the
+.I no_new_privs
+attribute cannot be unset.
+The setting of this attribute is inherited by children created by
.BR fork (2)
and
.BR clone (2),
Since Linux 4.10,
the value of a thread's
.I no_new_privs
-bit can be viewed via the
+attribute can be viewed via the
.I NoNewPrivs
field in the
.IR /proc/[pid]/status
.BR PR_GET_NO_NEW_PRIVS " (since Linux 3.5)"
Return (as the function result) the value of the
.I no_new_privs
-bit for the calling thread.
+attribute for the calling thread.
A value of 0 indicates the regular
.BR execve (2)
behavior.
will operate in the privilege-restricting mode described above.
.TP
.BR PR_SET_PDEATHSIG " (since Linux 2.1.57)"
-Set the parent death signal
+Set the parent-death signal
of the calling process to \fIarg2\fP (either a signal value
in the range 1..maxsig, or 0 to clear).
This is the signal that the calling process will get when its
parent dies.
-This value is cleared for the child of a
-.BR fork (2)
-and (since Linux 2.4.36 / 2.6.23)
-when executing a set-user-ID or set-group-ID binary,
-or a binary that has associated capabilities (see
-.BR capabilities (7)).
-This value is preserved across
-.BR execve (2).
.IP
.IR Warning :
.\" https://bugzilla.kernel.org/show_bug.cgi?id=43300
(via, for example,
.BR pthread_exit (3)),
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.
+If the parent thread and all ancestor subreapers have already terminated
+by the time of the
+.BR PR_SET_PDEATHSIG
+operation, then no parent-death signal is sent to the caller.
+.IP
+The parent-death signal is process-directed (see
+.BR signal (7))
+and, if the child installs a handler using the
+.BR sigaction (2)
+.B SA_SIGINFO
+flag, the
+.I si_pid
+field of the
+.I siginfo_t
+argument of the handler contains the PID of the terminating parent process.
+.IP
+The parent-death signal setting is cleared for the child of a
+.BR fork (2).
+It is also
+(since Linux 2.4.36 / 2.6.23)
+.\" commit d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f
+cleared when executing a set-user-ID or set-group-ID binary,
+or a binary that has associated capabilities (see
+.BR capabilities (7));
+otherwise, this value is preserved across
+.BR execve (2).
.TP
.BR PR_GET_PDEATHSIG " (since Linux 2.3.15)"
Return the current value of the parent process death signal,
Each thread has two associated timer slack values:
a "default" value, and a "current" value.
This operation sets the "current" timer slack value for the calling thread.
+.I arg2
+is an unsigned long value, then maximum "current" value is ULONG_MAX and
+the minimum "current" value is 1.
If the nanosecond value supplied in
.IR arg2
is greater than zero, then the "current" value is set to this value.
If
.I arg2
-is less than or equal to zero,
-.\" It seems that it's not possible to set the timer slack to zero;
-.\" The minimum value is 1? Seems a little strange.
+is equal to zero,
the "current" timer slack is reset to the
thread's "default" timer slack value.
.IP
.IR init
(PID 1), the ancestor of all processes,
are 50,000 nanoseconds (50 microseconds).
-The timer slack values are preserved across
+The timer slack value is inherited by a child created via
+.BR fork(2),
+and is preserved across
.BR execve (2).
.IP
Since Linux 4.6, the "current" timer slack value of any process
Return (as the function result)
the "current" timer slack value of the calling thread.
.TP
-.BR PR_SET_TIMING " (since Linux 2.6.0-test4)"
+.BR PR_SET_TIMING " (since Linux 2.6.0)"
+.\" Precisely: Linux 2.6.0-test4
Set whether to use (normal, traditional) statistical process timing or
accurate timestamp-based process timing, by passing
.B PR_TIMING_STATISTICAL
.\" and looking at the patch history, it appears
.\" that it never did anything.
.TP
-.BR PR_GET_TIMING " (since Linux 2.6.0-test4)"
+.BR PR_GET_TIMING " (since Linux 2.6.0)"
+.\" Precisely: Linux 2.6.0-test4
Return (as the function result) which process timing method is currently
in use.
.TP