1GETAUXVAL(3) Linux Programmer's Manual GETAUXVAL(3)
2
3
4
6 getauxval - retrieve a value from the auxiliary vector
7
9 #include <sys/auxv.h>
10
11 unsigned long getauxval(unsigned long type);
12
14 The getauxval() function retrieves values from the auxiliary vector, a
15 mechanism that the kernel's ELF binary loader uses to pass certain
16 information to user space when a program is executed.
17
18 Each entry in the auxiliary vector consists of a pair of values: a type
19 that identifies what this entry represents, and a value for that type.
20 Given the argument type, getauxval() returns the corresponding value.
21
22 The value returned for each type is given in the following list. Not
23 all type values are present on all architectures.
24
25 AT_BASE
26 The base address of the program interpreter (usually, the
27 dynamic linker).
28
29 AT_BASE_PLATFORM
30 A string identifying the real platform; may differ from AT_PLAT‐
31 FORM (PowerPC only).
32
33 AT_CLKTCK
34 The frequency with which times(2) counts. This value can also
35 be obtained via sysconf(_SC_CLK_TCK).
36
37 AT_DCACHEBSIZE
38 The data cache block size.
39
40 AT_EGID
41 The effective group ID of the thread.
42
43 AT_ENTRY
44 The entry address of the executable.
45
46 AT_EUID
47 The effective user ID of the thread.
48
49 AT_EXECFD
50 File descriptor of program.
51
52 AT_EXECFN
53 Pathname used to execute program.
54
55 AT_FLAGS
56 Flags (unused).
57
58 AT_FPUCW
59 Used FPU control word (SuperH architecture only). This gives
60 some information about the FPU initialization performed by the
61 kernel.
62
63 AT_GID The real group ID of the thread.
64
65 AT_HWCAP
66 A pointer to a multibyte mask of bits whose settings indicate
67 detailed processor capabilities. The contents of the bit mask
68 are hardware dependent (for example, see the kernel source file
69 arch/x86/include/asm/cpufeature.h for details relating to the
70 Intel x86 architecture). A human-readable version of the same
71 information is available via /proc/cpuinfo.
72
73 AT_ICACHEBSIZE
74 The instruction cache block size.
75
76 AT_PAGESZ
77 The system page size (the same value returned by
78 sysconf(_SC_PAGESIZE)).
79
80 AT_PHDR
81 The address of the program headers of the executable.
82
83 AT_PHENT
84 The size of program header entry.
85
86 AT_PHNUM
87 The number of program headers.
88
89 AT_PLATFORM
90 A pointer to a string that identifies the hardware platform that
91 the program is running on. The dynamic linker uses this in the
92 interpretation of rpath values.
93
94 AT_RANDOM
95 The address of sixteen bytes containing a random value.
96
97 AT_SECURE
98 Has a nonzero value if this executable should be treated
99 securely. Most commonly, a nonzero value indicates that the
100 process is executing a set-user-ID or set-group-ID program;
101 alternatively, a nonzero value may be triggered by a Linux Secu‐
102 rity Module. When this value is nonzero, the dynamic linker
103 disables the use of certain environment variables (see ld-
104 linux.so(8)) and glibc changes other aspects of its behavior.
105 (See also secure_getenv(3).)
106
107 AT_SYSINFO
108 The entry point to the system call function in the VDSO. Not
109 present/needed on all architectures (e.g., absent on x86-64).
110
111 AT_SYSINFO_EHDR
112 The address of a page containing the Virtual Dynamic Shared
113 Object (VDSO) that the kernel creates in order to provide fast
114 implementations of certain system calls.
115
116 AT_UCACHEBSIZE
117 The unified cache block size.
118
119 AT_UID The real user ID of the thread.
120
122 On success, getauxval() returns the value corresponding to type. If
123 type is not found, 0 is returned.
124
126 No errors are diagnosed.
127
129 The getauxval() function was added to glibc in version 2.16.
130
132 This function is a nonstandard glibc extension.
133
135 The primary consumer of the information in the auxiliary vector is the
136 dynamic linker ld-linux.so(8). The auxiliary vector is a convenient
137 and efficient shortcut that allows the kernel to communicate a certain
138 set of standard information that the dynamic linker usually or always
139 needs. In some cases, the same information could be obtained by system
140 calls, but using the auxiliary vector is cheaper.
141
142 The auxiliary vector resides just above the argument list and environ‐
143 ment in the process address space. The auxiliary vector supplied to a
144 program can be viewed by setting the LD_SHOW_AUXV environment variable
145 when running a program:
146
147 $ LD_SHOW_AUXV=1 sleep 1
148
149 The auxiliary vector of any process can (subject to file permissions)
150 be obtained via /proc/PID/auxv; see proc(5) for more information.
151
153 secure_getenv(3), ld-linux.so(8)
154
155 The kernel source file Documentation/ABI/stable/vdso
156
158 This page is part of release 3.53 of the Linux man-pages project. A
159 description of the project, and information about reporting bugs, can
160 be found at http://www.kernel.org/doc/man-pages/.
161
162
163
164GNU 2012-11-07 GETAUXVAL(3)