When a program is executed, it receives information from the operating
system about the environment in which it is operating. The form of this
information is a table of key-value pairs, where the keys are from the
set of ‘AT_’ values in elf.h. Some of the data is provided
by the kernel for libc consumption, and may be obtained by ordinary
interfaces, such as sysconf
. However, on a platform-by-platform
basis there may be information that is not available any other way.
getauxval
This function is used to inquire about the entries in the auxiliary vector. The type argument should be one of the ‘AT_’ symbols defined in elf.h. If a matching entry is found, the value is returned; if the entry is not found, zero is returned.
For some platforms, the key AT_HWCAP
is the easiest way to inquire
about any instruction set extensions available at runtime. In this case,
there will (of necessity) be a platform-specific set of ‘HWCAP_’
values masked together that describe the capabilities of the cpu on which
the program is being executed.