atomic_long_...h_add_unless(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic_long_...h_add_unless(9) β€” kernel API manual πŸŽ€

okay bestie, so this one lives in the Kernel API Manual, and the page is literally called atomic_long_fetch_add_unless(9) β€” yes the header got truncated and it's giving "my name is a mystery" energy, but we know her πŸ’–


✨ NAME ✨

atomic_long_fetch_add_unless β€” atomic add unless value, with full ordering πŸ¦‹


🌸 SYNOPSIS 🌸

long atomic_long_fetch_add_unless (atomic_long_t *v , long a , long u );

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_long_t πŸ‘‘ (the thing we're being all atomic about)
  • a β€” long value to add βž•
  • u β€” long value to compare with πŸ†š

πŸ’œ DESCRIPTION πŸ’œ

so here's the vibe check: if (v != u), she atomically updates v to (v + a) with full ordering ✨. Literally does the math and the memory ordering in one go, no cap.

Otherwise β€” meaning v already equals u β€” v is not modified, and relaxed ordering is provided 🫢. She looked at it, said "not today", and gave you the chill version of the ordering instead πŸ’…

⚠️ unsafe to use in noinstr code β€” bestie please, use raw_atomic_long_fetch_add_unless there instead 😭 fr fr, this is the one caveat and it's not a drill πŸ’€

⭐ RETURN ⭐

The original value of v β€” like, the value from before the add. time-travel queen behavior πŸ•°οΈπŸ‘‘


🌈 SEE ALSO 🌈

Kernel file ./include/linux/atomic/atomic-instrumented.h β€” and the whole extended family is here, gathered for the group chat πŸ“±βœ¨

the atomic_* girlies:

the atomic64_* crew (sixty-four of them, highkey iconic):

the atomic_long_* main characters (yes, our girl's whole family πŸ’…):


πŸ’€ okay that's everybody, go read them, iykyk 🫢

✨ that's the whole page bestie ✨ this cutie came from ./include/linux/atomic, dated October 2026, and yeah the footer says atomic_long_...h_add_unless(9) again because the header and footer are matching, and honestly? coordinated. slay πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from