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