]>
Commit | Line | Data |
---|---|---|
d9a216c0 | 1 | /* Checking macros for poll functions. |
dff8da6b | 2 | Copyright (C) 2012-2024 Free Software Foundation, Inc. |
d9a216c0 UD |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
d9a216c0 UD |
18 | |
19 | #ifndef _SYS_POLL_H | |
20 | # error "Never include <bits/poll2.h> directly; use <sys/poll.h> instead." | |
21 | #endif | |
22 | ||
23 | ||
e5f484c6 UD |
24 | __BEGIN_DECLS |
25 | ||
d9a216c0 UD |
26 | extern int __REDIRECT (__poll_alias, (struct pollfd *__fds, nfds_t __nfds, |
27 | int __timeout), poll); | |
28 | extern int __poll_chk (struct pollfd *__fds, nfds_t __nfds, int __timeout, | |
26492c0a MS |
29 | __SIZE_TYPE__ __fdslen) |
30 | __attr_access ((__write_only__, 1, 2)); | |
d9a216c0 UD |
31 | extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, |
32 | int __timeout, __SIZE_TYPE__ __fdslen), | |
33 | __poll_chk) | |
34 | __warnattr ("poll called with fds buffer too small file nfds entries"); | |
35 | ||
e938c027 | 36 | __fortify_function __fortified_attr_access (__write_only__, 1, 2) int |
d9a216c0 UD |
37 | poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) |
38 | { | |
a643f60c SP |
39 | return __glibc_fortify (poll, __nfds, sizeof (*__fds), |
40 | __glibc_objsize (__fds), | |
41 | __fds, __nfds, __timeout); | |
d9a216c0 UD |
42 | } |
43 | ||
44 | ||
45 | #ifdef __USE_GNU | |
2e274cd8 AZ |
46 | # ifdef __USE_TIME_BITS64 |
47 | extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds, | |
48 | const struct timespec *__timeout, | |
49 | const __sigset_t *__ss), __ppoll64); | |
50 | extern int __ppoll64_chk (struct pollfd *__fds, nfds_t __nfds, | |
51 | const struct timespec *__timeout, | |
52 | const __sigset_t *__ss, __SIZE_TYPE__ __fdslen) | |
53 | __attr_access ((__write_only__, 1, 2)); | |
54 | extern int __REDIRECT (__ppoll64_chk_warn, (struct pollfd *__fds, nfds_t __n, | |
55 | const struct timespec *__timeout, | |
56 | const __sigset_t *__ss, | |
57 | __SIZE_TYPE__ __fdslen), | |
58 | __ppoll64_chk) | |
59 | __warnattr ("ppoll called with fds buffer too small file nfds entries"); | |
60 | ||
61 | __fortify_function __fortified_attr_access (__write_only__, 1, 2) int | |
62 | ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, | |
63 | const __sigset_t *__ss) | |
64 | { | |
65 | return __glibc_fortify (ppoll64, __nfds, sizeof (*__fds), | |
66 | __glibc_objsize (__fds), | |
67 | __fds, __nfds, __timeout, __ss); | |
68 | } | |
69 | # else | |
d9a216c0 UD |
70 | extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, |
71 | const struct timespec *__timeout, | |
72 | const __sigset_t *__ss), ppoll); | |
73 | extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, | |
74 | const struct timespec *__timeout, | |
26492c0a MS |
75 | const __sigset_t *__ss, __SIZE_TYPE__ __fdslen) |
76 | __attr_access ((__write_only__, 1, 2)); | |
d9a216c0 UD |
77 | extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, |
78 | const struct timespec *__timeout, | |
79 | const __sigset_t *__ss, | |
80 | __SIZE_TYPE__ __fdslen), | |
81 | __ppoll_chk) | |
82 | __warnattr ("ppoll called with fds buffer too small file nfds entries"); | |
83 | ||
e938c027 | 84 | __fortify_function __fortified_attr_access (__write_only__, 1, 2) int |
d9a216c0 UD |
85 | ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, |
86 | const __sigset_t *__ss) | |
87 | { | |
a643f60c SP |
88 | return __glibc_fortify (ppoll, __nfds, sizeof (*__fds), |
89 | __glibc_objsize (__fds), | |
90 | __fds, __nfds, __timeout, __ss); | |
d9a216c0 | 91 | } |
2e274cd8 | 92 | # endif |
d9a216c0 | 93 | #endif |
e5f484c6 UD |
94 | |
95 | __END_DECLS |