1NICE(3P)                   POSIX Programmer's Manual                  NICE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       nice — change the nice value of a process
13

SYNOPSIS

15       #include <unistd.h>
16
17       int nice(int incr);
18

DESCRIPTION

20       The nice() function shall add the value of incr to the  nice  value  of
21       the calling process. A nice value of a process is a non-negative number
22       for which a more positive value shall result in less favorable schedul‐
23       ing.
24
25       A maximum nice value of 2*{NZERO}-1 and a minimum nice value of 0 shall
26       be imposed by the system. Requests for values above or below these lim‐
27       its  shall  result  in  the  nice  value being set to the corresponding
28       limit. Only a process with appropriate privileges can  lower  the  nice
29       value.
30
31       Calling  the nice() function has no effect on the priority of processes
32       or threads with policy SCHED_FIFO or SCHED_RR.  The effect on processes
33       or threads with other scheduling policies is implementation-defined.
34
35       The  nice value set with nice() shall be applied to the process. If the
36       process is multi-threaded, the nice value shall affect all system scope
37       threads in the process.
38
39       As  -1  is  a  permissible  return  value in a successful situation, an
40       application wishing to check for error situations should set  errno  to
41       0,  then  call nice(), and if it returns -1, check to see whether errno
42       is non-zero.
43

RETURN VALUE

45       Upon successful completion, nice() shall  return  the  new  nice  value
46       -{NZERO}.   Otherwise,  -1  shall  be  returned,  the nice value of the
47       process shall not be changed, and errno shall be set  to  indicate  the
48       error.
49

ERRORS

51       The nice() function shall fail if:
52
53       EPERM  The  incr  argument is negative and the calling process does not
54              have appropriate privileges.
55
56       The following sections are informative.
57

EXAMPLES

59   Changing the Nice Value
60       The following example adds the value of the incr argument, -20, to  the
61       nice value of the calling process.
62
63
64           #include <unistd.h>
65           ...
66           int incr = -20;
67           int ret;
68
69           ret = nice(incr);
70

APPLICATION USAGE

72       None.
73

RATIONALE

75       None.
76

FUTURE DIRECTIONS

78       None.
79

SEE ALSO

81       exec, getpriority()
82
83       The Base Definitions volume of POSIX.1‐2017, <limits.h>, <unistd.h>
84
86       Portions  of  this text are reprinted and reproduced in electronic form
87       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
88       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
89       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
90       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
91       event of any discrepancy between this version and the original IEEE and
92       The  Open Group Standard, the original IEEE and The Open Group Standard
93       is the referee document. The original Standard can be  obtained  online
94       at http://www.opengroup.org/unix/online.html .
95
96       Any  typographical  or  formatting  errors that appear in this page are
97       most likely to have been introduced during the conversion of the source
98       files  to  man page format. To report such errors, see https://www.ker
99       nel.org/doc/man-pages/reporting_bugs.html .
100
101
102
103IEEE/The Open Group                  2017                             NICE(3P)
Impressum