arch_test_and_set_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so bestie, welcome to the arch_test_and_set_bit(9) page from the Kernel API Manual β€” yes, this is the bit-flipping baddie you were looking for, and it's lowkey iconic. let's get into it πŸ’…βœ¨

🌸 NAME 🌸

arch_test_and_set_bit β€” set a bit and return its old value. that's the whole vibe: you set one bit, and it hands you back what was there before. periodt.

✨ SYNOPSIS ✨

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

πŸŽ€ ARGUMENTS πŸŽ€

  • nr β€” the bit to set, fr fr. this is the one you're flipping.
  • addr β€” the address to count from, no cap.

πŸ”₯ DESCRIPTION πŸ”₯

This is an atomic, fully-ordered operation β€” and yes bestie, that means it has an implied full memory barrier. the ordering is part of the package πŸ’–

atomic + fully ordered + implied full memory barrier = the whole mood. don't sleep on it.

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file: ./arch/riscv/include/asm/bitops.h

The whole reference squad:


mwah πŸ’‹ this cutie comes from ./arch/riscv/include/asm, and the manual page is dated October 2026. bye bestie, go set some bits responsibly 🫢✨

πŸ“¦ where this page comes from