Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /* * Copyright (c) 1998-2011 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1998 Apple Computer, Inc. All rights reserved. * * HISTORY * */ /* * Internal definitions used between the iokit user library and * server routines. */ #ifndef _IOKIT_IOKITSERVER_H #define _IOKIT_IOKITSERVER_H #include <IOKit/IOTypes.h> #include <IOKit/IOKitKeys.h> #include <IOKit/OSMessageNotification.h> #ifdef __cplusplus extern "C" { #endif #include <mach/kmod.h> #ifdef __cplusplus } #endif // IOCatalogueSendData /*! * @enum IOCatalogueSendData user-client flags. * @constant kIOCatalogAddDrivers Signals a call to the addDrivers function in IOCatalogue. * @constant kIOCatalogAddDriversNoMatch Signals a call to the addDrivers function in IOCatalogue but does not start a matching thread. * @constant kIOCatalogRemoveDrivers Signals a call to the removeDrivers function in IOCatalogue. * @constant kIOCatalogRemoveDriversNoMatch Signals a call to the removedrivers function in IOCatalogue but does not start a matching thread. * @constant kIOCatalogStartMatching Signals the IOCatalogue to start an IOService matching thread. * @constant kIOCatalogRemoveKernelLinker Deprecated; does nothing. * @constant kIOCatalogKextdActive Signals the kernel that kextd is running. * @constant kIOCatalogKextdFinishedLaunching Signals the IOCatalogue that kextd has finished sending it information at startup. * @constant kIOCatalogResetDrivers Resets the IOCatalogue with a new set of personalities. * @constant kIOCatalogResetDriversNoMatch Resets the IOCatalogue with a new set of personalities but does not start a matching thread. */ enum { kIOCatalogAddDrivers = 1, kIOCatalogAddDriversNoMatch, kIOCatalogRemoveDrivers, kIOCatalogRemoveDriversNoMatch, kIOCatalogStartMatching__Removed, kIOCatalogRemoveKernelLinker__Removed, kIOCatalogKextdActive, kIOCatalogKextdFinishedLaunching, kIOCatalogResetDrivers, kIOCatalogResetDriversNoMatch }; // IOCatalogueGetData /*! * @enum IOCatalogueGetData user-client flags * @constant kIOCatalogGetContents Returns a snapshot of the database to the caller. */ enum { kIOCatalogGetContents = 1, kIOCatalogGetModuleDemandList = 2, kIOCatalogGetCacheMissList = 3, kIOCatalogGetROMMkextList = 4 }; // IOCatalogueReset /*! * @enum IOCatalogueReset user-client flag * @constant kIOCatalogResetDefault Removes all entries from IOCatalogue except those used for booting the system. */ enum { kIOCatalogResetDefault = 1 }; // IOCatalogueTerminate /*! * @enum IOCatalogueTerminate user-client flags. * @constant kIOCatalogModuleUnload Terminates all services which depend on a particular module and unloads the module. * @constant kIOCatalogModuleTerminate Terminates all services which depend on a particular module but does not unload the module. * @constant kIOCatalogServiceTerminate Terminates a particular service by name. */ enum { kIOCatalogModuleUnload = 1, kIOCatalogModuleTerminate, kIOCatalogServiceTerminate }; #ifdef XNU_KERNEL_PRIVATE #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <kern/ipc_kobject.h> #if MACH_KERNEL_PRIVATE #include <ipc/ipc_port.h> #endif /* MACH_KERNEL_PRIVATE */ /* * Functions in iokit:IOUserClient.cpp */ #ifdef __cplusplus class IOMachPort; typedef IOMachPort * io_kobject_t; #else typedef struct IOMachPort * io_kobject_t; #endif extern void iokit_add_reference( io_object_t obj ); extern ipc_port_t iokit_port_make_send_for_object( io_object_t obj, ipc_kobject_type_t type ); extern void iokit_ident_no_senders( ipc_port_t port, mach_port_mscount_t mscount ); extern void iokit_object_no_senders( ipc_port_t port, mach_port_mscount_t mscount ); extern void iokit_connect_no_senders( ipc_port_t port, mach_port_mscount_t mscount ); extern void iokit_uext_no_senders( ipc_port_t port, mach_port_mscount_t mscount ); extern kern_return_t iokit_client_memory_for_type( io_object_t connect, unsigned int type, unsigned int * flags, vm_address_t * address, vm_size_t * size ); /* * Re-externs from <ipc/ipc_port.h> and <kern/ipc_kobject.h> for iokit/... * * Note: these are safe because IOKitServer.h is used from osfmk/... * context and will fail to build if they diverge. */ extern mach_port_t ipc_port_make_send_mqueue(mach_port_t) __result_use_check; extern mach_port_t ipc_port_copy_send_mqueue(mach_port_t) __result_use_check; extern void ipc_port_release_send(ipc_port_t port); extern bool ipc_kobject_is_mscount_current_locked(ipc_port_t port, mach_port_mscount_t mscount); extern ipc_kobject_t ipc_kobject_get_locked(ipc_port_t port, ipc_kobject_type_t type); extern void ipc_kobject_enable(ipc_port_t, ipc_kobject_t, ipc_kobject_type_t); extern ipc_kobject_t ipc_kobject_disable(ipc_port_t, ipc_kobject_type_t); extern mach_port_t ipc_kobject_make_send(mach_port_t, ipc_kobject_t, ipc_kobject_type_t) __result_use_check; extern mach_port_t ipc_kobject_copy_send(mach_port_t, ipc_kobject_t, ipc_kobject_type_t) __result_use_check; /* * Functions in osfmk:iokit_rpc.c */ extern void iokit_lock_port(ipc_port_t port); extern void iokit_unlock_port(ipc_port_t port); extern ipc_port_t iokit_alloc_object_port( io_kobject_t obj, ipc_kobject_type_t type ); extern void iokit_destroy_object_port( ipc_port_t port, ipc_kobject_type_t type ); extern ipc_kobject_type_t iokit_port_type(ipc_port_t port); extern mach_port_name_t iokit_make_send_right( task_t task, io_object_t obj, ipc_kobject_type_t type ); extern io_object_t iokit_lookup_io_object(ipc_port_t port, ipc_kobject_type_t type); extern kern_return_t iokit_mod_send_right( task_t task, mach_port_name_t name, mach_port_delta_t delta ); extern io_object_t iokit_lookup_object_with_port_name(mach_port_name_t name, ipc_kobject_type_t type, task_t task); extern io_object_t iokit_lookup_connect_ref_current_task(mach_port_name_t name); extern io_object_t iokit_lookup_uext_ref_current_task(mach_port_name_t name); extern void iokit_release_port_send( ipc_port_t port ); extern kern_return_t iokit_lookup_raw_current_task(mach_port_name_t name, ipc_kobject_type_t type, ipc_port_t *port); #ifndef MACH_KERNEL_PRIVATE typedef struct ipc_kmsg * ipc_kmsg_t; extern ipc_kmsg_t ipc_kmsg_alloc_uext_reply(size_t); extern mach_msg_header_t * ikm_header(ipc_kmsg_t); extern void * ikm_udata_from_header( ipc_kmsg_t kmsg); #endif /* MACH_KERNEL_PRIVATE */ extern kern_return_t uext_server(ipc_port_t receiver, ipc_kmsg_t request, ipc_kmsg_t * preply); extern kern_return_t iokit_label_dext_task(task_t task); extern void iokit_clear_registered_ports(task_t task); /* * Functions imported by iokit:IOMemoryDescriptor.cpp */ extern ppnum_t IOGetLastPageNumber(void); extern kern_return_t IOMapPages(vm_map_t map, mach_vm_address_t va, mach_vm_address_t pa, mach_vm_size_t length, unsigned int mapFlags); extern kern_return_t IOUnmapPages(vm_map_t map, mach_vm_address_t va, mach_vm_size_t length); extern kern_return_t IOProtectCacheMode(vm_map_t map, mach_vm_address_t va, mach_vm_size_t length, unsigned int options); extern unsigned int IODefaultCacheBits(addr64_t pa); #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* MACH_KERNEL_PRIVATE */ #endif /* ! _IOKIT_IOKITSERVER_H */ |