futex_atomi...chg_inatomic(9)
π 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 ofuaddrπ this is where the tea gets spilled afterwards, iykykuaddrβ pointer to user space address π the main character location, fr froldvalβ old value π the value we're checking against, the "if it's still this, thenβ¦"newvalβ new value to store touaddrβ¨ 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 π
- Kernel file
./arch/um/kernel/skas/uaccess.cπ arch_futex_atomic_op_inuser(9)π§
π«Ά 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 β0good,-EFAULTpage fault,-EAGAINcontention. 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms