]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/host_info.h
xnu-344.49.tar.gz
[apple/xnu.git] / osfmk / mach / host_info.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37
A
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
1c79356b
A
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25/*
26 * @OSF_COPYRIGHT@
27 */
1c79356b
A
28/*
29 * Mach Operating System
30 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
31 * All Rights Reserved.
32 *
33 * Permission to use, copy, modify and distribute this software and its
34 * documentation is hereby granted, provided that both the copyright
35 * notice and this permission notice appear in all copies of the
36 * software, derivative works or modified versions, and any portions
37 * thereof, and that both notices appear in supporting documentation.
38 *
39 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
40 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
42 *
43 * Carnegie Mellon requests users of this software to return to
44 *
45 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
46 * School of Computer Science
47 * Carnegie Mellon University
48 * Pittsburgh PA 15213-3890
49 *
50 * any improvements or extensions that they make and grant Carnegie Mellon
51 * the rights to redistribute these changes.
52 */
53/*
54 */
55
56/*
57 * File: mach/host_info.h
58 *
59 * Definitions for host_info call.
60 */
61
62#ifndef _MACH_HOST_INFO_H_
63#define _MACH_HOST_INFO_H_
64
65#include <mach/vm_statistics.h>
66#include <mach/machine.h>
67#include <mach/machine/vm_types.h>
68#include <mach/time_value.h>
69
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
84#define KERNEL_BOOTMAGIC_MAX (8192)
85
86/*
87 * Currently defined information.
88 */
89/* host_info() */
90typedef integer_t host_flavor_t;
91#define HOST_BASIC_INFO 1 /* basic info */
92#define HOST_SCHED_INFO 3 /* scheduling info */
93#define HOST_RESOURCE_SIZES 4 /* kernel struct sizes */
94#define HOST_PRIORITY_INFO 5 /* priority information */
9bccf70c
A
95#define HOST_SEMAPHORE_TRAPS 7 /* Has semaphore traps */
96#define HOST_MACH_MSG_TRAP 8 /* Has mach_msg_trap */
1c79356b
A
97
98struct host_basic_info {
99 integer_t max_cpus; /* max number of cpus possible */
100 integer_t avail_cpus; /* number of cpus now available */
101 vm_size_t memory_size; /* size of memory in bytes */
102 cpu_type_t cpu_type; /* cpu type */
103 cpu_subtype_t cpu_subtype; /* cpu subtype */
104};
105
106typedef struct host_basic_info host_basic_info_data_t;
107typedef struct host_basic_info *host_basic_info_t;
108#define HOST_BASIC_INFO_COUNT \
109 (sizeof(host_basic_info_data_t)/sizeof(integer_t))
110
111struct host_sched_info {
112 integer_t min_timeout; /* minimum timeout in milliseconds */
113 integer_t min_quantum; /* minimum quantum in milliseconds */
114};
115
116typedef struct host_sched_info host_sched_info_data_t;
117typedef struct host_sched_info *host_sched_info_t;
118#define HOST_SCHED_INFO_COUNT \
119 (sizeof(host_sched_info_data_t)/sizeof(integer_t))
120
121struct kernel_resource_sizes {
122 vm_size_t task;
123 vm_size_t thread;
124 vm_size_t port;
125 vm_size_t memory_region;
126 vm_size_t memory_object;
127};
128
129typedef struct kernel_resource_sizes kernel_resource_sizes_data_t;
130typedef struct kernel_resource_sizes *kernel_resource_sizes_t;
131#define HOST_RESOURCE_SIZES_COUNT \
132 (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))
133
134struct host_priority_info {
135 integer_t kernel_priority;
136 integer_t system_priority;
137 integer_t server_priority;
138 integer_t user_priority;
139 integer_t depress_priority;
140 integer_t idle_priority;
141 integer_t minimum_priority;
142 integer_t maximum_priority;
143};
144
145typedef struct host_priority_info host_priority_info_data_t;
146typedef struct host_priority_info *host_priority_info_t;
147#define HOST_PRIORITY_INFO_COUNT \
148 (sizeof(host_priority_info_data_t)/sizeof(integer_t))
149
150/* host_statistics() */
151#define HOST_LOAD_INFO 1 /* System loading stats */
152#define HOST_VM_INFO 2 /* Virtual memory stats */
153#define HOST_CPU_LOAD_INFO 3 /* CPU load stats */
154
155struct host_load_info {
156 integer_t avenrun[3]; /* scaled by LOAD_SCALE */
157 integer_t mach_factor[3]; /* scaled by LOAD_SCALE */
158};
159
160typedef struct host_load_info host_load_info_data_t;
161typedef struct host_load_info *host_load_info_t;
162#define HOST_LOAD_INFO_COUNT \
163 (sizeof(host_load_info_data_t)/sizeof(integer_t))
164
165/* in <mach/vm_statistics.h> */
166#define HOST_VM_INFO_COUNT \
167 (sizeof(vm_statistics_data_t)/sizeof(integer_t))
168
169struct host_cpu_load_info { /* number of ticks while running... */
170 unsigned long cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
171};
172typedef struct host_cpu_load_info host_cpu_load_info_data_t;
173typedef struct host_cpu_load_info *host_cpu_load_info_t;
174#define HOST_CPU_LOAD_INFO_COUNT \
175 (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))
176
1c79356b 177#endif /* _MACH_HOST_INFO_H_ */