2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
28 * All Rights Reserved.
30 * Permission to use, copy, modify and distribute this software and its
31 * documentation is hereby granted, provided that both the copyright
32 * notice and this permission notice appear in all copies of the
33 * software, derivative works or modified versions, and any portions
34 * thereof, and that both notices appear in supporting documentation.
36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
37 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
53 * Machine-independent task information structures and definitions.
55 * The definitions in this file are exported to the user. The kernel
56 * will translate its internal data structures to these structures
61 #ifndef _MACH_TASK_INFO_H_
62 #define _MACH_TASK_INFO_H_
64 #include <mach/message.h>
65 #include <mach/machine/vm_types.h>
66 #include <mach/time_value.h>
67 #include <mach/policy.h>
69 #include <sys/cdefs.h>
72 * Generic information structure to allow for expansion.
74 typedef natural_t task_flavor_t
;
75 typedef integer_t
*task_info_t
; /* varying array of int */
77 #define TASK_INFO_MAX (1024) /* maximum array size */
78 typedef integer_t task_info_data_t
[TASK_INFO_MAX
];
81 * Currently defined information structures.
84 #if __DARWIN_ALIGN_POWER
85 #pragma options align=power
88 #define TASK_BASIC_INFO_32 4 /* basic information */
90 struct task_basic_info_32
{
91 integer_t suspend_count
; /* suspend count for task */
92 natural_t virtual_size
; /* virtual memory size (bytes) */
93 natural_t resident_size
; /* resident memory size (bytes) */
94 time_value_t user_time
; /* total user run time for
96 time_value_t system_time
; /* total system run time for
98 policy_t policy
; /* default policy for new threads */
100 typedef struct task_basic_info_32 task_basic_info_32_data_t
;
101 typedef struct task_basic_info_32
*task_basic_info_32_t
;
102 #define TASK_BASIC_INFO_32_COUNT \
103 (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
106 #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
108 struct task_basic_info_64
{
109 integer_t suspend_count
; /* suspend count for task */
110 mach_vm_size_t virtual_size
; /* virtual memory size (bytes) */
111 mach_vm_size_t resident_size
; /* resident memory size (bytes) */
112 time_value_t user_time
; /* total user run time for
113 terminated threads */
114 time_value_t system_time
; /* total system run time for
115 terminated threads */
116 policy_t policy
; /* default policy for new threads */
118 typedef struct task_basic_info_64 task_basic_info_64_data_t
;
119 typedef struct task_basic_info_64
*task_basic_info_64_t
;
120 #define TASK_BASIC_INFO_64_COUNT \
121 (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
124 /* localized structure - cannot be safely passed between tasks of differing sizes */
126 struct task_basic_info
{
127 integer_t suspend_count
; /* suspend count for task */
128 vm_size_t virtual_size
; /* virtual memory size (bytes) */
129 vm_size_t resident_size
; /* resident memory size (bytes) */
130 time_value_t user_time
; /* total user run time for
131 terminated threads */
132 time_value_t system_time
; /* total system run time for
133 terminated threads */
134 policy_t policy
; /* default policy for new threads */
137 typedef struct task_basic_info task_basic_info_data_t
;
138 typedef struct task_basic_info
*task_basic_info_t
;
139 #define TASK_BASIC_INFO_COUNT \
140 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
141 #if !defined(__LP64__)
142 #define TASK_BASIC_INFO TASK_BASIC_INFO_32
144 #define TASK_BASIC_INFO TASK_BASIC_INFO_64
149 #define TASK_EVENTS_INFO 2 /* various event counts */
151 struct task_events_info
{
152 integer_t faults
; /* number of page faults */
153 integer_t pageins
; /* number of actual pageins */
154 integer_t cow_faults
; /* number of copy-on-write faults */
155 integer_t messages_sent
; /* number of messages sent */
156 integer_t messages_received
; /* number of messages received */
157 integer_t syscalls_mach
; /* number of mach system calls */
158 integer_t syscalls_unix
; /* number of unix system calls */
159 integer_t csw
; /* number of context switches */
161 typedef struct task_events_info task_events_info_data_t
;
162 typedef struct task_events_info
*task_events_info_t
;
163 #define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
164 (sizeof(task_events_info_data_t) / sizeof(natural_t)))
166 #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
167 only accurate if suspended */
169 struct task_thread_times_info
{
170 time_value_t user_time
; /* total user run time for
172 time_value_t system_time
; /* total system run time for
176 typedef struct task_thread_times_info task_thread_times_info_data_t
;
177 typedef struct task_thread_times_info
*task_thread_times_info_t
;
178 #define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
179 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
181 #define TASK_ABSOLUTETIME_INFO 1
183 struct task_absolutetime_info
{
184 uint64_t total_user
; /* total time */
185 uint64_t total_system
;
186 uint64_t threads_user
; /* existing threads only */
187 uint64_t threads_system
;
190 typedef struct task_absolutetime_info task_absolutetime_info_data_t
;
191 typedef struct task_absolutetime_info
*task_absolutetime_info_t
;
192 #define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
193 (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
195 #define TASK_SECURITY_TOKEN 13
196 #define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
197 (sizeof(security_token_t) / sizeof(natural_t)))
199 #define TASK_AUDIT_TOKEN 15
200 #define TASK_AUDIT_TOKEN_COUNT \
201 (sizeof(audit_token_t) / sizeof(natural_t))
203 #if __DARWIN_ALIGN_POWER
204 #pragma options align=reset
209 * Obsolete interfaces.
212 #define TASK_SCHED_TIMESHARE_INFO 10
213 #define TASK_SCHED_RR_INFO 11
214 #define TASK_SCHED_FIFO_INFO 12
216 #define TASK_SCHED_INFO 14
218 #endif /* _MACH_TASK_INFO_H_ */