]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/mach_types.h
xnu-517.tar.gz
[apple/xnu.git] / osfmk / mach / mach_types.h
1 /*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
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 * File: mach/mach_types.h
57 * Author: Avadis Tevanian, Jr., Michael Wayne Young
58 * Date: 1986
59 *
60 * Mach external interface definitions.
61 *
62 */
63
64 #ifndef _MACH_MACH_TYPES_H_
65 #define _MACH_MACH_TYPES_H_
66
67 #include <stdint.h>
68
69 #include <mach/host_info.h>
70 #include <mach/host_notify.h>
71 #include <mach/host_special_ports.h>
72 #include <mach/machine.h>
73 #include <mach/machine/vm_types.h>
74 #include <mach/memory_object_types.h>
75 #include <mach/exception_types.h>
76 #include <mach/port.h>
77 #include <mach/processor_info.h>
78 #include <mach/task_info.h>
79 #include <mach/task_policy.h>
80 #include <mach/task_special_ports.h>
81 #include <mach/thread_info.h>
82 #include <mach/thread_policy.h>
83 #include <mach/thread_special_ports.h>
84 #include <mach/thread_status.h>
85 #include <mach/time_value.h>
86 #include <mach/clock_types.h>
87 #include <mach/vm_attributes.h>
88 #include <mach/vm_inherit.h>
89 #include <mach/vm_behavior.h>
90 #include <mach/vm_prot.h>
91 #include <mach/vm_statistics.h>
92 #include <mach/vm_sync.h>
93 #include <mach/vm_types.h>
94 #include <mach/vm_region.h>
95 #include <mach/kmod.h>
96
97 #ifdef KERNEL_PRIVATE
98
99 #include <mach/vm_param.h>
100
101 /*
102 * If we are in the kernel, then pick up the kernel definitions for
103 * the basic mach types.
104 */
105 typedef struct task *task_t;
106 typedef struct thread *thread_t, *thread_act_t;
107 typedef struct ipc_space *ipc_space_t;
108 typedef struct host *host_t;
109 typedef struct host *host_priv_t;
110 typedef struct host *host_security_t;
111 typedef struct processor *processor_t;
112 typedef struct processor_set *processor_set_t;
113 typedef struct processor_set *processor_set_control_t;
114 typedef struct semaphore *semaphore_t;
115 typedef struct lock_set *lock_set_t;
116 typedef struct ledger *ledger_t;
117 typedef struct alarm *alarm_t;
118 typedef struct clock *clock_serv_t;
119 typedef struct clock *clock_ctrl_t;
120
121 #if !defined(MACH_KERNEL_PRIVATE)
122
123 /*
124 * Declare empty structure definitions for export to other
125 * kernel components. This lets us still provide some level
126 * of type checking, without exposing our internal data
127 * structures.
128 */
129 struct task ;
130 struct thread ;
131 struct host ;
132 struct processor ;
133 struct processor_set ;
134 struct semaphore ;
135 struct lock_set ;
136 struct ledger ;
137 struct alarm ;
138 struct clock ;
139
140 #endif /* !MACH_KERNEL_PRIVATE */
141
142 #else /* !KERNEL_PRIVATE */
143
144 /*
145 * If we are not in the kernel, then these will all be represented by
146 * ports at user-space.
147 */
148 typedef mach_port_t task_t;
149 typedef mach_port_t thread_t;
150 typedef mach_port_t thread_act_t;
151 typedef mach_port_t ipc_space_t;
152 typedef mach_port_t host_t;
153 typedef mach_port_t host_priv_t;
154 typedef mach_port_t host_security_t;
155 typedef mach_port_t processor_t;
156 typedef mach_port_t processor_set_t;
157 typedef mach_port_t processor_set_control_t;
158 typedef mach_port_t semaphore_t;
159 typedef mach_port_t lock_set_t;
160 typedef mach_port_t ledger_t;
161 typedef mach_port_t alarm_t;
162 typedef mach_port_t clock_serv_t;
163 typedef mach_port_t clock_ctrl_t;
164
165 #endif /* !KERNEL_PRIVATE */
166
167 /*
168 * These aren't really unique types. They are just called
169 * out as unique types at one point in history. So we list
170 * them here for compatibility.
171 */
172 typedef processor_set_t processor_set_name_t;
173
174 /*
175 * JMM - These types are just hard-coded as ports for now
176 */
177 typedef mach_port_t clock_reply_t;
178 typedef mach_port_t bootstrap_t;
179 typedef mach_port_t mem_entry_name_port_t;
180 typedef mach_port_t exception_handler_t;
181 typedef exception_handler_t *exception_handler_array_t;
182 typedef mach_port_t vm_task_entry_t;
183 typedef mach_port_t io_master_t;
184 typedef mach_port_t UNDServerRef;
185
186 /*
187 * JMM - Mig doesn't translate the components of an array.
188 * For example, Mig won't use the thread_t translations
189 * to translate a thread_array_t argument. So, these definitions
190 * are not completely accurate at the moment for other kernel
191 * components. MIG is being fixed.
192 */
193 typedef task_t *task_array_t;
194 typedef thread_t *thread_array_t;
195 typedef processor_set_t *processor_set_array_t;
196 typedef processor_set_t *processor_set_name_array_t;
197 typedef processor_t *processor_array_t;
198 typedef thread_act_t *thread_act_array_t;
199 typedef ledger_t *ledger_array_t;
200
201
202 /*
203 * However the real mach_types got declared, we also have to declare
204 * types with "port" in the name for compatability with the way OSF
205 * had declared the user interfaces at one point. Someday these should
206 * go away.
207 */
208 typedef task_t task_port_t;
209 typedef task_array_t task_port_array_t;
210 typedef thread_t thread_port_t;
211 typedef thread_array_t thread_port_array_t;
212 typedef ipc_space_t ipc_space_port_t;
213 typedef host_t host_name_t;
214 typedef host_t host_name_port_t;
215 typedef processor_set_t processor_set_port_t;
216 typedef processor_set_t processor_set_name_port_t;
217 typedef processor_set_array_t processor_set_name_port_array_t;
218 typedef processor_set_t processor_set_control_port_t;
219 typedef processor_t processor_port_t;
220 typedef processor_array_t processor_port_array_t;
221 typedef thread_act_t thread_act_port_t;
222 typedef thread_act_array_t thread_act_port_array_t;
223 typedef semaphore_t semaphore_port_t;
224 typedef lock_set_t lock_set_port_t;
225 typedef ledger_t ledger_port_t;
226 typedef ledger_array_t ledger_port_array_t;
227 typedef alarm_t alarm_port_t;
228 typedef clock_serv_t clock_serv_port_t;
229 typedef clock_ctrl_t clock_ctrl_port_t;
230 typedef exception_handler_t exception_port_t;
231 typedef exception_handler_array_t exception_port_arrary_t;
232
233
234 #define TASK_NULL ((task_t) 0)
235 #define THREAD_NULL ((thread_t) 0)
236 #define THR_ACT_NULL ((thread_act_t) 0)
237 #define IPC_SPACE_NULL ((ipc_space_t) 0)
238 #define HOST_NULL ((host_t) 0)
239 #define HOST_PRIV_NULL ((host_priv_t)0)
240 #define HOST_SECURITY_NULL ((host_security_t)0)
241 #define PROCESSOR_SET_NULL ((processor_set_t) 0)
242 #define PROCESSOR_NULL ((processor_t) 0)
243 #define SEMAPHORE_NULL ((semaphore_t) 0)
244 #define LOCK_SET_NULL ((lock_set_t) 0)
245 #define LEDGER_NULL ((ledger_t) 0)
246 #define ALARM_NULL ((alarm_t) 0)
247 #define CLOCK_NULL ((clock_t) 0)
248 #define UND_SERVER_NULL ((UNDServerRef) 0)
249
250 typedef integer_t ledger_item_t;
251 typedef vm_offset_t *emulation_vector_t;
252 typedef char *user_subsystem_t;
253
254 /*
255 * Backwards compatibility, for those programs written
256 * before mach/{std,mach}_types.{defs,h} were set up.
257 */
258 #include <mach/std_types.h>
259
260 #endif /* _MACH_MACH_TYPES_H_ */