io_canwrite(3)
π NAME π
io_canwrite β bestie, this one hands you a file descriptor that's ready to be written to β¨
π SYNTAX π
#include <libowfat/io.h>
int64 io_canwrite();
πΈ DESCRIPTION πΈ
okay so io_canwrite returns the next file descriptor that can be written to. that's the whole vibe. π«Ά
but like⦠there are prerequisites, bestie, it's not just gonna hand you fds for free:
- you have to have used
io_wantwrite()on that file descriptor earlier - and you have to have called
io_wait()orio_waituntil()
when you do that, these functions keep an internal data structure of which descriptors the operating system reported as writable. lowkey iconic bookkeeping ngl π
π¨ IMPORTANT REALITY CHECK π¨ there is no guarantee that you can still write data to that descriptor without blocking β only that you could back whenio_wait()orio_waituntil()were called. another process could have written something before you got there. the way that timing works is so rude π so look at the result fromio_trywrite().
if there are no more descriptors that you can write to without blocking, io_canwrite will return -1. and when that happens? you should call io_wait() or io_waituntil() again. go around the loop one more time, bestie, it's giving carousel π
and now the rules of engagement, fr fr:
β οΈ you should only useio_trywrite(3),io_sendfile(3)oriob_send(3)to write to the file. not plainwrite(2). if you do usewrite(2)and getEAGAIN, callio_eagain(3). periodt. π
π¦ SEE ALSO π¦
and that's the page, bestie!! π«Άβ¨ this one's from the Library Functions Manual, and the page itself is io_canwrite(3) β no version or date to speak of, it's just out here living its truth π
mwah, go write some fds 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