2017-09-15 07:24:53 +00:00
|
|
|
/** Allows to build programs with libc 2.18 and run on systems with at least libc 2.4,
|
2017-09-15 05:43:43 +00:00
|
|
|
* such as Ubuntu Lucid or CentOS 6.
|
|
|
|
*
|
|
|
|
* Also look at http://www.lightofdawn.org/wiki/wiki.cgi/NewAppsOnOldGlibc
|
|
|
|
*/
|
2017-09-15 05:27:09 +00:00
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
size_t __pthread_get_minstack(const pthread_attr_t * attr)
|
|
|
|
{
|
|
|
|
return 1048576; /// This is a guess. Don't sure it is correct.
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
|
|
|
|
long int syscall(long int __sysno, ...) __THROW;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-15 05:27:09 +00:00
|
|
|
#include <sys/select.h>
|
|
|
|
#include <stdlib.h>
|
2017-09-18 07:10:35 +00:00
|
|
|
#include <features.h>
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-18 07:10:35 +00:00
|
|
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)
|
2017-09-15 05:27:09 +00:00
|
|
|
long int __fdelt_chk(long int d)
|
2017-09-26 20:29:34 +00:00
|
|
|
{
|
|
|
|
if (d < 0)
|
|
|
|
abort();
|
2017-09-18 07:10:35 +00:00
|
|
|
#else
|
|
|
|
unsigned long int __fdelt_chk(unsigned long int d)
|
2017-09-15 05:27:09 +00:00
|
|
|
{
|
2017-09-26 20:29:34 +00:00
|
|
|
#endif
|
|
|
|
if (d >= FD_SETSIZE)
|
2017-09-15 05:27:09 +00:00
|
|
|
abort();
|
|
|
|
return d / __NFDBITS;
|
|
|
|
}
|
|
|
|
|
2017-09-15 05:43:43 +00:00
|
|
|
#include <sys/poll.h>
|
|
|
|
#include <stddef.h>
|
2017-09-15 05:27:09 +00:00
|
|
|
|
|
|
|
int __poll_chk(struct pollfd * fds, nfds_t nfds, int timeout, size_t fdslen)
|
|
|
|
{
|
|
|
|
if (fdslen / sizeof(*fds) < nfds)
|
|
|
|
abort();
|
|
|
|
return poll(fds, nfds, timeout);
|
|
|
|
}
|
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
#include <setjmp.h>
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
void longjmp(jmp_buf env, int val);
|
|
|
|
|
2017-09-16 22:32:04 +00:00
|
|
|
/// NOTE This disables some of FORTIFY_SOURCE functionality.
|
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
void __longjmp_chk(jmp_buf env, int val)
|
2017-09-15 05:27:09 +00:00
|
|
|
{
|
2017-09-15 07:24:53 +00:00
|
|
|
return longjmp(env, val);
|
2017-09-15 05:27:09 +00:00
|
|
|
}
|
|
|
|
|
2017-09-15 07:29:03 +00:00
|
|
|
#include <stdarg.h>
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
int vasprintf(char **s, const char *fmt, va_list ap);
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
int __vasprintf_chk(char **s, const char *fmt, va_list ap)
|
2017-09-15 05:27:09 +00:00
|
|
|
{
|
2017-09-15 07:24:53 +00:00
|
|
|
return vasprintf(s, fmt, ap);
|
|
|
|
}
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-15 07:29:03 +00:00
|
|
|
size_t fread(void *ptr, size_t size, size_t nmemb, void *stream);
|
|
|
|
|
|
|
|
size_t __fread_chk(void *ptr, size_t size, size_t nmemb, void *stream)
|
2017-09-15 07:24:53 +00:00
|
|
|
{
|
|
|
|
return fread(ptr, size, nmemb, stream);
|
|
|
|
}
|
2017-09-15 05:27:09 +00:00
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
int vsscanf(const char *str, const char *format, va_list ap);
|
|
|
|
|
|
|
|
int __isoc99_vsscanf(const char *str, const char *format, va_list ap)
|
|
|
|
{
|
|
|
|
return vsscanf(str, format, ap);
|
2017-09-15 05:27:09 +00:00
|
|
|
}
|
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
int sscanf(const char *restrict s, const char *restrict fmt, ...)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
ret = vsscanf(s, fmt, ap);
|
|
|
|
va_end(ap);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
int __isoc99_sscanf(const char *str, const char *format, ...) __attribute__((weak, alias("sscanf")));
|
|
|
|
|
2017-09-15 07:51:38 +00:00
|
|
|
int open(const char *path, int oflag);
|
|
|
|
|
|
|
|
int __open_2(const char *path, int oflag)
|
|
|
|
{
|
|
|
|
return open(path, oflag);
|
|
|
|
}
|
|
|
|
|
2017-09-15 07:24:53 +00:00
|
|
|
|
2017-09-15 05:27:09 +00:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|