Annotation of Gnu-Mach/include/mach/port.h, revision 1.1.1.2

1.1       root        1: /* 
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
                      4:  * All Rights Reserved.
                      5:  * 
                      6:  * Permission to use, copy, modify and distribute this software and its
                      7:  * documentation is hereby granted, provided that both the copyright
                      8:  * notice and this permission notice appear in all copies of the
                      9:  * software, derivative works or modified versions, and any portions
                     10:  * thereof, and that both notices appear in supporting documentation.
                     11:  * 
                     12:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
                     13:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
                     14:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
                     15:  * 
                     16:  * Carnegie Mellon requests users of this software to return to
                     17:  * 
                     18:  *  Software Distribution Coordinator  or  [email protected]
                     19:  *  School of Computer Science
                     20:  *  Carnegie Mellon University
                     21:  *  Pittsburgh PA 15213-3890
                     22:  * 
                     23:  * any improvements or extensions that they make and grant Carnegie Mellon
                     24:  * the rights to redistribute these changes.
                     25:  */
                     26: /*
                     27:  *     File:   mach/port.h
                     28:  *
                     29:  *     Definition of a port
                     30:  *
                     31:  *     [The basic mach_port_t type should probably be machine-dependent,
                     32:  *     as it must be represented by a 32-bit integer.]
                     33:  */
                     34: 
                     35: #ifndef        _MACH_PORT_H_
                     36: #define _MACH_PORT_H_
                     37: 
                     38: #include <mach/boolean.h>
                     39: #include <mach/machine/vm_types.h>
                     40: 
                     41: 
