2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
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
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
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.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
34 * Mach Operating System
35 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
36 * All Rights Reserved.
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.
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.
48 * Carnegie Mellon requests users of this software to return to
50 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
51 * School of Computer Science
52 * Carnegie Mellon University
53 * Pittsburgh PA 15213-3890
55 * any improvements or extensions that they make and grant Carnegie Mellon
56 * the rights to redistribute these changes.
62 * File: mach/host_info.h
64 * Definitions for host_info call.
67 #ifndef _MACH_HOST_INFO_H_
68 #define _MACH_HOST_INFO_H_
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>
76 #include <sys/cdefs.h>
79 * Generic information structure to allow for expansion.
81 typedef integer_t
*host_info_t
; /* varying array of int. */
83 #define HOST_INFO_MAX (1024) /* max array size */
84 typedef integer_t host_info_data_t
[HOST_INFO_MAX
];
86 #define KERNEL_VERSION_MAX (512)
87 typedef char kernel_version_t
[KERNEL_VERSION_MAX
];
89 #define KERNEL_BOOT_INFO_MAX (4096)
90 typedef char kernel_boot_info_t
[KERNEL_BOOT_INFO_MAX
];
93 * Currently defined information.
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 */
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 */
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)))
119 #if __DARWIN_ALIGN_POWER
120 #pragma options align=power
123 struct host_basic_info
{
124 integer_t max_cpus
; /* max number of CPUs possible */
125 integer_t avail_cpus
; /* number of CPUs now available */
126 natural_t memory_size
; /* size of memory in bytes, capped at 2 GB */
127 cpu_type_t cpu_type
; /* cpu type */
128 cpu_subtype_t cpu_subtype
; /* cpu subtype */
129 cpu_threadtype_t cpu_threadtype
; /* cpu threadtype */
130 integer_t physical_cpu
; /* number of physical CPUs now available */
131 integer_t physical_cpu_max
; /* max number of physical CPUs possible */
132 integer_t logical_cpu
; /* number of logical cpu now available */
133 integer_t logical_cpu_max
; /* max number of physical CPUs possible */
134 uint64_t max_mem
; /* actual size of physical memory */
137 #if __DARWIN_ALIGN_POWER
138 #pragma options align=reset
141 typedef struct host_basic_info host_basic_info_data_t
;
142 typedef struct host_basic_info
*host_basic_info_t
;
143 #define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
144 (sizeof(host_basic_info_data_t)/sizeof(integer_t)))
146 struct host_sched_info
{
147 integer_t min_timeout
; /* minimum timeout in milliseconds */
148 integer_t min_quantum
; /* minimum quantum in milliseconds */
151 typedef struct host_sched_info host_sched_info_data_t
;
152 typedef struct host_sched_info
*host_sched_info_t
;
153 #define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
154 (sizeof(host_sched_info_data_t)/sizeof(integer_t)))
156 struct kernel_resource_sizes
{
160 natural_t memory_region
;
161 natural_t memory_object
;
164 typedef struct kernel_resource_sizes kernel_resource_sizes_data_t
;
165 typedef struct kernel_resource_sizes
*kernel_resource_sizes_t
;
166 #define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
167 (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
169 struct host_priority_info
{
170 integer_t kernel_priority
;
171 integer_t system_priority
;
172 integer_t server_priority
;
173 integer_t user_priority
;
174 integer_t depress_priority
;
175 integer_t idle_priority
;
176 integer_t minimum_priority
;
177 integer_t maximum_priority
;
180 typedef struct host_priority_info host_priority_info_data_t
;
181 typedef struct host_priority_info
*host_priority_info_t
;
182 #define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
183 (sizeof(host_priority_info_data_t)/sizeof(integer_t)))
185 /* host_statistics() */
186 #define HOST_LOAD_INFO 1 /* System loading stats */
187 #define HOST_VM_INFO 2 /* Virtual memory stats */
188 #define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
190 struct host_load_info
{
191 integer_t avenrun
[3]; /* scaled by LOAD_SCALE */
192 integer_t mach_factor
[3]; /* scaled by LOAD_SCALE */
195 typedef struct host_load_info host_load_info_data_t
;
196 typedef struct host_load_info
*host_load_info_t
;
197 #define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
198 (sizeof(host_load_info_data_t)/sizeof(integer_t)))
200 /* in <mach/vm_statistics.h> */
201 #define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
202 (sizeof(vm_statistics_data_t)/sizeof(integer_t)))
203 #define HOST_VM_INFO_REV0_COUNT ((mach_msg_type_number_t) \
204 (sizeof(vm_statistics_rev0_data_t)/sizeof(integer_t)))
206 struct host_cpu_load_info
{ /* number of ticks while running... */
207 natural_t cpu_ticks
[CPU_STATE_MAX
]; /* ... in the given mode */
210 typedef struct host_cpu_load_info host_cpu_load_info_data_t
;
211 typedef struct host_cpu_load_info
*host_cpu_load_info_t
;
212 #define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
213 (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
215 #endif /* _MACH_HOST_INFO_H_ */