Debian Codegraph @

upstream/debian-trixie/man2/sched_rr_get_interval.2

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