test_and_clear_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… test_and_clear_bit(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” this one's a little kernel function called test_and_clear_bit, and honestly? she's iconic. ✨


🌸 NAME 🌸

test_and_clear_bit β€” clear a bit and return its old value. that's it. that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

bool test_and_clear_bit (long nr , volatile unsigned long *addr );

like, she takes two things and gives you back a bool. main character energy. πŸ‘‘


πŸ“ ARGUMENTS πŸ“

  • nr β€” the bit you wanna clear. yes, this one. this is the bit. 🫢
  • addr β€” the address to count from. that's where the counting happens. no cap. πŸ’«

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea: this is an atomic, fully-ordered operation β€” meaning it comes with an implied full memory barrier. like, she's not just clearing a bit, she's doing it atomically AND respecting the full ordering. the way that she's both 😭πŸ”₯

bestie pls remember: atomic + fully ordered = no sneaky reordering shenanigans. the memory barrier is implied, so you don't gotta ask for it, she just comes with it. periodt. πŸ’…

🧚 SEE ALSO 🧚

the whole bitops friend group!! go say hi to all of them, they're all slay in their own way πŸŒˆπŸ’œ


okay that's the whole page!! πŸŽ€ this lil beauty lives in ./include/asm-generic/bitops and it's dated October 2026 β€” so like, future vibes only. mwah πŸ’‹βœ¨ go clear some bits, bestie, you got this πŸ«ΆπŸ’–

πŸ“¦ where this page comes from