GETPRIORITY(2,L) AIX Technical Reference GETPRIORITY(2,L)
-------------------------------------------------------------------------------
getpriority, setpriority, nice
PURPOSE
Gets or sets program scheduling priority.
LIBRARY
Standard C Library (libc.a)
BSD Compatibility Library (libbsd.a)
SYNTAX
#include <sys/resource.h>
prio= getpriority(which, who) int nice(incr)
int prio, which, who; int incr;
setpriority(which, who, prio)
int which, who, prio;
DESCRIPTION
The scheduling priority of the process, process group, or user, as indicated by
which and who is obtained with the getpriority system call and set with the
setpriority system call. The which argument is one of PRIO_PROCESS, PRIO_PGRP,
or PRIO_USER, and who is interpreted relative to which (a process identifier
for PRIO_PROCESS, a process group identifier for PRO_PGRP, and a user ID for
PRIO_USER). A 0 value for who denotes the current process, process group, or
user. The prio value is in the range 0 to 39. The default priority is 20;
lower priorities cause more favorable scheduling.
A process's priority value is also referred to as its nice value.
The getpriority system call returns the highest priority (lowest numerical
value) enjoyed by any of the specified processes. The setpriority system call
sets the priorities of all of the specified processes to the specified value.
Only the superuser may lower priorities.
The nice system call adds the value of the incr parameter to the current
process's priority value. If incr causes the priority value to fall outside the
range 0 to 39, nice sets the priority value to the corresponding limit.
RETURN VALUE
Processed November 7, 1990 GETPRIORITY(2,L) 1
GETPRIORITY(2,L) AIX Technical Reference GETPRIORITY(2,L)
Upon successful completion, getpriority and nice return a priority value, and
setpriority returns 0. Otherwise, -1 is returned and errno is set to indicate
the error.
ERROR CONDITIONS
The getpriority, setpriority and nice system calls fail if one or more of the
following are true:
ESRCH No process was located using the which and who values specified.
EINVAL which was not one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
EPERM The calling process does not have an effective user ID of the
superuser.
EPERM The incr parameter is negative or greater than 40, and the effective
user ID of the calling process is not a superuser.
EACCES A non-superuser attempted to lower a process priority.
COMPATIBILITY NOTE
The routines getpriority, setpriority, and nice are also provided as
compatibility routines in libbsd.a. The libbsd.a version of these routines
differ from the libc.a version only in that they use priority values in the
range of -20 to 20, instead of 0 to 39.
Note also that certain AIX commands with 4.3BSD origins (csh, renice, and the
4.3BSD mode of ps) display and expect priority values in the BSD range, while
others (nice and the System V UNIX mode of ps) use priority values in the range
of 0 to 39.
RELATED INFORMATION
In this book: "exec: execl, execv, execle, execve, execlp, execvp" and "fork,
vfork."
The nice command in AIX Operating System Commands Reference.
Processed November 7, 1990 GETPRIORITY(2,L) 2