Added errno.h and ptrdiff_t
This commit is contained in:
9
photon/libc/errno/errno.c
Normal file
9
photon/libc/errno/errno.c
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
/* XXX This isn't thread safe */
|
||||
static int __errno = 0;
|
||||
|
||||
int *__errno_location(void)
|
||||
{
|
||||
return &__errno;
|
||||
}
|
||||
18
photon/libc/include/errno.h
Normal file
18
photon/libc/include/errno.h
Normal 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
|
||||
@@ -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) */
|
||||
|
||||
Reference in New Issue
Block a user