unistd-decl.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /* Checking routines for unistd functions. Declaration only.
  2. Copyright (C) 2023-2026 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifndef _BITS_UNISTD_DECL_H
  16. #define _BITS_UNISTD_DECL_H 1
  17. #ifndef _UNISTD_H
  18. # error "Never include <bits/unistd-decl.h> directly; use <unistd.h> instead."
  19. #endif
  20. extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
  21. size_t __buflen)
  22. __wur __attr_access ((__write_only__, 2, 3));
  23. extern ssize_t __REDIRECT_FORTIFY (__read_alias, (int __fd, void *__buf,
  24. size_t __nbytes), read)
  25. __wur __attr_access ((__write_only__, 2, 3));
  26. extern ssize_t __REDIRECT (__read_chk_warn,
  27. (int __fd, void *__buf, size_t __nbytes,
  28. size_t __buflen), __read_chk)
  29. __wur __warnattr ("read called with bigger length than size of "
  30. "the destination buffer");
  31. #if defined __USE_UNIX98 || defined __USE_XOPEN2K8
  32. extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
  33. __off_t __offset, size_t __bufsize)
  34. __wur __attr_access ((__write_only__, 2, 3));
  35. extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
  36. __off64_t __offset, size_t __bufsize)
  37. __wur __attr_access ((__write_only__, 2, 3));
  38. extern ssize_t __REDIRECT (__pread_alias,
  39. (int __fd, void *__buf, size_t __nbytes,
  40. __off_t __offset), pread)
  41. __wur __attr_access ((__write_only__, 2, 3));
  42. extern ssize_t __REDIRECT (__pread64_alias,
  43. (int __fd, void *__buf, size_t __nbytes,
  44. __off64_t __offset), pread64)
  45. __wur __attr_access ((__write_only__, 2, 3));
  46. extern ssize_t __REDIRECT (__pread_chk_warn,
  47. (int __fd, void *__buf, size_t __nbytes,
  48. __off_t __offset, size_t __bufsize), __pread_chk)
  49. __wur __warnattr ("pread called with bigger length than size of "
  50. "the destination buffer");
  51. extern ssize_t __REDIRECT (__pread64_chk_warn,
  52. (int __fd, void *__buf, size_t __nbytes,
  53. __off64_t __offset, size_t __bufsize),
  54. __pread64_chk)
  55. __wur __warnattr ("pread64 called with bigger length than size of "
  56. "the destination buffer");
  57. #endif
  58. #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
  59. extern ssize_t __readlink_chk (const char *__restrict __path,
  60. char *__restrict __buf, size_t __len,
  61. size_t __buflen)
  62. __THROW __nonnull ((1, 2)) __wur __attr_access ((__write_only__, 2, 3));
  63. extern ssize_t __REDIRECT_NTH (__readlink_alias,
  64. (const char *__restrict __path,
  65. char *__restrict __buf, size_t __len), readlink)
  66. __nonnull ((1, 2)) __wur __attr_access ((__write_only__, 2, 3));
  67. extern ssize_t __REDIRECT_NTH (__readlink_chk_warn,
  68. (const char *__restrict __path,
  69. char *__restrict __buf, size_t __len,
  70. size_t __buflen), __readlink_chk)
  71. __nonnull ((1, 2)) __wur __warnattr ("readlink called with bigger length "
  72. "than size of destination buffer");
  73. #endif
  74. #ifdef __USE_ATFILE
  75. extern ssize_t __readlinkat_chk (int __fd, const char *__restrict __path,
  76. char *__restrict __buf, size_t __len,
  77. size_t __buflen)
  78. __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4));
  79. extern ssize_t __REDIRECT_NTH (__readlinkat_alias,
  80. (int __fd, const char *__restrict __path,
  81. char *__restrict __buf, size_t __len),
  82. readlinkat)
  83. __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4));
  84. extern ssize_t __REDIRECT_NTH (__readlinkat_chk_warn,
  85. (int __fd, const char *__restrict __path,
  86. char *__restrict __buf, size_t __len,
  87. size_t __buflen), __readlinkat_chk)
  88. __nonnull ((2, 3)) __wur __warnattr ("readlinkat called with bigger "
  89. "length than size of destination "
  90. "buffer");
  91. #endif
  92. extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
  93. __THROW __wur;
  94. extern char *__REDIRECT_NTH (__getcwd_alias,
  95. (char *__buf, size_t __size), getcwd) __wur;
  96. extern char *__REDIRECT_NTH (__getcwd_chk_warn,
  97. (char *__buf, size_t __size, size_t __buflen),
  98. __getcwd_chk)
  99. __wur __warnattr ("getcwd caller with bigger length than size of "
  100. "destination buffer");
  101. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
  102. extern char *__getwd_chk (char *__buf, size_t buflen)
  103. __THROW __nonnull ((1)) __wur __attr_access ((__write_only__, 1, 2));
  104. extern char *__REDIRECT_NTH (__getwd_warn, (char *__buf), getwd)
  105. __nonnull ((1)) __wur __warnattr ("please use getcwd instead, as getwd "
  106. "doesn't specify buffer size");
  107. #endif
  108. extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
  109. size_t __buflen) __THROW
  110. __attr_access ((__write_only__, 2, 3));
  111. extern size_t __REDIRECT_NTH (__confstr_alias, (int __name, char *__buf,
  112. size_t __len), confstr)
  113. __attr_access ((__write_only__, 2, 3));
  114. extern size_t __REDIRECT_NTH (__confstr_chk_warn,
  115. (int __name, char *__buf, size_t __len,
  116. size_t __buflen), __confstr_chk)
  117. __warnattr ("confstr called with bigger length than size of destination "
  118. "buffer");
  119. extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
  120. __THROW __wur __attr_access ((__write_only__, 2, 1));
  121. extern int __REDIRECT_NTH (__getgroups_alias, (int __size, __gid_t __list[]),
  122. getgroups) __wur __attr_access ((__write_only__, 2, 1));
  123. extern int __REDIRECT_NTH (__getgroups_chk_warn,
  124. (int __size, __gid_t __list[], size_t __listlen),
  125. __getgroups_chk)
  126. __wur __warnattr ("getgroups called with bigger group count than what "
  127. "can fit into destination buffer");
  128. extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
  129. size_t __nreal) __THROW __nonnull ((2))
  130. __attr_access ((__write_only__, 2, 3));
  131. extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
  132. size_t __buflen), ttyname_r)
  133. __nonnull ((2));
  134. extern int __REDIRECT_NTH (__ttyname_r_chk_warn,
  135. (int __fd, char *__buf, size_t __buflen,
  136. size_t __nreal), __ttyname_r_chk)
  137. __nonnull ((2)) __warnattr ("ttyname_r called with bigger buflen than "
  138. "size of destination buffer");
  139. #ifdef __USE_POSIX199506
  140. extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
  141. __nonnull ((1)) __attr_access ((__write_only__, 1, 2));
  142. extern int __REDIRECT_FORTIFY (__getlogin_r_alias, (char *__buf, size_t __buflen),
  143. getlogin_r) __nonnull ((1));
  144. extern int __REDIRECT (__getlogin_r_chk_warn,
  145. (char *__buf, size_t __buflen, size_t __nreal),
  146. __getlogin_r_chk)
  147. __nonnull ((1)) __warnattr ("getlogin_r called with bigger buflen than "
  148. "size of destination buffer");
  149. #endif
  150. #if defined __USE_MISC || defined __USE_UNIX98
  151. extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
  152. __THROW __nonnull ((1)) __attr_access ((__write_only__, 1, 2));
  153. extern int __REDIRECT_NTH (__gethostname_alias, (char *__buf, size_t __buflen),
  154. gethostname)
  155. __nonnull ((1)) __attr_access ((__write_only__, 1, 2));
  156. extern int __REDIRECT_NTH (__gethostname_chk_warn,
  157. (char *__buf, size_t __buflen, size_t __nreal),
  158. __gethostname_chk)
  159. __nonnull ((1)) __warnattr ("gethostname called with bigger buflen than "
  160. "size of destination buffer");
  161. #endif
  162. #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_UNIX98)
  163. extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
  164. __THROW __nonnull ((1)) __wur __attr_access ((__write_only__, 1, 2));
  165. extern int __REDIRECT_FORTIFY_NTH (__getdomainname_alias, (char *__buf,
  166. size_t __buflen),
  167. getdomainname) __nonnull ((1))
  168. __wur __attr_access ((__write_only__, 1, 2));
  169. extern int __REDIRECT_NTH (__getdomainname_chk_warn,
  170. (char *__buf, size_t __buflen, size_t __nreal),
  171. __getdomainname_chk)
  172. __nonnull ((1)) __wur __warnattr ("getdomainname called with bigger "
  173. "buflen than size of destination "
  174. "buffer");
  175. #endif
  176. #endif /* bits/unistd-decl.h. */