lib: c: add fallback errno storage for single-threaded programs
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
#include <errno.h>
|
||||
#include <mango/log.h>
|
||||
#include <mango/status.h>
|
||||
|
||||
static int __errno = 32;
|
||||
|
||||
int __attribute__((weak)) * __errno_location(void)
|
||||
{
|
||||
kern_log("using builtin errno");
|
||||
return &__errno;
|
||||
}
|
||||
|
||||
#if defined(BUILD_STATIC)
|
||||
int __set_errno(int err)
|
||||
{
|
||||
@@ -12,6 +21,7 @@ int __set_errno(int err)
|
||||
int __set_errno(int err)
|
||||
{
|
||||
/* TODO */
|
||||
*__errno_location() = err;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user