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/mach/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,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  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.9  93/01/14  17:46:31  danner
   30  *      Cleanup.
   31  *      [92/06/10            pds]
   32  *      64bit cleanup.
   33  *      [92/12/01            af]
   34  * 
   35  * Revision 2.8  92/05/21  17:22:37  jfriedl
   36  *      Appended 'U' to constants that would otherwise be signed.
   37  *      [92/05/16            jfriedl]
   38  * 
   39  * Revision 2.7  92/01/15  13:44:48  rpd
   40  *      Changed MACH_IPC_COMPAT conditionals to default to not present.
   41  * 
   42  * Revision 2.6  91/08/28  11:15:36  jsb
   43  *      Added mach_port_seqno_t.  Added mps_seqno to mach_port_status_t
   44  *      and created old_mach_port_status_t for compatibility purposes.
   45  *      [91/08/09            rpd]
   46  * 
   47  * Revision 2.5  91/08/24  12:17:54  af
   48  *      Added a set of parenthesis to MACH_PORT_TYPE to shut up gcc2.
   49  *      [91/07/19            danner]
   50  * 
   51  * Revision 2.4.4.1  91/08/19  13:48:02  danner
   52  *      Added a set of parenthesis to MACH_PORT_TYPE to shut up gcc2.
   53  *      [91/07/19            danner]
   54  * 
   55  * Revision 2.4  91/05/14  16:58:38  mrt
   56  *      Correcting copyright
   57  * 
   58  * Revision 2.3  91/02/05  17:35:27  mrt
   59  *      Changed to new Mach copyright
   60  *      [91/02/01  17:20:17  mrt]
   61  * 
   62  * Revision 2.2  90/06/02  14:59:44  rpd
   63  *      Added mach_port_status_t.
   64  *      [90/05/13            rpd]
   65  *      Converted to new IPC.
   66  *      [90/03/26  22:38:36  rpd]
   67  * 
   68  *
   69  * Condensed history:
   70  *      Put ownership rights under MACH_IPC_XXXHACK (rpd).
   71  *      Put PORT_ENABLED under MACH_IPC_XXXHACK (rpd).
   72  *      Removed PORT_INVALID (rpd).
   73  *      Added port set, port name, port type declarations (rpd).
   74  *      Added PORT_INVALID (mwyoung).
   75  *      Added port_*_t types (mwyoung).
   76  *      Added PORT_ENABLED (mwyoung).
   77  *      Created (mwyoung).
   78  */
   79 /*
   80  *      File:   mach/port.h
   81  *
   82  *      Definition of a port
   83  *
   84  *      [The basic mach_port_t type should probably be machine-dependent,
   85  *      as it must be represented by a 32-bit integer.]
   86  */
   87 
   88 #ifndef _MACH_PORT_H_
   89 #define _MACH_PORT_H_
   90 
   91 #ifdef  KERNEL
   92 #include <mach_ipc_compat.h>
   93 #endif  /* KERNEL */
   94 
   95 #include <mach/boolean.h>
   96 #include <mach/machine/vm_types.h>
   97 
   98 
   99 typedef natural_t mach_port_t;
  100 typedef mach_port_t *mach_port_array_t;
  101 
  102 /*
  103  *  MACH_PORT_NULL is a legal value that can be carried in messages.
  104  *  It indicates the absence of any port or port rights.  (A port
  105  *  argument keeps the message from being "simple", even if the
  106  *  value is MACH_PORT_NULL.)  The value MACH_PORT_DEAD is also
  107  *  a legal value that can be carried in messages.  It indicates
  108  *  that a port right was present, but it died.
  109  */
  110 
  111 #define MACH_PORT_NULL          ((mach_port_t) 0)
  112 #define MACH_PORT_DEAD          ((mach_port_t) ~0)
  113 
  114 #define MACH_PORT_VALID(name)   \
  115                 (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD))
  116 
  117 /*
  118  *  These are the different rights a task may have.
  119  *  The MACH_PORT_RIGHT_* definitions are used as arguments
  120  *  to mach_port_allocate, mach_port_get_refs, etc, to specify
  121  *  a particular right to act upon.  The mach_port_names and
  122  *  mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
  123  *  definitions.  This is because a single name may denote
  124  *  multiple rights.
  125  */
  126 
  127 typedef natural_t mach_port_right_t;
  128 
  129 #define MACH_PORT_RIGHT_SEND            ((mach_port_right_t) 0)
  130 #define MACH_PORT_RIGHT_RECEIVE         ((mach_port_right_t) 1)
  131 #define MACH_PORT_RIGHT_SEND_ONCE       ((mach_port_right_t) 2)
  132 #define MACH_PORT_RIGHT_PORT_SET        ((mach_port_right_t) 3)
  133 #define MACH_PORT_RIGHT_DEAD_NAME       ((mach_port_right_t) 4)
  134 #define MACH_PORT_RIGHT_NUMBER          ((mach_port_right_t) 5)
  135 
  136 typedef natural_t mach_port_type_t;
  137 typedef mach_port_type_t *mach_port_type_array_t;
  138 
  139 #define MACH_PORT_TYPE(right)       ((mach_port_type_t)(1 << ((right)+16)))
  140 #define MACH_PORT_TYPE_NONE         ((mach_port_type_t) 0)
  141 #define MACH_PORT_TYPE_SEND         MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
  142 #define MACH_PORT_TYPE_RECEIVE      MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
  143 #define MACH_PORT_TYPE_SEND_ONCE    MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
  144 #define MACH_PORT_TYPE_PORT_SET     MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
  145 #define MACH_PORT_TYPE_DEAD_NAME    MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
  146 
  147 /* Convenient combinations. */
  148 
  149 #define MACH_PORT_TYPE_SEND_RECEIVE                                     \
  150                 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
  151 #define MACH_PORT_TYPE_SEND_RIGHTS                                      \
  152                 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
  153 #define MACH_PORT_TYPE_PORT_RIGHTS                                      \
  154                 (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
  155 #define MACH_PORT_TYPE_PORT_OR_DEAD                                     \
  156                 (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
  157 #define MACH_PORT_TYPE_ALL_RIGHTS                                       \
  158                 (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
  159 
  160 /* Dummy type bits that mach_port_type/mach_port_names can return. */
  161 
  162 #define MACH_PORT_TYPE_DNREQUEST        0x80000000U
  163 #define MACH_PORT_TYPE_MAREQUEST        0x40000000
  164 #define MACH_PORT_TYPE_COMPAT           0x20000000
  165 
  166 /* User-references for capabilities. */
  167 
  168 typedef natural_t mach_port_urefs_t;
  169 typedef integer_t mach_port_delta_t;                    /* change in urefs */
  170 
  171 /* Attributes of ports.  (See mach_port_get_receive_status.) */
  172 
  173 typedef natural_t mach_port_seqno_t;            /* sequence number */
  174 typedef unsigned int mach_port_mscount_t;       /* make-send count */
  175 typedef unsigned int mach_port_msgcount_t;      /* number of msgs */
  176 typedef unsigned int mach_port_rights_t;        /* number of rights */
  177 
  178 typedef struct mach_port_status {
  179         mach_port_t             mps_pset;       /* containing port set */
  180         mach_port_seqno_t       mps_seqno;      /* sequence number */
  181 /*mach_port_mscount_t*/natural_t mps_mscount;   /* make-send count */
  182 /*mach_port_msgcount_t*/natural_t mps_qlimit;   /* queue limit */
  183 /*mach_port_msgcount_t*/natural_t mps_msgcount; /* number in the queue */
  184 /*mach_port_rights_t*/natural_t mps_sorights;   /* how many send-once rights */
  185 /*boolean_t*/natural_t          mps_srights;    /* do send rights exist? */
  186 /*boolean_t*/natural_t          mps_pdrequest;  /* port-deleted requested? */
  187 /*boolean_t*/natural_t          mps_nsrequest;  /* no-senders requested? */
  188 } mach_port_status_t;
  189 
  190 #define MACH_PORT_QLIMIT_DEFAULT        ((mach_port_msgcount_t) 5)
  191 #define MACH_PORT_QLIMIT_MAX            ((mach_port_msgcount_t) 16)
  192 
  193 /*
  194  *  Compatibility definitions, for code written
  195  *  before there was an mps_seqno field.
  196  */
  197 
  198 typedef struct old_mach_port_status {
  199         mach_port_t             mps_pset;       /* containing port set */
  200 /*mach_port_mscount_t*/natural_t mps_mscount;   /* make-send count */
  201 /*mach_port_msgcount_t*/natural_t mps_qlimit;   /* queue limit */
  202 /*mach_port_msgcount_t*/natural_t mps_msgcount; /* number in the queue */
  203 /*mach_port_rights_t*/natural_t mps_sorights;   /* how many send-once rights */
  204 /*boolean_t*/natural_t          mps_srights;    /* do send rights exist? */
  205 /*boolean_t*/natural_t          mps_pdrequest;  /* port-deleted requested? */
  206 /*boolean_t*/natural_t          mps_nsrequest;  /* no-senders requested? */
  207 } old_mach_port_status_t;
  208 
  209 
  210 /* Definitions for the old IPC interface. */
  211 
  212 #if     MACH_IPC_COMPAT
  213 
  214 typedef integer_t       port_name_t;            /* A capability's name */
  215 typedef port_name_t     port_set_name_t;        /* Descriptive alias */
  216 typedef port_name_t     *port_name_array_t;
  217 
  218 typedef integer_t       port_type_t;            /* What kind of capability? */
  219 typedef port_type_t     *port_type_array_t;
  220 
  221         /* Values for port_type_t */
  222 
  223 #define PORT_TYPE_NONE          0               /* No rights */
  224 #define PORT_TYPE_SEND          1               /* Send rights */
  225 #define PORT_TYPE_RECEIVE       3               /* obsolete */
  226 #define PORT_TYPE_OWN           5               /* obsolete */
  227 #define PORT_TYPE_RECEIVE_OWN   7               /* Send, receive, ownership */
  228 #define PORT_TYPE_SET           9               /* Set ownership */
  229 #define PORT_TYPE_LAST          10              /* Last assigned */
  230 
  231 typedef port_name_t     port_t;                 /* Port with send rights */
  232 typedef port_t          port_rcv_t;             /* Port with receive rights */
  233 typedef port_t          port_own_t;             /* Port with ownership rights */
  234 typedef port_t          port_all_t;             /* Port with receive and ownership */
  235 typedef port_t          *port_array_t;
  236 
  237 #define PORT_NULL       ((port_name_t) 0)       /* Used to denote no port; legal value */
  238 
  239 #endif  /* MACH_IPC_COMPAT */
  240 
  241 #endif  /* _MACH_PORT_H_ */

Cache object: f34a1d5a5b38efbad1111a1759d17586


[ 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.