2 ** Copyright 2003-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
6 /* Provides user space storage for "errno", located in TLS
11 #include "support/TLS.h"
18 return (int *)tls_address(TLS_ERRNO_SLOT
);
22 // This is part of the Linuxbase binary specification
23 // and is referenced by some code in libgcc.a.
24 // ToDo: maybe we even want to include this always
26 extern int *(*__errno_location
)(void) __attribute__ ((weak
, alias("_errnop")));
34 _to_positive_error(int error
)
37 return error
== B_NO_MEMORY
? -B_POSIX_ENOMEM
: -error
;
43 _to_negative_error(int error
)
45 return error
> 0 ? -error
: error
;