uio.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*++
  2. Copyright (c) 2015 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. uio.h
  9. Abstract:
  10. This header contains definitions for scatter/gather I/O operations.
  11. Author:
  12. Evan Green 15-Jan-2015
  13. --*/
  14. #ifndef _SYS_UIO_H
  15. #define _SYS_UIO_H
  16. //
  17. // ------------------------------------------------------------------- Includes
  18. //
  19. #include <sys/types.h>
  20. //
  21. // ---------------------------------------------------------------- Definitions
  22. //
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. //
  27. // ------------------------------------------------------ Data Type Definitions
  28. //
  29. /*++
  30. Structure Description:
  31. This structure defines the type for a portion of an I/O buffer.
  32. Members:
  33. iov_base - Stores a pointer to the base of the data.
  34. iov_len - Stores the length of the data.
  35. --*/
  36. struct iovec {
  37. void *iov_base;
  38. size_t iov_len;
  39. };
  40. //
  41. // -------------------------------------------------------------------- Globals
  42. //
  43. //
  44. // -------------------------------------------------------- Function Prototypes
  45. //
  46. LIBC_API
  47. ssize_t
  48. readv (
  49. int FileDescriptor,
  50. const struct iovec *IoVector,
  51. int IoVectorCount
  52. );
  53. /*++
  54. Routine Description:
  55. This routine is equivalent to the read function, except that it places data
  56. into the buffers specified by the given I/O vector array.
  57. Arguments:
  58. FileDescriptor - Supplies the file descriptor to read from.
  59. IoVector - Supplies a pointer to an array of I/O vectors.
  60. IoVectorCount - Supplies the number of elements in the I/O vector array.
  61. That is, IoVector[IoVectorCount - 1] will be the last array element
  62. accessed.
  63. Return Value:
  64. Returns the same values a read would (the number of bytes read on success,
  65. or -1 on error with errno set to contain more information).
  66. --*/
  67. LIBC_API
  68. ssize_t
  69. writev (
  70. int FileDescriptor,
  71. const struct iovec *IoVector,
  72. int IoVectorCount
  73. );
  74. /*++
  75. Routine Description:
  76. This routine is equivalent to the write function, except that it reads data
  77. from the buffers specified by the given I/O vector array.
  78. Arguments:
  79. FileDescriptor - Supplies the file descriptor to write to.
  80. IoVector - Supplies a pointer to an array of I/O vectors.
  81. IoVectorCount - Supplies the number of elements in the I/O vector array.
  82. That is, IoVector[IoVectorCount - 1] will be the last array element
  83. accessed.
  84. Return Value:
  85. Returns the same values a write would (the number of bytes written on
  86. success, or -1 on error with errno set to contain more information).
  87. --*/
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif