NAME
nice — change nice
value of a process
SYNOPSIS
#include <unistd.h> int nice(int incr);
DESCRIPTION
The nice() function adds the value of incr to the nice value of the calling process. A process' nice value is a non-negative number for which a more positive value results in less favourable scheduling.
A maximum nice value of 2 * {NZERO} -1 and a minimum nice value of 0 are imposed by the system. Requests for values above or below these limits result in the nice value being set to the corresponding limit. Only a process with appropriate privileges can lower the nice value.
Calling the nice() function has no effect on the priority of processes or threads with policy SCHED_FIFO or SCHED_RR. The effect on processes or threads with other scheduling policies is implementation-dependent.
The nice value set with nice() is applied to the process. If the process is multi-threaded, the nice value affects all system scope threads in the process.
RETURN VALUE
Upon successful completion, nice() returns the new nice value minus {NZERO}. Otherwise, -1 is returned, the process' nice value is not changed, and errno is set to indicate the error.
ERRORS
The nice() function will fail if:
- [EPERM]
- The incr argument is negative and the calling process does not have appropriate privileges.
EXAMPLES
None.
APPLICATION USAGE
As -1 is a permissible return value in a successful situation, an application wishing to check for error situations should set errno to 0, then call nice() , and if it returns -1, check to see if errno is non-zero.
FUTURE DIRECTIONS
None.
SEE ALSO
<limits.h> , <unistd.h> .
DERIVATION
Derived from Issue 1 of the SVID.