| 1 | /* |
| 2 | * Copyright (c) 2000-2007, 2015 Apple 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,1987 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 | * Machine-independent task information structures and definitions. |
| 58 | * |
| 59 | * The definitions in this file are exported to the user. The kernel |
| 60 | * will translate its internal data structures to these structures |
| 61 | * as appropriate. |
| 62 | * |
| 63 | */ |
| 64 | |
| 65 | #ifndef _MACH_TASK_INFO_H_ |
| 66 | #define _MACH_TASK_INFO_H_ |
| 67 | |
| 68 | #include <mach/message.h> |
| 69 | #include <mach/machine/vm_types.h> |
| 70 | #include <mach/time_value.h> |
| 71 | #include <mach/policy.h> |
| 72 | #include <mach/vm_statistics.h> /* for vm_extmod_statistics_data_t */ |
| 73 | #include <Availability.h> |
| 74 | |
| 75 | #include <sys/cdefs.h> |
| 76 | |
| 77 | /* |
| 78 | * Generic information structure to allow for expansion. |
| 79 | */ |
| 80 | typedef natural_t task_flavor_t; |
| 81 | typedef integer_t *task_info_t; /* varying array of int */ |
| 82 | |
| 83 | /* Deprecated, use per structure _data_t's instead */ |
| 84 | #define TASK_INFO_MAX (1024) /* maximum array size */ |
| 85 | typedef integer_t task_info_data_t[TASK_INFO_MAX]; |
| 86 | |
| 87 | /* |
| 88 | * Currently defined information structures. |
| 89 | */ |
| 90 | |
| 91 | #pragma pack(push, 4) |
| 92 | |
| 93 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
| 94 | #define TASK_BASIC_INFO_32 4 /* basic information */ |
| 95 | #define TASK_BASIC2_INFO_32 6 |
| 96 | |
| 97 | struct task_basic_info_32 { |
| 98 | integer_t suspend_count; /* suspend count for task */ |
| 99 | natural_t virtual_size; /* virtual memory size (bytes) */ |
| 100 | natural_t resident_size; /* resident memory size (bytes) */ |
| 101 | time_value_t user_time; /* total user run time for |
| 102 | * terminated threads */ |
| 103 | time_value_t system_time; /* total system run time for |
| 104 | * terminated threads */ |
| 105 | policy_t policy; /* default policy for new threads */ |
| 106 | }; |
| 107 | typedef struct task_basic_info_32 task_basic_info_32_data_t; |
| 108 | typedef struct task_basic_info_32 *task_basic_info_32_t; |
| 109 | #define TASK_BASIC_INFO_32_COUNT \ |
| 110 | (sizeof(task_basic_info_32_data_t) / sizeof(natural_t)) |
| 111 | |
| 112 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
| 113 | struct task_basic_info_64 { |
| 114 | integer_t suspend_count; /* suspend count for task */ |
| 115 | #if defined(__arm__) || defined(__arm64__) |
| 116 | #if defined(KERNEL) |
| 117 | /* Compatibility with old 32-bit mach_vm_size_t */ |
| 118 | natural_t virtual_size; /* virtual memory size (bytes) */ |
| 119 | natural_t resident_size; /* resident memory size (bytes) */ |
| 120 | #else |
| 121 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 122 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ |
| 123 | #endif |
| 124 | #else /* defined(__arm__) || defined(__arm64__) */ |
| 125 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 126 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ |
| 127 | #endif /* defined(__arm__) || defined(__arm64__) */ |
| 128 | time_value_t user_time; /* total user run time for |
| 129 | * terminated threads */ |
| 130 | time_value_t system_time; /* total system run time for |
| 131 | * terminated threads */ |
| 132 | policy_t policy; /* default policy for new threads */ |
| 133 | }; |
| 134 | typedef struct task_basic_info_64 task_basic_info_64_data_t; |
| 135 | typedef struct task_basic_info_64 *task_basic_info_64_t; |
| 136 | |
| 137 | #if defined(__arm__) || defined(__arm64__) |
| 138 | #if defined(KERNEL) |
| 139 | /* |
| 140 | * Backwards-compatibility for old mach_vm*_t types. |
| 141 | * The kernel knows about old and new, and if you are compiled |
| 142 | * to run on an earlier iOS version, you interact with the old |
| 143 | * (narrow) version. If you are compiled for a newer OS |
| 144 | * version, however, you are mapped to the wide version. |
| 145 | */ |
| 146 | |
| 147 | #define TASK_BASIC_INFO_64 5 |
| 148 | #define TASK_BASIC_INFO_64_COUNT \ |
| 149 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t)) |
| 150 | |
| 151 | #elif defined(__arm__) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0) |
| 152 | /* |
| 153 | * Note: arm64 can't use the old flavor. If you somehow manage to, |
| 154 | * you can cope with the nonsense data yourself. |
| 155 | */ |
| 156 | #define TASK_BASIC_INFO_64 5 |
| 157 | #define TASK_BASIC_INFO_64_COUNT \ |
| 158 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t)) |
| 159 | |
| 160 | #else |
| 161 | |
| 162 | #define TASK_BASIC_INFO_64 TASK_BASIC_INFO_64_2 |
| 163 | #define TASK_BASIC_INFO_64_COUNT TASK_BASIC_INFO_64_2_COUNT |
| 164 | #endif |
| 165 | #else /* defined(__arm__) || defined(__arm64__) */ |
| 166 | #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */ |
| 167 | #define TASK_BASIC_INFO_64_COUNT \ |
| 168 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t)) |
| 169 | #endif |
| 170 | |
| 171 | |
| 172 | /* localized structure - cannot be safely passed between tasks of differing sizes */ |
| 173 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
| 174 | struct task_basic_info { |
| 175 | integer_t suspend_count; /* suspend count for task */ |
| 176 | vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 177 | vm_size_t resident_size; /* resident memory size (bytes) */ |
| 178 | time_value_t user_time; /* total user run time for |
| 179 | * terminated threads */ |
| 180 | time_value_t system_time; /* total system run time for |
| 181 | * terminated threads */ |
| 182 | policy_t policy; /* default policy for new threads */ |
| 183 | }; |
| 184 | |
| 185 | typedef struct task_basic_info task_basic_info_data_t; |
| 186 | typedef struct task_basic_info *task_basic_info_t; |
| 187 | #define TASK_BASIC_INFO_COUNT \ |
| 188 | (sizeof(task_basic_info_data_t) / sizeof(natural_t)) |
| 189 | #if !defined(__LP64__) |
| 190 | #define TASK_BASIC_INFO TASK_BASIC_INFO_32 |
| 191 | #else |
| 192 | #define TASK_BASIC_INFO TASK_BASIC_INFO_64 |
| 193 | #endif |
| 194 | |
| 195 | |
| 196 | |
| 197 | #define TASK_EVENTS_INFO 2 /* various event counts */ |
| 198 | |
| 199 | struct task_events_info { |
| 200 | integer_t faults; /* number of page faults */ |
| 201 | integer_t pageins; /* number of actual pageins */ |
| 202 | integer_t cow_faults; /* number of copy-on-write faults */ |
| 203 | integer_t messages_sent; /* number of messages sent */ |
| 204 | integer_t messages_received; /* number of messages received */ |
| 205 | integer_t syscalls_mach; /* number of mach system calls */ |
| 206 | integer_t syscalls_unix; /* number of unix system calls */ |
| 207 | integer_t csw; /* number of context switches */ |
| 208 | }; |
| 209 | typedef struct task_events_info task_events_info_data_t; |
| 210 | typedef struct task_events_info *task_events_info_t; |
| 211 | #define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \ |
| 212 | (sizeof(task_events_info_data_t) / sizeof(natural_t))) |
| 213 | |
| 214 | #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads - |
| 215 | * only accurate if suspended */ |
| 216 | |
| 217 | struct task_thread_times_info { |
| 218 | time_value_t user_time; /* total user run time for |
| 219 | * live threads */ |
| 220 | time_value_t system_time; /* total system run time for |
| 221 | * live threads */ |
| 222 | }; |
| 223 | |
| 224 | typedef struct task_thread_times_info task_thread_times_info_data_t; |
| 225 | typedef struct task_thread_times_info *task_thread_times_info_t; |
| 226 | #define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \ |
| 227 | (sizeof(task_thread_times_info_data_t) / sizeof(natural_t))) |
| 228 | |
| 229 | #define TASK_ABSOLUTETIME_INFO 1 |
| 230 | |
| 231 | struct task_absolutetime_info { |
| 232 | uint64_t total_user; |
| 233 | uint64_t total_system; |
| 234 | uint64_t threads_user; /* existing threads only */ |
| 235 | uint64_t threads_system; |
| 236 | }; |
| 237 | |
| 238 | typedef struct task_absolutetime_info task_absolutetime_info_data_t; |
| 239 | typedef struct task_absolutetime_info *task_absolutetime_info_t; |
| 240 | #define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \ |
| 241 | (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t))) |
| 242 | |
| 243 | #define TASK_KERNELMEMORY_INFO 7 |
| 244 | |
| 245 | struct task_kernelmemory_info { |
| 246 | uint64_t total_palloc; /* private kernel mem alloc'ed */ |
| 247 | uint64_t total_pfree; /* private kernel mem freed */ |
| 248 | uint64_t total_salloc; /* shared kernel mem alloc'ed */ |
| 249 | uint64_t total_sfree; /* shared kernel mem freed */ |
| 250 | }; |
| 251 | |
| 252 | typedef struct task_kernelmemory_info task_kernelmemory_info_data_t; |
| 253 | typedef struct task_kernelmemory_info *task_kernelmemory_info_t; |
| 254 | #define TASK_KERNELMEMORY_INFO_COUNT ((mach_msg_type_number_t) \ |
| 255 | (sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t))) |
| 256 | |
| 257 | #define TASK_SECURITY_TOKEN 13 |
| 258 | #define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \ |
| 259 | (sizeof(security_token_t) / sizeof(natural_t))) |
| 260 | |
| 261 | #define TASK_AUDIT_TOKEN 15 |
| 262 | #define TASK_AUDIT_TOKEN_COUNT \ |
| 263 | (sizeof(audit_token_t) / sizeof(natural_t)) |
| 264 | |
| 265 | |
| 266 | #define TASK_AFFINITY_TAG_INFO 16 /* This is experimental. */ |
| 267 | |
| 268 | struct task_affinity_tag_info { |
| 269 | integer_t set_count; |
| 270 | integer_t min; |
| 271 | integer_t max; |
| 272 | integer_t task_count; |
| 273 | }; |
| 274 | typedef struct task_affinity_tag_info task_affinity_tag_info_data_t; |
| 275 | typedef struct task_affinity_tag_info *task_affinity_tag_info_t; |
| 276 | #define TASK_AFFINITY_TAG_INFO_COUNT \ |
| 277 | (sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t)) |
| 278 | |
| 279 | #define TASK_DYLD_INFO 17 |
| 280 | |
| 281 | struct task_dyld_info { |
| 282 | mach_vm_address_t all_image_info_addr; |
| 283 | mach_vm_size_t all_image_info_size; |
| 284 | integer_t all_image_info_format; |
| 285 | }; |
| 286 | typedef struct task_dyld_info task_dyld_info_data_t; |
| 287 | typedef struct task_dyld_info *task_dyld_info_t; |
| 288 | #define TASK_DYLD_INFO_COUNT \ |
| 289 | (sizeof(task_dyld_info_data_t) / sizeof(natural_t)) |
| 290 | #define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */ |
| 291 | #define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */ |
| 292 | |
| 293 | #if defined(__arm__) || defined(__arm64__) |
| 294 | |
| 295 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
| 296 | /* Compatibility for old 32-bit mach_vm_*_t */ |
| 297 | #define TASK_BASIC_INFO_64_2 18 /* 64-bit capable basic info */ |
| 298 | |
| 299 | struct task_basic_info_64_2 { |
| 300 | integer_t suspend_count; /* suspend count for task */ |
| 301 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 302 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ |
| 303 | time_value_t user_time; /* total user run time for |
| 304 | * terminated threads */ |
| 305 | time_value_t system_time; /* total system run time for |
| 306 | * terminated threads */ |
| 307 | policy_t policy; /* default policy for new threads */ |
| 308 | }; |
| 309 | typedef struct task_basic_info_64_2 task_basic_info_64_2_data_t; |
| 310 | typedef struct task_basic_info_64_2 *task_basic_info_64_2_t; |
| 311 | #define TASK_BASIC_INFO_64_2_COUNT \ |
| 312 | (sizeof(task_basic_info_64_2_data_t) / sizeof(natural_t)) |
| 313 | #endif |
| 314 | |
| 315 | #define TASK_EXTMOD_INFO 19 |
| 316 | |
| 317 | struct task_extmod_info { |
| 318 | unsigned char task_uuid[16]; |
| 319 | vm_extmod_statistics_data_t extmod_statistics; |
| 320 | }; |
| 321 | typedef struct task_extmod_info task_extmod_info_data_t; |
| 322 | typedef struct task_extmod_info *task_extmod_info_t; |
| 323 | #define TASK_EXTMOD_INFO_COUNT \ |
| 324 | (sizeof(task_extmod_info_data_t) / sizeof(natural_t)) |
| 325 | |
| 326 | |
| 327 | #define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */ |
| 328 | struct mach_task_basic_info { |
| 329 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 330 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ |
| 331 | mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */ |
| 332 | time_value_t user_time; /* total user run time for |
| 333 | * terminated threads */ |
| 334 | time_value_t system_time; /* total system run time for |
| 335 | * terminated threads */ |
| 336 | policy_t policy; /* default policy for new threads */ |
| 337 | integer_t suspend_count; /* suspend count for task */ |
| 338 | }; |
| 339 | typedef struct mach_task_basic_info mach_task_basic_info_data_t; |
| 340 | typedef struct mach_task_basic_info *mach_task_basic_info_t; |
| 341 | #define MACH_TASK_BASIC_INFO_COUNT \ |
| 342 | (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t)) |
| 343 | |
| 344 | |
| 345 | #define TASK_POWER_INFO 21 |
| 346 | |
| 347 | struct task_power_info { |
| 348 | uint64_t total_user; |
| 349 | uint64_t total_system; |
| 350 | uint64_t task_interrupt_wakeups; |
| 351 | uint64_t task_platform_idle_wakeups; |
| 352 | uint64_t task_timer_wakeups_bin_1; |
| 353 | uint64_t task_timer_wakeups_bin_2; |
| 354 | }; |
| 355 | |
| 356 | typedef struct task_power_info task_power_info_data_t; |
| 357 | typedef struct task_power_info *task_power_info_t; |
| 358 | #define TASK_POWER_INFO_COUNT ((mach_msg_type_number_t) \ |
| 359 | (sizeof (task_power_info_data_t) / sizeof (natural_t))) |
| 360 | |
| 361 | |
| 362 | |
| 363 | #define TASK_VM_INFO 22 |
| 364 | #define TASK_VM_INFO_PURGEABLE 23 |
| 365 | struct task_vm_info { |
| 366 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ |
| 367 | integer_t region_count; /* number of memory regions */ |
| 368 | integer_t page_size; |
| 369 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ |
| 370 | mach_vm_size_t resident_size_peak; /* peak resident size (bytes) */ |
| 371 | |
| 372 | mach_vm_size_t device; |
| 373 | mach_vm_size_t device_peak; |
| 374 | mach_vm_size_t internal; |
| 375 | mach_vm_size_t internal_peak; |
| 376 | mach_vm_size_t external; |
| 377 | mach_vm_size_t external_peak; |
| 378 | mach_vm_size_t reusable; |
| 379 | mach_vm_size_t reusable_peak; |
| 380 | mach_vm_size_t purgeable_volatile_pmap; |
| 381 | mach_vm_size_t purgeable_volatile_resident; |
| 382 | mach_vm_size_t purgeable_volatile_virtual; |
| 383 | mach_vm_size_t compressed; |
| 384 | mach_vm_size_t compressed_peak; |
| 385 | mach_vm_size_t compressed_lifetime; |
| 386 | |
| 387 | /* added for rev1 */ |
| 388 | mach_vm_size_t ; |
| 389 | |
| 390 | /* added for rev2 */ |
| 391 | mach_vm_address_t min_address; |
| 392 | mach_vm_address_t max_address; |
| 393 | |
| 394 | /* added for rev3 */ |
| 395 | int64_t ; |
| 396 | int64_t ledger_purgeable_nonvolatile; |
| 397 | int64_t ledger_purgeable_novolatile_compressed; |
| 398 | int64_t ledger_purgeable_volatile; |
| 399 | int64_t ledger_purgeable_volatile_compressed; |
| 400 | int64_t ledger_tag_network_nonvolatile; |
| 401 | int64_t ledger_tag_network_nonvolatile_compressed; |
| 402 | int64_t ledger_tag_network_volatile; |
| 403 | int64_t ledger_tag_network_volatile_compressed; |
| 404 | int64_t ; |
| 405 | int64_t ; |
| 406 | int64_t ; |
| 407 | int64_t ; |
| 408 | int64_t ; |
| 409 | int64_t ; |
| 410 | int64_t ; |
| 411 | int64_t ; |
| 412 | int64_t ; |
| 413 | int64_t ; |
| 414 | int64_t ; |
| 415 | int64_t ; |
| 416 | |
| 417 | /* added for rev4 */ |
| 418 | uint64_t limit_bytes_remaining; |
| 419 | |
| 420 | /* added for rev5 */ |
| 421 | integer_t decompressions; |
| 422 | |
| 423 | /* added for rev6 */ |
| 424 | int64_t ledger_swapins; |
| 425 | }; |
| 426 | typedef struct task_vm_info task_vm_info_data_t; |
| 427 | typedef struct task_vm_info *task_vm_info_t; |
| 428 | #define TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \ |
| 429 | (sizeof (task_vm_info_data_t) / sizeof (natural_t))) |
| 430 | #define TASK_VM_INFO_REV6_COUNT TASK_VM_INFO_COUNT |
| 431 | #define TASK_VM_INFO_REV5_COUNT /* doesn't include ledger swapins */ \ |
| 432 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV6_COUNT - 2)) |
| 433 | #define TASK_VM_INFO_REV4_COUNT /* doesn't include decompressions */ \ |
| 434 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV5_COUNT - 1)) |
| 435 | #define TASK_VM_INFO_REV3_COUNT /* doesn't include limit bytes */ \ |
| 436 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV4_COUNT - 2)) |
| 437 | #define TASK_VM_INFO_REV2_COUNT /* doesn't include extra ledgers info */ \ |
| 438 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV3_COUNT - 42)) |
| 439 | #define TASK_VM_INFO_REV1_COUNT /* doesn't include min and max address */ \ |
| 440 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV2_COUNT - 4)) |
| 441 | #define TASK_VM_INFO_REV0_COUNT /* doesn't include phys_footprint */ \ |
| 442 | ((mach_msg_type_number_t) (TASK_VM_INFO_REV1_COUNT - 2)) |
| 443 | |
| 444 | typedef struct vm_purgeable_info task_purgable_info_t; |
| 445 | |
| 446 | |
| 447 | #define TASK_TRACE_MEMORY_INFO 24 /* no longer supported */ |
| 448 | struct task_trace_memory_info { |
| 449 | uint64_t user_memory_address; /* address of start of trace memory buffer */ |
| 450 | uint64_t buffer_size; /* size of buffer in bytes */ |
| 451 | uint64_t mailbox_array_size; /* size of mailbox area in bytes */ |
| 452 | }; |
| 453 | typedef struct task_trace_memory_info task_trace_memory_info_data_t; |
| 454 | typedef struct task_trace_memory_info * task_trace_memory_info_t; |
| 455 | #define TASK_TRACE_MEMORY_INFO_COUNT ((mach_msg_type_number_t) \ |
| 456 | (sizeof(task_trace_memory_info_data_t) / sizeof(natural_t))) |
| 457 | |
| 458 | #define TASK_WAIT_STATE_INFO 25 /* deprecated. */ |
| 459 | struct task_wait_state_info { |
| 460 | uint64_t total_wait_state_time; /* Time that all threads past and present have been in a wait state */ |
| 461 | uint64_t total_wait_sfi_state_time; /* Time that threads have been in SFI wait (should be a subset of total wait state time */ |
| 462 | uint32_t _reserved[4]; |
| 463 | }; |
| 464 | typedef struct task_wait_state_info task_wait_state_info_data_t; |
| 465 | typedef struct task_wait_state_info * task_wait_state_info_t; |
| 466 | #define TASK_WAIT_STATE_INFO_COUNT ((mach_msg_type_number_t) \ |
| 467 | (sizeof(task_wait_state_info_data_t) / sizeof(natural_t))) |
| 468 | |
| 469 | #define TASK_POWER_INFO_V2 26 |
| 470 | |
| 471 | typedef struct { |
| 472 | uint64_t task_gpu_utilisation; |
| 473 | uint64_t task_gpu_stat_reserved0; |
| 474 | uint64_t task_gpu_stat_reserved1; |
| 475 | uint64_t task_gpu_stat_reserved2; |
| 476 | } gpu_energy_data; |
| 477 | |
| 478 | typedef gpu_energy_data *gpu_energy_data_t; |
| 479 | struct task_power_info_v2 { |
| 480 | task_power_info_data_t cpu_energy; |
| 481 | gpu_energy_data gpu_energy; |
| 482 | #if defined(__arm__) || defined(__arm64__) |
| 483 | uint64_t task_energy; |
| 484 | #endif /* defined(__arm__) || defined(__arm64__) */ |
| 485 | uint64_t task_ptime; |
| 486 | uint64_t task_pset_switches; |
| 487 | }; |
| 488 | |
| 489 | typedef struct task_power_info_v2 task_power_info_v2_data_t; |
| 490 | typedef struct task_power_info_v2 *task_power_info_v2_t; |
| 491 | #define TASK_POWER_INFO_V2_COUNT_OLD \ |
| 492 | ((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) - sizeof(uint64_t)*2) / sizeof (natural_t)) |
| 493 | #define TASK_POWER_INFO_V2_COUNT \ |
| 494 | ((mach_msg_type_number_t) (sizeof (task_power_info_v2_data_t) / sizeof (natural_t))) |
| 495 | |
| 496 | #define TASK_VM_INFO_PURGEABLE_ACCOUNT 27 /* Used for xnu purgeable vm unit tests */ |
| 497 | |
| 498 | #ifdef PRIVATE |
| 499 | struct pvm_account_info { |
| 500 | uint64_t pvm_volatile_count; /* Number of volatile bytes associated with a task */ |
| 501 | uint64_t pvm_volatile_compressed_count; /* Number of volatile compressed bytes associated with a task */ |
| 502 | uint64_t pvm_nonvolatile_count; /* Number of nonvolatile bytes associated with a task */ |
| 503 | uint64_t pvm_nonvolatile_compressed_count; /* Number of nonvolatile compressed bytes associated with a task */ |
| 504 | }; |
| 505 | |
| 506 | typedef struct pvm_account_info *pvm_account_info_t; |
| 507 | typedef struct pvm_account_info pvm_account_info_data_t; |
| 508 | |
| 509 | #define PVM_ACCOUNT_INFO_COUNT ((mach_msg_type_number_t) \ |
| 510 | (sizeof (pvm_account_info_data_t) / sizeof (natural_t))) |
| 511 | #endif /* PRIVATE */ |
| 512 | |
| 513 | #define TASK_FLAGS_INFO 28 /* return t_flags field */ |
| 514 | struct task_flags_info { |
| 515 | uint32_t flags; /* task flags */ |
| 516 | }; |
| 517 | typedef struct task_flags_info task_flags_info_data_t; |
| 518 | typedef struct task_flags_info * task_flags_info_t; |
| 519 | #define TASK_FLAGS_INFO_COUNT ((mach_msg_type_number_t) \ |
| 520 | (sizeof(task_flags_info_data_t) / sizeof (natural_t))) |
| 521 | |
| 522 | #define TF_LP64 0x00000001 /* task has 64-bit addressing */ |
| 523 | #define TF_64B_DATA 0x00000002 /* task has 64-bit data registers */ |
| 524 | |
| 525 | #define TASK_DEBUG_INFO_INTERNAL 29 /* Used for kernel internal development tests. */ |
| 526 | |
| 527 | #ifdef PRIVATE |
| 528 | struct task_debug_info_internal { |
| 529 | integer_t suspend_count; |
| 530 | uint64_t ipc_space_size; |
| 531 | }; |
| 532 | typedef struct task_debug_info_internal *task_debug_info_internal_t; |
| 533 | typedef struct task_debug_info_internal task_debug_info_internal_data_t; |
| 534 | #define TASK_DEBUG_INFO_INTERNAL_COUNT ((mach_msg_type_number_t) \ |
| 535 | (sizeof (task_debug_info_internal_data_t) / sizeof(natural_t))) |
| 536 | |
| 537 | #endif /* PRIVATE */ |
| 538 | |
| 539 | #ifdef PRIVATE |
| 540 | |
| 541 | typedef struct task_suspend_stats_s { |
| 542 | uint64_t tss_last_start; /* mach_absolute_time of beginning of last suspension*/ |
| 543 | uint64_t tss_last_end; /* mach_absolute_time of end of last suspension */ |
| 544 | uint64_t tss_count; /* number of times this task has been suspended */ |
| 545 | uint64_t tss_duration; /* sum(mach_absolute_time) of time spend suspended */ |
| 546 | } *task_suspend_stats_t; |
| 547 | |
| 548 | typedef struct task_suspend_stats_s task_suspend_stats_data_t; |
| 549 | #define TASK_SUSPEND_STATS_INFO 30 |
| 550 | #define TASK_SUSPEND_STATS_INFO_COUNT ((mach_msg_type_number_t) \ |
| 551 | (sizeof(task_suspend_stats_data_t) / sizeof(natural_t))) |
| 552 | |
| 553 | typedef struct task_suspend_source_s { |
| 554 | uint64_t tss_time; /* mach_absolute_time of suspend */ |
| 555 | uint64_t tss_tid; /* tid of suspending thread */ |
| 556 | int tss_pid; /* pid of suspending task */ |
| 557 | char tss_procname[65]; /* name of suspending task */ |
| 558 | uint8_t tss_padding[3]; /* pad to multiple of natural_t */ |
| 559 | } *task_suspend_source_t; |
| 560 | #define TASK_SUSPEND_SOURCES_MAX 4 |
| 561 | typedef struct task_suspend_source_s task_suspend_source_array_t[TASK_SUSPEND_SOURCES_MAX]; |
| 562 | |
| 563 | typedef struct task_suspend_source_s task_suspend_source_data_t; |
| 564 | #define TASK_SUSPEND_SOURCES_INFO 31 |
| 565 | #define TASK_SUSPEND_SOURCES_INFO_COUNT ((mach_msg_type_number_t) \ |
| 566 | (sizeof(task_suspend_source_data_t) * TASK_SUSPEND_SOURCES_MAX / sizeof(natural_t))) |
| 567 | |
| 568 | #endif /* PRIVATE */ |
| 569 | |
| 570 | /* |
| 571 | * Type to control EXC_GUARD delivery options for a task |
| 572 | * via task_get/set_exc_guard_behavior interface(s). |
| 573 | */ |
| 574 | typedef uint32_t task_exc_guard_behavior_t; |
| 575 | |
| 576 | /* EXC_GUARD optional delivery settings on a per-task basis */ |
| 577 | #define TASK_EXC_GUARD_NONE 0x00 |
| 578 | #define TASK_EXC_GUARD_VM_DELIVER 0x01 /* Deliver virtual memory EXC_GUARD exceptions */ |
| 579 | #define TASK_EXC_GUARD_VM_ONCE 0x02 /* Deliver them only once */ |
| 580 | #define TASK_EXC_GUARD_VM_CORPSE 0x04 /* Deliver them via a forked corpse */ |
| 581 | #define TASK_EXC_GUARD_VM_FATAL 0x08 /* Virtual Memory EXC_GUARD delivery is fatal */ |
| 582 | #define TASK_EXC_GUARD_VM_ALL 0x0f |
| 583 | |
| 584 | #define TASK_EXC_GUARD_MP_DELIVER 0x10 /* Deliver mach port EXC_GUARD exceptions */ |
| 585 | #define TASK_EXC_GUARD_MP_ONCE 0x20 /* Deliver them only once */ |
| 586 | #define TASK_EXC_GUARD_MP_CORPSE 0x40 /* Deliver them via a forked corpse */ |
| 587 | #define TASK_EXC_GUARD_MP_FATAL 0x80 /* mach port EXC_GUARD delivery is fatal */ |
| 588 | #define TASK_EXC_GUARD_MP_ALL 0xf0 |
| 589 | |
| 590 | #define TASK_EXC_GUARD_ALL 0xff /* All optional deliver settings */ |
| 591 | |
| 592 | #ifdef PRIVATE |
| 593 | /* |
| 594 | * Experimental mode of setting default guard behavior for non-Apple processes |
| 595 | * The default for 3rd party guards is shifted up 8 bits - but otherwise the same values as above. |
| 596 | */ |
| 597 | #define TASK_EXC_GUARD_THIRD_PARTY_DEFAULT_SHIFT 0x8 /* 3rd party default shifted up in boot-arg */ |
| 598 | |
| 599 | #define TASK_EXC_GUARD_HONOR_NAMED_DEFAULTS 0x10000 /* Honor the by-process-name defaults */ |
| 600 | |
| 601 | #endif |
| 602 | |
| 603 | /* |
| 604 | * Type to control corpse forking options for a task |
| 605 | * via task_get/set_corpse_forking_behavior interface(s). |
| 606 | */ |
| 607 | typedef uint32_t task_corpse_forking_behavior_t; |
| 608 | |
| 609 | #define TASK_CORPSE_FORKING_DISABLED_MEM_DIAG 0x01 /* Disable corpse forking because the task is running under a diagnostic tool */ |
| 610 | |
| 611 | #ifdef XNU_KERNEL_PRIVATE |
| 612 | |
| 613 | __options_decl(task_control_port_options_t, uint32_t, { |
| 614 | TASK_CONTROL_PORT_OPTIONS_NONE = 0x00000000, |
| 615 | |
| 616 | TASK_CONTROL_PORT_PINNED_SOFT = 0x00000001, |
| 617 | TASK_CONTROL_PORT_PINNED_HARD = 0x00000002, |
| 618 | TASK_CONTROL_PORT_IMMOVABLE_SOFT = 0x00000004, |
| 619 | TASK_CONTROL_PORT_IMMOVABLE_HARD = 0x00000008, |
| 620 | }); |
| 621 | |
| 622 | #define TASK_CONTROL_PORT_IMMOVABLE (TASK_CONTROL_PORT_IMMOVABLE_SOFT | TASK_CONTROL_PORT_IMMOVABLE_HARD) |
| 623 | #define TASK_CONTROL_PORT_PINNED (TASK_CONTROL_PORT_PINNED_SOFT | TASK_CONTROL_PORT_PINNED_HARD) |
| 624 | |
| 625 | #endif /* XNU_KERNEL_PRIVATE */ |
| 626 | |
| 627 | /* |
| 628 | * Obsolete interfaces. |
| 629 | */ |
| 630 | |
| 631 | #define TASK_SCHED_TIMESHARE_INFO 10 |
| 632 | #define TASK_SCHED_RR_INFO 11 |
| 633 | #define TASK_SCHED_FIFO_INFO 12 |
| 634 | |
| 635 | #define TASK_SCHED_INFO 14 |
| 636 | |
| 637 | #pragma pack(pop) |
| 638 | |
| 639 | #endif /* _MACH_TASK_INFO_H_ */ |
| 640 | |