2016-06-27 06:34:10 +00:00
|
|
|
/// Include this file with -include compiler parameter.
|
|
|
|
/// And add -Wl,--wrap=memcpy for linking.
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/select.h>
|
|
|
|
|
2016-06-27 06:52:27 +00:00
|
|
|
__attribute__((__weak__)) long int __fdelt_chk(long int d)
|
2016-06-27 06:34:10 +00:00
|
|
|
{
|
|
|
|
if (d < 0 || d >= FD_SETSIZE)
|
|
|
|
abort();
|
|
|
|
return d / __NFDBITS;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <sys/poll.h>
|
|
|
|
|
2016-06-27 06:52:27 +00:00
|
|
|
__attribute__((__weak__)) int __poll_chk(struct pollfd * fds, nfds_t nfds, int timeout, __SIZE_TYPE__ fdslen)
|
2016-06-27 06:34:10 +00:00
|
|
|
{
|
|
|
|
if (fdslen / sizeof(*fds) < nfds)
|
|
|
|
abort();
|
|
|
|
return poll(fds, nfds, timeout);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-27 06:52:27 +00:00
|
|
|
__attribute__((__weak__)) void * __memcpy_glibc_2_2_5(void *, const void *, size_t);
|
2016-06-27 06:34:10 +00:00
|
|
|
|
|
|
|
__asm__(".symver __memcpy_glibc_2_2_5, memcpy@GLIBC_2.2.5");
|
|
|
|
|
2016-06-27 06:52:27 +00:00
|
|
|
__attribute__((__weak__)) void * __wrap_memcpy(void * dest, const void * src, size_t n)
|
2016-06-27 06:34:10 +00:00
|
|
|
{
|
|
|
|
return __memcpy_glibc_2_2_5(dest, src, n);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-27 07:13:54 +00:00
|
|
|
size_t __pthread_get_minstack(const pthread_attr_t * attr)
|
|
|
|
{
|
|
|
|
return 1048576;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <unistd.h>
|
2016-06-27 07:15:48 +00:00
|
|
|
#include <sys/syscall.h>
|
2016-06-27 07:13:54 +00:00
|
|
|
|
|
|
|
int __gai_sigqueue(int sig, const union sigval val, pid_t caller_pid)
|
|
|
|
{
|
|
|
|
siginfo_t info;
|
|
|
|
|
|
|
|
memset(&info, 0, sizeof(siginfo_t));
|
|
|
|
info.si_signo = sig;
|
|
|
|
info.si_code = SI_ASYNCNL;
|
|
|
|
info.si_pid = caller_pid;
|
|
|
|
info.si_uid = getuid();
|
|
|
|
info.si_value = val;
|
|
|
|
|
|
|
|
return syscall(__NR_rt_sigqueueinfo, info.si_pid, sig, &info);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-27 06:34:10 +00:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|