raw_atomic64...ess_negative(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 raw_atomic64...ess_negative(9) β€” Kernel API Manual, bestie edition πŸ’…

okay so this is a page straight out of the Kernel API Manual, and the title got a little ✨truncated✨ on the way in β€” the header literally reads raw_atomic64...ess_negative(9) up top, which is giving "name too long for the man page column, so we did a little snip snip". Iconic behavior honestly. Anyway, it's the man page for raw_atomic64_inc_unless_negative, and she is so much more chill than she sounds 🫢


πŸ¦‹ NAME

raw_atomic64_inc_unless_negative β€” atomic increment unless negative, with full ordering. That's the whole vibe: bump the number, but only if it's not already in the negatives. Manifesting the +1 ✨


πŸŽ€ SYNOPSIS

bool raw_atomic64_inc_unless_negative (atomic64_t *v );

that's it. one function, one pointer, one bool coming back to you. lowkey elegant πŸ’–


🧚 ARGUMENTS

  • v β€” pointer to an atomic64_t. like, that's your little number box. hand her over, she knows what to do 🌸

⭐ DESCRIPTION

So here's the tea, bestie: if (v >= 0), she atomically updates v to (v + 1) with full ordering. Full ordering, no cap β€” that's the strong memory-barrier energy πŸ”₯

Otherwise β€” meaning if v is negative β€” v is not modified at all, and relaxed ordering is provided. She looks at it, goes "nope, not today", and does nothing. Respect. πŸ’…

also super important: it's safe to use in noinstr code β€” that's literally her whole thing. But everywhere else? Prefer atomic64_inc_unless_negative. She's the specialist, not the default. iykyk πŸ§šβ€β™€οΈ

πŸ‘‘ RETURN

  • true β€” v was updated (she said yes πŸ’–)
  • false β€” v was not updated (she said no πŸ™ˆ)

🌈 SEE ALSO

okay so the source file for all this lives right here:

  • ./include/linux/atomic/atomic-arch-fallback.h in the kernel tree

and then there's the entire friend group β€” every single one of these is a real reference, and yes I'm listing all of them, because we don't gatekeep on this blog πŸ‘‘

the 32-bit raw_atomic_* babes ✨

and the 64-bit raw_atomic64_* main characters πŸ‘‘


and that's the whole page, bestie!! πŸ’– this one came from the source path ./include/linux/atomic and it's dated October 2026 β€” so mark your calendar, she's a Scorpio I guess πŸ¦‹βœ¨ mwah, go forth and increment responsibly πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from