This is the mail archive of the
glibc-linux@ricardo.ecn.wfu.edu
mailing list for the glibc project.
Re: errno
- To: glibc-linux at ricardo dot ecn dot wfu dot edu
- Subject: Re: errno
- From: Kaz Kylheku <kaz at ashi dot footprints dot net>
- Date: Fri, 15 Oct 1999 05:34:42 -0700 (PDT)
- Reply-To: glibc-linux at ricardo dot ecn dot wfu dot edu
On Fri, 15 Oct 1999, Tseng Chao Ming wrote:
> Date: Fri, 15 Oct 1999 15:44:51 +0800
> From: Tseng Chao Ming <kevin@gv.com.tw>
> Reply-To: glibc-linux@ricardo.ecn.wfu.edu
> To: glibc-linux@ricardo.ecn.wfu.edu
> Subject: errno
>
> hello,
> i want to make a custom lite glibc
> but i cannot find out where errno is
> please help
According to ANSI C, errno is not necessarily the external name of an object
but merely an expression that designates an error value. It can be implemented
as a macro that is put into <errno.h>.
Modern libraries have to support applications that use multiple threads.
In the presence of multiple threads, each thread has to have its own errno.
This requirement can be met using an errno macro that expands to a
thread-specific error location, for example:
extern int *__thread_errno_location(void);
#define errno (*__thread_errno_location())
To see how errno works in glibc, or any library, it's best to start by looking
how the expression is defined in the errno.h header.
- References:
- errno
- From: Tseng Chao Ming (Soft Eng)