GELF_GETAUXV(3)
π GELF_GETAUXV π
okay so bestie, welcome to gelf_getauxv β a page from the Libelf Programmer's Manual (yes, that libelf, the one that lives in elfutils land) π
β¨ NAME β¨
gelf_getauxv β grab class-independent info out of an auxiliary vector at whatever index you want, no cap π
πΈ SYNOPSIS πΈ
#include <gelf.h>
GElf_auxv_t *gelf_getauxv (Elf_Data *data, int ndx, GElf_auxv_t *dst);
π¦ DESCRIPTION π¦
So the whole vibe is: you pull one auxiliary vector entry out of data, at index ndx, and you tuck it into the class-independent representation that dst is pointing at. That's it. That's the function. β¨
Now here's the part you cannot skip, iykyk: data must be an Elf_Data* that's associated with an ELF note of type NT_AUXV, and its d_type must be set to ELF_T_AUXV. Not optional. Not negotiable. π
If you need to get an Elf_Data* that actually has a d_type of ELF_T_AUXV, that's what elf_getdata_rawchunk(3) is for β go say hi to it. And where do you find NT_AUXV notes chilling? Normally in core files π. You can also just read the auxiliary vector straight out of /proc/PID/auxv if that's more your thing.
And if you want the whole lore on what an auxiliary vector even is, go read getauxval(3). It's giving lore drop. π
π PARAMETERS π
dataβ pointer to anElf_Dataof a note with typeNT_AUXV, and it must have itsd_typeset toELF_T_AUXV. Peepelf_getdata_rawchunk(3)for more deets.ndxβ the index of the auxiliary vector entry you want, insidedata.dstβ pointer to a caller-providedGElf_auxv_tstruct where the requested entry gets stored. Must not beNULL. Like, don't. π«
π RETURN VALUE π
On success, this function updates dst with the auxiliary vector entry you asked for and hands dst right back to you. Slay. π«Ά
On failure, it returns NULL and sets elf_errno. Classic.
Special little edge case bestie: ifdataisNULL, thenNULLis returned andelf_errnois not set. So don't go blamingelf_errnofor that one, it did nothing wrong. π
π SEE ALSO π
elf_getdata_rawchunk(3), getauxval(3) libelf(3), elf(5)
π ATTRIBUTES π
The interface, the attribute, the value β but make it a list because tables are not the vibe here:
- Interface:
gelf_getauxv() - Attribute: Thread safety
- Value:
MT-Safe
π REPORTING BUGS π
Found a bug? Report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. They wanna know, fr fr. π
π§ HISTORY π§
gelf_getauxv first appeared in elfutils 0.130. Heads up though β this function is an elfutils libelf extension, which means it may not be available in other libelf implementations. So if you're porting somewhere else, do a vibe check first. β
and that's the whole page bestie, you ate it, periodt π
this has been Libelf, dated 2025-12-31 β go forth and read your auxiliary vectors, main character πΈβ¨
π¦ where this page comes from
- alpine 3.24: elfutils-doc 0.195-r0 Β· GPL-3.0-or-later AND ( GPL-2.0-or-later OR LGPL-3.0-or-later )
- arch rolling: libelf 0.196-1
- arch rolling: libelf 0.197-1 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 10: elfutils-libelf-devel 0.197-1.el10 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- centos-stream 9: elfutils-libelf-devel 0.197-1.el9 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.196-1.fc43
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 43: elfutils-libelf-devel 0.197-1.fc43 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.196-1.fc44
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- fedora 44: elfutils-libelf-devel 0.197-1.fc44 Β· GPL-2.0-or-later OR LGPL-3.0-or-later
- nixpkgs unstable: elfutils 0.195
- ubuntu stonking: libelf-dev 0.196-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms