---
name: "io_fd_canwrite"
section: "3"
platform: "linux"
package: "libowfat-dev"
version: "0.32-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/io_fd_canwrite"
---

# io\_fd\_canwrite(3)

prepare descriptor for io\_wait

## NAME

io\_fd\_canwrite - prepare descriptor for io\_wait

## SYNTAX

**#include \<libowfat/io.h\>**

int **io\_fd**(int64 fd); int **io\_fd\_canwrite**(int64 fd);

## DESCRIPTION

io\_fd\_canwrite is just like io\_fd, except that it assumes the descriptor is writable, which may save a syscall or two.  This assumption is true in most cases, because the kernel buffers writes.  Noteworthy cases in which you need to use io\_fd instead of io\_fd\_canwrite are unconnected sockets, i.e. when you queued a non-blocking connect() and want to ask for writability to get notified when it went through.

It is OK to call this function on a descriptor that io\_fd() has already been called on.

## RETURN VALUE

io\_fd\_canwrite returns 1 on success, 0 on error.

## SEE ALSO

[io\_wait(3)](/io_wait/3.md), [io\_wantread(3)](/io_wantread/3.md), [io\_canread(3)](/io_canread/3.md), [io\_eagain(3)](/io_eagain/3.md), [io\_nonblock(3)](/io_nonblock/3.md), [io\_fd(3)](/io_fd/3.md)
