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
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       nice(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
16

DESCRIPTION

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

RETURN VALUE

24       On success, the new nice value is returned (but see NOTES  below).   On
25       error, -1 is returned, and errno is set appropriately.
26

ERRORS

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

CONFORMING TO

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

NOTES

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

SEE ALSO

51       nice(1),   fork(2),  getpriority(2),  setpriority(2),  capabilities(7),
52       renice(1)
53

COLOPHON

55       This page is part of release 3.25 of the Linux  man-pages  project.   A
56       description  of  the project, and information about reporting bugs, can
57       be found at http://www.kernel.org/doc/man-pages/.
58
59
60
61Linux                             2007-07-26                           NICE(2)
Impressum