io_tryreadtimeout(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– io_tryreadtimeout β€” read from a descriptor without blocking πŸ’–

okay bestie, welcome to io_tryreadtimeout(3), straight out of the Library Functions Manual. she's a lil function, she's polite, she does NOT make you wait. let's get into it πŸ¦‹


✨ NAME ✨

io_tryreadtimeout β€” read from a descriptor without blocking πŸ’…


🌸 SYNTAX 🌸

#include <libowfat/io.h>

int io_tryreadtimeout(int64 fd,char* buf,int64 len);

that's it. that's the whole vibe. copy it exactly, don't freestyle the signature, she's sensitive πŸ™ˆ


πŸŽ€ DESCRIPTION πŸŽ€

so here's the tea β˜• β€” io_tryreadtimeout is identical to io_tryread, with literally one exception. one. singular. iconic behaviour, honestly.

if ALL THREE of these things are true at the same time:

  • io_tryread returns -1 (meaning the descriptor is not ready for reading, she's not in the mood yet 😭), and
  • the descriptor has a timeout, and
  • the read attempt happened after the descriptor's timeout πŸ‘€

then β€” and only then β€” io_tryreadtimeout instead returns -2, with errno set to ETIMEDOUT.

so like. she didn't just fail. she failed and she's telling you exactly why. -1 is "not ready bestie, try again", -2 is "girl. you're late. ETIMEDOUT. goodbye." πŸ’€

no cap, if you only remember one thing: -1 = not ready, -2 = not ready and past the timeout, with errno = ETIMEDOUT.

🌈 SEE ALSO 🌈

go read her friends, they're all part of the same squad fr fr:


and that's the whole page, babes 🫢 go forth and never block. this was io_tryreadtimeout(3) from the Library Functions Manual β€” mwah, slay, periodt βœ¨πŸ‘‘