CINXE.COM

nice

<html> <head> <title>nice</title> <META NAME="KEYWORDS" CONTENT="nice"> </head> <body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#0000ff" ALINK="#0000ff" TEXT="#000000"> <center> <h1><b>nice</b></h1></center> <PRE> <STRONG><A HREF="/man2/NICE">NICE(2)</A></STRONG> Linux Programmer's Manual <STRONG><A HREF="/man2/NICE">NICE(2)</A></STRONG> NAME nice - change process priority SYNOPSIS #include &lt;unistd.h&gt; int nice(int inc); Feature Test Macro Requirements for glibc (see <STRONG><A HREF="/man7/feature_test_macros">feature_test_macros(7)</A></STRONG>): nice(): _XOPEN_SOURCE || /* Since glibc 2.19: */ _DEFAULT_SOURCE || /* Glibc versions &lt;= 2.19: */ _BSD_SOURCE || _SVID_SOURCE DESCRIPTION nice() adds inc to the nice value for the calling thread. (A higher nice value means a low priority.) The range of the nice value is +19 (low priority) to -20 (high prior- ity). Attempts to set a nice value outside the range are clamped to the range. Traditionally, only a privileged process could lower the nice value (i.e., set a higher priority). However, since Linux 2.6.12, an unpriv- ileged process can decrease the nice value of a target process that has a suitable RLIMIT_NICE soft limit; see <STRONG><A HREF="/man2/getrlimit">getrlimit(2)</A></STRONG> for details. RETURN VALUE On success, the new nice value is returned (but see NOTES below). On error, -1 is returned, and errno is set appropriately. A successful call can legitimately return -1. To detect an error, set errno to 0 before the call, and check whether it is nonzero after nice() returns -1. ERRORS EPERM The calling process attempted to increase its priority by sup- plying a negative inc but has insufficient privileges. Under Linux, the CAP_SYS_NICE capability is required. (But see the discussion of the RLIMIT_NICE resource limit in <STRONG><A HREF="/man2/setrlimit">setrlimit(2)</A></STRONG>.) CONFORMING TO POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. However, the raw system call and (g)libc (earlier than glibc 2.2.4) return value is nonstandard, see below. NOTES For further details on the nice value, see <STRONG><A HREF="/man7/sched">sched(7)</A></STRONG>. Note: the addition of the "autogroup" feature in Linux 2.6.38 means that the nice value no longer has its traditional effect in many cir- cumstances. For details, see <STRONG><A HREF="/man7/sched">sched(7)</A></STRONG>. C library/kernel differences POSIX.1 specifies that nice() should return the new nice value. How- ever, the raw Linux system call returns 0 on success. Likewise, the nice() wrapper function provided in glibc 2.2.3 and earlier returns 0 on success. Since glibc 2.2.4, the nice() wrapper function provided by glibc pro- vides conformance to POSIX.1 by calling <STRONG><A HREF="/man2/getpriority">getpriority(2)</A></STRONG> to obtain the new nice value, which is then returned to the caller. SEE ALSO <STRONG><A HREF="/man1/nice">nice(1)</A></STRONG>, <STRONG><A HREF="/man1/renice">renice(1)</A></STRONG>, <STRONG><A HREF="/man2/fork">fork(2)</A></STRONG>, <STRONG><A HREF="/man2/getpriority">getpriority(2)</A></STRONG>, <STRONG><A HREF="/man2/getrlimit">getrlimit(2)</A></STRONG>, setprior- <STRONG><A HREF="/man2/ity">ity(2)</A></STRONG>, <STRONG><A HREF="/man7/capabilities">capabilities(7)</A></STRONG>, <STRONG><A HREF="/man7/sched">sched(7)</A></STRONG> COLOPHON This page is part of release 5.05 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 <STRONG><A HREF="/man2/NICE">NICE(2)</A></STRONG></PRE> <center> <h6>Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2025 <a href="http://www.he.net">Hurricane Electric</a>. All Rights Reserved.</h6></center> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10