errno definition broken in non-threaded code

Jim Blandy jimb at
Tue Sep 26 18:49:17 UTC 2006

Rich Felker <dalias at> writes:
> On Mon, Sep 25, 2006 at 12:35:50PM -0700, Jim Blandy wrote:
>> Mike Frysinger <vapier at> writes:
>> > On Saturday 23 September 2006 02:02, Jim Blandy wrote:
>> >> I'm beginning to think libc_hidden_proto and libc_hidden_def can't be
>> >> used for errno in non-threaded configurations, without a change to the
>> >> way errno is defined for user code.  Trunk revision r13360 may not be
>> >> quite right.
>> >
>> > user code should not be accessing errno directly ... that is the point of the 
>> > __errno_location() function ...
>> I see --- so uClibc should not be exporting errno as a plain variable,
>> as it does now.
> Whether it does or not is irrelevant since any program that declares
> "extern int errno;" rather than including errno.h is nonconformant and
> broken according to both ISO C and POSIX.

Yes --- as you say, programs that declare errno themselves are
incorrect.  But they aren't the issue here.

At the moment, in non-threaded configurations, uClibc's own <errno.h>
says "extern int errno;", breaking properly written programs, too.  As
I said earlier, uClibc's own test/inet/bug-if1.c fails because it's
not checking the same errno that uClibc's if_indextoname is setting.

More information about the uClibc mailing list