Annotation of OSKit-Mach/include/mach/port.h, revision 1.1

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: #ifdef MACH_KERNEL
        !            39: #include <mach_ipc_compat.h>
        !            40: #endif /* MACH_KERNEL */
        !            41: 
        !            42: #include <mach/boolean.h>
        !            43: #include <mach/machine/vm_types.h>
        !            44: 
        !            45: 
        !            46: typedef natural_t mach_port_t;
        !            47: typedef mach_port_t *mach_port_array_t;
        !            48: typedef int *rpc_signature_info_t;
        !            49: 
        !            50: /*
        !            51:  *  MACH_PORT_NULL is a legal value that can be carried in messages.
        !            52:  *  It indicates the absence of any port or port rights.  (A port
        !            53:  *  argument keeps the message from being "simple", even if the
        !            54:  *  value is MACH_PORT_NULL.)  The value MACH_PORT_DEAD is also
        !            55:  *  a legal value that can be carried in messages.  It indicates
        !            56:  *  that a port right was present, but it died.
        !            57:  */
        !            58: 
        !            59: #define MACH_PORT_NULL         ((mach_port_t) 0)
        !            60: #define MACH_PORT_DEAD         ((mach_port_t) ~0)
        !            61: 
        !            62: #define        MACH_PORT_VALID(name)   \
        !            63:                (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD))
        !            64: 
        !            65: /*
        !            66:  *  These are the different rights a task may have.
        !            67:  *  The MACH_PORT_RIGHT_* definitions are used as arguments
        !            68:  *  to mach_port_allocate, mach_port_get_refs, etc, to specify
        !            69:  *  a particular right to act upon.  The mach_port_names and
        !            70:  *  mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
        !            71:  *  definitions.  This is because a single name may denote
        !            72:  *  multiple rights.
        !            73:  */
        !            74: 
        !            75: typedef natural_t mach_port_right_t;
        !            76: 
        !            77: #define MACH_PORT_RIGHT_SEND           ((mach_port_right_t) 0)
        !            78: #define MACH_PORT_RIGHT_RECEIVE                ((mach_port_right_t) 1)
        !            79: #define MACH_PORT_RIGHT_SEND_ONCE      ((mach_port_right_t) 2)
        !            80: #define MACH_PORT_RIGHT_PORT_SET       ((mach_port_right_t) 3)
        !            81: #define MACH_PORT_RIGHT_DEAD_NAME      ((mach_port_right_t) 4)
        !            82: #define MACH_PORT_RIGHT_NUMBER         ((mach_port_right_t) 5)
        !            83: 
        !            84: typedef natural_t mach_port_type_t;
        !            85: typedef mach_port_type_t *mach_port_type_array_t;
        !            86: 
        !            87: #define MACH_PORT_TYPE(right)      ((mach_port_type_t)(1 << ((right)+16)))
        !            88: #define MACH_PORT_TYPE_NONE        ((mach_port_type_t) 0)
        !            89: #define MACH_PORT_TYPE_SEND        MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
        !            90: #define MACH_PORT_TYPE_RECEIVE     MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
        !            91: #define MACH_PORT_TYPE_SEND_ONCE    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
        !            92: #define MACH_PORT_TYPE_PORT_SET            MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
        !            93: #define MACH_PORT_TYPE_DEAD_NAME    MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
        !            94: 
        !            95: /* Convenient combinations. */
        !            96: 
        !            97: #define MACH_PORT_TYPE_SEND_RECEIVE                                    \
        !            98:                (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
        !            99: #define        MACH_PORT_TYPE_SEND_RIGHTS                                      \
        !           100:                (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
        !           101: #define        MACH_PORT_TYPE_PORT_RIGHTS                                      \
        !           102:                (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
        !           103: #define        MACH_PORT_TYPE_PORT_OR_DEAD                                     \
        !           104:                (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
        !           105: #define MACH_PORT_TYPE_ALL_RIGHTS                                      \
        !           106:                (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
        !           107: 
        !           108: /* Dummy type bits that mach_port_type/mach_port_names can return. */
        !           109: 
        !           110: #define MACH_PORT_TYPE_DNREQUEST       0x80000000U
        !           111: #define MACH_PORT_TYPE_MAREQUEST       0x40000000
        !           112: #define        MACH_PORT_TYPE_COMPAT           0x20000000
        !           113: 
        !           114: /* User-references for capabilities. */
        !           115: 
        !           116: typedef natural_t mach_port_urefs_t;
        !           117: typedef integer_t mach_port_delta_t;                   /* change in urefs */
        !           118: 
        !           119: /* Attributes of ports.  (See mach_port_get_receive_status.) */
        !           120: 
        !           121: typedef natural_t mach_port_seqno_t;           /* sequence number */
        !           122: typedef unsigned int mach_port_mscount_t;      /* make-send count */
        !           123: typedef unsigned int mach_port_msgcount_t;     /* number of msgs */
        !           124: typedef unsigned int mach_port_rights_t;       /* number of rights */
        !           125: 
        !           126: typedef struct mach_port_status {
        !           127:        mach_port_t             mps_pset;       /* containing port set */
        !           128:        mach_port_seqno_t       mps_seqno;      /* sequence number */
        !           129: /*mach_port_mscount_t*/natural_t mps_mscount;  /* make-send count */
        !           130: /*mach_port_msgcount_t*/natural_t mps_qlimit;  /* queue limit */
        !           131: /*mach_port_msgcount_t*/natural_t mps_msgcount;        /* number in the queue */
        !           132: /*mach_port_rights_t*/natural_t        mps_sorights;   /* how many send-once rights */
        !           133: /*boolean_t*/natural_t         mps_srights;    /* do send rights exist? */
        !           134: /*boolean_t*/natural_t         mps_pdrequest;  /* port-deleted requested? */
        !           135: /*boolean_t*/natural_t         mps_nsrequest;  /* no-senders requested? */
        !           136: } mach_port_status_t;
        !           137: 
        !           138: #define MACH_PORT_QLIMIT_DEFAULT       ((mach_port_msgcount_t) 5)
        !           139: #define MACH_PORT_QLIMIT_MAX           ((mach_port_msgcount_t) 16)
        !           140: 
        !           141: /*
        !           142:  *  Compatibility definitions, for code written
        !           143:  *  before there was an mps_seqno field.
        !           144:  */
        !           145: 
        !           146: typedef struct old_mach_port_status {
        !           147:        mach_port_t             mps_pset;       /* containing port set */
        !           148: /*mach_port_mscount_t*/natural_t mps_mscount;  /* make-send count */
        !           149: /*mach_port_msgcount_t*/natural_t mps_qlimit;  /* queue limit */
        !           150: /*mach_port_msgcount_t*/natural_t mps_msgcount;        /* number in the queue */
        !           151: /*mach_port_rights_t*/natural_t        mps_sorights;   /* how many send-once rights */
        !           152: /*boolean_t*/natural_t         mps_srights;    /* do send rights exist? */
        !           153: /*boolean_t*/natural_t         mps_pdrequest;  /* port-deleted requested? */
        !           154: /*boolean_t*/natural_t         mps_nsrequest;  /* no-senders requested? */
        !           155: } old_mach_port_status_t;
        !           156: 
        !           157: 
        !           158: /* Definitions for the old IPC interface. */
        !           159: 
        !           160: #if    MACH_IPC_COMPAT
        !           161: 
        !           162: typedef integer_t      port_name_t;            /* A capability's name */
        !           163: typedef port_name_t    port_set_name_t;        /* Descriptive alias */
        !           164: typedef port_name_t    *port_name_array_t;
        !           165: 
        !           166: typedef integer_t      port_type_t;            /* What kind of capability? */
        !           167: typedef port_type_t    *port_type_array_t;
        !           168: 
        !           169:        /* Values for port_type_t */
        !           170: 
        !           171: #define PORT_TYPE_NONE         0               /* No rights */
        !           172: #define PORT_TYPE_SEND         1               /* Send rights */
        !           173: #define PORT_TYPE_RECEIVE      3               /* obsolete */
        !           174: #define PORT_TYPE_OWN          5               /* obsolete */
        !           175: #define PORT_TYPE_RECEIVE_OWN  7               /* Send, receive, ownership */
        !           176: #define PORT_TYPE_SET          9               /* Set ownership */
        !           177: #define PORT_TYPE_LAST         10              /* Last assigned */
        !           178: 
        !           179: typedef        port_name_t     port_t;                 /* Port with send rights */
        !           180: typedef        port_t          port_rcv_t;             /* Port with receive rights */
        !           181: typedef        port_t          port_own_t;             /* Port with ownership rights */
        !           182: typedef        port_t          port_all_t;             /* Port with receive and ownership */
        !           183: typedef        port_t          *port_array_t;
        !           184: 
        !           185: #define PORT_NULL      ((port_name_t) 0)       /* Used to denote no port; legal value */
        !           186: 
        !           187: #endif /* MACH_IPC_COMPAT */
        !           188: 
        !           189: #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.