atomic_inc_and_test(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ atomic_inc_and_test(9) ✨

okay so this is the manual page for atomic_inc_and_test, straight out of the Kernel API Manual β€” yes, that Kernel API Manual. pull up a chair bestie, this one's short and so useful 🫢


🌸 NAME 🌸

atomic_inc_and_test β€” bumps a value up by one, atomically, with full ordering, and then tells you whether it landed on zero πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

bool atomic_inc_and_test (atomic_t *v );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • v β€” a pointer to an atomic_t. that's it. that's the whole arg list. iconic minimalism πŸ’–

⭐ DESCRIPTION ⭐

so what it does: it atomically updates v to (v + 1), and it does the whole thing with full ordering. no cap, the ordering is the whole point β€” that's what makes it "full ordering" and not some relaxed little guy.

🚨 real talk though: this is unsafe to use in noinstr code. if you're living in noinstr land, use raw_atomic_inc_and_test there instead. like, don't come for me, that's just the rule πŸ’€

πŸ”₯ RETURN πŸ”₯

  • true β€” the resulting value of v is zero πŸŽ‰
  • false β€” it's literally anything else πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

first up, the source of truth β€” the kernel file ./include/linux/atomic/atomic-instrumented.h β€” and then, like, the entire atomic family tree. every single one. follow for follow bestie 🌈


and that's the whole page, bestie πŸ’– mwah πŸ’‹

okay real quick sign-off: this lil masterpiece lives in ./include/linux/atomic and it's dated October 2026 β€” go be atomic, stay ordered, and don't use it in noinstr code βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from