2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
31 * All Rights Reserved.
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 #ifndef _MACH_POLICY_H_
57 #define _MACH_POLICY_H_
62 * Definitions for scheduing policy.
64 * N.B. The interfaces defined here are all obsolete!!
67 #include <mach/boolean.h>
68 #include <mach/vm_types.h>
70 #include <sys/appleapiopts.h>
73 * Old scheduling control interface
76 typedef integer_t
*policy_info_t
;
77 typedef integer_t
*policy_base_t
;
78 typedef integer_t
*policy_limit_t
;
80 #ifdef __APPLE_API_UNSTABLE
83 * Policy definitions. Policies should be powers of 2,
84 * but cannot be or'd together other than to test for a
87 #define POLICY_NULL 0 /* none */
88 #define POLICY_TIMESHARE 1 /* timesharing */
89 #define POLICY_RR 2 /* fixed round robin */
90 #define POLICY_FIFO 4 /* fixed fifo */
92 #define __NEW_SCHEDULING_FRAMEWORK__
95 * Check if policy is of 'class' fixed-priority.
97 #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO)
100 * Check if policy is valid.
102 #define invalid_policy(policy) \
103 ((policy) != POLICY_TIMESHARE && \
104 (policy) != POLICY_RR && \
105 (policy) != POLICY_FIFO)
109 * Types for TIMESHARE policy
111 struct policy_timeshare_base
{
112 integer_t base_priority
;
114 struct policy_timeshare_limit
{
115 integer_t max_priority
;
117 struct policy_timeshare_info
{
118 integer_t max_priority
;
119 integer_t base_priority
;
120 integer_t cur_priority
;
122 integer_t depress_priority
;
125 typedef struct policy_timeshare_base
*policy_timeshare_base_t
;
126 typedef struct policy_timeshare_limit
*policy_timeshare_limit_t
;
127 typedef struct policy_timeshare_info
*policy_timeshare_info_t
;
129 typedef struct policy_timeshare_base policy_timeshare_base_data_t
;
130 typedef struct policy_timeshare_limit policy_timeshare_limit_data_t
;
131 typedef struct policy_timeshare_info policy_timeshare_info_data_t
;
134 #define POLICY_TIMESHARE_BASE_COUNT \
135 (sizeof(struct policy_timeshare_base)/sizeof(integer_t))
136 #define POLICY_TIMESHARE_LIMIT_COUNT \
137 (sizeof(struct policy_timeshare_limit)/sizeof(integer_t))
138 #define POLICY_TIMESHARE_INFO_COUNT \
139 (sizeof(struct policy_timeshare_info)/sizeof(integer_t))
143 * Types for the ROUND ROBIN (RR) policy
145 struct policy_rr_base
{
146 integer_t base_priority
;
149 struct policy_rr_limit
{
150 integer_t max_priority
;
152 struct policy_rr_info
{
153 integer_t max_priority
;
154 integer_t base_priority
;
157 integer_t depress_priority
;
160 typedef struct policy_rr_base
*policy_rr_base_t
;
161 typedef struct policy_rr_limit
*policy_rr_limit_t
;
162 typedef struct policy_rr_info
*policy_rr_info_t
;
164 typedef struct policy_rr_base policy_rr_base_data_t
;
165 typedef struct policy_rr_limit policy_rr_limit_data_t
;
166 typedef struct policy_rr_info policy_rr_info_data_t
;
168 #define POLICY_RR_BASE_COUNT \
169 (sizeof(struct policy_rr_base)/sizeof(integer_t))
170 #define POLICY_RR_LIMIT_COUNT \
171 (sizeof(struct policy_rr_limit)/sizeof(integer_t))
172 #define POLICY_RR_INFO_COUNT \
173 (sizeof(struct policy_rr_info)/sizeof(integer_t))
177 * Types for the FIRST-IN-FIRST-OUT (FIFO) policy
179 struct policy_fifo_base
{
180 integer_t base_priority
;
182 struct policy_fifo_limit
{
183 integer_t max_priority
;
185 struct policy_fifo_info
{
186 integer_t max_priority
;
187 integer_t base_priority
;
189 integer_t depress_priority
;
192 typedef struct policy_fifo_base
*policy_fifo_base_t
;
193 typedef struct policy_fifo_limit
*policy_fifo_limit_t
;
194 typedef struct policy_fifo_info
*policy_fifo_info_t
;
196 typedef struct policy_fifo_base policy_fifo_base_data_t
;
197 typedef struct policy_fifo_limit policy_fifo_limit_data_t
;
198 typedef struct policy_fifo_info policy_fifo_info_data_t
;
200 #define POLICY_FIFO_BASE_COUNT \
201 (sizeof(struct policy_fifo_base)/sizeof(integer_t))
202 #define POLICY_FIFO_LIMIT_COUNT \
203 (sizeof(struct policy_fifo_limit)/sizeof(integer_t))
204 #define POLICY_FIFO_INFO_COUNT \
205 (sizeof(struct policy_fifo_info)/sizeof(integer_t))
208 * Aggregate policy types
211 struct policy_bases
{
212 policy_timeshare_base_data_t ts
;
213 policy_rr_base_data_t rr
;
214 policy_fifo_base_data_t fifo
;
217 struct policy_limits
{
218 policy_timeshare_limit_data_t ts
;
219 policy_rr_limit_data_t rr
;
220 policy_fifo_limit_data_t fifo
;
223 struct policy_infos
{
224 policy_timeshare_info_data_t ts
;
225 policy_rr_info_data_t rr
;
226 policy_fifo_info_data_t fifo
;
229 typedef struct policy_bases policy_base_data_t
;
230 typedef struct policy_limits policy_limit_data_t
;
231 typedef struct policy_infos policy_info_data_t
;
233 #endif /* __APPLE_API_UNSTABLE */
235 #endif /* _MACH_POLICY_H_ */