futex_atomi...chg_inatomic(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… futex_atomi...chg_inatomic β€” Kernel API Manual

okay so bestie, welcome to the Kernel API Manual ✨ this one's a very niche little number from the UML (user-mode-linux) side of things, and honestly? it's giving "atomic operations but make it architecture-specific" πŸ¦‹


🌸 NAME 🌸

futex_atomic_cmpxchg_inatomic β€” literally does a compare-and-exchange on the content of uaddr with newval, but only if the current value happens to be oldval πŸ‘‘

like, no cap, that's the whole vibe. compare first, swap second, atomic the entire time πŸŽ€


⭐ SYNOPSIS ⭐

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

yes the spacing is exactly like that, don't come for me, I'm just the messenger πŸ™ˆ


πŸ¦‹ ARGUMENTS πŸ¦‹

  • uval β€” pointer to store content of uaddr πŸ’– this is where the tea gets spilled afterwards, iykyk
  • uaddr β€” pointer to user space address 🌈 the main character location, fr fr
  • oldval β€” old value πŸ‘‘ the value we're checking against, the "if it's still this, then…"
  • newval β€” new value to store to uaddr ✨ the glow-up we're applying if the vibe check passes

πŸ”₯ RETURN πŸ”₯

  • 0 β€” On success πŸŽ‰ slay, it worked
  • -EFAULT β€” User access resulted in a page fault πŸ’€ oop, the user memory said "not today"
  • -EAGAIN β€” Atomic operation was unable to complete due to contention 😭 it got crowded in there, try again bestie

πŸ’œ SEE ALSO πŸ’œ


🫢 ok but real talk: this is an atomic operation, so don't be out here assuming your normal lazy read-modify-write energy applies. The return codes are literally the whole story β€” 0 good, -EFAULT page fault, -EAGAIN contention. That's it, that's the plot πŸ“

mwah πŸ’‹ that's the page! brought to you by the folks over at ./arch/um/kernel/skas, dated October 2026, and yeah β€” that's genuinely the whole thing. no notes. periodt πŸ’…βœ¨

πŸ“¦ where this page comes from