]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) Tom Bjorkholm & Markus Kuhn, 1996 |
2 | .\" | |
1dd72f9c | 3 | .\" %%%LICENSE_START(GPLv2+_DOC_FULL) |
fea681da MK |
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 | |
c715f741 MK |
20 | .\" License along with this manual; if not, see |
21 | .\" <http://www.gnu.org/licenses/>. | |
6a8d8745 | 22 | .\" %%%LICENSE_END |
fea681da MK |
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 | .\" | |
4b8c67d9 | 29 | .TH SCHED_RR_GET_INTERVAL 2 2017-09-15 "Linux" "Linux Programmer's Manual" |
fea681da | 30 | .SH NAME |
273691af | 31 | sched_rr_get_interval \- get the SCHED_RR interval for the named process |
fea681da MK |
32 | .SH SYNOPSIS |
33 | .B #include <sched.h> | |
68e4db0a | 34 | .PP |
70bdb9b5 | 35 | .BI "int sched_rr_get_interval(pid_t " pid ", struct timespec *" tp ); |
fea681da | 36 | .SH DESCRIPTION |
e511ffb6 | 37 | .BR sched_rr_get_interval () |
ca016ea9 MK |
38 | writes into the |
39 | .I timespec | |
40 | structure pointed to by | |
41 | .I tp | |
42 | the round-robin time quantum for the process identified by | |
43 | .IR pid . | |
4e2621b5 MK |
44 | The specified process should be running under the |
45 | .B SCHED_RR | |
46 | scheduling policy. | |
efeece04 | 47 | .PP |
ca016ea9 MK |
48 | The |
49 | .I timespec | |
50 | structure has the following form: | |
efeece04 | 51 | .PP |
088a639b | 52 | .in +4n |
b8302363 | 53 | .EX |
1bef0ec2 MK |
54 | struct timespec { |
55 | time_t tv_sec; /* seconds */ | |
56 | long tv_nsec; /* nanoseconds */ | |
57 | }; | |
b8302363 | 58 | .EE |
273691af | 59 | .in |
efeece04 | 60 | .PP |
1bef0ec2 | 61 | If |
ca016ea9 MK |
62 | .I pid |
63 | is zero, the time quantum for the calling process is written into | |
64 | .IR *tp . | |
8d30cbf4 MK |
65 | .\" FIXME . On Linux, sched_rr_get_interval() |
66 | .\" returns the timeslice for SCHED_OTHER processes -- this timeslice | |
67 | .\" is influenced by the nice value. | |
68 | .\" For SCHED_FIFO processes, this always returns 0. | |
69 | .\" | |
273691af MK |
70 | .\" The round-robin time quantum value is not alterable under Linux |
71 | .\" 1.3.81. | |
c13182ef | 72 | .\" |
47297adb | 73 | .SH RETURN VALUE |
fea681da | 74 | On success, |
e511ffb6 | 75 | .BR sched_rr_get_interval () |
fea681da MK |
76 | returns 0. |
77 | On error, \-1 is returned, and | |
78 | .I errno | |
79 | is set appropriately. | |
80 | .SH ERRORS | |
81 | .TP | |
82 | .B EFAULT | |
7fac88a9 | 83 | Problem with copying information to user space. |
fea681da MK |
84 | .TP |
85 | .B EINVAL | |
86 | Invalid pid. | |
87 | .TP | |
88 | .B ENOSYS | |
273691af | 89 | The system call is not yet implemented (only on rather old kernels). |
fea681da MK |
90 | .TP |
91 | .B ESRCH | |
585d3814 MK |
92 | Could not find a process with the ID |
93 | .IR pid . | |
47297adb | 94 | .SH CONFORMING TO |
8e408b23 | 95 | POSIX.1-2001, POSIX.1-2008. |
4fb31341 | 96 | .SH NOTES |
4e2621b5 MK |
97 | POSIX systems on which |
98 | .BR sched_rr_get_interval () | |
99 | is available define | |
100 | .B _POSIX_PRIORITY_SCHEDULING | |
ca016ea9 MK |
101 | in |
102 | .IR <unistd.h> . | |
c634028a | 103 | .SS Linux notes |
273691af MK |
104 | POSIX does not specify any mechanism for controlling the size of the |
105 | round-robin time quantum. | |
45b4eda6 | 106 | Older Linux kernels provide a (nonportable) method of doing this. |
273691af MK |
107 | The quantum can be controlled by adjusting the process's nice value (see |
108 | .BR setpriority (2)). | |
109 | Assigning a negative (i.e., high) nice value results in a longer quantum; | |
110 | assigning a positive (i.e., low) nice value results in a shorter quantum. | |
111 | The default quantum is 0.1 seconds; | |
c13182ef | 112 | the degree to which changing the nice value affects the |
273691af | 113 | quantum has varied somewhat across kernel versions. |
65656807 | 114 | This method of adjusting the quantum was removed |
45b4eda6 | 115 | .\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c |
65656807 | 116 | starting with Linux 2.6.24. |
efeece04 | 117 | .PP |
65656807 MK |
118 | Linux 3.9 added |
119 | .\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee | |
120 | a new mechanism for adjusting (and viewing) the | |
45b4eda6 | 121 | .BR SCHED_RR |
65656807 MK |
122 | quantum: the |
123 | .I /proc/sys/kernel/sched_rr_timeslice_ms | |
124 | file exposes the quantum as a millisecond value, whose default is 100. | |
125 | Writing 0 to this file resets the quantum to the default value. | |
273691af | 126 | .\" .SH BUGS |
988db661 | 127 | .\" As of Linux 1.3.81 |
a4401275 MK |
128 | .\" .BR sched_rr_get_interval () |
129 | .\" returns with error | |
273691af MK |
130 | .\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested |
131 | .\" properly. | |
47297adb | 132 | .SH SEE ALSO |
5f8e6418 | 133 | .BR sched (7) |