[uClibc]Re: errno confusion

Miles Bader miles at lsi.nec.co.jp
Fri Aug 16 04:35:53 UTC 2002


David McCullough <davidm at snapgear.com> writes:
> The only trick is that the assembler on platforms that do both
> threads/non-threads may need changing.  Given that no one likes to change
> working asm,  it may be better if each platform can choose how it operates.
> 
> So for the 850 you might have a define in features.h or elsewhere in "bits"
> that says errno is just referenced directly rather than via a function.

I'd like to define a sane default (e.g. what I suggested in my previous
message), and then add platform-specific overrides only when really
necessary.

I think the changes I suggest won't invalidate any working code
(especially assembly code, since that doesn't see any #definition of
`errno' anyway, and must deal with it explicitly) --

  (1) For a non-threaded C library, (*__errno_location)() is just
      &errno, and removing the #define of `errno' simply makes user C
      code more efficient.

  (2) For a threaded C library, the only difference will be that `errno'
      is #defined inside the C library as well as for user code.  Since
      it _wasn't_ defined before, presumably any C code that was using
      `errno' previously was, in fact, incorrect (and my change will
      just make it correct).  [There might be a few places that need
      special treatment, such as the actual definition of `errno', but
      I presume they are easily identifiable]

-Miles
-- 
I have seen the enemy, and he is us.  -- Pogo



More information about the uClibc mailing list