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 .\" FIXME glibc 2.18 added AT_HWCAP2
29 .TH GETAUXVAL 3 2014-04-08 "GNU" "Linux Programmer's Manual"
31 getauxval \- retrieve a value from the auxiliary vector
34 .B #include <sys/auxv.h>
36 .BI "unsigned long getauxval(unsigned long " type );
41 function retrieves values from the auxiliary vector,
42 a mechanism that the kernel's ELF binary loader
43 uses to pass certain information to
44 user space when a program is executed.
46 Each entry in the auxiliary vector consists of a pair of values:
47 a type that identifies what this entry represents,
48 and a value for that type.
52 returns the corresponding value.
54 The value returned for each
56 is given in the following list.
59 values are present on all architectures.
62 The base address of the program interpreter (usually, the dynamic linker).
65 A string identifying the real platform; may differ from
70 The frequency with which
73 This value can also be obtained via
74 .IR sysconf(_SC_CLK_TCK) .
77 The data cache block size.
80 The effective group ID of the thread.
83 The entry address of the executable.
86 The effective user ID of the thread.
89 File descriptor of program.
92 Pathname used to execute program.
98 Used FPU control word (SuperH architecture only).
99 This gives some information about the FPU initialization
100 performed by the kernel.
103 The real group ID of the thread.
106 A pointer to a multibyte mask of bits whose settings
107 indicate detailed processor capabilities.
108 The contents of the bit mask are hardware dependent
109 (for example, see the kernel source file
110 .IR arch/x86/include/asm/cpufeature.h
111 for details relating to the Intel x86 architecture).
112 A human-readable version of the same information is available via
116 The instruction cache block size.
125 The system page size (the same value returned by
126 .IR sysconf(_SC_PAGESIZE) ).
129 The address of the program headers of the executable.
132 The size of program header entry.
135 The number of program headers.
138 A pointer to a string that identifies the hardware platform
139 that the program is running on.
140 The dynamic linker uses this in the interpretation of
145 The address of sixteen bytes containing a random value.
148 Has a nonzero value if this executable should be treated securely.
149 Most commonly, a nonzero value indicates that the process is
150 executing a set-user-ID or set-group-ID program; alternatively,
151 a nonzero value may be triggered by a Linux Security Module.
152 When this value is nonzero,
153 the dynamic linker disables the use of certain environment variables (see
155 and glibc changes other aspects of its behavior.
157 .BR secure_getenv (3).)
160 The entry point to the system call function in the vDSO.
161 Not present/needed on all architectures (e.g., absent on x86-64).
164 The address of a page containing the virtual Dynamic Shared Object (vDSO)
165 that the kernel creates in order to provide fast implementations of
166 certain system calls.
169 The unified cache block size.
172 The real user ID of the thread.
176 returns the value corresponding to
180 is not found, 0 is returned.
182 No errors are diagnosed.
186 function was added to glibc in version 2.16.
188 .SS Multithreading (see pthreads(7))
191 function is thread-safe.
193 This function is a nonstandard glibc extension.
195 The primary consumer of the information in the auxiliary vector
196 is the dynamic linker
198 The auxiliary vector is a convenient and efficient shortcut
199 that allows the kernel to communicate a certain set of standard
200 information that the dynamic linker usually or always needs.
201 In some cases, the same information could be obtained by system calls,
202 but using the auxiliary vector is cheaper.
204 The auxiliary vector resides just above the argument list and
205 environment in the process address space.
206 The auxiliary vector supplied to a program can be viewed by setting the
208 environment variable when running a program:
210 $ LD_SHOW_AUXV=1 sleep 1
212 The auxiliary vector of any process can (subject to file permissions)
217 for more information.
219 .BR secure_getenv (3),
223 This page is part of release 3.65 of the Linux
226 A description of the project,
227 and information about reporting bugs,
229 \%http://www.kernel.org/doc/man\-pages/.