fsleep(9)
β¨ fsleep(9) β¨
okay bestie so this is fsleep from the Kernel API Manual, and honestly? she's the friend who always picks the right outfit for the occasion π
β a flexible sleep that autoselects the best mechanism. no cap.
π¦ SYNOPSIS
void fsleep (unsigned long usecs );
like, that's it. one arg. so clean of her π
πΈ ARGUMENTS
usecsβ the sleep duration you're asking for, measured in microseconds. yes, *micro*seconds. she's precise like that π«Ά
π DESCRIPTION
so here's the whole vibe: fsleep scans the situation and picks the mechanism that gives you at most 25% slack on the sleep duration you asked for. maximum 25%, she's not about to let your timing drift off into the void π. and because she's got range, she does it with three different moves:
udelayloop for sleep durations <= 10 microseconds β because spinning up an hrtimer for a sleep that short is giving unnecessary overhead energy π and she is not about that.usleep_rangefor sleep durations where usingmsleepwould land you with slack bigger than 25%. note: this whole decision depends on the granularity of jiffies, so it's not a fixed rule, iykyk βmsleepfor literally all the other sleep durations. she saves the chill one for last π₯
π NOTE
real talk: when CONFIG_HIGH_RES_TIMERS is not set, every single sleep gets processed with the granularity of jiffies β and that means the slack might exceed 25%, especially for short sleep durations. so... vibe check your config before you come for her, bestie ππ
π SEE ALSO
Kernel file ./include/linux/delay.h plus her whole friend group: mdelay(9), usleep_range(9), usleep_range_idle(9), ssleep(9) π
anyway that's the whole page, mwah π β this iconic little number lives in ./include/linux and is dated October 2026. see u in the next sleep call, 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