1io_canwrite(3) Library Functions Manual io_canwrite(3)
2
3
4
6 io_canwrite - return a file descriptor that can be written to
7
9 #include <io.h>
10
11 int64 io_canwrite();
12
14 io_canwrite returns the next file descriptor that can be written to.
15 You have to have used io_wantwrite() on the file descriptor earlier,
16 and you have to have called io_wait() or io_waituntil().
17
18 These functions then keep an internal data structure on which descrip‐
19 tors were reported writable by the operating system.
20
21 Please note that there is no guarantee that you can still write data
22 without blocking to that descriptor, just that you could when io_wait()
23 or io_waituntil() were called. Another process could have written
24 something before you. Look at the result from io_trywrite().
25
26 If there are no more descriptors that you can write to without block‐
27 ing, io_canwrite will return -1. In this case you should call
28 io_wait() or io_waituntil() again.
29
30 You should only use io_trywrite(3), io_sendfile(3) or iob_send(3) to
31 write to the file, not plain write(2). If you use write(2) and get
32 EAGAIN, call io_eagain(3).
33
35 io_wait(3), io_canwrite(3)
36
37
38
39 io_canwrite(3)