|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University.
4: * Copyright (c) 1993,1994 The University of Utah and
5: * the Computer Systems Laboratory (CSL).
6: * All rights reserved.
7: *
8: * Permission to use, copy, modify and distribute this software and its
9: * documentation is hereby granted, provided that both the copyright
10: * notice and this permission notice appear in all copies of the
11: * software, derivative works or modified versions, and any portions
12: * thereof, and that both notices appear in supporting documentation.
13: *
14: * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
15: * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
16: * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
17: * THIS SOFTWARE.
18: *
19: * Carnegie Mellon requests users of this software to return to
20: *
21: * Software Distribution Coordinator or [email protected]
22: * School of Computer Science
23: * Carnegie Mellon University
24: * Pittsburgh PA 15213-3890
25: *
26: * any improvements or extensions that they make and grant Carnegie Mellon
27: * the rights to redistribute these changes.
28: */
29: /*
30: * File: mach/mach_port.defs
31: * Author: Rich Draves
32: *
33: * Copyright (c) 1989 Richard P. Draves, Jr.
34: *
35: * Exported kernel calls.
36: */
37:
38: subsystem
39: #if KERNEL_SERVER
40: KernelServer
41: #endif
42: mach_port 3200;
43:
44: #include <mach/std_types.defs>
45: #include <mach/mach_types.defs>
46:
47: /*
48: * Returns the set of port and port set names
49: * to which the target task has access, along with
50: * the type (set or port) for each name.
51: */
52:
53: routine mach_port_names(
54: task : ipc_space_t;
55: out names : mach_port_name_array_t =
56: ^array[] of mach_port_name_t
57: ctype: mach_port_array_t;
58: out types : mach_port_type_array_t =
59: ^array[] of mach_port_type_t);
60:
61: /*
62: * Returns the type (set or port) for the port name
63: * within the target task. Also indicates whether
64: * there is a dead-name request for the name.
65: */
66:
67: routine mach_port_type(
68: task : ipc_space_t;
69: name : mach_port_name_t;
70: out ptype : mach_port_type_t);
71:
72: /*
73: * Changes the name by which a port (or port set) is known to
74: * the target task. The new name can't be in use. The
75: * old name becomes available for recycling.
76: */
77:
78: routine mach_port_rename(
79: task : ipc_space_t;
80: old_name : mach_port_name_t;
81: new_name : mach_port_name_t);
82:
83: /*
84: * Allocates the specified kind of object, with the given name.
85: * The right must be one of
86: * MACH_PORT_RIGHT_RECEIVE
87: * MACH_PORT_RIGHT_PORT_SET
88: * MACH_PORT_RIGHT_DEAD_NAME
89: * New port sets are empty. New ports don't have any
90: * send/send-once rights or queued messages. The make-send
91: * count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
92: * New sets, ports, and dead names have one user reference.
93: */
94:
95: routine mach_port_allocate_name(
96: task : ipc_space_t;
97: right : mach_port_right_t;
98: name : mach_port_name_t);
99:
100: /*
101: * Allocates the specified kind of object.
102: * The right must be one of
103: * MACH_PORT_RIGHT_RECEIVE
104: * MACH_PORT_RIGHT_PORT_SET
105: * MACH_PORT_RIGHT_DEAD_NAME
106: * Like port_allocate_name, but the kernel picks a name.
107: * It can use any name not associated with a right.
108: */
109:
110: routine mach_port_allocate(
111: task : ipc_space_t;
112: right : mach_port_right_t;
113: out name : mach_port_name_t);
114:
115: /*
116: * Destroys all rights associated with the name and makes it
117: * available for recycling immediately. The name can be a
118: * port (possibly with multiple user refs), a port set, or
119: * a dead name (again, with multiple user refs).
120: */
121:
122: routine mach_port_destroy(
123: task : ipc_space_t;
124: name : mach_port_name_t);
125:
126: /*
127: * Releases one send/send-once/dead-name user ref.
128: * Just like mach_port_mod_refs -1, but deduces the
129: * correct type of right. This allows a user task
130: * to release a ref for a port without worrying
131: * about whether the port has died or not.
132: */
133:
134: routine mach_port_deallocate(
135: task : ipc_space_t;
136: name : mach_port_name_t);
137:
138: /*
139: * A port set always has one user ref.
140: * A send-once right always has one user ref.
141: * A dead name always has one or more user refs.
142: * A send right always has one or more user refs.
143: * A receive right always has one user ref.
144: * The right must be one of
145: * MACH_PORT_RIGHT_RECEIVE
146: * MACH_PORT_RIGHT_PORT_SET
147: * MACH_PORT_RIGHT_DEAD_NAME
148: * MACH_PORT_RIGHT_SEND
149: * MACH_PORT_RIGHT_SEND_ONCE
150: */
151:
152: routine mach_port_get_refs(
153: task : ipc_space_t;
154: name : mach_port_name_t;
155: right : mach_port_right_t;
156: out refs : mach_port_urefs_t);
157:
158: /*
159: * The delta is a signed change to the task's
160: * user ref count for the right. Only dead names
161: * and send rights can have a positive delta.
162: * The resulting user ref count can't be negative.
163: * If it is zero, the right is deallocated.
164: * If the name isn't a composite right, it becomes
165: * available for recycling. The right must be one of
166: * MACH_PORT_RIGHT_RECEIVE
167: * MACH_PORT_RIGHT_PORT_SET
168: * MACH_PORT_RIGHT_DEAD_NAME
169: * MACH_PORT_RIGHT_SEND
170: * MACH_PORT_RIGHT_SEND_ONCE
171: */
172:
173: routine mach_port_mod_refs(
174: task : ipc_space_t;
175: name : mach_port_name_t;
176: right : mach_port_right_t;
177: delta : mach_port_delta_t);
178:
179: /*
180: * Temporary compatibility call.
181: */
182:
183: routine old_mach_port_get_receive_status(
184: task : ipc_space_t;
185: name : mach_port_name_t;
186: out status : old_mach_port_status_t);
187:
188: /*
189: * Only valid for receive rights.
190: * Sets the queue-limit for the port.
191: * The limit must be
192: * 1 <= qlimit <= MACH_PORT_QLIMIT_MAX
193: */
194:
195: routine mach_port_set_qlimit(
196: task : ipc_space_t;
197: name : mach_port_name_t;
198: qlimit : mach_port_msgcount_t);
199:
200: /*
201: * Only valid for receive rights.
202: * Sets the make-send count for the port.
203: */
204:
205: routine mach_port_set_mscount(
206: task : ipc_space_t;
207: name : mach_port_name_t;
208: mscount : mach_port_mscount_t);
209:
210: /*
211: * Only valid for port sets. Returns a list of
212: * the members.
213: */
214:
215: routine mach_port_get_set_status(
216: task : ipc_space_t;
217: name : mach_port_name_t;
218: out members : mach_port_name_array_t =
219: ^array[] of mach_port_name_t
220: ctype: mach_port_array_t);
221:
222: /*
223: * Puts the member port (the task must have receive rights)
224: * into the after port set. (Or removes it from any port set
225: * if after is MACH_PORT_NULL.) If the port is already in
226: * a set, does an atomic move.
227: */
228:
229: routine mach_port_move_member(
230: task : ipc_space_t;
231: member : mach_port_name_t;
232: after : mach_port_name_t);
233:
234: /*
235: * Requests a notification from the kernel. The request
236: * must supply the send-once right which is used for
237: * the notification. If a send-once right was previously
238: * registered, it is returned. The msg_id must be one of
239: * MACH_NOTIFY_PORT_DESTROYED (receive rights)
240: * MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
241: * MACH_NOTIFY_NO_SENDERS (receive rights)
242: *
243: * The sync value specifies whether a notification should
244: * get sent immediately, if appropriate. The exact meaning
245: * depends on the notification:
246: * MACH_NOTIFY_PORT_DESTROYED: must be zero.
247: * MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
248: * and the notification gets sent immediately.
249: * If zero, then name can't be dead.
250: * MACH_NOTIFY_NO_SENDERS: the notification gets sent
251: * immediately if the current mscount is greater
252: * than or equal to the sync value and there are no
253: * extant send rights.
254: */
255:
256: routine mach_port_request_notification(
257: task : ipc_space_t;
258: name : mach_port_name_t;
259: id : mach_msg_id_t;
260: sync : mach_port_mscount_t;
261: notify : mach_port_send_once_t;
262: out previous : mach_port_send_once_t);
263:
264: /*
265: * Inserts the specified rights into the target task,
266: * using the specified name. If inserting send/receive
267: * rights and the task already has send/receive rights
268: * for the port, then the names must agree. In any case,
269: * the task gains a user ref for the port.
270: */
271:
272: routine mach_port_insert_right(
273: task : ipc_space_t;
274: name : mach_port_name_t;
275: poly : mach_port_poly_t);
276:
277: /*
278: * Returns the specified right for the named port
279: * in the target task, extracting that right from
280: * the target task. The target task loses a user
281: * ref and the name may be available for recycling.
282: * msgt_name must be one of
283: * MACH_MSG_TYPE_MOVE_RECEIVE
284: * MACH_MSG_TYPE_COPY_SEND
285: * MACH_MSG_TYPE_MAKE_SEND
286: * MACH_MSG_TYPE_MOVE_SEND
287: * MACH_MSG_TYPE_MAKE_SEND_ONCE
288: * MACH_MSG_TYPE_MOVE_SEND_ONCE
289: */
290:
291: routine mach_port_extract_right(
292: task : ipc_space_t;
293: name : mach_port_name_t;
294: msgt_name : mach_msg_type_name_t;
295: out poly : mach_port_poly_t);
296:
297: /*
298: * The task must have receive rights for the named port.
299: * Returns a status structure (see mach/port.h).
300: */
301:
302: routine mach_port_get_receive_status(
303: task : ipc_space_t;
304: name : mach_port_name_t;
305: out status : mach_port_status_t);
306:
307: /*
308: * Only valid for receive rights.
309: * Sets the sequence number for the port.
310: */
311:
312: routine mach_port_set_seqno(
313: task : ipc_space_t;
314: name : mach_port_name_t;
315: seqno : mach_port_seqno_t);
316:
317: #ifdef MIGRATING_THREADS
318: /*
319: * Only valid for receive rights.
320: * Set the user-mode entry info for RPCs coming through this port.
321: * Do this BEFORE attaching an ActPool to this port,
322: * unless you can be sure no RPCs will be coming through it yet.
323: */
324:
325: routine mach_port_set_rpcinfo(
326: task : ipc_space_t;
327: name : mach_port_name_t;
328: rpc_info : thread_info_t); /* XXX */
329:
330: /*
331: * Only valid for receive rights.
332: * Create a new activation for migrating RPC, and attach it to the port's ActPool.
333: * Create an ActPool for the port if it doesn't already have one.
334: * Supply a stack and receive memory buffer.
335: */
336:
337: routine mach_port_create_act(
338: task : task_t;
339: name : mach_port_name_t;
340: user_stack : vm_offset_t;
341: user_rbuf : vm_offset_t;
342: user_rbuf_size : vm_size_t;
343: out new_act : thread_t);
344:
345: #endif /* MIGRATING_THREADS */
346:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.