Go to the previous, next section.
int getpriority(int which, int who);
int setpriority(int which, int who, int prio);
which: [in] which kind of taks to work on.
who: [in] who exactly we want to work on.
prio: [in] the new priority.
getpriority
retreives the highest priority of a task, a process
group or a user and setpriority
sets the priority of a task, all
process in a process group or a user. which and have the
following values:
PRIO_PROCESS
PRIO_PGRP
PRIO_USER
In any case, a value of zero for who means the current process, process group or user. prio is in the range [-20,20] with lower values giving a higher scheduling priority.
getpriority returns something between -20 and 20.
setpriority returns 0 on success and -1 on error. In case of
errorm, errno
is set to one of the following values:
EINVAL
: which has an invalid value.
EPERM
: the effective uid and gid of the calling task do not
match those of the target task.
EACCESS
: the caller tried to lower a priority but is not a
superuser task.
ESRCH
.
Go to the previous, next section.