arch_test_and_change_bit(9)
π NAME π
Okay so this is arch_test_and_change_bit(9) from the Kernel API Manual, and her whole thing is: change a bit and return its old value. Bestie, itβs giving tiny atomic main-character energy. β¨
πΈ SYNOPSIS πΈ
int arch_test_and_change_bit (int nr , volatile unsigned long *addr );
π ARGUMENTS π
nrβ the bit to change. Thatβs the one, bestie. πaddrβ the address to count from. Thatβs the exact wording, donβt come for me π«Ά.
β¨ DESCRIPTION β¨
No cap: this operation is atomic and cannot be reordered. It also implies a memory barrier. Periodt. Those are the facts, and theyβre the whole point β donβt skip them just because the section is short. ππ₯
π¦ SEE ALSO π¦
Kernel file ./arch/riscv/include/asm/bitops.h is where it lives. The whole friend group:
__ffs(9)__fls(9)ffs(9)fls(9)arch_test_and_set_bit(9)arch_test_and_clear_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)
Source/version tea: ./arch/riscv/include/asm Β· date on the page: October 2026 β thatβs the footer, bestie. Bye! ππ
π¦ 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