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

1.1     ! root        1: /*
        !             2:  * Mach Operating System
        !             3:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University.
        !             4:  * Copyright (c) 1993,1994 The University of Utah and
        !             5:  * the Computer Systems Laboratory (CSL).
        !             6:  * All rights reserved.
        !             7:  *
        !             8:  * Permission to use, copy, modify and distribute this software and its
        !             9:  * documentation is hereby granted, provided that both the copyright
        !            10:  * notice and this permission notice appear in all copies of the
        !            11:  * software, derivative works or modified versions, and any portions
        !            12:  * thereof, and that both notices appear in supporting documentation.
        !            13:  *
        !            14:  * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
        !            15:  * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
        !            16:  * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
        !            17:  * THIS SOFTWARE.
        !            18:  *
        !            19:  * Carnegie Mellon requests users of this software to return to
        !            20:  *
        !            21:  *  Software Distribution Coordinator  or  [email protected]
        !            22:  *  School of Computer Science
        !            23:  *  Carnegie Mellon University
        !            24:  *  Pittsburgh PA 15213-3890
        !            25:  *
        !            26:  * any improvements or extensions that they make and grant Carnegie Mellon
        !            27:  * the rights to redistribute these changes.
        !            28:  */
        !            29: /*
        !            30:  */
        !            31: /*
        !            32:  *     File:   ipc/ipc_port.h
        !            33:  *     Author: Rich Draves
        !            34:  *     Date:   1989
        !            35:  *
        !            36:  *     Implementation specific complement to mach/port.h.
        !            37:  */
        !            38: 
        !            39: #ifndef        _IPC_PORT_H_
        !            40: #define _IPC_PORT_H_
        !            41: 
        !            42: #include <mach/port.h>
        !            43: 
        !            44: /*
        !            45:  *     mach_port_t must be an unsigned type.  Port values
        !            46:  *     have two parts, a generation number and an index.
        !            47:  *     These macros encapsulate all knowledge of how
        !            48:  *     a mach_port_t is layed out.  However, ipc/ipc_entry.c
        !            49:  *     implicitly assumes when it uses the splay tree functions
        !            50:  *     that the generation number is in the low bits, so that
        !            51:  *     names are ordered first by index and then by generation.
        !            52:  *
        !            53:  *     If the size of generation numbers changes,
        !            54:  *     be sure to update IE_BITS_GEN_MASK and friends
        !            55:  *     in ipc/ipc_entry.h.
        !            56:  */
        !            57: 
        !            58: #if PORT_GENERATIONS
        !            59: #define        MACH_PORT_INDEX(name)           ((name) >> 8)
        !            60: #define        MACH_PORT_GEN(name)             (((name) & 0xff) << 24)
        !            61: #define        MACH_PORT_MAKE(index, gen)      (((index) << 8) | ((gen) >> 24))
        !            62: #else
        !            63: #define        MACH_PORT_INDEX(name)           (name)
        !            64: #define        MACH_PORT_GEN(name)             0
        !            65: #define        MACH_PORT_MAKE(index, gen)      (index)
        !            66: #endif
        !            67: 
        !            68: #define        MACH_PORT_NGEN(name)            MACH_PORT_MAKE(0, MACH_PORT_GEN(name))
        !            69: #define        MACH_PORT_MAKEB(index, bits)    MACH_PORT_MAKE(index, IE_BITS_GEN(bits))
        !            70: 
        !            71: /*
        !            72:  *     Typedefs for code cleanliness.  These must all have
        !            73:  *     the same (unsigned) type as mach_port_t.
        !            74:  */
        !            75: 
        !            76: typedef mach_port_t mach_port_index_t;         /* index values */
        !            77: typedef mach_port_t mach_port_gen_t;           /* generation numbers */
        !            78: 
        !            79: 
        !            80: #define        MACH_PORT_UREFS_MAX     ((mach_port_urefs_t) ((1 << 16) - 1))
        !            81: 
        !            82: #define        MACH_PORT_UREFS_OVERFLOW(urefs, delta)                          \
        !            83:                (((delta) > 0) &&                                       \
        !            84:                 ((((urefs) + (delta)) <= (urefs)) ||                   \
        !            85:                  (((urefs) + (delta)) > MACH_PORT_UREFS_MAX)))
        !            86: 
        !            87: #define        MACH_PORT_UREFS_UNDERFLOW(urefs, delta)                         \
        !            88:                (((delta) < 0) && (-(delta) > (urefs)))
        !            89: 
        !            90: #endif /* _IPC_PORT_H_ */

unix.superglobalmegacorp.com

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