diff options
Diffstat (limited to 'include/poll.h')
| -rw-r--r-- | include/poll.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/poll.h b/include/poll.h index d00d7c1..995f197 100644 --- a/include/poll.h +++ b/include/poll.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include_next <poll.h> | 4 | #include_next <poll.h> |
| 5 | 5 | ||
| 6 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 | 6 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0 |
| 7 | #include "fortify-headers.h" | ||
| 7 | 8 | ||
| 8 | #ifdef __cplusplus | 9 | #ifdef __cplusplus |
| 9 | extern "C" { | 10 | extern "C" { |
| @@ -11,28 +12,25 @@ extern "C" { | |||
| 11 | 12 | ||
| 12 | #undef poll | 13 | #undef poll |
| 13 | 14 | ||
| 14 | __typeof__(poll) __poll_orig __asm__(__USER_LABEL_PREFIX__ "poll"); | 15 | fortify_fn(poll) int poll(struct pollfd *fds, nfds_t nfds, int timeout) |
| 15 | extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | ||
| 16 | int poll(struct pollfd *fds, nfds_t nfds, int timeout) | ||
| 17 | { | 16 | { |
| 18 | __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); | 17 | __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); |
| 19 | 18 | ||
| 20 | if (nfds > bos / sizeof(struct pollfd)) | 19 | if (nfds > bos / sizeof(struct pollfd)) |
| 21 | __builtin_trap(); | 20 | __builtin_trap(); |
| 22 | return __poll_orig(fds, nfds, timeout); | 21 | return __orig_poll(fds, nfds, timeout); |
| 23 | } | 22 | } |
| 24 | 23 | ||
| 25 | #ifdef _GNU_SOURCE | 24 | #ifdef _GNU_SOURCE |
| 26 | #undef ppoll | 25 | #undef ppoll |
| 27 | __typeof__(ppoll) __ppoll_orig __asm__(__USER_LABEL_PREFIX__ "ppoll"); | 26 | fortify_fn(ppoll) int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, |
| 28 | extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__)) | 27 | const sigset_t *mask) |
| 29 | int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *mask) | ||
| 30 | { | 28 | { |
| 31 | __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); | 29 | __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); |
| 32 | 30 | ||
| 33 | if (nfds > bos / sizeof(struct pollfd)) | 31 | if (nfds > bos / sizeof(struct pollfd)) |
| 34 | __builtin_trap(); | 32 | __builtin_trap(); |
| 35 | return __ppoll_orig(fds, nfds, timeout, mask); | 33 | return __orig_ppoll(fds, nfds, timeout, mask); |
| 36 | } | 34 | } |
| 37 | #endif | 35 | #endif |
| 38 | 36 | ||
