2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
36 * All Rights Reserved.
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
61 #ifndef _MACH_POLICY_H_
62 #define _MACH_POLICY_H_
67 * Definitions for scheduing policy.
71 * All interfaces defined here are obsolete.
74 #include <mach/boolean.h>
75 #include <mach/message.h>
76 #include <mach/vm_types.h>
79 * Old scheduling control interface
82 typedef integer_t
*policy_info_t
;
83 typedef integer_t
*policy_base_t
;
84 typedef integer_t
*policy_limit_t
;
87 * Policy definitions. Policies should be powers of 2,
88 * but cannot be or'd together other than to test for a
91 #define POLICY_NULL 0 /* none */
92 #define POLICY_TIMESHARE 1 /* timesharing */
93 #define POLICY_RR 2 /* fixed round robin */
94 #define POLICY_FIFO 4 /* fixed fifo */
96 #define __NEW_SCHEDULING_FRAMEWORK__
99 * Check if policy is of 'class' fixed-priority.
101 #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO)
104 * Check if policy is valid.
106 #define invalid_policy(policy) \
107 ((policy) != POLICY_TIMESHARE && \
108 (policy) != POLICY_RR && \
109 (policy) != POLICY_FIFO)
113 * Types for TIMESHARE policy
115 struct policy_timeshare_base
{
116 integer_t base_priority
;
118 struct policy_timeshare_limit
{
119 integer_t max_priority
;
121 struct policy_timeshare_info
{
122 integer_t max_priority
;
123 integer_t base_priority
;
124 integer_t cur_priority
;
126 integer_t depress_priority
;
129 typedef struct policy_timeshare_base
*policy_timeshare_base_t
;
130 typedef struct policy_timeshare_limit
*policy_timeshare_limit_t
;
131 typedef struct policy_timeshare_info
*policy_timeshare_info_t
;
133 typedef struct policy_timeshare_base policy_timeshare_base_data_t
;
134 typedef struct policy_timeshare_limit policy_timeshare_limit_data_t
;
135 typedef struct policy_timeshare_info policy_timeshare_info_data_t
;
138 #define POLICY_TIMESHARE_BASE_COUNT ((mach_msg_type_number_t) \
139 (sizeof(struct policy_timeshare_base)/sizeof(integer_t)))
140 #define POLICY_TIMESHARE_LIMIT_COUNT ((mach_msg_type_number_t) \
141 (sizeof(struct policy_timeshare_limit)/sizeof(integer_t)))
142 #define POLICY_TIMESHARE_INFO_COUNT ((mach_msg_type_number_t) \
143 (sizeof(struct policy_timeshare_info)/sizeof(integer_t)))
147 * Types for the ROUND ROBIN (RR) policy
149 struct policy_rr_base
{
150 integer_t base_priority
;
153 struct policy_rr_limit
{
154 integer_t max_priority
;
156 struct policy_rr_info
{
157 integer_t max_priority
;
158 integer_t base_priority
;
161 integer_t depress_priority
;
164 typedef struct policy_rr_base
*policy_rr_base_t
;
165 typedef struct policy_rr_limit
*policy_rr_limit_t
;
166 typedef struct policy_rr_info
*policy_rr_info_t
;
168 typedef struct policy_rr_base policy_rr_base_data_t
;
169 typedef struct policy_rr_limit policy_rr_limit_data_t
;
170 typedef struct policy_rr_info policy_rr_info_data_t
;
172 #define POLICY_RR_BASE_COUNT ((mach_msg_type_number_t) \
173 (sizeof(struct policy_rr_base)/sizeof(integer_t)))
174 #define POLICY_RR_LIMIT_COUNT ((mach_msg_type_number_t) \
175 (sizeof(struct policy_rr_limit)/sizeof(integer_t)))
176 #define POLICY_RR_INFO_COUNT ((mach_msg_type_number_t) \
177 (sizeof(struct policy_rr_info)/sizeof(integer_t)))
181 * Types for the FIRST-IN-FIRST-OUT (FIFO) policy
183 struct policy_fifo_base
{
184 integer_t base_priority
;
186 struct policy_fifo_limit
{
187 integer_t max_priority
;
189 struct policy_fifo_info
{
190 integer_t max_priority
;
191 integer_t base_priority
;
193 integer_t depress_priority
;
196 typedef struct policy_fifo_base
*policy_fifo_base_t
;
197 typedef struct policy_fifo_limit
*policy_fifo_limit_t
;
198 typedef struct policy_fifo_info
*policy_fifo_info_t
;
200 typedef struct policy_fifo_base policy_fifo_base_data_t
;
201 typedef struct policy_fifo_limit policy_fifo_limit_data_t
;
202 typedef struct policy_fifo_info policy_fifo_info_data_t
;
204 #define POLICY_FIFO_BASE_COUNT ((mach_msg_type_number_t) \
205 (sizeof(struct policy_fifo_base)/sizeof(integer_t)))
206 #define POLICY_FIFO_LIMIT_COUNT ((mach_msg_type_number_t) \
207 (sizeof(struct policy_fifo_limit)/sizeof(integer_t)))
208 #define POLICY_FIFO_INFO_COUNT ((mach_msg_type_number_t) \
209 (sizeof(struct policy_fifo_info)/sizeof(integer_t)))
212 * Aggregate policy types
215 struct policy_bases
{
216 policy_timeshare_base_data_t ts
;
217 policy_rr_base_data_t rr
;
218 policy_fifo_base_data_t fifo
;
221 struct policy_limits
{
222 policy_timeshare_limit_data_t ts
;
223 policy_rr_limit_data_t rr
;
224 policy_fifo_limit_data_t fifo
;
227 struct policy_infos
{
228 policy_timeshare_info_data_t ts
;
229 policy_rr_info_data_t rr
;
230 policy_fifo_info_data_t fifo
;
233 typedef struct policy_bases policy_base_data_t
;
234 typedef struct policy_limits policy_limit_data_t
;
235 typedef struct policy_infos policy_info_data_t
;
237 #endif /* _MACH_POLICY_H_ */