prctl.2: Correct some details for PR_SET_TIMERSLACK

In kernel/sys.c, arg2 is an unsigned long value and it will never
less than 0. Also, since kernel commit id da8b44d5a9f8 (Linux
4.6), timer_slack_ns and default timer_slack_ns have been
converted into u64, the return value of PR_GET_TIMERSLACK has been
limited under ULONG_MAX.

The timer slack value also can be inherited by a child created via
fork(2).

Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Yang Xu 2019-07-24 14:52:23 +08:00 committed by Michael Kerrisk
parent 2f368cc328
commit c14f79303f
1 changed files with 7 additions and 4 deletions

View File

@ -1239,14 +1239,15 @@ this operation expects a user-space buffer of 8 (not 4) bytes on these ABIs.
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
@ -1291,7 +1292,9 @@ The timer slack values of
.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