IOUNIT(2)                                               IOUNIT(2)

          iounit - return size of atomic I/O unit for file descriptor

          #include <u.h>
          #include <libc.h>

          int iounit(int fd)

          Reads and writes of files are transmitted using the 9P pro-
          tocol (see 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.

          The iounit routine uses the dup(3) interface to discover the
          I/O unit size for the file descriptor fd and returns its
          value.  Certain file descriptors, particularly those associ-
          ated with devices, may have no specific I/O unit, in which
          case iounit will return 0.


          dup(3), read(5)

          Returns zero if any error occurs or if the I/O unit size of
          the fd is unspecified or unknown.