uio.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /* Copyright (C) 1991-2026 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <https://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_UIO_H
  15. #define _SYS_UIO_H 1
  16. #include <features.h>
  17. #include <sys/types.h>
  18. #include <bits/types/struct_iovec.h>
  19. #include <bits/uio_lim.h>
  20. #ifdef __IOV_MAX
  21. # define UIO_MAXIOV __IOV_MAX
  22. #else
  23. # undef UIO_MAXIOV
  24. #endif
  25. __BEGIN_DECLS
  26. /* Read data from file descriptor FD, and put the result in the
  27. buffers described by IOVEC, which is a vector of COUNT 'struct iovec's.
  28. The buffers are filled in the order specified.
  29. Operates just like 'read' (see <unistd.h>) except that data are
  30. put in IOVEC instead of a contiguous buffer.
  31. This function is a cancellation point and therefore not marked with
  32. __THROW. */
  33. extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count)
  34. __wur __attr_access ((__read_only__, 2, 3));
  35. /* Write data pointed by the buffers described by IOVEC, which
  36. is a vector of COUNT 'struct iovec's, to file descriptor FD.
  37. The data is written in the order specified.
  38. Operates just like 'write' (see <unistd.h>) except that the data
  39. are taken from IOVEC instead of a contiguous buffer.
  40. This function is a cancellation point and therefore not marked with
  41. __THROW. */
  42. extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count)
  43. __wur __attr_access ((__read_only__, 2, 3));
  44. #ifdef __USE_MISC
  45. # ifndef __USE_FILE_OFFSET64
  46. /* Read data from file descriptor FD at the given position OFFSET
  47. without change the file pointer, and put the result in the buffers
  48. described by IOVEC, which is a vector of COUNT 'struct iovec's.
  49. The buffers are filled in the order specified. Operates just like
  50. 'pread' (see <unistd.h>) except that data are put in IOVEC instead
  51. of a contiguous buffer.
  52. This function is a cancellation point and therefore not marked with
  53. __THROW. */
  54. extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count,
  55. __off_t __offset)
  56. __wur __attr_access ((__read_only__, 2, 3));
  57. /* Write data pointed by the buffers described by IOVEC, which is a
  58. vector of COUNT 'struct iovec's, to file descriptor FD at the given
  59. position OFFSET without change the file pointer. The data is
  60. written in the order specified. Operates just like 'pwrite' (see
  61. <unistd.h>) except that the data are taken from IOVEC instead of a
  62. contiguous buffer.
  63. This function is a cancellation point and therefore not marked with
  64. __THROW. */
  65. extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
  66. __off_t __offset)
  67. __wur __attr_access ((__read_only__, 2, 3));
  68. # else
  69. # ifdef __REDIRECT
  70. extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
  71. int __count, __off64_t __offset),
  72. preadv64)
  73. __wur __attr_access ((__read_only__, 2, 3));
  74. extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec,
  75. int __count, __off64_t __offset),
  76. pwritev64)
  77. __wur __attr_access ((__read_only__, 2, 3));
  78. # else
  79. # define preadv preadv64
  80. # define pwritev pwritev64
  81. # endif
  82. # endif
  83. # ifdef __USE_LARGEFILE64
  84. /* Read data from file descriptor FD at the given position OFFSET
  85. without change the file pointer, and put the result in the buffers
  86. described by IOVEC, which is a vector of COUNT 'struct iovec's.
  87. The buffers are filled in the order specified. Operates just like
  88. 'pread' (see <unistd.h>) except that data are put in IOVEC instead
  89. of a contiguous buffer.
  90. This function is a cancellation point and therefore not marked with
  91. __THROW. */
  92. extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count,
  93. __off64_t __offset)
  94. __wur __attr_access ((__read_only__, 2, 3));
  95. /* Write data pointed by the buffers described by IOVEC, which is a
  96. vector of COUNT 'struct iovec's, to file descriptor FD at the given
  97. position OFFSET without change the file pointer. The data is
  98. written in the order specified. Operates just like 'pwrite' (see
  99. <unistd.h>) except that the data are taken from IOVEC instead of a
  100. contiguous buffer.
  101. This function is a cancellation point and therefore not marked with
  102. __THROW. */
  103. extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
  104. __off64_t __offset)
  105. __wur __attr_access ((__read_only__, 2, 3));
  106. # endif
  107. #endif /* Use misc. */
  108. #ifdef __USE_GNU
  109. # ifndef __USE_FILE_OFFSET64
  110. /* Same as preadv but with an additional flag argumenti defined at uio.h. */
  111. extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
  112. __off_t __offset, int ___flags)
  113. __wur __attr_access ((__read_only__, 2, 3));
  114. /* Same as preadv but with an additional flag argument defined at uio.h. */
  115. extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
  116. __off_t __offset, int __flags) __wur;
  117. # else
  118. # ifdef __REDIRECT
  119. extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
  120. int __count, __off64_t __offset,
  121. int __flags),
  122. pwritev64v2)
  123. __wur __attr_access ((__read_only__, 2, 3));
  124. extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
  125. int __count, __off64_t __offset,
  126. int __flags),
  127. preadv64v2)
  128. __wur __attr_access ((__read_only__, 2, 3));
  129. # else
  130. # define preadv2 preadv64v2
  131. # define pwritev2 pwritev64v2
  132. # endif
  133. # endif
  134. # ifdef __USE_LARGEFILE64
  135. /* Same as preadv but with an additional flag argumenti defined at uio.h. */
  136. extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
  137. int __count, __off64_t __offset,
  138. int ___flags)
  139. __wur __attr_access ((__read_only__, 2, 3));
  140. /* Same as preadv but with an additional flag argument defined at uio.h. */
  141. extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
  142. int __count, __off64_t __offset,
  143. int __flags)
  144. __wur __attr_access ((__read_only__, 2, 3));
  145. # endif
  146. #endif /* Use GNU. */
  147. __END_DECLS
  148. /* Some operating systems provide system-specific extensions to this
  149. header. */
  150. #ifdef __USE_GNU
  151. # include <bits/uio-ext.h>
  152. #endif
  153. #endif /* sys/uio.h */