atomic64_dec...ess_positive(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_dec_unless_positive(9) β€” the Kernel API Manual, but make it make sense

okay so bestie, welcome to the Kernel API Manual πŸŽ€ this is page atomic64_dec...ess_positive(9) (yes the header truncates it, the real name is atomic64_dec_unless_positive, we're slaying regardless) and it's literally the "decrement but only if you're being nice about it" function. let's go 🌸


✨ NAME ✨

atomic64_dec_unless_positive β€” atomic decrement unless positive, with full ordering. that's the whole vibe. πŸ¦‹


🌈 SYNOPSIS 🌈

bool atomic64_dec_unless_positive (atomic64_t *v );

πŸ’– ARGUMENTS πŸ’–

  • v β€” pointer to atomic64_t. that's it. that's the argument. she's a pointer to an atomic64_t and she knows it πŸ‘‘

🫢 DESCRIPTION 🫢

okay so here's the tea β˜• if (v <= 0), it atomically updates v to (v - 1) with full ordering. like, atomic atomic. no one's sneaking in between. πŸ”₯

otherwise β€” meaning if it's not the case that v <= 0 β€” then v is not modified, and relaxed ordering is provided. so she looked at your number, went "nope, not touching that", and gave you relaxed ordering instead. respectful. 😌

⚠️ not me telling you this is unsafe in noinstr code β€” it literally is! use raw_atomic64_dec_unless_positive there instead. do not come for me if you ignore this, i warned you πŸ™ˆ

⭐ RETURN ⭐

  • true β€” if v was updated πŸ’–
  • false β€” otherwise πŸ₯²

that's it. boolean. clean. iconic.


πŸ¦‹ SEE ALSO πŸ¦‹

so the kernel file is ./include/linux/atomic/atomic-instrumented.h and bestie. bestie. the see-also list is long. like genuinely enormous. but i'm not skipping a single one because every single function deserves her moment ✨ here we go:

🌸 the atomic_* girlies

πŸ’œ the atomic64_* squad (yes, our main character lives here)

🧚 the atomic_long_* besties


okay that's genuinely everyone, i counted, we're done, nobody got left out πŸ’…


and that's the page bestie!! πŸŽ€ her home is ./include/linux/atomic, she's dated October 2026, and the header/footer both call her atomic64_dec...ess_positive(9) because even manpage headers get truncated. go forth and decrement responsibly β€” only when v <= 0, and never in noinstr code. mwah 🫢✨

πŸ“¦ where this page comes from