io_fd(3)
π io_fd β bestie's guide to prepping a descriptor π
okay so. welcome to io_fd, a lil function from libowfat's io family (that's the Library Functions Manual, for the record). its whole job? getting a descriptor ready so io_wait knows you care about it. that's it. that's the girl. β¨
β¨ SYNOPSIS β¨
#include <libowfat/io.h>
int io_fd(int64 fd);
πΈ DESCRIPTION πΈ
so here's the tea, bestie. if you wanna use io_canread() and io_canwrite() on a descriptor, you have to run io_wait() on it first β and io_wait() has to actually know which descriptors you're interested in. that's where io_fd() comes in. it tells io_wait() "hey, i'm interested in this fd, keep an eye on her." π
now, if you already know the descriptor is writable, call io_fd_canwrite() instead. most fresh descriptors are writable, like if it came from pipe(2) or socketpair(2) or accept(2). doing that saves you one syscall, and saving syscalls is lowkey self-care. π
also, io_pipe and io_socketpair already call io_fd_canwrite() for you, so you don't gotta do a thing. they got you. π«Ά
β οΈ okay important part, no skipping: waiting on descriptors only works for sockets, fifos and pipes. it may also work on devices and TTYs, but that's platform dependent β do not rely on that, fr fr. and it does not work on files. like, at all. don't even try it, it's giving disappointment. π
π₯ RETURN VALUE π₯
io_fdreturns 1 on success, and 0 on error.
that's it. binary queen. π
π SEE ALSO π
and that's the whole page, bestie β this was io_fd(3) from the Library Functions Manual (the libowfat crew, no cap), and there's no version or date info on this one so i can't spill what i don't have π. now go forth and prep those descriptors. slay. π
β¨ππ¦
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· 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 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