.\" Copyright (c) 1980, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
+.\" %%%LICENSE_END
.\"
.\" @(#)getpriority.2 6.9 (Berkeley) 3/10/91
.\"
.\" FIXME Oct 2008: Denys Vlasenko is working on a PRIO_THREAD feature that
.\" is likely to get included in mainline; this will need to be documented.
.\"
-.TH GETPRIORITY 2 2008-05-29 "Linux" "Linux Programmer's Manual"
+.TH GETPRIORITY 2 2013-02-12 "Linux" "Linux Programmer's Manual"
.SH NAME
getpriority, setpriority \- get/set program scheduling priority
.SH SYNOPSIS
call sets the priorities of all of the specified processes
to the specified value.
Only the superuser may lower priorities.
-.SH "RETURN VALUE"
+.SH RETURN VALUE
Since
.BR getpriority ()
can legitimately return the value \-1, it is necessary
to clear the external variable
.I errno
prior to the
-call, then check it afterwards to determine
+call, then check it afterward to determine
if \-1 is an error or a legitimate value.
The
.BR setpriority ()
have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE
capability).
-Since Linux 2.6.12, this error only occurs if the caller attempts
+Since Linux 2.6.12, this error occurs only if the caller attempts
to set a process priority outside the range of the
.B RLIMIT_NICE
soft resource limit of the target process; see
.B CAP_SYS_NICE
capability).
But see NOTES below.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
SVr4, 4.4BSD (these function calls first appeared in 4.2BSD),
POSIX.1-2001.
.SH NOTES
.BR execve (2).
The degree to which their relative nice value affects the scheduling of
-processes varies across Unix systems, and,
+processes varies across UNIX systems, and,
on Linux, across kernel versions.
Starting with kernel 2.6.23, Linux adopted an algorithm that causes
relative differences in nice values to have a much stronger effect.
.LP
The actual priority range varies between kernel versions.
Linux before 1.3.36 had \-infinity..15.
-Since kernel 1.3.43 Linux has the range \-20..19.
+Since kernel 1.3.43, Linux has the range \-20..19.
Within the kernel, nice values are actually represented
using the corresponding range 40..1
(since negative numbers are error codes) and these are the values
.I struct timeval
defined in
.IR <sys/time.h> .)
-.SH "SEE ALSO"
+.SH BUGS
+According to POSIX, the nice value is a per-process setting.
+However, under the current Linux/NPTL implementation of POSIX threads,
+the nice value is a per-thread attribute:
+different threads in the same process can have different nice values.
+Portable applications should avoid relying on the Linux behavior,
+which may be made standards conformant in the future.
+.SH SEE ALSO
.BR nice (1),
+.BR renice (1),
.BR fork (2),
-.BR capabilities (7),
-.BR renice (8)
-.sp
+.BR capabilities (7)
+
.I Documentation/scheduler/sched-nice-design.txt
-in the kernel source tree (since Linux 2.6.23).
+in the Linux kernel source tree (since Linux 2.6.23)