add directory Ref-docs
This commit is contained in:
153
Ref-docs/POSIX/susv3/functions/nice.html
Normal file
153
Ref-docs/POSIX/susv3/functions/nice.html
Normal file
@@ -0,0 +1,153 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
||||
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
||||
<title>nice</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
||||
</script>
|
||||
|
||||
<basefont size="3"> <a name="nice"></a> <a name="tag_03_406"></a><!-- nice -->
|
||||
<!--header start-->
|
||||
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
||||
IEEE Std 1003.1-2001<br>
|
||||
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
||||
|
||||
<!--header end-->
|
||||
<hr size="2" noshade>
|
||||
<h4><a name="tag_03_406_01"></a>NAME</h4>
|
||||
|
||||
<blockquote>nice - change the nice value of a process</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_02"></a>SYNOPSIS</h4>
|
||||
|
||||
<blockquote class="synopsis">
|
||||
<div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt=
|
||||
"[Option Start]" border="0"> #include <<a href="../basedefs/unistd.h.html">unistd.h</a>><br>
|
||||
<br>
|
||||
int nice(int</tt> <i>incr</i><tt>); <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
||||
|
||||
<tt><br>
|
||||
</tt></blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_03"></a>DESCRIPTION</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <i>nice</i>() function shall add the value of <i>incr</i> 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.</p>
|
||||
|
||||
<p>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.</p>
|
||||
|
||||
<p><sup>[<a href="javascript:open_code('PS')">PS|TPS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
||||
Calling the <i>nice</i>() 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. <img src="../images/opt-end.gif" alt=
|
||||
"[Option End]" border="0"></p>
|
||||
|
||||
<p>The nice value set with <i>nice</i>() shall be applied to the process. If the process is multi-threaded, the nice value shall
|
||||
affect all system scope threads in the process.</p>
|
||||
|
||||
<p>As -1 is a permissible return value in a successful situation, an application wishing to check for error situations should set
|
||||
<i>errno</i> to 0, then call <i>nice</i>(), and if it returns -1, check to see whether <i>errno</i> is non-zero.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_04"></a>RETURN VALUE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>Upon successful completion, <i>nice</i>() shall return the new nice value -{NZERO}. Otherwise, -1 shall be returned, the
|
||||
process' nice value shall not be changed, and <i>errno</i> shall be set to indicate the error.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_05"></a>ERRORS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The <i>nice</i>() function shall fail if:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>[EPERM]</dt>
|
||||
|
||||
<dd>The <i>incr</i> argument is negative and the calling process does not have appropriate privileges.</dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
<div class="box"><em>The following sections are informative.</em></div>
|
||||
|
||||
<h4><a name="tag_03_406_06"></a>EXAMPLES</h4>
|
||||
|
||||
<blockquote>
|
||||
<h5><a name="tag_03_406_06_01"></a>Changing the Nice Value</h5>
|
||||
|
||||
<p>The following example adds the value of the <i>incr</i> argument, -20, to the nice value of the calling process.</p>
|
||||
|
||||
<pre>
|
||||
<tt>#include <unistd.h>
|
||||
...
|
||||
int incr = -20;
|
||||
int ret;
|
||||
<br>
|
||||
ret = nice(incr);
|
||||
</tt>
|
||||
</pre>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_07"></a>APPLICATION USAGE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_08"></a>RATIONALE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_09"></a>FUTURE DIRECTIONS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_10"></a>SEE ALSO</h4>
|
||||
|
||||
<blockquote>
|
||||
<p><a href="getpriority.html"><i>getpriority</i>()</a> , <a href="setpriority.html"><i>setpriority</i>()</a> , the Base Definitions
|
||||
volume of IEEE Std 1003.1-2001, <a href="../basedefs/limits.h.html"><i><limits.h></i></a>, <a href=
|
||||
"../basedefs/unistd.h.html"><i><unistd.h></i></a></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_11"></a>CHANGE HISTORY</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>First released in Issue 1. Derived from Issue 1 of the SVID.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_03_406_12"></a>Issue 5</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>A statement is added to the description indicating the effects of this function on the different scheduling policies and
|
||||
multi-threaded processes.</p>
|
||||
</blockquote>
|
||||
|
||||
<div class="box"><em>End of informative text.</em></div>
|
||||
|
||||
<hr>
|
||||
<hr size="2" noshade>
|
||||
<center><font size="2"><!--footer start-->
|
||||
UNIX ® is a registered Trademark of The Open Group.<br>
|
||||
POSIX ® is a registered Trademark of The IEEE.<br>
|
||||
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
||||
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
||||
]</font></center>
|
||||
|
||||
<!--footer end-->
|
||||
<hr size="2" noshade>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user