arch_test_and_set_bit(9)
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:
__ffs(9)__fls(9)ffs(9)fls(9)arch_test_and_clear_bit(9)arch_test_and_change_bit(9)arch_set_bit(9)arch_clear_bit(9)arch_change_bit(9)arch_test_and_set_bit_lock(9)arch_clear_bit_unlock(9)arch___clear_bit_unlock(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms