]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/message.h
xnu-517.7.7.tar.gz
[apple/xnu.git] / osfmk / mach / message.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
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.
1c79356b 11 *
e5568f75
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
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.
1c79356b
A
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
0b4e3aa0
A
67/* static templates are slower and bigger */
68/* #define UseStaticTemplates 0 */
69
9bccf70c 70#include <sys/appleapiopts.h>
1c79356b 71
9bccf70c
A
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>
1c79356b
A
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
85typedef 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
168typedef unsigned int mach_msg_bits_t;
169typedef natural_t mach_msg_size_t;
170typedef integer_t mach_msg_id_t;
171
172
173#define MACH_MSG_SIZE_NULL (mach_msg_size_t *) 0
174
175typedef 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
185typedef 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
1c79356b
A
193#endif /* MACH_KERNEL */
194
195typedef 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
203typedef 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
211typedef 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
220typedef 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
230typedef 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
240typedef 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
248typedef 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
256typedef 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
268typedef struct
269{
270 mach_msg_header_t header;
271 mach_msg_body_t body;
272} mach_msg_base_t;
273
274typedef unsigned int mach_msg_trailer_type_t;
275
276#define MACH_MSG_TRAILER_FORMAT_0 0
277
278typedef unsigned int mach_msg_trailer_size_t;
279
280typedef 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
286typedef 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
293typedef struct
294{
295 unsigned int val[2];
296} security_token_t;
297
298typedef 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
e5568f75
A
306/*
307 * The audit token is an opaque token which identifies
308 * Mach tasks and senders of Mach messages as subjects
309 * to the BSM audit system. Only the appropriate BSM
310 * library routines should be used to interpret the
311 * contents of the audit token as the representation
312 * of the subject identity within the token may change
313 * over time.
314 */
55e303ae
A
315typedef struct
316{
317 unsigned int val[8];
318} audit_token_t;
319
320typedef struct
321{
322 mach_msg_trailer_type_t msgh_trailer_type;
323 mach_msg_trailer_size_t msgh_trailer_size;
324 mach_port_seqno_t msgh_seqno;
325 security_token_t msgh_sender;
326 audit_token_t msgh_audit;
327} mach_msg_audit_trailer_t;
1c79356b 328
1c79356b 329#define MACH_MSG_TRAILER_MINIMUM_SIZE sizeof(mach_msg_trailer_t)
55e303ae
A
330
331/*
332 * These values can change from release to release - but clearly
333 * code cannot request additional trailer elements one was not
334 * compiled to understand. Therefore, it is safe to use this
335 * constant when the same module specified the receive options.
336 * Otherwise, you run the risk that the options requested by
337 * another module may exceed the local modules notion of
338 * MAX_TRAILER_SIZE.
339 */
340typedef mach_msg_audit_trailer_t mach_msg_max_trailer_t;
341#define MAX_TRAILER_SIZE sizeof(mach_msg_max_trailer_t)
342
343/*
344 * Legacy requirements keep us from ever updating these defines (even
345 * when the format_0 trailers gain new option data fields in the future).
346 * Therefore, they shouldn't be used going forward. Instead, the sizes
347 * should be compared against the specific element size requested using
348 * REQUESTED_TRAILER_SIZE.
349 */
350typedef mach_msg_security_trailer_t mach_msg_format_0_trailer_t;
351#define MACH_MSG_TRAILER_FORMAT_0_SIZE sizeof(mach_msg_format_0_trailer_t)
1c79356b
A
352
353#define KERNEL_SECURITY_TOKEN_VALUE { {0, 1} }
354extern security_token_t KERNEL_SECURITY_TOKEN;
355
55e303ae
A
356#define KERNEL_AUDIT_TOKEN_VALUE { {0, 0, 0, 0, 0, 0, 0, 0} }
357extern audit_token_t KERNEL_AUDIT_TOKEN;
358
1c79356b
A
359typedef integer_t mach_msg_options_t;
360
361typedef struct
362{
363 mach_msg_header_t header;
364} mach_msg_empty_send_t;
365
366typedef struct
367{
368 mach_msg_header_t header;
369 mach_msg_trailer_t trailer;
370} mach_msg_empty_rcv_t;
371
372typedef union
373{
374 mach_msg_empty_send_t send;
375 mach_msg_empty_rcv_t rcv;
376} mach_msg_empty_t;
377
378/* utility to round the message size - will become machine dependent */
379#define round_msg(x) (((mach_msg_size_t)(x) + sizeof (natural_t) - 1) & \
380 ~(sizeof (natural_t) - 1))
381
382/*
383 * There is no fixed upper bound to the size of Mach messages.
384 */
385
386#define MACH_MSG_SIZE_MAX ((mach_msg_size_t) ~0)
387
9bccf70c 388#ifdef __APPLE_API_OBSOLETE
1c79356b
A
389/*
390 * Compatibility definitions, for code written
391 * when there was a msgh_kind instead of msgh_seqno.
392 */
1c79356b 393#define MACH_MSGH_KIND_NORMAL 0x00000000
1c79356b 394#define MACH_MSGH_KIND_NOTIFICATION 0x00000001
1c79356b
A
395#define msgh_kind msgh_seqno
396#define mach_msg_kind_t mach_port_seqno_t
9bccf70c 397#endif /* __APPLE_API_OBSOLETE */
1c79356b
A
398
399/*
400 * The msgt_number field specifies the number of data elements.
401 * The msgt_size field specifies the size of each data element, in bits.
402 * The msgt_name field specifies the type of each data element.
403 * If msgt_inline is TRUE, the data follows the type descriptor
404 * in the body of the message. If msgt_inline is FALSE, then a pointer
405 * to the data should follow the type descriptor, and the data is
406 * sent out-of-line. In this case, if msgt_deallocate is TRUE,
407 * then the out-of-line data is moved (instead of copied) into the message.
408 * If msgt_longform is TRUE, then the type descriptor is actually
409 * a mach_msg_type_long_t.
410 *
411 * The actual amount of inline data following the descriptor must
412 * a multiple of the word size. For out-of-line data, this is a
413 * pointer. For inline data, the supplied data size (calculated
414 * from msgt_number/msgt_size) is rounded up. This guarantees
415 * that type descriptors always fall on word boundaries.
416 *
417 * For port rights, msgt_size must be 8*sizeof(mach_port_t).
418 * If the data is inline, msgt_deallocate should be FALSE.
419 * The msgt_unused bit should be zero.
420 * The msgt_name, msgt_size, msgt_number fields in
421 * a mach_msg_type_long_t should be zero.
422 */
423
424typedef natural_t mach_msg_type_size_t;
425typedef natural_t mach_msg_type_number_t;
426
427/*
428 * Values received/carried in messages. Tells the receiver what
429 * sort of port right he now has.
430 *
431 * MACH_MSG_TYPE_PORT_NAME is used to transfer a port name
432 * which should remain uninterpreted by the kernel. (Port rights
433 * are not transferred, just the port name.)
434 */
435
436#define MACH_MSG_TYPE_PORT_NONE 0
437
438#define MACH_MSG_TYPE_PORT_NAME 15
439#define MACH_MSG_TYPE_PORT_RECEIVE MACH_MSG_TYPE_MOVE_RECEIVE
440#define MACH_MSG_TYPE_PORT_SEND MACH_MSG_TYPE_MOVE_SEND
441#define MACH_MSG_TYPE_PORT_SEND_ONCE MACH_MSG_TYPE_MOVE_SEND_ONCE
442
443#define MACH_MSG_TYPE_LAST 22 /* Last assigned */
444
445/*
446 * A dummy value. Mostly used to indicate that the actual value
447 * will be filled in later, dynamically.
448 */
449
450#define MACH_MSG_TYPE_POLYMORPHIC ((mach_msg_type_name_t) -1)
451
452/*
453 * Is a given item a port type?
454 */
455
456#define MACH_MSG_TYPE_PORT_ANY(x) \
457 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
458 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
459
460#define MACH_MSG_TYPE_PORT_ANY_SEND(x) \
461 (((x) >= MACH_MSG_TYPE_MOVE_SEND) && \
462 ((x) <= MACH_MSG_TYPE_MAKE_SEND_ONCE))
463
464#define MACH_MSG_TYPE_PORT_ANY_RIGHT(x) \
465 (((x) >= MACH_MSG_TYPE_MOVE_RECEIVE) && \
466 ((x) <= MACH_MSG_TYPE_MOVE_SEND_ONCE))
467
468typedef integer_t mach_msg_option_t;
469
470#define MACH_MSG_OPTION_NONE 0x00000000
471
472#define MACH_SEND_MSG 0x00000001
473#define MACH_RCV_MSG 0x00000002
474#define MACH_RCV_LARGE 0x00000004
475
476#define MACH_SEND_TIMEOUT 0x00000010
477#define MACH_SEND_INTERRUPT 0x00000040 /* libmach implements */
478#define MACH_SEND_CANCEL 0x00000080
479#define MACH_SEND_ALWAYS 0x00010000 /* internal use only */
480#define MACH_SEND_TRAILER 0x00020000
481
482#define MACH_RCV_TIMEOUT 0x00000100
483#define MACH_RCV_NOTIFY 0x00000200
484#define MACH_RCV_INTERRUPT 0x00000400 /* libmach implements */
485#define MACH_RCV_OVERWRITE 0x00001000
486
487/*
488 * NOTE: a 0x00------ RCV mask implies to ask for
489 * a MACH_MSG_TRAILER_FORMAT_0 with 0 Elements,
490 * which is equivalent to a mach_msg_trailer_t.
491 */
492#define MACH_RCV_TRAILER_NULL 0
493#define MACH_RCV_TRAILER_SEQNO 1
494#define MACH_RCV_TRAILER_SENDER 2
55e303ae 495#define MACH_RCV_TRAILER_AUDIT 3
1c79356b
A
496
497#define MACH_RCV_TRAILER_TYPE(x) (((x) & 0xf) << 28)
498#define MACH_RCV_TRAILER_ELEMENTS(x) (((x) & 0xf) << 24)
499#define MACH_RCV_TRAILER_MASK ((0xff << 24))
500
1c79356b 501#define GET_RCV_ELEMENTS(y) (((y) >> 24) & 0xf)
9bccf70c
A
502#define REQUESTED_TRAILER_SIZE(y) \
503 ((mach_msg_trailer_size_t) \
504 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_NULL) ? \
505 sizeof(mach_msg_trailer_t) : \
506 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SEQNO) ? \
507 sizeof(mach_msg_seqno_trailer_t) : \
55e303ae
A
508 ((GET_RCV_ELEMENTS(y) == MACH_RCV_TRAILER_SENDER) ? \
509 sizeof(mach_msg_security_trailer_t) : \
510 sizeof(mach_msg_audit_trailer_t)))))
1c79356b
A
511/*
512 * Much code assumes that mach_msg_return_t == kern_return_t.
513 * This definition is useful for descriptive purposes.
514 *
515 * See <mach/error.h> for the format of error codes.
516 * IPC errors are system 4. Send errors are subsystem 0;
517 * receive errors are subsystem 1. The code field is always non-zero.
518 * The high bits of the code field communicate extra information
519 * for some error codes. MACH_MSG_MASK masks off these special bits.
520 */
521
522typedef kern_return_t mach_msg_return_t;
523
524#define MACH_MSG_SUCCESS 0x00000000
525
526
527#define MACH_MSG_MASK 0x00003e00
528 /* All special error code bits defined below. */
529#define MACH_MSG_IPC_SPACE 0x00002000
530 /* No room in IPC name space for another capability name. */
531#define MACH_MSG_VM_SPACE 0x00001000
532 /* No room in VM address space for out-of-line memory. */
533#define MACH_MSG_IPC_KERNEL 0x00000800
534 /* Kernel resource shortage handling an IPC capability. */
535#define MACH_MSG_VM_KERNEL 0x00000400
536 /* Kernel resource shortage handling out-of-line memory. */
537
538#define MACH_SEND_IN_PROGRESS 0x10000001
539 /* Thread is waiting to send. (Internal use only.) */
540#define MACH_SEND_INVALID_DATA 0x10000002
541 /* Bogus in-line data. */
542#define MACH_SEND_INVALID_DEST 0x10000003
543 /* Bogus destination port. */
544#define MACH_SEND_TIMED_OUT 0x10000004
545 /* Message not sent before timeout expired. */
546#define MACH_SEND_INTERRUPTED 0x10000007
547 /* Software interrupt. */
548#define MACH_SEND_MSG_TOO_SMALL 0x10000008
549 /* Data doesn't contain a complete message. */
550#define MACH_SEND_INVALID_REPLY 0x10000009
551 /* Bogus reply port. */
552#define MACH_SEND_INVALID_RIGHT 0x1000000a
553 /* Bogus port rights in the message body. */
554#define MACH_SEND_INVALID_NOTIFY 0x1000000b
555 /* Bogus notify port argument. */
556#define MACH_SEND_INVALID_MEMORY 0x1000000c
557 /* Invalid out-of-line memory pointer. */
558#define MACH_SEND_NO_BUFFER 0x1000000d
559 /* No message buffer is available. */
560#define MACH_SEND_TOO_LARGE 0x1000000e
561 /* Send is too large for port */
562#define MACH_SEND_INVALID_TYPE 0x1000000f
563 /* Invalid msg-type specification. */
564#define MACH_SEND_INVALID_HEADER 0x10000010
565 /* A field in the header had a bad value. */
566#define MACH_SEND_INVALID_TRAILER 0x10000011
567 /* The trailer to be sent does not match kernel format. */
568#define MACH_SEND_INVALID_RT_OOL_SIZE 0x10000015
9bccf70c 569 /* compatibility: no longer a returned error */
1c79356b
A
570
571#define MACH_RCV_IN_PROGRESS 0x10004001
572 /* Thread is waiting for receive. (Internal use only.) */
573#define MACH_RCV_INVALID_NAME 0x10004002
574 /* Bogus name for receive port/port-set. */
575#define MACH_RCV_TIMED_OUT 0x10004003
576 /* Didn't get a message within the timeout value. */
577#define MACH_RCV_TOO_LARGE 0x10004004
578 /* Message buffer is not large enough for inline data. */
579#define MACH_RCV_INTERRUPTED 0x10004005
580 /* Software interrupt. */
581#define MACH_RCV_PORT_CHANGED 0x10004006
9bccf70c 582 /* compatibility: no longer a returned error */
1c79356b
A
583#define MACH_RCV_INVALID_NOTIFY 0x10004007
584 /* Bogus notify port argument. */
585#define MACH_RCV_INVALID_DATA 0x10004008
586 /* Bogus message buffer for inline data. */
587#define MACH_RCV_PORT_DIED 0x10004009
588 /* Port/set was sent away/died during receive. */
589#define MACH_RCV_IN_SET 0x1000400a
9bccf70c 590 /* compatibility: no longer a returned error */
1c79356b
A
591#define MACH_RCV_HEADER_ERROR 0x1000400b
592 /* Error receiving message header. See special bits. */
593#define MACH_RCV_BODY_ERROR 0x1000400c
594 /* Error receiving message body. See special bits. */
595#define MACH_RCV_INVALID_TYPE 0x1000400d
596 /* Invalid msg-type specification in scatter list. */
597#define MACH_RCV_SCATTER_SMALL 0x1000400e
598 /* Out-of-line overwrite region is not large enough */
599#define MACH_RCV_INVALID_TRAILER 0x1000400f
600 /* trailer type or number of trailer elements not supported */
601#define MACH_RCV_IN_PROGRESS_TIMED 0x10004011
602 /* Waiting for receive with timeout. (Internal use only.) */
603
9bccf70c
A
604/*
605 * Routine: mach_msg_overwrite
606 * Purpose:
607 * Send and/or receive a message. If the message operation
608 * is interrupted, and the user did not request an indication
609 * of that fact, then restart the appropriate parts of the
610 * operation silently (trap version does not restart).
611 *
612 * Distinct send and receive buffers may be specified. If
613 * no separate receive buffer is specified, the msg parameter
614 * will be used for both send and receive operations.
615 *
616 * In addition to a distinct receive buffer, that buffer may
617 * already contain scatter control information to direct the
618 * receiving of the message.
619 */
620#ifdef __APPLE_API_PRIVATE
1c79356b
A
621extern mach_msg_return_t mach_msg_overwrite_trap(
622 mach_msg_header_t *msg,
623 mach_msg_option_t option,
624 mach_msg_size_t send_size,
625 mach_msg_size_t rcv_size,
626 mach_port_name_t rcv_name,
627 mach_msg_timeout_t timeout,
628 mach_port_name_t notify,
629 mach_msg_header_t *rcv_msg,
630 mach_msg_size_t rcv_limit);
9bccf70c 631#endif /* __APPLE_API_PRIVATE */
1c79356b
A
632
633extern mach_msg_return_t mach_msg_overwrite(
634 mach_msg_header_t *msg,
635 mach_msg_option_t option,
636 mach_msg_size_t send_size,
637 mach_msg_size_t rcv_size,
638 mach_port_name_t rcv_name,
639 mach_msg_timeout_t timeout,
640 mach_port_name_t notify,
641 mach_msg_header_t *rcv_msg,
642 mach_msg_size_t rcv_limit);
643
9bccf70c
A
644/*
645 * Routine: mach_msg
646 * Purpose:
647 * Send and/or receive a message. If the message operation
648 * is interrupted, and the user did not request an indication
649 * of that fact, then restart the appropriate parts of the
650 * operation silently (trap version does not restart).
651 */
652#ifdef __APPLE_API_PRIVATE
1c79356b
A
653extern mach_msg_return_t mach_msg_trap(
654 mach_msg_header_t *msg,
655 mach_msg_option_t option,
656 mach_msg_size_t send_size,
657 mach_msg_size_t rcv_size,
658 mach_port_name_t rcv_name,
659 mach_msg_timeout_t timeout,
660 mach_port_name_t notify);
9bccf70c 661#endif /* __APPLE_API_PRIVATE */
1c79356b
A
662
663extern mach_msg_return_t mach_msg(
664 mach_msg_header_t *msg,
665 mach_msg_option_t option,
666 mach_msg_size_t send_size,
667 mach_msg_size_t rcv_size,
668 mach_port_name_t rcv_name,
669 mach_msg_timeout_t timeout,
670 mach_port_name_t notify);
671
672#endif /* _MACH_MESSAGE_H_ */