wait_on_bit_lock_io(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… wait_on_bit_lock_io β€” from the Kernel API Manual, bestie πŸ’–

okay so picture this: you're a kernel dev, you need a bit, but the bit isn't ready yet. that's literally this function's whole job. welcome 🫢


✨ NAME ✨

wait_on_bit_lock_io β€” wait for a bit to be cleared, then set it. that's it. that's the vibe. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

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

yes the formatting is a little chaotic, no we're not fixing it, it's iconic πŸ’…


🌸 ARGUMENTS 🌸

  • word β€” the address containing the bit we're waiting on. like, the actual location. point at it.
  • bit β€” which bit of the word we're waiting on and setting. very specific queen behavior ✨
  • mode β€” the task state to sleep in. this is your napping settings, basically 😴

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜•: you wait for the given bit in an unsigned long or bitmap (peep DECLARE_BITMAP) to be cleared. someone else has to signal that clearing with wake_up_bit β€” often as clear_and_wake_up_bit β€” otherwise you're just sitting there, and not in a cute way 😭

the moment it's clear, this function atomically sets it and returns. no gaps, no drama, atomic and slay πŸ”₯

it's super similar to wait_on_bit_lock, but it calls io_schedule instead of schedule. that one swap is the entire plot twist, iykyk πŸ’€

now for the return values, bestie, pay attention:

  • returns zero if the bit was (eventually) found to be clear and was set βœ…
  • returns non-zero if a signal was delivered to the process and the mode allows that signal to wake the process πŸ“¬
fr fr: if you set your mode so signals can wake you, your wait might bail early with non-zero. that's not a bug, that's the feature working exactly as advertised 🧚

🌈 SEE ALSO 🌈

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

go read them all, they're all main characters in their own right πŸ‘‘


πŸ’– that's the whole page, no cap. go lock yourself a bit. carefully. atomically. πŸŽ€

mwah πŸ’‹ this one came straight outta ./include/linux, dated October 2026, and the page itself is wait_on_bit_lock_io(9) β€” catch you in the next manpage, bestie πŸ¦‹βœ¨

πŸ“¦ where this page comes from