wait_on_bit_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… wait_on_bit_lock(9) β€” like, the kernel API manual, bestie ✨

okay so welcome to the glow-up of wait_on_bit_lock, a kernel API manual page, and honestly? she's iconic. buckle up πŸŽ€


🌸 NAME 🌸

wait_on_bit_lock β€” wait for a bit to be cleared, then set it. that's the whole vibe. wait, then snatch. πŸ’…


✨ SYNOPSIS ✨

int wait_on_bit_lock (unsigned long *word , int bit , unsigned mode );

🫢 ARGUMENTS 🫢

  • word β€” the address containing the bit being waited on. it's giving "where the drama lives" πŸ“
  • bit β€” the bit of the word being waited on and set. yes, both. she's multitalented πŸ’β€β™€οΈ
  • mode β€” the task state to sleep in 😴 the actual napping configuration, no cap

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so picture this: you're waiting for the given bit in an unsigned long or a bitmap (see DECLARE_BITMAP) to be cleared. cleared. gone. bye. πŸ‘‹

and like β€” important β€” the clearing of the bit must be signalled with wake_up_bit, often as clear_and_wake_up_bit. that's the bat signal, bestie. no signal, no party 🚨

as soon as it's clear, this function atomically sets it and returns. atomic. like she does it all in one breath, no gaps, no interleaving. main character energy πŸ”₯

this is similar to wait_on_bit, but sets the bit before returning. so like, her cousin, but she does more πŸ’…

the returned value will be zero if the bit was successfully set β€” and in that case the call has the same memory sequencing semantics as test_and_clear_bit β€” or it'll be -EINTR if the process received a signal and the mode permitted wake up on that signal πŸ™ˆ

lowkey important: -EINTR means a signal barged in mid-nap. that's not a bug, that's the mode you asked for πŸ’€

🧚 SEE ALSO 🧚

kernel file ./include/linux/wait_bit.h, plus the whole friend group, fr fr:


and that's the page, bestie πŸ“ bye bestie, go set some bits πŸ’œ β€” this one's from ./include/linux, dated October 2026, and it's wait_on_bit_lock(9) all the way down πŸŒˆβ­πŸ‘‘

πŸ“¦ where this page comes from