[uClibc-cvs] svn commit: branches/uClibc-nptl: extra/Configs include libc/stdio libc/sy etc...

sjhill at uclibc.org sjhill at uclibc.org
Tue Aug 9 05:50:51 UTC 2005


Author: sjhill
Date: 2005-08-08 23:50:49 -0600 (Mon, 08 Aug 2005)
New Revision: 11077

Log:
In reality, the futex support that was originally added was only for STDIO operations internal to libc. The futexes should not be visible to anything other than libc. These changes clean up futex and STDIO.


Modified:
   branches/uClibc-nptl/extra/Configs/Config.in
   branches/uClibc-nptl/include/netdb.h
   branches/uClibc-nptl/libc/stdio/Makefile
   branches/uClibc-nptl/libc/stdio/_fopen.c
   branches/uClibc-nptl/libc/stdio/_stdio.c
   branches/uClibc-nptl/libc/stdio/_stdio.h
   branches/uClibc-nptl/libc/stdio/scanf.c
   branches/uClibc-nptl/libc/stdio/vdprintf.c
   branches/uClibc-nptl/libc/stdio/vsnprintf.c
   branches/uClibc-nptl/libc/stdio/vswprintf.c
   branches/uClibc-nptl/libc/sysdeps/linux/common/bits/errno.h
   branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h


Changeset:
Modified: branches/uClibc-nptl/extra/Configs/Config.in
===================================================================
--- branches/uClibc-nptl/extra/Configs/Config.in	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/extra/Configs/Config.in	2005-08-09 05:50:49 UTC (rev 11077)
@@ -321,7 +321,6 @@
 	bool "Native POSIX Threading (NPTL) Support"
 	depends on UCLIBC_HAS_THREADS
 	default n
-	select UCLIBC_HAS_FUTEXES
 	help
 	  If you want to compile uClibc with NPTL support, then answer Y.
 
@@ -356,16 +355,6 @@
 	  If you are doing development and want to debug applications using
 	  uClibc's pthread library, answer Y.  Otherwise, answer N.
 
-config UCLIBC_HAS_FUTEXES
-	bool "Fast user mutexes (futex) Support"
-	default n
-	depends on PTHREADS_NATIVE
-	help
-	  If you want to compile uClibc to use fast user mutexes, also
-	  known as futexes, answer Y.  Otherwise, answer N.
-
-	  NOTE:  Futexes are only supported with Linux 2.6 kernels.
-
 config UCLIBC_HAS_LFS
 	bool "Large File Support"
 	default y
@@ -1041,6 +1030,14 @@
 
 	  Most people will answer Y.
 
+config UCLIBC_HAS_STDIO_FUTEXES
+	bool "Use futexes for multithreaded I/O locking"
+	default n
+	depends on PTHREADS_NATIVE
+	help
+	  If you want to compile uClibc to use futexes for low-level
+	  I/O locking, answer Y.  Otherwise, answer N.
+
 endmenu
 
 

Modified: branches/uClibc-nptl/include/netdb.h
===================================================================
--- branches/uClibc-nptl/include/netdb.h	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/include/netdb.h	2005-08-09 05:50:49 UTC (rev 11077)
@@ -53,12 +53,11 @@
 
 __BEGIN_DECLS
 
-#ifdef __PTHREADS_NATIVE__
-#include <tls.h>
-extern __thread int h_errno attribute_tls_model_ie;
-#else
 /* Error status for non-reentrant lookup functions.  */
+#ifndef __PTHREADS_NATIVE__
 extern int h_errno;
+#else
+#define h_errno (*__h_errno_location ())
 #endif
 
 /* Function to get address of global `h_errno' variable.  */
@@ -459,4 +458,13 @@
 
 __END_DECLS
 
+#ifdef _LIBC
+# ifdef __PTHREADS_NATIVE__
+#  include <tls.h>
+#  undef h_errno
+#  define h_errno h_errno     /* For #ifndef h_errno tests.  */
+extern __thread int h_errno attribute_tls_model_ie;
+# endif
+#endif
+
 #endif	/* netdb.h */

Modified: branches/uClibc-nptl/libc/stdio/Makefile
===================================================================
--- branches/uClibc-nptl/libc/stdio/Makefile	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/Makefile	2005-08-09 05:50:49 UTC (rev 11077)
@@ -121,6 +121,10 @@
 OBJS += $(CLOBJS)
 endif
 
+ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
+CFLAGS += -D__USE_STDIO_FUTEXES__
+endif
+
 OBJ_LIST=../obj.stdio
 
 all: $(OBJ_LIST)

Modified: branches/uClibc-nptl/libc/stdio/_fopen.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_fopen.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/_fopen.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -98,7 +98,7 @@
 #ifdef __UCLIBC_HAS_THREADS__
 		/* We only initialize the mutex in the non-freopen case. */
 		/* stream->__user_locking = _stdio_user_locking; */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 		_IO_lock_init (stream->_lock);
 #else
 		__stdio_init_mutex(&stream->__lock);
@@ -194,7 +194,7 @@
 #ifdef __UCLIBC_HAS_THREADS__
 	/* Even in the freopen case, we reset the user locking flag. */
 	stream->__user_locking = _stdio_user_locking;
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	/* _IO_lock_init (stream->_lock); */
 #else
 	/* __stdio_init_mutex(&stream->__lock); */

Modified: branches/uClibc-nptl/libc/stdio/_stdio.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/_stdio.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -73,7 +73,7 @@
 #endif
 
 #ifdef __UCLIBC_HAS_THREADS__
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 #define __STDIO_FILE_INIT_THREADSAFE \
 	2, _LIBC_LOCK_RECURSIVE_INITIALIZER,
 #else
