|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /*
26: * Mach Operating System
27: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
28: * All Rights Reserved.
29: *
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.
35: *
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.
39: *
40: * Carnegie Mellon requests users of this software to return to
41: *
42: * Software Distribution Coordinator or [email protected]
43: * School of Computer Science
44: * Carnegie Mellon University
45: * Pittsburgh PA 15213-3890
46: *
47: * any improvements or extensions that they make and grant Carnegie Mellon
48: * the rights to redistribute these changes.
49: */
50: /*
51: * HISTORY
52: * $Log: mach_port.defs,v $
1.1.1.2 ! root 53: * Revision 1.3 1999/07/22 20:04:01 wsanchez
! 54: * Update APSL
! 55: *
! 56: * Revision 1.2 1999/03/25 09:19:41 wsanchez
! 57: * Merge kernel-copyrights.
! 58: * Undelete drvAdaptecU2SCSI.
! 59: *
1.1 root 60: * Revision 1.1.1.1.666.4 1999/03/16 17:05:39 wsanchez
61: * Substitute License
62: *
63: * Revision 1.1.1.1.666.3 1999/03/16 15:28:03 wsanchez
64: * Substitute copyright
65: *
66: * Revision 1.1.1.1.666.2 1999/03/16 10:37:38 umeshv
67: * Fixed errors in previous commit.
68: *
69: * Revision 1.1.1.1.666.1 1999/03/11 09:52:49 umeshv
70: * Added copyrights.
71: *
72: * Revision 1.1.1.1 1997/09/30 02:44:50 wsanchez
73: * Import of kernel from umeshv/kernel
74: *
75: * Revision 2.6 92/01/14 16:45:25 rpd
76: * Changed mach_port_{name,type}_array_t usages to remain compatible,
77: * because the definition of the types changed incompatibly.
78: * [92/01/13 rpd]
79: *
80: * Revision 2.5 91/08/28 11:15:13 jsb
81: * Added mach_port_set_seqno. Moved mach_port_get_receive_status
82: * to a new id, renaming the old call old_mach_port_get_receive_status.
83: * [91/08/09 rpd]
84: *
85: * Revision 2.4 91/05/14 16:54:47 mrt
86: * Correcting copyright
87: *
88: * Revision 2.3 91/02/05 17:33:31 mrt
89: * Changed to new Mach copyright
90: * [91/02/01 17:18:11 mrt]
91: *
92: * Revision 2.2 90/06/02 14:58:25 rpd
93: * Modified mach_port_get_receive_status to return
94: * a status structure (mach_port_status_t).
95: * Updated mach_port_set_qlimit comment.
96: * [90/05/13 rpd]
97: * Created for new IPC.
98: * [90/03/26 23:45:32 rpd]
99: *
100: */
101: /*
102: * File: mach/mach_port.defs
103: * Author: Rich Draves
104: *
105: * Copyright (c) 1989 Richard P. Draves, Jr.
106: *
107: * Exported kernel calls.
108: */
109:
110: subsystem
111: #if KERNEL_SERVER
112: KernelServer
113: #endif KERNEL_SERVER
114: mach_port 3200;
115:
116: #include <mach/std_types.defs>
117: #include <mach/mach_types.defs>
118:
119: /*
120: * Returns the set of port and port set names
121: * to which the target task has access, along with
122: * the type (set or port) for each name.
123: */
124:
125: routine mach_port_names(
126: task : ipc_space_t;
127: out names : mach_port_name_array_t =
128: ^array[] of mach_port_name_t
129: ctype: mach_port_array_t;
130: out types : mach_port_type_array_t =
131: ^array[] of mach_port_type_t);
132:
133: /*
134: * Returns the type (set or port) for the port name
135: * within the target task. Also indicates whether
136: * there is a dead-name request for the name.
137: */
138:
139: routine mach_port_type(
140: task : ipc_space_t;
141: name : mach_port_name_t;
142: out ptype : mach_port_type_t);
143:
144: /*
145: * Changes the name by which a port (or port set) is known to
146: * the target task. The new name can't be in use. The
147: * old name becomes available for recycling.
148: */
149:
150: routine mach_port_rename(
151: task : ipc_space_t;
152: old_name : mach_port_name_t;
153: new_name : mach_port_name_t);
154:
155: /*
156: * Allocates the specified kind of object, with the given name.
157: * The right must be one of
158: * MACH_PORT_RIGHT_RECEIVE
159: * MACH_PORT_RIGHT_PORT_SET
160: * MACH_PORT_RIGHT_DEAD_NAME
161: * New port sets are empty. New ports don't have any
162: * send/send-once rights or queued messages. The make-send
163: * count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
164: * New sets, ports, and dead names have one user reference.
165: */
166:
167: routine mach_port_allocate_name(
168: task : ipc_space_t;
169: right : mach_port_right_t;
170: name : mach_port_name_t);
171:
172: /*
173: * Allocates the specified kind of object.
174: * The right must be one of
175: * MACH_PORT_RIGHT_RECEIVE
176: * MACH_PORT_RIGHT_PORT_SET
177: * MACH_PORT_RIGHT_DEAD_NAME
178: * Like port_allocate_name, but the kernel picks a name.
179: * It can use any name not associated with a right.
180: */
181:
182: routine mach_port_allocate(
183: task : ipc_space_t;
184: right : mach_port_right_t;
185: out name : mach_port_name_t);
186:
187: /*
188: * Destroys all rights associated with the name and makes it
189: * available for recycling immediately. The name can be a
190: * port (possibly with multiple user refs), a port set, or
191: * a dead name (again, with multiple user refs).
192: */
193:
194: routine mach_port_destroy(
195: task : ipc_space_t;
196: name : mach_port_name_t);
197:
198: /*
199: * Releases one send/send-once/dead-name user ref.
200: * Just like mach_port_mod_refs -1, but deduces the
201: * correct type of right. This allows a user task
202: * to release a ref for a port without worrying
203: * about whether the port has died or not.
204: */
205:
206: routine mach_port_deallocate(
207: task : ipc_space_t;
208: name : mach_port_name_t);
209:
210: /*
211: * A port set always has one user ref.
212: * A send-once right always has one user ref.
213: * A dead name always has one or more user refs.
214: * A send right always has one or more user refs.
215: * A receive right always has one user ref.
216: * The right must be one of
217: * MACH_PORT_RIGHT_RECEIVE
218: * MACH_PORT_RIGHT_PORT_SET
219: * MACH_PORT_RIGHT_DEAD_NAME
220: * MACH_PORT_RIGHT_SEND
221: * MACH_PORT_RIGHT_SEND_ONCE
222: */
223:
224: routine mach_port_get_refs(
225: task : ipc_space_t;
226: name : mach_port_name_t;
227: right : mach_port_right_t;
228: out refs : mach_port_urefs_t);
229:
230: /*
231: * The delta is a signed change to the task's
232: * user ref count for the right. Only dead names
233: * and send rights can have a positive delta.
234: * The resulting user ref count can't be negative.
235: * If it is zero, the right is deallocated.
236: * If the name isn't a composite right, it becomes
237: * available for recycling. The right must be one of
238: * MACH_PORT_RIGHT_RECEIVE
239: * MACH_PORT_RIGHT_PORT_SET
240: * MACH_PORT_RIGHT_DEAD_NAME
241: * MACH_PORT_RIGHT_SEND
242: * MACH_PORT_RIGHT_SEND_ONCE
243: */
244:
245: routine mach_port_mod_refs(
246: task : ipc_space_t;
247: name : mach_port_name_t;
248: right : mach_port_right_t;
249: delta : mach_port_delta_t);
250:
251: skip; /* was old_mach_port_get_receive_status */
252:
253: /*
254: * Only valid for receive rights.
255: * Sets the queue-limit for the port.
256: * The limit must be
257: * 1 <= qlimit <= MACH_PORT_QLIMIT_MAX
258: */
259:
260: routine mach_port_set_qlimit(
261: task : ipc_space_t;
262: name : mach_port_name_t;
263: qlimit : mach_port_msgcount_t);
264:
265: /*
266: * Only valid for receive rights.
267: * Sets the make-send count for the port.
268: */
269:
270: routine mach_port_set_mscount(
271: task : ipc_space_t;
272: name : mach_port_name_t;
273: mscount : mach_port_mscount_t);
274:
275: /*
276: * Only valid for port sets. Returns a list of
277: * the members.
278: */
279:
280: routine mach_port_get_set_status(
281: task : ipc_space_t;
282: name : mach_port_name_t;
283: out members : mach_port_name_array_t =
284: ^array[] of mach_port_name_t
285: ctype: mach_port_array_t);
286:
287: /*
288: * Puts the member port (the task must have receive rights)
289: * into the after port set. (Or removes it from any port set
290: * if after is MACH_PORT_NULL.) If the port is already in
291: * a set, does an atomic move.
292: */
293:
294: routine mach_port_move_member(
295: task : ipc_space_t;
296: member : mach_port_name_t;
297: after : mach_port_name_t);
298:
299: /*
300: * Requests a notification from the kernel. The request
301: * must supply the send-once right which is used for
302: * the notification. If a send-once right was previously
303: * registered, it is returned. The msg_id must be one of
304: * MACH_NOTIFY_PORT_DESTROYED (receive rights)
305: * MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
306: * MACH_NOTIFY_NO_SENDERS (receive rights)
307: *
308: * The sync value specifies whether a notification should
309: * get sent immediately, if appropriate. The exact meaning
310: * depends on the notification:
311: * MACH_NOTIFY_PORT_DESTROYED: must be zero.
312: * MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
313: * and the notification gets sent immediately.
314: * If zero, then name can't be dead.
315: * MACH_NOTIFY_NO_SENDERS: the notification gets sent
316: * immediately if the current mscount is greater
317: * than or equal to the sync value and there are no
318: * extant send rights.
319: */
320:
321: routine mach_port_request_notification(
322: task : ipc_space_t;
323: name : mach_port_name_t;
324: id : mach_msg_id_t;
325: sync : mach_port_mscount_t;
326: notify : mach_port_send_once_t;
327: out previous : mach_port_send_once_t);
328:
329: /*
330: * Inserts the specified rights into the target task,
331: * using the specified name. If inserting send/receive
332: * rights and the task already has send/receive rights
333: * for the port, then the names must agree. In any case,
334: * the task gains a user ref for the port.
335: */
336:
337: routine mach_port_insert_right(
338: task : ipc_space_t;
339: name : mach_port_name_t;
340: poly : mach_port_poly_t);
341:
342: /*
343: * Returns the specified right for the named port
344: * in the target task, extracting that right from
345: * the target task. The target task loses a user
346: * ref and the name may be available for recycling.
347: * msgt_name must be one of
348: * MACH_MSG_TYPE_MOVE_RECEIVE
349: * MACH_MSG_TYPE_COPY_SEND
350: * MACH_MSG_TYPE_MAKE_SEND
351: * MACH_MSG_TYPE_MOVE_SEND
352: * MACH_MSG_TYPE_MAKE_SEND_ONCE
353: * MACH_MSG_TYPE_MOVE_SEND_ONCE
354: */
355:
356: routine mach_port_extract_right(
357: task : ipc_space_t;
358: name : mach_port_name_t;
359: msgt_name : mach_msg_type_name_t;
360: out poly : mach_port_poly_t);
361:
362: /*
363: * The task must have receive rights for the named port.
364: * Returns a status structure (see mach/port.h).
365: */
366:
367: routine mach_port_get_receive_status(
368: task : ipc_space_t;
369: name : mach_port_name_t;
370: out status : mach_port_status_t);
371:
372: /*
373: * Only valid for receive rights.
374: * Sets the sequence number for the port.
375: */
376:
377: routine mach_port_set_seqno(
378: task : ipc_space_t;
379: name : mach_port_name_t;
380: seqno : mach_port_seqno_t);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.