321 lines
13 KiB
HTML
321 lines
13 KiB
HTML
<!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_04_92"></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_04_92_01"></a>NAME</h4>
|
|
|
|
<blockquote>nice - invoke a utility with an altered nice value</blockquote>
|
|
|
|
<h4><a name="tag_04_92_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<div class="box"><code><tt><sup>[<a href="javascript:open_code('UP')">UP</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> nice</tt> <b>[</b><tt>-n</tt> <i>increment</i><b>]</b> <i>utility</i>
|
|
<b>[</b><i>argument</i><tt>...</tt><b>]</b><tt><img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>nice</i> utility shall invoke a utility, requesting that it be run with a different nice value (see the Base Definitions
|
|
volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap03.html#tag_03_239">Section 3.239, Nice Value</a>). With no
|
|
options and only if the user has appropriate privileges, the executed utility shall be run with a nice value that is some
|
|
implementation-defined quantity less than or equal to the nice value of the current process. If the user lacks appropriate
|
|
privileges to affect the nice value in the requested manner, the <i>nice</i> utility shall not affect the nice value; in this case,
|
|
a warning message may be written to standard error, but this shall not prevent the invocation of <i>utility</i> or affect the exit
|
|
status.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_04"></a>OPTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>nice</i> utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, <a href=
|
|
"../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>.</p>
|
|
|
|
<p>The following option is supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><b>-n </b> <i>increment</i></dt>
|
|
|
|
<dd>A positive or negative decimal integer which shall have the same effect on the execution of the utility as if the utility had
|
|
called the <a href="../functions/nice.html"><i>nice</i>()</a> function with the numeric value of the <i>increment</i>
|
|
option-argument.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_05"></a>OPERANDS</h4>
|
|
|
|
<blockquote>
|
|
<p>The following operands shall be supported:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>utility</i></dt>
|
|
|
|
<dd>The name of a utility that is to be invoked. If the <i>utility</i> operand names any of the special built-in utilities in <a
|
|
href="xcu_chap02.html#tag_02_14"><i>Special Built-In Utilities</i></a> , the results are undefined.</dd>
|
|
|
|
<dt><i>argument</i></dt>
|
|
|
|
<dd>Any string to be supplied as an argument when invoking the utility named by the <i>utility</i> operand.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_06"></a>STDIN</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_07"></a>INPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_08"></a>ENVIRONMENT VARIABLES</h4>
|
|
|
|
<blockquote>
|
|
<p>The following environment variables shall affect the execution of <i>nice</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>LANG</i></dt>
|
|
|
|
<dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> for
|
|
the precedence of internationalization variables used to determine the values of locale categories.)</dd>
|
|
|
|
<dt><i>LC_ALL</i></dt>
|
|
|
|
<dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd>
|
|
|
|
<dt><i>LC_CTYPE</i></dt>
|
|
|
|
<dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as
|
|
opposed to multi-byte characters in arguments).</dd>
|
|
|
|
<dt><i>LC_MESSAGES</i></dt>
|
|
|
|
<dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard
|
|
error.</dd>
|
|
|
|
<dt><i>NLSPATH</i></dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i> <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></dd>
|
|
|
|
<dt><i>PATH</i></dt>
|
|
|
|
<dd>Determine the search path used to locate the utility to be invoked. See the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap08.html">Chapter 8, Environment Variables</a>.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_09"></a>ASYNCHRONOUS EVENTS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_10"></a>STDOUT</h4>
|
|
|
|
<blockquote>
|
|
<p>Not used.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_11"></a>STDERR</h4>
|
|
|
|
<blockquote>
|
|
<p>The standard error shall be used only for diagnostic messages.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_12"></a>OUTPUT FILES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_13"></a>EXTENDED DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_14"></a>EXIT STATUS</h4>
|
|
|
|
<blockquote>
|
|
<p>If <i>utility</i> is invoked, the exit status of <i>nice</i> shall be the exit status of <i>utility</i>; otherwise, the
|
|
<i>nice</i> utility shall exit with one of the following values:</p>
|
|
|
|
<dl compact>
|
|
<dt>1-125</dt>
|
|
|
|
<dd>An error occurred in the <i>nice</i> utility.</dd>
|
|
|
|
<dt> 126</dt>
|
|
|
|
<dd>The utility specified by <i>utility</i> was found but could not be invoked.</dd>
|
|
|
|
<dt> 127</dt>
|
|
|
|
<dd>The utility specified by <i>utility</i> could not be found.</dd>
|
|
</dl>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_15"></a>CONSEQUENCES OF ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>Default.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_04_92_16"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>The only guaranteed portable uses of this utility are:</p>
|
|
|
|
<dl compact>
|
|
<dt><i>nice utility</i></dt>
|
|
|
|
<dd><br>
|
|
Run <i>utility</i> with the default lower nice value.</dd>
|
|
|
|
<dt><i>nice </i> <b>-n </b> <<i>positive integer</i>><i> utility</i></dt>
|
|
|
|
<dd><br>
|
|
Run <i>utility</i> with a lower nice value.</dd>
|
|
</dl>
|
|
|
|
<p>On some implementations they have no discernible effect on the invoked utility and on some others they are exactly
|
|
equivalent.</p>
|
|
|
|
<p>Historical systems have frequently supported the <<i>positive integer</i>> up to 20. Since there is no error penalty
|
|
associated with guessing a number that is too high, users without access to the system conformance document (to see what limits are
|
|
actually in place) could use the historical 1 to 20 range or attempt to use very large numbers if the job should be truly low
|
|
priority.</p>
|
|
|
|
<p>The nice value of a process can be displayed using the command:</p>
|
|
|
|
<pre>
|
|
<tt>ps -o nice
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>The <a href="../utilities/command.html"><i>command</i></a>, <a href="../utilities/env.html"><i>env</i></a>, <i>nice</i>, <a
|
|
href="../utilities/nohup.html"><i>nohup</i></a>, <a href="../utilities/time.html"><i>time</i></a>, and <a href=
|
|
"../utilities/xargs.html"><i>xargs</i></a> utilities have been specified to use exit code 127 if an error occurs so that
|
|
applications can distinguish "failure to find a utility" from "invoked utility exited with an error indication". The value 127
|
|
was chosen because it is not commonly used for other meanings; most utilities use small values for "normal error conditions" and
|
|
the values above 128 can be confused with termination due to receipt of a signal. The value 126 was chosen in a similar manner to
|
|
indicate that the utility could be found, but not invoked. Some scripts produce meaningful error messages differentiating the 126
|
|
and 127 cases. The distinction between exit codes 126 and 127 is based on KornShell practice that uses 127 when all attempts to
|
|
<i>exec</i> the utility fail with [ENOENT], and uses 126 when any attempt to <i>exec</i> the utility fails for any other
|
|
reason.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_17"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_18"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>Due to the text about the limits of the nice value being implementation-defined, <i>nice</i> is not actually required to change
|
|
the nice value of the executed command; the limits could be zero differences from the system default, although the implementor is
|
|
required to document this fact in the conformance document.</p>
|
|
|
|
<p>The 4.3 BSD version of <i>nice</i> does not check whether <i>increment</i> is a valid decimal integer. The command <i>nice</i>
|
|
<b>-x</b> <i>utility</i>, for example, would be treated the same as the command <i>nice</i> <b>--1</b> <i>utility</i>. If the user
|
|
does not have appropriate privileges, this results in a "permission denied" error. This is considered a bug.</p>
|
|
|
|
<p>When a user without appropriate privileges gives a negative <i>increment</i>, System V treats it like the command <i>nice</i>
|
|
<b>-0</b> <i>utility</i>, while 4.3 BSD writes a "permission denied" message and does not run the utility. Neither was considered
|
|
clearly superior, so the behavior was left unspecified.</p>
|
|
|
|
<p>The C shell has a built-in version of <i>nice</i> that has a different interface from the one described in this volume of
|
|
IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>The term "utility" is used, rather than "command", to highlight the fact that shell compound commands, pipelines, and so on,
|
|
cannot be used. Special built-ins also cannot be used. However, "utility" includes user application programs and shell scripts,
|
|
not just utilities defined in this volume of IEEE Std 1003.1-2001.</p>
|
|
|
|
<p>Historical implementations of <i>nice</i> provide a nice value range of 40 or 41 discrete steps, with the default nice value
|
|
being the midpoint of that range. By default, they lower the nice value of the executed utility by 10.</p>
|
|
|
|
<p>Some historical documentation states that the <i>increment</i> value must be within a fixed range. This is misleading; the valid
|
|
<i>increment</i> values on any invocation are determined by the current process nice value, which is not always the default.</p>
|
|
|
|
<p>The definition of nice value is not intended to suggest that all processes in a system have priorities that are comparable.
|
|
Scheduling policy extensions such as the realtime priorities in the System Interfaces volume of IEEE Std 1003.1-2001 make
|
|
the notion of a single underlying priority for all scheduling policies problematic. Some implementations may implement the
|
|
<i>nice</i>-related features to affect all processes on the system, others to affect just the general time-sharing activities
|
|
implied by this volume of IEEE Std 1003.1-2001, and others may have no effect at all. Because of the use of
|
|
"implementation-defined" in <i>nice</i> and <a href="../utilities/renice.html"><i>renice</i></a>, a wide range of implementation
|
|
strategies are possible.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_19"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_20"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="xcu_chap02.html#tag_02"><i>Shell Command Language</i></a> , <a href="renice.html"><i>renice</i></a> , the System
|
|
Interfaces volume of IEEE Std 1003.1-2001, <a href="../functions/nice.html"><i>nice</i>()</a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_21"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 4.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_04_92_22"></a>Issue 6</h4>
|
|
|
|
<blockquote>
|
|
<p>This utility is marked as part of the User Portability Utilities option.</p>
|
|
|
|
<p>The obsolescent SYNOPSIS is removed.</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>
|
|
|