SCHED_SETPARAM(2)

NAME
sched_setparam - Set scheduling parameters for a process

SYNOPSIS
# include <sched.h>

int sched_setparam ( pid_t pid, const struct sched_param *p )

DESCRIPTION
The function sched_setparam sets the scheduling parameter for a process given by pid to the parameters specified by p. If the pid is 0, the parameters are applied to the calling process. Depending on the scheduling policy under which the process is running, different members of p may be used. This implementation of POSIX.4 defines the following scheduling policies and the valid members of the sched_param structure.

SCHED_FIFO      sched_priority

SCHED_RR        sched_priority

On a successful call to sched_setparam, the system updates the priority of the process and forces a reschedule (if required).

RETURN VALUE
On a failure sched_setparam returns -1 with errno indicating the error, otherwise 0.

ERRORS
When sched_setparam fails, errno will be set to one among the following values:

EINVAL
    The calling process has not provided a valid sched_param structure.

EINVAL
    The calling process must be of scheduling policy SCHED_FIFO or SCHED_RR to use this call.

EINVAL
    The sched_priority being set is greater than sched_get_priority_max() or less than sched_get_priority_min().

ESRCH
    The process specified by a non-zero pid does not exist on the system.

EPERM
    The calling process cannot affect the scheduling parameters of the process given by pid because it lacks authority. Under Linux, a process must be the same uid as the caller or the caller must be superuser.

SEE ALSO
sched_getparam(2), sched_get_priority_min(2) sched_get_priority_max(2), sched_setscheduler(2), sched_getscheduler(2)