fortify-headers/include/poll.h

46 lines
1.1 KiB
C
Raw Normal View History

#ifndef _FORTIFY_POLL_H
#define _FORTIFY_POLL_H
#include_next <poll.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
2015-03-13 23:09:15 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#undef poll
2015-03-11 09:26:11 +00:00
__typeof__(poll) __poll_orig __asm__(__USER_LABEL_PREFIX__ "poll");
2015-03-14 09:38:11 +00:00
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
int poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
__typeof__(sizeof 0) bos = __builtin_object_size(fds, 0);
if (nfds > bos / sizeof(struct pollfd))
__builtin_trap();
return __poll_orig(fds, nfds, timeout);
}
2015-03-03 14:28:25 +00:00
#ifdef _GNU_SOURCE
#undef ppoll
__typeof__(ppoll) __ppoll_orig __asm__(__USER_LABEL_PREFIX__ "ppoll");
2015-03-14 09:38:11 +00:00
extern __inline __attribute__((__always_inline__,__gnu_inline__,__artificial__))
int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *mask)
2015-03-03 14:28:25 +00:00
{
__typeof__(sizeof 0) bos = __builtin_object_size(fds, 0);
if (nfds > bos / sizeof(struct pollfd))
__builtin_trap();
return __ppoll_orig(fds, nfds, timeout, mask);
2015-03-03 14:28:25 +00:00
}
#endif
2015-03-13 23:09:15 +00:00
#ifdef __cplusplus
}
2015-03-11 09:26:11 +00:00
#endif
#endif
#endif