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

# io\_waitread(3)

read from a descriptor

## NAME

io\_waitread - read from a descriptor

## SYNTAX

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

int **io\_waitread**(int64 fd,char\* buf,int64 len);

## DESCRIPTION

io\_waitread tries to read *len* bytes of data from descriptor *fd* into buf\[0\], buf\[1\], ..., buf\[len-1\]. (The effects are undefined if *len* is 0 or smaller.) There are several possible results:

- •

  o\_waitread returns an integer between 1 and *len*: This number of bytes was available for immediate reading; the bytes were read into the beginning of *buf*. Note that this number can be, and often is, smaller than *len*; you must not assume that io\_waitread always succeeds in reading exactly *len* bytes.

- •

  io\_waitread returns 0: No bytes were read, because the descriptor is at end of file. For example, this descriptor has reached the end of a disk file, or is reading an empty pipe that has been closed by all writers.

- •

  io\_waitread returns -3, setting *errno* to something other than EAGAIN: No bytes were read, because the read attempt encountered a persistent error, such as a serious disk failure (EIO), an unreachable network (ENETUNREACH), or an invalid descriptor number (EBADF).

## SEE ALSO

[io\_nonblock(3)](/io_nonblock/3.md), [io\_waitread(3)](/io_waitread/3.md), io\_waitreadtimeout(3)
