]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/policy.h
xnu-792.24.17.tar.gz
[apple/xnu.git] / osfmk / mach / policy.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
6601e61a 4 * @APPLE_LICENSE_HEADER_START@
1c79356b 5 *
6601e61a
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
8f6c56a5 11 *
6601e61a
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
6601e61a
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
8f6c56a5 19 *
6601e61a 20 * @APPLE_LICENSE_HEADER_END@
1c79356b
A
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
25/*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
28 * All Rights Reserved.
29 *
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
35 *
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50/*
51 */
52
53#ifndef _MACH_POLICY_H_
54#define _MACH_POLICY_H_
55
56/*
57 * mach/policy.h
58 *
59 * Definitions for scheduing policy.
91447636
A
60 */
61
62/*
63 * All interfaces defined here are obsolete.
1c79356b
A
64 */
65
66#include <mach/boolean.h>
91447636 67#include <mach/message.h>
1c79356b
A
68#include <mach/vm_types.h>
69
9bccf70c
A
70/*
71 * Old scheduling control interface
72 */
73typedef int policy_t;
74typedef integer_t *policy_info_t;
75typedef integer_t *policy_base_t;
76typedef integer_t *policy_limit_t;
77
1c79356b
A
78/*
79 * Policy definitions. Policies should be powers of 2,
80 * but cannot be or'd together other than to test for a
81 * policy 'class'.
82 */
83#define POLICY_NULL 0 /* none */
84#define POLICY_TIMESHARE 1 /* timesharing */
85#define POLICY_RR 2 /* fixed round robin */
86#define POLICY_FIFO 4 /* fixed fifo */
87
88#define __NEW_SCHEDULING_FRAMEWORK__
89
90/*
91 * Check if policy is of 'class' fixed-priority.
92 */
93#define POLICYCLASS_FIXEDPRI (POLICY_RR | POLICY_FIFO)
94
95/*
96 * Check if policy is valid.
97 */
98#define invalid_policy(policy) \
99 ((policy) != POLICY_TIMESHARE && \
100 (policy) != POLICY_RR && \
101 (policy) != POLICY_FIFO)
102
103
1c79356b
A
104/*
105 * Types for TIMESHARE policy
106 */
107struct policy_timeshare_base {
108 integer_t base_priority;
109};
110struct policy_timeshare_limit {
111 integer_t max_priority;
112};
113struct policy_timeshare_info {
114 integer_t max_priority;
115 integer_t base_priority;
116 integer_t cur_priority;
117 boolean_t depressed;
118 integer_t depress_priority;
119};
120
121typedef struct policy_timeshare_base *policy_timeshare_base_t;
122typedef struct policy_timeshare_limit *policy_timeshare_limit_t;
123typedef struct policy_timeshare_info *policy_timeshare_info_t;
124
125typedef struct policy_timeshare_base policy_timeshare_base_data_t;
126typedef struct policy_timeshare_limit policy_timeshare_limit_data_t;
127typedef struct policy_timeshare_info policy_timeshare_info_data_t;
128
129
91447636
A
130#define POLICY_TIMESHARE_BASE_COUNT ((mach_msg_type_number_t) \
131 (sizeof(struct policy_timeshare_base)/sizeof(integer_t)))
132#define POLICY_TIMESHARE_LIMIT_COUNT ((mach_msg_type_number_t) \
133 (sizeof(struct policy_timeshare_limit)/sizeof(integer_t)))
134#define POLICY_TIMESHARE_INFO_COUNT ((mach_msg_type_number_t) \
135 (sizeof(struct policy_timeshare_info)/sizeof(integer_t)))
1c79356b
A
136
137
138/*
139 * Types for the ROUND ROBIN (RR) policy
140 */
141struct policy_rr_base {
142 integer_t base_priority;
143 integer_t quantum;
144};
145struct policy_rr_limit {
146 integer_t max_priority;
147};
148struct policy_rr_info {
149 integer_t max_priority;
150 integer_t base_priority;
151 integer_t quantum;
152 boolean_t depressed;
153 integer_t depress_priority;
154};
155
156typedef struct policy_rr_base *policy_rr_base_t;
157typedef struct policy_rr_limit *policy_rr_limit_t;
158typedef struct policy_rr_info *policy_rr_info_t;
159
160typedef struct policy_rr_base policy_rr_base_data_t;
161typedef struct policy_rr_limit policy_rr_limit_data_t;
162typedef struct policy_rr_info policy_rr_info_data_t;
163
91447636
A
164#define POLICY_RR_BASE_COUNT ((mach_msg_type_number_t) \
165 (sizeof(struct policy_rr_base)/sizeof(integer_t)))
166#define POLICY_RR_LIMIT_COUNT ((mach_msg_type_number_t) \
167 (sizeof(struct policy_rr_limit)/sizeof(integer_t)))
168#define POLICY_RR_INFO_COUNT ((mach_msg_type_number_t) \
169 (sizeof(struct policy_rr_info)/sizeof(integer_t)))
1c79356b
A
170
171
172/*
173 * Types for the FIRST-IN-FIRST-OUT (FIFO) policy
174 */
175struct policy_fifo_base {
176 integer_t base_priority;
177};
178struct policy_fifo_limit {
179 integer_t max_priority;
180};
181struct policy_fifo_info {
182 integer_t max_priority;
183 integer_t base_priority;
184 boolean_t depressed;
185 integer_t depress_priority;
186};
187
188typedef struct policy_fifo_base *policy_fifo_base_t;
189typedef struct policy_fifo_limit *policy_fifo_limit_t;
190typedef struct policy_fifo_info *policy_fifo_info_t;
191
192typedef struct policy_fifo_base policy_fifo_base_data_t;
193typedef struct policy_fifo_limit policy_fifo_limit_data_t;
194typedef struct policy_fifo_info policy_fifo_info_data_t;
195
91447636
A
196#define POLICY_FIFO_BASE_COUNT ((mach_msg_type_number_t) \
197 (sizeof(struct policy_fifo_base)/sizeof(integer_t)))
198#define POLICY_FIFO_LIMIT_COUNT ((mach_msg_type_number_t) \
199 (sizeof(struct policy_fifo_limit)/sizeof(integer_t)))
200#define POLICY_FIFO_INFO_COUNT ((mach_msg_type_number_t) \
201 (sizeof(struct policy_fifo_info)/sizeof(integer_t)))
1c79356b
A
202
203/*
204 * Aggregate policy types
205 */
206
207struct policy_bases {
208 policy_timeshare_base_data_t ts;
209 policy_rr_base_data_t rr;
210 policy_fifo_base_data_t fifo;
211};
212
213struct policy_limits {
214 policy_timeshare_limit_data_t ts;
215 policy_rr_limit_data_t rr;
216 policy_fifo_limit_data_t fifo;
217};
218
219struct policy_infos {
220 policy_timeshare_info_data_t ts;
221 policy_rr_info_data_t rr;
222 policy_fifo_info_data_t fifo;
223};
224
225typedef struct policy_bases policy_base_data_t;
226typedef struct policy_limits policy_limit_data_t;
227typedef struct policy_infos policy_info_data_t;
228
91447636 229#endif /* _MACH_POLICY_H_ */