svn commit: branches/uClibc-nptl: include libc/misc/internals libpthread/n etc...

sjhill at uclibc.org sjhill at uclibc.org
Thu Jan 5 01:25:31 UTC 2006


Author: sjhill
Date: 2006-01-04 17:25:30 -0800 (Wed, 04 Jan 2006)
New Revision: 13094

Log:
Changes to make 'h_errno' be a TLS variable. These changes should be portable into the trunk as, I think, they handle both thread and non-threaded cases and maybe only minor tweaks to handle the linuxthreads model, if any.


Modified:
   branches/uClibc-nptl/include/netdb.h
   branches/uClibc-nptl/libc/misc/internals/Makefile.in
   branches/uClibc-nptl/libc/misc/internals/__h_errno_location.c
   branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in


Changeset:
Modified: branches/uClibc-nptl/include/netdb.h
===================================================================
--- branches/uClibc-nptl/include/netdb.h	2006-01-05 01:20:21 UTC (rev 13093)
+++ branches/uClibc-nptl/include/netdb.h	2006-01-05 01:25:30 UTC (rev 13094)
@@ -60,9 +60,31 @@
 /* Function to get address of global `h_errno' variable.  */
 extern int *__h_errno_location (void) __THROW __attribute__ ((__const__));
 
+/* Macros for accessing h_errno from inside libc.  */
 #ifdef _LIBC
-# define __set_h_errno(x) (h_errno = (x))
-#endif
+# ifdef __UCLIBC_HAS_THREADS__
+#  if defined __UCLIBC_HAS_THREADS_NATIVE__ \
+	      && (!defined NOT_IN_libc || defined IS_IN_libpthread)
+#   undef h_errno
+#   ifndef NOT_IN_libc
+#    define h_errno __libc_h_errno
+#   else
+#    define h_errno h_errno     /* For #ifndef h_errno tests.  */
+#   endif
+extern __thread int h_errno attribute_tls_model_ie;
+#   define __set_h_errno(x) (h_errno = (x))
+#  else
+static inline int __set_h_errno (int __err)
+{
+	return *__h_errno_location () = __err;
+}
+#  endif /* __UCLIBC_HAS_THREADS_NATIVE__ */
+# else
+#  undef h_errno
+#  define __set_h_errno(x) (h_errno = (x))
+extern int h_errno;
+# endif /* __UCLIBC_HAS_THREADS__ */
+#endif /* _LIBC */
 
 /* Possible values left in `h_errno'.  */
 #define	NETDB_INTERNAL	-1	/* See errno.  */

Modified: branches/uClibc-nptl/libc/misc/internals/Makefile.in
===================================================================
--- branches/uClibc-nptl/libc/misc/internals/Makefile.in	2006-01-05 01:20:21 UTC (rev 13093)
+++ branches/uClibc-nptl/libc/misc/internals/Makefile.in	2006-01-05 01:25:30 UTC (rev 13094)
@@ -17,7 +17,7 @@
 MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC))
 
 libc-a-y+=$(MISC_INTERNALS_OBJ)
-libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os)
+libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.oS)
 libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS
 libc-static-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.o
 

Modified: branches/uClibc-nptl/libc/misc/internals/__h_errno_location.c
===================================================================
--- branches/uClibc-nptl/libc/misc/internals/__h_errno_location.c	2006-01-05 01:20:21 UTC (rev 13093)
+++ branches/uClibc-nptl/libc/misc/internals/__h_errno_location.c	2006-01-05 01:25:30 UTC (rev 13094)
@@ -1,11 +1,9 @@
 #define __FORCE_GLIBC
 #include <features.h>
 #include <netdb.h>
-#undef h_errno
 
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-extern __thread int h_errno;
-#else
+#ifndef __UCLIBC_HAS_THREADS_NATIVE__
+#undef h_errno
 extern int h_errno;
 #endif
 

Modified: branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in	2006-01-05 01:20:21 UTC (rev 13093)
+++ branches/uClibc-nptl/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in	2006-01-05 01:25:30 UTC (rev 13094)
@@ -43,7 +43,6 @@
 CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
 #CFLAGS:=$(CFLAGS:-O1=-O2)
 
-CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 CFLAGS-OMIT-libc_pthread_init.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 CFLAGS-OMIT-libc_multiple_threads.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 CFLAGS-OMIT-register-atfork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
@@ -51,6 +50,7 @@
 CFLAGS-OMIT-getpid.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 CFLAGS-OMIT-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 CFLAGS-OMIT-sleep.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
 
 linux_DIR := $(top_srcdir)/libpthread/nptl/sysdeps/unix/sysv/linux
 linux_OUT := $(top_builddir)/libpthread/nptl/sysdeps/unix/sysv/linux
@@ -67,7 +67,7 @@
 
 
 libc-a-y += $(LIBC_OBJ)
-libc-so-y += $(LIBC_OBJ:.o=.os)
+libc-so-y += $(LIBC_OBJ:.o=.oS)
 
 objclean-y += pthread_linux_objclean
 




More information about the uClibc-cvs mailing list