1.1.1.2 ! root       42: typedef vm_offset_t mach_port_t;
1.1       root       43: typedef mach_port_t *mach_port_array_t;
                     44: typedef int *rpc_signature_info_t;
                     45: 
                     46: /*
                     47:  *  MACH_PORT_NULL is a legal value that can be carried in messages.
                     48:  *  It indicates the absence of any port or port rights.  (A port
                     49:  *  argument keeps the message from being "simple", even if the
                     50:  *  value is MACH_PORT_NULL.)  The value MACH_PORT_DEAD is also
                     51:  *  a legal value that can be carried in messages.  It indicates
                     52:  *  that a port right was present, but it died.
                     53:  */
                     54: 
                     55: #define MACH_PORT_NULL         ((mach_port_t) 0)
                     56: #define MACH_PORT_DEAD         ((mach_port_t) ~0)
                     57: 
                     58: #define        MACH_PORT_VALID(name)   \
                     59:                (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD))
                     60: 
                     61: /*
                     62:  *  These are the different rights a task may have.
                     63:  *  The MACH_PORT_RIGHT_* definitions are used as arguments
                     64:  *  to mach_port_allocate, mach_port_get_refs, etc, to specify
                     65:  *  a particular right to act upon.  The mach_port_names and
                     66:  *  mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
                     67:  *  definitions.  This is because a single name may denote
                     68:  *  multiple rights.
                     69:  */
                     70: 
                     71: typedef natural_t mach_port_right_t;
                     72: 
                     73: #define MACH_PORT_RIGHT_SEND           ((mach_port_right_t) 0)
                     74: #define MACH_PORT_RIGHT_RECEIVE                ((mach_port_right_t) 1)
                     75: #define MACH_PORT_RIGHT_SEND_ONCE      ((mach_port_right_t) 2)
                     76: #define MACH_PORT_RIGHT_PORT_SET       ((mach_port_right_t) 3)
                     77: #define MACH_PORT_RIGHT_DEAD_NAME      ((mach_port_right_t) 4)
                     78: #define MACH_PORT_RIGHT_NUMBER         ((mach_port_right_t) 5)
                     79: 
                     80: typedef natural_t mach_port_type_t;
                     81: typedef mach_port_type_t *mach_port_type_array_t;
                     82: 
                     83: #define MACH_PORT_TYPE(right)      ((mach_port_type_t)(1 << ((right)+16)))
                     84: #define MACH_PORT_TYPE_NONE        ((mach_port_type_t) 0)
                     85: #define MACH_PORT_TYPE_SEND        MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
                     86: #define MACH_PORT_TYPE_RECEIVE     MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
                     87: #define MACH_PORT_TYPE_SEND_ONCE    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
                     88: #define MACH_PORT_TYPE_PORT_SET            MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
                     89: #define MACH_PORT_TYPE_DEAD_NAME    MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
                     90: 
                     91: /* Convenient combinations. */
                     92: 
                     93: #define MACH_PORT_TYPE_SEND_RECEIVE                                    \
                     94:                (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
                     95: #define        MACH_PORT_TYPE_SEND_RIGHTS                                      \
                     96:                (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
                     97: #define        MACH_PORT_TYPE_PORT_RIGHTS                                      \
                     98:                (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
                     99: #define        MACH_PORT_TYPE_PORT_OR_DEAD                                     \
                    100:                (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
                    101: #define MACH_PORT_TYPE_ALL_RIGHTS                                      \
                    102:                (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
                    103: 
                    104: /* Dummy type bits that mach_port_type/mach_port_names can return. */
                    105: 
                    106: #define MACH_PORT_TYPE_DNREQUEST       0x80000000U
                    107: #define MACH_PORT_TYPE_MAREQUEST       0x40000000
                    108: #define        MACH_PORT_TYPE_COMPAT           0x20000000
                    109: 
                    110: /* User-references for capabilities. */
                    111: 
                    112: typedef natural_t mach_port_urefs_t;
                    113: typedef integer_t mach_port_delta_t;                   /* change in urefs */
                    114: 
                    115: /* Attributes of ports.  (See mach_port_get_receive_status.) */
                    116: 
                    117: typedef natural_t mach_port_seqno_t;           /* sequence number */
                    118: typedef unsigned int mach_port_mscount_t;      /* make-send count */
                    119: typedef unsigned int mach_port_msgcount_t;     /* number of msgs */
                    120: typedef unsigned int mach_port_rights_t;       /* number of rights */
                    121: 
                    122: typedef struct mach_port_status {
                    123:        mach_port_t             mps_pset;       /* containing port set */
                    124:        mach_port_seqno_t       mps_seqno;      /* sequence number */
                    125: /*mach_port_mscount_t*/natural_t mps_mscount;  /* make-send count */
                    126: /*mach_port_msgcount_t*/natural_t mps_qlimit;  /* queue limit */
                    127: /*mach_port_msgcount_t*/natural_t mps_msgcount;        /* number in the queue */
                    128: /*mach_port_rights_t*/natural_t        mps_sorights;   /* how many send-once rights */
                    129: /*boolean_t*/natural_t         mps_srights;    /* do send rights exist? */
                    130: /*boolean_t*/natural_t         mps_pdrequest;  /* port-deleted requested? */
                    131: /*boolean_t*/natural_t         mps_nsrequest;  /* no-senders requested? */
                    132: } mach_port_status_t;
                    133: 
                    134: #define MACH_PORT_QLIMIT_DEFAULT       ((mach_port_msgcount_t) 5)
                    135: #define MACH_PORT_QLIMIT_MAX           ((mach_port_msgcount_t) 16)
                    136: 
                    137: /*
                    138:  *  Compatibility definitions, for code written
                    139:  *  before there was an mps_seqno field.
                    140:  */
                    141: 
                    142: typedef struct old_mach_port_status {
                    143:        mach_port_t             mps_pset;       /* containing port set */
                    144: /*mach_port_mscount_t*/natural_t mps_mscount;  /* make-send count */
                    145: /*mach_port_msgcount_t*/natural_t mps_qlimit;  /* queue limit */
                    146: /*mach_port_msgcount_t*/natural_t mps_msgcount;        /* number in the queue */
                    147: /*mach_port_rights_t*/natural_t        mps_sorights;   /* how many send-once rights */
                    148: /*boolean_t*/natural_t         mps_srights;    /* do send rights exist? */
                    149: /*boolean_t*/natural_t         mps_pdrequest;  /* port-deleted requested? */
                    150: /*boolean_t*/natural_t         mps_nsrequest;  /* no-senders requested? */
                    151: } old_mach_port_status_t;
                    152: 
                    153: #endif /* _MACH_PORT_H_ */

unix.superglobalmegacorp.com

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