atomic_fetch_xor_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic_fetch_xor_acquire β€” kernel API manual, bestie edition πŸ¦‹

Okay so we're looking at atomic_fetch_xor_acquire from the Kernel API Manual, and honestly? She's a little icon of a function. Let's get into it ✨


🌸 NAME 🌸

atomic_fetch_xor_acquire β€” atomic bitwise XOR with acquire ordering, periodt πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int atomic_fetch_xor_acquire (int i , atomic_t *v );

πŸ’– ARGUMENTS πŸ’–

  • i β€” an int value, that's it, that's her 🫢
  • v β€” pointer to atomic_t, i.e. the vibe we're about to update

✨ DESCRIPTION ✨

So what she does is: atomically updates v to (v ^ i) β€” with acquire ordering 🧚 Like, the whole thing happens in one go, no one can catch her mid-XOR, and the acquire ordering is doing its memory-ordering thing while she slays.

⚠️ Real talk though: this is unsafe to use in noinstr code. If you're in there, use raw_atomic_fetch_xor_acquire instead. No exceptions, bestie 😭

πŸ”₯ RETURN πŸ”₯

She gives you back the original value of v β€” the one from before the XOR. Like getting a receipt for the past πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

The kernel file is ./include/linux/atomic/atomic-instrumented.h, and here's the whole friend group, no cap β€” every single one of them:


That's the whole squad, iykyk 🌈 Go forth and XOR atomically, bestie πŸ’œ


Source: ./include/linux/atomic Β· Dated: October 2026 Β· Page: atomic_fetch_xor_acquire(9) πŸŽ€ slay and goodbye πŸŽ€

πŸ“¦ where this page comes from