1 .\" Copyright (c) 1992 Drew Eckhardt <drew@cs.colorado.edu>, March 28, 1992
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1996-11-04 by Eric S. Raymond <esr@thyrsus.com>
28 .\" Modified 2001-06-04 by aeb
29 .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
31 .TH NICE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
33 nice \- change process priority
36 .B #include <unistd.h>
38 .BI "int nice(int " inc );
42 Feature Test Macro Requirements for glibc (see
43 .BR feature_test_macros (7)):
49 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
50 || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
56 to the nice value for the calling thread.
57 (A higher nice value means a lower priority.)
59 The range of the nice value is +19 (low priority) to \-20 (high priority).
60 Attempts to set a nice value outside the range are clamped to the range.
62 Traditionally, only a privileged process could lower the nice value
63 (i.e., set a higher priority).
64 However, since Linux 2.6.12, an unprivileged process can decrease
65 the nice value of a target process that has a suitable
71 On success, the new nice value is returned (but see NOTES below).
72 On error, \-1 is returned, and
74 is set to indicate the error.
76 A successful call can legitimately return \-1.
77 To detect an error, set
79 to 0 before the call, and check whether it is nonzero after
85 The calling process attempted to increase its priority by
88 but has insufficient privileges.
91 capability is required.
92 (But see the discussion of the
97 POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
98 However, the raw system call and (g)libc
99 (earlier than glibc 2.2.4) return value is nonstandard, see below.
100 .\" SVr4 documents an additional
104 For further details on the nice value, see
108 the addition of the "autogroup" feature in Linux 2.6.38 means that
109 the nice value no longer has its traditional effect in many circumstances.
113 .SS C library/kernel differences
114 POSIX.1 specifies that
116 should return the new nice value.
117 However, the raw Linux system call returns 0 on success.
120 wrapper function provided in glibc 2.2.3 and earlier returns 0 on success.
122 Since glibc 2.2.4, the
124 wrapper function provided by glibc provides conformance to POSIX.1 by calling
126 to obtain the new nice value, which is then returned to the caller.
134 .BR capabilities (7),