1 /* 2 * Copyright (c) 2003-2004 Apple Computer, Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 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 License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 29 #ifndef LIBKERN_SYSCTL_H 30 #define LIBKERN_SYSCTL_H 31 32 #include <sys/cdefs.h> 33 34 __BEGIN_DECLS 35 36 #include <sys/types.h> 37 38 /* 39 * These are the support HW selectors for sysctlbyname. Parameters that are byte counts or frequencies are 64 bit numbers. 40 * All other parameters are 32 bit numbers. 41 * 42 * hw.memsize - The number of bytes of physical memory in the system. 43 * 44 * hw.ncpu - The maximum number of processors that could be available this boot. 45 * Use this value for sizing of static per processor arrays; i.e. processor load statistics. 46 * 47 * hw.activecpu - The number of processors currently available for executing threads. 48 * Use this number to determine the number threads to create in SMP aware applications. 49 * This number can change when power management modes are changed. 50 * 51 * hw.physicalcpu - The number of physical processors available in the current power management mode. 52 * hw.physicalcpu_max - The maximum number of physical processors that could be available this boot 53 * 54 * hw.logicalcpu - The number of logical processors available in the current power management mode. 55 * hw.logicalcpu_max - The maximum number of logical processors that could be available this boot 56 * 57 * hw.tbfrequency - This gives the time base frequency used by the OS and is the basis of all timing services. 58 * In general is is better to use mach's or higher level timing services, but this value 59 * is needed to convert the PPC Time Base registers to real time. 60 * 61 * hw.cpufrequency, hw.busfrequency and their min/max versions are deprecated because frequency isn't consistent. 62 * 63 * hw.cpufrequency - (deprecated) These values provide the current, min and max cpu frequency. The min and max are for 64 * hw.cpufrequency_max - (deprecated) all power management modes. The current frequency is the max frequency in the current mode. 65 * hw.cpufrequency_min - (deprecated) All frequencies are in Hz. 66 * 67 * hw.busfrequency - (deprecated) These values provide the current, min and max bus frequency. The min and max are for 68 * hw.busfrequency_max - (deprecated) all power management modes. The current frequency is the max frequency in the current mode. 69 * hw.busfrequency_min - (deprecated) All frequencies are in Hz. 70 * 71 * hw.cputype - These values provide the mach-o cpu type and subtype. A complete list is in <mach/machine.h> 72 * hw.cpusubtype - These values should be used to determine what processor family the running cpu is from so that 73 * the best binary can be chosen, or the best dynamic code generated. They should not be used 74 * to determine if a given processor feature is available. 75 * hw.cputhreadtype - This value will be present if the processor supports threads. Like hw.cpusubtype this selector 76 * should not be used to infer features, and only used to name the processors thread architecture. 77 * The values are defined in <mach/machine.h> 78 * 79 * hw.byteorder - Gives the byte order of the processor. 4321 for big endian, 1234 for little. 80 * 81 * hw.pagesize - Gives the size in bytes of the pages used by the processor and VM system. 82 * 83 * hw.cachelinesize - Gives the size in bytes of the processor's cache lines. 84 * This value should be use to control the strides of loops that use cache control instructions 85 * like dcbz, dcbt or dcbst. 86 * 87 * hw.l1dcachesize - These values provide the size in bytes of the L1, L2 and L3 caches. If a cache is not present 88 * hw.l1icachesize - then the selector will return and error. 89 * hw.l2cachesize - 90 * hw.l3cachesize - 91 * 92 * 93 * These are the selectors for optional processor features. Selectors that return errors are not support on the system. 94 * Supported features will return 1 if they are recommended or 0 if they are supported but are not expected to help performance. 95 * Future versions of these selectors may return larger values as necessary so it is best to test for non zero. 96 * 97 * hw.optional.floatingpoint - Floating Point Instructions 98 * hw.optional.altivec - AltiVec Instructions 99 * hw.optional.graphicsops - Graphics Operations 100 * hw.optional.64bitops - 64-bit Instructions 101 * hw.optional.fsqrt - HW Floating Point Square Root Instruction 102 * hw.optional.stfiwx - Store Floating Point as Integer Word Indexed Instructions 103 * hw.optional.dcba - Data Cache Block Allocate Instruction 104 * hw.optional.datastreams - Data Streams Instructions 105 * hw.optional.dcbtstreams - Data Cache Block Touch Steams Instruction Form 106 * 107 */ 108 109 /* 110 * Sysctl handling 111 */ 112 #ifdef XNU_KERNEL_PRIVATE 113 int kernel_sysctlbyname(const char *, void *, size_t *, void *, size_t); 114 #else 115 int sysctlbyname(const char *, void *, size_t *, void *, size_t); 116 #endif 117 118 __END_DECLS 119 120 #endif /* LIBKERN_SYSCTL_H */ 121