OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / 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 2007-04-06 "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 \fItimespec\fP structure pointed to by \fItp\fP the
40 round-robin time quantum for the process identified by \fIpid\fP.
41
42 The \fItimespec\fP structure has the following form:
43
44 .in +4n
45 .nf
46 struct timespec {
47     time_t tv_sec;    /* seconds */
48     long   tv_nsec;   /* nanoseconds */
49 };
50 .fi
51 .in
52
53 If
54 \fIpid\fP is zero, the time quantum for the calling process is written
55 into \fI*tp\fP.
56 The identified process should be running under the
57 .B SCHED_RR
58 scheduling policy.
59 .\" FIXME . On Linux, sched_rr_get_interval()
60 .\" returns the timeslice for SCHED_OTHER processes -- this timeslice
61 .\" is influenced by the nice value.
62 .\" For SCHED_FIFO processes, this always returns 0.
63 .\"
64 .\" The round-robin time quantum value is not alterable under Linux
65 .\" 1.3.81.
66 .\"
67 POSIX systems on which
68 .BR sched_rr_get_interval ()
69 is available define
70 .B _POSIX_PRIORITY_SCHEDULING
71 in \fI<unistd.h>\fP.
72 .SH "RETURN VALUE"
73 On success,
74 .BR sched_rr_get_interval ()
75 returns 0.
76 On error, \-1 is returned, and
77 .I errno
78 is set appropriately.
79 .SH ERRORS
80 .TP
81 .B EFAULT
82 Problem with copying information to userspace.
83 .TP
84 .B EINVAL
85 Invalid pid.
86 .TP
87 .B ENOSYS
88 The system call is not yet implemented (only on rather old kernels).
89 .TP
90 .B ESRCH
91 The process whose ID is \fIpid\fP could not be found.
92 .SH "CONFORMING TO"
93 POSIX.1-2001.
94 .SH NOTES
95 .SS Linux Notes
96 .\" FIXME
97 .\" From at least Linux 2.6.9, the following is no longer true
98 .\" for SCHED_RR processes.  For RR processes the timeslice is always
99 .\" DEF_TIMESLICE, or 0.1 secs.
100 .\" Was the following really true for older kernels?
101 .\" Must build a 2.6.8 kernel and retest, and rewrite the following text
102 .\" appropriately.
103 POSIX does not specify any mechanism for controlling the size of the
104 round-robin time quantum.
105 However, Linux provides a (nonportable) method of doing this.
106 The quantum can be controlled by adjusting the process's nice value (see
107 .BR setpriority (2)).
108 Assigning a negative (i.e., high) nice value results in a longer quantum;
109 assigning a positive (i.e., low) nice value results in a shorter quantum.
110 The default quantum is 0.1 seconds;
111 the degree to which changing the nice value affects the
112 quantum has varied somewhat across kernel versions.
113 .\" .SH BUGS
114 .\" As of Linux 1.3.81
115 .\" .BR sched_rr_get_interval ()
116 .\" returns with error
117 .\" ENOSYS, because SCHED_RR has not yet been fully implemented and tested
118 .\" properly.
119 .SH "SEE ALSO"
120 .BR sched_setscheduler (2)
121 has a description of the Linux scheduling scheme.
122 .PP
123 .I Programming for the real world \- POSIX.4
124 by Bill O. Gallmeister, O'Reilly & Associates, Inc., ISBN 1-56592-074-0