]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
3e170ce0 | 2 | * Copyright (c) 2000-2007, 2015 Apple Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
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. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* | |
29 | * @OSF_COPYRIGHT@ | |
30 | */ | |
1c79356b A |
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 | */ | |
1c79356b A |
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 | ||
91447636 A |
65 | #ifndef _MACH_TASK_INFO_H_ |
66 | #define _MACH_TASK_INFO_H_ | |
1c79356b | 67 | |
91447636 | 68 | #include <mach/message.h> |
1c79356b A |
69 | #include <mach/machine/vm_types.h> |
70 | #include <mach/time_value.h> | |
71 | #include <mach/policy.h> | |
316670eb A |
72 | #include <mach/vm_statistics.h> /* for vm_extmod_statistics_data_t */ |
73 | #include <Availability.h> | |
1c79356b | 74 | |
91447636 | 75 | #include <sys/cdefs.h> |
9bccf70c | 76 | |
1c79356b A |
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 | ||
316670eb | 83 | /* Deprecated, use per structure _data_t's instead */ |
1c79356b A |
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 | ||
0c530ab8 | 91 | #pragma pack(4) |
91447636 | 92 | |
316670eb | 93 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
91447636 | 94 | #define TASK_BASIC_INFO_32 4 /* basic information */ |
2d21ac55 | 95 | #define TASK_BASIC2_INFO_32 6 |
91447636 A |
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 | ||
316670eb | 112 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
91447636 A |
113 | struct task_basic_info_64 { |
114 | integer_t suspend_count; /* suspend count for task */ | |
115 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ | |
116 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ | |
117 | time_value_t user_time; /* total user run time for | |
118 | terminated threads */ | |
119 | time_value_t system_time; /* total system run time for | |
120 | terminated threads */ | |
121 | policy_t policy; /* default policy for new threads */ | |
122 | }; | |
123 | typedef struct task_basic_info_64 task_basic_info_64_data_t; | |
124 | typedef struct task_basic_info_64 *task_basic_info_64_t; | |
316670eb A |
125 | |
126 | #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */ | |
91447636 A |
127 | #define TASK_BASIC_INFO_64_COUNT \ |
128 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t)) | |
129 | ||
130 | ||
131 | /* localized structure - cannot be safely passed between tasks of differing sizes */ | |
316670eb | 132 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */ |
1c79356b A |
133 | struct task_basic_info { |
134 | integer_t suspend_count; /* suspend count for task */ | |
91447636 A |
135 | vm_size_t virtual_size; /* virtual memory size (bytes) */ |
136 | vm_size_t resident_size; /* resident memory size (bytes) */ | |
1c79356b A |
137 | time_value_t user_time; /* total user run time for |
138 | terminated threads */ | |
139 | time_value_t system_time; /* total system run time for | |
140 | terminated threads */ | |
141 | policy_t policy; /* default policy for new threads */ | |
142 | }; | |
143 | ||
144 | typedef struct task_basic_info task_basic_info_data_t; | |
145 | typedef struct task_basic_info *task_basic_info_t; | |
146 | #define TASK_BASIC_INFO_COUNT \ | |
147 | (sizeof(task_basic_info_data_t) / sizeof(natural_t)) | |
91447636 A |
148 | #if !defined(__LP64__) |
149 | #define TASK_BASIC_INFO TASK_BASIC_INFO_32 | |
150 | #else | |
151 | #define TASK_BASIC_INFO TASK_BASIC_INFO_64 | |
152 | #endif | |
153 | ||
1c79356b A |
154 | |
155 | ||
156 | #define TASK_EVENTS_INFO 2 /* various event counts */ | |
157 | ||
158 | struct task_events_info { | |
159 | integer_t faults; /* number of page faults */ | |
160 | integer_t pageins; /* number of actual pageins */ | |
161 | integer_t cow_faults; /* number of copy-on-write faults */ | |
162 | integer_t messages_sent; /* number of messages sent */ | |
163 | integer_t messages_received; /* number of messages received */ | |
164 | integer_t syscalls_mach; /* number of mach system calls */ | |
165 | integer_t syscalls_unix; /* number of unix system calls */ | |
166 | integer_t csw; /* number of context switches */ | |
167 | }; | |
168 | typedef struct task_events_info task_events_info_data_t; | |
169 | typedef struct task_events_info *task_events_info_t; | |
91447636 A |
170 | #define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \ |
171 | (sizeof(task_events_info_data_t) / sizeof(natural_t))) | |
1c79356b A |
172 | |
173 | #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads - | |
174 | only accurate if suspended */ | |
175 | ||
176 | struct task_thread_times_info { | |
177 | time_value_t user_time; /* total user run time for | |
178 | live threads */ | |
179 | time_value_t system_time; /* total system run time for | |
180 | live threads */ | |
181 | }; | |
182 | ||
183 | typedef struct task_thread_times_info task_thread_times_info_data_t; | |
184 | typedef struct task_thread_times_info *task_thread_times_info_t; | |
91447636 A |
185 | #define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \ |
186 | (sizeof(task_thread_times_info_data_t) / sizeof(natural_t))) | |
9bccf70c | 187 | |
91447636 | 188 | #define TASK_ABSOLUTETIME_INFO 1 |
1c79356b | 189 | |
91447636 | 190 | struct task_absolutetime_info { |
db609669 | 191 | uint64_t total_user; |
91447636 A |
192 | uint64_t total_system; |
193 | uint64_t threads_user; /* existing threads only */ | |
194 | uint64_t threads_system; | |
195 | }; | |
9bccf70c | 196 | |
91447636 A |
197 | typedef struct task_absolutetime_info task_absolutetime_info_data_t; |
198 | typedef struct task_absolutetime_info *task_absolutetime_info_t; | |
199 | #define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \ | |
200 | (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t))) | |
9bccf70c | 201 | |
6d2010ae A |
202 | #define TASK_KERNELMEMORY_INFO 7 |
203 | ||
204 | struct task_kernelmemory_info { | |
205 | uint64_t total_palloc; /* private kernel mem alloc'ed */ | |
206 | uint64_t total_pfree; /* private kernel mem freed */ | |
207 | uint64_t total_salloc; /* shared kernel mem alloc'ed */ | |
208 | uint64_t total_sfree; /* shared kernel mem freed */ | |
209 | }; | |
210 | ||
211 | typedef struct task_kernelmemory_info task_kernelmemory_info_data_t; | |
212 | typedef struct task_kernelmemory_info *task_kernelmemory_info_t; | |
213 | #define TASK_KERNELMEMORY_INFO_COUNT ((mach_msg_type_number_t) \ | |
214 | (sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t))) | |
215 | ||
1c79356b | 216 | #define TASK_SECURITY_TOKEN 13 |
91447636 A |
217 | #define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \ |
218 | (sizeof(security_token_t) / sizeof(natural_t))) | |
1c79356b | 219 | |
55e303ae A |
220 | #define TASK_AUDIT_TOKEN 15 |
221 | #define TASK_AUDIT_TOKEN_COUNT \ | |
222 | (sizeof(audit_token_t) / sizeof(natural_t)) | |
223 | ||
2d21ac55 A |
224 | |
225 | #define TASK_AFFINITY_TAG_INFO 16 /* This is experimental. */ | |
226 | ||
227 | struct task_affinity_tag_info { | |
228 | integer_t set_count; | |
229 | integer_t min; | |
230 | integer_t max; | |
231 | integer_t task_count; | |
232 | }; | |
233 | typedef struct task_affinity_tag_info task_affinity_tag_info_data_t; | |
234 | typedef struct task_affinity_tag_info *task_affinity_tag_info_t; | |
235 | #define TASK_AFFINITY_TAG_INFO_COUNT \ | |
236 | (sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t)) | |
237 | ||
6d2010ae | 238 | #define TASK_DYLD_INFO 17 |
b0d623f7 A |
239 | |
240 | struct task_dyld_info { | |
241 | mach_vm_address_t all_image_info_addr; | |
242 | mach_vm_size_t all_image_info_size; | |
6d2010ae | 243 | integer_t all_image_info_format; |
b0d623f7 A |
244 | }; |
245 | typedef struct task_dyld_info task_dyld_info_data_t; | |
246 | typedef struct task_dyld_info *task_dyld_info_t; | |
247 | #define TASK_DYLD_INFO_COUNT \ | |
248 | (sizeof(task_dyld_info_data_t) / sizeof(natural_t)) | |
6d2010ae A |
249 | #define TASK_DYLD_ALL_IMAGE_INFO_32 0 /* format value */ |
250 | #define TASK_DYLD_ALL_IMAGE_INFO_64 1 /* format value */ | |
251 | ||
316670eb A |
252 | |
253 | #define TASK_EXTMOD_INFO 19 | |
6d2010ae A |
254 | |
255 | struct task_extmod_info { | |
256 | unsigned char task_uuid[16]; | |
257 | vm_extmod_statistics_data_t extmod_statistics; | |
258 | }; | |
259 | typedef struct task_extmod_info task_extmod_info_data_t; | |
260 | typedef struct task_extmod_info *task_extmod_info_t; | |
261 | #define TASK_EXTMOD_INFO_COUNT \ | |
262 | (sizeof(task_extmod_info_data_t) / sizeof(natural_t)) | |
b0d623f7 | 263 | |
4b17d6b6 | 264 | |
39236c6e | 265 | #define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */ |
316670eb A |
266 | struct mach_task_basic_info { |
267 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ | |
268 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ | |
269 | mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */ | |
270 | time_value_t user_time; /* total user run time for | |
271 | terminated threads */ | |
272 | time_value_t system_time; /* total system run time for | |
273 | terminated threads */ | |
274 | policy_t policy; /* default policy for new threads */ | |
275 | integer_t suspend_count; /* suspend count for task */ | |
276 | }; | |
277 | typedef struct mach_task_basic_info mach_task_basic_info_data_t; | |
278 | typedef struct mach_task_basic_info *mach_task_basic_info_t; | |
279 | #define MACH_TASK_BASIC_INFO_COUNT \ | |
280 | (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t)) | |
91447636 | 281 | |
39236c6e A |
282 | |
283 | #define TASK_POWER_INFO 21 | |
284 | ||
285 | struct task_power_info { | |
286 | uint64_t total_user; | |
287 | uint64_t total_system; | |
288 | uint64_t task_interrupt_wakeups; | |
289 | uint64_t task_platform_idle_wakeups; | |
290 | uint64_t task_timer_wakeups_bin_1; | |
291 | uint64_t task_timer_wakeups_bin_2; | |
292 | }; | |
293 | ||
294 | typedef struct task_power_info task_power_info_data_t; | |
295 | typedef struct task_power_info *task_power_info_t; | |
296 | #define TASK_POWER_INFO_COUNT ((mach_msg_type_number_t) \ | |
297 | (sizeof (task_power_info_data_t) / sizeof (natural_t))) | |
298 | ||
299 | ||
300 | ||
301 | #define TASK_VM_INFO 22 | |
302 | #define TASK_VM_INFO_PURGEABLE 23 | |
303 | struct task_vm_info { | |
304 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */ | |
305 | integer_t region_count; /* number of memory regions */ | |
306 | integer_t page_size; | |
307 | mach_vm_size_t resident_size; /* resident memory size (bytes) */ | |
308 | mach_vm_size_t resident_size_peak; /* peak resident size (bytes) */ | |
309 | ||
310 | mach_vm_size_t device; | |
311 | mach_vm_size_t device_peak; | |
312 | mach_vm_size_t internal; | |
313 | mach_vm_size_t internal_peak; | |
314 | mach_vm_size_t external; | |
315 | mach_vm_size_t external_peak; | |
316 | mach_vm_size_t reusable; | |
317 | mach_vm_size_t reusable_peak; | |
318 | mach_vm_size_t purgeable_volatile_pmap; | |
319 | mach_vm_size_t purgeable_volatile_resident; | |
320 | mach_vm_size_t purgeable_volatile_virtual; | |
321 | mach_vm_size_t compressed; | |
322 | mach_vm_size_t compressed_peak; | |
323 | mach_vm_size_t compressed_lifetime; | |
3e170ce0 A |
324 | |
325 | /* added for rev1 */ | |
326 | mach_vm_size_t phys_footprint; | |
39236c6e A |
327 | }; |
328 | typedef struct task_vm_info task_vm_info_data_t; | |
329 | typedef struct task_vm_info *task_vm_info_t; | |
330 | #define TASK_VM_INFO_COUNT ((mach_msg_type_number_t) \ | |
331 | (sizeof (task_vm_info_data_t) / sizeof (natural_t))) | |
3e170ce0 A |
332 | #define TASK_VM_INFO_REV0_COUNT /* doesn't include phys_footprint */ \ |
333 | ((mach_msg_type_number_t) \ | |
334 | (TASK_VM_INFO_COUNT - 2)) | |
39236c6e A |
335 | |
336 | typedef struct vm_purgeable_info task_purgable_info_t; | |
337 | ||
fe8ab488 A |
338 | |
339 | #define TASK_TRACE_MEMORY_INFO 24 | |
340 | struct task_trace_memory_info { | |
341 | uint64_t user_memory_address; /* address of start of trace memory buffer */ | |
342 | uint64_t buffer_size; /* size of buffer in bytes */ | |
343 | uint64_t mailbox_array_size; /* size of mailbox area in bytes */ | |
344 | }; | |
345 | typedef struct task_trace_memory_info task_trace_memory_info_data_t; | |
346 | typedef struct task_trace_memory_info * task_trace_memory_info_t; | |
347 | #define TASK_TRACE_MEMORY_INFO_COUNT ((mach_msg_type_number_t) \ | |
348 | (sizeof(task_trace_memory_info_data_t) / sizeof(natural_t))) | |
349 | ||
350 | #define TASK_WAIT_STATE_INFO 25 /* deprecated. */ | |
351 | struct task_wait_state_info { | |
352 | uint64_t total_wait_state_time; /* Time that all threads past and present have been in a wait state */ | |
353 | uint64_t total_wait_sfi_state_time; /* Time that threads have been in SFI wait (should be a subset of total wait state time */ | |
354 | uint32_t _reserved[4]; | |
355 | }; | |
356 | typedef struct task_wait_state_info task_wait_state_info_data_t; | |
357 | typedef struct task_wait_state_info * task_wait_state_info_t; | |
358 | #define TASK_WAIT_STATE_INFO_COUNT ((mach_msg_type_number_t) \ | |
359 | (sizeof(task_wait_state_info_data_t) / sizeof(natural_t))) | |
360 | ||
361 | #define TASK_POWER_INFO_V2 26 | |
362 | ||
363 | typedef struct { | |
364 | uint64_t task_gpu_utilisation; | |
365 | uint64_t task_gpu_stat_reserved0; | |
366 | uint64_t task_gpu_stat_reserved1; | |
367 | uint64_t task_gpu_stat_reserved2; | |
368 | } gpu_energy_data; | |
369 | ||
370 | typedef gpu_energy_data *gpu_energy_data_t; | |
371 | struct task_power_info_v2 { | |
372 | task_power_info_data_t cpu_energy; | |
373 | gpu_energy_data gpu_energy; | |
374 | }; | |
375 | ||
376 | typedef struct task_power_info_v2 task_power_info_v2_data_t; | |
377 | typedef struct task_power_info_v2 *task_power_info_v2_t; | |
378 | #define TASK_POWER_INFO_V2_COUNT ((mach_msg_type_number_t) \ | |
379 | (sizeof (task_power_info_v2_data_t) / sizeof (natural_t))) | |
380 | ||
3e170ce0 A |
381 | |
382 | #define TASK_VM_INFO_PURGEABLE_ACCOUNT 27 /* Used for xnu purgeable vm unit tests */ | |
383 | ||
384 | #ifdef PRIVATE | |
385 | struct pvm_account_info { | |
386 | uint64_t pvm_volatile_count; /* Number of volatile bytes associated with a task */ | |
387 | uint64_t pvm_volatile_compressed_count; /* Number of volatile compressed bytes associated with a task */ | |
388 | uint64_t pvm_nonvolatile_count; /* Number of nonvolatile bytes associated with a task */ | |
389 | uint64_t pvm_nonvolatile_compressed_count; /* Number of nonvolatile compressed bytes associated with a task */ | |
390 | }; | |
391 | ||
392 | typedef struct pvm_account_info *pvm_account_info_t; | |
393 | typedef struct pvm_account_info pvm_account_info_data_t; | |
394 | ||
395 | #define PVM_ACCOUNT_INFO_COUNT ((mach_msg_type_number_t) \ | |
396 | (sizeof (pvm_account_info_data_t) / sizeof (natural_t))) | |
397 | #endif /* PRIVATE */ | |
398 | ||
399 | #define TASK_FLAGS_INFO 28 /* return t_flags field */ | |
400 | struct task_flags_info { | |
401 | uint32_t flags; /* task flags */ | |
402 | }; | |
403 | typedef struct task_flags_info task_flags_info_data_t; | |
404 | typedef struct task_flags_info * task_flags_info_t; | |
405 | #define TASK_FLAGS_INFO_COUNT ((mach_msg_type_number_t) \ | |
406 | (sizeof(task_flags_info_data_t) / sizeof (natural_t))) | |
407 | ||
408 | #define TF_LP64 0x00000001 /* task has 64-bit addressing */ | |
409 | ||
410 | #define TASK_DEBUG_INFO_INTERNAL 29 /* Used for kernel internal development tests. */ | |
411 | ||
412 | #ifdef PRIVATE | |
413 | struct task_debug_info_internal { | |
414 | uint64_t ipc_space_size; | |
415 | }; | |
416 | typedef struct task_debug_info_internal *task_debug_info_internal_t; | |
417 | typedef struct task_debug_info_internal task_debug_info_internal_data_t; | |
418 | #define TASK_DEBUG_INFO_INTERNAL_COUNT ((mach_msg_type_number_t) \ | |
419 | (sizeof (task_debug_info_internal_data_t) / sizeof(natural_t))) | |
420 | ||
421 | #endif /* PRIVATE */ | |
422 | ||
91447636 A |
423 | /* |
424 | * Obsolete interfaces. | |
425 | */ | |
426 | ||
427 | #define TASK_SCHED_TIMESHARE_INFO 10 | |
428 | #define TASK_SCHED_RR_INFO 11 | |
429 | #define TASK_SCHED_FIFO_INFO 12 | |
430 | ||
431 | #define TASK_SCHED_INFO 14 | |
432 | ||
316670eb A |
433 | #pragma pack() |
434 | ||
91447636 | 435 | #endif /* _MACH_TASK_INFO_H_ */ |