line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* Checking macros for poll functions. |
2
|
|
|
|
|
|
|
Copyright (C) 2012-2016 Free Software Foundation, Inc. |
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 |
16
|
|
|
|
|
|
|
License along with the GNU C Library; if not, see |
17
|
|
|
|
|
|
|
. */ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#ifndef _SYS_POLL_H |
20
|
|
|
|
|
|
|
# error "Never include directly; use instead." |
21
|
|
|
|
|
|
|
#endif |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
__BEGIN_DECLS |
25
|
|
|
|
|
|
|
|
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, |
29
|
|
|
|
|
|
|
__SIZE_TYPE__ __fdslen); |
30
|
|
|
|
|
|
|
extern int __REDIRECT (__poll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, |
31
|
|
|
|
|
|
|
int __timeout, __SIZE_TYPE__ __fdslen), |
32
|
|
|
|
|
|
|
__poll_chk) |
33
|
|
|
|
|
|
|
__warnattr ("poll called with fds buffer too small file nfds entries"); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__fortify_function int |
36
|
|
|
|
|
|
|
poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) |
37
|
|
|
|
|
|
|
{ |
38
|
|
|
|
|
|
|
if (__bos (__fds) != (__SIZE_TYPE__) -1) |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
if (! __builtin_constant_p (__nfds)) |
41
|
|
|
|
|
|
|
return __poll_chk (__fds, __nfds, __timeout, __bos (__fds)); |
42
|
|
|
|
|
|
|
else if (__bos (__fds) / sizeof (*__fds) < __nfds) |
43
|
|
|
|
|
|
|
return __poll_chk_warn (__fds, __nfds, __timeout, __bos (__fds)); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
6
|
|
|
|
|
|
return __poll_alias (__fds, __nfds, __timeout); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#ifdef __USE_GNU |
51
|
|
|
|
|
|
|
extern int __REDIRECT (__ppoll_alias, (struct pollfd *__fds, nfds_t __nfds, |
52
|
|
|
|
|
|
|
const struct timespec *__timeout, |
53
|
|
|
|
|
|
|
const __sigset_t *__ss), ppoll); |
54
|
|
|
|
|
|
|
extern int __ppoll_chk (struct pollfd *__fds, nfds_t __nfds, |
55
|
|
|
|
|
|
|
const struct timespec *__timeout, |
56
|
|
|
|
|
|
|
const __sigset_t *__ss, __SIZE_TYPE__ __fdslen); |
57
|
|
|
|
|
|
|
extern int __REDIRECT (__ppoll_chk_warn, (struct pollfd *__fds, nfds_t __nfds, |
58
|
|
|
|
|
|
|
const struct timespec *__timeout, |
59
|
|
|
|
|
|
|
const __sigset_t *__ss, |
60
|
|
|
|
|
|
|
__SIZE_TYPE__ __fdslen), |
61
|
|
|
|
|
|
|
__ppoll_chk) |
62
|
|
|
|
|
|
|
__warnattr ("ppoll called with fds buffer too small file nfds entries"); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__fortify_function int |
65
|
|
|
|
|
|
|
ppoll (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, |
66
|
|
|
|
|
|
|
const __sigset_t *__ss) |
67
|
|
|
|
|
|
|
{ |
68
|
|
|
|
|
|
|
if (__bos (__fds) != (__SIZE_TYPE__) -1) |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
if (! __builtin_constant_p (__nfds)) |
71
|
|
|
|
|
|
|
return __ppoll_chk (__fds, __nfds, __timeout, __ss, __bos (__fds)); |
72
|
|
|
|
|
|
|
else if (__bos (__fds) / sizeof (*__fds) < __nfds) |
73
|
|
|
|
|
|
|
return __ppoll_chk_warn (__fds, __nfds, __timeout, __ss, |
74
|
|
|
|
|
|
|
__bos (__fds)); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
return __ppoll_alias (__fds, __nfds, __timeout, __ss); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
#endif |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END_DECLS |