mirror of https://github.com/mkerrisk/man-pages
nice.2: Rework discussion of nice() return value and standards conformance
Make the text a little clearer. In particular, clarify that the raw system call (still) returns 0 on success. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
52694f0979
commit
32ff480294
26
man2/nice.2
26
man2/nice.2
|
@ -84,7 +84,7 @@ resource limit in
|
|||
.BR setrlimit (2).)
|
||||
.SH CONFORMING TO
|
||||
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
|
||||
However, the Linux and (g)libc
|
||||
However, the raw system call and (g)libc
|
||||
(earlier than glibc 2.2.4) return value is nonstandard, see below.
|
||||
SVr4 documents an additional
|
||||
.B EINVAL
|
||||
|
@ -98,23 +98,21 @@ the addition of the "autogroup" feature in Linux 2.6.38 means that
|
|||
the nice value no longer has its traditional effect in many circumstances.
|
||||
For details, see
|
||||
.BR sched (7).
|
||||
|
||||
SUSv2 and POSIX.1 specify that
|
||||
.BR nice ()
|
||||
should return the new nice value.
|
||||
However, the Linux system call and the
|
||||
.BR nice ()
|
||||
library function provided in older versions of (g)libc
|
||||
(earlier than glibc 2.2.4) return 0 on success.
|
||||
The new nice value can be found using
|
||||
.BR getpriority (2).
|
||||
.\"
|
||||
.SS C library/kernel differences
|
||||
Since glibc 2.2.4,
|
||||
POSIX.1 specifies that
|
||||
.BR nice ()
|
||||
is implemented as a library function that calls
|
||||
should return the new nice value.
|
||||
However, the raw Linux system call returns 0 on success.
|
||||
Likewise, the
|
||||
.BR nice ()
|
||||
wrapper function provided in glibc 2.2.3 and earlier returns 0 on success.
|
||||
|
||||
Since glibc 2.2.4, the
|
||||
.BR nice ()
|
||||
wrapper function provided by glibc provides conformance to POSIX.1 by calling
|
||||
.BR getpriority (2)
|
||||
to obtain the new nice value to be returned to the caller.
|
||||
to obtain the new nice value, which is then returned to the caller.
|
||||
With this implementation,
|
||||
a successful call can legitimately return \-1.
|
||||
To reliably detect an error, set
|
||||
|
|
Loading…
Reference in New Issue