Annotation of XNU/osfmk/mach/message.h, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.