1 .\" Copyright 2012 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" See also https://lwn.net/Articles/519085/
27 .TH GETAUXVAL 3 2017-09-15 "GNU" "Linux Programmer's Manual"
29 getauxval \- retrieve a value from the auxiliary vector
32 .B #include <sys/auxv.h>
34 .BI "unsigned long getauxval(unsigned long " type );
39 function retrieves values from the auxiliary vector,
40 a mechanism that the kernel's ELF binary loader
41 uses to pass certain information to
42 user space when a program is executed.
44 Each entry in the auxiliary vector consists of a pair of values:
45 a type that identifies what this entry represents,
46 and a value for that type.
50 returns the corresponding value.
52 The value returned for each
54 is given in the following list.
57 values are present on all architectures.
60 The base address of the program interpreter (usually, the dynamic linker).
63 A string identifying the real platform; may differ from
68 The frequency with which
71 This value can also be obtained via
72 .IR sysconf(_SC_CLK_TCK) .
75 The data cache block size.
78 The effective group ID of the thread.
81 The entry address of the executable.
84 The effective user ID of the thread.
87 File descriptor of program.
90 Pathname used to execute program.
96 Used FPU control word (SuperH architecture only).
97 This gives some information about the FPU initialization
98 performed by the kernel.
101 The real group ID of the thread.
104 An architecture and ABI dependent bit-mask whose settings
105 indicate detailed processor capabilities.
106 The contents of the bit mask are hardware dependent
107 (for example, see the kernel source file
108 .IR arch/x86/include/asm/cpufeature.h
109 for details relating to the Intel x86 architecture; the value
110 returned is the first 32-bit word of the array described there).
111 A human-readable version of the same information is available via
114 .BR AT_HWCAP2 " (since glibc 2.18)"
115 Further machine-dependent hints about processor capabilities.
118 The instruction cache block size.
127 The system page size (the same value returned by
128 .IR sysconf(_SC_PAGESIZE) ).
131 The address of the program headers of the executable.
134 The size of program header entry.
137 The number of program headers.
140 A pointer to a string that identifies the hardware platform
141 that the program is running on.
142 The dynamic linker uses this in the interpretation of
147 The address of sixteen bytes containing a random value.
150 Has a nonzero value if this executable should be treated securely.
151 Most commonly, a nonzero value indicates that the process is
152 executing a set-user-ID or set-group-ID binary
153 (so that its real and effective UIDs or GIDs differ from one another),
154 or that it gained capabilities by executing
155 a binary file that has capabilities (see
156 .BR capabilities (7)).
158 a nonzero value may be triggered by a Linux Security Module.
159 When this value is nonzero,
160 the dynamic linker disables the use of certain environment variables (see
162 and glibc changes other aspects of its behavior.
164 .BR secure_getenv (3).)
167 The entry point to the system call function in the vDSO.
168 Not present/needed on all architectures (e.g., absent on x86-64).
171 The address of a page containing the virtual Dynamic Shared Object (vDSO)
172 that the kernel creates in order to provide fast implementations of
173 certain system calls.
176 The unified cache block size.
179 The real user ID of the thread.
183 returns the value corresponding to
187 is not found, 0 is returned.
190 .BR ENOENT " (since glibc 2.19)"
191 .\" commit b9ab448f980e296eac21ac65f53783967cc6037b
192 No entry corresponding to
194 could be found in the auxiliary vector.
198 function was added to glibc in version 2.16.
200 For an explanation of the terms used in this section, see
206 Interface Attribute Value
209 T} Thread safety MT-Safe
212 This function is a nonstandard glibc extension.
214 The primary consumer of the information in the auxiliary vector
215 is the dynamic linker
217 The auxiliary vector is a convenient and efficient shortcut
218 that allows the kernel to communicate a certain set of standard
219 information that the dynamic linker usually or always needs.
220 In some cases, the same information could be obtained by system calls,
221 but using the auxiliary vector is cheaper.
223 The auxiliary vector resides just above the argument list and
224 environment in the process address space.
225 The auxiliary vector supplied to a program can be viewed by setting the
227 environment variable when running a program:
231 $ LD_SHOW_AUXV=1 sleep 1
235 The auxiliary vector of any process can (subject to file permissions)
237 .IR /proc/[pid]/auxv ;
240 for more information.
242 Before the addition of the
245 there was no way to unambiguously distinguish the case where
247 could not be found from the case where the value corresponding to
251 .BR secure_getenv (3),