git: 9front

ref: f200ab4cf210045ab7424d68a11b7cb0ccd3b9d6
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.