OSDN Git Service

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