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
19

DESCRIPTION

21       The nice() function shall add the value of incr to the  nice  value  of
22       the calling process. A process' nice value is a non-negative number for
23       which a more positive value shall result in less favorable scheduling.
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  process'  nice  value
47       shall not be changed, and errno shall be set to indicate the error.
48

ERRORS

50       The nice() function shall fail if:
51
52       EPERM  The  incr  argument is negative and the calling process does not
53              have appropriate privileges.
54
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
70              ret = nice(incr);
71

APPLICATION USAGE

73       None.
74

RATIONALE

76       None.
77

FUTURE DIRECTIONS

79       None.
80

SEE ALSO

82       getpriority(),   setpriority(),   the   Base   Definitions   volume  of
83       IEEE Std 1003.1-2001, <limits.h>, <unistd.h>
84
86       Portions of this text are reprinted and reproduced in  electronic  form
87       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
88       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
89       Specifications  Issue  6,  Copyright  (C) 2001-2003 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
97
98IEEE/The Open Group                  2003                             NICE(3P)
Impressum