]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
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 | |
13 | * file. | |
14 | * | |
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 | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
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. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * @OSF_COPYRIGHT@ | |
27 | */ | |
28 | /* | |
29 | * Mach Operating System | |
30 | * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University | |
31 | * All Rights Reserved. | |
32 | * | |
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. | |
38 | * | |
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. | |
42 | * | |
43 | * Carnegie Mellon requests users of this software to return to | |
44 | * | |
45 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
46 | * School of Computer Science | |
47 | * Carnegie Mellon University | |
48 | * Pittsburgh PA 15213-3890 | |
49 | * | |
50 | * any improvements or extensions that they make and grant Carnegie Mellon | |
51 | * the rights to redistribute these changes. | |
52 | */ | |
53 | /* | |
54 | */ | |
55 | ||
56 | #ifndef _MACH_POLICY_H_ | |
57 | #define _MACH_POLICY_H_ | |
58 | ||
59 | /* | |
60 | * mach/policy.h | |
61 | * | |
62 | * Definitions for scheduing policy. | |
63 | * | |
64 | * N.B. The interfaces defined here are all obsolete!! | |
65 | */ | |
66 | ||
67 | #include <mach/boolean.h> | |
68 | #include <mach/vm_types.h> | |
69 | ||
9bccf70c A |
70 | #include <sys/appleapiopts.h> |
71 | ||
72 | /* | |
73 | * Old scheduling control interface | |
74 | */ | |
75 | typedef int policy_t; | |
76 | typedef integer_t *policy_info_t; | |
77 | typedef integer_t *policy_base_t; | |
78 | typedef integer_t *policy_limit_t; | |
79 | ||
80 | #ifdef __APPLE_API_UNSTABLE | |
81 | ||
1c79356b A |
82 | /* |
83 | * Policy definitions. Policies should be powers of 2, | |
84 | * but cannot be or'd together other than to test for a | |
85 | * policy 'class'. | |
86 | */ | |
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 */ | |
91 | ||
92 | #define __NEW_SCHEDULING_FRAMEWORK__ | |
93 | ||
94 | /* | |
95 | * Check if policy is of 'class' fixed-priority. | |
96 | */ | |
97 | #define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO) | |
98 | ||
99 | /* | |
100 | * Check if policy is valid. | |
101 | */ | |
102 | #define invalid_policy(policy) \ | |
103 | ((policy) != POLICY_TIMESHARE && \ | |
104 | (policy) != POLICY_RR && \ | |
105 | (policy) != POLICY_FIFO) | |
106 | ||
107 | ||
1c79356b A |
108 | /* |
109 | * Types for TIMESHARE policy | |
110 | */ | |
111 | struct policy_timeshare_base { | |
112 | integer_t base_priority; | |
113 | }; | |
114 | struct policy_timeshare_limit { | |
115 | integer_t max_priority; | |
116 | }; | |
117 | struct policy_timeshare_info { | |
118 | integer_t max_priority; | |
119 | integer_t base_priority; | |
120 | integer_t cur_priority; | |
121 | boolean_t depressed; | |
122 | integer_t depress_priority; | |
123 | }; | |
124 | ||
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; | |
128 | ||
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; | |
132 | ||
133 | ||
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)) | |
140 | ||
141 | ||
142 | /* | |
143 | * Types for the ROUND ROBIN (RR) policy | |
144 | */ | |
145 | struct policy_rr_base { | |
146 | integer_t base_priority; | |
147 | integer_t quantum; | |
148 | }; | |
149 | struct policy_rr_limit { | |
150 | integer_t max_priority; | |
151 | }; | |
152 | struct policy_rr_info { | |
153 | integer_t max_priority; | |
154 | integer_t base_priority; | |
155 | integer_t quantum; | |
156 | boolean_t depressed; | |
157 | integer_t depress_priority; | |
158 | }; | |
159 | ||
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; | |
163 | ||
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; | |
167 | ||
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)) | |
174 | ||
175 | ||
176 | /* | |
177 | * Types for the FIRST-IN-FIRST-OUT (FIFO) policy | |
178 | */ | |
179 | struct policy_fifo_base { | |
180 | integer_t base_priority; | |
181 | }; | |
182 | struct policy_fifo_limit { | |
183 | integer_t max_priority; | |
184 | }; | |
185 | struct policy_fifo_info { | |
186 | integer_t max_priority; | |
187 | integer_t base_priority; | |
188 | boolean_t depressed; | |
189 | integer_t depress_priority; | |
190 | }; | |
191 | ||
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; | |
195 | ||
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; | |
199 | ||
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)) | |
206 | ||
207 | /* | |
208 | * Aggregate policy types | |
209 | */ | |
210 | ||
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; | |
215 | }; | |
216 | ||
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; | |
221 | }; | |
222 | ||
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; | |
227 | }; | |
228 | ||
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; | |
232 | ||
9bccf70c A |
233 | #endif /* __APPLE_API_UNSTABLE */ |
234 | ||
1c79356b | 235 | #endif /* _MACH_POLICY_H_ */ |