sched_get_priority_max(S-osr5)
sched_get_priority_max, sched_get_priority_min --
get the maximum/minimum priority
Syntax
cc . . . -lc
#include <sched.h>
int sched_get_priority_max(int policy);
int sched_get_priority_min(int policy);
Description
sched_get_priority_max-
get the maximum priority
sched_get_priority_min-
get the minimum priority
sched_get_priority_max and sched_get_priority_min
return the maximum and minimum priorities allocated to the scheduling policy
specified by policy.
The following policies are available:
SCHED_FIFO-
first in first out. Processes are allowed on the
CPU in the order in which they were added to the
queue of processes to be run, for each priority.
SCHED_RR-
round-robin. Identical to SCHED_FIFO except that
a process runs only for a set time slice (see
sched_rr_get_interval(S-osr5)).
Once the process has completed its time slice it is placed
on the tail of the queue of processes to be run, for its
priority.
SCHED_OTHER-
non-realtime scheduling. This uses the traditional UNIX scheduler.
Return values
Upon successful completion sched_get_priority_max and
sched_get_priority_min return the maximum and minimum priorities
respectively. If an error has occurred both functions return -1, and
errno is set to indicate the error.
Diagnostics
If sched_get_priority_max or sched_get_priority_min
terminate due to an error, they will set errno to one of the
following values:
[EINVAL]-
The specified policy does not exist.
[ENOSYS]-
The functions are not supported.
Examples
The following example illustrates the use of sched_get_priority_max
and sched_get_priority_min:
int pmin, pmax, priority = 36;
struct sched_param sp;
...
pmin = sched_get_priority_min(SCHED_FIFO);
pmax = sched_get_priority_max(SCHED_FIFO);
if (priority >= pmin && priority <= pmax) {
sp.sched_priority = priority;
}
else {
sp.sched_priority = pmin;
}
sched_setparam(0, &sp);
Files
/usr/lib/libc.a-
linking library
See also
sched_getparam(S-osr5),
sched_getscheduler(S-osr5),
sched_rr_get_interval(S-osr5),
sched_setparam(S-osr5),
sched_setscheduler(S-osr5),
sched_yield(S-osr5)
Standards conformance
Text reprinted and/or adapted from IEEE Std
1003.1b-1993, IEEE Standard for Information
Technology, POSIX Part 1: System Application
Program Interface (API) Amendment 1: Realtime
Extensions [C Language], copyright © 1993 by the
Institute of Electrical and Electronics Engineers, Inc. The
IEEE takes no responsibility for and will assume
no liability for damages resulting from the reader's
misinterpretation of said information resulting from the
placement and context in this publication. Information is
reproduced with the permission of the IEEE.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005