]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/host_info.h
9a55dcb59f67dcfcb59d2cfdab088b3c6211286a
[apple/xnu.git] / osfmk / mach / host_info.h
1 /*
2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * @OSF_COPYRIGHT@
25 */
26 /*
27 * Mach Operating System
28 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
29 * All Rights Reserved.
30 *
31 * Permission to use, copy, modify and distribute this software and its
32 * documentation is hereby granted, provided that both the copyright
33 * notice and this permission notice appear in all copies of the
34 * software, derivative works or modified versions, and any portions
35 * thereof, and that both notices appear in supporting documentation.
36 *
37 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
38 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
39 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
40 *
41 * Carnegie Mellon requests users of this software to return to
42 *
43 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
44 * School of Computer Science
45 * Carnegie Mellon University
46 * Pittsburgh PA 15213-3890
47 *
48 * any improvements or extensions that they make and grant Carnegie Mellon
49 * the rights to redistribute these changes.
50 */
51 /*
52 */
53
54 /*
55 * File: mach/host_info.h
56 *
57 * Definitions for host_info call.
58 */
59
60 #ifndef _MACH_HOST_INFO_H_
61 #define _MACH_HOST_INFO_H_
62
63 #include <mach/message.h>
64 #include <mach/vm_statistics.h>
65 #include <mach/machine.h>
66 #include <mach/machine/vm_types.h>
67 #include <mach/time_value.h>
68
69 #include <sys/cdefs.h>
70
71 /*
72 * Generic information structure to allow for expansion.
73 */
74 typedef integer_t *host_info_t; /* varying array of int. */
75
76 #define HOST_INFO_MAX (1024) /* max array size */
77 typedef integer_t host_info_data_t[HOST_INFO_MAX];
78
79 #define KERNEL_VERSION_MAX (512)
80 typedef char kernel_version_t[KERNEL_VERSION_MAX];
81
82 #define KERNEL_BOOT_INFO_MAX (4096)
83 typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
84
85 /*
86 * Currently defined information.
87 */
88 /* host_info() */
89 typedef integer_t host_flavor_t;
90 #define HOST_BASIC_INFO 1 /* basic info */
91 #define HOST_SCHED_INFO 3 /* scheduling info */
92 #define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */
93 #define HOST_PRIORITY_INFO 5 /* priority information */
94 #define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
95 #define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
96
97 #ifdef MACH_KERNEL_PRIVATE
98 struct host_basic_info_old {
99 integer_t max_cpus; /* max number of cpus possible */
100 integer_t avail_cpus; /* number of cpus now available */
101 natural_t memory_size; /* size of memory in bytes */
102 cpu_type_t cpu_type; /* cpu type */
103 cpu_subtype_t cpu_subtype; /* cpu subtype */
104 };
105
106 typedef struct host_basic_info_old host_basic_info_data_old_t;
107 typedef struct host_basic_info_old *host_basic_info_old_t;
108 #define HOST_BASIC_INFO_OLD_COUNT ((mach_msg_type_number_t) \
109 (sizeof(host_basic_info_data_old_t)/sizeof(integer_t)))
110 #endif
111
112 #if __DARWIN_ALIGN_POWER
113 #pragma options align=power
114 #endif
115
116 struct host_basic_info {
117 integer_t max_cpus; /* max number of CPUs possible */
118 integer_t avail_cpus; /* number of CPUs now available */
119 natural_t memory_size; /* size of memory in bytes, capped at 2 GB */
120 cpu_type_t cpu_type; /* cpu type */
121 cpu_subtype_t cpu_subtype; /* cpu subtype */
122 cpu_threadtype_t cpu_threadtype; /* cpu threadtype */
123 integer_t physical_cpu; /* number of physical CPUs now available */
124 integer_t physical_cpu_max; /* max number of physical CPUs possible */
125 integer_t logical_cpu; /* number of logical cpu now available */
126 integer_t logical_cpu_max; /* max number of physical CPUs possible */
127 uint64_t max_mem; /* actual size of physical memory */
128 };
129
130 #if __DARWIN_ALIGN_POWER
131 #pragma options align=reset
132 #endif
133
134 typedef struct host_basic_info host_basic_info_data_t;
135 typedef struct host_basic_info *host_basic_info_t;
136 #define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
137 (sizeof(host_basic_info_data_t)/sizeof(integer_t)))
138
139 struct host_sched_info {
140 integer_t min_timeout; /* minimum timeout in milliseconds */
141 integer_t min_quantum; /* minimum quantum in milliseconds */
142 };
143
144 typedef struct host_sched_info host_sched_info_data_t;
145 typedef struct host_sched_info *host_sched_info_t;
146 #define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
147 (sizeof(host_sched_info_data_t)/sizeof(integer_t)))
148
149 struct kernel_resource_sizes {
150 natural_t task;
151 natural_t thread;
152 natural_t port;
153 natural_t memory_region;
154 natural_t memory_object;
155 };
156
157 typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
158 typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
159 #define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
160 (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
161
162 struct host_priority_info {
163 integer_t kernel_priority;
164 integer_t system_priority;
165 integer_t server_priority;
166 integer_t user_priority;
167 integer_t depress_priority;
168 integer_t idle_priority;
169 integer_t minimum_priority;
170 integer_t maximum_priority;
171 };
172
173 typedef struct host_priority_info host_priority_info_data_t;
174 typedef struct host_priority_info *host_priority_info_t;
175 #define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
176 (sizeof(host_priority_info_data_t)/sizeof(integer_t)))
177
178 /* host_statistics() */
179 #define HOST_LOAD_INFO 1 /* System loading stats */
180 #define HOST_VM_INFO 2 /* Virtual memory stats */
181 #define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
182
183 struct host_load_info {
184 integer_t avenrun[3]; /* scaled by LOAD_SCALE */
185 integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
186 };
187
188 typedef struct host_load_info host_load_info_data_t;
189 typedef struct host_load_info *host_load_info_t;
190 #define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
191 (sizeof(host_load_info_data_t)/sizeof(integer_t)))
192
193 /* in <mach/vm_statistics.h> */
194 #define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
195 (sizeof(vm_statistics_data_t)/sizeof(integer_t)))
196 #define HOST_VM_INFO_REV0_COUNT ((mach_msg_type_number_t) \
197 (sizeof(vm_statistics_rev0_data_t)/sizeof(integer_t)))
198
199 struct host_cpu_load_info { /* number of ticks while running... */
200 natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
201 };
202
203 typedef struct host_cpu_load_info host_cpu_load_info_data_t;
204 typedef struct host_cpu_load_info *host_cpu_load_info_t;
205 #define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
206 (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
207
208 #endif /* _MACH_HOST_INFO_H_ */