getpriority(2) — System Calls
OSF
NAME
getpriority, setpriority − Gets or sets process scheduling priority
SYNOPSIS
#include <sys/resource.h>
int getpriority(
int which,
int who );
int setpriority(
int which,
int who,
int priority );
PARAMETERS
whichSpecifies one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER.
whoSpecifies a numeric value interpreted relative to the which parameter (a process identifier, process group identifier, and a user ID, respectively). A 0 (zero) value for the who parameter denotes the current process, process group, or user.
prioritySpecifies a value in the range -20 to 20. The default priority is 0 (zero); negative priorities cause more favorable scheduling.
DESCRIPTION
The setpriority() function sets the scheduling priority of a process, process group, or user. The getpriority() function obtains the current priority of a process, process group, or user.
The getpriority() function returns the highest priority (lowest numerical value) pertaining to any of the specified processes. The setpriority() function sets the priorities of all of the specified processes to the specified value. If the specified value is less than -20, a value of -20 is used; if it is greater than 20, a value of 20 is used.
RETURN VALUES
Upon successful completion, the getpriority() function returns an integer in the range -20 to 20. Otherwise, -1 is returned.
Upon successful completion, the setpriority() function returns 0 (zero). Otherwise, -1 is returned.
ERRORS
If the getpriority() or setpriority() function fails, errno may be set to one of the following values:
[ESRCH]No process was located using the which and who parameter values specified.
[EINVAL]The which parameter was not recognized.
In addition to the errors indicated above, the setpriority() function can fail with errno set to one of the following values: