2 * Copyright (c) 2000-2005 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,1988,1987 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: mach/message.h
55 * Mach IPC message and primitive function definitions.
58 #ifndef _MACH_MESSAGE_H_
59 #define _MACH_MESSAGE_H_
62 #include <mach/port.h>
63 #include <mach/boolean.h>
64 #include <mach/kern_return.h>
65 #include <mach/machine/vm_types.h>
67 #include <sys/cdefs.h>
70 * The timeout mechanism uses mach_msg_timeout_t values,
71 * passed by value. The timeout units are milliseconds.
72 * It is controlled with the MACH_SEND_TIMEOUT
73 * and MACH_RCV_TIMEOUT options.
76 typedef natural_t mach_msg_timeout_t
;
79 * The value to be used when there is no timeout.
80 * (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
83 #define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
86 * The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. It it isn't on, it
87 * assumes the body of the message doesn't contain port rights or OOL
88 * data. The field is set in received messages. A user task must
89 * use caution in interpreting the body of a message if the bit isn't
90 * on, because the mach_msg_type's in the body might "lie" about the
91 * contents. If the bit isn't on, but the mach_msg_types
92 * in the body specify rights or OOL data, the behavior is undefined.
93 * (Ie, an error may or may not be produced.)
95 * The value of MACH_MSGH_BITS_REMOTE determines the interpretation
96 * of the msgh_remote_port field. It is handled like a msgt_name.
98 * The value of MACH_MSGH_BITS_LOCAL determines the interpretation
99 * of the msgh_local_port field. It is handled like a msgt_name.
101 * MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
102 * and local fields, into a single value suitable for msgh_bits.
104 * MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
106 * The unused bits should be zero and are reserved for the kernel
107 * or for future interface expansion.
110 #define MACH_MSGH_BITS_ZERO 0x00000000
111 #define MACH_MSGH_BITS_REMOTE_MASK 0x000000ff
112 #define MACH_MSGH_BITS_LOCAL_MASK 0x0000ff00
113 #define MACH_MSGH_BITS_COMPLEX 0x80000000U
114 #define MACH_MSGH_BITS_USER 0x8000ffffU
116 #define MACH_MSGH_BITS_CIRCULAR 0x40000000 /* internal use only */
117 #define MACH_MSGH_BITS_USED 0xc000ffffU
119 #define MACH_MSGH_BITS_PORTS_MASK \
120 (MACH_MSGH_BITS_REMOTE_MASK|MACH_MSGH_BITS_LOCAL_MASK)
122 #define MACH_MSGH_BITS(remote, local) \
123 ((remote) | ((local) << 8))
124 #define MACH_MSGH_BITS_REMOTE(bits) \
125 ((bits) & MACH_MSGH_BITS_REMOTE_MASK)
126 #define MACH_MSGH_BITS_LOCAL(bits) \
127 (((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
128 #define MACH_MSGH_BITS_PORTS(bits) \
129 ((bits) & MACH_MSGH_BITS_PORTS_MASK)
130 #define MACH_MSGH_BITS_OTHER(bits) \
131 ((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
134 * Every message starts with a message header.
135 * Following the message header are zero or more pairs of
136 * type descriptors (mach_msg_type_t/mach_msg_type_long_t) and
137 * data values. The size of the message must be specified in bytes,
138 * and includes the message header, type descriptors, inline
139 * data, and inline pointer for out-of-line data.
141 * The msgh_remote_port field specifies the destination of the message.
142 * It must specify a valid send or send-once right for a port.
144 * The msgh_local_port field specifies a "reply port". Normally,
145 * This field carries a send-once right that the receiver will use
146 * to reply to the message. It may carry the values MACH_PORT_NULL,
147 * MACH_PORT_DEAD, a send-once right, or a send right.
149 * The msgh_seqno field carries a sequence number associated with the
150 * received-from port. A port's sequence number is incremented every
151 * time a message is received from it. In sent messages, the field's
154 * The msgh_id field is uninterpreted by the message primitives.
155 * It normally carries information specifying the format
156 * or meaning of the message.
159 typedef unsigned int mach_msg_bits_t
;
160 typedef natural_t mach_msg_size_t
;
161 typedef integer_t mach_msg_id_t
;
164 #define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
166 typedef unsigned int mach_msg_type_name_t
;
168 #define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive rights */
169 #define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send rights */
170 #define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce rights */
171 #define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send rights */
172 #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive rights */
173 #define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive rights */
174 #define MACH_MSG_TYPE_COPY_RECEIVE 22 /* Must hold receive rights */
176 typedef unsigned int mach_msg_copy_options_t
;
178 #define MACH_MSG_PHYSICAL_COPY 0
179 #define MACH_MSG_VIRTUAL_COPY 1
180 #define MACH_MSG_ALLOCATE 2
181 #define MACH_MSG_OVERWRITE 3
183 #define MACH_MSG_KALLOC_COPY_T 4
184 #endif /* MACH_KERNEL */
186 typedef unsigned int mach_msg_descriptor_type_t
;
188 #define MACH_MSG_PORT_DESCRIPTOR 0
189 #define MACH_MSG_OOL_DESCRIPTOR 1
190 #define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
191 #define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
198 mach_msg_size_t pad2
;
199 unsigned int pad3
: 24;
200 mach_msg_descriptor_type_t type
: 8;
201 } mach_msg_type_descriptor_t
;
206 mach_msg_size_t pad1
;
207 unsigned int pad2
: 16;
208 mach_msg_type_name_t disposition
: 8;
209 mach_msg_descriptor_type_t type
: 8;
210 } mach_msg_port_descriptor_t
;
215 mach_msg_size_t size
;
216 boolean_t deallocate
: 8;
217 mach_msg_copy_options_t copy
: 8;
218 unsigned int pad1
: 8;
219 mach_msg_descriptor_type_t type
: 8;
220 } mach_msg_ool_descriptor32_t
;
225 boolean_t deallocate
: 8;
226 mach_msg_copy_options_t copy
: 8;
227 unsigned int pad1
: 8;
228 mach_msg_descriptor_type_t type
: 8;
229 mach_msg_size_t size
;
230 } mach_msg_ool_descriptor64_t
;
235 #if !defined(__LP64__)
236 mach_msg_size_t size
;
238 boolean_t deallocate
: 8;
239 mach_msg_copy_options_t copy
: 8;
240 unsigned int pad1
: 8;
241 mach_msg_descriptor_type_t type
: 8;
242 #if defined(__LP64__)
243 mach_msg_size_t size
;
245 } mach_msg_ool_descriptor_t
;
250 mach_msg_size_t count
;
251 boolean_t deallocate
: 8;
252 mach_msg_copy_options_t copy
: 8;
253 mach_msg_type_name_t disposition
: 8;
254 mach_msg_descriptor_type_t type
: 8;
255 } mach_msg_ool_ports_descriptor32_t
;
260 boolean_t deallocate
: 8;
261 mach_msg_copy_options_t copy
: 8;
262 mach_msg_type_name_t disposition
: 8;
263 mach_msg_descriptor_type_t type
: 8;
264 mach_msg_size_t count
;
265 } mach_msg_ool_ports_descriptor64_t
;
270 #if !defined(__LP64__)
271 mach_msg_size_t count
;
273 boolean_t deallocate
: 8;
274 mach_msg_copy_options_t copy
: 8;
275 mach_msg_type_name_t disposition
: 8;
276 mach_msg_descriptor_type_t type
: 8;
277 #if defined(__LP64__)
278 mach_msg_size_t count
;
280 } mach_msg_ool_ports_descriptor_t
;
283 * LP64support - This union definition is not really
284 * appropriate in LP64 mode because not all descriptors
285 * are of the same size in that environment.
289 mach_msg_port_descriptor_t port
;
290 mach_msg_ool_descriptor_t out_of_line
;
291 mach_msg_ool_ports_descriptor_t ool_ports
;
292 mach_msg_type_descriptor_t type
;
293 } mach_msg_descriptor_t
;
297 mach_msg_size_t msgh_descriptor_count
;
300 #define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
301 #define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
305 mach_msg_bits_t msgh_bits
;
306 mach_msg_size_t msgh_size
;
307 mach_port_t msgh_remote_port
;
308 mach_port_t msgh_local_port
;
309 mach_msg_size_t msgh_reserved
;
310 mach_msg_id_t msgh_id
;
313 #define MACH_MSG_NULL (mach_msg_header_t *) 0
317 mach_msg_header_t header
;
318 mach_msg_body_t body
;
321 typedef unsigned int mach_msg_trailer_type_t
;
323 #define MACH_MSG_TRAILER_FORMAT_0 0
325 typedef unsigned int mach_msg_trailer_size_t
;
329 mach_msg_trailer_type_t msgh_trailer_type
;
330 mach_msg_trailer_size_t msgh_trailer_size
;
331 } mach_msg_trailer_t
;
335 mach_msg_trailer_type_t msgh_trailer_type
;
336 mach_msg_trailer_size_t msgh_trailer_size
;
337 mach_port_seqno_t msgh_seqno
;
338 } mach_msg_seqno_trailer_t
;
347 mach_msg_trailer_type_t msgh_trailer_type
;
348 mach_msg_trailer_size_t msgh_trailer_size
;
349 mach_port_seqno_t msgh_seqno
;
350 security_token_t msgh_sender
;
351 } mach_msg_security_trailer_t
;
354 * The audit token is an opaque token which identifies
355 * Mach tasks and senders of Mach messages as subjects
356 * to the BSM audit system. Only the appropriate BSM
357 * library routines should be used to interpret the
358 * contents of the audit token as the representation
359 * of the subject identity within the token may change
369 mach_msg_trailer_type_t msgh_trailer_type
;
370 mach_msg_trailer_size_t msgh_trailer_size
;
371 mach_port_seqno_t msgh_seqno
;
372 security_token_t msgh_sender
;
373 audit_token_t msgh_audit
;
374 } mach_msg_audit_trailer_t
;
376 #define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
379 * These values can change from release to release - but clearly
380 * code cannot request additional trailer elements one was not
381 * compiled to understand. Therefore, it is safe to use this
382 * constant when the same module specified the receive options.
383 * Otherwise, you run the risk that the options requested by
384 * another module may exceed the local modules notion of
387 typedef mach_msg_audit_trailer_t mach_msg_max_trailer_t
;
388 #define MAX_TRAILER_SIZE sizeof(mach_msg_max_trailer_t)
391 * Legacy requirements keep us from ever updating these defines (even
392 * when the format_0 trailers gain new option data fields in the future).
393 * Therefore, they shouldn't be used going forward. Instead, the sizes
394 * should be compared against the specific element size requested using
395 * REQUESTED_TRAILER_SIZE.
397 typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t
;
398 #define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
400 #define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
401 extern security_token_t KERNEL_SECURITY_TOKEN
;
403 #define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
404 extern audit_token_t KERNEL_AUDIT_TOKEN
;
406 typedef integer_t mach_msg_options_t
;
410 mach_msg_header_t header
;
411 } mach_msg_empty_send_t
;
415 mach_msg_header_t header
;
416 mach_msg_trailer_t trailer
;
417 } mach_msg_empty_rcv_t
;
421 mach_msg_empty_send_t send
;
422 mach_msg_empty_rcv_t rcv
;
427 /* utility to round the message size - will become machine dependent */
428 #define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
429 ~(sizeof (natural_t) - 1))
432 * There is no fixed upper bound to the size of Mach messages.
435 #define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
438 * Compatibility definitions, for code written
439 * when there was a msgh_kind instead of msgh_seqno.
441 #define MACH_MSGH_KIND_NORMAL 0x00000000
442 #define MACH_MSGH_KIND_NOTIFICATION 0x00000001
443 #define msgh_kind msgh_seqno
444 #define mach_msg_kind_t mach_port_seqno_t
447 * The msgt_number field specifies the number of data elements.
448 * The msgt_size field specifies the size of each data element, in bits.
449 * The msgt_name field specifies the type of each data element.
450 * If msgt_inline is TRUE, the data follows the type descriptor
451 * in the body of the message. If msgt_inline is FALSE, then a pointer
452 * to the data should follow the type descriptor, and the data is
453 * sent out-of-line. In this case, if msgt_deallocate is TRUE,
454 * then the out-of-line data is moved (instead of copied) into the message.
455 * If msgt_longform is TRUE, then the type descriptor is actually
456 * a mach_msg_type_long_t.
458 * The actual amount of inline data following the descriptor must
459 * a multiple of the word size. For out-of-line data, this is a
460 * pointer. For inline data, the supplied data size (calculated
461 * from msgt_number/msgt_size) is rounded up. This guarantees
462 * that type descriptors always fall on word boundaries.
464 * For port rights, msgt_size must be 8*sizeof(mach_port_t).
465 * If the data is inline, msgt_deallocate should be FALSE.
466 * The msgt_unused bit should be zero.
467 * The msgt_name, msgt_size, msgt_number fields in
468 * a mach_msg_type_long_t should be zero.
471 typedef natural_t mach_msg_type_size_t
;
472 typedef natural_t mach_msg_type_number_t
;
475 * Values received/carried in messages. Tells the receiver what
476 * sort of port right he now has.
478 * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
479 * which should remain uninterpreted by the kernel. (Port rights
480 * are not transferred, just the port name.)
483 #define MACH_MSG_TYPE_PORT_NONE 0
485 #define MACH_MSG_TYPE_PORT_NAME 15
486 #define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
487 #define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
488 #define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
490 #define MACH_MSG_TYPE_LAST 22 /* Last assigned */
493 * A dummy value. Mostly used to indicate that the actual value
494 * will be filled in later, dynamically.
497 #define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
500 * Is a given item a port type?
503 #define MACH_MSG_TYPE_PORT_ANY(x) \
504 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
505 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
507 #define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
508 (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
509 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
511 #define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
512 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
513 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
515 typedef integer_t mach_msg_option_t
;
517 #define MACH_MSG_OPTION_NONE 0x00000000
519 #define MACH_SEND_MSG 0x00000001
520 #define MACH_RCV_MSG 0x00000002
521 #define MACH_RCV_LARGE 0x00000004
523 #define MACH_SEND_TIMEOUT 0x00000010
524 #define MACH_SEND_INTERRUPT 0x00000040 /* libmach implements */
525 #define MACH_SEND_CANCEL 0x00000080
526 #define MACH_SEND_ALWAYS 0x00010000 /* internal use only */
527 #define MACH_SEND_TRAILER 0x00020000
529 #define MACH_RCV_TIMEOUT 0x00000100
530 #define MACH_RCV_NOTIFY 0x00000200
531 #define MACH_RCV_INTERRUPT 0x00000400 /* libmach implements */
532 #define MACH_RCV_OVERWRITE 0x00001000
535 * NOTE: a 0x00------ RCV mask implies to ask for
536 * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
537 * which is equivalent to a mach_msg_trailer_t.
539 #define MACH_RCV_TRAILER_NULL 0
540 #define MACH_RCV_TRAILER_SEQNO 1
541 #define MACH_RCV_TRAILER_SENDER 2
542 #define MACH_RCV_TRAILER_AUDIT 3
544 #define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
545 #define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
546 #define MACH_RCV_TRAILER_MASK ((0xff << 24))
548 #define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
549 #define REQUESTED_TRAILER_SIZE(y) \
550 ((mach_msg_trailer_size_t) \
551 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
552 sizeof(mach_msg_trailer_t) : \
553 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
554 sizeof(mach_msg_seqno_trailer_t) : \
555 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
556 sizeof(mach_msg_security_trailer_t) : \
557 sizeof(mach_msg_audit_trailer_t)))))
559 * Much code assumes that mach_msg_return_t == kern_return_t.
560 * This definition is useful for descriptive purposes.
562 * See <mach/error.h> for the format of error codes.
563 * IPC errors are system 4. Send errors are subsystem 0;
564 * receive errors are subsystem 1. The code field is always non-zero.
565 * The high bits of the code field communicate extra information
566 * for some error codes. MACH_MSG_MASK masks off these special bits.
569 typedef kern_return_t mach_msg_return_t
;
571 #define MACH_MSG_SUCCESS 0x00000000
574 #define MACH_MSG_MASK 0x00003e00
575 /* All special error code bits defined below. */
576 #define MACH_MSG_IPC_SPACE 0x00002000
577 /* No room in IPC name space for another capability name. */
578 #define MACH_MSG_VM_SPACE 0x00001000
579 /* No room in VM address space for out-of-line memory. */
580 #define MACH_MSG_IPC_KERNEL 0x00000800
581 /* Kernel resource shortage handling an IPC capability. */
582 #define MACH_MSG_VM_KERNEL 0x00000400
583 /* Kernel resource shortage handling out-of-line memory. */
585 #define MACH_SEND_IN_PROGRESS 0x10000001
586 /* Thread is waiting to send. (Internal use only.) */
587 #define MACH_SEND_INVALID_DATA 0x10000002
588 /* Bogus in-line data. */
589 #define MACH_SEND_INVALID_DEST 0x10000003
590 /* Bogus destination port. */
591 #define MACH_SEND_TIMED_OUT 0x10000004
592 /* Message not sent before timeout expired. */
593 #define MACH_SEND_INTERRUPTED 0x10000007
594 /* Software interrupt. */
595 #define MACH_SEND_MSG_TOO_SMALL 0x10000008
596 /* Data doesn't contain a complete message. */
597 #define MACH_SEND_INVALID_REPLY 0x10000009
598 /* Bogus reply port. */
599 #define MACH_SEND_INVALID_RIGHT 0x1000000a
600 /* Bogus port rights in the message body. */
601 #define MACH_SEND_INVALID_NOTIFY 0x1000000b
602 /* Bogus notify port argument. */
603 #define MACH_SEND_INVALID_MEMORY 0x1000000c
604 /* Invalid out-of-line memory pointer. */
605 #define MACH_SEND_NO_BUFFER 0x1000000d
606 /* No message buffer is available. */
607 #define MACH_SEND_TOO_LARGE 0x1000000e
608 /* Send is too large for port */
609 #define MACH_SEND_INVALID_TYPE 0x1000000f
610 /* Invalid msg-type specification. */
611 #define MACH_SEND_INVALID_HEADER 0x10000010
612 /* A field in the header had a bad value. */
613 #define MACH_SEND_INVALID_TRAILER 0x10000011
614 /* The trailer to be sent does not match kernel format. */
615 #define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
616 /* compatibility: no longer a returned error */
618 #define MACH_RCV_IN_PROGRESS 0x10004001
619 /* Thread is waiting for receive. (Internal use only.) */
620 #define MACH_RCV_INVALID_NAME 0x10004002
621 /* Bogus name for receive port/port-set. */
622 #define MACH_RCV_TIMED_OUT 0x10004003
623 /* Didn't get a message within the timeout value. */
624 #define MACH_RCV_TOO_LARGE 0x10004004
625 /* Message buffer is not large enough for inline data. */
626 #define MACH_RCV_INTERRUPTED 0x10004005
627 /* Software interrupt. */
628 #define MACH_RCV_PORT_CHANGED 0x10004006
629 /* compatibility: no longer a returned error */
630 #define MACH_RCV_INVALID_NOTIFY 0x10004007
631 /* Bogus notify port argument. */
632 #define MACH_RCV_INVALID_DATA 0x10004008
633 /* Bogus message buffer for inline data. */
634 #define MACH_RCV_PORT_DIED 0x10004009
635 /* Port/set was sent away/died during receive. */
636 #define MACH_RCV_IN_SET 0x1000400a
637 /* compatibility: no longer a returned error */
638 #define MACH_RCV_HEADER_ERROR 0x1000400b
639 /* Error receiving message header. See special bits. */
640 #define MACH_RCV_BODY_ERROR 0x1000400c
641 /* Error receiving message body. See special bits. */
642 #define MACH_RCV_INVALID_TYPE 0x1000400d
643 /* Invalid msg-type specification in scatter list. */
644 #define MACH_RCV_SCATTER_SMALL 0x1000400e
645 /* Out-of-line overwrite region is not large enough */
646 #define MACH_RCV_INVALID_TRAILER 0x1000400f
647 /* trailer type or number of trailer elements not supported */
648 #define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
649 /* Waiting for receive with timeout. (Internal use only.) */
655 * Routine: mach_msg_overwrite
657 * Send and/or receive a message. If the message operation
658 * is interrupted, and the user did not request an indication
659 * of that fact, then restart the appropriate parts of the
660 * operation silently (trap version does not restart).
662 * Distinct send and receive buffers may be specified. If
663 * no separate receive buffer is specified, the msg parameter
664 * will be used for both send and receive operations.
666 * In addition to a distinct receive buffer, that buffer may
667 * already contain scatter control information to direct the
668 * receiving of the message.
671 extern mach_msg_return_t
mach_msg_overwrite(
672 mach_msg_header_t
*msg
,
673 mach_msg_option_t option
,
674 mach_msg_size_t send_size
,
675 mach_msg_size_t rcv_size
,
676 mach_port_name_t rcv_name
,
677 mach_msg_timeout_t timeout
,
678 mach_port_name_t notify
,
679 mach_msg_header_t
*rcv_msg
,
680 mach_msg_size_t rcv_limit
);
687 * Send and/or receive a message. If the message operation
688 * is interrupted, and the user did not request an indication
689 * of that fact, then restart the appropriate parts of the
690 * operation silently (trap version does not restart).
692 extern mach_msg_return_t
mach_msg(
693 mach_msg_header_t
*msg
,
694 mach_msg_option_t option
,
695 mach_msg_size_t send_size
,
696 mach_msg_size_t rcv_size
,
697 mach_port_name_t rcv_name
,
698 mach_msg_timeout_t timeout
,
699 mach_port_name_t notify
);
705 #endif /* _MACH_MESSAGE_H_ */