uio.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /* Copyright (C) 1991-2019 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. <http://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;
  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;
  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) __wur;
  56. /* Write data pointed by the buffers described by IOVEC, which is a
  57. vector of COUNT 'struct iovec's, to file descriptor FD at the given
  58. position OFFSET without change the file pointer. The data is
  59. written in the order specified. Operates just like 'pwrite' (see
  60. <unistd.h>) except that the data are taken from IOVEC instead of a
  61. contiguous buffer.
  62. This function is a cancellation point and therefore not marked with
  63. __THROW. */
  64. extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count,
  65. __off_t __offset) __wur;
  66. # else
  67. # ifdef __REDIRECT
  68. extern ssize_t __REDIRECT (preadv, (int __fd, const struct iovec *__iovec,
  69. int __count, __off64_t __offset),
  70. preadv64) __wur;
  71. extern ssize_t __REDIRECT (pwritev, (int __fd, const struct iovec *__iovec,
  72. int __count, __off64_t __offset),
  73. pwritev64) __wur;
  74. # else
  75. # define preadv preadv64
  76. # define pwritev pwritev64
  77. # endif
  78. # endif
  79. # ifdef __USE_LARGEFILE64
  80. /* Read data from file descriptor FD at the given position OFFSET
  81. without change the file pointer, and put the result in the buffers
  82. described by IOVEC, which is a vector of COUNT 'struct iovec's.
  83. The buffers are filled in the order specified. Operates just like
  84. 'pread' (see <unistd.h>) except that data are put in IOVEC instead
  85. of a contiguous buffer.
  86. This function is a cancellation point and therefore not marked with
  87. __THROW. */
  88. extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count,
  89. __off64_t __offset) __wur;
  90. /* Write data pointed by the buffers described by IOVEC, which is a
  91. vector of COUNT 'struct iovec's, to file descriptor FD at the given
  92. position OFFSET without change the file pointer. The data is
  93. written in the order specified. Operates just like 'pwrite' (see
  94. <unistd.h>) except that the data are taken from IOVEC instead of a
  95. contiguous buffer.
  96. This function is a cancellation point and therefore not marked with
  97. __THROW. */
  98. extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
  99. __off64_t __offset) __wur;
  100. # endif
  101. #endif /* Use misc. */
  102. #ifdef __USE_GNU
  103. # ifndef __USE_FILE_OFFSET64
  104. /* Same as preadv but with an additional flag argumenti defined at uio.h. */
  105. extern ssize_t preadv2 (int __fp, const struct iovec *__iovec, int __count,
  106. __off_t __offset, int ___flags) __wur;
  107. /* Same as preadv but with an additional flag argument defined at uio.h. */
  108. extern ssize_t pwritev2 (int __fd, const struct iovec *__iodev, int __count,
  109. __off_t __offset, int __flags) __wur;
  110. # else
  111. # ifdef __REDIRECT
  112. extern ssize_t __REDIRECT (pwritev2, (int __fd, const struct iovec *__iovec,
  113. int __count, __off64_t __offset,
  114. int __flags),
  115. pwritev64v2) __wur;
  116. extern ssize_t __REDIRECT (preadv2, (int __fd, const struct iovec *__iovec,
  117. int __count, __off64_t __offset,
  118. int __flags),
  119. preadv64v2) __wur;
  120. # else
  121. # define preadv2 preadv64v2
  122. # define pwritev2 pwritev64v2
  123. # endif
  124. # endif
  125. # ifdef __USE_LARGEFILE64
  126. /* Same as preadv but with an additional flag argumenti defined at uio.h. */
  127. extern ssize_t preadv64v2 (int __fp, const struct iovec *__iovec,
  128. int __count, __off64_t __offset,
  129. int ___flags) __wur;
  130. /* Same as preadv but with an additional flag argument defined at uio.h. */
  131. extern ssize_t pwritev64v2 (int __fd, const struct iovec *__iodev,
  132. int __count, __off64_t __offset,
  133. int __flags) __wur;
  134. # endif
  135. #endif /* Use GNU. */
  136. __END_DECLS
  137. /* Some operating systems provide system-specific extensions to this
  138. header. */
  139. #ifdef __USE_GNU
  140. # include <bits/uio-ext.h>
  141. #endif
  142. #endif /* sys/uio.h */