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.
86 #define TASK_BASIC_INFO_32 4 /* basic information */
88 struct task_basic_info_32
{
89 integer_t suspend_count
; /* suspend count for task */
90 natural_t virtual_size
; /* virtual memory size (bytes) */
91 natural_t resident_size
; /* resident memory size (bytes) */
92 time_value_t user_time
; /* total user run time for
94 time_value_t system_time
; /* total system run time for
96 policy_t policy
; /* default policy for new threads */
98 typedef struct task_basic_info_32 task_basic_info_32_data_t
;
99 typedef struct task_basic_info_32
*task_basic_info_32_t
;
100 #define TASK_BASIC_INFO_32_COUNT \
101 (sizeof(task_basic_info_32_data_t) / sizeof(natural_t))
104 #define TASK_BASIC_INFO_64 5 /* 64-bit capable basic info */
106 struct task_basic_info_64
{
107 integer_t suspend_count
; /* suspend count for task */
108 mach_vm_size_t virtual_size
; /* virtual memory size (bytes) */
109 mach_vm_size_t resident_size
; /* resident memory size (bytes) */
110 time_value_t user_time
; /* total user run time for
111 terminated threads */
112 time_value_t system_time
; /* total system run time for
113 terminated threads */
114 policy_t policy
; /* default policy for new threads */
116 typedef struct task_basic_info_64 task_basic_info_64_data_t
;
117 typedef struct task_basic_info_64
*task_basic_info_64_t
;
118 #define TASK_BASIC_INFO_64_COUNT \
119 (sizeof(task_basic_info_64_data_t) / sizeof(natural_t))
122 /* localized structure - cannot be safely passed between tasks of differing sizes */
124 struct task_basic_info
{
125 integer_t suspend_count
; /* suspend count for task */
126 vm_size_t virtual_size
; /* virtual memory size (bytes) */
127 vm_size_t resident_size
; /* resident memory size (bytes) */
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 */
135 typedef struct task_basic_info task_basic_info_data_t
;
136 typedef struct task_basic_info
*task_basic_info_t
;
137 #define TASK_BASIC_INFO_COUNT \
138 (sizeof(task_basic_info_data_t) / sizeof(natural_t))
139 #if !defined(__LP64__)
140 #define TASK_BASIC_INFO TASK_BASIC_INFO_32
142 #define TASK_BASIC_INFO TASK_BASIC_INFO_64
147 #define TASK_EVENTS_INFO 2 /* various event counts */
149 struct task_events_info
{
150 integer_t faults
; /* number of page faults */
151 integer_t pageins
; /* number of actual pageins */
152 integer_t cow_faults
; /* number of copy-on-write faults */
153 integer_t messages_sent
; /* number of messages sent */
154 integer_t messages_received
; /* number of messages received */
155 integer_t syscalls_mach
; /* number of mach system calls */
156 integer_t syscalls_unix
; /* number of unix system calls */
157 integer_t csw
; /* number of context switches */
159 typedef struct task_events_info task_events_info_data_t
;
160 typedef struct task_events_info
*task_events_info_t
;
161 #define TASK_EVENTS_INFO_COUNT ((mach_msg_type_number_t) \
162 (sizeof(task_events_info_data_t) / sizeof(natural_t)))
164 #define TASK_THREAD_TIMES_INFO 3 /* total times for live threads -
165 only accurate if suspended */
167 struct task_thread_times_info
{
168 time_value_t user_time
; /* total user run time for
170 time_value_t system_time
; /* total system run time for
174 typedef struct task_thread_times_info task_thread_times_info_data_t
;
175 typedef struct task_thread_times_info
*task_thread_times_info_t
;
176 #define TASK_THREAD_TIMES_INFO_COUNT ((mach_msg_type_number_t) \
177 (sizeof(task_thread_times_info_data_t) / sizeof(natural_t)))
179 #define TASK_ABSOLUTETIME_INFO 1
181 struct task_absolutetime_info
{
182 uint64_t total_user
; /* total time */
183 uint64_t total_system
;
184 uint64_t threads_user
; /* existing threads only */
185 uint64_t threads_system
;
188 typedef struct task_absolutetime_info task_absolutetime_info_data_t
;
189 typedef struct task_absolutetime_info
*task_absolutetime_info_t
;
190 #define TASK_ABSOLUTETIME_INFO_COUNT ((mach_msg_type_number_t) \
191 (sizeof (task_absolutetime_info_data_t) / sizeof (natural_t)))
193 #define TASK_SECURITY_TOKEN 13
194 #define TASK_SECURITY_TOKEN_COUNT ((mach_msg_type_number_t) \
195 (sizeof(security_token_t) / sizeof(natural_t)))
197 #define TASK_AUDIT_TOKEN 15
198 #define TASK_AUDIT_TOKEN_COUNT \
199 (sizeof(audit_token_t) / sizeof(natural_t))
205 * Obsolete interfaces.
208 #define TASK_SCHED_TIMESHARE_INFO 10
209 #define TASK_SCHED_RR_INFO 11
210 #define TASK_SCHED_FIFO_INFO 12
212 #define TASK_SCHED_INFO 14
214 #endif /* _MACH_TASK_INFO_H_ */