|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: * ! 4: * @APPLE_LICENSE_HEADER_START@ ! 5: * ! 6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: * Reserved. This file contains Original Code and/or Modifications of ! 8: * Original Code as defined in and that are subject to the Apple Public ! 9: * Source License Version 1.1 (the "License"). You may not use this file ! 10: * except in compliance with the License. Please obtain a copy of the ! 11: * License at http://www.apple.com/publicsource and read it before using ! 12: * this file. ! 13: * ! 14: * The Original Code and all software distributed under the License are ! 15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: * License for the specific language governing rights and limitations ! 20: * under the License. ! 21: * ! 22: * @APPLE_LICENSE_HEADER_END@ ! 23: */ ! 24: ! 25: /* ! 26: * Copyright (c) 1995, 1994, 1993, 1992, 1991, 1990 ! 27: * Open Software Foundation, Inc. ! 28: * ! 29: * Permission to use, copy, modify, and distribute this software and ! 30: * its documentation for any purpose and without fee is hereby granted, ! 31: * provided that the above copyright notice appears in all copies and ! 32: * that both the copyright notice and this permission notice appear in ! 33: * supporting documentation, and that the name of ("OSF") or Open Software ! 34: * Foundation not be used in advertising or publicity pertaining to ! 35: * distribution of the software without specific, written prior permission. ! 36: * ! 37: * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE ! 38: * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ! 39: * FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL OSF BE LIABLE FOR ANY ! 40: * SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ! 41: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN ! 42: * ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING ! 43: * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! 44: */ ! 45: /* ! 46: * OSF Research Institute MK6.1 (unencumbered) 1/31/1995 ! 47: */ ! 48: /* ! 49: * Mach Operating System ! 50: * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University ! 51: * All Rights Reserved. ! 52: * ! 53: * Permission to use, copy, modify and distribute this software and its ! 54: * documentation is hereby granted, provided that both the copyright ! 55: * notice and this permission notice appear in all copies of the ! 56: * software, derivative works or modified versions, and any portions ! 57: * thereof, and that both notices appear in supporting documentation. ! 58: * ! 59: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 60: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 61: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 62: * ! 63: * Carnegie Mellon requests users of this software to return to ! 64: * ! 65: * Software Distribution Coordinator or [email protected] ! 66: * School of Computer Science ! 67: * Carnegie Mellon University ! 68: * Pittsburgh PA 15213-3890 ! 69: * ! 70: * any improvements or extensions that they make and grant Carnegie Mellon ! 71: * the rights to redistribute these changes. ! 72: */ ! 73: /* ! 74: * File: mach/port.h ! 75: * ! 76: * Definition of a port ! 77: * ! 78: * [The basic mach_port_t type should probably be machine-dependent, ! 79: * as it must be represented by a 32-bit integer.] ! 80: */ ! 81: ! 82: #ifndef _MACH_PORT_H_ ! 83: #define _MACH_PORT_H_ ! 84: ! 85: #import <mach/boolean.h> ! 86: #import <mach/machine/vm_types.h> ! 87: ! 88: typedef natural_t mach_port_t; ! 89: typedef mach_port_t mach_port_name_t; ! 90: typedef mach_port_t *mach_port_array_t; ! 91: ! 92: /* ! 93: * MACH_PORT_NULL is a legal value that can be carried in messages. ! 94: * It indicates the absence of any port or port rights. (A port ! 95: * argument keeps the message from being "simple", even if the ! 96: * value is MACH_PORT_NULL.) The value MACH_PORT_DEAD is also ! 97: * a legal value that can be carried in messages. It indicates ! 98: * that a port right was present, but it died. ! 99: */ ! 100: ! 101: #define MACH_PORT_NULL ((mach_port_t) 0) ! 102: #define MACH_PORT_DEAD ((mach_port_t) ~0) ! 103: ! 104: #define MACH_PORT_VALID(name) \ ! 105: (((name) != MACH_PORT_NULL) && ((name) != MACH_PORT_DEAD)) ! 106: ! 107: /* ! 108: * These are the different rights a task may have. ! 109: * The MACH_PORT_RIGHT_* definitions are used as arguments ! 110: * to mach_port_allocate, mach_port_get_refs, etc, to specify ! 111: * a particular right to act upon. The mach_port_names and ! 112: * mach_port_type calls return bitmasks using the MACH_PORT_TYPE_* ! 113: * definitions. This is because a single name may denote ! 114: * multiple rights. ! 115: */ ! 116: ! 117: typedef natural_t mach_port_right_t; ! 118: ! 119: #define MACH_PORT_RIGHT_SEND ((mach_port_right_t) 0) ! 120: #define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1) ! 121: #define MACH_PORT_RIGHT_SEND_ONCE ((mach_port_right_t) 2) ! 122: #define MACH_PORT_RIGHT_PORT_SET ((mach_port_right_t) 3) ! 123: #define MACH_PORT_RIGHT_DEAD_NAME ((mach_port_right_t) 4) ! 124: #define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 5) ! 125: ! 126: typedef natural_t mach_port_type_t; ! 127: typedef mach_port_type_t *mach_port_type_array_t; ! 128: ! 129: #define MACH_PORT_TYPE(right) ((mach_port_type_t)(1 << ((right)+16))) ! 130: #define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0) ! 131: #define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND) ! 132: #define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE) ! 133: #define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE) ! 134: #define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET) ! 135: #define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME) ! 136: ! 137: /* Convenient combinations. */ ! 138: ! 139: #define MACH_PORT_TYPE_SEND_RECEIVE \ ! 140: (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE) ! 141: #define MACH_PORT_TYPE_SEND_RIGHTS \ ! 142: (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE) ! 143: #define MACH_PORT_TYPE_PORT_RIGHTS \ ! 144: (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE) ! 145: #define MACH_PORT_TYPE_PORT_OR_DEAD \ ! 146: (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME) ! 147: #define MACH_PORT_TYPE_ALL_RIGHTS \ ! 148: (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET) ! 149: ! 150: /* Dummy type bits that mach_port_type/mach_port_names can return. */ ! 151: ! 152: #define MACH_PORT_TYPE_DNREQUEST 0x80000000U ! 153: #define MACH_PORT_TYPE_MAREQUEST 0x40000000 ! 154: #define MACH_PORT_TYPE_COMPAT 0x20000000 ! 155: ! 156: /* User-references for capabilities. */ ! 157: ! 158: typedef natural_t mach_port_urefs_t; ! 159: typedef integer_t mach_port_delta_t; /* change in urefs */ ! 160: ! 161: /* Attributes of ports. (See mach_port_get_receive_status.) */ ! 162: ! 163: typedef natural_t mach_port_seqno_t; /* sequence number */ ! 164: typedef unsigned int mach_port_mscount_t; /* make-send count */ ! 165: typedef unsigned int mach_port_msgcount_t; /* number of msgs */ ! 166: typedef unsigned int mach_port_rights_t; /* number of rights */ ! 167: ! 168: typedef struct mach_port_status { ! 169: mach_port_t mps_pset; /* containing port set */ ! 170: mach_port_seqno_t mps_seqno; /* sequence number */ ! 171: /*mach_port_mscount_t*/natural_t mps_mscount; /* make-send count */ ! 172: /*mach_port_msgcount_t*/natural_t mps_qlimit; /* queue limit */ ! 173: /*mach_port_msgcount_t*/natural_t mps_msgcount; /* number in the queue */ ! 174: /*mach_port_rights_t*/natural_t mps_sorights; /* how many send-once rights */ ! 175: /*boolean_t*/natural_t mps_srights; /* do send rights exist? */ ! 176: /*boolean_t*/natural_t mps_pdrequest; /* port-deleted requested? */ ! 177: /*boolean_t*/natural_t mps_nsrequest; /* no-senders requested? */ ! 178: } mach_port_status_t; ! 179: ! 180: #define MACH_PORT_QLIMIT_DEFAULT ((mach_port_msgcount_t) 5) ! 181: #define MACH_PORT_QLIMIT_MAX ((mach_port_msgcount_t) 16) ! 182: ! 183: typedef struct mach_port_limits { ! 184: mach_port_msgcount_t mpl_qlimit; /* number of msgs */ ! 185: } mach_port_limits_t; ! 186: ! 187: typedef int *mach_port_info_t; /* varying array of int */ ! 188: ! 189: /* Flavors for mach_port_get/set_attributes() */ ! 190: typedef int mach_port_flavor_t; ! 191: #define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_status_t */ ! 192: #define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_limits_t */ ! 193: #define MACH_PORT_DNREQUESTS_SIZE 3 /* info is int */ ! 194: ! 195: #define MACH_PORT_LIMITS_INFO_COUNT \ ! 196: (sizeof(mach_port_limits_t)/sizeof(int)) ! 197: #define MACH_PORT_RECEIVE_STATUS_COUNT \ ! 198: (sizeof(mach_port_status_t)/sizeof(int)) ! 199: #define MACH_PORT_DNREQUESTS_SIZE_COUNT 1 ! 200: ! 201: /* Definitions for the old IPC interface. */ ! 202: ! 203: typedef integer_t port_name_t; /* A capability's name */ ! 204: typedef port_name_t port_set_name_t; /* Descriptive alias */ ! 205: typedef port_name_t *port_name_array_t; ! 206: ! 207: typedef integer_t port_type_t; /* What kind of capability? */ ! 208: typedef port_type_t *port_type_array_t; ! 209: ! 210: /* Values for port_type_t */ ! 211: ! 212: #define PORT_TYPE_NONE 0 /* No rights */ ! 213: #define PORT_TYPE_SEND 1 /* Send rights */ ! 214: #define PORT_TYPE_RECEIVE 3 /* obsolete */ ! 215: #define PORT_TYPE_OWN 5 /* obsolete */ ! 216: #define PORT_TYPE_RECEIVE_OWN 7 /* Send, receive, ownership */ ! 217: #define PORT_TYPE_SET 9 /* Set ownership */ ! 218: #define PORT_TYPE_LAST 10 /* Last assigned */ ! 219: ! 220: typedef port_name_t port_t; /* Port with send rights */ ! 221: typedef port_t port_rcv_t; /* Port with receive rights */ ! 222: typedef port_t port_own_t; /* Port with ownership rights */ ! 223: typedef port_t port_all_t; /* Port with receive and ownership */ ! 224: typedef port_t *port_array_t; ! 225: ! 226: #define PORT_NULL ((port_name_t) 0) /* Used to denote no port; legal value */ ! 227: ! 228: #define PORT_BACKLOG_DEFAULT MACH_PORT_QLIMIT_DEFAULT ! 229: #define PORT_BACKLOG_MAX MACH_PORT_QLIMIT_MAX ! 230: ! 231: #endif /* _MACH_PORT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.