io_waitread(3)
π io_waitread(3) π
okay so bestie, welcome to io_waitread β the <libowfat/io.h> girlies know π
this one is literally about reading from a descriptor. that's it. that's the whole vibe. no cap.
β¨ NAME β¨
io_waitread β read from a descriptor π«Ά
πΈ SYNTAX πΈ
#include <libowfat/io.h>
int io_waitread(int64 fd,char* buf,int64 len);
π¦ DESCRIPTION π¦
so what io_waitread does is it tries to read len bytes of data from descriptor fd into buf[0], buf[1], ..., buf[len-1]. yes queen, straight into your buffer, index by index, no skips.
β οΈ real talk though: the effects are undefined iflenis0or smaller. undefined. not "kinda weird", not "probably fine" β undefined. do not do it. do not test it. do not look at it funny. π«
there are a few possible outcomes, and each one is its own little moment:
io_waitreadreturns an integer between1andlenβ yay! that many bytes were available for immediate reading, and they got read into the beginning ofbuf. but bestie, hear me: this number can be, and often is, smaller thanlen. you must not assumeio_waitreadalways succeeds in reading exactlylenbytes. it's giving "partial read" and that is completely valid behaviour. π don't write code that pretends otherwise.io_waitreadreturns0β no bytes were read, because the descriptor is at end of file. like, for example, this descriptor has reached the end of a disk file, or it's reading an empty pipe that has been closed by all writers. that's it, that's the end, the story is over, nobody's writing anymore. πio_waitreadreturns-3, settingerrnoto something other thanEAGAINβ no bytes were read, because the read attempt encountered a persistent error. and by persistent we mean persistent, like: a serious disk failure (EIO), an unreachable network (ENETUNREACH), or an invalid descriptor number (EBADF). this is not a "try again later" moment, this is a "something is actually wrong" moment. π
π₯ SEE ALSO π₯
io_nonblock(3)io_waitread(3)io_waitreadtimeout(3)
and that's the page, bestie π§ straight from the Library Functions Manual, filed under io_waitread(3) β the same name up top and down at the bottom, iconic symmetry fr fr. now go read your descriptor responsibly πβ¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms