2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
53 * File: ipc/ipc_right.h
57 * Declarations of functions to manipulate IPC capabilities.
60 #ifndef _IPC_IPC_RIGHT_H_
61 #define _IPC_IPC_RIGHT_H_
63 #include <mach/boolean.h>
64 #include <mach/kern_return.h>
65 #include <ipc/ipc_port.h>
66 #include <ipc/ipc_entry.h>
68 #define ipc_right_lookup_read ipc_right_lookup_write
69 #define ipc_right_lookup_two_read ipc_right_lookup_two_write
71 /* Find an entry in a space, given the name */
72 extern kern_return_t
ipc_right_lookup_write(
74 mach_port_name_t name
,
77 /* Find two entries in a space, given two names */
78 extern kern_return_t
ipc_right_lookup_two_write(
80 mach_port_name_t name1
,
82 mach_port_name_t name2
,
83 ipc_entry_t
*entryp2
);
85 /* Translate (space, object) -> (name, entry) */
86 extern boolean_t
ipc_right_reverse(
89 mach_port_name_t
*namep
,
92 /* Make a dead-name request, returning the registered send-once right */
93 extern kern_return_t
ipc_right_dnrequest(
95 mach_port_name_t name
,
98 ipc_port_t
*previousp
);
100 /* Cancel a dead-name request and return the send-once right */
101 extern ipc_port_t
ipc_right_dncancel(
104 mach_port_name_t name
,
107 #define ipc_right_dncancel_macro(space, port, name, entry) \
108 ((entry->ie_request == 0) ? IP_NULL : \
109 ipc_right_dncancel((space), (port), (name), (entry)))
111 /* Check if an entry is being used */
112 extern boolean_t
ipc_right_inuse(
114 mach_port_name_t name
,
117 /* Check if the port has died */
118 extern boolean_t
ipc_right_check(
121 mach_port_name_t name
,
124 /* Clean up an entry in a dead space */
125 extern void ipc_right_clean(
127 mach_port_name_t name
,
130 /* Destroy an entry in a space */
131 extern kern_return_t
ipc_right_destroy(
133 mach_port_name_t name
,
136 /* Release a send/send-once/dead-name user reference */
137 extern kern_return_t
ipc_right_dealloc(
139 mach_port_name_t name
,
142 /* Modify the user-reference count for a right */
143 extern kern_return_t
ipc_right_delta(
145 mach_port_name_t name
,
147 mach_port_right_t right
,
148 mach_port_delta_t delta
);
150 /* Retrieve information about a right */
151 extern kern_return_t
ipc_right_info(
153 mach_port_name_t name
,
155 mach_port_type_t
*typep
,
156 mach_port_urefs_t
*urefsp
);
158 /* Check if a subsequent ipc_right_copyin would succeed */
159 extern boolean_t
ipc_right_copyin_check(
161 mach_port_name_t name
,
163 mach_msg_type_name_t msgt_name
);
165 /* Copyin a capability from a space */
166 extern kern_return_t
ipc_right_copyin(
168 mach_port_name_t name
,
170 mach_msg_type_name_t msgt_name
,
172 ipc_object_t
*objectp
,
173 ipc_port_t
*sorightp
);
175 /* Undo the effects of an ipc_right_copyin */
176 extern void ipc_right_copyin_undo(
178 mach_port_name_t name
,
180 mach_msg_type_name_t msgt_name
,
184 /* Copyin two send rights from a space */
185 extern kern_return_t
ipc_right_copyin_two(
187 mach_port_name_t name
,
189 ipc_object_t
*objectp
,
190 ipc_port_t
*sorightp
);
192 /* Copyout a capability to a space */
193 extern kern_return_t
ipc_right_copyout(
195 mach_port_name_t name
,
197 mach_msg_type_name_t msgt_name
,
199 ipc_object_t object
);
201 /* Reanme a capability */
202 extern kern_return_t
ipc_right_rename(
204 mach_port_name_t oname
,
206 mach_port_name_t nname
,
209 #endif /* _IPC_IPC_RIGHT_H_ */