summaryrefslogtreecommitdiff
path: root/static/plan9-4e/man2/iounit.2
diff options
context:
space:
mode:
Diffstat (limited to 'static/plan9-4e/man2/iounit.2')
-rw-r--r--static/plan9-4e/man2/iounit.237
1 files changed, 37 insertions, 0 deletions
diff --git a/static/plan9-4e/man2/iounit.2 b/static/plan9-4e/man2/iounit.2
new file mode 100644
index 00000000..a31d7079
--- /dev/null
+++ b/static/plan9-4e/man2/iounit.2
@@ -0,0 +1,37 @@
+.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.