2004-11-03 13:51:07 +00:00
|
|
|
.\" Hey Emacs! This file is -*- nroff -*- source.
|
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1992 Drew Eckhardt <drew@cs.colorado.edu>, March 28, 1992
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\"
|
|
|
|
.\" Modified by Michael Haardt <michael@moria.de>
|
|
|
|
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
|
|
|
|
.\" Modified 1996-11-04 by Eric S. Raymond <esr@thyrsus.com>
|
|
|
|
.\" Modified 2001-06-04 by aeb
|
2007-09-20 06:52:22 +00:00
|
|
|
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
2007-07-08 12:11:40 +00:00
|
|
|
.TH NICE 2 2007-07-26 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
nice \- change process priority
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <unistd.h>
|
|
|
|
.sp
|
|
|
|
.BI "int nice(int " inc );
|
2007-07-08 12:11:40 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
2008-07-15 20:36:58 +00:00
|
|
|
.BR nice ():
|
2007-07-08 12:11:40 +00:00
|
|
|
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2005-06-16 15:07:57 +00:00
|
|
|
.BR nice ()
|
2007-04-12 22:42:49 +00:00
|
|
|
adds
|
2004-11-03 13:51:07 +00:00
|
|
|
.I inc
|
2005-07-19 06:32:54 +00:00
|
|
|
to the nice value for the calling process.
|
2006-07-22 14:07:21 +00:00
|
|
|
(A higher nice value means a low priority.)
|
2007-04-12 22:42:49 +00:00
|
|
|
Only the super\%user may specify a negative increment,
|
2006-07-22 14:07:21 +00:00
|
|
|
or priority increase.
|
2005-07-28 12:33:20 +00:00
|
|
|
The range for nice values is described in
|
|
|
|
.BR getpriority (2).
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "RETURN VALUE"
|
2005-06-16 15:07:57 +00:00
|
|
|
On success, the new nice value is returned (but see NOTES below).
|
|
|
|
On error, \-1 is returned, and
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EPERM
|
|
|
|
The calling process attempted to increase its priority by
|
|
|
|
supplying a negative
|
2007-09-20 16:26:31 +00:00
|
|
|
.I inc
|
2004-11-03 13:51:07 +00:00
|
|
|
but has insufficient privileges.
|
|
|
|
Under Linux the
|
|
|
|
.B CAP_SYS_NICE
|
|
|
|
capability is required.
|
2007-04-12 22:42:49 +00:00
|
|
|
(But see the discussion of the
|
2005-09-20 17:42:39 +00:00
|
|
|
.B RLIMIT_NICE
|
|
|
|
resource limit in
|
|
|
|
.BR setrlimit (2).)
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH "CONFORMING TO"
|
2007-04-12 22:42:49 +00:00
|
|
|
SVr4, 4.3BSD, POSIX.1-2001.
|
2006-08-03 13:57:17 +00:00
|
|
|
However, the Linux and (g)libc
|
accept.2, execve.2, futimesat.2, getresuid.2, getrlimit.2, madvise.2, mq_getsetattr.2, msgctl.2, nice.2, open.2, poll.2, setresuid.2, shmctl.2, sigaction.2, times.2, utimensat.2, __setfpucw.3, atoi.3, endian.3, err.3, euidaccess.3, fenv.3, fopencookie.3, fpurge.3, getgrouplist.3, getutmp.3, j0.3, lgamma.3, netlink.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cleanup_push_defer_np.3, pthread_getattr_np.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_tryjoin_np.3, pthread_yield.3, random_r.3, readdir.3, rtnetlink.3, scanf.3, setenv.3, significand.3, sigsetops.3, strerror.3, strstr.3, sysv_signal.3, termios.3, timegm.3, unlocked_stdio.3, y0.3, locale.5, bootparam.7, feature_test_macros.7, ip.7, locale.7, pthreads.7, rtld-audit.7, nscd.8: Global fix: s/non-standard/nonstandard/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 16:37:52 +00:00
|
|
|
(earlier than glibc 2.2.4) return value is nonstandard, see below.
|
2007-06-22 17:16:20 +00:00
|
|
|
SVr4 documents an additional
|
2007-09-20 16:26:31 +00:00
|
|
|
.B EINVAL
|
2007-06-22 17:16:20 +00:00
|
|
|
error code.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NOTES
|
2006-08-03 13:57:17 +00:00
|
|
|
SUSv2 and POSIX.1-2001 specify that
|
2005-06-16 15:07:57 +00:00
|
|
|
.BR nice ()
|
|
|
|
should return the new nice value.
|
|
|
|
However, the Linux syscall and the
|
|
|
|
.BR nice ()
|
2005-06-22 06:52:22 +00:00
|
|
|
library function provided in older versions of (g)libc
|
2005-06-16 15:07:57 +00:00
|
|
|
(earlier than glibc 2.2.4) return 0 on success.
|
2005-06-22 06:52:22 +00:00
|
|
|
The new nice value can be found using
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR getpriority (2).
|
2005-06-16 15:07:57 +00:00
|
|
|
|
|
|
|
Since glibc 2.2.4,
|
|
|
|
.BR nice ()
|
|
|
|
is implemented as a library function that calls
|
|
|
|
.BR getpriority (2)
|
2005-06-22 06:52:22 +00:00
|
|
|
to obtain the new nice value to be returned to the caller.
|
2005-06-16 15:07:57 +00:00
|
|
|
With this implementation,
|
2005-07-06 11:23:52 +00:00
|
|
|
a successful call can legitimately return \-1.
|
2004-11-03 13:51:07 +00:00
|
|
|
To reliably detect an error, set
|
|
|
|
.I errno
|
|
|
|
to 0 before the call, and check its value when
|
2005-06-16 15:07:57 +00:00
|
|
|
.BR nice ()
|
2004-11-03 13:51:07 +00:00
|
|
|
returns \-1.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR nice (1),
|
clock_nanosleep.2, getpriority.2, kexec_load.2, nanosleep.2, nice.2, sched_setaffinity.2, timer_create.2, timer_delete.2, timer_settime.2, utime.2, btowc.3, futimes.3, log.3, pthread_attr_setguardsize.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_tryjoin_np.3, strcoll.3, strcpy.3, string.3, strxfrm.3, networks.5, aio.7, sigevent.7, udplite.7: SEE ALSO: Place entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-11-01 05:34:26 +00:00
|
|
|
.BR renice (1),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR fork (2),
|
|
|
|
.BR getpriority (2),
|
|
|
|
.BR setpriority (2),
|
clock_nanosleep.2, getpriority.2, kexec_load.2, nanosleep.2, nice.2, sched_setaffinity.2, timer_create.2, timer_delete.2, timer_settime.2, utime.2, btowc.3, futimes.3, log.3, pthread_attr_setguardsize.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_tryjoin_np.3, strcoll.3, strcpy.3, string.3, strxfrm.3, networks.5, aio.7, sigevent.7, udplite.7: SEE ALSO: Place entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-11-01 05:34:26 +00:00
|
|
|
.BR capabilities (7)
|