wait_on_bit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– wait_on_bit(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual page for wait_on_bit(9) β€” it's giving β€œsleep until that bit is cleared” energy and honestly? iconic. πŸ¦‹


✨ NAME ✨

wait_on_bit β€” wait for a bit to be cleared πŸ’…


✨ SYNOPSIS ✨

the signature is literally right here, no cap:

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

✨ ARGUMENTS ✨

  • word β€” the address containing the bit being waited on πŸŽ€
  • bit β€” the bit at that address being waited on ✨
  • mode β€” the task state to sleep in 😴

✨ DESCRIPTION ✨

okay so this function waits for the given bit in an unsigned long or bitmap (see DECLARE_BITMAP) to be cleared. yes, that bit. the one you're obsessed with. 🫢

the clearing of the bit must be signalled with wake_up_bit, often as clear_and_wake_up_bit. like, do not forget this part, bestie β€” it's the whole vibe. πŸ’€

the process will wait on a waitqueue selected by hash from a shared pool. and here's the cute part: it will only be woken on a wake_up for the target bit, even if other processes on the same queue are waiting for other bits. main character energy only. πŸ‘‘

the returned value will be zero if the bit was cleared β€” in which case the call has ACQUIRE semantics β€” or -EINTR if the process received a signal and the mode permitted wake up on that signal. periodt. πŸ’–


✨ SEE ALSO ✨

the kernel file is ./include/linux/wait_bit.h, and the bestie list is:


signed, sealed, slayed from ./include/linux β€” October 2026 β€” for wait_on_bit(9) πŸ’Œβœ¨

πŸ“¦ where this page comes from