poll2.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Checking macros for poll functions.
  2. Copyright (C) 2012-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 _SYS_POLL_H
  16. # error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead."
  17. #endif
  18. __BEGIN_DECLS
  19. extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds,
  20. int __timeout), poll);
  21. extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout,
  22. __SIZE_TYPE__ __fdslen)
  23. __attr_access ((__write_only__, 1, 2));
  24. extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
  25. int __timeout, __SIZE_TYPE__ __fdslen),
  26. __poll_chk)
  27. __warnattr ("poll called with fds buffer too small file nfds entries");
  28. __fortify_function __fortified_attr_access (__write_only__, 1, 2)
  29. __attribute_overloadable__ int
  30. poll (__fortify_clang_overload_arg (struct pollfd *, ,__fds), nfds_t __nfds,
  31. int __timeout)
  32. __fortify_clang_warning_only_if_bos_lt2 (__nfds, __fds, sizeof (*__fds),
  33. "poll called with fds buffer "
  34. "too small file nfds entries")
  35. {
  36. return __glibc_fortify (poll, __nfds, sizeof (*__fds),
  37. __glibc_objsize (__fds),
  38. __fds, __nfds, __timeout);
  39. }
  40. #ifdef __USE_GNU
  41. # ifdef __USE_TIME64_REDIRECTS
  42. extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds,
  43. const struct timespec *__timeout,
  44. const __sigset_t *__ss), __ppoll64);
  45. extern int __ppoll64_chk (struct pollfd *__fds, nfds_t __nfds,
  46. const struct timespec *__timeout,
  47. const __sigset_t *__ss, __SIZE_TYPE__ __fdslen)
  48. __attr_access ((__write_only__, 1, 2));
  49. extern int __REDIRECT (__ppoll64_chk_warn, (struct pollfd *__fds, nfds_t __n,
  50. const struct timespec *__timeout,
  51. const __sigset_t *__ss,
  52. __SIZE_TYPE__ __fdslen),
  53. __ppoll64_chk)
  54. __warnattr ("ppoll called with fds buffer too small file nfds entries");
  55. __fortify_function __fortified_attr_access (__write_only__, 1, 2)
  56. __attribute_overloadable__ int
  57. ppoll (__fortify_clang_overload_arg (struct pollfd *, ,__fds), nfds_t __nfds,
  58. const struct timespec *__timeout, const __sigset_t *__ss)
  59. __fortify_clang_warning_only_if_bos_lt2 (__nfds, __fds, sizeof (*__fds),
  60. "ppoll called with fds buffer "
  61. "too small file nfds entries")
  62. {
  63. return __glibc_fortify (ppoll64, __nfds, sizeof (*__fds),
  64. __glibc_objsize (__fds),
  65. __fds, __nfds, __timeout, __ss);
  66. }
  67. # else
  68. extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds,
  69. const struct timespec *__timeout,
  70. const __sigset_t *__ss), ppoll);
  71. extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds,
  72. const struct timespec *__timeout,
  73. const __sigset_t *__ss, __SIZE_TYPE__ __fdslen)
  74. __attr_access ((__write_only__, 1, 2));
  75. extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds,
  76. const struct timespec *__timeout,
  77. const __sigset_t *__ss,
  78. __SIZE_TYPE__ __fdslen),
  79. __ppoll_chk)
  80. __warnattr ("ppoll called with fds buffer too small file nfds entries");
  81. __fortify_function __fortified_attr_access (__write_only__, 1, 2)
  82. __attribute_overloadable__ int
  83. ppoll (__fortify_clang_overload_arg (struct pollfd *, ,__fds), nfds_t __nfds,
  84. const struct timespec *__timeout, const __sigset_t *__ss)
  85. __fortify_clang_warning_only_if_bos_lt2 (__nfds, __fds, sizeof (*__fds),
  86. "ppoll called with fds buffer "
  87. "too small file nfds entries")
  88. {
  89. return __glibc_fortify (ppoll, __nfds, sizeof (*__fds),
  90. __glibc_objsize (__fds),
  91. __fds, __nfds, __timeout, __ss);
  92. }
  93. # endif
  94. #endif
  95. __END_DECLS