1 | /*␊ |
2 | * Copyright (c) 2000-2007 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(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 | #ifdef __arm__␊ |
116 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */␊ |
117 | mach_vm_size_t resident_size; /* resident memory size (bytes) */␊ |
118 | #else /* __arm__ */␊ |
119 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */␊ |
120 | mach_vm_size_t resident_size; /* resident memory size (bytes) */␊ |
121 | #endif /* __arm__ */␊ |
122 | time_value_t user_time; /* total user run time for␊ |
123 | terminated threads */␊ |
124 | time_value_t system_time; /* total system run time for␊ |
125 | terminated threads */␊ |
126 | ␉policy_t␉policy;␉␉/* default policy for new threads */␊ |
127 | };␊ |
128 | typedef struct task_basic_info_64 task_basic_info_64_data_t;␊ |
129 | typedef struct task_basic_info_64 *task_basic_info_64_t;␊ |
130 | ␊ |
131 | #ifdef __arm__␊ |
132 | ␉#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_5_0)␊ |
133 | ␉␊ |
134 | ␉#define TASK_BASIC_INFO_64 5 ␊ |
135 | ␉#define TASK_BASIC_INFO_64_COUNT \␊ |
136 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))␊ |
137 | ␉␊ |
138 | ␉#else ␊ |
139 | ␉␊ |
140 | ␉#define TASK_BASIC_INFO_64 ␉TASK_BASIC_INFO_64_2␉␊ |
141 | ␉#define TASK_BASIC_INFO_64_COUNT ␉TASK_BASIC_INFO_64_2_COUNT␊ |
142 | ␉#endif ␊ |
143 | #else /* __arm__ */␊ |
144 | #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */␊ |
145 | #define TASK_BASIC_INFO_64_COUNT \␊ |
146 | (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))␊ |
147 | #endif␊ |
148 | ␊ |
149 | ␊ |
150 | /* localized structure - cannot be safely passed between tasks of differing sizes */␊ |
151 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */␊ |
152 | struct task_basic_info {␊ |
153 | integer_t suspend_count; /* suspend count for task */␊ |
154 | vm_size_t virtual_size; /* virtual memory size (bytes) */␊ |
155 | vm_size_t resident_size; /* resident memory size (bytes) */␊ |
156 | time_value_t user_time; /* total user run time for␊ |
157 | terminated threads */␊ |
158 | time_value_t system_time; /* total system run time for␊ |
159 | terminated threads */␊ |
160 | ␉policy_t␉policy;␉␉/* default policy for new threads */␊ |
161 | };␊ |
162 | ␊ |
163 | typedef struct task_basic_info task_basic_info_data_t;␊ |
164 | typedef struct task_basic_info *task_basic_info_t;␊ |
165 | #define TASK_BASIC_INFO_COUNT \␊ |
166 | (sizeof(task_basic_info_data_t) / sizeof(natural_t))␊ |
167 | #if !defined(__LP64__)␊ |
168 | #define TASK_BASIC_INFO TASK_BASIC_INFO_32␊ |
169 | #else␊ |
170 | #define TASK_BASIC_INFO TASK_BASIC_INFO_64␊ |
171 | #endif␊ |
172 | ␊ |
173 | ␊ |
174 | ␊ |
175 | #define␉TASK_EVENTS_INFO␉2␉/* various event counts */␊ |
176 | ␊ |
177 | struct task_events_info {␊ |
178 | ␉integer_t␉faults;␉␉/* number of page faults */␊ |
179 | ␉integer_t ␉pageins;␉/* number of actual pageins */␊ |
180 | ␉integer_t ␉cow_faults;␉/* number of copy-on-write faults */␊ |
181 | ␉integer_t ␉messages_sent;␉/* number of messages sent */␊ |
182 | ␉integer_t ␉messages_received; /* number of messages received */␊ |
183 | integer_t ␉syscalls_mach; /* number of mach system calls */␊ |
184 | ␉integer_t ␉syscalls_unix; /* number of unix system calls */␊ |
185 | ␉integer_t ␉csw; /* number of context switches */␊ |
186 | };␊ |
187 | typedef struct task_events_info␉␉task_events_info_data_t;␊ |
188 | typedef struct task_events_info␉␉*task_events_info_t;␊ |
189 | #define␉TASK_EVENTS_INFO_COUNT␉␉((mach_msg_type_number_t) \␊ |
190 | ␉␉(sizeof(task_events_info_data_t) / sizeof(natural_t)))␊ |
191 | ␊ |
192 | #define␉TASK_THREAD_TIMES_INFO␉3␉/* total times for live threads -␊ |
193 | ␉␉␉␉␉ only accurate if suspended */␊ |
194 | ␊ |
195 | struct task_thread_times_info {␊ |
196 | ␉time_value_t␉user_time;␉/* total user run time for␊ |
197 | ␉␉␉␉␉ live threads */␊ |
198 | ␉time_value_t␉system_time;␉/* total system run time for␊ |
199 | ␉␉␉␉␉ live threads */␊ |
200 | };␊ |
201 | ␊ |
202 | typedef struct task_thread_times_info␉task_thread_times_info_data_t;␊ |
203 | typedef struct task_thread_times_info␉*task_thread_times_info_t;␊ |
204 | #define␉TASK_THREAD_TIMES_INFO_COUNT␉((mach_msg_type_number_t) \␊ |
205 | ␉␉(sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))␊ |
206 | ␊ |
207 | #define TASK_ABSOLUTETIME_INFO␉1␊ |
208 | ␊ |
209 | struct task_absolutetime_info {␊ |
210 | ␉uint64_t␉␉total_user;␉␉/* total time */␊ |
211 | ␉uint64_t␉␉total_system;␊ |
212 | ␉uint64_t␉␉threads_user;␉/* existing threads only */␊ |
213 | ␉uint64_t␉␉threads_system;␊ |
214 | };␊ |
215 | ␊ |
216 | typedef struct task_absolutetime_info␉task_absolutetime_info_data_t;␊ |
217 | typedef struct task_absolutetime_info␉*task_absolutetime_info_t;␊ |
218 | #define TASK_ABSOLUTETIME_INFO_COUNT␉((mach_msg_type_number_t) \␊ |
219 | ␉␉(sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))␊ |
220 | ␊ |
221 | #define TASK_KERNELMEMORY_INFO␉7␊ |
222 | ␊ |
223 | struct task_kernelmemory_info {␊ |
224 | ␉uint64_t␉␉total_palloc;␉/* private kernel mem alloc'ed */␊ |
225 | ␉uint64_t␉␉total_pfree;␉/* private kernel mem freed */␊ |
226 | ␉uint64_t␉␉total_salloc;␉/* shared kernel mem alloc'ed */␊ |
227 | ␉uint64_t␉␉total_sfree;␉/* shared kernel mem freed */␊ |
228 | };␊ |
229 | ␊ |
230 | typedef struct task_kernelmemory_info␉task_kernelmemory_info_data_t;␊ |
231 | typedef struct task_kernelmemory_info␉*task_kernelmemory_info_t;␊ |
232 | #define TASK_KERNELMEMORY_INFO_COUNT␉((mach_msg_type_number_t) \␊ |
233 | ␉␉(sizeof (task_kernelmemory_info_data_t) / sizeof (natural_t)))␊ |
234 | ␊ |
235 | #define TASK_SECURITY_TOKEN␉␉13␊ |
236 | #define TASK_SECURITY_TOKEN_COUNT␉((mach_msg_type_number_t) \␊ |
237 | ␉␉(sizeof(security_token_t) / sizeof(natural_t)))␊ |
238 | ␊ |
239 | #define TASK_AUDIT_TOKEN␉␉15␊ |
240 | #define TASK_AUDIT_TOKEN_COUNT␉\␊ |
241 | ␉␉(sizeof(audit_token_t) / sizeof(natural_t))␊ |
242 | ␊ |
243 | ␊ |
244 | #define TASK_AFFINITY_TAG_INFO␉␉16 ␉/* This is experimental. */␊ |
245 | ␊ |
246 | struct task_affinity_tag_info {␊ |
247 | ␉integer_t␉␉set_count;␊ |
248 | ␉integer_t␉␉min;␊ |
249 | ␉integer_t␉␉max;␊ |
250 | ␉integer_t␉␉task_count;␊ |
251 | };␊ |
252 | typedef struct task_affinity_tag_info␉task_affinity_tag_info_data_t;␊ |
253 | typedef struct task_affinity_tag_info␉*task_affinity_tag_info_t;␊ |
254 | #define TASK_AFFINITY_TAG_INFO_COUNT␉\␊ |
255 | ␉␉(sizeof(task_affinity_tag_info_data_t) / sizeof(natural_t))␊ |
256 | ␊ |
257 | #define TASK_DYLD_INFO␉␉␉17␊ |
258 | ␊ |
259 | struct task_dyld_info {␊ |
260 | ␉mach_vm_address_t␉all_image_info_addr;␊ |
261 | ␉mach_vm_size_t␉␉all_image_info_size;␊ |
262 | ␉integer_t␉␉all_image_info_format;␉␉␊ |
263 | };␊ |
264 | typedef struct task_dyld_info␉task_dyld_info_data_t;␊ |
265 | typedef struct task_dyld_info␉*task_dyld_info_t;␊ |
266 | #define TASK_DYLD_INFO_COUNT␉\␊ |
267 | ␉␉(sizeof(task_dyld_info_data_t) / sizeof(natural_t))␊ |
268 | #define TASK_DYLD_ALL_IMAGE_INFO_32␉0␉/* format value */␊ |
269 | #define TASK_DYLD_ALL_IMAGE_INFO_64␉1␉/* format value */␊ |
270 | ␊ |
271 | #ifdef __arm__␊ |
272 | ␊ |
273 | /* Don't use this, use MACH_TASK_BASIC_INFO instead */␊ |
274 | /* Compatibility for old 32-bit mach_vm_*_t */␊ |
275 | #define TASK_BASIC_INFO_64_2 18 /* 64-bit capable basic info */␊ |
276 | ␊ |
277 | struct task_basic_info_64_2 {␊ |
278 | integer_t suspend_count; /* suspend count for task */␊ |
279 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */␊ |
280 | mach_vm_size_t resident_size; /* resident memory size (bytes) */␊ |
281 | time_value_t user_time; /* total user run time for␊ |
282 | terminated threads */␊ |
283 | time_value_t system_time; /* total system run time for␊ |
284 | terminated threads */␊ |
285 | ␉policy_t␉policy;␉␉/* default policy for new threads */␊ |
286 | };␊ |
287 | typedef struct task_basic_info_64_2 task_basic_info_64_2_data_t;␊ |
288 | typedef struct task_basic_info_64_2 *task_basic_info_64_2_t;␊ |
289 | #define TASK_BASIC_INFO_64_2_COUNT \␊ |
290 | (sizeof(task_basic_info_64_2_data_t) / sizeof(natural_t))␊ |
291 | #endif␊ |
292 | ␊ |
293 | #define TASK_EXTMOD_INFO␉␉␉19␊ |
294 | ␊ |
295 | struct task_extmod_info {␊ |
296 | ␉unsigned char␉task_uuid[16];␊ |
297 | ␉vm_extmod_statistics_data_t␉␉extmod_statistics;␊ |
298 | };␊ |
299 | typedef struct task_extmod_info␉task_extmod_info_data_t;␊ |
300 | typedef struct task_extmod_info␉*task_extmod_info_t;␊ |
301 | #define TASK_EXTMOD_INFO_COUNT␉\␊ |
302 | ␉␉(sizeof(task_extmod_info_data_t) / sizeof(natural_t))␊ |
303 | ␊ |
304 | /* Always 64-bit in user and kernel */␊ |
305 | #define MACH_TASK_BASIC_INFO 20 /* always 64-bit basic info */␊ |
306 | ␊ |
307 | struct mach_task_basic_info {␊ |
308 | mach_vm_size_t virtual_size; /* virtual memory size (bytes) */␊ |
309 | mach_vm_size_t resident_size; /* resident memory size (bytes) */␊ |
310 | mach_vm_size_t resident_size_max; /* maximum resident memory size (bytes) */␊ |
311 | time_value_t user_time; /* total user run time for␊ |
312 | terminated threads */␊ |
313 | time_value_t system_time; /* total system run time for␊ |
314 | terminated threads */␊ |
315 | policy_t policy; /* default policy for new threads */␊ |
316 | integer_t suspend_count; /* suspend count for task */␊ |
317 | };␊ |
318 | typedef struct mach_task_basic_info mach_task_basic_info_data_t;␊ |
319 | typedef struct mach_task_basic_info *mach_task_basic_info_t;␊ |
320 | #define MACH_TASK_BASIC_INFO_COUNT \␊ |
321 | (sizeof(mach_task_basic_info_data_t) / sizeof(natural_t))␊ |
322 | ␊ |
323 | /*␊ |
324 | * Obsolete interfaces.␊ |
325 | */␊ |
326 | ␊ |
327 | #define TASK_SCHED_TIMESHARE_INFO␉10␊ |
328 | #define TASK_SCHED_RR_INFO␉␉11␊ |
329 | #define TASK_SCHED_FIFO_INFO␉␉12␊ |
330 | ␊ |
331 | #define TASK_SCHED_INFO␉␉␉14␊ |
332 | ␊ |
333 | #pragma pack()␊ |
334 | ␊ |
335 | #endif␉/* _MACH_TASK_INFO_H_ */␊ |
336 | |