Seth Woolley's Man Viewer

Manual for nice - man 2 nice

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

NICE(2)                    Linux Programmer's Manual                   NICE(2)



NAME
       nice(1,2) - change process priority

SYNOPSIS
       #include <unistd.h>

       int nice(1,2)(int inc);

DESCRIPTION
       nice(1,2)  adds  inc  to  the nice(1,2) value for the calling pid.  (A large nice(1,2)
       value means a low priority.)  Only the superuser may specify a negative
       increment, or priority increase.

RETURN VALUE
       On  success,  zero is returned.  On error(8,n), -1 is returned, and errno is
       set(7,n,1 builtins) appropriately.

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.

CONFORMING TO
       SVr4, SVID EXT, AT&T, X/OPEN, BSD 4.3. However,  the  Linux  and  glibc
       (earlier  than  glibc  2.2.4)  return  value is nonstandard, see below.
       SVr4 documents an additional EINVAL error(8,n) code.

NOTES
       Note that the routine is documented in(1,8) SUSv2 and POSIX  1003.1-2003  to
       return the new nice(1,2) value, while the Linux syscall and (g)libc (earlier
       than glibc 2.2.4) routines return 0 on success.  The new nice(1,2) value can
       be  found  using  getpriority(2).  Note that an implementation in(1,8) which
       nice(1,2) returns the new nice(1,2) value can legitimately return -1.   To  reli-
       ably  detect  an  error(8,n),  set(7,n,1 builtins) errno to 0 before the call, and check its
       value when nice(1,2) returns -1.

SEE ALSO
       nice(1,2)(1),  fork(2),  getpriority(2),  setpriority(2),   capabilities(7),
       renice(8)



Linux 2.6.6                       2004-05-27                           NICE(2)

References for this manual (incoming links)