]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/message.h
a346aa32741820d9acf1aa194b5014e4dbbf8cf2
[apple/xnu.git] / osfmk / mach / message.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 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 Software.Distribution@CS.CMU.EDU
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 */
52 /*
53 * File: mach/message.h
54 *
55 * Mach IPC message and primitive function definitions.
56 */
57
58 #ifndef _MACH_MESSAGE_H_
59 #define _MACH_MESSAGE_H_
60
61 #ifdef MACH_KERNEL
62 /* Have to have MIG parameter check for kernel */
63 #define TypeCheck 1
64 #define _MIG_KERNEL_SPECIFIC_CODE_ 1
65 #endif /* MACH_KERNEL */
66
67 /* static templates are slower and bigger */
68 /* #define UseStaticTemplates 0 */
69
70 #include <sys/appleapiopts.h>
71
72 #include <stdint.h>
73 #include <mach/port.h>
74 #include <mach/boolean.h>
75 #include <mach/kern_return.h>
76 #include <mach/machine/vm_types.h>
77
78 /*
79 * The timeout mechanism uses mach_msg_timeout_t values,
80 * passed by value. The timeout units are milliseconds.
81 * It is controlled with the MACH_SEND_TIMEOUT
82 * and MACH_RCV_TIMEOUT options.
83 */
84
85 typedef natural_t mach_msg_timeout_t;
86
87 /*
88 * The value to be used when there is no timeout.
89 * (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
90 */
91
92 #define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
93
94 /*
95 * The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. It it isn't on, it
96 * assumes the body of the message doesn't contain port rights or OOL
97 * data. The field is set in received messages. A user task must
98 * use caution in interpreting the body of a message if the bit isn't
99 * on, because the mach_msg_type's in the body might "lie" about the
100 * contents. If the bit isn't on, but the mach_msg_types
101 * in the body specify rights or OOL data, the behavior is undefined.
102 * (Ie, an error may or may not be produced.)
103 *
104 * The value of MACH_MSGH_BITS_REMOTE determines the interpretation
105 * of the msgh_remote_port field. It is handled like a msgt_name.
106 *
107 * The value of MACH_MSGH_BITS_LOCAL determines the interpretation
108 * of the msgh_local_port field. It is handled like a msgt_name.
109 *
110 * MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
111 * and local fields, into a single value suitable for msgh_bits.
112 *
113 * MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
114 *
115 * The unused bits should be zero and are reserved for the kernel
116 * or for future interface expansion.
117 */
118
119 #define MACH_MSGH_BITS_ZERO 0x00000000
120 #define MACH_MSGH_BITS_REMOTE_MASK 0x000000ff
121 #define MACH_MSGH_BITS_LOCAL_MASK 0x0000ff00
122 #define MACH_MSGH_BITS_COMPLEX 0x80000000U
123 #define MACH_MSGH_BITS_USER 0x8000ffffU
124
125 #define MACH_MSGH_BITS_CIRCULAR 0x40000000 /* internal use only */
126 #define MACH_MSGH_BITS_USED 0xc000ffffU
127
128 #define MACH_MSGH_BITS_PORTS_MASK \
129 (MACH_MSGH_BITS_REMOTE_MASK|MACH_MSGH_BITS_LOCAL_MASK)
130
131 #define MACH_MSGH_BITS(remote, local) \
132 ((remote) | ((local) << 8))
133 #define MACH_MSGH_BITS_REMOTE(bits) \
134 ((bits) & MACH_MSGH_BITS_REMOTE_MASK)
135 #define MACH_MSGH_BITS_LOCAL(bits) \
136 (((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
137 #define MACH_MSGH_BITS_PORTS(bits) \
138 ((bits) & MACH_MSGH_BITS_PORTS_MASK)
139 #define MACH_MSGH_BITS_OTHER(bits) \
140 ((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
141
142 /*
143 * Every message starts with a message header.
144 * Following the message header are zero or more pairs of
145 * type descriptors (mach_msg_type_t/mach_msg_type_long_t) and
146 * data values. The size of the message must be specified in bytes,
147 * and includes the message header, type descriptors, inline
148 * data, and inline pointer for out-of-line data.
149 *
150 * The msgh_remote_port field specifies the destination of the message.
151 * It must specify a valid send or send-once right for a port.
152 *
153 * The msgh_local_port field specifies a "reply port". Normally,
154 * This field carries a send-once right that the receiver will use
155 * to reply to the message. It may carry the values MACH_PORT_NULL,
156 * MACH_PORT_DEAD, a send-once right, or a send right.
157 *
158 * The msgh_seqno field carries a sequence number associated with the
159 * received-from port. A port's sequence number is incremented every
160 * time a message is received from it. In sent messages, the field's
161 * value is ignored.
162 *
163 * The msgh_id field is uninterpreted by the message primitives.
164 * It normally carries information specifying the format
165 * or meaning of the message.
166 */
167
168 typedef unsigned int mach_msg_bits_t;
169 typedef natural_t mach_msg_size_t;
170 typedef integer_t mach_msg_id_t;
171
172
173 #define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
174
175 typedef unsigned int mach_msg_type_name_t;
176
177 #define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive rights */
178 #define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send rights */
179 #define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce rights */
180 #define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send rights */
181 #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive rights */
182 #define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive rights */
183 #define MACH_MSG_TYPE_COPY_RECEIVE 22 /* Must hold receive rights */
184
185 typedef unsigned int mach_msg_copy_options_t;
186
187 #define MACH_MSG_PHYSICAL_COPY 0
188 #define MACH_MSG_VIRTUAL_COPY 1
189 #define MACH_MSG_ALLOCATE 2
190 #define MACH_MSG_OVERWRITE 3
191 #ifdef MACH_KERNEL
192 #define MACH_MSG_KALLOC_COPY_T 4
193 #endif /* MACH_KERNEL */
194
195 typedef unsigned int mach_msg_descriptor_type_t;
196
197 #define MACH_MSG_PORT_DESCRIPTOR 0
198 #define MACH_MSG_OOL_DESCRIPTOR 1
199 #define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
200 #define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
201
202
203 typedef struct
204 {
205 void* pad1;
206 mach_msg_size_t pad2;
207 unsigned int pad3 : 24;
208 mach_msg_descriptor_type_t type : 8;
209 } mach_msg_type_descriptor_t;
210
211 typedef struct
212 {
213 mach_port_t name;
214 mach_msg_size_t pad1;
215 unsigned int pad2 : 16;
216 mach_msg_type_name_t disposition : 8;
217 mach_msg_descriptor_type_t type : 8;
218 } mach_msg_port_descriptor_t;
219
220 typedef struct
221 {
222 void* address;
223 mach_msg_size_t size;
224 boolean_t deallocate: 8;
225 mach_msg_copy_options_t copy: 8;
226 unsigned int pad1: 8;
227 mach_msg_descriptor_type_t type: 8;
228 } mach_msg_ool_descriptor_t;
229
230 typedef struct
231 {
232 void* address;
233 mach_msg_size_t count;
234 boolean_t deallocate: 8;
235 mach_msg_copy_options_t copy: 8;
236 mach_msg_type_name_t disposition : 8;
237 mach_msg_descriptor_type_t type : 8;
238 } mach_msg_ool_ports_descriptor_t;
239
240 typedef union
241 {
242 mach_msg_port_descriptor_t port;
243 mach_msg_ool_descriptor_t out_of_line;
244 mach_msg_ool_ports_descriptor_t ool_ports;
245 mach_msg_type_descriptor_t type;
246 } mach_msg_descriptor_t;
247
248 typedef struct
249 {
250 mach_msg_size_t msgh_descriptor_count;
251 } mach_msg_body_t;
252
253 #define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
254 #define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
255
256 typedef struct
257 {
258 mach_msg_bits_t msgh_bits;
259 mach_msg_size_t msgh_size;
260 mach_port_t msgh_remote_port;
261 mach_port_t msgh_local_port;
262 mach_msg_size_t msgh_reserved;
263 mach_msg_id_t msgh_id;
264 } mach_msg_header_t;
265
266 #define MACH_MSG_NULL (mach_msg_header_t *) 0
267
268 typedef struct
269 {
270 mach_msg_header_t header;
271 mach_msg_body_t body;
272 } mach_msg_base_t;
273
274 typedef unsigned int mach_msg_trailer_type_t;
275
276 #define MACH_MSG_TRAILER_FORMAT_0 0
277
278 typedef unsigned int mach_msg_trailer_size_t;
279
280 typedef struct
281 {
282 mach_msg_trailer_type_t msgh_trailer_type;
283 mach_msg_trailer_size_t msgh_trailer_size;
284 } mach_msg_trailer_t;
285
286 typedef struct
287 {
288 mach_msg_trailer_type_t msgh_trailer_type;
289 mach_msg_trailer_size_t msgh_trailer_size;
290 mach_port_seqno_t msgh_seqno;
291 } mach_msg_seqno_trailer_t;
292
293 typedef struct
294 {
295 unsigned int val[2];
296 } security_token_t;
297
298 typedef struct
299 {
300 mach_msg_trailer_type_t msgh_trailer_type;
301 mach_msg_trailer_size_t msgh_trailer_size;
302 mach_port_seqno_t msgh_seqno;
303 security_token_t msgh_sender;
304 } mach_msg_security_trailer_t;
305
306 typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
307
308 #define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
309 #define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
310 #define MAX_TRAILER_SIZE MACH_MSG_TRAILER_FORMAT_0_SIZE
311
312 #define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
313 extern security_token_t KERNEL_SECURITY_TOKEN;
314
315 typedef integer_t mach_msg_options_t;
316
317 typedef struct
318 {
319 mach_msg_header_t header;
320 } mach_msg_empty_send_t;
321
322 typedef struct
323 {
324 mach_msg_header_t header;
325 mach_msg_trailer_t trailer;
326 } mach_msg_empty_rcv_t;
327
328 typedef union
329 {
330 mach_msg_empty_send_t send;
331 mach_msg_empty_rcv_t rcv;
332 } mach_msg_empty_t;
333
334 /* utility to round the message size - will become machine dependent */
335 #define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
336 ~(sizeof (natural_t) - 1))
337
338 /*
339 * There is no fixed upper bound to the size of Mach messages.
340 */
341
342 #define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
343
344 #ifdef __APPLE_API_OBSOLETE
345 /*
346 * Compatibility definitions, for code written
347 * when there was a msgh_kind instead of msgh_seqno.
348 */
349 #define MACH_MSGH_KIND_NORMAL 0x00000000
350 #define MACH_MSGH_KIND_NOTIFICATION 0x00000001
351 #define msgh_kind msgh_seqno
352 #define mach_msg_kind_t mach_port_seqno_t
353 #endif /* __APPLE_API_OBSOLETE */
354
355 /*
356 * The msgt_number field specifies the number of data elements.
357 * The msgt_size field specifies the size of each data element, in bits.
358 * The msgt_name field specifies the type of each data element.
359 * If msgt_inline is TRUE, the data follows the type descriptor
360 * in the body of the message. If msgt_inline is FALSE, then a pointer
361 * to the data should follow the type descriptor, and the data is
362 * sent out-of-line. In this case, if msgt_deallocate is TRUE,
363 * then the out-of-line data is moved (instead of copied) into the message.
364 * If msgt_longform is TRUE, then the type descriptor is actually
365 * a mach_msg_type_long_t.
366 *
367 * The actual amount of inline data following the descriptor must
368 * a multiple of the word size. For out-of-line data, this is a
369 * pointer. For inline data, the supplied data size (calculated
370 * from msgt_number/msgt_size) is rounded up. This guarantees
371 * that type descriptors always fall on word boundaries.
372 *
373 * For port rights, msgt_size must be 8*sizeof(mach_port_t).
374 * If the data is inline, msgt_deallocate should be FALSE.
375 * The msgt_unused bit should be zero.
376 * The msgt_name, msgt_size, msgt_number fields in
377 * a mach_msg_type_long_t should be zero.
378 */
379
380 typedef natural_t mach_msg_type_size_t;
381 typedef natural_t mach_msg_type_number_t;
382
383 /*
384 * Values received/carried in messages. Tells the receiver what
385 * sort of port right he now has.
386 *
387 * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
388 * which should remain uninterpreted by the kernel. (Port rights
389 * are not transferred, just the port name.)
390 */
391
392 #define MACH_MSG_TYPE_PORT_NONE 0
393
394 #define MACH_MSG_TYPE_PORT_NAME 15
395 #define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
396 #define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
397 #define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
398
399 #define MACH_MSG_TYPE_LAST 22 /* Last assigned */
400
401 /*
402 * A dummy value. Mostly used to indicate that the actual value
403 * will be filled in later, dynamically.
404 */
405
406 #define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
407
408 /*
409 * Is a given item a port type?
410 */
411
412 #define MACH_MSG_TYPE_PORT_ANY(x) \
413 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
414 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
415
416 #define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
417 (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
418 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
419
420 #define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
421 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
422 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
423
424 typedef integer_t mach_msg_option_t;
425
426 #define MACH_MSG_OPTION_NONE 0x00000000
427
428 #define MACH_SEND_MSG 0x00000001
429 #define MACH_RCV_MSG 0x00000002
430 #define MACH_RCV_LARGE 0x00000004
431
432 #define MACH_SEND_TIMEOUT 0x00000010
433 #define MACH_SEND_INTERRUPT 0x00000040 /* libmach implements */
434 #define MACH_SEND_CANCEL 0x00000080
435 #define MACH_SEND_ALWAYS 0x00010000 /* internal use only */
436 #define MACH_SEND_TRAILER 0x00020000
437
438 #define MACH_RCV_TIMEOUT 0x00000100
439 #define MACH_RCV_NOTIFY 0x00000200
440 #define MACH_RCV_INTERRUPT 0x00000400 /* libmach implements */
441 #define MACH_RCV_OVERWRITE 0x00001000
442
443 /*
444 * NOTE: a 0x00------ RCV mask implies to ask for
445 * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
446 * which is equivalent to a mach_msg_trailer_t.
447 */
448 #define MACH_RCV_TRAILER_NULL 0
449 #define MACH_RCV_TRAILER_SEQNO 1
450 #define MACH_RCV_TRAILER_SENDER 2
451
452 #define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
453 #define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
454 #define MACH_RCV_TRAILER_MASK ((0xff << 24))
455
456 #define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
457 #define REQUESTED_TRAILER_SIZE(y) \
458 ((mach_msg_trailer_size_t) \
459 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
460 sizeof(mach_msg_trailer_t) : \
461 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
462 sizeof(mach_msg_seqno_trailer_t) : \
463 sizeof(mach_msg_security_trailer_t))))
464 /*
465 * Much code assumes that mach_msg_return_t == kern_return_t.
466 * This definition is useful for descriptive purposes.
467 *
468 * See <mach/error.h> for the format of error codes.
469 * IPC errors are system 4. Send errors are subsystem 0;
470 * receive errors are subsystem 1. The code field is always non-zero.
471 * The high bits of the code field communicate extra information
472 * for some error codes. MACH_MSG_MASK masks off these special bits.
473 */
474
475 typedef kern_return_t mach_msg_return_t;
476
477 #define MACH_MSG_SUCCESS 0x00000000
478
479
480 #define MACH_MSG_MASK 0x00003e00
481 /* All special error code bits defined below. */
482 #define MACH_MSG_IPC_SPACE 0x00002000
483 /* No room in IPC name space for another capability name. */
484 #define MACH_MSG_VM_SPACE 0x00001000
485 /* No room in VM address space for out-of-line memory. */
486 #define MACH_MSG_IPC_KERNEL 0x00000800
487 /* Kernel resource shortage handling an IPC capability. */
488 #define MACH_MSG_VM_KERNEL 0x00000400
489 /* Kernel resource shortage handling out-of-line memory. */
490
491 #define MACH_SEND_IN_PROGRESS 0x10000001
492 /* Thread is waiting to send. (Internal use only.) */
493 #define MACH_SEND_INVALID_DATA 0x10000002
494 /* Bogus in-line data. */
495 #define MACH_SEND_INVALID_DEST 0x10000003
496 /* Bogus destination port. */
497 #define MACH_SEND_TIMED_OUT 0x10000004
498 /* Message not sent before timeout expired. */
499 #define MACH_SEND_INTERRUPTED 0x10000007
500 /* Software interrupt. */
501 #define MACH_SEND_MSG_TOO_SMALL 0x10000008
502 /* Data doesn't contain a complete message. */
503 #define MACH_SEND_INVALID_REPLY 0x10000009
504 /* Bogus reply port. */
505 #define MACH_SEND_INVALID_RIGHT 0x1000000a
506 /* Bogus port rights in the message body. */
507 #define MACH_SEND_INVALID_NOTIFY 0x1000000b
508 /* Bogus notify port argument. */
509 #define MACH_SEND_INVALID_MEMORY 0x1000000c
510 /* Invalid out-of-line memory pointer. */
511 #define MACH_SEND_NO_BUFFER 0x1000000d
512 /* No message buffer is available. */
513 #define MACH_SEND_TOO_LARGE 0x1000000e
514 /* Send is too large for port */
515 #define MACH_SEND_INVALID_TYPE 0x1000000f
516 /* Invalid msg-type specification. */
517 #define MACH_SEND_INVALID_HEADER 0x10000010
518 /* A field in the header had a bad value. */
519 #define MACH_SEND_INVALID_TRAILER 0x10000011
520 /* The trailer to be sent does not match kernel format. */
521 #define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
522 /* compatibility: no longer a returned error */
523
524 #define MACH_RCV_IN_PROGRESS 0x10004001
525 /* Thread is waiting for receive. (Internal use only.) */
526 #define MACH_RCV_INVALID_NAME 0x10004002
527 /* Bogus name for receive port/port-set. */
528 #define MACH_RCV_TIMED_OUT 0x10004003
529 /* Didn't get a message within the timeout value. */
530 #define MACH_RCV_TOO_LARGE 0x10004004
531 /* Message buffer is not large enough for inline data. */
532 #define MACH_RCV_INTERRUPTED 0x10004005
533 /* Software interrupt. */
534 #define MACH_RCV_PORT_CHANGED 0x10004006
535 /* compatibility: no longer a returned error */
536 #define MACH_RCV_INVALID_NOTIFY 0x10004007
537 /* Bogus notify port argument. */
538 #define MACH_RCV_INVALID_DATA 0x10004008
539 /* Bogus message buffer for inline data. */
540 #define MACH_RCV_PORT_DIED 0x10004009
541 /* Port/set was sent away/died during receive. */
542 #define MACH_RCV_IN_SET 0x1000400a
543 /* compatibility: no longer a returned error */
544 #define MACH_RCV_HEADER_ERROR 0x1000400b
545 /* Error receiving message header. See special bits. */
546 #define MACH_RCV_BODY_ERROR 0x1000400c
547 /* Error receiving message body. See special bits. */
548 #define MACH_RCV_INVALID_TYPE 0x1000400d
549 /* Invalid msg-type specification in scatter list. */
550 #define MACH_RCV_SCATTER_SMALL 0x1000400e
551 /* Out-of-line overwrite region is not large enough */
552 #define MACH_RCV_INVALID_TRAILER 0x1000400f
553 /* trailer type or number of trailer elements not supported */
554 #define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
555 /* Waiting for receive with timeout. (Internal use only.) */
556
557 /*
558 * Routine: mach_msg_overwrite
559 * Purpose:
560 * Send and/or receive a message. If the message operation
561 * is interrupted, and the user did not request an indication
562 * of that fact, then restart the appropriate parts of the
563 * operation silently (trap version does not restart).
564 *
565 * Distinct send and receive buffers may be specified. If
566 * no separate receive buffer is specified, the msg parameter
567 * will be used for both send and receive operations.
568 *
569 * In addition to a distinct receive buffer, that buffer may
570 * already contain scatter control information to direct the
571 * receiving of the message.
572 */
573 #ifdef __APPLE_API_PRIVATE
574 extern mach_msg_return_t mach_msg_overwrite_trap(
575 mach_msg_header_t *msg,
576 mach_msg_option_t option,
577 mach_msg_size_t send_size,
578 mach_msg_size_t rcv_size,
579 mach_port_name_t rcv_name,
580 mach_msg_timeout_t timeout,
581 mach_port_name_t notify,
582 mach_msg_header_t *rcv_msg,
583 mach_msg_size_t rcv_limit);
584 #endif /* __APPLE_API_PRIVATE */
585
586 extern mach_msg_return_t mach_msg_overwrite(
587 mach_msg_header_t *msg,
588 mach_msg_option_t option,
589 mach_msg_size_t send_size,
590 mach_msg_size_t rcv_size,
591 mach_port_name_t rcv_name,
592 mach_msg_timeout_t timeout,
593 mach_port_name_t notify,
594 mach_msg_header_t *rcv_msg,
595 mach_msg_size_t rcv_limit);
596
597 /*
598 * Routine: mach_msg
599 * Purpose:
600 * Send and/or receive a message. If the message operation
601 * is interrupted, and the user did not request an indication
602 * of that fact, then restart the appropriate parts of the
603 * operation silently (trap version does not restart).
604 */
605 #ifdef __APPLE_API_PRIVATE
606 extern mach_msg_return_t mach_msg_trap(
607 mach_msg_header_t *msg,
608 mach_msg_option_t option,
609 mach_msg_size_t send_size,
610 mach_msg_size_t rcv_size,
611 mach_port_name_t rcv_name,
612 mach_msg_timeout_t timeout,
613 mach_port_name_t notify);
614 #endif /* __APPLE_API_PRIVATE */
615
616 extern mach_msg_return_t mach_msg(
617 mach_msg_header_t *msg,
618 mach_msg_option_t option,
619 mach_msg_size_t send_size,
620 mach_msg_size_t rcv_size,
621 mach_port_name_t rcv_name,
622 mach_msg_timeout_t timeout,
623 mach_port_name_t notify);
624
625 #endif /* _MACH_MESSAGE_H_ */