]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
2d21ac55 A |
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 | |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
31 | /* | |
32 | * Mach Operating System | |
33 | * Copyright (c) 1991,1990,1989 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 | * File: ipc/ipc_right.h | |
60 | * Author: Rich Draves | |
61 | * Date: 1989 | |
62 | * | |
63 | * Declarations of functions to manipulate IPC capabilities. | |
64 | */ | |
65 | ||
66 | #ifndef _IPC_IPC_RIGHT_H_ | |
67 | #define _IPC_IPC_RIGHT_H_ | |
68 | ||
69 | #include <mach/boolean.h> | |
70 | #include <mach/kern_return.h> | |
71 | #include <ipc/ipc_port.h> | |
72 | #include <ipc/ipc_entry.h> | |
73 | ||
74 | #define ipc_right_lookup_read ipc_right_lookup_write | |
75 | #define ipc_right_lookup_two_read ipc_right_lookup_two_write | |
76 | ||
77 | /* Find an entry in a space, given the name */ | |
78 | extern kern_return_t ipc_right_lookup_write( | |
79 | ipc_space_t space, | |
80 | mach_port_name_t name, | |
81 | ipc_entry_t *entryp); | |
82 | ||
83 | /* Find two entries in a space, given two names */ | |
84 | extern kern_return_t ipc_right_lookup_two_write( | |
85 | ipc_space_t space, | |
86 | mach_port_name_t name1, | |
87 | ipc_entry_t *entryp1, | |
88 | mach_port_name_t name2, | |
89 | ipc_entry_t *entryp2); | |
90 | ||
91 | /* Translate (space, object) -> (name, entry) */ | |
92 | extern boolean_t ipc_right_reverse( | |
93 | ipc_space_t space, | |
94 | ipc_object_t object, | |
95 | mach_port_name_t *namep, | |
96 | ipc_entry_t *entryp); | |
97 | ||
6d2010ae A |
98 | /* Make a notification request, returning the previous send-once right */ |
99 | extern kern_return_t ipc_right_request_alloc( | |
1c79356b A |
100 | ipc_space_t space, |
101 | mach_port_name_t name, | |
102 | boolean_t immediate, | |
6d2010ae | 103 | boolean_t send_possible, |
1c79356b A |
104 | ipc_port_t notify, |
105 | ipc_port_t *previousp); | |
106 | ||
6d2010ae A |
107 | /* Cancel a notification request and return the send-once right */ |
108 | extern ipc_port_t ipc_right_request_cancel( | |
1c79356b A |
109 | ipc_space_t space, |
110 | ipc_port_t port, | |
111 | mach_port_name_t name, | |
112 | ipc_entry_t entry); | |
113 | ||
6d2010ae A |
114 | #define ipc_right_request_cancel_macro(space, port, name, entry) \ |
115 | ((entry->ie_request == IE_REQ_NONE) ? IP_NULL : \ | |
116 | ipc_right_request_cancel((space), (port), (name), (entry))) | |
1c79356b A |
117 | |
118 | /* Check if an entry is being used */ | |
119 | extern boolean_t ipc_right_inuse( | |
120 | ipc_space_t space, | |
121 | mach_port_name_t name, | |
122 | ipc_entry_t entry); | |
123 | ||
124 | /* Check if the port has died */ | |
125 | extern boolean_t ipc_right_check( | |
126 | ipc_space_t space, | |
127 | ipc_port_t port, | |
128 | mach_port_name_t name, | |
129 | ipc_entry_t entry); | |
130 | ||
131 | /* Clean up an entry in a dead space */ | |
316670eb | 132 | extern void ipc_right_terminate( |
1c79356b A |
133 | ipc_space_t space, |
134 | mach_port_name_t name, | |
135 | ipc_entry_t entry); | |
136 | ||
137 | /* Destroy an entry in a space */ | |
138 | extern kern_return_t ipc_right_destroy( | |
139 | ipc_space_t space, | |
140 | mach_port_name_t name, | |
39236c6e A |
141 | ipc_entry_t entry, |
142 | boolean_t check_guard, | |
143 | uint64_t guard); | |
1c79356b A |
144 | |
145 | /* Release a send/send-once/dead-name user reference */ | |
146 | extern kern_return_t ipc_right_dealloc( | |
147 | ipc_space_t space, | |
148 | mach_port_name_t name, | |
149 | ipc_entry_t entry); | |
150 | ||
151 | /* Modify the user-reference count for a right */ | |
152 | extern kern_return_t ipc_right_delta( | |
153 | ipc_space_t space, | |
154 | mach_port_name_t name, | |
155 | ipc_entry_t entry, | |
156 | mach_port_right_t right, | |
157 | mach_port_delta_t delta); | |
158 | ||
39236c6e A |
159 | /* Destroy a receive right; Modify ref count for send rights */ |
160 | extern kern_return_t ipc_right_destruct( | |
161 | ipc_space_t space, | |
162 | mach_port_name_t name, | |
163 | ipc_entry_t entry, | |
164 | mach_port_delta_t srdelta, | |
165 | uint64_t guard); | |
166 | ||
1c79356b A |
167 | /* Retrieve information about a right */ |
168 | extern kern_return_t ipc_right_info( | |
169 | ipc_space_t space, | |
170 | mach_port_name_t name, | |
171 | ipc_entry_t entry, | |
172 | mach_port_type_t *typep, | |
173 | mach_port_urefs_t *urefsp); | |
174 | ||
175 | /* Check if a subsequent ipc_right_copyin would succeed */ | |
176 | extern boolean_t ipc_right_copyin_check( | |
177 | ipc_space_t space, | |
178 | mach_port_name_t name, | |
179 | ipc_entry_t entry, | |
180 | mach_msg_type_name_t msgt_name); | |
181 | ||
182 | /* Copyin a capability from a space */ | |
183 | extern kern_return_t ipc_right_copyin( | |
184 | ipc_space_t space, | |
185 | mach_port_name_t name, | |
186 | ipc_entry_t entry, | |
187 | mach_msg_type_name_t msgt_name, | |
188 | boolean_t deadok, | |
189 | ipc_object_t *objectp, | |
316670eb A |
190 | ipc_port_t *sorightp, |
191 | ipc_port_t *releasep, | |
3e170ce0 | 192 | int *assertcntp); |
1c79356b A |
193 | |
194 | /* Undo the effects of an ipc_right_copyin */ | |
195 | extern void ipc_right_copyin_undo( | |
196 | ipc_space_t space, | |
197 | mach_port_name_t name, | |
198 | ipc_entry_t entry, | |
199 | mach_msg_type_name_t msgt_name, | |
200 | ipc_object_t object, | |
201 | ipc_port_t soright); | |
202 | ||
fe8ab488 | 203 | /* Copyin a pair of dispositions from a space */ |
1c79356b A |
204 | extern kern_return_t ipc_right_copyin_two( |
205 | ipc_space_t space, | |
206 | mach_port_name_t name, | |
207 | ipc_entry_t entry, | |
fe8ab488 A |
208 | mach_msg_type_name_t msgt_one, |
209 | mach_msg_type_name_t msgt_two, | |
1c79356b | 210 | ipc_object_t *objectp, |
316670eb A |
211 | ipc_port_t *sorightp, |
212 | ipc_port_t *releasep); | |
1c79356b A |
213 | |
214 | /* Copyout a capability to a space */ | |
215 | extern kern_return_t ipc_right_copyout( | |
216 | ipc_space_t space, | |
217 | mach_port_name_t name, | |
218 | ipc_entry_t entry, | |
219 | mach_msg_type_name_t msgt_name, | |
220 | boolean_t overflow, | |
221 | ipc_object_t object); | |
222 | ||
223 | /* Reanme a capability */ | |
224 | extern kern_return_t ipc_right_rename( | |
225 | ipc_space_t space, | |
226 | mach_port_name_t oname, | |
227 | ipc_entry_t oentry, | |
228 | mach_port_name_t nname, | |
229 | ipc_entry_t nentry); | |
230 | ||
231 | #endif /* _IPC_IPC_RIGHT_H_ */ |