futex_atomi...atomic_local(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ futex_atomic_cmpxchg_inatomic_local(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– this one's a kernel-space girly and she's lowkey doing the most important job: the atomic compare-and-exchange for futexes. no cap, she's iconic.


🌸 NAME 🌸

futex_atomic_cmpxchg_inatomic_local β€” compares the content of uaddr with newval, and swaps it in only if the current value is oldval. it's giving "i'll only change if you're exactly who i expected you to be" πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int futex_atomic_cmpxchg_inatomic_local (u32 *uval , u32 __user *uaddr ,
u32 oldval , u32 newval );

that's the whole vibe. four args, one int back. slay.


πŸ¦‹ ARGUMENTS πŸ¦‹

okay let's meet the cast 🫢

  • uval β€” pointer to store content of uaddr. she's the little notepad where the result gets written down πŸ“
  • uaddr β€” pointer to user space address. yes bestie, user space, tread carefully πŸ‘€
  • oldval β€” old value. the expected one, the one we're checking against ⭐
  • newval β€” new value to store to uaddr. the glow-up we're trying to apply πŸ’«

πŸ”₯ RETURN πŸ”₯

the return value is literally the whole plot, so pay attention πŸ™ˆ

  • 0 β€” on success πŸŽ‰
  • -EFAULT β€” user access resulted in a page fault 😭
  • -EAGAIN β€” atomic operation was unable to complete due to contention πŸ’€
fr fr, if you see -EAGAIN it's not a you problem, it's just the vibes being contested. try again later ✨

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./include/asm-generic/futex.h β€” go read the source, iykyk πŸ“–
  • futex_atomic_op_inuser_local(9) β€” her sibling, also doing atomic things 🌈

and that's the tea πŸ“ this page lives in ./include/asm-generic, dated October 2026, and it's brought to you by the futex_atomi...atomic_local(9) girlies themselves. mwah, ily, go write some lock-free code responsibly πŸ’œπŸ§š

πŸ“¦ where this page comes from