]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/task_info.h
xnu-792.17.14.tar.gz
[apple/xnu.git] / osfmk / mach / task_info.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
8f6c56a5 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
8f6c56a5
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.
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
8ad349bb 24 * limitations under the License.
8f6c56a5
A
25 *
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 */
56/*
57 */
58/*
59 * Machine-independent task information structures and definitions.
60 *
61 * The definitions in this file are exported to the user. The kernel
62 * will translate its internal data structures to these structures
63 * as appropriate.
64 *
65 */
66
91447636
A
67#ifndef _MACH_TASK_INFO_H_
68#define _MACH_TASK_INFO_H_
1c79356b 69
91447636 70#include <mach/message.h>
1c79356b
A
71#include <mach/machine/vm_types.h>
72#include <mach/time_value.h>
73#include <mach/policy.h>
74
91447636 75#include <sys/cdefs.h>
9bccf70c 76
1c79356b
A
77/*
78 * Generic information structure to allow for expansion.
79 */
80typedef natural_t task_flavor_t;
81typedef integer_t *task_info_t; /* varying array of int */
82
83#define TASK_INFO_MAX (1024) /* maximum array size */
84typedef integer_t task_info_data_t[TASK_INFO_MAX];
85
86/*
87 * Currently defined information structures.
88 */
89
8f6c56a5
A
90#if __DARWIN_ALIGN_POWER
91#pragma options align=power
92#endif
91447636
A
93
94#define TASK_BASIC_INFO_32 4 /* basic information */
95
96struct task_basic_info_32 {
97 integer_t suspend_count; /* suspend count for task */
98 natural_t virtual_size; /* virtual memory size (bytes) */
99 natural_t resident_size; /* resident memory size (bytes) */
100 time_value_t user_time; /* total user run time for
101 terminated threads */
102 time_value_t system_time; /* total system run time for
103 terminated threads */
104 policy_t policy; /* default policy for new threads */
105};
106typedef struct task_basic_info_32 task_basic_info_32_data_t;
107typedef struct task_basic_info_32 *task_basic_info_32_t;
108#define TASK_BASIC_INFO_32_COUNT \
109 (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
110
111
112#define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
113
114struct task_basic_info_64 {
115 integer_t suspend_count; /* suspend count for task */
116 mach_vm_size_t virtual_size; /* virtual memory size (bytes) */
117 mach_vm_size_t resident_size; /* resident memory size (bytes) */
118 time_value_t user_time; /* total user run time for
119 terminated threads */
120 time_value_t system_time; /* total system run time for
121 terminated threads */
122 policy_t policy; /* default policy for new threads */
123};
124typedef struct task_basic_info_64 task_basic_info_64_data_t;
125typedef struct task_basic_info_64 *task_basic_info_64_t;
126#define TASK_BASIC_INFO_64_COUNT \
127 (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
128
129
130/* localized structure - cannot be safely passed between tasks of differing sizes */
1c79356b
A
131
132struct task_basic_info {
133 integer_t suspend_count; /* suspend count for task */
91447636
A
134 vm_size_t virtual_size; /* virtual memory size (bytes) */
135 vm_size_t resident_size; /* resident memory size (bytes) */
1c79356b
A
136 time_value_t user_time; /* total user run time for
137 terminated threads */
138 time_value_t system_time; /* total system run time for
139 terminated threads */
140 policy_t policy; /* default policy for new threads */
141};
142
143typedef struct task_basic_info task_basic_info_data_t;
144typedef struct task_basic_info *task_basic_info_t;
145#define TASK_BASIC_INFO_COUNT \
146 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
91447636
A
147#if !defined(__LP64__)
148#define TASK_BASIC_INFO TASK_BASIC_INFO_32
149#else
150#define TASK_BASIC_INFO TASK_BASIC_INFO_64
151#endif
152
1c79356b
A
153
154
155#define TASK_EVENTS_INFO 2 /* various event counts */
156
157struct task_events_info {
158 integer_t faults; /* number of page faults */
159 integer_t pageins; /* number of actual pageins */
160 integer_t cow_faults; /* number of copy-on-write faults */
161 integer_t messages_sent; /* number of messages sent */
162 integer_t messages_received; /* number of messages received */
163 integer_t syscalls_mach; /* number of mach system calls */
164 integer_t syscalls_unix; /* number of unix system calls */
165 integer_t csw; /* number of context switches */
166};
167typedef struct task_events_info task_events_info_data_t;
168typedef struct task_events_info *task_events_info_t;
91447636
A
169#define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
170 (sizeof(task_events_info_data_t) / sizeof(natural_t)))
1c79356b
A
171
172#define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
173 only accurate if suspended */
174
175struct task_thread_times_info {
176 time_value_t user_time; /* total user run time for
177 live threads */
178 time_value_t system_time; /* total system run time for
179 live threads */
180};
181
182typedef struct task_thread_times_info task_thread_times_info_data_t;
183typedef struct task_thread_times_info *task_thread_times_info_t;
91447636
A
184#define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
185 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
9bccf70c 186
91447636 187#define TASK_ABSOLUTETIME_INFO 1
1c79356b 188
91447636
A
189struct task_absolutetime_info {
190 uint64_t total_user; /* total time */
191 uint64_t total_system;
192 uint64_t threads_user; /* existing threads only */
193 uint64_t threads_system;
194};
9bccf70c 195
91447636
A
196typedef struct task_absolutetime_info task_absolutetime_info_data_t;
197typedef struct task_absolutetime_info *task_absolutetime_info_t;
198#define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
199 (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
9bccf70c 200
1c79356b 201#define TASK_SECURITY_TOKEN 13
91447636
A
202#define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
203 (sizeof(security_token_t) / sizeof(natural_t)))
1c79356b 204
55e303ae
A
205#define TASK_AUDIT_TOKEN 15
206#define TASK_AUDIT_TOKEN_COUNT \
207 (sizeof(audit_token_t) / sizeof(natural_t))
208
8f6c56a5
A
209#if __DARWIN_ALIGN_POWER
210#pragma options align=reset
211#endif
91447636
A
212
213
214/*
215 * Obsolete interfaces.
216 */
217
218#define TASK_SCHED_TIMESHARE_INFO 10
219#define TASK_SCHED_RR_INFO 11
220#define TASK_SCHED_FIFO_INFO 12
221
222#define TASK_SCHED_INFO 14
223
224#endif /* _MACH_TASK_INFO_H_ */