io_wantread(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_wantread β€” the "hey bestie, I wanna read from this fd" signal πŸ’–

okay so this is io_wantread(3) from the Library Functions Manual, and honestly? she's a whole mood. let's get into it πŸ¦‹


✨ NAME ✨

io_wantread β€” signal that you want to read from a descriptor πŸ‘‘

🌸 SYNTAX 🌸

#include <libowfat/io.h>

void io_wantread(int64 fd);

πŸ’… DESCRIPTION πŸ’…

so basically io_wantread is you telling the next io_wait() that you want to read from this descriptor. that's it. that's the whole vibe. it's giving "hey, keep an eye on this one for me" 🫢

changed your mind? no worries babe, just call io_dontwantread() again. we love a flexible queen πŸ’–

the next time you call io_wait(), it will look whether this descriptor becomes readable, too. and then you can use io_canread() to check whether the descriptor has actually become readable. check the vibes, confirm the vibes ✨

⚠️ okay important, no cap: you have to have called io_fd on the descriptor first (io_pipe and io_socketpair do this for you, they're the helpful besties who handle it 🧚).

and listen β€” waiting on descriptors only works for sockets, fifos and pipes. it may also work on devices and TTYs, but that's platform dependent, so you should not rely on that. fr fr, don't build your whole personality on it πŸ’€


🌈 SEE ALSO 🌈


and that's the tea, bestie β€” this page lives in io_wantread(3) land, so go forth and read from those descriptors responsibly πŸ’œβœ¨