2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
31 * All Rights Reserved.
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.
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.
43 * Carnegie Mellon requests users of this software to return to
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
56 * File: ipc/ipc_right.h
60 * Declarations of functions to manipulate IPC capabilities.
63 #ifndef _IPC_IPC_RIGHT_H_
64 #define _IPC_IPC_RIGHT_H_
66 #include <mach/boolean.h>
67 #include <mach/kern_return.h>
68 #include <ipc/ipc_port.h>
69 #include <ipc/ipc_entry.h>
71 #define ipc_right_lookup_read ipc_right_lookup_write
72 #define ipc_right_lookup_two_read ipc_right_lookup_two_write
74 /* Find an entry in a space, given the name */
75 extern kern_return_t
ipc_right_lookup_write(
77 mach_port_name_t name
,
80 /* Find two entries in a space, given two names */
81 extern kern_return_t
ipc_right_lookup_two_write(
83 mach_port_name_t name1
,
85 mach_port_name_t name2
,
86 ipc_entry_t
*entryp2
);
88 /* Translate (space, object) -> (name, entry) */
89 extern boolean_t
ipc_right_reverse(
92 mach_port_name_t
*namep
,
95 /* Make a dead-name request, returning the registered send-once right */
96 extern kern_return_t
ipc_right_dnrequest(
98 mach_port_name_t name
,
101 ipc_port_t
*previousp
);
103 /* Cancel a dead-name request and return the send-once right */
104 extern ipc_port_t
ipc_right_dncancel(
107 mach_port_name_t name
,
110 #define ipc_right_dncancel_macro(space, port, name, entry) \
111 ((entry->ie_request == 0) ? IP_NULL : \
112 ipc_right_dncancel((space), (port), (name), (entry)))
114 /* Check if an entry is being used */
115 extern boolean_t
ipc_right_inuse(
117 mach_port_name_t name
,
120 /* Check if the port has died */
121 extern boolean_t
ipc_right_check(
124 mach_port_name_t name
,
127 /* Clean up an entry in a dead space */
128 extern void ipc_right_clean(
130 mach_port_name_t name
,
133 /* Destroy an entry in a space */
134 extern kern_return_t
ipc_right_destroy(
136 mach_port_name_t name
,
139 /* Release a send/send-once/dead-name user reference */
140 extern kern_return_t
ipc_right_dealloc(
142 mach_port_name_t name
,
145 /* Modify the user-reference count for a right */
146 extern kern_return_t
ipc_right_delta(
148 mach_port_name_t name
,
150 mach_port_right_t right
,
151 mach_port_delta_t delta
);
153 /* Retrieve information about a right */
154 extern kern_return_t
ipc_right_info(
156 mach_port_name_t name
,
158 mach_port_type_t
*typep
,
159 mach_port_urefs_t
*urefsp
);
161 /* Check if a subsequent ipc_right_copyin would succeed */
162 extern boolean_t
ipc_right_copyin_check(
164 mach_port_name_t name
,
166 mach_msg_type_name_t msgt_name
);
168 /* Copyin a capability from a space */
169 extern kern_return_t
ipc_right_copyin(
171 mach_port_name_t name
,
173 mach_msg_type_name_t msgt_name
,
175 ipc_object_t
*objectp
,
176 ipc_port_t
*sorightp
);
178 /* Undo the effects of an ipc_right_copyin */
179 extern void ipc_right_copyin_undo(
181 mach_port_name_t name
,
183 mach_msg_type_name_t msgt_name
,
187 /* Copyin two send rights from a space */
188 extern kern_return_t
ipc_right_copyin_two(
190 mach_port_name_t name
,
192 ipc_object_t
*objectp
,
193 ipc_port_t
*sorightp
);
195 /* Copyout a capability to a space */
196 extern kern_return_t
ipc_right_copyout(
198 mach_port_name_t name
,
200 mach_msg_type_name_t msgt_name
,
202 ipc_object_t object
);
204 /* Reanme a capability */
205 extern kern_return_t
ipc_right_rename(
207 mach_port_name_t oname
,
209 mach_port_name_t nname
,
212 #endif /* _IPC_IPC_RIGHT_H_ */