]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/host_info.h
xnu-792.10.96.tar.gz
[apple/xnu.git] / osfmk / mach / host_info.h
CommitLineData
1c79356b 1/*
91447636 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
37839358
A
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.
e5568f75 11 *
37839358
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
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.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 */
1c79356b
A
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
91447636 62#include <mach/message.h>
1c79356b
A
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
91447636
A
68#include <sys/cdefs.h>
69
1c79356b
A
70/*
71 * Generic information structure to allow for expansion.
72 */
73typedef integer_t *host_info_t; /* varying array of int. */
74
75#define HOST_INFO_MAX (1024) /* max array size */
76typedef integer_t host_info_data_t[HOST_INFO_MAX];
77
78#define KERNEL_VERSION_MAX (512)
79typedef char kernel_version_t[KERNEL_VERSION_MAX];
80
81#define KERNEL_BOOT_INFO_MAX (4096)
82typedef char kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
83
1c79356b
A
84/*
85 * Currently defined information.
86 */
87/* host_info() */
88typedef 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 */
9bccf70c
A
93#define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
94#define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
1c79356b 95
91447636
A
96#ifdef MACH_KERNEL_PRIVATE
97struct host_basic_info_old {
1c79356b
A
98 integer_t max_cpus; /* max number of cpus possible */
99 integer_t avail_cpus; /* number of cpus now available */
91447636 100 natural_t memory_size; /* size of memory in bytes */
1c79356b
A
101 cpu_type_t cpu_type; /* cpu type */
102 cpu_subtype_t cpu_subtype; /* cpu subtype */
103};
104
91447636
A
105typedef struct host_basic_info_old host_basic_info_data_old_t;
106typedef 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
c0fea474 111#pragma pack(4)
91447636
A
112
113struct host_basic_info {
114 integer_t max_cpus; /* max number of CPUs possible */
115 integer_t avail_cpus; /* number of CPUs now available */
116 natural_t memory_size; /* size of memory in bytes, capped at 2 GB */
117 cpu_type_t cpu_type; /* cpu type */
118 cpu_subtype_t cpu_subtype; /* cpu subtype */
119 cpu_threadtype_t cpu_threadtype; /* cpu threadtype */
120 integer_t physical_cpu; /* number of physical CPUs now available */
121 integer_t physical_cpu_max; /* max number of physical CPUs possible */
122 integer_t logical_cpu; /* number of logical cpu now available */
123 integer_t logical_cpu_max; /* max number of physical CPUs possible */
124 uint64_t max_mem; /* actual size of physical memory */
125};
126
c0fea474 127#pragma pack()
91447636 128
1c79356b
A
129typedef struct host_basic_info host_basic_info_data_t;
130typedef struct host_basic_info *host_basic_info_t;
91447636
A
131#define HOST_BASIC_INFO_COUNT ((mach_msg_type_number_t) \
132 (sizeof(host_basic_info_data_t)/sizeof(integer_t)))
1c79356b
A
133
134struct host_sched_info {
135 integer_t min_timeout; /* minimum timeout in milliseconds */
136 integer_t min_quantum; /* minimum quantum in milliseconds */
137};
138
139typedef struct host_sched_info host_sched_info_data_t;
140typedef struct host_sched_info *host_sched_info_t;
91447636
A
141#define HOST_SCHED_INFO_COUNT ((mach_msg_type_number_t) \
142 (sizeof(host_sched_info_data_t)/sizeof(integer_t)))
1c79356b
A
143
144struct kernel_resource_sizes {
91447636
A
145 natural_t task;
146 natural_t thread;
147 natural_t port;
148 natural_t memory_region;
149 natural_t memory_object;
1c79356b
A
150};
151
152typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
153typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
91447636
A
154#define HOST_RESOURCE_SIZES_COUNT ((mach_msg_type_number_t) \
155 (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t)))
1c79356b
A
156
157struct host_priority_info {
158 integer_t kernel_priority;
159 integer_t system_priority;
160 integer_t server_priority;
161 integer_t user_priority;
162 integer_t depress_priority;
163 integer_t idle_priority;
164 integer_t minimum_priority;
165 integer_t maximum_priority;
166};
167
168typedef struct host_priority_info host_priority_info_data_t;
169typedef struct host_priority_info *host_priority_info_t;
91447636
A
170#define HOST_PRIORITY_INFO_COUNT ((mach_msg_type_number_t) \
171 (sizeof(host_priority_info_data_t)/sizeof(integer_t)))
1c79356b
A
172
173/* host_statistics() */
174#define HOST_LOAD_INFO 1 /* System loading stats */
175#define HOST_VM_INFO 2 /* Virtual memory stats */
176#define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
177
178struct host_load_info {
179 integer_t avenrun[3]; /* scaled by LOAD_SCALE */
180 integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
181};
182
183typedef struct host_load_info host_load_info_data_t;
184typedef struct host_load_info *host_load_info_t;
91447636
A
185#define HOST_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
186 (sizeof(host_load_info_data_t)/sizeof(integer_t)))
1c79356b
A
187
188/* in <mach/vm_statistics.h> */
91447636
A
189#define HOST_VM_INFO_COUNT ((mach_msg_type_number_t) \
190 (sizeof(vm_statistics_data_t)/sizeof(integer_t)))
191#define HOST_VM_INFO_REV0_COUNT ((mach_msg_type_number_t) \
192 (sizeof(vm_statistics_rev0_data_t)/sizeof(integer_t)))
1c79356b
A
193
194struct host_cpu_load_info { /* number of ticks while running... */
91447636 195 natural_t cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
1c79356b 196};
91447636 197
1c79356b
A
198typedef struct host_cpu_load_info host_cpu_load_info_data_t;
199typedef struct host_cpu_load_info *host_cpu_load_info_t;
91447636
A
200#define HOST_CPU_LOAD_INFO_COUNT ((mach_msg_type_number_t) \
201 (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t)))
1c79356b 202
1c79356b 203#endif /* _MACH_HOST_INFO_H_ */