]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/sched_rr_get_interval.2
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man2 / sched_rr_get_interval.2
CommitLineData
fea681da
MK
1.\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996
2.\"
e4a74ca8 3.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da
MK
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.\"
4c1c5274 10.TH sched_rr_get_interval 2 (date) "Linux man-pages (unreleased)"
fea681da 11.SH NAME
273691af 12sched_rr_get_interval \- get the SCHED_RR interval for the named process
c655057f
AC
13.SH LIBRARY
14Standard C library
8fc3b2cf 15.RI ( libc ", " \-lc )
fea681da 16.SH SYNOPSIS
c7db92b9 17.nf
fea681da 18.B #include <sched.h>
c6d039a3 19.P
70bdb9b5 20.BI "int sched_rr_get_interval(pid_t " pid ", struct timespec *" tp );
c7db92b9 21.fi
fea681da 22.SH DESCRIPTION
e511ffb6 23.BR sched_rr_get_interval ()
ca016ea9 24writes into the
e97e048a 25.BR timespec (3)
ca016ea9
MK
26structure pointed to by
27.I tp
28the round-robin time quantum for the process identified by
29.IR pid .
4e2621b5
MK
30The specified process should be running under the
31.B SCHED_RR
32scheduling policy.
c6d039a3 33.P
1bef0ec2 34If
ca016ea9
MK
35.I pid
36is zero, the time quantum for the calling process is written into
37.IR *tp .
8d30cbf4
MK
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.\"
273691af
MK
43.\" The round-robin time quantum value is not alterable under Linux
44.\" 1.3.81.
c13182ef 45.\"
47297adb 46.SH RETURN VALUE
fea681da 47On success,
e511ffb6 48.BR sched_rr_get_interval ()
fea681da
MK
49returns 0.
50On error, \-1 is returned, and
51.I errno
f6a4078b 52is set to indicate the error.
fea681da
MK
53.SH ERRORS
54.TP
55.B EFAULT
7fac88a9 56Problem with copying information to user space.
fea681da
MK
57.TP
58.B EINVAL
59Invalid pid.
60.TP
61.B ENOSYS
273691af 62The system call is not yet implemented (only on rather old kernels).
fea681da
MK
63.TP
64.B ESRCH
585d3814
MK
65Could not find a process with the ID
66.IR pid .
4131356c
AC
67.SH VERSIONS
68.SS Linux
69Linux 3.9 added
70.\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee
71a new mechanism for adjusting (and viewing) the
72.B SCHED_RR
73quantum: the
74.I /proc/sys/kernel/sched_rr_timeslice_ms
75file exposes the quantum as a millisecond value, whose default is 100.
76Writing 0 to this file resets the quantum to the default value.
3113c7f3 77.SH STANDARDS
4131356c
AC
78POSIX.1-2008.
79.SH HISTORY
80POSIX.1-2001.
81.SS Linux
273691af
MK
82POSIX does not specify any mechanism for controlling the size of the
83round-robin time quantum.
45b4eda6 84Older Linux kernels provide a (nonportable) method of doing this.
273691af
MK
85The quantum can be controlled by adjusting the process's nice value (see
86.BR setpriority (2)).
87Assigning a negative (i.e., high) nice value results in a longer quantum;
88assigning a positive (i.e., low) nice value results in a shorter quantum.
89The default quantum is 0.1 seconds;
c13182ef 90the degree to which changing the nice value affects the
273691af 91quantum has varied somewhat across kernel versions.
65656807 92This method of adjusting the quantum was removed
45b4eda6 93.\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c
65656807 94starting with Linux 2.6.24.
4131356c
AC
95.SH NOTES
96POSIX systems on which
97.BR sched_rr_get_interval ()
98is available define
99.B _POSIX_PRIORITY_SCHEDULING
100in
101.IR <unistd.h> .
273691af 102.\" .SH BUGS
988db661 103.\" As of Linux 1.3.81
a4401275
MK
104.\" .BR sched_rr_get_interval ()
105.\" returns with error
273691af
MK
106.\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested
107.\" properly.
47297adb 108.SH SEE ALSO
e97e048a 109.BR timespec (3),
5f8e6418 110.BR sched (7)