]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/mach_types.h
xnu-6153.121.1.tar.gz
[apple/xnu.git] / osfmk / mach / mach_types.h
CommitLineData
1c79356b 1/*
cb323159 2 * Copyright (c) 2000-2018 Apple 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 */
2d21ac55
A
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 */
1c79356b
A
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
0a7de745 73#ifndef _MACH_MACH_TYPES_H_
1c79356b
A
74#define _MACH_MACH_TYPES_H_
75
0b4e3aa0
A
76#include <stdint.h>
77
91447636
A
78#include <sys/cdefs.h>
79
1c79356b 80#include <mach/host_info.h>
55e303ae
A
81#include <mach/host_notify.h>
82#include <mach/host_special_ports.h>
1c79356b
A
83#include <mach/machine.h>
84#include <mach/machine/vm_types.h>
85#include <mach/memory_object_types.h>
91447636 86#include <mach/message.h>
1c79356b
A
87#include <mach/exception_types.h>
88#include <mach/port.h>
fe8ab488 89#include <mach/mach_voucher_types.h>
1c79356b
A
90#include <mach/processor_info.h>
91#include <mach/task_info.h>
5ba3f43e 92#include <mach/task_inspect.h>
1c79356b
A
93#include <mach/task_policy.h>
94#include <mach/task_special_ports.h>
95#include <mach/thread_info.h>
96#include <mach/thread_policy.h>
97#include <mach/thread_special_ports.h>
98#include <mach/thread_status.h>
99#include <mach/time_value.h>
100#include <mach/clock_types.h>
101#include <mach/vm_attributes.h>
102#include <mach/vm_inherit.h>
91447636 103#include <mach/vm_purgable.h>
1c79356b
A
104#include <mach/vm_behavior.h>
105#include <mach/vm_prot.h>
106#include <mach/vm_statistics.h>
107#include <mach/vm_sync.h>
108#include <mach/vm_types.h>
109#include <mach/vm_region.h>
110#include <mach/kmod.h>
39037602 111#include <mach/dyld_kernel.h>
1c79356b 112
0a7de745 113#ifdef KERNEL
1c79356b
A
114
115#include <mach/vm_param.h>
116
117/*
118 * If we are in the kernel, then pick up the kernel definitions for
119 * the basic mach types.
120 */
0a7de745
A
121typedef struct task *task_t, *task_name_t, *task_inspect_t, *task_suspension_token_t;
122typedef struct thread *thread_t, *thread_act_t, *thread_inspect_t;
123typedef struct ipc_space *ipc_space_t, *ipc_space_inspect_t;
124typedef struct coalition *coalition_t;
125typedef struct host *host_t;
126typedef struct host *host_priv_t;
127typedef struct host *host_security_t;
128typedef struct processor *processor_t;
129typedef struct processor_set *processor_set_t;
130typedef struct processor_set *processor_set_control_t;
131typedef struct semaphore *semaphore_t;
132typedef struct ledger *ledger_t;
133typedef struct alarm *alarm_t;
134typedef struct clock *clock_serv_t;
135typedef struct clock *clock_ctrl_t;
cb323159 136typedef struct arcade_register *arcade_register_t;
ea3f0419 137typedef struct suid_cred *suid_cred_t;
fe8ab488 138
39236c6e
A
139/*
140 * OBSOLETE: lock_set interfaces are obsolete.
141 */
0a7de745
A
142typedef struct lock_set *lock_set_t;
143struct lock_set;
39236c6e 144
0a7de745 145#ifndef MACH_KERNEL_PRIVATE
91447636
A
146
147__BEGIN_DECLS
9bccf70c 148
0a7de745
A
149struct task;
150struct thread;
151struct host;
152struct processor;
153struct processor_set;
154struct semaphore;
155struct ledger;
156struct alarm;
157struct clock;
cb323159 158struct arcade_register;
ea3f0419 159struct suid_cred;
cb323159 160
91447636 161__END_DECLS
1c79356b 162
0a7de745 163#endif /* MACH_KERNEL_PRIVATE */
91447636 164
0a7de745 165#else /* KERNEL */
1c79356b
A
166
167/*
168 * If we are not in the kernel, then these will all be represented by
169 * ports at user-space.
170 */
0a7de745
A
171typedef mach_port_t task_t;
172typedef mach_port_t task_name_t;
173typedef mach_port_t task_inspect_t;
174typedef mach_port_t task_suspension_token_t;
175typedef mach_port_t thread_t;
176typedef mach_port_t thread_act_t;
177typedef mach_port_t thread_inspect_t;
178typedef mach_port_t ipc_space_t;
179typedef mach_port_t ipc_space_inspect_t;
180typedef mach_port_t coalition_t;
181typedef mach_port_t host_t;
182typedef mach_port_t host_priv_t;
183typedef mach_port_t host_security_t;
184typedef mach_port_t processor_t;
185typedef mach_port_t processor_set_t;
186typedef mach_port_t processor_set_control_t;
187typedef mach_port_t semaphore_t;
188typedef mach_port_t lock_set_t;
189typedef mach_port_t ledger_t;
190typedef mach_port_t alarm_t;
191typedef mach_port_t clock_serv_t;
192typedef mach_port_t clock_ctrl_t;
cb323159 193typedef mach_port_t arcade_register_t;
ea3f0419
A
194typedef mach_port_t suid_cred_t;
195
0a7de745 196#endif /* KERNEL */
1c79356b 197
9bccf70c
A
198/*
199 * These aren't really unique types. They are just called
200 * out as unique types at one point in history. So we list
201 * them here for compatibility.
202 */
0a7de745 203typedef processor_set_t processor_set_name_t;
1c79356b
A
204
205/*
91447636 206 * These types are just hard-coded as ports
1c79356b 207 */
0a7de745
A
208typedef mach_port_t clock_reply_t;
209typedef mach_port_t bootstrap_t;
210typedef mach_port_t mem_entry_name_port_t;
211typedef mach_port_t exception_handler_t;
212typedef exception_handler_t *exception_handler_array_t;
213typedef mach_port_t vm_task_entry_t;
214typedef mach_port_t io_master_t;
215typedef mach_port_t UNDServerRef;
1c79356b
A
216
217/*
91447636 218 * Mig doesn't translate the components of an array.
1c79356b
A
219 * For example, Mig won't use the thread_t translations
220 * to translate a thread_array_t argument. So, these definitions
221 * are not completely accurate at the moment for other kernel
91447636 222 * components.
1c79356b 223 */
0a7de745
A
224typedef task_t *task_array_t;
225typedef thread_t *thread_array_t;
226typedef processor_set_t *processor_set_array_t;
227typedef processor_set_t *processor_set_name_array_t;
228typedef processor_t *processor_array_t;
229typedef thread_act_t *thread_act_array_t;
230typedef ledger_t *ledger_array_t;
1c79356b
A
231
232/*
233 * However the real mach_types got declared, we also have to declare
234 * types with "port" in the name for compatability with the way OSF
235 * had declared the user interfaces at one point. Someday these should
236 * go away.
237 */
0a7de745
A
238typedef task_t task_port_t;
239typedef task_array_t task_port_array_t;
240typedef thread_t thread_port_t;
241typedef thread_array_t thread_port_array_t;
242typedef ipc_space_t ipc_space_port_t;
243typedef host_t host_name_t;
244typedef host_t host_name_port_t;
245typedef processor_set_t processor_set_port_t;
246typedef processor_set_t processor_set_name_port_t;
247typedef processor_set_array_t processor_set_name_port_array_t;
248typedef processor_set_t processor_set_control_port_t;
249typedef processor_t processor_port_t;
250typedef processor_array_t processor_port_array_t;
251typedef thread_act_t thread_act_port_t;
252typedef thread_act_array_t thread_act_port_array_t;
253typedef semaphore_t semaphore_port_t;
254typedef lock_set_t lock_set_port_t;
255typedef ledger_t ledger_port_t;
256typedef ledger_array_t ledger_port_array_t;
257typedef alarm_t alarm_port_t;
258typedef clock_serv_t clock_serv_port_t;
259typedef clock_ctrl_t clock_ctrl_port_t;
260typedef exception_handler_t exception_port_t;
1c79356b 261typedef exception_handler_array_t exception_port_arrary_t;
cb323159
A
262typedef char vfs_path_t[4096];
263typedef char nspace_path_t[1024]; /* 1024 == PATH_MAX */
ea3f0419
A
264typedef char suid_cred_path_t[1024];
265typedef uint32_t suid_cred_uid_t;
1c79356b 266
cb323159
A
267#ifdef KERNEL
268#define TASK_NULL ((task_t) NULL)
269#define TASK_NAME_NULL ((task_name_t) NULL)
270#define TASK_INSPECT_NULL ((task_inspect_t) NULL)
271#define THREAD_NULL ((thread_t) NULL)
272#define THREAD_INSPECT_NULL ((thread_inspect_t)NULL)
273#define TID_NULL ((uint64_t) NULL)
274#define THR_ACT_NULL ((thread_act_t) NULL)
275#define IPC_SPACE_NULL ((ipc_space_t) NULL)
276#define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) NULL)
277#define COALITION_NULL ((coalition_t) NULL)
278#define HOST_NULL ((host_t) NULL)
279#define HOST_PRIV_NULL ((host_priv_t)NULL)
280#define HOST_SECURITY_NULL ((host_security_t)NULL)
281#define PROCESSOR_SET_NULL ((processor_set_t) NULL)
282#define PROCESSOR_NULL ((processor_t) NULL)
283#define SEMAPHORE_NULL ((semaphore_t) NULL)
284#define LOCK_SET_NULL ((lock_set_t) NULL)
285#define LEDGER_NULL ((ledger_t) NULL)
286#define ALARM_NULL ((alarm_t) NULL)
287#define CLOCK_NULL ((clock_t) NULL)
288#define UND_SERVER_NULL ((UNDServerRef) NULL)
289#define ARCADE_REG_NULL ((arcade_register_t) NULL)
ea3f0419 290#define SUID_CRED_NULL ((suid_cred_t) NULL)
cb323159 291#else
0a7de745
A
292#define TASK_NULL ((task_t) 0)
293#define TASK_NAME_NULL ((task_name_t) 0)
294#define TASK_INSPECT_NULL ((task_inspect_t) 0)
295#define THREAD_NULL ((thread_t) 0)
cb323159 296#define THREAD_INSPECT_NULL ((thread_inspect_t) 0)
0a7de745
A
297#define TID_NULL ((uint64_t) 0)
298#define THR_ACT_NULL ((thread_act_t) 0)
299#define IPC_SPACE_NULL ((ipc_space_t) 0)
300#define IPC_SPACE_INSPECT_NULL ((ipc_space_inspect_t) 0)
301#define COALITION_NULL ((coalition_t) 0)
302#define HOST_NULL ((host_t) 0)
cb323159
A
303#define HOST_PRIV_NULL ((host_priv_t) 0)
304#define HOST_SECURITY_NULL ((host_security_t) 0)
0a7de745
A
305#define PROCESSOR_SET_NULL ((processor_set_t) 0)
306#define PROCESSOR_NULL ((processor_t) 0)
307#define SEMAPHORE_NULL ((semaphore_t) 0)
308#define LOCK_SET_NULL ((lock_set_t) 0)
309#define LEDGER_NULL ((ledger_t) 0)
310#define ALARM_NULL ((alarm_t) 0)
311#define CLOCK_NULL ((clock_t) 0)
312#define UND_SERVER_NULL ((UNDServerRef) 0)
cb323159 313#define ARCADE_REG_NULL ((arcade_register_t) 0)
ea3f0419 314#define SUID_CRED_NULL ((suid_cred_t) 0)
cb323159 315#endif
1c79356b 316
316670eb 317/* DEPRECATED */
0a7de745
A
318typedef natural_t ledger_item_t;
319#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0))
316670eb 320
0a7de745 321typedef int64_t ledger_amount_t;
39236c6e 322#define LEDGER_LIMIT_INFINITY ((ledger_amount_t)((1ULL << 63) - 1))
91447636 323
0a7de745
A
324typedef mach_vm_offset_t *emulation_vector_t;
325typedef char *user_subsystem_t;
1c79356b 326
0a7de745 327typedef char *labelstr_t;
1c79356b
A
328/*
329 * Backwards compatibility, for those programs written
330 * before mach/{std,mach}_types.{defs,h} were set up.
331 */
332#include <mach/std_types.h>
333
0a7de745 334#endif /* _MACH_MACH_TYPES_H_ */