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

# io\_fd(3)

prepare descriptor for io\_wait

## NAME

io\_fd - prepare descriptor for io\_wait

## SYNTAX

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

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

## DESCRIPTION

If you want to use io\_canread() and io\_canwrite() on a descriptor, you have to use io\_wait() on it first, and io\_wait() has to know which descriptors you are interested in.  Use io\_fd() for this.

io\_pipe and io\_socketpair already call io\_fd for you.

Waiting on descriptors only works for sockets, fifos and pipes.  It may also work on devices and TTYs, but that is platform dependent -- you should not rely on that.  It does not work on files.

## RETURN VALUE

io\_fd 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)
