#include <pthread.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include "libunwind_i.h"
#include "compiler.h"
int getpagesize(void)
{
return 4096;
}
long sysconf(int name)
{
if (name == _SC_PAGESIZE)
{
return getpagesize();
}
errno = EINVAL;
return -1;
}
void* mmap(void *addr, size_t length, int prot, int flags, int fd, size_t offset)
{
if ((flags & MAP_ANONYMOUS) == 0)
return MAP_FAILED;
return calloc(1, length);
}
int munmap(void *addr, size_t length)
{
free(addr);
return 0;
}
int pthread_key_create(pthread_key_t *key, void (*destroy)(void*))
{
return 0;
}
int pthread_setspecific(pthread_key_t key, const void *value)
{
return 0;
}
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
return 0;
}
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
return 0;
}
int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
return 0;
}
int pthread_once(pthread_once_t *control, void (*init)(void))
{
if (control == 0)
return -1;
if (*control != PTHREAD_ONCE_INIT)
{
(*init)();
*control = ~PTHREAD_ONCE_INIT;
}
return 0;
}
int sigfillset(sigset_t *set)
{
return 0;
}
ssize_t read(int fd, void *buf, size_t count)
{
return -1;
}
ssize_t write(int fd, const void *buf, size_t nbyte)
{
return -1;
}
int close(int fd)
{
return -1;
}
unw_accessors_t * unw_get_accessors_int (unw_addr_space_t as)
{
return unw_get_accessors(as);
}
int stat(const char *path, struct stat *buf)
{
return 0;
}
int fstat(int fd, struct stat *buf)
{
return 0;
}