sched_setparam(2) SDK R4.11 sched_setparam(2)
NAME
sched_setparam - set the scheduling priority for a process
SYNOPSIS
#include <sched.h>
int schedsetparam (pid, *priority)
pidt pid;
struct schedparam*priority;
DESCRIPTION
Use schedsetparam(2) to set the scheduling priority of process pid
to the value indicated in priority. The POSIX-designated structure
that priority points to is:
struct schedparam
{
int schedpriority;
};
If pid is 0, this call sets the priority of the calling process.
The larger the number in schedpriority, the higher the priority. To
find out the priority range for a given pid, use
schedgetscheduler(2) to get its scheduling policy, then use
schedgetprioritymax(2) and schedgetprioritymin(2) to get the
range defined by that policy.
Only a calling process with the appropriate privilege can set a
priority higher than the current priority. A priority that is lower
than or equal to the current priority may be set either by a calling
process having appropriate privilege or by a process having an
effective user id matching that of pid. For systems supporting the
DG/UX Capability Option, appropriate privilege is defined as having
one or more specific capabilities enabled in the effective capability
set of the calling process. See capdefaults(5) for the default
capability for this system call.
On systems without the DG/UX Capability Option, appropriate privilege
means that the process has an effective UID of root. See the
appropriateprivilege(5) man page for more information.
If this call fails, the priority of pid is not changed.
Note
* This routine is based on POSIX realtime extension document P1003.4
draft 14. It is therefore subject to change.
* Compilation of a source file using this routine requires that
feature macro _POSIX4_DRAFT_SOURCE be defined. This feature macro
is not enabled by any other feature macro, nor does it enable any
other feature macro.
* The compiled routine must be linked to library librte.a.
RETURN VALUE
If successful, schedsetparam returns 0. If unsuccessful, the routine
returns -1 and sets ERRNO to one of the following:
EFAULT The address of priority is bad.
EINVAL The priority value in schedpriority is outside the range
defined for the scheduling policy of pid.
EPERM The caller does not have permission to set the scheduling
priority of pid.
ESRCH Process pid doesn't exist or is negative.
SEE ALSO
schedgetparam(2), schedsetscheduler(2), schedgetscheduler(2),
schedyield(2), schedgetprioritymax(2), schedgetprioritymin(2),
schedrrgetinterval(2), appropriateprivilege(5).
capdefaults(5).
Licensed material--property of copyright holder(s)