'\"macro stdmacro
.if n .pH g2.nice @(#)nice	40.10 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} nice 2 "" "\&"
.if \nX=1 .ds x} nice 2 ""
.if \nX=2 .ds x} nice 2 "" "\&"
.if \nX=3 .ds x} nice "" "" "\&"
.TH \*(x}
.SH NAME
\f4nice\f1 \- change priority of a time-sharing process
.SH SYNOPSIS
\f4#include <unistd.h>
.sp .5
\f4int nice(int incr);\f1
.SH DESCRIPTION
\f4nice\fP
allows a process in the time-sharing scheduling class to change its priority.
The
\f4priocntl\fP
system call is a more general interface to scheduler functions.
.PP
\f4nice\fP
adds the value of 
.I incr\^
to the nice value of the calling process.
A process's
nice value
is a non-negative number for which a more positive value
results in lower
.SM CPU
priority.
.PP
A maximum nice value of 39 and a minimum nice value of 0
are imposed by the system.
(The default nice value is 20.)
Requests for values above or below these limits result in the nice value
being set to the corresponding limit.
.PP
.TP 14
\f4EPERM\fP
\f4nice\fP
fails and does not change the nice value if
.I incr\^
is negative or greater than 39 and the effective user
.SM ID
of the calling process is not super-user.
.TP
\f4EINVAL\fP
\f4nice\fP
fails if called by a process in a scheduling class other than time-sharing.
.SH SEE ALSO
\f4exec\fP(2),
\f4priocntl\fP(2).
.sp .2
\f4nice\fP(1) in the
\f2User's Reference Manual\f1.
.SH DIAGNOSTICS
Upon successful completion,
\f4nice\fP
returns the new nice value minus 20.
Otherwise, a value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.\"	@(#)nice.2	6.2 of 9/6/83
.Ee
