raw_atomic_long_xchg(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_long_xchg(9) πŸ’…

okay bestie, welcome to the Kernel API Manual β€” today’s main character is raw_atomic_long_xchg(9), and she is literally the atomic exchange with full ordering ✨


🌸 NAME 🌸

raw_atomic_long_xchg β€” atomic exchange with full ordering πŸ’–

✨ SYNOPSIS ✨

long raw_atomic_long_xchg (atomic_long_t *v , long new );

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_long_t πŸ’…
  • new β€” long value to assign πŸŽ€

πŸ’… DESCRIPTION πŸ’…

okay so she atomically updates v to new with full ordering β€” a whole swap situation, no cap.

She’s safe to use in noinstr code; but elsewhere, bestie, prefer atomic_long_xchg β€” that’s the vibe check from the manpage itself πŸ‘‘

πŸ¦‹ RETURN πŸ¦‹

The original value of v β€” the before pic, not the after πŸ˜­πŸ’–

πŸ‘€ SEE ALSO πŸ‘€

Kernel file ./include/linux/atomic/atomic-long.h β€” and the whole atomic-long squad is below, bestie πŸ‘‡


xoxo, raw_atomic_long_xchg(9) πŸ’… β€” source ./include/linux/atomic, October 2026 πŸŽ€

πŸ“¦ where this page comes from