]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" Copyright (c) 1992 Drew Eckhardt <drew@cs.colorado.edu>, March 28, 1992 | |
4 | .\" | |
5 | .\" Permission is granted to make and distribute verbatim copies of this | |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
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 | |
305a0578 | 29 | .\" Modified 2004-05-27 by Michael Kerrisk <mtk-manpages@gmx.net> |
fea681da | 30 | .\" |
8ba10b3e | 31 | .TH NICE 2 2005-09-20 "Linux 2.6.12" "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 ); | |
38 | .SH DESCRIPTION | |
2a019416 | 39 | .BR nice () |
fea681da MK |
40 | adds |
41 | .I inc | |
e360c3a9 | 42 | to the nice value for the calling process. |
fea681da MK |
43 | (A large nice value means a low priority.) |
44 | Only the super\%user may specify a negative increment, or priority increase. | |
7d5b6eb8 MK |
45 | The range for nice values is described in |
46 | .BR getpriority (2). | |
fea681da | 47 | .SH "RETURN VALUE" |
2a019416 MK |
48 | On success, the new nice value is returned (but see NOTES below). |
49 | On error, \-1 is returned, and | |
fea681da MK |
50 | .I errno |
51 | is set appropriately. | |
52 | .SH ERRORS | |
53 | .TP | |
54 | .B EPERM | |
55 | The calling process attempted to increase its priority by | |
56 | supplying a negative | |
57 | .IR inc | |
58 | but has insufficient privileges. | |
59 | Under Linux the | |
60 | .B CAP_SYS_NICE | |
61 | capability is required. | |
8ba10b3e MK |
62 | (But see the discussion of the |
63 | .B RLIMIT_NICE | |
64 | resource limit in | |
65 | .BR setrlimit (2).) | |
fea681da | 66 | .SH "CONFORMING TO" |
b14d4aa5 | 67 | SVr4, SVID EXT, AT&T, X/OPEN, 4.3BSD. However, the Linux and (g)libc |
fea681da | 68 | (earlier than glibc 2.2.4) return value is nonstandard, see below. |
2a019416 | 69 | SVr4 documents an additional EINVAL error code. |
fea681da | 70 | .SH NOTES |
2a019416 MK |
71 | SUSv2 and POSIX 1003.1-2003 specify that |
72 | .BR nice () | |
73 | should return the new nice value. | |
74 | However, the Linux syscall and the | |
75 | .BR nice () | |
42eda4ae | 76 | library function provided in older versions of (g)libc |
2a019416 | 77 | (earlier than glibc 2.2.4) return 0 on success. |
42eda4ae | 78 | The new nice value can be found using |
fea681da | 79 | .BR getpriority (2). |
2a019416 MK |
80 | |
81 | Since glibc 2.2.4, | |
82 | .BR nice () | |
83 | is implemented as a library function that calls | |
84 | .BR getpriority (2) | |
42eda4ae | 85 | to obtain the new nice value to be returned to the caller. |
2a019416 | 86 | With this implementation, |
84d60f79 | 87 | a successful call can legitimately return \-1. |
fea681da MK |
88 | To reliably detect an error, set |
89 | .I errno | |
90 | to 0 before the call, and check its value when | |
2a019416 | 91 | .BR nice () |
fea681da MK |
92 | returns \-1. |
93 | .SH "SEE ALSO" | |
94 | .BR nice (1), | |
95 | .BR fork (2), | |
96 | .BR getpriority (2), | |
97 | .BR setpriority (2), | |
98 | .BR capabilities (7), | |
99 | .BR renice (8) |