diff --git a/include/bits/errno.h b/include/bits/errno.h index c4f10c1d1f849ee390145fe62a522dae046ac7f7..5181e3a9009de3dc1b574cd056c1410ec2a99170 100644 --- a/include/bits/errno.h +++ b/include/bits/errno.h @@ -7,7 +7,7 @@ extern "C" { #define ENOTSUP EOPNOTSUPP -extern __thread int errno; +#define errno (*__errno_location()) #ifdef __cplusplus } // extern "C" diff --git a/src/header/errno/mod.rs b/src/header/errno/mod.rs index e39fb205e555990f4be38832bc8c0174bf341476..a203373bda1e9a2eb07cd3c634c72a535f6872a5 100644 --- a/src/header/errno/mod.rs +++ b/src/header/errno/mod.rs @@ -3,14 +3,15 @@ use platform; use platform::types::*; +//TODO: Consider removing, provided for compatibility with newlib #[no_mangle] pub unsafe extern "C" fn __errno() -> *mut c_int { - &mut platform::errno + __errno_location() } #[no_mangle] pub unsafe extern "C" fn __errno_location() -> *mut c_int { - __errno() + &mut platform::errno } pub const EPERM: c_int = 1; /* Operation not permitted */