raw_atomic_l...h_add_unless(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_l...h_add_unless(9) β€” from the Kernel API Manual, bestie

okay so picture this: you're deep in kernel land, the manual's literally called the Kernel API Manual, and you need one very specific little long atomic to do exactly one very specific little thing. that's this page. welcome 🫢


✨ NAME ✨

raw_atomic_long_fetch_add_unless β€” atomic add unless value, with full ordering. yes the name is a whole sentence, we don't make the rules πŸ’€


🌸 SYNOPSIS 🌸

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

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_long_t. it's the thing we're being all atomic about ✨
  • a β€” a long value to add. the "add" part of the show πŸ’–
  • u β€” a long value to compare with. the "unless" part, our little vibe check πŸ¦‹

πŸ’œ DESCRIPTION πŸ’œ

so here's the plot: if (v != u), we atomically update v to (v + a) with full ordering. slay. iconic. the whole package 🌈

otherwise β€” like, if v is u β€” nothing happens to v at all, and you get relaxed ordering instead. not me giving you a different ordering depending on the answer 😭 that's just how it is.

🫢 important bestie note: this one is safe to use in noinstr code; prefer atomic_long_fetch_add_unless everywhere else. that's literally in the manual, no cap.

⭐ RETURN ⭐

the original value of v. not the new one, the original one β€” read it, remember it, it's yours πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file is ./include/linux/atomic/atomic-long.h β€” go say hi to it for me πŸ’…

and now, the friend group. every single one. i'm not skipping a single member of this family, they all get their moment ✨


anyway that's the whole page, you ate that πŸ’… ok bye love u, stay atomic πŸ§šπŸ’–

this came from ./include/linux/atomic, October 2026 edition β€” signed, sealed, delivered, periodt πŸ‘‘
πŸ“¦ where this page comes from