Rewrote description of return value.

As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296183
This commit is contained in:
Michael Kerrisk 2005-06-16 15:07:57 +00:00
parent 4f90a5f34e
commit 2a01941630
1 changed files with 25 additions and 13 deletions

View File

@ -28,7 +28,7 @@
.\" Modified 2001-06-04 by aeb .\" Modified 2001-06-04 by aeb
.\" Modified 2004-05-27 by Michael Kerrisk <mtk-manpages@gmx.net> .\" Modified 2004-05-27 by Michael Kerrisk <mtk-manpages@gmx.net>
.\" .\"
.TH NICE 2 2004-05-27 "Linux 2.6.6" "Linux Programmer's Manual" .TH NICE 2 2005-06-16 "Linux 2.6.12" "Linux Programmer's Manual"
.SH NAME .SH NAME
nice \- change process priority nice \- change process priority
.SH SYNOPSIS .SH SYNOPSIS
@ -36,14 +36,15 @@ nice \- change process priority
.sp .sp
.BI "int nice(int " inc ); .BI "int nice(int " inc );
.SH DESCRIPTION .SH DESCRIPTION
.B nice .BR nice ()
adds adds
.I inc .I inc
to the nice value for the calling pid. to the nice value for the calling pid.
(A large nice value means a low priority.) (A large nice value means a low priority.)
Only the super\%user may specify a negative increment, or priority increase. Only the super\%user may specify a negative increment, or priority increase.
.SH "RETURN VALUE" .SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and On success, the new nice value is returned (but see NOTES below).
On error, \-1 is returned, and
.I errno .I errno
is set appropriately. is set appropriately.
.SH ERRORS .SH ERRORS
@ -59,21 +60,32 @@ capability is required.
.SH "CONFORMING TO" .SH "CONFORMING TO"
SVr4, SVID EXT, AT&T, X/OPEN, BSD 4.3. However, the Linux and glibc SVr4, SVID EXT, AT&T, X/OPEN, BSD 4.3. However, the Linux and glibc
(earlier than glibc 2.2.4) return value is nonstandard, see below. (earlier than glibc 2.2.4) return value is nonstandard, see below.
SVr4 documents an additional SVr4 documents an additional EINVAL error code.
EINVAL error code.
.SH NOTES .SH NOTES
Note that the routine is documented in SUSv2 and POSIX 1003.1-2003 SUSv2 and POSIX 1003.1-2003 specify that
to return the new nice value, while the Linux syscall and (g)libc .BR nice ()
(earlier than glibc 2.2.4) routines return 0 on success. should return the new nice value.
The new nice value can be found using However, the Linux syscall and the
.BR nice ()
library function provided in older versions of glibc
(earlier than glibc 2.2.4) return 0 on success.
In this case, the new nice value can be found using
.BR getpriority (2). .BR getpriority (2).
Note that an implementation in which
.B nice Since glibc 2.2.4,
returns the new nice value can legitimately return \-1. .BR nice ()
is implemented as a library function that calls
.BR getpriority (2)
to obtain the new nice value,
and this is returned to the caller as the function result of the
.BR nice ()
call.
With this implementation,
a successful call can can legitimately return \-1.
To reliably detect an error, set To reliably detect an error, set
.I errno .I errno
to 0 before the call, and check its value when to 0 before the call, and check its value when
.B nice .BR nice ()
returns \-1. returns \-1.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR nice (1), .BR nice (1),