]>
Commit | Line | Data |
---|---|---|
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 | 12 | sched_rr_get_interval \- get the SCHED_RR interval for the named process |
c655057f AC |
13 | .SH LIBRARY |
14 | Standard C library | |
8fc3b2cf | 15 | .RI ( libc ", " \-lc ) |
fea681da | 16 | .SH SYNOPSIS |
c7db92b9 | 17 | .nf |
fea681da | 18 | .B #include <sched.h> |
68e4db0a | 19 | .PP |
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 | 24 | writes into the |
e97e048a | 25 | .BR timespec (3) |
ca016ea9 MK |
26 | structure pointed to by |
27 | .I tp | |
28 | the round-robin time quantum for the process identified by | |
29 | .IR pid . | |
4e2621b5 MK |
30 | The specified process should be running under the |
31 | .B SCHED_RR | |
32 | scheduling policy. | |
efeece04 | 33 | .PP |
1bef0ec2 | 34 | If |
ca016ea9 MK |
35 | .I pid |
36 | is 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 | 47 | On success, |
e511ffb6 | 48 | .BR sched_rr_get_interval () |
fea681da MK |
49 | returns 0. |
50 | On error, \-1 is returned, and | |
51 | .I errno | |
f6a4078b | 52 | is set to indicate the error. |
fea681da MK |
53 | .SH ERRORS |
54 | .TP | |
55 | .B EFAULT | |
7fac88a9 | 56 | Problem with copying information to user space. |
fea681da MK |
57 | .TP |
58 | .B EINVAL | |
59 | Invalid pid. | |
60 | .TP | |
61 | .B ENOSYS | |
273691af | 62 | The system call is not yet implemented (only on rather old kernels). |
fea681da MK |
63 | .TP |
64 | .B ESRCH | |
585d3814 MK |
65 | Could not find a process with the ID |
66 | .IR pid . | |
3113c7f3 | 67 | .SH STANDARDS |
8e408b23 | 68 | POSIX.1-2001, POSIX.1-2008. |
4fb31341 | 69 | .SH NOTES |
4e2621b5 MK |
70 | POSIX systems on which |
71 | .BR sched_rr_get_interval () | |
72 | is available define | |
73 | .B _POSIX_PRIORITY_SCHEDULING | |
ca016ea9 MK |
74 | in |
75 | .IR <unistd.h> . | |
c634028a | 76 | .SS Linux notes |
273691af MK |
77 | POSIX does not specify any mechanism for controlling the size of the |
78 | round-robin time quantum. | |
45b4eda6 | 79 | Older Linux kernels provide a (nonportable) method of doing this. |
273691af MK |
80 | The quantum can be controlled by adjusting the process's nice value (see |
81 | .BR setpriority (2)). | |
82 | Assigning a negative (i.e., high) nice value results in a longer quantum; | |
83 | assigning a positive (i.e., low) nice value results in a shorter quantum. | |
84 | The default quantum is 0.1 seconds; | |
c13182ef | 85 | the degree to which changing the nice value affects the |
273691af | 86 | quantum has varied somewhat across kernel versions. |
65656807 | 87 | This method of adjusting the quantum was removed |
45b4eda6 | 88 | .\" commit a4ec24b48ddef1e93f7578be53270f0b95ad666c |
65656807 | 89 | starting with Linux 2.6.24. |
efeece04 | 90 | .PP |
65656807 MK |
91 | Linux 3.9 added |
92 | .\" commit ce0dbbbb30aee6a835511d5be446462388ba9eee | |
93 | a new mechanism for adjusting (and viewing) the | |
1ae6b2c7 | 94 | .B SCHED_RR |
65656807 MK |
95 | quantum: the |
96 | .I /proc/sys/kernel/sched_rr_timeslice_ms | |
97 | file exposes the quantum as a millisecond value, whose default is 100. | |
98 | Writing 0 to this file resets the quantum to the default value. | |
273691af | 99 | .\" .SH BUGS |
988db661 | 100 | .\" As of Linux 1.3.81 |
a4401275 MK |
101 | .\" .BR sched_rr_get_interval () |
102 | .\" returns with error | |
273691af MK |
103 | .\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested |
104 | .\" properly. | |
47297adb | 105 | .SH SEE ALSO |
e97e048a | 106 | .BR timespec (3), |
5f8e6418 | 107 | .BR sched (7) |