read_poll_timeout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… read_poll_timeout(9) πŸ’…

okay so bestie, welcome to the kernel API manual β€” this is read_poll_timeout, and honestly? it's giving "just keep checking until it works" energy. she periodically polls an address until a condition is met or a timeout occurs. iconic behavior, no cap. πŸŽ€


✨ SYNOPSIS ✨

read_poll_timeout (op , val , cond , sleep_us , timeout_us ,
sleep_before_read , args... );

that's the whole vibe right there. six named things plus a lil args... situation. slay. πŸ¦‹


🌸 ARGUMENTS 🌸

  • op β€” the accessor function. she's the main character here, and she takes args as her arguments. iykyk.
  • val β€” the variable you're reading the value into. the lil home for your result. 🏠
  • cond β€” the break condition, aka the "we're so done here" check. usually involves val, because of course it does.
  • sleep_us β€” maximum time to sleep between reads, in us. and yes, 0 means tight-loops β€” literally just going feral in a loop, no rest. please read the usleep_range function description for the details and limitations, bestie, i'm begging you. πŸ™ˆ
  • timeout_us β€” timeout in us. 0 means never timeout β€” she waits forever, patient queen. πŸ‘‘
  • sleep_before_read β€” if it's true, sleep for sleep_us before the read. like a lil nap before the vibe check. 😴
  • args β€” the arguments for op poll. they get passed straight through. 🫢

πŸ’– DESCRIPTION πŸ’–

so, when it's available, you'll probably want to use one of the specialized macros defined below rather than this macro directly. like, not me telling you what to do, but… i'm telling you what to do. πŸ’…


⭐ RETURN ⭐

0 on success and -ETIMEDOUT upon a timeout. either way, the last read value at args is stored in val β€” so you always get the receipt. 🧾

🚨 warning, bestie, lowkey important: must not be called from atomic context if sleep_us or timeout_us are used. fr fr. do not do that. πŸ’€

🌈 SEE ALSO 🌈

go read those too, they're literally the family. 🫢✨


and that's the page, bestie! πŸŽ€ this one lives under ./include/linux and the date on it is October 2026 β€” so yeah, straight from the kernel API manual, dated in the future like the icon she is. mwah. πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from