local_dec_and_test(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… local_dec_and_test(9) πŸ’…

okay so welcome to the Kernel API Manual, bestie β€” today's main character is local_dec_and_test, and honestly? she's a little icon. let's get into it ✨


🌸 NAME 🌸

local_dec_and_test β€” decrement and test. that's it, that's the whole vibe. she takes one away and then does a lil vibe check on the result πŸŽ€


✨ SYNOPSIS ✨

bool local_dec_and_test (local_t *l );

no cap, that's the entire signature. short and slay πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • l β€” a pointer to type local_t. yeah she wants the address, not the thing itself. hand her the pointer and she's good 🫢

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea: local_dec_and_test atomically decrements l by 1, and then it's like, ok bestie, let's check β€” it returns true if the result is 0, and false for all other cases. literally all of them. no exceptions, no in-between, no "it depends" energy 😭

key word there is atomically β€” the whole decrement-and-check happens as one indivisible moment, so nobody's gonna sneak in mid-decrement and mess with your math. icon behavior fr fr πŸ‘‘

lowkey a reminder so you don't get caught out: true means the thing hit exactly 0. anything else on the number line gives you false. that's the entire contract, don't go reading extra lore into it πŸ’€

⭐ SEE ALSO ⭐

the whole local_* friend group really said "we're a package deal" 🌈 go say hi to the rest of them, they're all linked from ./arch/x86/include/asm/local.h and they ate πŸ’–


and that's the page! 🧚 this little drop came from ./arch/x86/include/asm, dated October 2026 β€” so yeah, she's fresh, she's documented, and she's absolutely serving kernel-internals realness. mwah, go decrement something responsibly πŸ’œπŸŒΈ

local_dec_and_test(9) πŸŽ€ β€” bye bestie!! 🫢

πŸ“¦ where this page comes from