execve.2: SEE ALSO: getauxval(3)
[man-pages.git] / man2 / sched_rr_get_interval.2
blob93db938df585592ace265109f4b20bae2e03f894
1 .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
2 .\"
3 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, see
21 .\" <http://www.gnu.org/licenses/>.
22 .\" %%%LICENSE_END
23 .\"
24 .\" 1996-04-01 Tom Bjorkholm <tomb@mydata.se>
25 .\"            First version written
26 .\" 1996-04-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
27 .\"            revision
28 .\"
29 .TH SCHED_RR_GET_INTERVAL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
30 .SH NAME
31 sched_rr_get_interval \- get the SCHED_RR interval for the named process
32 .SH SYNOPSIS
33 .nf
34 .B #include <sched.h>
35 .PP
36 .BI "int sched_rr_get_interval(pid_t " pid ", struct timespec *" tp );
37 .fi
38 .SH DESCRIPTION
39 .BR sched_rr_get_interval ()
40 writes into the
41 .I timespec
42 structure pointed to by
43 .I tp
44 the round-robin time quantum for the process identified by
45 .IR pid .
46 The specified process should be running under the
47 .B SCHED_RR
48 scheduling policy.
49 .PP
50 The
51 .I timespec
52 structure has the following form:
53 .PP
54 .in +4n
55 .EX
56 struct timespec {
57     time_t tv_sec;    /* seconds */
58     long   tv_nsec;   /* nanoseconds */
60 .EE
61 .in
62 .PP
64 .I pid
65 is zero, the time quantum for the calling process is written into
66 .IR *tp .
67 .\" FIXME . On Linux, sched_rr_get_interval()
68 .\" returns the timeslice for SCHED_OTHER processes -- this timeslice
69 .\" is influenced by the nice value.
70 .\" For SCHED_FIFO processes, this always returns 0.
71 .\"
72 .\" The round-robin time quantum value is not alterable under Linux
73 .\" 1.3.81.
74 .\"
75 .SH RETURN VALUE
76 On success,
77 .BR sched_rr_get_interval ()
78 returns 0.
79 On error, \-1 is returned, and
80 .I errno
81 is set to indicate the error.
82 .SH ERRORS
83 .TP
84 .B EFAULT
85 Problem with copying information to user space.
86 .TP
87 .B EINVAL
88 Invalid pid.
89 .TP
90 .B ENOSYS
91 The system call is not yet implemented (only on rather old kernels).
92 .TP
93 .B ESRCH
94 Could not find a process with the ID
95 .IR pid .
96 .SH CONFORMING TO
97 POSIX.1-2001, POSIX.1-2008.
98 .SH NOTES
99 POSIX systems on which
100 .BR sched_rr_get_interval ()
101 is available define
102 .B _POSIX_PRIORITY_SCHEDULING
104 .IR <unistd.h> .
105 .SS Linux notes
106 POSIX does not specify any mechanism for controlling the size of the
107 round-robin time quantum.
108 Older Linux kernels provide a (nonportable) method of doing this.
109 The quantum can be controlled by adjusting the process's nice value (see
110 .BR setpriority (2)).
111 Assigning a negative (i.e., high) nice value results in a longer quantum;
112 assigning a positive (i.e., low) nice value results in a shorter quantum.
113 The default quantum is 0.1 seconds;
114 the degree to which changing the nice value affects the
115 quantum has varied somewhat across kernel versions.
116 This method of adjusting the quantum was removed
117 .\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
118 starting with Linux 2.6.24.
120 Linux 3.9 added
121 .\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee
122 a new mechanism for adjusting (and viewing) the
123 .BR SCHED_RR
124 quantum: the
125 .I /proc/sys/kernel/sched_rr_timeslice_ms
126 file exposes the quantum as a millisecond value, whose default is 100.
127 Writing 0 to this file resets the quantum to the default value.
128 .\" .SH BUGS
129 .\" As of Linux 1.3.81
130 .\" .BR sched_rr_get_interval ()
131 .\" returns with error
132 .\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested
133 .\" properly.
134 .SH SEE ALSO
135 .BR sched (7)