for_each_shdr_str(9)
π for_each_shdr_str(9) β like, the Kernel API Manual, bestie β¨
okay so real talk, this one lives in the Kernel API Manual and it's genuinely one of those little macros that eats and leaves no crumbs π it's a for loop-flavoured iterator that reads strings that are in an ELF section. yes, that ELF. no cap.
β¨ SYNOPSIS β¨
for_each_shdr_str (len , ehdr , sec );
that's the whole vibe check right there π«Ά (and yes, the spaces are exactly that, don't come for me, that's literally how it's written π)
π ARGUMENTS π
lenβ an"int"that's gonna hold the length of the current string. it's your little output slot, she reports back every loop πehdrβ a pointer to theehdrof the ELF file. like, the ELF header itself, the main character πsecβ the section that has the strings to iterate on. this is the section you're serving, the one with the good stuff in it πΈ
π¦ DESCRIPTION π¦
okay so picture this: it's a for loop π and it iterates over all the nul terminated strings that are in a given ELF section. every single one. not a single string left behind, periodt π
the variable "str" will hold the current string for each iteration β so like, every time you go around the loop, str is your girl, she's got the string of the moment β¨
and the len you passed in? she'll contain the strlen of that string. so you get the string and its length, no extra math, we love an efficient queen π
π SEE ALSO π
- Kernel file
./scripts/tracepoint-update.cβ go look, iykyk π
fr fr bestie, that's the whole page. no hidden options, no top-secret env vars, just a loop that hands you strings and their lengths like a good friend who brings you a snack π
mwah π β this one came from ./scripts, dated October 2026, and i'm obsessed with her honestly πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms