]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_tt.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / kern / ipc_tt.h
1 /*
2 * Copyright (c) 2000 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,1987 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 _KERN_IPC_TT_H_
57 #define _KERN_IPC_TT_H_
58
59 #include <mach/boolean.h>
60 #include <mach/port.h>
61 #include <vm/vm_kern.h>
62 #include <kern/kern_types.h>
63 #include <kern/ipc_kobject.h>
64 #include <ipc/ipc_space.h>
65 #include <ipc/ipc_table.h>
66 #include <ipc/ipc_port.h>
67 #include <ipc/ipc_right.h>
68 #include <ipc/ipc_entry.h>
69 #include <ipc/ipc_object.h>
70
71
72 /* Initialize a task's IPC state */
73 extern void ipc_task_init(
74 task_t task,
75 task_t parent);
76
77 /* Enable a task for IPC access */
78 extern void ipc_task_enable(
79 task_t task);
80
81 /* Disable IPC access to a task */
82 extern void ipc_task_disable(
83 task_t task);
84
85 /* Clean up and destroy a task's IPC state */
86 extern void ipc_task_terminate(
87 task_t task);
88
89 /* Initialize a thread's IPC state */
90 extern void ipc_thread_init(
91 thread_t thread);
92
93 /* Clean up and destroy a thread's IPC state */
94 extern void ipc_thread_terminate(
95 thread_t thread);
96
97 /* Return a send right for the task's user-visible self port */
98 extern ipc_port_t retrieve_task_self_fast(
99 task_t task);
100
101 /* Return a send right for the thread's user-visible self port */
102 extern ipc_port_t retrieve_act_self_fast(
103 thread_act_t);
104
105 /* Convert from a port to a task */
106 extern task_t convert_port_to_task(
107 ipc_port_t port);
108
109 /* Convert from a port entry port to a task */
110 extern task_t convert_port_to_task(
111 ipc_port_t port);
112
113 extern boolean_t ref_task_port_locked(
114 ipc_port_t port, task_t *ptask);
115
116 /* Convert from a port to a space */
117 extern ipc_space_t convert_port_to_space(
118 ipc_port_t port);
119
120 extern boolean_t ref_space_port_locked(
121 ipc_port_t port, ipc_space_t *pspace);
122
123 /* Convert from a port to a map */
124 extern vm_map_t convert_port_to_map(
125 ipc_port_t port);
126
127 /* Convert from a map entry port to a map */
128 extern vm_map_t convert_port_entry_to_map(
129 ipc_port_t port);
130
131 /* Convert from a port to a vm_object */
132 extern vm_object_t convert_port_entry_to_object(
133 ipc_port_t port);
134
135 /* Convert from a port to a upl_object */
136 extern upl_t convert_port_to_upl(
137 ipc_port_t port);
138
139 /* Convert from a port to a thread */
140 extern thread_act_t convert_port_to_act(
141 ipc_port_t port);
142
143 extern thread_act_t port_name_to_act(
144 mach_port_name_t port_name);
145
146 extern boolean_t ref_act_port_locked(
147 ipc_port_t port, thread_act_t *pthr_act);
148
149 /* Convert from a task to a port */
150 extern ipc_port_t convert_task_to_port(
151 task_t task);
152
153 /* Convert from a thread to a port */
154 extern ipc_port_t convert_act_to_port( thread_act_t );
155
156 /* Convert from a upl to a port */
157 extern ipc_port_t convert_upl_to_port( upl_t );
158
159 /* Deallocate a space ref produced by convert_port_to_space */
160 extern void space_deallocate(
161 ipc_space_t space);
162
163 /* Allocate a reply port */
164 extern mach_port_name_t mach_reply_port(void);
165
166 /* Initialize a thread_act's ipc mechanism */
167 extern void ipc_thr_act_init(task_t, thread_act_t);
168
169 /* Disable IPC access to a thread_act */
170 extern void ipc_thr_act_disable(thread_act_t);
171
172 /* Clean up and destroy a thread_act's IPC state */
173 extern void ipc_thr_act_terminate(thread_act_t);
174
175 #endif /* _KERN_IPC_TT_H_ */