2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
46 * Carnegie Mellon requests users of this software to return to
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
59 #ifndef _MACH_POLICY_H_
60 #define _MACH_POLICY_H_
65 * Definitions for scheduing policy.
69 * All interfaces defined here are obsolete.
72 #include <mach/boolean.h>
73 #include <mach/message.h>
74 #include <mach/vm_types.h>
77 * Old scheduling control interface
80 typedef integer_t
*policy_info_t
;
81 typedef integer_t
*policy_base_t
;
82 typedef integer_t
*policy_limit_t
;
85 * Policy definitions. Policies should be powers of 2,
86 * but cannot be or'd together other than to test for a
89 #define POLICY_NULL 0 /* none */
90 #define POLICY_TIMESHARE 1 /* timesharing */
91 #define POLICY_RR 2 /* fixed round robin */
92 #define POLICY_FIFO 4 /* fixed fifo */
94 #define __NEW_SCHEDULING_FRAMEWORK__
97 * Check if policy is of 'class' fixed-priority.
99 #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO)
102 * Check if policy is valid.
104 #define invalid_policy(policy) \
105 ((policy) != POLICY_TIMESHARE && \
106 (policy) != POLICY_RR && \
107 (policy) != POLICY_FIFO)
111 * Types for TIMESHARE policy
113 struct policy_timeshare_base
{
114 integer_t base_priority
;
116 struct policy_timeshare_limit
{
117 integer_t max_priority
;
119 struct policy_timeshare_info
{
120 integer_t max_priority
;
121 integer_t base_priority
;
122 integer_t cur_priority
;
124 integer_t depress_priority
;
127 typedef struct policy_timeshare_base
*policy_timeshare_base_t
;
128 typedef struct policy_timeshare_limit
*policy_timeshare_limit_t
;
129 typedef struct policy_timeshare_info
*policy_timeshare_info_t
;
131 typedef struct policy_timeshare_base policy_timeshare_base_data_t
;
132 typedef struct policy_timeshare_limit policy_timeshare_limit_data_t
;
133 typedef struct policy_timeshare_info policy_timeshare_info_data_t
;
136 #define POLICY_TIMESHARE_BASE_COUNT ((mach_msg_type_number_t) \
137 (sizeof(struct policy_timeshare_base)/sizeof(integer_t)))
138 #define POLICY_TIMESHARE_LIMIT_COUNT ((mach_msg_type_number_t) \
139 (sizeof(struct policy_timeshare_limit)/sizeof(integer_t)))
140 #define POLICY_TIMESHARE_INFO_COUNT ((mach_msg_type_number_t) \
141 (sizeof(struct policy_timeshare_info)/sizeof(integer_t)))
145 * Types for the ROUND ROBIN (RR) policy
147 struct policy_rr_base
{
148 integer_t base_priority
;
151 struct policy_rr_limit
{
152 integer_t max_priority
;
154 struct policy_rr_info
{
155 integer_t max_priority
;
156 integer_t base_priority
;
159 integer_t depress_priority
;
162 typedef struct policy_rr_base
*policy_rr_base_t
;
163 typedef struct policy_rr_limit
*policy_rr_limit_t
;
164 typedef struct policy_rr_info
*policy_rr_info_t
;
166 typedef struct policy_rr_base policy_rr_base_data_t
;
167 typedef struct policy_rr_limit policy_rr_limit_data_t
;
168 typedef struct policy_rr_info policy_rr_info_data_t
;
170 #define POLICY_RR_BASE_COUNT ((mach_msg_type_number_t) \
171 (sizeof(struct policy_rr_base)/sizeof(integer_t)))
172 #define POLICY_RR_LIMIT_COUNT ((mach_msg_type_number_t) \
173 (sizeof(struct policy_rr_limit)/sizeof(integer_t)))
174 #define POLICY_RR_INFO_COUNT ((mach_msg_type_number_t) \
175 (sizeof(struct policy_rr_info)/sizeof(integer_t)))
179 * Types for the FIRST-IN-FIRST-OUT (FIFO) policy
181 struct policy_fifo_base
{
182 integer_t base_priority
;
184 struct policy_fifo_limit
{
185 integer_t max_priority
;
187 struct policy_fifo_info
{
188 integer_t max_priority
;
189 integer_t base_priority
;
191 integer_t depress_priority
;
194 typedef struct policy_fifo_base
*policy_fifo_base_t
;
195 typedef struct policy_fifo_limit
*policy_fifo_limit_t
;
196 typedef struct policy_fifo_info
*policy_fifo_info_t
;
198 typedef struct policy_fifo_base policy_fifo_base_data_t
;
199 typedef struct policy_fifo_limit policy_fifo_limit_data_t
;
200 typedef struct policy_fifo_info policy_fifo_info_data_t
;
202 #define POLICY_FIFO_BASE_COUNT ((mach_msg_type_number_t) \
203 (sizeof(struct policy_fifo_base)/sizeof(integer_t)))
204 #define POLICY_FIFO_LIMIT_COUNT ((mach_msg_type_number_t) \
205 (sizeof(struct policy_fifo_limit)/sizeof(integer_t)))
206 #define POLICY_FIFO_INFO_COUNT ((mach_msg_type_number_t) \
207 (sizeof(struct policy_fifo_info)/sizeof(integer_t)))
210 * Aggregate policy types
213 struct policy_bases
{
214 policy_timeshare_base_data_t ts
;
215 policy_rr_base_data_t rr
;
216 policy_fifo_base_data_t fifo
;
219 struct policy_limits
{
220 policy_timeshare_limit_data_t ts
;
221 policy_rr_limit_data_t rr
;
222 policy_fifo_limit_data_t fifo
;
225 struct policy_infos
{
226 policy_timeshare_info_data_t ts
;
227 policy_rr_info_data_t rr
;
228 policy_fifo_info_data_t fifo
;
231 typedef struct policy_bases policy_base_data_t
;
232 typedef struct policy_limits policy_limit_data_t
;
233 typedef struct policy_infos policy_info_data_t
;
235 #endif /* _MACH_POLICY_H_ */