]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/sched_get_priority_max.2
5791025e242454053fe93e36548f9a4663a8b999
[thirdparty/man-pages.git] / man2 / sched_get_priority_max.2
1 .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
2 .\"
3 .\" SPDX-License-Identifier: GPL-2.0-or-later
4 .\"
5 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
6 .\" First version written
7 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
8 .\" revision
9 .\"
10 .TH SCHED_GET_PRIORITY_MAX 2 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
11 .SH NAME
12 sched_get_priority_max, sched_get_priority_min \- get static priority range
13 .SH LIBRARY
14 Standard C library
15 .RI ( libc ", " \-lc )
16 .SH SYNOPSIS
17 .nf
18 .B #include <sched.h>
19 .PP
20 .BI "int sched_get_priority_max(int " policy );
21 .BI "int sched_get_priority_min(int " policy );
22 .fi
23 .SH DESCRIPTION
24 .BR sched_get_priority_max ()
25 returns the maximum priority value that can be used with the
26 scheduling algorithm identified by
27 .IR policy .
28 .BR sched_get_priority_min ()
29 returns the minimum priority value that can be used with the
30 scheduling algorithm identified by
31 .IR policy .
32 Supported
33 .I policy
34 values are
35 .BR SCHED_FIFO ,
36 .BR SCHED_RR ,
37 .BR SCHED_OTHER ,
38 .BR SCHED_BATCH ,
39 .BR SCHED_IDLE ,
40 and
41 .BR SCHED_DEADLINE .
42 Further details about these policies can be found in
43 .BR sched (7).
44 .PP
45 Processes with numerically higher priority values are scheduled before
46 processes with numerically lower priority values.
47 Thus, the value
48 returned by
49 .BR sched_get_priority_max ()
50 will be greater than the
51 value returned by
52 .BR sched_get_priority_min ().
53 .PP
54 Linux allows the static priority range 1 to 99 for the
55 .B SCHED_FIFO
56 and
57 .B SCHED_RR
58 policies, and the priority 0 for the remaining policies.
59 Scheduling priority ranges for the various policies
60 are not alterable.
61 .PP
62 The range of scheduling priorities may vary on other POSIX systems,
63 thus it is a good idea for portable applications to use a virtual
64 priority range and map it to the interval given by
65 .BR sched_get_priority_max ()
66 and
67 .BR sched_get_priority_min ()
68 POSIX.1 requires
69 .\" POSIX.1-2001, POSIX.1-2008 (XBD 2.8.4)
70 a spread of at least 32 between the maximum and the minimum values for
71 .B SCHED_FIFO
72 and
73 .BR SCHED_RR .
74 .PP
75 POSIX systems on which
76 .BR sched_get_priority_max ()
77 and
78 .BR sched_get_priority_min ()
79 are available define
80 .B _POSIX_PRIORITY_SCHEDULING
81 in
82 .IR <unistd.h> .
83 .SH RETURN VALUE
84 On success,
85 .BR sched_get_priority_max ()
86 and
87 .BR sched_get_priority_min ()
88 return the maximum/minimum priority value for the named scheduling
89 policy.
90 On error, \-1 is returned, and
91 .I errno
92 is set to indicate the error.
93 .SH ERRORS
94 .TP
95 .B EINVAL
96 The argument
97 .I policy
98 does not identify a defined scheduling policy.
99 .SH STANDARDS
100 POSIX.1-2001, POSIX.1-2008.
101 .SH SEE ALSO
102 .ad l
103 .nh
104 .BR sched_getaffinity (2),
105 .BR sched_getparam (2),
106 .BR sched_getscheduler (2),
107 .BR sched_setaffinity (2),
108 .BR sched_setparam (2),
109 .BR sched_setscheduler (2),
110 .BR sched (7)