]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/host_info.h
xnu-792.6.76.tar.gz
[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 * 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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_COPYRIGHT@
24 */
25 /*
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
28 * All Rights Reserved.
29 *
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.
35 *
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.
39 *
40 * Carnegie Mellon requests users of this software to return to
41 *
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
46 *
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
49 */
50 /*
51 */
52
53 /*
54 * File: mach/host_info.h
55 *
56 * Definitions for host_info call.
57 */
58
59 #ifndef _MACH_HOST_INFO_H_
60 #define _MACH_HOST_INFO_H_
61
62 #include <mach/message.h>
63 #include <mach/vm_statistics.h>
64 #include <mach/machine.h>
65 #include <mach/machine/vm_types.h>
66 #include <mach/time_value.h>
67
68 #include <sys/cdefs.h>
69
70 /*
71 * Generic information structure to allow for expansion.
72 */
73 typedef integer_t *host_info_t; /* varying array of int. */
74
75 #define HOST_INFO_MAX (1024) /* max array size */
76 typedef integer_t host_info_data_t[HOST_INFO_MAX];
77
78 #define KERNEL_VERSION_MAX (512)
79 typedef char kernel_version_t[KERNEL_VERSION_MAX];
80
81 #define KERNEL_BOOT_INFO_MAX (4096)
82 typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
83
84 /*
85 * Currently defined information.
86 */
87 /* host_info() */
88 typedef integer_t host_flavor_t;
89 #define HOST_BASIC_INFO 1 /* basic info */
90 #define HOST_SCHED_INFO 3 /* scheduling info */
91 #define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */
92 #define HOST_PRIORITY_INFO 5 /* priority information */
93 #define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
94 #define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
95
96 #ifdef MACH_KERNEL_PRIVATE
97 struct host_basic_info_old {
98 integer_t max_cpus; /* max number of cpus possible */
99 integer_t avail_cpus; /* number of cpus now available */
100 natural_t memory_size; /* size of memory in bytes */
101 cpu_type_t cpu_type; /* cpu type */
102 cpu_subtype_t cpu_subtype; /* cpu subtype */
103 };
104
105 typedef struct host_basic_info_old host_basic_info_data_old_t;
106 typedef struct host_basic_info_old *host_basic_info_old_t;
107 #define HOST_BASIC_INFO_OLD_COUNT ((mach_msg_type_number_t) \
108 (sizeof(host_basic_info_data_old_t)/sizeof(integer_t)))
109 #endif
110
111 #if __DARWIN_ALIGN_POWER
112 #pragma options align=power
113 #endif
114
115 struct host_basic_info {
116 integer_t max_cpus; /* max number of CPUs possible */
117 integer_t avail_cpus; /* number of CPUs now available */
118 natural_t memory_size; /* size of memory in bytes, capped at 2 GB */
119 cpu_type_t cpu_type; /* cpu type */
120 cpu_subtype_t cpu_subtype; /* cpu subtype */
121 cpu_threadtype_t cpu_threadtype; /* cpu threadtype */
122 integer_t physical_cpu; /* number of physical CPUs now available */
123 integer_t physical_cpu_max; /* max number of physical CPUs possible */
124 integer_t logical_cpu; /* number of logical cpu now available */
125 integer_t logical_cpu_max; /* max number of physical CPUs possible */
126 uint64_t max_mem; /* actual size of physical memory */
127 };
128
129 #if __DARWIN_ALIGN_POWER
130 #pragma options align=reset
131 #endif
132
133 typedef struct host_basic_info host_basic_info_data_t;
134 typedef struct host_basic_info *host_basic_info_t;
135 #define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
136 (sizeof(host_basic_info_data_t)/sizeof(integer_t)))
137
138 struct host_sched_info {
139 integer_t min_timeout; /* minimum timeout in milliseconds */
140 integer_t min_quantum; /* minimum quantum in milliseconds */
141 };
142
143 typedef struct host_sched_info host_sched_info_data_t;
144 typedef struct host_sched_info *host_sched_info_t;
145 #define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
146 (sizeof(host_sched_info_data_t)/sizeof(integer_t)))
147
148 struct kernel_resource_sizes {
149 natural_t task;
150 natural_t thread;
151 natural_t port;
152 natural_t memory_region;
153 natural_t memory_object;
154 };
155
156 typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
157 typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
158 #define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
159 (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
160
161 struct host_priority_info {
162 integer_t kernel_priority;
163 integer_t system_priority;
164 integer_t server_priority;
165 integer_t user_priority;
166 integer_t depress_priority;
167 integer_t idle_priority;
168 integer_t minimum_priority;
169 integer_t maximum_priority;
170 };
171
172 typedef struct host_priority_info host_priority_info_data_t;
173 typedef struct host_priority_info *host_priority_info_t;
174 #define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
175 (sizeof(host_priority_info_data_t)/sizeof(integer_t)))
176
177 /* host_statistics() */
178 #define HOST_LOAD_INFO 1 /* System loading stats */
179 #define HOST_VM_INFO 2 /* Virtual memory stats */
180 #define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
181
182 struct host_load_info {
183 integer_t avenrun[3]; /* scaled by LOAD_SCALE */
184 integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
185 };
186
187 typedef struct host_load_info host_load_info_data_t;
188 typedef struct host_load_info *host_load_info_t;
189 #define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
190 (sizeof(host_load_info_data_t)/sizeof(integer_t)))
191
192 /* in <mach/vm_statistics.h> */
193 #define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
194 (sizeof(vm_statistics_data_t)/sizeof(integer_t)))
195 #define HOST_VM_INFO_REV0_COUNT ((mach_msg_type_number_t) \
196 (sizeof(vm_statistics_rev0_data_t)/sizeof(integer_t)))
197
198 struct host_cpu_load_info { /* number of ticks while running... */
199 natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
200 };
201
202 typedef struct host_cpu_load_info host_cpu_load_info_data_t;
203 typedef struct host_cpu_load_info *host_cpu_load_info_t;
204 #define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
205 (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
206
207 #endif /* _MACH_HOST_INFO_H_ */