Debian Codegraph @

upstream/debian-unstable/man2/sched_rr_get_interval.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_rr_get_interval 2 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 sched_rr_get_interval \- get the SCHED_RR interval for the named process
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_rr_get_interval(pid_t " pid ", struct timespec *" tp );
18 .fi
19 .SH DESCRIPTION
20 .BR sched_rr_get_interval ()
21 writes into the
22 .BR timespec (3)
23 structure pointed to by
24 .I tp
25 the round-robin time quantum for the process identified by
26 .IR pid .
27 The specified process should be running under the
28 .B SCHED_RR
29 scheduling policy.
30 .P
31 If
32 .I pid
33 is zero, the time quantum for the calling process is written into
34 .IR *tp .
35 .\" FIXME . On Linux, sched_rr_get_interval()
36 .\" returns the timeslice for SCHED_OTHER processes -- this timeslice
37 .\" is influenced by the nice value.
38 .\" For SCHED_FIFO processes, this always returns 0.
39 .\"
40 .\" The round-robin time quantum value is not alterable under Linux
41 .\" 1.3.81.
42 .\"
43 .SH RETURN VALUE
44 On success,
45 .BR sched_rr_get_interval ()
46 returns 0.
47 On error, \-1 is returned, and
48 .I errno
49 is set to indicate the error.
50 .SH ERRORS
51 .TP
52 .B EFAULT
53 Problem with copying information to user space.
54 .TP
55 .B EINVAL
56 Invalid
57 .IR pid .
58 .TP
59 .B ENOSYS
60 The system call is not yet implemented (only on rather old kernels).
61 .TP
62 .B ESRCH
63 Could not find a process with the ID
64 .IR pid .
65 .SH VERSIONS
66 .SS Linux
67 Linux 3.9 added
68 .\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee
69 a new mechanism for adjusting (and viewing) the
70 .B SCHED_RR
71 quantum: the
72 .I /proc/sys/kernel/sched_rr_timeslice_ms
73 file exposes the quantum as a millisecond value, whose default is 100.
74 Writing 0 to this file resets the quantum to the default value.
75 .SH STANDARDS
76 POSIX.1-2024.
77 .SH HISTORY
78 POSIX.1-2001.
79 .SS Linux
80 POSIX does not specify any mechanism for controlling the size of the
81 round-robin time quantum.
82 Older Linux kernels provide a (nonportable) method of doing this.
83 The quantum can be controlled by adjusting the process's nice value (see
84 .BR setpriority (2)).
85 Assigning a negative (i.e., high) nice value results in a longer quantum;
86 assigning a positive (i.e., low) nice value results in a shorter quantum.
87 The default quantum is 0.1 seconds;
88 the degree to which changing the nice value affects the
89 quantum has varied somewhat across kernel versions.
90 This method of adjusting the quantum was removed
91 .\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
92 starting with Linux 2.6.24.
93 .SH NOTES
94 POSIX systems on which
95 .BR sched_rr_get_interval ()
96 is available define
97 .B _POSIX_PRIORITY_SCHEDULING
98 in
99 .IR <unistd.h> .
100 .\" .SH BUGS
101 .\" As of Linux 1.3.81
102 .\" .BR sched_rr_get_interval ()
103 .\" returns with error
104 .\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested
105 .\" properly.
106 .SH SEE ALSO
107 .BR timespec (3),
108 .BR sched (7)