This is the mail archive of the glibc-linux@ricardo.ecn.wfu.edu mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: errno


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]