Next: , Previous: , Up: The Basic Program/System Interface   [Contents][Index]

25.5 Auxiliary Vector

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.

25.5.1 Definition of getauxval

Function: unsigned long int getauxval (unsigned long int type)

Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.

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 and errno is set to ENOENT.

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.