Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/lib/ape/man/3/nice

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "NICE" 3P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" nice 
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.SH NAME
nice \- change the nice value of a process
.SH SYNOPSIS
.LP
\fB#include <unistd.h>
.br
.sp
int nice(int\fP \fIincr\fP\fB); \fP
\fB
.br
\fP
.SH DESCRIPTION
.LP
The \fInice\fP() function shall add the value of \fIincr\fP to the
nice value of the calling process. A process' nice value is
a non-negative number for which a more positive value shall result
in less favorable scheduling.
.LP
A maximum nice value of 2*{NZERO}-1 and a minimum nice value of 0
shall be imposed by the system. Requests for values above or
below these limits shall result in the nice value being set to the
corresponding limit. Only a process with appropriate privileges
can lower the nice value.
.LP
Calling the \fInice\fP() 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-defined.
.LP
The nice value set with \fInice\fP() shall be applied to the process.
If the process is multi-threaded, the nice value shall
affect all system scope threads in the process.
.LP
As -1 is a permissible return value in a successful situation, an
application wishing to check for error situations should set
\fIerrno\fP to 0, then call \fInice\fP(), and if it returns -1, check
to see whether \fIerrno\fP is non-zero.
.SH RETURN VALUE
.LP
Upon successful completion, \fInice\fP() shall return the new nice
value -{NZERO}. Otherwise, -1 shall be returned, the
process' nice value shall not be changed, and \fIerrno\fP shall be
set to indicate the error.
.SH ERRORS
.LP
The \fInice\fP() function shall fail if:
.TP 7
.B EPERM
The \fIincr\fP argument is negative and the calling process does not
have appropriate privileges.
.sp
.LP
\fIThe following sections are informative.\fP
.SH EXAMPLES
.SS Changing the Nice Value
.LP
The following example adds the value of the \fIincr\fP argument, -20,
to the nice value of the calling process.
.sp
.RS
.nf

\fB#include <unistd.h>
\&...
int incr = -20;
int ret;
.sp

ret = nice(incr);
\fP
.fi
.RE
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fIgetpriority\fP(), \fIsetpriority\fP(), the Base Definitions
volume of IEEE\ Std\ 1003.1-2001, \fI<limits.h>\fP, \fI<unistd.h>\fP
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.