local_inc_and_test(9)
β¨ local_inc_and_test(9) β¨
okay so bestie, we're in the Kernel API Manual today and this one is literally the cutest little helper π it's local_inc_and_test(9) and it does exactly what it says on the tin, no cap.
πΈ NAME πΈ
local_inc_and_test β increment and test π
π¦ SYNOPSIS π¦
bool local_inc_and_test (local_t *l );
that's it. that's the whole vibe check. β¨
π ARGUMENTS π
lβ pointer to typelocal_tπ«Ά that's the thing getting incremented, she's the main character here.
π DESCRIPTION π
okay so here's the tea β: this function atomically increments l by 1, and then it returns true if the result is zero, or false for all other cases.
atomic means nobody can sneak in and mess with it halfway through β it's giving locked-in, one-and-done, no interruptions energy π
so like:
- result is
0βtrueπ₯ - literally anything else β
falseπ
that's it, that's the whole function, she's iconic and she knows it π
β SEE ALSO β
lowkey you should also go look at the kernel file ./arch/x86/include/asm/local.h β that's where the family lives π and while you're there, say hi to:
local_sub_and_test(9)local_dec_and_test(9)local_add_negative(9)local_add_return(9)local_add_unless(9)
they're all siblings, they all ate, periodt π
aaaand that's the page bestie π§ from the fine folks at ./arch/x86/include/asm, dated October 2026, and yes we are still calling this whole thing local_inc_and_test(9) π mwah, go increment something responsibly π
π¦ 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