]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 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. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 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 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 | /* | |
60 | * File: mach/host_info.h | |
61 | * | |
62 | * Definitions for host_info call. | |
63 | */ | |
64 | ||
65 | #ifndef _MACH_HOST_INFO_H_ | |
66 | #define _MACH_HOST_INFO_H_ | |
67 | ||
91447636 | 68 | #include <mach/message.h> |
1c79356b A |
69 | #include <mach/vm_statistics.h> |
70 | #include <mach/machine.h> | |
71 | #include <mach/machine/vm_types.h> | |
72 | #include <mach/time_value.h> | |
73 | ||
91447636 A |
74 | #include <sys/cdefs.h> |
75 | ||
1c79356b A |
76 | /* |
77 | * Generic information structure to allow for expansion. | |
78 | */ | |
79 | typedef integer_t *host_info_t; /* varying array of int. */ | |
80 | ||
81 | #define HOST_INFO_MAX (1024) /* max array size */ | |
82 | typedef integer_t host_info_data_t[HOST_INFO_MAX]; | |
83 | ||
84 | #define KERNEL_VERSION_MAX (512) | |
85 | typedef char kernel_version_t[KERNEL_VERSION_MAX]; | |
86 | ||
87 | #define KERNEL_BOOT_INFO_MAX (4096) | |
88 | typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX]; | |
89 | ||
1c79356b A |
90 | /* |
91 | * Currently defined information. | |
92 | */ | |
93 | /* host_info() */ | |
94 | typedef integer_t host_flavor_t; | |
95 | #define HOST_BASIC_INFO 1 /* basic info */ | |
96 | #define HOST_SCHED_INFO 3 /* scheduling info */ | |
97 | #define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */ | |
98 | #define HOST_PRIORITY_INFO 5 /* priority information */ | |
9bccf70c A |
99 | #define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */ |
100 | #define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */ | |
1c79356b | 101 | |
91447636 A |
102 | #ifdef MACH_KERNEL_PRIVATE |
103 | struct host_basic_info_old { | |
1c79356b | 104 | integer_t max_cpus; /* max number of cpus possible */ |
2d21ac55 | 105 | uint32_t avail_cpus; /* number of cpus now available */ |
91447636 | 106 | natural_t memory_size; /* size of memory in bytes */ |
1c79356b A |
107 | cpu_type_t cpu_type; /* cpu type */ |
108 | cpu_subtype_t cpu_subtype; /* cpu subtype */ | |
109 | }; | |
110 | ||
91447636 A |
111 | typedef struct host_basic_info_old host_basic_info_data_old_t; |
112 | typedef struct host_basic_info_old *host_basic_info_old_t; | |
113 | #define HOST_BASIC_INFO_OLD_COUNT ((mach_msg_type_number_t) \ | |
114 | (sizeof(host_basic_info_data_old_t)/sizeof(integer_t))) | |
115 | #endif | |
116 | ||
0c530ab8 | 117 | #pragma pack(4) |
91447636 A |
118 | |
119 | struct host_basic_info { | |
120 | integer_t max_cpus; /* max number of CPUs possible */ | |
121 | integer_t avail_cpus; /* number of CPUs now available */ | |
122 | natural_t memory_size; /* size of memory in bytes, capped at 2 GB */ | |
123 | cpu_type_t cpu_type; /* cpu type */ | |
124 | cpu_subtype_t cpu_subtype; /* cpu subtype */ | |
125 | cpu_threadtype_t cpu_threadtype; /* cpu threadtype */ | |
126 | integer_t physical_cpu; /* number of physical CPUs now available */ | |
127 | integer_t physical_cpu_max; /* max number of physical CPUs possible */ | |
128 | integer_t logical_cpu; /* number of logical cpu now available */ | |
129 | integer_t logical_cpu_max; /* max number of physical CPUs possible */ | |
130 | uint64_t max_mem; /* actual size of physical memory */ | |
131 | }; | |
132 | ||
0c530ab8 | 133 | #pragma pack() |
91447636 | 134 | |
1c79356b A |
135 | typedef struct host_basic_info host_basic_info_data_t; |
136 | typedef struct host_basic_info *host_basic_info_t; | |
91447636 A |
137 | #define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \ |
138 | (sizeof(host_basic_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
139 | |
140 | struct host_sched_info { | |
141 | integer_t min_timeout; /* minimum timeout in milliseconds */ | |
142 | integer_t min_quantum; /* minimum quantum in milliseconds */ | |
143 | }; | |
144 | ||
145 | typedef struct host_sched_info host_sched_info_data_t; | |
146 | typedef struct host_sched_info *host_sched_info_t; | |
91447636 A |
147 | #define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \ |
148 | (sizeof(host_sched_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
149 | |
150 | struct kernel_resource_sizes { | |
91447636 A |
151 | natural_t task; |
152 | natural_t thread; | |
153 | natural_t port; | |
154 | natural_t memory_region; | |
155 | natural_t memory_object; | |
1c79356b A |
156 | }; |
157 | ||
158 | typedef struct kernel_resource_sizes kernel_resource_sizes_data_t; | |
159 | typedef struct kernel_resource_sizes *kernel_resource_sizes_t; | |
91447636 A |
160 | #define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \ |
161 | (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))) | |
1c79356b A |
162 | |
163 | struct host_priority_info { | |
164 | integer_t kernel_priority; | |
165 | integer_t system_priority; | |
166 | integer_t server_priority; | |
167 | integer_t user_priority; | |
168 | integer_t depress_priority; | |
169 | integer_t idle_priority; | |
170 | integer_t minimum_priority; | |
171 | integer_t maximum_priority; | |
172 | }; | |
173 | ||
174 | typedef struct host_priority_info host_priority_info_data_t; | |
175 | typedef struct host_priority_info *host_priority_info_t; | |
91447636 A |
176 | #define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \ |
177 | (sizeof(host_priority_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
178 | |
179 | /* host_statistics() */ | |
180 | #define HOST_LOAD_INFO 1 /* System loading stats */ | |
181 | #define HOST_VM_INFO 2 /* Virtual memory stats */ | |
182 | #define HOST_CPU_LOAD_INFO 3 /* CPU load stats */ | |
183 | ||
184 | struct host_load_info { | |
185 | integer_t avenrun[3]; /* scaled by LOAD_SCALE */ | |
186 | integer_t mach_factor[3]; /* scaled by LOAD_SCALE */ | |
187 | }; | |
188 | ||
189 | typedef struct host_load_info host_load_info_data_t; | |
190 | typedef struct host_load_info *host_load_info_t; | |
91447636 A |
191 | #define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ |
192 | (sizeof(host_load_info_data_t)/sizeof(integer_t))) | |
1c79356b A |
193 | |
194 | /* in <mach/vm_statistics.h> */ | |
91447636 A |
195 | #define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \ |
196 | (sizeof(vm_statistics_data_t)/sizeof(integer_t))) | |
2d21ac55 A |
197 | |
198 | /* size of the latest version of the structure */ | |
199 | #define HOST_VM_INFO_LATEST_COUNT HOST_VM_INFO_COUNT | |
200 | #define HOST_VM_INFO_REV2_COUNT HOST_VM_INFO_LATEST_COUNT | |
201 | /* previous versions: adjust the size according to what was added each time */ | |
202 | #define HOST_VM_INFO_REV1_COUNT /* added "speculative_count" (1 int) */ \ | |
203 | ((mach_msg_type_number_t) \ | |
204 | (HOST_VM_INFO_REV2_COUNT - 1)) | |
205 | #define HOST_VM_INFO_REV0_COUNT /* added "purgable" info (2 ints) */ \ | |
206 | ((mach_msg_type_number_t) \ | |
207 | (HOST_VM_INFO_REV1_COUNT - 2)) | |
1c79356b A |
208 | |
209 | struct host_cpu_load_info { /* number of ticks while running... */ | |
91447636 | 210 | natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */ |
1c79356b | 211 | }; |
91447636 | 212 | |
1c79356b A |
213 | typedef struct host_cpu_load_info host_cpu_load_info_data_t; |
214 | typedef struct host_cpu_load_info *host_cpu_load_info_t; | |
91447636 A |
215 | #define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \ |
216 | (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))) | |
1c79356b | 217 | |
1c79356b | 218 | #endif /* _MACH_HOST_INFO_H_ */ |