atomic_long_fetch_andnot(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic_long_fetch_andnot(9) β€” Kernel API Manual, bestie edition πŸŽ€

okay so you opened <hotpink>atomic_long_fetch_andnot(9)</hotpink>, the kernel API manual page, and it's giving "atomic bitwise AND NOT with full ordering" β€” which sounds intimidating but honestly? kind of iconic once you get it. let's break it down together, no cap. πŸ¦‹


✨ NAME ✨

atomic_long_fetch_andnot β€” the atomic bitwise AND NOT with full ordering. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

long atomic_long_fetch_andnot (long i , atomic_long_t *v );

yes bestie, that's the exact signature. spaces and all. we don't editorialize here. πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” a long value. that's it. that's the whole description. she's a simple girl. 🌷
  • v β€” pointer to an atomic_long_t. this is the main character right here β€” the thing that's actually getting updated. ✨

🧚 DESCRIPTION 🧚

okay so the lore: this function atomically updates v to (v & ~i) with full ordering. so it takes the current value of v, ANDs it with the bitwise NOT of i, and writes it back β€” all in one indivisible little move, with full ordering on top so nothing sneaks around it. literally atomic. obsessssed. πŸ”₯

🚨 important warning, fr fr: this is unsafe to use in noinstr code. if you're in noinstr code, you gotta use raw_atomic_long_fetch_andnot there instead. do not skip this. the kernel will not be cute about it. 😭

πŸ‘‘ RETURN πŸ‘‘

it hands you back the original value of v β€” the value that was sitting there before the update. so you get the before pic and the function keeps the after pic. bestie behavior honestly. 🫢


🌈 SEE ALSO 🌈

the source lives in ./include/linux/atomic/atomic-instrumented.h, and it comes with an entire friend group of atomic buddies. like, a whole squad. here they all are, in order, no skips, no cuts: πŸ’œ


and that's the whole page bestie, you ate that. πŸ’…βœ¨

🌸 this served cuteness comes straight from the source file ./include/linux/atomic, dated October 2026 β€” so go forth, be atomic, and remember: noinstr code does NOT get the fancy version. mwah. πŸ«ΆπŸ’–
πŸ“¦ where this page comes from