#include <sys/stat.h>
#include <sys/times.h>
#include <sys/time.h>
#include <errno.h>

#undef errno
extern int errno;

void _exit(int status) {
  while(1);
}

int _close(int file) {
  return -1;
}

int _fstat(int file, struct stat *st) {
  st->st_mode = S_IFCHR;
  return 0;
}

int _isatty(int file) {
  return 1;
}

int _lseek(int file, int ptr, int dir) {
  return 0;
}

int _open(const char *name, int flags, int mode) {
  return -1;
}

int _read(int file, char *ptr, int len) {
  return 0;
}

void *_sbrk(int incr) {
  errno = ENOMEM;
  return (void *)-1;
}

int _stat(const char *file, struct stat *st) {
  st->st_mode = S_IFCHR;
  return 0;
}

int _unlink(const char *name) {
  errno = ENOENT;
  return -1;
}

int _write(int file, char *ptr, int len) {
  return len;
}

int _getpid(void) {
  return 1;
}

int _kill(int pid, int sig) {
  errno = EINVAL;
  return -1;
}

int _gettimeofday(struct timeval *tv, void *tz) {
  return 0;
}

void _fini(void) {
}
