errno
The C library errno
variable is defined in the implicit static data area of the library.
This area is identified
by __user_libspace()
. The function that returns
the address of errno
is:
(*(
volatile int
*) __aeabi_errno_addr())
You can define __aeabi_errno_addr()
if
you want to place errno
at a user-defined location instead
of the default location identified by __user_libspace()
.
Note
Legacy versions of errno.h might define errno
in
terms of __rt_errno_addr()
rather than __aeabi_errno_addr()
.
The function name __rt_errno_addr()
is a legacy
from pre-ABI versions of the tools, and is still supported to ensure
that object files generated with those tools link successfully.
Returns
The return value is a pointer to a variable of type int
,
containing the currently applicable instance of errno
.