futex_atomi...atomic_local(9)
β¨ 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 ofuaddr. 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 touaddr. 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
- 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