[uClibc]Re: errno confusion

Miles Bader miles at lsi.nec.co.jp
Fri Aug 16 02:41:00 UTC 2002


Any response to this?

My gut feeling is that:

 (1) For systems without threads (__UCLIBC_HAS_THREADS__ undefined),
     `errno' should never be defined, and should just be normal
     variable.

 (2) For systems _with_ threads (__UCLIBC_HAS_THREADS__ defined),
     `errno' should be defined the same regardless of whether _LIBC is
     defined or not; code that needs to do something special inside uclibc
     can explicitly undefine it.

     [as I mentioned before, at least <linux/asm/unistd.h> tries to
     write to errno, and so system call sturbs might currently do the
     wrong thing in a threaded uclibc]

Thus the previously mentioned code inside common/bits/errno.h would
become:

   #  if defined __UCLIBC_HAS_THREADS__ || defined _LIBC_REENTRANT
   /* When using threads, errno is a per-thread value.  */
   #   define errno (*__errno_location ())
   #  endif

   #  if defined _LIBC
   /* We wouldn't need a special macro anymore but it is history.  */
   #   define __set_errno(val) (errno) = (val)
   #  endif /* _LIBC */

[I'm not sure what the implication of _LIBC_REENTRANT is though, so
perhaps that test is wrong]

Does anyone see problems with this?

Thanks,

-Miles
-- 
We live, as we dream -- alone....



More information about the uClibc mailing list