GELF_GETCHDR(3)

πŸ“¦
version 0.197 Β· 2 versions
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu stonking

πŸ’– GELF_GETCHDR πŸ’–

okay so bestie, welcome to the Libelf Programmer's Manual ✨ this one's all about gelf_getchdr β€” she retrieves the class-independent compression header for an ELF section that's got compressed data in it. no cap. πŸŽ€


🌸 NAME 🌸

gelf_getchdr β€” retrieve the class-independent compression header for an ELF section with compressed data.

like literally that's her whole job and she does it flawlessly πŸ’…


✨ SYNOPSIS ✨

#include <gelf.h>

GElf_Chdr *gelf_getchdr (Elf_Scn *scn, GElf_Chdr *dest);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you call this, and it grabs the class-independent compression header for the section scn β€” the one with compressed data β€” and drops it right into dest. 🫢

How do you know a section is even compressed? The SHF_COMPRESSED flag, bestie. That's the signal. If you wanna know more about what the compression header even is, go peek at libelf(3) β€” she explains it. πŸ“š


πŸŽ€ PARAMETERS πŸŽ€

  • scn β€” the section whose compression header you're retrieving. and listen, her SHF_COMPRESSED flag must be set. that's not a suggestion, that's the requirement. ⚠️
  • dest β€” a pointer to a GElf_Chdr structure that you, the caller, provide. she's gonna fill it with the class-independent compression header for scn. it's giving "bring your own buffer" energy 🧺

⭐ RETURN VALUE ⭐

  • On success? She returns dest. slay. πŸ‘‘
  • On failure? She returns NULL and sets elf_errno. πŸ’€
  • And if scn is NULL? She returns NULL and does not set elf_errno. that's the special case, don't forget it, iykyk πŸ™ˆ

🌈 SEE ALSO 🌈

go read them all, they're iconic, fr fr πŸ’œ


πŸ‘‘ ATTRIBUTES πŸ‘‘

  • gelf_getchdr() β€” Thread safety: MT-Safe βœ…

like she's safe to use across threads, we love a low-drama function ✨


😭 REPORTING BUGS 😭

Found a bug? Not her fault but okay, report it to <elfutils-devel@sourceware.org> or hit up https://sourceware.org/bugzilla/. be nice about it, the maintainers are doing their best 🫢


πŸ“œ HISTORY πŸ“œ

gelf_getchdr first appeared in elfutils 0.165. a legend since day one, periodt. πŸ’–


Libelf Β· 2025-12-27 β€” that's the source and date bestie, signing off πŸŽ€βœ¨ mwah, go compress something responsibly πŸ’…πŸ¦‹

πŸ“¦ where this page comes from