Added errno.h and ptrdiff_t

This commit is contained in:
Max Wash
2020-04-30 17:46:06 +01:00
parent bb1f32f334
commit 7acf66de3e
3 changed files with 37 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
/* XXX This isn't thread safe */
static int __errno = 0;
int *__errno_location(void)
{
return &__errno;
}

View File

@@ -0,0 +1,18 @@
#ifndef ERRNO_H_
#define ERRNO_H_
#include <sys/_errno.h>
#define errno (*__errno_location())
#if defined(__cplusplus)
extern "C" {
#endif
extern int *__errno_location(void);
#if defined(__cplusplus)
}
#endif
#endif

View File

@@ -10,13 +10,21 @@
extern "C" {
#endif /* defined(__cplusplus) */
#ifndef __ptrdiff_t_defined
#define __ptrdiff_t_defined
typedef __intptr_t ptrdiff_t;
#endif
#ifndef __SIZE_T_DEFINED
#define __SIZE_T_DEFINED
#ifndef __size_t_defined
#define __size_t_defined
typedef __uintptr_t size_t;
#endif
#ifndef __ssize_t_defined
#define __ssize_t_defined
typedef __intptr_t ssize_t;
#endif
#if defined(__cplusplus)
}
#endif /* defined(__cplusplus) */