Debian Codegraph @

upstream/debian-unstable/man2/sched_get_priority_max.2

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