1/* 2 * Copyright (c) 2000-2010 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28/* 29 * @OSF_COPYRIGHT@ 30 */ 31/* 32 * Mach Operating System 33 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University 34 * All Rights Reserved. 35 * 36 * Permission to use, copy, modify and distribute this software and its 37 * documentation is hereby granted, provided that both the copyright 38 * notice and this permission notice appear in all copies of the 39 * software, derivative works or modified versions, and any portions 40 * thereof, and that both notices appear in supporting documentation. 41 * 42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 45 * 46 * Carnegie Mellon requests users of this software to return to 47 * 48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 49 * School of Computer Science 50 * Carnegie Mellon University 51 * Pittsburgh PA 15213-3890 52 * 53 * any improvements or extensions that they make and grant Carnegie Mellon 54 * the rights to redistribute these changes. 55 */ 56/* 57 */ 58/* 59 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce 60 * support for mandatory and extensible security protections. This notice 61 * is included in support of clause 2.2 (b) of the Apple Public License, 62 * Version 2.0. 63 */ 64/* 65 * File: mach/mach_types.h 66 * Author: Avadis Tevanian, Jr., Michael Wayne Young 67 * Date: 1986 68 * 69 * Mach external interface definitions. 70 * 71 */ 72 73#ifndef _MACH_MACH_TYPES_H_ 74#define _MACH_MACH_TYPES_H_ 75 76#include <stdint.h> 77 78#include <sys/cdefs.h> 79 80#include <mach/host_info.h> 81#include <mach/host_notify.h> 82#include <mach/host_special_ports.h> 83#include <mach/machine.h> 84#include <mach/machine/vm_types.h> 85#include <mach/memory_object_types.h> 86#include <mach/message.h> 87#include <mach/exception_types.h> 88#include <mach/port.h> 89#include <mach/processor_info.h> 90#include <mach/task_info.h> 91#include <mach/task_policy.h> 92#include <mach/task_special_ports.h> 93#include <mach/thread_info.h> 94#include <mach/thread_policy.h> 95#include <mach/thread_special_ports.h> 96#include <mach/thread_status.h> 97#include <mach/time_value.h> 98#include <mach/clock_types.h> 99#include <mach/vm_attributes.h> 100#include <mach/vm_inherit.h> 101#include <mach/vm_purgable.h> 102#include <mach/vm_behavior.h> 103#include <mach/vm_prot.h> 104#include <mach/vm_statistics.h> 105#include <mach/vm_sync.h> 106#include <mach/vm_types.h> 107#include <mach/vm_region.h> 108#include <mach/kmod.h> 109 110#ifdef KERNEL 111 112#include <mach/vm_param.h> 113 114/* 115 * If we are in the kernel, then pick up the kernel definitions for 116 * the basic mach types. 117 */ 118typedef struct task *task_t, *task_name_t; 119typedef struct thread *thread_t, *thread_act_t; 120typedef struct ipc_space *ipc_space_t; 121typedef struct host *host_t; 122typedef struct host *host_priv_t; 123typedef struct host *host_security_t; 124typedef struct processor *processor_t; 125typedef struct processor_set *processor_set_t; 126typedef struct processor_set *processor_set_control_t; 127typedef struct semaphore *semaphore_t; 128typedef struct lock_set *lock_set_t; 129typedef struct ledger *ledger_t; 130typedef struct alarm *alarm_t; 131typedef struct clock *clock_serv_t; 132typedef struct clock *clock_ctrl_t; 133 134#ifndef MACH_KERNEL_PRIVATE 135 136__BEGIN_DECLS 137 138struct task ; 139struct thread ; 140struct host ; 141struct processor ; 142struct processor_set ; 143struct semaphore ; 144struct lock_set ; 145struct ledger ; 146struct alarm ; 147struct clock ; 148 149__END_DECLS 150 151#endif /* MACH_KERNEL_PRIVATE */ 152 153#else /* KERNEL */ 154 155/* 156 * If we are not in the kernel, then these will all be represented by 157 * ports at user-space. 158 */ 159typedef mach_port_t task_t; 160typedef mach_port_t task_name_t; 161typedef mach_port_t thread_t; 162typedef mach_port_t thread_act_t; 163typedef mach_port_t ipc_space_t; 164typedef mach_port_t host_t; 165typedef mach_port_t host_priv_t; 166typedef mach_port_t host_security_t; 167typedef mach_port_t processor_t; 168typedef mach_port_t processor_set_t; 169typedef mach_port_t processor_set_control_t; 170typedef mach_port_t semaphore_t; 171typedef mach_port_t lock_set_t; 172typedef mach_port_t ledger_t; 173typedef mach_port_t alarm_t; 174typedef mach_port_t clock_serv_t; 175typedef mach_port_t clock_ctrl_t; 176 177#endif /* KERNEL */ 178 179/* 180 * These aren't really unique types. They are just called 181 * out as unique types at one point in history. So we list 182 * them here for compatibility. 183 */ 184typedef processor_set_t processor_set_name_t; 185 186/* 187 * These types are just hard-coded as ports 188 */ 189typedef mach_port_t clock_reply_t; 190typedef mach_port_t bootstrap_t; 191typedef mach_port_t mem_entry_name_port_t; 192typedef mach_port_t exception_handler_t; 193typedef exception_handler_t *exception_handler_array_t; 194typedef mach_port_t vm_task_entry_t; 195typedef mach_port_t io_master_t; 196typedef mach_port_t UNDServerRef; 197 198/* 199 * Mig doesn't translate the components of an array. 200 * For example, Mig won't use the thread_t translations 201 * to translate a thread_array_t argument. So, these definitions 202 * are not completely accurate at the moment for other kernel 203 * components. 204 */ 205typedef task_t *task_array_t; 206typedef thread_t *thread_array_t; 207typedef processor_set_t *processor_set_array_t; 208typedef processor_set_t *processor_set_name_array_t; 209typedef processor_t *processor_array_t; 210typedef thread_act_t *thread_act_array_t; 211typedef ledger_t *ledger_array_t; 212 213/* 214 * However the real mach_types got declared, we also have to declare 215 * types with "port" in the name for compatability with the way OSF 216 * had declared the user interfaces at one point. Someday these should 217 * go away. 218 */ 219typedef task_t task_port_t; 220typedef task_array_t task_port_array_t; 221typedef thread_t thread_port_t; 222typedef thread_array_t thread_port_array_t; 223typedef ipc_space_t ipc_space_port_t; 224typedef host_t host_name_t; 225typedef host_t host_name_port_t; 226typedef processor_set_t processor_set_port_t; 227typedef processor_set_t processor_set_name_port_t; 228typedef processor_set_array_t processor_set_name_port_array_t; 229typedef processor_set_t processor_set_control_port_t; 230typedef processor_t processor_port_t; 231typedef processor_array_t processor_port_array_t; 232typedef thread_act_t thread_act_port_t; 233typedef thread_act_array_t thread_act_port_array_t; 234typedef semaphore_t semaphore_port_t; 235typedef lock_set_t lock_set_port_t; 236typedef ledger_t ledger_port_t; 237typedef ledger_array_t ledger_port_array_t; 238typedef alarm_t alarm_port_t; 239typedef clock_serv_t clock_serv_port_t; 240typedef clock_ctrl_t clock_ctrl_port_t; 241typedef exception_handler_t exception_port_t; 242typedef exception_handler_array_t exception_port_arrary_t; 243 244 245#define TASK_NULL ((task_t) 0) 246#define TASK_NAME_NULL ((task_name_t) 0) 247#define THREAD_NULL ((thread_t) 0) 248#define TID_NULL ((uint64_t) 0) 249#define THR_ACT_NULL ((thread_act_t) 0) 250#define IPC_SPACE_NULL ((ipc_space_t) 0) 251#define HOST_NULL ((host_t) 0) 252#define HOST_PRIV_NULL ((host_priv_t)0) 253#define HOST_SECURITY_NULL ((host_security_t)0) 254#define PROCESSOR_SET_NULL ((processor_set_t) 0) 255#define PROCESSOR_NULL ((processor_t) 0) 256#define SEMAPHORE_NULL ((semaphore_t) 0) 257#define LOCK_SET_NULL ((lock_set_t) 0) 258#define LEDGER_NULL ((ledger_t) 0) 259#define ALARM_NULL ((alarm_t) 0) 260#define CLOCK_NULL ((clock_t) 0) 261#define UND_SERVER_NULL ((UNDServerRef) 0) 262 263/* DEPRECATED */ 264typedef natural_t ledger_item_t; 265#define LEDGER_ITEM_INFINITY ((ledger_item_t) (~0)) 266 267typedef int64_t ledger_amount_t; 268#define LEDGER_LIMIT_INFINITY ((ledger_amount_t)(((uint64_t)1 << 63) - 1)) 269 270typedef mach_vm_offset_t *emulation_vector_t; 271typedef char *user_subsystem_t; 272 273typedef char *labelstr_t; 274/* 275 * Backwards compatibility, for those programs written 276 * before mach/{std,mach}_types.{defs,h} were set up. 277 */ 278#include <mach/std_types.h> 279 280#endif /* _MACH_MACH_TYPES_H_ */ 281