iounit 1001 B

12345678910111213141516171819202122232425262728293031323334353637
  1. .TH IOUNIT 2
  2. .SH NAME
  3. iounit \- return size of atomic I/O unit for file descriptor
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .B
  10. int iounit(int fd)
  11. .SH DESCRIPTION
  12. Reads and writes of files are transmitted using the 9P protocol (see
  13. .IR intro (5))
  14. and in general, operations involving large amounts of data must be
  15. broken into smaller pieces by the operating system.
  16. The `I/O unit' associated with each file descriptor records the maximum
  17. size, in bytes, that may be read or written without breaking up the transfer.
  18. .PP
  19. The
  20. .I iounit
  21. routine uses the
  22. .IR dup (3)
  23. interface to discover the I/O unit size for the file descriptor
  24. .I fd
  25. and returns its value.
  26. Certain file descriptors, particularly those associated with devices, may
  27. have no specific I/O unit, in which case
  28. .I iounit
  29. will return
  30. .BR 0 .
  31. .SH SOURCE
  32. .B /sys/src/libc/9sys
  33. .SH SEE ALSO
  34. .IR dup (3),
  35. .IR read (5)
  36. .SH DIAGNOSTICS
  37. Returns zero if any error occurs or if the I/O unit size of the fd is unspecified or unknown.