Next: Host Time, Previous: Host Ports, Up: Host Interface
The
host_info
function returns various information about host. host_info is an array of integers that is supplied by the caller. It will be filled with the requested information. host_info_count is supplied as the maximum number of integers in host_info. On return, it contains the actual number of integers in host_info. The maximum number of integers returned by any flavor isHOST_INFO_MAX
.The type of information returned is defined by flavor, which can be one of the following:
HOST_BASIC_INFO
- The function returns basic information about the host, as defined by
host_basic_info_t
. This includes the number of processors, their type, and the amount of memory installed in the system. The number of integers returned isHOST_BASIC_INFO_COUNT
. For how to get more information about the processor, see Processor Interface.HOST_PROCESSOR_SLOTS
- The function returns the numbers of the slots with active processors in them. The number of integers returned can be up to
max_cpus
, as returned by theHOST_BASIC_INFO
flavor ofhost_info
.HOST_SCHED_INFO
- The function returns information of interest to schedulers as defined by
host_sched_info_t
. The number of integers returned isHOST_SCHED_INFO_COUNT
.The function returns
KERN_SUCCESS
if the call succeeded andKERN_INVALID_ARGUMENT
if host is not a host or flavor is not recognized. The function returnsMIG_ARRAY_TOO_LARGE
if the returned info array is too large for host_info. In this case, host_info is filled as much as possible and host_info_count is set to the number of elements that would be returned if there were enough room.
A pointer to this structure is returned in host_info by the
host_info
function and provides basic information about the host. You can cast a variable of typehost_info_t
to a pointer of this type if you provided it as the host_info parameter for theHOST_BASIC_INFO
flavor ofhost_info
. It has the following members:
int max_cpus
- The maximum number of possible processors for which the kernel is configured.
int avail_cpus
- The number of cpus currently available.
vm_size_t memory_size
- The size of physical memory in bytes.
cpu_type_t cpu_type
- The type of the master processor.
cpu_subtype_t cpu_subtype
- The subtype of the master processor.
The type and subtype of the individual processors are also available by
processor_info
, see Processor Interface.
A pointer to this structure is returned in host_info by the
host_info
function and provides information of interest to schedulers. You can cast a variable of typehost_info_t
to a pointer of this type if you provided it as the host_info parameter for theHOST_SCHED_INFO
flavor ofhost_info
. It has the following members:
int min_timeout
- The minimum timeout and unit of time in milliseconds.
int min_quantum
- The minimum quantum and unit of quantum in milliseconds.
The
host_kernel_version
function returns the version string compiled into the kernel executing on host at the time it was built in the character string version. This string describes the version of the kernel. The constantKERNEL_VERSION_MAX
should be used to dimension storage for the returned string if thekernel_version_t
declaration is not used.If the version string compiled into the kernel is longer than
KERNEL_VERSION_MAX
, the result is truncated and not necessarily null-terminated.If host is not a valid send right to a host port, the function returns
KERN_INVALID_ARGUMENT
. If version points to inaccessible memory, it returnsKERN_INVALID_ADDRESS
, andKERN_SUCCESS
otherwise.
The
host_get_boot_info
function returns the boot-time information string supplied by the operator to the kernel executing on host_priv in the character string boot_info. The constantKERNEL_BOOT_INFO_MAX
should be used to dimension storage for the returned string if thekernel_boot_info_t
declaration is not used.If the boot-time information string supplied by the operator is longer than
KERNEL_BOOT_INFO_MAX
, the result is truncated and not necessarily null-terminated.