]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ipc/ipc_right.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / ipc / ipc_right.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
8ad349bb
A
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
1c79356b
A
29 */
30/*
31 * @OSF_COPYRIGHT@
32 */
33/*
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
36 * All Rights Reserved.
37 *
38 * Permission to use, copy, modify and distribute this software and its
39 * documentation is hereby granted, provided that both the copyright
40 * notice and this permission notice appear in all copies of the
41 * software, derivative works or modified versions, and any portions
42 * thereof, and that both notices appear in supporting documentation.
43 *
44 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
45 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
46 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
47 *
48 * Carnegie Mellon requests users of this software to return to
49 *
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
54 *
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
57 */
58/*
59 */
60/*
61 * File: ipc/ipc_right.h
62 * Author: Rich Draves
63 * Date: 1989
64 *
65 * Declarations of functions to manipulate IPC capabilities.
66 */
67
68#ifndef _IPC_IPC_RIGHT_H_
69#define _IPC_IPC_RIGHT_H_
70
71#include <mach/boolean.h>
72#include <mach/kern_return.h>
73#include <ipc/ipc_port.h>
74#include <ipc/ipc_entry.h>
75
76#define ipc_right_lookup_read ipc_right_lookup_write
77#define ipc_right_lookup_two_read ipc_right_lookup_two_write
78
79/* Find an entry in a space, given the name */
80extern kern_return_t ipc_right_lookup_write(
81 ipc_space_t space,
82 mach_port_name_t name,
83 ipc_entry_t *entryp);
84
85/* Find two entries in a space, given two names */
86extern kern_return_t ipc_right_lookup_two_write(
87 ipc_space_t space,
88 mach_port_name_t name1,
89 ipc_entry_t *entryp1,
90 mach_port_name_t name2,
91 ipc_entry_t *entryp2);
92
93/* Translate (space, object) -> (name, entry) */
94extern boolean_t ipc_right_reverse(
95 ipc_space_t space,
96 ipc_object_t object,
97 mach_port_name_t *namep,
98 ipc_entry_t *entryp);
99
100/* Make a dead-name request, returning the registered send-once right */
101extern kern_return_t ipc_right_dnrequest(
102 ipc_space_t space,
103 mach_port_name_t name,
104 boolean_t immediate,
105 ipc_port_t notify,
106 ipc_port_t *previousp);
107
108/* Cancel a dead-name request and return the send-once right */
109extern ipc_port_t ipc_right_dncancel(
110 ipc_space_t space,
111 ipc_port_t port,
112 mach_port_name_t name,
113 ipc_entry_t entry);
114
115#define ipc_right_dncancel_macro(space, port, name, entry) \
116 ((entry->ie_request == 0) ? IP_NULL : \
117 ipc_right_dncancel((space), (port), (name), (entry)))
118
119/* Check if an entry is being used */
120extern boolean_t ipc_right_inuse(
121 ipc_space_t space,
122 mach_port_name_t name,
123 ipc_entry_t entry);
124
125/* Check if the port has died */
126extern boolean_t ipc_right_check(
127 ipc_space_t space,
128 ipc_port_t port,
129 mach_port_name_t name,
130 ipc_entry_t entry);
131
132/* Clean up an entry in a dead space */
133extern void ipc_right_clean(
134 ipc_space_t space,
135 mach_port_name_t name,
136 ipc_entry_t entry);
137
138/* Destroy an entry in a space */
139extern kern_return_t ipc_right_destroy(
140 ipc_space_t space,
141 mach_port_name_t name,
142 ipc_entry_t entry);
143
144/* Release a send/send-once/dead-name user reference */
145extern kern_return_t ipc_right_dealloc(
146 ipc_space_t space,
147 mach_port_name_t name,
148 ipc_entry_t entry);
149
150/* Modify the user-reference count for a right */
151extern kern_return_t ipc_right_delta(
152 ipc_space_t space,
153 mach_port_name_t name,
154 ipc_entry_t entry,
155 mach_port_right_t right,
156 mach_port_delta_t delta);
157
158/* Retrieve information about a right */
159extern kern_return_t ipc_right_info(
160 ipc_space_t space,
161 mach_port_name_t name,
162 ipc_entry_t entry,
163 mach_port_type_t *typep,
164 mach_port_urefs_t *urefsp);
165
166/* Check if a subsequent ipc_right_copyin would succeed */
167extern boolean_t ipc_right_copyin_check(
168 ipc_space_t space,
169 mach_port_name_t name,
170 ipc_entry_t entry,
171 mach_msg_type_name_t msgt_name);
172
173/* Copyin a capability from a space */
174extern kern_return_t ipc_right_copyin(
175 ipc_space_t space,
176 mach_port_name_t name,
177 ipc_entry_t entry,
178 mach_msg_type_name_t msgt_name,
179 boolean_t deadok,
180 ipc_object_t *objectp,
181 ipc_port_t *sorightp);
182
183/* Undo the effects of an ipc_right_copyin */
184extern void ipc_right_copyin_undo(
185 ipc_space_t space,
186 mach_port_name_t name,
187 ipc_entry_t entry,
188 mach_msg_type_name_t msgt_name,
189 ipc_object_t object,
190 ipc_port_t soright);
191
192/* Copyin two send rights from a space */
193extern kern_return_t ipc_right_copyin_two(
194 ipc_space_t space,
195 mach_port_name_t name,
196 ipc_entry_t entry,
197 ipc_object_t *objectp,
198 ipc_port_t *sorightp);
199
200/* Copyout a capability to a space */
201extern kern_return_t ipc_right_copyout(
202 ipc_space_t space,
203 mach_port_name_t name,
204 ipc_entry_t entry,
205 mach_msg_type_name_t msgt_name,
206 boolean_t overflow,
207 ipc_object_t object);
208
209/* Reanme a capability */
210extern kern_return_t ipc_right_rename(
211 ipc_space_t space,
212 mach_port_name_t oname,
213 ipc_entry_t oentry,
214 mach_port_name_t nname,
215 ipc_entry_t nentry);
216
217#endif /* _IPC_IPC_RIGHT_H_ */