]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1992 Drew Eckhardt <drew@cs.colorado.edu>, March 28, 1992 |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
7 | .\" | |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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 | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da MK |
24 | .\" |
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 | |
c11b1abf | 29 | .\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da | 30 | .\" |
460495ca | 31 | .TH NICE 2 2015-08-08 "Linux" "Linux Programmer's Manual" |
fea681da MK |
32 | .SH NAME |
33 | nice \- change process priority | |
34 | .SH SYNOPSIS | |
35 | .B #include <unistd.h> | |
36 | .sp | |
37 | .BI "int nice(int " inc ); | |
cc4615cc MK |
38 | .sp |
39 | .in -4n | |
40 | Feature Test Macro Requirements for glibc (see | |
41 | .BR feature_test_macros (7)): | |
42 | .in | |
43 | .sp | |
4e3b3468 | 44 | .BR nice (): |
cc4615cc | 45 | _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE |
fea681da | 46 | .SH DESCRIPTION |
2a019416 | 47 | .BR nice () |
c13182ef | 48 | adds |
fea681da | 49 | .I inc |
e360c3a9 | 50 | to the nice value for the calling process. |
70cbdedf | 51 | (A higher nice value means a low priority.) |
c13182ef | 52 | Only the super\%user may specify a negative increment, |
70cbdedf | 53 | or priority increase. |
7d5b6eb8 MK |
54 | The range for nice values is described in |
55 | .BR getpriority (2). | |
47297adb | 56 | .SH RETURN VALUE |
2a019416 MK |
57 | On success, the new nice value is returned (but see NOTES below). |
58 | On error, \-1 is returned, and | |
fea681da MK |
59 | .I errno |
60 | is set appropriately. | |
61 | .SH ERRORS | |
62 | .TP | |
63 | .B EPERM | |
64 | The calling process attempted to increase its priority by | |
65 | supplying a negative | |
0daa9e92 | 66 | .I inc |
fea681da | 67 | but has insufficient privileges. |
eb9a0b2f | 68 | Under Linux, the |
fea681da MK |
69 | .B CAP_SYS_NICE |
70 | capability is required. | |
c13182ef | 71 | (But see the discussion of the |
8ba10b3e MK |
72 | .B RLIMIT_NICE |
73 | resource limit in | |
74 | .BR setrlimit (2).) | |
47297adb | 75 | .SH CONFORMING TO |
fa8def73 | 76 | POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. |
97c1eac8 | 77 | However, the Linux and (g)libc |
c8f2dd47 | 78 | (earlier than glibc 2.2.4) return value is nonstandard, see below. |
682edefb | 79 | SVr4 documents an additional |
0daa9e92 | 80 | .B EINVAL |
682edefb | 81 | error code. |
fea681da | 82 | .SH NOTES |
fa8def73 | 83 | SUSv2 and POSIX.1 specify that |
2a019416 MK |
84 | .BR nice () |
85 | should return the new nice value. | |
a99f81e6 | 86 | However, the Linux system call and the |
2a019416 | 87 | .BR nice () |
42eda4ae | 88 | library function provided in older versions of (g)libc |
2a019416 | 89 | (earlier than glibc 2.2.4) return 0 on success. |
42eda4ae | 90 | The new nice value can be found using |
fea681da | 91 | .BR getpriority (2). |
2a019416 MK |
92 | |
93 | Since glibc 2.2.4, | |
94 | .BR nice () | |
95 | is implemented as a library function that calls | |
96 | .BR getpriority (2) | |
42eda4ae | 97 | to obtain the new nice value to be returned to the caller. |
2a019416 | 98 | With this implementation, |
84d60f79 | 99 | a successful call can legitimately return \-1. |
fea681da MK |
100 | To reliably detect an error, set |
101 | .I errno | |
102 | to 0 before the call, and check its value when | |
2a019416 | 103 | .BR nice () |
fea681da | 104 | returns \-1. |
47297adb | 105 | .SH SEE ALSO |
fea681da | 106 | .BR nice (1), |
3e5c319e | 107 | .BR renice (1), |
fea681da MK |
108 | .BR fork (2), |
109 | .BR getpriority (2), | |
110 | .BR setpriority (2), | |
624a173b MK |
111 | .BR capabilities (7), |
112 | .BR sched (7) |