1NICE(2)                    Linux Programmer's Manual                   NICE(2)
2
3
4

NAME

6       nice - change process priority
7

SYNOPSIS

9       #include <unistd.h>
10
11       int nice(int inc);
12

DESCRIPTION

14       nice()  adds  inc to the nice value for the calling process.  (A higher
15       nice value means a low priority.)  Only the  superuser  may  specify  a
16       negative increment, or priority increase.  The range for nice values is
17       described in getpriority(2).
18

RETURN VALUE

20       On success, the new nice value is returned (but see NOTES  below).   On
21       error, -1 is returned, and errno is set appropriately.
22

ERRORS

24       EPERM  The  calling  process attempted to increase its priority by sup‐
25              plying a negative inc but has  insufficient  privileges.   Under
26              Linux  the  CAP_SYS_NICE  capability  is required.  (But see the
27              discussion of the RLIMIT_NICE resource limit in setrlimit(2).)
28

CONFORMING TO

30       SVr4, 4.3BSD, POSIX.1-2001.  However, the Linux  and  (g)libc  (earlier
31       than  glibc  2.2.4) return value is nonstandard, see below.  SVr4 docu‐
32       ments an additional EINVAL error code.
33

NOTES

35       SUSv2 and POSIX.1-2001 specify that nice() should return the  new  nice
36       value.  However, the Linux syscall and the nice() library function pro‐
37       vided in older versions of (g)libc (earlier than glibc 2.2.4) return  0
38       on success.  The new nice value can be found using getpriority(2).
39
40       Since  glibc  2.2.4,  nice()  is implemented as a library function that
41       calls getpriority(2) to obtain the new nice value to be returned to the
42       caller.   With  this implementation, a successful call can legitimately
43       return -1.  To reliably detect an error, set  errno  to  0  before  the
44       call, and check its value when nice() returns -1.
45

SEE ALSO

47       nice(1),   fork(2),  getpriority(2),  setpriority(2),  capabilities(7),
48       renice(8)
49
50
51
52Linux 2.6.12                      2005-09-20                           NICE(2)
Impressum