sync_test_and_change_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, this is the sync_test_and_change_bit(9) page from the Kernel API Manual, and it's giving β€œchange a bit, return the old value” main character energy πŸ’…βœ¨

🌸 NAME 🌸

sync_test_and_change_bit β€” change a bit and return its old value. Periodt. πŸ’–

✨ SYNOPSIS ✨

int sync_test_and_change_bit (long nr , volatile unsigned long *addr );

πŸŽ€ ARGUMENTS πŸŽ€

  • nr β€” the bit to change, bestie.
  • addr β€” the address to count from. Yes, that’s the wording fr fr.

πŸ’… DESCRIPTION πŸ’…

okay so the actual tea: this operation is atomic and cannot be reordered. It also implies a memory barrier. That’s the whole lore β€” no cap. πŸ¦‹

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./arch/x86/include/asm/sync_bitops.h is the home base, and these are the other icons you’re gonna want to check:


kisses and bit-flips, bestie 🫢 β€” this page’s source/version is ./arch/x86/include/asm, dated October 2026, signing off as sync_test_and_change_bit(9) πŸ’–

πŸ“¦ where this page comes from