403 lines
9.3 KiB
HTML
403 lines
9.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GETAUXVAL</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GETAUXVAL</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2019-10-10<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
getauxval - retrieve a value from the auxiliary vector
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/auxv.h">sys/auxv.h</A>></B>
|
|
|
|
<B>unsigned long getauxval(unsigned long </B><I>type</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>getauxval</B>()
|
|
|
|
function retrieves values from the auxiliary vector,
|
|
a mechanism that the kernel's ELF binary loader
|
|
uses to pass certain information to
|
|
user space when a program is executed.
|
|
<P>
|
|
|
|
Each entry in the auxiliary vector consists of a pair of values:
|
|
a type that identifies what this entry represents,
|
|
and a value for that type.
|
|
Given the argument
|
|
<I>type</I>,
|
|
|
|
<B>getauxval</B>()
|
|
|
|
returns the corresponding value.
|
|
<P>
|
|
|
|
The value returned for each
|
|
<I>type</I>
|
|
|
|
is given in the following list.
|
|
Not all
|
|
<I>type</I>
|
|
|
|
values are present on all architectures.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>AT_BASE</B>
|
|
|
|
<DD>
|
|
The base address of the program interpreter (usually, the dynamic linker).
|
|
<DT id="2"><B>AT_BASE_PLATFORM</B>
|
|
|
|
<DD>
|
|
A pointer to a string identifying the real platform; may differ from
|
|
<B>AT_PLATFORM</B>
|
|
|
|
(PowerPC only).
|
|
<DT id="3"><B>AT_CLKTCK</B>
|
|
|
|
<DD>
|
|
The frequency with which
|
|
<B><A HREF="/cgi-bin/man/man2html?2+times">times</A></B>(2)
|
|
|
|
counts.
|
|
This value can also be obtained via
|
|
<I>sysconf(_SC_CLK_TCK)</I>.
|
|
|
|
<DT id="4"><B>AT_DCACHEBSIZE</B>
|
|
|
|
<DD>
|
|
The data cache block size.
|
|
<DT id="5"><B>AT_EGID</B>
|
|
|
|
<DD>
|
|
The effective group ID of the thread.
|
|
<DT id="6"><B>AT_ENTRY</B>
|
|
|
|
<DD>
|
|
The entry address of the executable.
|
|
<DT id="7"><B>AT_EUID</B>
|
|
|
|
<DD>
|
|
The effective user ID of the thread.
|
|
<DT id="8"><B>AT_EXECFD</B>
|
|
|
|
<DD>
|
|
File descriptor of program.
|
|
<DT id="9"><B>AT_EXECFN</B>
|
|
|
|
<DD>
|
|
A pointer to a string containing the pathname used to execute the program.
|
|
<DT id="10"><B>AT_FLAGS</B>
|
|
|
|
<DD>
|
|
Flags (unused).
|
|
<DT id="11"><B>AT_FPUCW</B>
|
|
|
|
<DD>
|
|
Used FPU control word (SuperH architecture only).
|
|
This gives some information about the FPU initialization
|
|
performed by the kernel.
|
|
<DT id="12"><B>AT_GID</B>
|
|
|
|
<DD>
|
|
The real group ID of the thread.
|
|
<DT id="13"><B>AT_HWCAP</B>
|
|
|
|
<DD>
|
|
An architecture and ABI dependent bit-mask whose settings
|
|
indicate detailed processor capabilities.
|
|
The contents of the bit mask are hardware dependent
|
|
(for example, see the kernel source file
|
|
<I>arch/x86/include/asm/cpufeature.h</I>
|
|
|
|
for details relating to the Intel x86 architecture; the value
|
|
returned is the first 32-bit word of the array described there).
|
|
A human-readable version of the same information is available via
|
|
<I>/proc/cpuinfo</I>.
|
|
|
|
<DT id="14"><B>AT_HWCAP2</B> (since glibc 2.18)
|
|
|
|
<DD>
|
|
Further machine-dependent hints about processor capabilities.
|
|
<DT id="15"><B>AT_ICACHEBSIZE</B>
|
|
|
|
<DD>
|
|
The instruction cache block size.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<DT id="16">
|
|
<DD>
|
|
<B>AT_L1D_CACHEGEOMETRY</B>
|
|
|
|
Geometry of the L1 data cache, encoded with the cache line size in bytes
|
|
in the bottom 16 bits and the cache associativity in the next 16 bits.
|
|
The associativity is such that if N is the 16-bit value,
|
|
the cache is N-way set associative.
|
|
<DT id="17"><B>AT_L1D_CACHESIZE</B>
|
|
|
|
<DD>
|
|
The L1 data cache size.
|
|
<DT id="18"><B>AT_L1I_CACHEGEOMETRY</B>
|
|
|
|
<DD>
|
|
Geometry of the L1 instruction cache, encoded as for
|
|
<B>AT_L1D_CACHEGEOMETRY</B>.
|
|
|
|
<DT id="19"><B>AT_L1I_CACHESIZE</B>
|
|
|
|
<DD>
|
|
The L1 instruction cache size.
|
|
<DT id="20"><B>AT_L2_CACHEGEOMETRY</B>
|
|
|
|
<DD>
|
|
Geometry of the L2 cache, encoded as for
|
|
<B>AT_L1D_CACHEGEOMETRY</B>.
|
|
|
|
<DT id="21"><B>AT_L2_CACHESIZE</B>
|
|
|
|
<DD>
|
|
The L2 cache size.
|
|
<DT id="22"><B>AT_L3_CACHEGEOMETRY</B>
|
|
|
|
<DD>
|
|
Geometry of the L3 cache, encoded as for
|
|
<B>AT_L1D_CACHEGEOMETRY</B>.
|
|
|
|
<DT id="23"><B>AT_L3_CACHESIZE</B>
|
|
|
|
<DD>
|
|
The L3 cache size.
|
|
<DT id="24"><B>AT_PAGESZ</B>
|
|
|
|
<DD>
|
|
The system page size (the same value returned by
|
|
<I>sysconf(_SC_PAGESIZE)</I>).
|
|
|
|
<DT id="25"><B>AT_PHDR</B>
|
|
|
|
<DD>
|
|
The address of the program headers of the executable.
|
|
<DT id="26"><B>AT_PHENT</B>
|
|
|
|
<DD>
|
|
The size of program header entry.
|
|
<DT id="27"><B>AT_PHNUM</B>
|
|
|
|
<DD>
|
|
The number of program headers.
|
|
<DT id="28"><B>AT_PLATFORM</B>
|
|
|
|
<DD>
|
|
A pointer to a string that identifies the hardware platform
|
|
that the program is running on.
|
|
The dynamic linker uses this in the interpretation of
|
|
<I>rpath</I>
|
|
|
|
values.
|
|
<DT id="29"><B>AT_RANDOM</B>
|
|
|
|
<DD>
|
|
The address of sixteen bytes containing a random value.
|
|
<DT id="30"><B>AT_SECURE</B>
|
|
|
|
<DD>
|
|
Has a nonzero value if this executable should be treated securely.
|
|
Most commonly, a nonzero value indicates that the process is
|
|
executing a set-user-ID or set-group-ID binary
|
|
(so that its real and effective UIDs or GIDs differ from one another),
|
|
or that it gained capabilities by executing
|
|
a binary file that has capabilities (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7)).
|
|
|
|
Alternatively,
|
|
a nonzero value may be triggered by a Linux Security Module.
|
|
When this value is nonzero,
|
|
the dynamic linker disables the use of certain environment variables (see
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ld-linux.so">ld-linux.so</A></B>(8))
|
|
|
|
and glibc changes other aspects of its behavior.
|
|
(See also
|
|
<B><A HREF="/cgi-bin/man/man2html?3+secure_getenv">secure_getenv</A></B>(3).)
|
|
|
|
<DT id="31"><B>AT_SYSINFO</B>
|
|
|
|
<DD>
|
|
The entry point to the system call function in the vDSO.
|
|
Not present/needed on all architectures (e.g., absent on x86-64).
|
|
<DT id="32"><B>AT_SYSINFO_EHDR</B>
|
|
|
|
<DD>
|
|
The address of a page containing the virtual Dynamic Shared Object (vDSO)
|
|
that the kernel creates in order to provide fast implementations of
|
|
certain system calls.
|
|
<DT id="33"><B>AT_UCACHEBSIZE</B>
|
|
|
|
<DD>
|
|
The unified cache block size.
|
|
<DT id="34"><B>AT_UID</B>
|
|
|
|
<DD>
|
|
The real user ID of the thread.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>getauxval</B>()
|
|
|
|
returns the value corresponding to
|
|
<I>type</I>.
|
|
|
|
If
|
|
<I>type</I>
|
|
|
|
is not found, 0 is returned.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="35"><B>ENOENT</B> (since glibc 2.19)
|
|
|
|
<DD>
|
|
|
|
No entry corresponding to
|
|
<I>type</I>
|
|
|
|
could be found in the auxiliary vector.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>getauxval</B>()
|
|
|
|
function was added to glibc in version 2.16.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>getauxval</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
This function is a nonstandard glibc extension.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The primary consumer of the information in the auxiliary vector
|
|
is the dynamic linker,
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ld-linux.so">ld-linux.so</A></B>(8).
|
|
|
|
The auxiliary vector is a convenient and efficient shortcut
|
|
that allows the kernel to communicate a certain set of standard
|
|
information that the dynamic linker usually or always needs.
|
|
In some cases, the same information could be obtained by system calls,
|
|
but using the auxiliary vector is cheaper.
|
|
<P>
|
|
|
|
The auxiliary vector resides just above the argument list and
|
|
environment in the process address space.
|
|
The auxiliary vector supplied to a program can be viewed by setting the
|
|
<B>LD_SHOW_AUXV</B>
|
|
|
|
environment variable when running a program:
|
|
<P>
|
|
|
|
|
|
|
|
$ LD_SHOW_AUXV=1 sleep 1
|
|
|
|
|
|
<P>
|
|
|
|
The auxiliary vector of any process can (subject to file permissions)
|
|
be obtained via
|
|
<I>/proc/[pid]/auxv</I>;
|
|
|
|
see
|
|
<B><A HREF="/cgi-bin/man/man2html?5+proc">proc</A></B>(5)
|
|
|
|
for more information.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
Before the addition of the
|
|
<B>ENOENT</B>
|
|
|
|
error in glibc 2.19,
|
|
there was no way to unambiguously distinguish the case where
|
|
<I>type</I>
|
|
|
|
could not be found from the case where the value corresponding to
|
|
<I>type</I>
|
|
|
|
was zero.
|
|
<A NAME="lbAL"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+secure_getenv">secure_getenv</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+vdso">vdso</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ld-linux.so">ld-linux.so</A></B>(8)
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="36"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="37"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="38"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="39"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="40"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="41"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="42"><A HREF="#lbAH">ATTRIBUTES</A><DD>
|
|
<DT id="43"><A HREF="#lbAI">CONFORMING TO</A><DD>
|
|
<DT id="44"><A HREF="#lbAJ">NOTES</A><DD>
|
|
<DT id="45"><A HREF="#lbAK">BUGS</A><DD>
|
|
<DT id="46"><A HREF="#lbAL">SEE ALSO</A><DD>
|
|
<DT id="47"><A HREF="#lbAM">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:44 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|