]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/mach_types.h
xnu-3789.60.24.tar.gz
[apple/xnu.git] / osfmk / mach / mach_types.h
1 /*
2 * Copyright (c) 2000-2010 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
34 * All Rights Reserved.
35 *
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.
41 *
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.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 */
58 /*
59 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
60 * support for mandatory and extensible security protections. This notice
61 * is included in support of clause 2.2 (b) of the Apple Public License,
62 * Version 2.0.
63 */
64 /*
65 * File: mach/mach_types.h
66 * Author: Avadis Tevanian, Jr., Michael Wayne Young
67 * Date: 1986
68 *
69 * Mach external interface definitions.
70 *
71 */
72
73 #ifndef _MACH_MACH_TYPES_H_
74 #define _MACH_MACH_TYPES_H_
75
76 #include <stdint.h>
77
78 #include <sys/cdefs.h>
79
80 #include <mach/host_info.h>
81 #include <mach/host_notify.h>
82 #include <mach/host_special_ports.h>
83 #include <mach/machine.h>
84 #include <mach/machine/vm_types.h>
85 #include <mach/memory_object_types.h>
86 #include <mach/message.h>
87 #include <mach/exception_types.h>
88 #include <mach/port.h>
89 #include <mach/mach_voucher_types.h>
90 #include <mach/processor_info.h>
91 #include <mach/task_info.h>
92 #include <mach/task_policy.h>
93 #include <mach/task_special_ports.h>
94 #include <mach/thread_info.h>
95 #include <mach/thread_policy.h>
96 #include <mach/thread_special_ports.h>
97 #include <mach/thread_status.h>
98 #include <mach/time_value.h>
99 #include <mach/clock_types.h>
100 #include <mach/vm_attributes.h>
101 #include <mach/vm_inherit.h>
102 #include <mach/vm_purgable.h>
103 #include <mach/vm_behavior.h>
104 #include <mach/vm_prot.h>
105 #include <mach/vm_statistics.h>
106 #include <mach/vm_sync.h>
107 #include <mach/vm_types.h>
108 #include <mach/vm_region.h>
109 #include <mach/kmod.h>
110 #include <mach/dyld_kernel.h>
111
112 #ifdef KERNEL
113
114 #include <mach/vm_param.h>
115
116 /*
117 * If we are in the kernel, then pick up the kernel definitions for
118 * the basic mach types.
119 */
120 typedef struct task *task_t, *task_name_t, *task_inspect_t, *task_suspension_token_t;
121 typedef struct thread *thread_t, *thread_act_t, *thread_inspect_t;
122 typedef struct ipc_space *ipc_space_t, *ipc_space_inspect_t;
123 typedef struct coalition *coalition_t;
124 typedef struct host *host_t;
125 typedef struct host *host_priv_t;
126 typedef struct host *host_security_t;
127 typedef struct processor *processor_t;
128 typedef struct processor_set *processor_set_t;
129 typedef struct processor_set *processor_set_control_t;
130 typedef struct semaphore *semaphore_t;
131 typedef struct ledger *ledger_t;
132 typedef struct alarm *alarm_t;
133 typedef struct clock *clock_serv_t;
134 typedef struct clock *clock_ctrl_t;
135
136
137 /*
138 * OBSOLETE: lock_set interfaces are obsolete.
139 */
140 typedef struct lock_set *lock_set_t;
141 struct lock_set ;
142
143 #ifndef MACH_KERNEL_PRIVATE
144
145 __BEGIN_DECLS
146
147 struct task ;
148 struct thread ;
149 struct host ;
150 struct processor ;
151 struct processor_set ;
152 struct semaphore ;
153 struct ledger ;
154 struct alarm ;
155 struct clock ;
156
157 __END_DECLS
158
159 #endif /* MACH_KERNEL_PRIVATE */
160
161 #else /* KERNEL */
162
163 /*
164 * If we are not in the kernel, then these will all be represented by
165 * ports at user-space.
166 */
167 typedef mach_port_t task_t;
168 typedef mach_port_t task_name_t;
169 typedef mach_port_t task_inspect_t;
170 typedef mach_port_t task_suspension_token_t;
171 typedef mach_port_t thread_t;
172 typedef mach_port_t thread_act_t;
173 typedef mach_port_t thread_inspect_t;
174 typedef mach_port_t ipc_space_t;
175 typedef mach_port_t ipc_space_inspect_t;
176 typedef mach_port_t coalition_t;
177 typedef mach_port_t host_t;
178 typedef mach_port_t host_priv_t;
179 typedef mach_port_t host_security_t;
180 typedef mach_port_t processor_t;
181 typedef mach_port_t processor_set_t;
182 typedef mach_port_t processor_set_control_t;
183 typedef mach_port_t semaphore_t;
184 typedef mach_port_t lock_set_t;
185 typedef mach_port_t ledger_t;
186 typedef mach_port_t alarm_t;
187 typedef mach_port_t clock_serv_t;
188 typedef mach_port_t clock_ctrl_t;
189
190 #endif /* KERNEL */
191
192 /*
193 * These aren't really unique types. They are just called
194 * out as unique types at one point in history. So we list
195 * them here for compatibility.
196 */
197 typedef processor_set_t processor_set_name_t;
198
199 /*
200 * These types are just hard-coded as ports
201 */
202 typedef mach_port_t clock_reply_t;
203 typedef mach_port_t bootstrap_t;
204 typedef mach_port_t mem_entry_name_port_t;
205 typedef mach_port_t exception_handler_t;
206 typedef exception_handler_t *exception_handler_array_t;
207 typedef mach_port_t vm_task_entry_t;
208 typedef mach_port_t io_master_t;
209 typedef mach_port_t UNDServerRef;
210
211 /*
212 * Mig doesn't translate the components of an array.
213 * For example, Mig won't use the thread_t translations
214 * to translate a thread_array_t argument. So, these definitions
215 * are not completely accurate at the moment for other kernel
216 * components.
217 */
218 typedef task_t *task_array_t;
219 typedef thread_t *thread_array_t;
220 typedef processor_set_t *processor_set_array_t;
221 typedef processor_set_t *processor_set_name_array_t;
222 typedef processor_t *processor_array_t;
223 typedef thread_act_t *thread_act_array_t;
224 typedef ledger_t *ledger_array_t;
225
226 /*
227 * However the real mach_types got declared, we also have to declare
228 * types with "port" in the name for compatability with the way OSF
229 * had declared the user interfaces at one point. Someday these should
230 * go away.
231 */
232 typedef task_t task_port_t;
233 typedef task_array_t task_port_array_t;
234 typedef thread_t thread_port_t;
235 typedef thread_array_t thread_port_array_t;
236 typedef ipc_space_t ipc_space_port_t;
237 typedef host_t host_name_t;
238 typedef host_t host_name_port_t;
239 typedef processor_set_t processor_set_port_t;
240 typedef processor_set_t processor_set_name_port_t;
241 typedef processor_set_array_t processor_set_name_port_array_t;
242 typedef processor_set_t processor_set_control_port_t;
243 typedef processor_t processor_port_t;
244 typedef processor_array_t processor_port_array_t;
245 typedef thread_act_t thread_act_port_t;
246 typedef thread_act_array_t thread_act_port_array_t;
247 typedef semaphore_t semaphore_port_t;
248 typedef lock_set_t lock_set_port_t;
249 typedef ledger_t ledger_port_t;
250 typedef ledger_array_t ledger_port_array_t;
251 typedef alarm_t alarm_port_t;
252 typedef clock_serv_t clock_serv_port_t;
253 typedef clock_ctrl_t clock_ctrl_port_t;
254 typedef exception_handler_t exception_port_t;
255 typedef exception_handler_array_t exception_port_arrary_t;
256
257
258 #define TASK_NULL ((task_t) 0)
259 #define TASK_NAME_NULL ((task_name_t) 0)
260 #define TASK_INSPECT_NULL ((task_inspect_t) 0)
261 #define THREAD_NULL ((thread_t) 0)
262 #define THREAD_INSPECT_NULL ((thread_inspect_t)0)
263 #define TID_NULL ((uint64_t) 0)
264 #define THR_ACT_NULL ((thread_act_t) 0)
265 #define IPC_SPACE_NULL ((ipc_space_t) 0)
266 #define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0)
267 #define COALITION_NULL ((coalition_t) 0)
268 #define HOST_NULL ((host_t) 0)
269 #define HOST_PRIV_NULL ((host_priv_t)0)
270 #define HOST_SECURITY_NULL ((host_security_t)0)
271 #define PROCESSOR_SET_NULL ((processor_set_t) 0)
272 #define PROCESSOR_NULL ((processor_t) 0)
273 #define SEMAPHORE_NULL ((semaphore_t) 0)
274 #define LOCK_SET_NULL ((lock_set_t) 0)
275 #define LEDGER_NULL ((ledger_t) 0)
276 #define ALARM_NULL ((alarm_t) 0)
277 #define CLOCK_NULL ((clock_t) 0)
278 #define UND_SERVER_NULL ((UNDServerRef) 0)
279
280 /* DEPRECATED */
281 typedef natural_t ledger_item_t;
282 #define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
283
284 typedef int64_t ledger_amount_t;
285 #define LEDGER_LIMIT_INFINITY ((ledger_amount_t)((1ULL << 63) - 1))
286
287 typedef mach_vm_offset_t *emulation_vector_t;
288 typedef char *user_subsystem_t;
289
290 typedef char *labelstr_t;
291 /*
292 * Backwards compatibility, for those programs written
293 * before mach/{std,mach}_types.{defs,h} were set up.
294 */
295 #include <mach/std_types.h>
296
297 #endif /* _MACH_MACH_TYPES_H_ */