raw_atomic_..._and_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_..._and_relaxed(9) β€” like, the Kernel API Manual one, bestie

okay so. welcome to the group chat that is the Kernel API Manual, and today's main character is raw_atomic_..._and_relaxed(9). yes the title is doing a little ellipsis thing, it's giving "and friends" energy, we'll get to that. πŸŽ€


✨ NAME ✨

raw_atomic_long_fetch_and_relaxed β€” atomic bitwise AND with relaxed ordering. she's an AND operator and she's chill about it. no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

long raw_atomic_long_fetch_and_relaxed (long i , atomic_long_t *v );

literally just two things in, one long out. ship it. πŸ’œ


🌸 ARGUMENTS 🌸

  • i β€” a long value. that's it, that's the whole argument. iconic.
  • v β€” a pointer to atomic_long_t. you're pointing at the thing we're about to mess with. handle with love. 🫢

πŸ”₯ DESCRIPTION πŸ”₯

okay so what she does: atomically updates v to (v & i) β€” yes the bitwise AND, yes with i β€” and she does it with relaxed ordering. no extra fence drama, no "wait for everyone else", just the operation, atomically, done. that's the vibe check and she passed. ✨

big note, bestie: she's safe to use in noinstr code. but β€” and hear me β€” prefer atomic_long_fetch_and_relaxed everywhere else. raw_ is the noinstr-safe flavor, not the everyday casual one. iykyk πŸ’…

πŸ’– RETURN πŸ’–

the original value of v. like, the value before the AND. the pre-glow-up version. she gives you the before pic, not the after. πŸ˜­πŸ‘‘


🌈 SEE ALSO 🌈

first up, the source, absolutely gotta give credit:

  • Kernel file ./include/linux/atomic/atomic-long.h

and now. the family. the whole entire family. buckle up bestie, she's got relatives:

yeah. that's the whole roster. every single one of them showed up to the party and they all ate. πŸ”₯πŸ‘‘


🧚 sign-off 🧚

so anyway, this lil page lives in ./include/linux/atomic, it's part of the Kernel API Manual (that's the manual name, writing it down so we don't forget πŸ’–), and it's dated October 2026. go forth and AND atomically, bestie. mwah. πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from