The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/ipc/port.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989 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  Software.Distribution@CS.CMU.EDU
   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  * HISTORY
   28  * $Log:        port.h,v $
   29  * Revision 2.6  93/01/14  17:33:25  danner
   30  *      64bit cleanup.
   31  *      [92/11/30            af]
   32  * 
   33  * Revision 2.5  91/05/14  16:39:33  mrt
   34  *      Correcting copyright
   35  * 
   36  * Revision 2.4  91/02/05  17:25:23  mrt
   37  *      Changed to new Mach copyright
   38  *      [91/02/01  15:53:51  mrt]
   39  * 
   40  * Revision 2.3  91/01/08  15:15:29  rpd
   41  *      Removed MACH_IPC_GENNOS.
   42  *      [90/11/08            rpd]
   43  * 
   44  * Revision 2.2  90/06/02  14:52:36  rpd
   45  *      Created for new IPC.
   46  *      [90/03/26  21:06:32  rpd]
   47  * 
   48  */
   49 /*
   50  *      File:   ipc/ipc_port.h
   51  *      Author: Rich Draves
   52  *      Date:   1989
   53  *
   54  *      Implementation specific complement to mach/port.h.
   55  */
   56 
   57 #ifndef _IPC_PORT_H_
   58 #define _IPC_PORT_H_
   59 
   60 #include <mach/port.h>
   61 
   62 /*
   63  *      mach_port_t must be an unsigned type.  Port values
   64  *      have two parts, a generation number and an index.
   65  *      These macros encapsulate all knowledge of how
   66  *      a mach_port_t is layed out.  However, ipc/ipc_entry.c
   67  *      implicitly assumes when it uses the splay tree functions
   68  *      that the generation number is in the low bits, so that
   69  *      names are ordered first by index and then by generation.
   70  *
   71  *      If the size of generation numbers changes,
   72  *      be sure to update IE_BITS_GEN_MASK and friends
   73  *      in ipc/ipc_entry.h.
   74  */
   75 
   76 #define MACH_PORT_INDEX(name)           ((name) >> 8)
   77 #define MACH_PORT_GEN(name)             (((name) & 0xff) << 24)
   78 #define MACH_PORT_MAKE(index, gen)      (((index) << 8) | ((gen) >> 24))
   79 
   80 #define MACH_PORT_NGEN(name)            MACH_PORT_MAKE(0, MACH_PORT_GEN(name))
   81 #define MACH_PORT_MAKEB(index, bits)    \
   82                 MACH_PORT_MAKE(index, IE_BITS_GEN(bits))
   83 
   84 /*
   85  *      Typedefs for code cleanliness.  These must all have
   86  *      the same (unsigned) type as mach_port_t.
   87  */
   88 
   89 typedef mach_port_t mach_port_index_t;          /* index values */
   90 typedef mach_port_t mach_port_gen_t;            /* generation numbers */
   91 
   92 
   93 #define MACH_PORT_UREFS_MAX     ((mach_port_urefs_t) ((1 << 16) - 1))
   94 
   95 #define MACH_PORT_UREFS_OVERFLOW(urefs, delta)                          \
   96                 (((delta) > 0) &&                                       \
   97                  ((((urefs) + (delta)) <= (urefs)) ||                   \
   98                   (((urefs) + (delta)) > MACH_PORT_UREFS_MAX)))
   99 
  100 #define MACH_PORT_UREFS_UNDERFLOW(urefs, delta)                         \
  101                 (((delta) < 0) && (-(delta) > (urefs)))
  102 
  103 #endif  _IPC_PORT_H_

Cache object: fc36321c0ea9b4d456ebc5d39be07d17


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.