diff --git a/include/errno.h b/include/errno.h index 1b4a473f..19e8f5c0 100644 --- a/include/errno.h +++ b/include/errno.h @@ -29,6 +29,7 @@ #else // ! WITH_GLIBC int errno; #define ENOENT 2 +#define EINTR 4 #define EIO 5 #define EBADF 9 #define EAGAIN 11 diff --git a/include/fcntl.h b/include/fcntl.h index 27666185..ab89de08 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -28,12 +28,16 @@ #include_next #else // ! WITH_GLIBC + #define O_RDONLY 0 #define O_WRONLY 1 #define O_RDWR 2 #define O_CREAT 64 #define O_EXCL 128 #define O_TRUNC 512 +#define O_APPEND 1024 + +#define FD_CLOEXEC 1 #define F_DUPFD 0 #define F_GETFD 1 diff --git a/include/sys/resource.h b/include/sys/resource.h index 29c359f3..099bb5fc 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -26,6 +26,8 @@ #else // ! WITH_GLIBC +#include + struct rusage { struct timeval ru_utime; diff --git a/lib/binutils.c b/lib/binutils.c index 102bed10..13f212b8 100644 --- a/lib/binutils.c +++ b/lib/binutils.c @@ -223,3 +223,55 @@ sbrk (intptr_t delta) return malloc (delta); return g_brk; } + +// binutils 2.30 +char * +strdup (char const *s) +{ + size_t length = strlen (s) + 1; + char *p = (char*)malloc (length); + if (p) + return memcpy (p, s, length); + return 0; +} + +int +raise (int signum) +{ + kill (getpid (), signum); +} + +size_t +strftime (char *s, size_t size, char const *template, + struct tm const *brokentime) +{ + eputs ("strftime stub\n"); + return template; +} + +#if !__MESC__ +typedef char wchar_t[]; + +size_t +mbstowcs (wchar_t *wstring, char const *string, + size_t size) +{ + eputs ("mbstowcs stub\n"); + strcpy (wstring, string); + return strlen (string); +} +#endif + +void +clearerr (FILE *stream) +{ + errno = 0; +} + +double +fabs (double number) +{ + if (number < 0) + return -number; + return number; +}