]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 5 | * |
2d21ac55 A |
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. | |
0a7de745 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
0a7de745 | 31 | /* |
1c79356b A |
32 | * Mach Operating System |
33 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
34 | * All Rights Reserved. | |
0a7de745 | 35 | * |
1c79356b A |
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. | |
0a7de745 | 41 | * |
1c79356b A |
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. | |
0a7de745 | 45 | * |
1c79356b | 46 | * Carnegie Mellon requests users of this software to return to |
0a7de745 | 47 | * |
1c79356b A |
48 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
49 | * School of Computer Science | |
50 | * Carnegie Mellon University | |
51 | * Pittsburgh PA 15213-3890 | |
0a7de745 | 52 | * |
1c79356b A |
53 | * any improvements or extensions that they make and grant Carnegie Mellon |
54 | * the rights to redistribute these changes. | |
55 | */ | |
56 | /* | |
57 | */ | |
58 | ||
0a7de745 | 59 | #ifndef _MACH_POLICY_H_ |
1c79356b A |
60 | #define _MACH_POLICY_H_ |
61 | ||
62 | /* | |
63 | * mach/policy.h | |
64 | * | |
65 | * Definitions for scheduing policy. | |
91447636 A |
66 | */ |
67 | ||
68 | /* | |
69 | * All interfaces defined here are obsolete. | |
1c79356b A |
70 | */ |
71 | ||
72 | #include <mach/boolean.h> | |
91447636 | 73 | #include <mach/message.h> |
1c79356b A |
74 | #include <mach/vm_types.h> |
75 | ||
9bccf70c A |
76 | /* |
77 | * Old scheduling control interface | |
78 | */ | |
0a7de745 A |
79 | typedef int policy_t; |
80 | typedef integer_t *policy_info_t; | |
81 | typedef integer_t *policy_base_t; | |
82 | typedef integer_t *policy_limit_t; | |
9bccf70c | 83 | |
1c79356b A |
84 | /* |
85 | * Policy definitions. Policies should be powers of 2, | |
86 | * but cannot be or'd together other than to test for a | |
87 | * policy 'class'. | |
88 | */ | |
0a7de745 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 */ | |
1c79356b A |
93 | |
94 | #define __NEW_SCHEDULING_FRAMEWORK__ | |
95 | ||
96 | /* | |
97 | * Check if policy is of 'class' fixed-priority. | |
98 | */ | |
0a7de745 | 99 | #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO) |
1c79356b A |
100 | |
101 | /* | |
102 | * Check if policy is valid. | |
103 | */ | |
0a7de745 A |
104 | #define invalid_policy(policy) \ |
105 | ((policy) != POLICY_TIMESHARE && \ | |
106 | (policy) != POLICY_RR && \ | |
1c79356b A |
107 | (policy) != POLICY_FIFO) |
108 | ||
109 | ||
1c79356b | 110 | /* |
0a7de745 | 111 | * Types for TIMESHARE policy |
1c79356b | 112 | */ |
0a7de745 A |
113 | struct policy_timeshare_base { |
114 | integer_t base_priority; | |
1c79356b A |
115 | }; |
116 | struct policy_timeshare_limit { | |
0a7de745 | 117 | integer_t max_priority; |
1c79356b A |
118 | }; |
119 | struct policy_timeshare_info { | |
0a7de745 A |
120 | integer_t max_priority; |
121 | integer_t base_priority; | |
122 | integer_t cur_priority; | |
123 | boolean_t depressed; | |
124 | integer_t depress_priority; | |
1c79356b A |
125 | }; |
126 | ||
0a7de745 A |
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; | |
1c79356b | 130 | |
0a7de745 A |
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; | |
1c79356b A |
134 | |
135 | ||
0a7de745 | 136 | #define POLICY_TIMESHARE_BASE_COUNT ((mach_msg_type_number_t) \ |
91447636 | 137 | (sizeof(struct policy_timeshare_base)/sizeof(integer_t))) |
0a7de745 | 138 | #define POLICY_TIMESHARE_LIMIT_COUNT ((mach_msg_type_number_t) \ |
91447636 | 139 | (sizeof(struct policy_timeshare_limit)/sizeof(integer_t))) |
0a7de745 | 140 | #define POLICY_TIMESHARE_INFO_COUNT ((mach_msg_type_number_t) \ |
91447636 | 141 | (sizeof(struct policy_timeshare_info)/sizeof(integer_t))) |
1c79356b A |
142 | |
143 | ||
144 | /* | |
145 | * Types for the ROUND ROBIN (RR) policy | |
146 | */ | |
0a7de745 A |
147 | struct policy_rr_base { |
148 | integer_t base_priority; | |
149 | integer_t quantum; | |
1c79356b A |
150 | }; |
151 | struct policy_rr_limit { | |
0a7de745 | 152 | integer_t max_priority; |
1c79356b A |
153 | }; |
154 | struct policy_rr_info { | |
0a7de745 A |
155 | integer_t max_priority; |
156 | integer_t base_priority; | |
157 | integer_t quantum; | |
158 | boolean_t depressed; | |
159 | integer_t depress_priority; | |
1c79356b A |
160 | }; |
161 | ||
0a7de745 A |
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; | |
1c79356b | 165 | |
0a7de745 A |
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; | |
1c79356b | 169 | |
0a7de745 | 170 | #define POLICY_RR_BASE_COUNT ((mach_msg_type_number_t) \ |
91447636 | 171 | (sizeof(struct policy_rr_base)/sizeof(integer_t))) |
0a7de745 | 172 | #define POLICY_RR_LIMIT_COUNT ((mach_msg_type_number_t) \ |
91447636 | 173 | (sizeof(struct policy_rr_limit)/sizeof(integer_t))) |
0a7de745 | 174 | #define POLICY_RR_INFO_COUNT ((mach_msg_type_number_t) \ |
91447636 | 175 | (sizeof(struct policy_rr_info)/sizeof(integer_t))) |
1c79356b A |
176 | |
177 | ||
178 | /* | |
0a7de745 | 179 | * Types for the FIRST-IN-FIRST-OUT (FIFO) policy |
1c79356b | 180 | */ |
0a7de745 A |
181 | struct policy_fifo_base { |
182 | integer_t base_priority; | |
1c79356b A |
183 | }; |
184 | struct policy_fifo_limit { | |
0a7de745 | 185 | integer_t max_priority; |
1c79356b A |
186 | }; |
187 | struct policy_fifo_info { | |
0a7de745 A |
188 | integer_t max_priority; |
189 | integer_t base_priority; | |
190 | boolean_t depressed; | |
191 | integer_t depress_priority; | |
1c79356b A |
192 | }; |
193 | ||
0a7de745 A |
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; | |
1c79356b | 197 | |
0a7de745 A |
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; | |
1c79356b | 201 | |
0a7de745 | 202 | #define POLICY_FIFO_BASE_COUNT ((mach_msg_type_number_t) \ |
91447636 | 203 | (sizeof(struct policy_fifo_base)/sizeof(integer_t))) |
0a7de745 | 204 | #define POLICY_FIFO_LIMIT_COUNT ((mach_msg_type_number_t) \ |
91447636 | 205 | (sizeof(struct policy_fifo_limit)/sizeof(integer_t))) |
0a7de745 | 206 | #define POLICY_FIFO_INFO_COUNT ((mach_msg_type_number_t) \ |
91447636 | 207 | (sizeof(struct policy_fifo_info)/sizeof(integer_t))) |
1c79356b A |
208 | |
209 | /* | |
0a7de745 | 210 | * Aggregate policy types |
1c79356b A |
211 | */ |
212 | ||
213 | struct policy_bases { | |
0a7de745 A |
214 | policy_timeshare_base_data_t ts; |
215 | policy_rr_base_data_t rr; | |
216 | policy_fifo_base_data_t fifo; | |
1c79356b A |
217 | }; |
218 | ||
219 | struct policy_limits { | |
0a7de745 A |
220 | policy_timeshare_limit_data_t ts; |
221 | policy_rr_limit_data_t rr; | |
222 | policy_fifo_limit_data_t fifo; | |
1c79356b A |
223 | }; |
224 | ||
225 | struct policy_infos { | |
0a7de745 A |
226 | policy_timeshare_info_data_t ts; |
227 | policy_rr_info_data_t rr; | |
228 | policy_fifo_info_data_t fifo; | |
1c79356b A |
229 | }; |
230 | ||
0a7de745 A |
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; | |
1c79356b | 234 | |
0a7de745 | 235 | #endif /* _MACH_POLICY_H_ */ |