1 .\" $FreeBSD: src/lib/libc/sys/sched_setscheduler.2,v 1.3.2.9 2001/12/14 18:34:01 ru Exp $
2 .\" $DragonFly: src/lib/libc/sys/sched_setscheduler.2,v 1.4 2006/05/26 19:39:37 swildner Exp $
3 .\" Copyright (c) 1998 HD Associates, Inc.
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .Dt SCHED_SETSCHEDULER 2
31 .Nm sched_setscheduler ,
32 .Nm sched_getscheduler
33 .Nd set/get scheduling policy and scheduler parameters
39 .Fn sched_setscheduler "pid_t pid" "int policy" "const struct sched_param *param"
41 .Fn sched_getscheduler "pid_t pid"
44 .Fn sched_setscheduler
45 function sets the scheduling policy and scheduling parameters
46 of the process specified by
50 and the parameters specified in the
52 structure pointed to by
59 structure must be any integer within the inclusive priority range for
60 the scheduling policy specified by
63 In this implementation, if the value of
65 is negative the function will fail.
67 If a process specified by
69 exists and if the calling process has permission, the scheduling
70 policy and scheduling parameters will be set for the process
71 whose process ID is equal to
76 is zero, the scheduling policy and scheduling
77 parameters are set for the calling process.
79 In this implementation, the policy of when a process can affect
80 the scheduling parameters of another process is specified in
82 as a write-style operation.
84 The scheduling policies are in
86 .Bl -tag -width [SCHED_OTHER]
88 First-in-first-out fixed priority scheduling with no round robin scheduling;
90 The standard time sharing scheduler;
92 Round-robin scheduling across same priority processes.
97 structure is defined in
100 .Bd -literal -offset indent
102 int sched_priority; /* scheduling priority */
107 .Fn sched_getscheduler
108 function returns the scheduling policy of the process specified
112 If a process specified by
114 exists and if the calling process has permission,
115 the scheduling parameters for the process whose process ID is equal to
119 In this implementation, the policy of when a process can obtain the
120 scheduling parameters of another process are detailed in
122 as a read-style operation.
126 is zero, the scheduling parameters for the calling process will be
127 returned. In this implementation, the
128 .Fa sched_getscheduler
129 function will fail if
137 will be set to the corresponding value:
140 The system is not configured to support this functionality.
142 The requesting process doesn not have permission as detailed in
145 No process can be found corresponding to that specified by
150 parameter is invalid, or one or more of the parameters contained in
152 is outside the valid range for the specified scheduling policy.
155 .Xr sched_getparam 2 ,
156 .Xr sched_get_priority_max 2 ,
157 .Xr sched_get_priority_min 2 ,
158 .Xr sched_rr_get_interval 2 ,
159 .Xr sched_setparam 2 ,
163 .Fn sched_setscheduler
165 .Fn sched_getscheduler