wait_on_bit_lock_io(9)
π 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:
wait_on_bit(9)wait_on_bit_io(9)wait_on_bit_timeout(9)wait_on_bit_action(9)wait_on_bit_lock(9)wait_on_bit_lock_action(9)wait_var_event(9)wait_var_event_io(9)wait_var_event_killable(9)wait_var_event_timeout(9)wait_var_event_interruptible(9)wait_var_event_any_lock(9)wait_var_event_spinlock(9)wait_var_event_mutex(9)wake_up_var_protected(9)wake_up_var_locked(9)clear_and_wake_up_bit(9)test_and_clear_wake_up_bit(9)atomic_dec_and_wake_up(9)store_release_wake_up(9)
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
- 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