2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
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.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
36 * All Rights Reserved.
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.
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.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
61 * File: mach/message.h
63 * Mach IPC message and primitive function definitions.
66 #ifndef _MACH_MESSAGE_H_
67 #define _MACH_MESSAGE_H_
70 #include <mach/port.h>
71 #include <mach/boolean.h>
72 #include <mach/kern_return.h>
73 #include <mach/machine/vm_types.h>
75 #include <sys/cdefs.h>
78 * The timeout mechanism uses mach_msg_timeout_t values,
79 * passed by value. The timeout units are milliseconds.
80 * It is controlled with the MACH_SEND_TIMEOUT
81 * and MACH_RCV_TIMEOUT options.
84 typedef natural_t mach_msg_timeout_t
;
87 * The value to be used when there is no timeout.
88 * (No MACH_SEND_TIMEOUT/MACH_RCV_TIMEOUT option.)
91 #define MACH_MSG_TIMEOUT_NONE ((mach_msg_timeout_t) 0)
94 * The kernel uses MACH_MSGH_BITS_COMPLEX as a hint. It it isn't on, it
95 * assumes the body of the message doesn't contain port rights or OOL
96 * data. The field is set in received messages. A user task must
97 * use caution in interpreting the body of a message if the bit isn't
98 * on, because the mach_msg_type's in the body might "lie" about the
99 * contents. If the bit isn't on, but the mach_msg_types
100 * in the body specify rights or OOL data, the behavior is undefined.
101 * (Ie, an error may or may not be produced.)
103 * The value of MACH_MSGH_BITS_REMOTE determines the interpretation
104 * of the msgh_remote_port field. It is handled like a msgt_name.
106 * The value of MACH_MSGH_BITS_LOCAL determines the interpretation
107 * of the msgh_local_port field. It is handled like a msgt_name.
109 * MACH_MSGH_BITS() combines two MACH_MSG_TYPE_* values, for the remote
110 * and local fields, into a single value suitable for msgh_bits.
112 * MACH_MSGH_BITS_CIRCULAR should be zero; is is used internally.
114 * The unused bits should be zero and are reserved for the kernel
115 * or for future interface expansion.
118 #define MACH_MSGH_BITS_ZERO 0x00000000
119 #define MACH_MSGH_BITS_REMOTE_MASK 0x000000ff
120 #define MACH_MSGH_BITS_LOCAL_MASK 0x0000ff00
121 #define MACH_MSGH_BITS_COMPLEX 0x80000000U
122 #define MACH_MSGH_BITS_USER 0x8000ffffU
124 #define MACH_MSGH_BITS_CIRCULAR 0x40000000 /* internal use only */
125 #define MACH_MSGH_BITS_USED 0xc000ffffU
127 #define MACH_MSGH_BITS_PORTS_MASK \
128 (MACH_MSGH_BITS_REMOTE_MASK|MACH_MSGH_BITS_LOCAL_MASK)
130 #define MACH_MSGH_BITS(remote, local) \
131 ((remote) | ((local) << 8))
132 #define MACH_MSGH_BITS_REMOTE(bits) \
133 ((bits) & MACH_MSGH_BITS_REMOTE_MASK)
134 #define MACH_MSGH_BITS_LOCAL(bits) \
135 (((bits) & MACH_MSGH_BITS_LOCAL_MASK) >> 8)
136 #define MACH_MSGH_BITS_PORTS(bits) \
137 ((bits) & MACH_MSGH_BITS_PORTS_MASK)
138 #define MACH_MSGH_BITS_OTHER(bits) \
139 ((bits) &~ MACH_MSGH_BITS_PORTS_MASK)
142 * Every message starts with a message header.
143 * Following the message header are zero or more pairs of
144 * type descriptors (mach_msg_type_t/mach_msg_type_long_t) and
145 * data values. The size of the message must be specified in bytes,
146 * and includes the message header, type descriptors, inline
147 * data, and inline pointer for out-of-line data.
149 * The msgh_remote_port field specifies the destination of the message.
150 * It must specify a valid send or send-once right for a port.
152 * The msgh_local_port field specifies a "reply port". Normally,
153 * This field carries a send-once right that the receiver will use
154 * to reply to the message. It may carry the values MACH_PORT_NULL,
155 * MACH_PORT_DEAD, a send-once right, or a send right.
157 * The msgh_seqno field carries a sequence number associated with the
158 * received-from port. A port's sequence number is incremented every
159 * time a message is received from it. In sent messages, the field's
162 * The msgh_id field is uninterpreted by the message primitives.
163 * It normally carries information specifying the format
164 * or meaning of the message.
167 typedef unsigned int mach_msg_bits_t
;
168 typedef natural_t mach_msg_size_t
;
169 typedef integer_t mach_msg_id_t
;
172 #define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
174 typedef unsigned int mach_msg_type_name_t
;
176 #define MACH_MSG_TYPE_MOVE_RECEIVE 16 /* Must hold receive rights */
177 #define MACH_MSG_TYPE_MOVE_SEND 17 /* Must hold send rights */
178 #define MACH_MSG_TYPE_MOVE_SEND_ONCE 18 /* Must hold sendonce rights */
179 #define MACH_MSG_TYPE_COPY_SEND 19 /* Must hold send rights */
180 #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive rights */
181 #define MACH_MSG_TYPE_MAKE_SEND_ONCE 21 /* Must hold receive rights */
182 #define MACH_MSG_TYPE_COPY_RECEIVE 22 /* Must hold receive rights */
184 typedef unsigned int mach_msg_copy_options_t
;
186 #define MACH_MSG_PHYSICAL_COPY 0
187 #define MACH_MSG_VIRTUAL_COPY 1
188 #define MACH_MSG_ALLOCATE 2
189 #define MACH_MSG_OVERWRITE 3
191 #define MACH_MSG_KALLOC_COPY_T 4
192 #endif /* MACH_KERNEL */
194 typedef unsigned int mach_msg_descriptor_type_t
;
196 #define MACH_MSG_PORT_DESCRIPTOR 0
197 #define MACH_MSG_OOL_DESCRIPTOR 1
198 #define MACH_MSG_OOL_PORTS_DESCRIPTOR 2
199 #define MACH_MSG_OOL_VOLATILE_DESCRIPTOR 3
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
;
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
;
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_descriptor32_t
;
233 boolean_t deallocate
: 8;
234 mach_msg_copy_options_t copy
: 8;
235 unsigned int pad1
: 8;
236 mach_msg_descriptor_type_t type
: 8;
237 mach_msg_size_t size
;
238 } mach_msg_ool_descriptor64_t
;
243 #if !defined(__LP64__)
244 mach_msg_size_t size
;
246 boolean_t deallocate
: 8;
247 mach_msg_copy_options_t copy
: 8;
248 unsigned int pad1
: 8;
249 mach_msg_descriptor_type_t type
: 8;
250 #if defined(__LP64__)
251 mach_msg_size_t size
;
253 } mach_msg_ool_descriptor_t
;
258 mach_msg_size_t count
;
259 boolean_t deallocate
: 8;
260 mach_msg_copy_options_t copy
: 8;
261 mach_msg_type_name_t disposition
: 8;
262 mach_msg_descriptor_type_t type
: 8;
263 } mach_msg_ool_ports_descriptor32_t
;
268 boolean_t deallocate
: 8;
269 mach_msg_copy_options_t copy
: 8;
270 mach_msg_type_name_t disposition
: 8;
271 mach_msg_descriptor_type_t type
: 8;
272 mach_msg_size_t count
;
273 } mach_msg_ool_ports_descriptor64_t
;
278 #if !defined(__LP64__)
279 mach_msg_size_t count
;
281 boolean_t deallocate
: 8;
282 mach_msg_copy_options_t copy
: 8;
283 mach_msg_type_name_t disposition
: 8;
284 mach_msg_descriptor_type_t type
: 8;
285 #if defined(__LP64__)
286 mach_msg_size_t count
;
288 } mach_msg_ool_ports_descriptor_t
;
291 * LP64support - This union definition is not really
292 * appropriate in LP64 mode because not all descriptors
293 * are of the same size in that environment.
297 mach_msg_port_descriptor_t port
;
298 mach_msg_ool_descriptor_t out_of_line
;
299 mach_msg_ool_ports_descriptor_t ool_ports
;
300 mach_msg_type_descriptor_t type
;
301 } mach_msg_descriptor_t
;
305 mach_msg_size_t msgh_descriptor_count
;
308 #define MACH_MSG_BODY_NULL (mach_msg_body_t *) 0
309 #define MACH_MSG_DESCRIPTOR_NULL (mach_msg_descriptor_t *) 0
313 mach_msg_bits_t msgh_bits
;
314 mach_msg_size_t msgh_size
;
315 mach_port_t msgh_remote_port
;
316 mach_port_t msgh_local_port
;
317 mach_msg_size_t msgh_reserved
;
318 mach_msg_id_t msgh_id
;
321 #define MACH_MSG_NULL (mach_msg_header_t *) 0
325 mach_msg_header_t header
;
326 mach_msg_body_t body
;
329 typedef unsigned int mach_msg_trailer_type_t
;
331 #define MACH_MSG_TRAILER_FORMAT_0 0
333 typedef unsigned int mach_msg_trailer_size_t
;
337 mach_msg_trailer_type_t msgh_trailer_type
;
338 mach_msg_trailer_size_t msgh_trailer_size
;
339 } mach_msg_trailer_t
;
343 mach_msg_trailer_type_t msgh_trailer_type
;
344 mach_msg_trailer_size_t msgh_trailer_size
;
345 mach_port_seqno_t msgh_seqno
;
346 } mach_msg_seqno_trailer_t
;
355 mach_msg_trailer_type_t msgh_trailer_type
;
356 mach_msg_trailer_size_t msgh_trailer_size
;
357 mach_port_seqno_t msgh_seqno
;
358 security_token_t msgh_sender
;
359 } mach_msg_security_trailer_t
;
362 * The audit token is an opaque token which identifies
363 * Mach tasks and senders of Mach messages as subjects
364 * to the BSM audit system. Only the appropriate BSM
365 * library routines should be used to interpret the
366 * contents of the audit token as the representation
367 * of the subject identity within the token may change
377 mach_msg_trailer_type_t msgh_trailer_type
;
378 mach_msg_trailer_size_t msgh_trailer_size
;
379 mach_port_seqno_t msgh_seqno
;
380 security_token_t msgh_sender
;
381 audit_token_t msgh_audit
;
382 } mach_msg_audit_trailer_t
;
384 #define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
387 * These values can change from release to release - but clearly
388 * code cannot request additional trailer elements one was not
389 * compiled to understand. Therefore, it is safe to use this
390 * constant when the same module specified the receive options.
391 * Otherwise, you run the risk that the options requested by
392 * another module may exceed the local modules notion of
395 typedef mach_msg_audit_trailer_t mach_msg_max_trailer_t
;
396 #define MAX_TRAILER_SIZE sizeof(mach_msg_max_trailer_t)
399 * Legacy requirements keep us from ever updating these defines (even
400 * when the format_0 trailers gain new option data fields in the future).
401 * Therefore, they shouldn't be used going forward. Instead, the sizes
402 * should be compared against the specific element size requested using
403 * REQUESTED_TRAILER_SIZE.
405 typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t
;
406 #define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
408 #define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
409 extern security_token_t KERNEL_SECURITY_TOKEN
;
411 #define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
412 extern audit_token_t KERNEL_AUDIT_TOKEN
;
414 typedef integer_t mach_msg_options_t
;
418 mach_msg_header_t header
;
419 } mach_msg_empty_send_t
;
423 mach_msg_header_t header
;
424 mach_msg_trailer_t trailer
;
425 } mach_msg_empty_rcv_t
;
429 mach_msg_empty_send_t send
;
430 mach_msg_empty_rcv_t rcv
;
435 /* utility to round the message size - will become machine dependent */
436 #define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
437 ~(sizeof (natural_t) - 1))
440 * There is no fixed upper bound to the size of Mach messages.
443 #define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
446 * Compatibility definitions, for code written
447 * when there was a msgh_kind instead of msgh_seqno.
449 #define MACH_MSGH_KIND_NORMAL 0x00000000
450 #define MACH_MSGH_KIND_NOTIFICATION 0x00000001
451 #define msgh_kind msgh_seqno
452 #define mach_msg_kind_t mach_port_seqno_t
455 * The msgt_number field specifies the number of data elements.
456 * The msgt_size field specifies the size of each data element, in bits.
457 * The msgt_name field specifies the type of each data element.
458 * If msgt_inline is TRUE, the data follows the type descriptor
459 * in the body of the message. If msgt_inline is FALSE, then a pointer
460 * to the data should follow the type descriptor, and the data is
461 * sent out-of-line. In this case, if msgt_deallocate is TRUE,
462 * then the out-of-line data is moved (instead of copied) into the message.
463 * If msgt_longform is TRUE, then the type descriptor is actually
464 * a mach_msg_type_long_t.
466 * The actual amount of inline data following the descriptor must
467 * a multiple of the word size. For out-of-line data, this is a
468 * pointer. For inline data, the supplied data size (calculated
469 * from msgt_number/msgt_size) is rounded up. This guarantees
470 * that type descriptors always fall on word boundaries.
472 * For port rights, msgt_size must be 8*sizeof(mach_port_t).
473 * If the data is inline, msgt_deallocate should be FALSE.
474 * The msgt_unused bit should be zero.
475 * The msgt_name, msgt_size, msgt_number fields in
476 * a mach_msg_type_long_t should be zero.
479 typedef natural_t mach_msg_type_size_t
;
480 typedef natural_t mach_msg_type_number_t
;
483 * Values received/carried in messages. Tells the receiver what
484 * sort of port right he now has.
486 * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
487 * which should remain uninterpreted by the kernel. (Port rights
488 * are not transferred, just the port name.)
491 #define MACH_MSG_TYPE_PORT_NONE 0
493 #define MACH_MSG_TYPE_PORT_NAME 15
494 #define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
495 #define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
496 #define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
498 #define MACH_MSG_TYPE_LAST 22 /* Last assigned */
501 * A dummy value. Mostly used to indicate that the actual value
502 * will be filled in later, dynamically.
505 #define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
508 * Is a given item a port type?
511 #define MACH_MSG_TYPE_PORT_ANY(x) \
512 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
513 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
515 #define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
516 (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
517 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
519 #define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
520 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
521 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
523 typedef integer_t mach_msg_option_t
;
525 #define MACH_MSG_OPTION_NONE 0x00000000
527 #define MACH_SEND_MSG 0x00000001
528 #define MACH_RCV_MSG 0x00000002
529 #define MACH_RCV_LARGE 0x00000004
531 #define MACH_SEND_TIMEOUT 0x00000010
532 #define MACH_SEND_INTERRUPT 0x00000040 /* libmach implements */
533 #define MACH_SEND_CANCEL 0x00000080
534 #define MACH_SEND_ALWAYS 0x00010000 /* internal use only */
535 #define MACH_SEND_TRAILER 0x00020000
537 #define MACH_RCV_TIMEOUT 0x00000100
538 #define MACH_RCV_NOTIFY 0x00000200
539 #define MACH_RCV_INTERRUPT 0x00000400 /* libmach implements */
540 #define MACH_RCV_OVERWRITE 0x00001000
543 * NOTE: a 0x00------ RCV mask implies to ask for
544 * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
545 * which is equivalent to a mach_msg_trailer_t.
547 #define MACH_RCV_TRAILER_NULL 0
548 #define MACH_RCV_TRAILER_SEQNO 1
549 #define MACH_RCV_TRAILER_SENDER 2
550 #define MACH_RCV_TRAILER_AUDIT 3
552 #define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
553 #define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
554 #define MACH_RCV_TRAILER_MASK ((0xff << 24))
556 #define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
557 #define REQUESTED_TRAILER_SIZE(y) \
558 ((mach_msg_trailer_size_t) \
559 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
560 sizeof(mach_msg_trailer_t) : \
561 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
562 sizeof(mach_msg_seqno_trailer_t) : \
563 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
564 sizeof(mach_msg_security_trailer_t) : \
565 sizeof(mach_msg_audit_trailer_t)))))
567 * Much code assumes that mach_msg_return_t == kern_return_t.
568 * This definition is useful for descriptive purposes.
570 * See <mach/error.h> for the format of error codes.
571 * IPC errors are system 4. Send errors are subsystem 0;
572 * receive errors are subsystem 1. The code field is always non-zero.
573 * The high bits of the code field communicate extra information
574 * for some error codes. MACH_MSG_MASK masks off these special bits.
577 typedef kern_return_t mach_msg_return_t
;
579 #define MACH_MSG_SUCCESS 0x00000000
582 #define MACH_MSG_MASK 0x00003e00
583 /* All special error code bits defined below. */
584 #define MACH_MSG_IPC_SPACE 0x00002000
585 /* No room in IPC name space for another capability name. */
586 #define MACH_MSG_VM_SPACE 0x00001000
587 /* No room in VM address space for out-of-line memory. */
588 #define MACH_MSG_IPC_KERNEL 0x00000800
589 /* Kernel resource shortage handling an IPC capability. */
590 #define MACH_MSG_VM_KERNEL 0x00000400
591 /* Kernel resource shortage handling out-of-line memory. */
593 #define MACH_SEND_IN_PROGRESS 0x10000001
594 /* Thread is waiting to send. (Internal use only.) */
595 #define MACH_SEND_INVALID_DATA 0x10000002
596 /* Bogus in-line data. */
597 #define MACH_SEND_INVALID_DEST 0x10000003
598 /* Bogus destination port. */
599 #define MACH_SEND_TIMED_OUT 0x10000004
600 /* Message not sent before timeout expired. */
601 #define MACH_SEND_INTERRUPTED 0x10000007
602 /* Software interrupt. */
603 #define MACH_SEND_MSG_TOO_SMALL 0x10000008
604 /* Data doesn't contain a complete message. */
605 #define MACH_SEND_INVALID_REPLY 0x10000009
606 /* Bogus reply port. */
607 #define MACH_SEND_INVALID_RIGHT 0x1000000a
608 /* Bogus port rights in the message body. */
609 #define MACH_SEND_INVALID_NOTIFY 0x1000000b
610 /* Bogus notify port argument. */
611 #define MACH_SEND_INVALID_MEMORY 0x1000000c
612 /* Invalid out-of-line memory pointer. */
613 #define MACH_SEND_NO_BUFFER 0x1000000d
614 /* No message buffer is available. */
615 #define MACH_SEND_TOO_LARGE 0x1000000e
616 /* Send is too large for port */
617 #define MACH_SEND_INVALID_TYPE 0x1000000f
618 /* Invalid msg-type specification. */
619 #define MACH_SEND_INVALID_HEADER 0x10000010
620 /* A field in the header had a bad value. */
621 #define MACH_SEND_INVALID_TRAILER 0x10000011
622 /* The trailer to be sent does not match kernel format. */
623 #define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
624 /* compatibility: no longer a returned error */
626 #define MACH_RCV_IN_PROGRESS 0x10004001
627 /* Thread is waiting for receive. (Internal use only.) */
628 #define MACH_RCV_INVALID_NAME 0x10004002
629 /* Bogus name for receive port/port-set. */
630 #define MACH_RCV_TIMED_OUT 0x10004003
631 /* Didn't get a message within the timeout value. */
632 #define MACH_RCV_TOO_LARGE 0x10004004
633 /* Message buffer is not large enough for inline data. */
634 #define MACH_RCV_INTERRUPTED 0x10004005
635 /* Software interrupt. */
636 #define MACH_RCV_PORT_CHANGED 0x10004006
637 /* compatibility: no longer a returned error */
638 #define MACH_RCV_INVALID_NOTIFY 0x10004007
639 /* Bogus notify port argument. */
640 #define MACH_RCV_INVALID_DATA 0x10004008
641 /* Bogus message buffer for inline data. */
642 #define MACH_RCV_PORT_DIED 0x10004009
643 /* Port/set was sent away/died during receive. */
644 #define MACH_RCV_IN_SET 0x1000400a
645 /* compatibility: no longer a returned error */
646 #define MACH_RCV_HEADER_ERROR 0x1000400b
647 /* Error receiving message header. See special bits. */
648 #define MACH_RCV_BODY_ERROR 0x1000400c
649 /* Error receiving message body. See special bits. */
650 #define MACH_RCV_INVALID_TYPE 0x1000400d
651 /* Invalid msg-type specification in scatter list. */
652 #define MACH_RCV_SCATTER_SMALL 0x1000400e
653 /* Out-of-line overwrite region is not large enough */
654 #define MACH_RCV_INVALID_TRAILER 0x1000400f
655 /* trailer type or number of trailer elements not supported */
656 #define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
657 /* Waiting for receive with timeout. (Internal use only.) */
663 * Routine: mach_msg_overwrite
665 * Send and/or receive a message. If the message operation
666 * is interrupted, and the user did not request an indication
667 * of that fact, then restart the appropriate parts of the
668 * operation silently (trap version does not restart).
670 * Distinct send and receive buffers may be specified. If
671 * no separate receive buffer is specified, the msg parameter
672 * will be used for both send and receive operations.
674 * In addition to a distinct receive buffer, that buffer may
675 * already contain scatter control information to direct the
676 * receiving of the message.
679 extern mach_msg_return_t
mach_msg_overwrite(
680 mach_msg_header_t
*msg
,
681 mach_msg_option_t option
,
682 mach_msg_size_t send_size
,
683 mach_msg_size_t rcv_size
,
684 mach_port_name_t rcv_name
,
685 mach_msg_timeout_t timeout
,
686 mach_port_name_t notify
,
687 mach_msg_header_t
*rcv_msg
,
688 mach_msg_size_t rcv_limit
);
695 * Send and/or receive a message. If the message operation
696 * is interrupted, and the user did not request an indication
697 * of that fact, then restart the appropriate parts of the
698 * operation silently (trap version does not restart).
700 extern mach_msg_return_t
mach_msg(
701 mach_msg_header_t
*msg
,
702 mach_msg_option_t option
,
703 mach_msg_size_t send_size
,
704 mach_msg_size_t rcv_size
,
705 mach_port_name_t rcv_name
,
706 mach_msg_timeout_t timeout
,
707 mach_port_name_t notify
);
713 #endif /* _MACH_MESSAGE_H_ */