home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / mach / host_info.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  5.6 KB  |  174 lines

  1. /*
  2.  * Copyright (c) 2000 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/vm_statistics.h>
  63. #include <mach/machine.h>
  64. #include <mach/machine/vm_types.h>
  65. #include <mach/time_value.h>
  66.  
  67. /*
  68.  *    Generic information structure to allow for expansion.
  69.  */
  70. typedef integer_t    *host_info_t;        /* varying array of int. */
  71.  
  72. #define    HOST_INFO_MAX    (1024)        /* max array size */
  73. typedef integer_t    host_info_data_t[HOST_INFO_MAX];
  74.  
  75. #define KERNEL_VERSION_MAX (512)
  76. typedef char    kernel_version_t[KERNEL_VERSION_MAX];
  77.  
  78. #define KERNEL_BOOT_INFO_MAX (4096)
  79. typedef char    kernel_boot_info_t[KERNEL_BOOT_INFO_MAX];
  80.  
  81. #define    KERNEL_BOOTMAGIC_MAX    (8192)
  82.  
  83. /*
  84.  *    Currently defined information.
  85.  */
  86. /* host_info() */
  87. typedef    integer_t    host_flavor_t;
  88. #define HOST_BASIC_INFO        1    /* basic info */
  89. #define HOST_SCHED_INFO        3    /* scheduling info */
  90. #define HOST_RESOURCE_SIZES    4    /* kernel struct sizes */
  91. #define HOST_PRIORITY_INFO    5    /* priority information */
  92. #define HOST_SEMAPHORE_TRAPS    7    /* Has semaphore traps - temporary */
  93.  
  94. struct host_basic_info {
  95.     integer_t    max_cpus;    /* max number of cpus possible */
  96.     integer_t    avail_cpus;    /* number of cpus now available */
  97.     vm_size_t    memory_size;    /* size of memory in bytes */
  98.     cpu_type_t    cpu_type;    /* cpu type */
  99.     cpu_subtype_t    cpu_subtype;    /* cpu subtype */
  100. };
  101.  
  102. typedef    struct host_basic_info    host_basic_info_data_t;
  103. typedef struct host_basic_info    *host_basic_info_t;
  104. #define HOST_BASIC_INFO_COUNT \
  105.         (sizeof(host_basic_info_data_t)/sizeof(integer_t))
  106.  
  107. struct host_sched_info {
  108.     integer_t    min_timeout;    /* minimum timeout in milliseconds */
  109.     integer_t    min_quantum;    /* minimum quantum in milliseconds */
  110. };
  111.  
  112. typedef    struct host_sched_info    host_sched_info_data_t;
  113. typedef struct host_sched_info    *host_sched_info_t;
  114. #define HOST_SCHED_INFO_COUNT \
  115.         (sizeof(host_sched_info_data_t)/sizeof(integer_t))
  116.  
  117. struct kernel_resource_sizes {
  118.     vm_size_t    task;
  119.         vm_size_t    thread;
  120.         vm_size_t    port;
  121.         vm_size_t    memory_region;
  122.         vm_size_t    memory_object;
  123. };
  124.  
  125. typedef struct kernel_resource_sizes    kernel_resource_sizes_data_t;
  126. typedef struct kernel_resource_sizes    *kernel_resource_sizes_t;
  127. #define HOST_RESOURCE_SIZES_COUNT \
  128.         (sizeof(kernel_resource_sizes_data_t)/sizeof(integer_t))
  129.  
  130. struct host_priority_info {
  131.         integer_t    kernel_priority;
  132.         integer_t    system_priority;
  133.         integer_t    server_priority;
  134.         integer_t    user_priority;
  135.         integer_t    depress_priority;
  136.         integer_t    idle_priority;
  137.         integer_t    minimum_priority;
  138.     integer_t    maximum_priority;
  139. };
  140.  
  141. typedef struct host_priority_info    host_priority_info_data_t;
  142. typedef struct host_priority_info    *host_priority_info_t;
  143. #define HOST_PRIORITY_INFO_COUNT \
  144.         (sizeof(host_priority_info_data_t)/sizeof(integer_t))
  145.  
  146. /* host_statistics() */
  147. #define    HOST_LOAD_INFO        1    /* System loading stats */
  148. #define HOST_VM_INFO        2    /* Virtual memory stats */
  149. #define HOST_CPU_LOAD_INFO    3    /* CPU load stats */
  150.  
  151. struct host_load_info {
  152.     integer_t    avenrun[3];    /* scaled by LOAD_SCALE */
  153.     integer_t    mach_factor[3];    /* scaled by LOAD_SCALE */
  154. };
  155.  
  156. typedef struct host_load_info    host_load_info_data_t;
  157. typedef struct host_load_info    *host_load_info_t;
  158. #define    HOST_LOAD_INFO_COUNT \
  159.         (sizeof(host_load_info_data_t)/sizeof(integer_t))
  160.  
  161. /* in <mach/vm_statistics.h> */
  162. #define    HOST_VM_INFO_COUNT \
  163.         (sizeof(vm_statistics_data_t)/sizeof(integer_t))
  164.  
  165. struct host_cpu_load_info {        /* number of ticks while running... */
  166.     unsigned long    cpu_ticks[CPU_STATE_MAX]; /* ... in the given mode */
  167. };
  168. typedef struct host_cpu_load_info    host_cpu_load_info_data_t;
  169. typedef struct host_cpu_load_info    *host_cpu_load_info_t;
  170. #define HOST_CPU_LOAD_INFO_COUNT \
  171.         (sizeof (host_cpu_load_info_data_t) / sizeof (integer_t))
  172.  
  173. #endif    /* _MACH_HOST_INFO_H_ */
  174.