[Previous]
[Contents]
[Next]

setprio()

set the priority of a process

Synopsis:

#include <sys/sched.h>
int setprio( pid_t pid, int prio );

Description:

The setprio() function changes the priority of process pid to priority prio. If pid is zero, the priority of the calling process is set.

The prio parameter must lie between 1 (lowest) and 29 (highest for superuser) or 19 (highest for non-superuser).

By default, the process priority and scheduling algorithm are inherited from or explicitly set by the process that created it. Once running, the process may change its priority by using this function.

Returns:

The previous priority. If an error occurs, -1 is returned and errno is set.

Errors:

EINVAL
The priority prio isn't a valid priority.
EPERM
The calling process doesn't have sufficient privilege to set the priority.
ESRCH
The process pid doesn't exist.

Examples:

See qnx_scheduler().

Classification:

QNX

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, getprio(), qnx_scheduler(), sched_getparam(), sched_getscheduler(), sched_setscheduler(), sched_yield()


[Previous]
[Contents]
[Next]