diff options
Diffstat (limited to 'libc/bionic')
-rw-r--r-- | libc/bionic/__set_errno.cpp (renamed from libc/bionic/__set_errno.c) | 40 | ||||
-rw-r--r-- | libc/bionic/pthread.c | 1 |
2 files changed, 18 insertions, 23 deletions
diff --git a/libc/bionic/__set_errno.c b/libc/bionic/__set_errno.cpp index 163d40444..5b249c8bb 100644 --- a/libc/bionic/__set_errno.c +++ b/libc/bionic/__set_errno.cpp @@ -28,29 +28,25 @@ #include <errno.h> +// These functions are called from our assembler syscall stubs. +// C/C++ code should just assign 'errno' instead. -int __set_errno(int n) -{ - errno = n; - return -1; +// TODO: should be __LIBC_HIDDEN__, but already exported by NDK :-( +// TODO: this isn't used on ARM. +extern "C" int __set_errno(int n) { + errno = n; + return -1; } -/* - * this function is called from syscall stubs, - * (tail-called in the case of 0-4 arg versions) - */ - -__LIBC_HIDDEN__ -int __set_syscall_errno(int n) -{ - /* some syscalls, mmap() for example, have valid return - ** values that are "negative". Since errno values are not - ** greater than 131 on Linux, we will just consider - ** anything significantly out of range as not-an-error - */ - if(n > -256) { - return __set_errno(-n); - } else { - return n; - } +// TODO: this is only used on ARM, but is exported by NDK on all platforms :-( +extern "C" __LIBC_HIDDEN__ int __set_syscall_errno(int n) { + // Some syscalls, mmap() for example, have valid return + // values that are "negative". Since errno values are not + // greater than 131 on Linux, we will just consider + // anything significantly out of range as not-an-error. + if(n > -256) { + return __set_errno(-n); + } else { + return n; + } } diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index d8d0d0541..b685f2dcd 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -59,7 +59,6 @@ extern void pthread_debug_mutex_unlock_check(pthread_mutex_t *mutex); extern int __pthread_clone(int (*fn)(void*), void *child_stack, int flags, void *arg); extern void _exit_with_stack_teardown(void * stackBase, int stackSize, int retCode); extern void _exit_thread(int retCode); -extern int __set_errno(int); int __futex_wake_ex(volatile void *ftx, int pshared, int val) { |