From: Michael Kerrisk Date: Mon, 5 Dec 2016 08:18:40 +0000 (+0100) Subject: nice.2: Move discussion of handling the -1 success return to RETURN VALUE X-Git-Tag: man-pages-4.09~127 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=540038a17d4a16e6dff6b9566626d04e37a3e83a;p=thirdparty%2Fman-pages.git nice.2: Move discussion of handling the -1 success return to RETURN VALUE This detail was rather hidden in NOTES. Also, rework the text a little. Signed-off-by: Michael Kerrisk --- diff --git a/man2/nice.2 b/man2/nice.2 index 2b2fe3a4f9..913937a117 100644 --- a/man2/nice.2 +++ b/man2/nice.2 @@ -68,6 +68,13 @@ On success, the new nice value is returned (but see NOTES below). On error, \-1 is returned, and .I errno is set appropriately. + +A successful call can legitimately return \-1. +To detect an error, set +.I errno +to 0 before the call, and check whether it is nonzero after +.BR nice () +returns \-1. .SH ERRORS .TP .B EPERM @@ -113,13 +120,6 @@ Since glibc 2.2.4, the wrapper function provided by glibc provides conformance to POSIX.1 by calling .BR getpriority (2) 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 -.I errno -to 0 before the call, and check its value when -.BR nice () -returns \-1. .SH SEE ALSO .BR nice (1), .BR renice (1),