shithub: riscv

ref: 3d1908d762c6e91e0b6fe2e235e85bdf397d092d
dir: /sys/man/2/iounit/

View raw version
.TH IOUNIT 2
.SH NAME
iounit \- return size of atomic I/O unit for file descriptor
.SH SYNOPSIS
.B #include <u.h>
.br
.B #include <libc.h>
.PP
.B
int iounit(int fd)
.SH DESCRIPTION
Reads and writes of files are transmitted using the 9P protocol (see
.IR intro (5))
and in general, operations involving large amounts of data must be
broken into smaller pieces by the operating system.
The `I/O unit' associated with each file descriptor records the maximum
size, in bytes, that may be read or written without breaking up the transfer.
.PP
The
.I iounit
routine uses the
.IR dup (3)
interface to discover the I/O unit size for the file descriptor
.I fd
and returns its value.
Certain file descriptors, particularly those associated with devices, may
have no specific I/O unit, in which case
.I iounit
will return
.BR 0 .
.SH SOURCE
.B /sys/src/libc/9sys
.SH SEE ALSO
.IR dup (3),
.IR read (5)
.SH DIAGNOSTICS
Returns zero if any error occurs or if the I/O unit size of the fd is unspecified or unknown.