raw_atomic_long_cmpxchg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_long_cmpxchg πŸ’…

okay so bestie, welcome to the Kernel API Manual ✨ this one's a little kernel function called raw_atomic_long_cmpxchg, and honestly? it ate. let's get into it 🫢


🌸 NAME 🌸

raw_atomic_long_cmpxchg β€” atomic compare and exchange with full ordering πŸ”₯


πŸŽ€ SYNOPSIS πŸŽ€

long raw_atomic_long_cmpxchg (atomic_long_t *v , long old , long new );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • v β€” pointer to atomic_long_t πŸ‘ˆ like, the thing we're messing with
  • old β€” the long value to compare with πŸ‘€ the one we're checking against
  • new β€” the long value to assign πŸ’– the glow-up value, if the vibe check passes

✨ DESCRIPTION ✨

okay so here's the tea β˜• if (v == old), it atomically updates v to new with full ordering. slay. otherwise, v is literally not modified at all, and you get relaxed ordering instead. no cap πŸ€·β€β™€οΈ

it's safe to use in noinstr code β€” but bestie, prefer atomic_long_cmpxchg elsewhere, fr fr πŸ’… that's the main character, this one's the special-case icon πŸ‘‘


⭐ RETURN ⭐

the original value of v πŸ’– that's it, that's the return. iykyk


🧚 SEE ALSO 🧚

kernel file ./include/linux/atomic/atomic-long.h πŸ“

and now the obligatory friend group, no one gets left out 🫢:


and that's the whole page bestie, every single one of them accounted for 🫢 no skips, no summaries, periodt πŸ’€βœ¨

🌸 ok final sign-off 🌸 this little beauty lives in ./include/linux/atomic, it's dated October 2026, and it's page raw_atomic_long_cmpxchg(9) of your fave manual. mwah πŸ’‹ go be atomic, icon πŸ‘‘πŸŒˆ

πŸ“¦ where this page comes from