### 26.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.

#### 26.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`.

  Note: There is no relationship between the ‘`AT_`’ constants defined in `elf.h` and the file name lookup flags in `fcntl.h`. See Descriptor-Relative Access.

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.