@@ -156,8 +156,8 @@
 FILE *_stdio_openlist = _stdio_streams;
 
 # ifdef __UCLIBC_HAS_THREADS__
-#  ifdef __UCLIBC_HAS_FUTEXES__
-#  include <bits/stdio-lock.h>
+#  ifdef __USE_STDIO_FUTEXES__
+#   include <bits/stdio-lock.h>
 _IO_lock_t _stdio_openlist_lock = _IO_lock_initializer;
 #  else
 pthread_mutex_t _stdio_openlist_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
@@ -172,7 +172,7 @@
 /* 2 if threading not initialized and 0 otherwise; */
 int _stdio_user_locking = 2;
 
-#ifndef __UCLIBC_HAS_FUTEXES__
+#ifndef __USE_STDIO_FUTEXES__
 void __stdio_init_mutex(pthread_mutex_t *m)
 {
 	static const pthread_mutex_t __stdio_mutex_initializer
@@ -196,7 +196,7 @@
 	 * locked, then I suppose there is a chance that a pointer in the
 	 * chain might be corrupt due to a partial store.
 	 */ 
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (_stdio_openlist_lock);
 #else
 	__stdio_init_mutex(&_stdio_openlist_lock);
@@ -221,7 +221,7 @@
 		}
 		
 		ptr->__user_locking = 1; /* Set locking mode to "by caller". */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 		_IO_lock_init (ptr->_lock);
 #else
 		__stdio_init_mutex(&ptr->__lock); /* Shouldn't be necessary, but... */

Modified: branches/uClibc-nptl/libc/stdio/_stdio.h
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.h	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/_stdio.h	2005-08-09 05:50:49 UTC (rev 11077)
@@ -25,7 +25,7 @@
 #ifdef __UCLIBC_HAS_THREADS__
 #include <pthread.h>
 
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES___
 #define __STDIO_THREADLOCK_OPENLIST \
 	_IO_lock_lock(_stdio_openlist_lock)
 

Modified: branches/uClibc-nptl/libc/stdio/scanf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/scanf.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/scanf.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -235,7 +235,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);
@@ -286,7 +286,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f.f._lock);
 #else
 	__stdio_init_mutex(&f.f.__lock);
@@ -421,7 +421,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);

Modified: branches/uClibc-nptl/libc/stdio/vdprintf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/vdprintf.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/vdprintf.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -43,7 +43,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);

Modified: branches/uClibc-nptl/libc/stdio/vsnprintf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/vsnprintf.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/vsnprintf.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -41,7 +41,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);
@@ -113,7 +113,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f.f._lock);
 #else
 	__stdio_init_mutex(&f.f.__lock);
@@ -201,7 +201,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);

Modified: branches/uClibc-nptl/libc/stdio/vswprintf.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/vswprintf.c	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/stdio/vswprintf.c	2005-08-09 05:50:49 UTC (rev 11077)
@@ -38,7 +38,7 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 	f.__user_locking = 1;		/* Set user locking. */
-#ifdef __UCLIBC_HAS_FUTEXES__
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_init (f._lock);
 #else
 	__stdio_init_mutex(&f.__lock);

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/errno.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/errno.h	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/errno.h	2005-08-09 05:50:49 UTC (rev 11077)
@@ -39,7 +39,9 @@
 
 #  if defined _LIBC
 /* We wouldn't need a special macro anymore but it is history.  */
-#   define __set_errno(val) ((errno) = (val))
+#   ifndef __set_errno
+#    define __set_errno(val) ((errno) = (val))
+#   endif
 #  endif /* _LIBC */
 
 #  if defined __UCLIBC_HAS_THREADS__

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h	2005-08-09 05:49:51 UTC (rev 11076)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h	2005-08-09 05:50:49 UTC (rev 11077)
@@ -119,7 +119,7 @@
 #ifdef __UCLIBC_HAS_THREADS__
 /* Need this for pthread_mutex_t. */
 #include <bits/pthreadtypes.h>
-#if defined __UCLIBC_HAS_FUTEXES__  && defined _LIBC
+#ifdef __USE_STDIO_FUTEXES__
 #include <bits/stdio-lock.h>
 #endif
 
@@ -137,7 +137,7 @@
 
 #define __STDIO_AUTO_THREADLOCK_VAR			int __infunc_user_locking
 
-#if defined __UCLIBC_HAS_FUTEXES__ && defined _LIBC
+#ifdef __USE_STDIO_FUTEXES__
 
 #define __STDIO_SET_USER_LOCKING(__stream)	((__stream)->__user_locking = 1)
 
@@ -313,7 +313,7 @@
 #endif
 #ifdef __UCLIBC_HAS_THREADS__
 	int __user_locking;
-#if defined __UCLIBC_HAS_FUTEXES__ && defined _LIBC
+#ifdef __USE_STDIO_FUTEXES__
 	_IO_lock_t _lock;
 #else
 	pthread_mutex_t __lock;
@@ -392,7 +392,7 @@
 extern struct __STDIO_FILE_STRUCT *_stdio_openlist;
 
 #ifdef __UCLIBC_HAS_THREADS__
-#if defined __UCLIBC_HAS_FUTEXES__ && defined _LIBC
+#ifdef __USE_STDIO_FUTEXES__
 extern _IO_lock_t _stdio_openlist_lock;
 #else
 extern pthread_mutex_t _stdio_openlist_lock;




More information about the uClibc-cvs mailing list