GELF_GETCAP(3)
π GELF_GETCAP(3) π
ok so bestie, this is a page from the Library Functions Manual for gelf_getcap and gelf_update_cap, and it lives in the ELF Access Library (libelf, -lelf) β yes the linker flag is literally -lelf, slay. π
β¨ NAME β¨
gelf_getcap, gelf_update_cap β read and update ELF capability information. that's the whole vibe. π
π LIBRARY π
ELF Access Library (libelf, -lelf) β link it and it's yours, no cap. π«Ά
π§ SYNOPSIS π§
#include <gelf.h>
GElf_Cap *
gelf_getcap(Elf_Data *data, int ndx, GElf_Cap *cap);
int
gelf_update_cap(Elf_Data *data, int ndx, GElf_Cap *cap);
like, look at it. two little functions. absolutely iconic. β
πΈ DESCRIPTION πΈ
okay so these are the convenience functions β you know, the ones that save you from doing the class-dependent thing by hand β and they're here to retrieve and update class-dependent Elf32_Cap or Elf64_Cap information. yes, class-dependent, meaning 32-bit vs 64-bit, iykyk. π₯
Argument data is an Elf_Data descriptor, and it needs to be associated with a section of type SHT_SUNW_cap. that's the vibe check it has to pass, fr fr. Argument ndx is the index of the entry you're retrieving or updating β like, which one in the lineup. and the class-independent GElf_Cap structure? that's described over in gelf(3), go peek. π
Function gelf_getcap() retrieves the class-dependent entry at index ndx in the data buffer data, and copies it to the destination pointed to by argument cap β but only after translation to class-independent form. so it does the glow-up for you. π
Function gelf_update_cap() goes the other way around: it converts the class-independent entry pointed to by argument cap to class-dependent form, and writes it to the entry at index ndx in the data buffer described by argument data. and here's the thing, bestie β gelf_update_cap() signals an error if any of the values in the class-independent representation exceeds the representable limits of the target type. so if your number is too big for the target? nope. error. it will not be squeezing into that outfit. π
π¦ RETURN VALUES π¦
- Function
gelf_getcap()returns the value of argumentcapif everything's good, orNULLif it's not. π - Function
gelf_update_cap()returns a non-zero value on success, or zero if something went wrong. simple as that. β¨
π ERRORS π
these functions may fail with the following errors β cop the list:
[ELF_E_ARGUMENT]β ArgumentsdataorcapwereNULL. like, you gave me nothing, bestie.[ELF_E_ARGUMENT]β Argumentndxwas less than zero or larger than the number of entries in the data descriptor. out of bounds, literally.[ELF_E_ARGUMENT]β Data descriptordatawas not associated with a section of typeSHT_SUNW_cap. wrong section, wrong crowd. π[ELF_E_RANGE]β A value was not representable in the target type. too much for the target to hold, periodt.[ELF_E_VERSION]β TheElf_Datadescriptor denoted by argumentdatais associated with an ELF object with an unsupported version. the version check said no. π§
π SEE ALSO π
elf(3), elf_getdata(3), elf_getscn(3), gelf(3) β go read those next, they're the supporting cast and they ate. π
ok that's the whole page, no notes. go forth and handle your capability entries with main character energy. π
and that's a wrap, bestie β this one's from the Debian edition, dated April 22, 2019, and the page itself is GELF_GETCAP(3). that's the source, the version, and the date, all folded into this cute little sign-off so nothing gets lost. ππ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: libelf 15.0.0
- Copyright (c) 2006,2008 Joseph Koshy. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms