svn commit: branches/uClibc-nptl/libc: inet misc/sysvipc stdio sysdeps/linux/co etc...

kraj at uclibc.org kraj at uclibc.org
Wed Jul 9 23:52:42 UTC 2008


Author: kraj
Date: 2008-07-09 16:52:41 -0700 (Wed, 09 Jul 2008)
New Revision: 22726

Log:
Fix the builds without STDIO_FUTEXES. Fix msgecv and msgsend to compile on ARM as well.

Modified:
   branches/uClibc-nptl/libc/inet/resolv.c
   branches/uClibc-nptl/libc/misc/sysvipc/msgq.c
   branches/uClibc-nptl/libc/stdio/_stdio.c
   branches/uClibc-nptl/libc/stdio/_stdio.h
   branches/uClibc-nptl/libc/stdio/fflush.c
   branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_mutex.h
   branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h
   branches/uClibc-nptl/libc/sysdeps/linux/common/pause.c


Changeset:
Modified: branches/uClibc-nptl/libc/inet/resolv.c
===================================================================
--- branches/uClibc-nptl/libc/inet/resolv.c	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/inet/resolv.c	2008-07-09 23:52:41 UTC (rev 22726)
@@ -155,6 +155,7 @@
 #include <sys/utsname.h>
 #include <sys/un.h>
 #include <bits/uClibc_mutex.h>
+#include <tls.h>
 
 /* poll() is not supported in kernel <= 2.0, therefore if __NR_poll is
  * not available, we assume an old Linux kernel is in use and we will

Modified: branches/uClibc-nptl/libc/misc/sysvipc/msgq.c
===================================================================
--- branches/uClibc-nptl/libc/misc/sysvipc/msgq.c	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/misc/sysvipc/msgq.c	2008-07-09 23:52:41 UTC (rev 22726)
@@ -1,6 +1,11 @@
 #include <errno.h>
 #include <sys/msg.h>
 #include "ipc.h"
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+#include "sysdep-cancel.h"
+#else
+#define SINGLE_THREAD_P 1
+#endif
 
 
 #ifdef L_msgctl
@@ -42,83 +47,66 @@
 
 
 #ifdef L_msgrcv
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <sysdep-cancel.h>
-
-int
-__libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg)
+#ifdef __NR_msgrcv
+#define __NR___syscall_msgrcv __NR_msgrcv
+static inline _syscall5(int, __syscall_msgrcv, int, msqid, void *, msgp,
+			size_t, msgsz, long int, msgtyp, int, msgflg);
+#endif
+static inline int do_msgrcv (int msqid, void *msgp, size_t msgsz,
+			    long int msgtyp, int msgflg)
 {
-  /* The problem here is that Linux' calling convention only allows up to
-     fives parameters to a system call.  */
-  struct new_msg_buf tmp;
-
-  tmp.oldmsg = msgp;
-  tmp.r_msgtyp = msgtyp;
-
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
-			   __ptrvalue (&tmp));
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
-			       __ptrvalue (&tmp));
-
-   LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-weak_alias(__libc_msgrcv, msgrcv)
-#else
 #ifdef __NR_msgrcv
-_syscall5(int, msgrcv, int, msqid, void *, msgp, size_t, msgsz, long int, msgtyp, int, msgflg);
+    return __syscall_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
 #else
-int msgrcv (int msqid, void *msgp, size_t msgsz,
-	long int msgtyp, int msgflg)
-{
     struct new_msg_buf temp;
 
     temp.r_msgtyp = msgtyp;
     temp.oldmsg = msgp;
     return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp, 0);
+#endif
 }
+int msgrcv (int msqid, void *msgp, size_t msgsz,
+	    long int msgtyp, int msgflg)
+{
+    if (SINGLE_THREAD_P)
+	return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+    int oldtype = LIBC_CANCEL_ASYNC ();
+    int result = do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg);
+    LIBC_CANCEL_RESET (oldtype);
+    return result;
 #endif
+}
 #endif
-#endif
 
 
 
 #ifdef L_msgsnd
-#ifdef __UCLIBC_HAS_THREADS_NATIVE__
-#include <sysdep-cancel.h>
-
-int
-__libc_msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
+#ifdef __NR_msgsnd
+#define __NR___syscall_msgsnd __NR_msgsnd
+static inline _syscall4(int, __syscall_msgsnd, int, msqid, const void *, msgp,
+			size_t, msgsz, int, msgflg);
+#endif
+/* Send message to message queue.  */
+static inline int do_msgsnd (int msqid, const void *msgp, size_t msgsz,
+			    int msgflg)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
-			   msgflg, msgp);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
-			       msgflg, msgp);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-weak_alias(__libc_msgsnd, msgsnd)
-#else
 #ifdef __NR_msgsnd
-_syscall4(int, msgsnd, int, msqid, const void *, msgp, size_t, msgsz, int, msgflg);
+    return __syscall_msgsnd(msqid, msgp, msgsz, msgflg);
 #else
-/* Send message to message queue.  */
+    return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp, 0);
+#endif
+}
 int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
 {
-    return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp, 0);
+    if (SINGLE_THREAD_P)
+	return do_msgsnd(msqid, msgp, msgsz, msgflg);
+#ifdef __UCLIBC_HAS_THREADS_NATIVE__
+    int oldtype = LIBC_CANCEL_ASYNC ();
+    int result = do_msgsnd(msqid, msgp, msgsz, msgflg);
+    LIBC_CANCEL_RESET (oldtype);
+    return result;
+#endif
 }
 #endif
-#endif
-#endif
 

Modified: branches/uClibc-nptl/libc/stdio/_stdio.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.c	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/stdio/_stdio.c	2008-07-09 23:52:41 UTC (rev 22726)
@@ -7,7 +7,11 @@
 
 #include "_stdio.h"
 
-/* Experimentally off - libc_hidden_proto(memcpy) */
+#if defined (__UCLIBC_HAS_THREADS__) && defined (__USE_STDIO_FUTEXES__)
+#include <bits/stdio-lock.h>
+#endif
+
+libc_hidden_proto(memcpy)
 libc_hidden_proto(isatty)
 
 /* This is pretty much straight from uClibc, but with one important
@@ -160,18 +164,21 @@
 
 # ifdef __UCLIBC_HAS_THREADS__
 #  ifdef __USE_STDIO_FUTEXES__
-#  define __UCLIBC_IO_MUTEX_INITIALIZER _IO_lock_initializer
+_IO_lock_t _stdio_openlist_add_lock = _IO_lock_initializer;
 #  else
-#  define __UCLIBC_IO_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+__UCLIBC_MUTEX_INIT(_stdio_openlist_add_lock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
 #  endif
-
-__UCLIBC_IO_MUTEX_INIT(_stdio_openlist_add_lock, __UCLIBC_IO_MUTEX_INITIALIZER);
-#  ifdef __STDIO_BUFFERS
-__UCLIBC_IO_MUTEX_INIT(_stdio_openlist_del_lock, __UCLIBC_IO_MUTEX_INITIALIZER);
+#ifdef __STDIO_BUFFERS
+#  ifdef __USE_STDIO_FUTEXES__
+_IO_lock_t _stdio_openlist_del_lock = _IO_lock_initializer;
+#  else
+__UCLIBC_MUTEX_INIT(_stdio_openlist_del_lock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP);
+#  endif
 volatile int _stdio_openlist_use_count = 0;
 int _stdio_openlist_del_count = 0;
-#  endif
+#endif
 # endif
+
 #endif
 /**********************************************************************/
 #ifdef __UCLIBC_HAS_THREADS__
@@ -179,6 +186,7 @@
 /* 2 if threading not initialized and 0 otherwise; */
 int _stdio_user_locking = 2;
 
+#ifndef __USE_STDIO_FUTEXES__
 void attribute_hidden __stdio_init_mutex(__UCLIBC_MUTEX_TYPE *m)
 {
 	const __UCLIBC_MUTEX_STATIC(__stdio_mutex_initializer,
@@ -186,6 +194,7 @@
 
 	memcpy(m, &__stdio_mutex_initializer, sizeof(__stdio_mutex_initializer));
 }
+#endif
 
 #endif
 /**********************************************************************/
@@ -204,7 +213,7 @@
 	STDIO_INIT_MUTEX(_stdio_openlist_add_lock);
 #warning check
 #ifdef __STDIO_BUFFERS
-	STDIO_INIT_MUTEX(_stdio_openlist_del_lock);
+	STDIO_INIT_MUTEX(ptr->__lock); /* Shouldn't be necessary, but... */
 #endif
 
 	/* Next we need to worry about the streams themselves.  If a stream
@@ -226,7 +235,11 @@
 		}
 
 		ptr->__user_locking = 1; /* Set locking mode to "by caller". */
-		STDIO_INIT_MUTEX(ptr->__lock); /* Shouldn't be necessary, but... */
+#ifdef __USE_STDIO_FUTEXES__
+		_IO_lock_init (ptr->_lock);
+#else
+		__stdio_init_mutex(&ptr->__lock); /* Shouldn't be necessary, but... */
+#endif
 	}
 #endif
 

Modified: branches/uClibc-nptl/libc/stdio/_stdio.h
===================================================================
--- branches/uClibc-nptl/libc/stdio/_stdio.h	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/stdio/_stdio.h	2008-07-09 23:52:41 UTC (rev 22726)
@@ -24,18 +24,18 @@
 #include <bits/uClibc_mutex.h>
 
 #define __STDIO_THREADLOCK_OPENLIST_ADD			\
-        __UCLIBC_IO_MUTEX_LOCK(_stdio_openlist_add_lock)
+        __UCLIBC_MUTEX_LOCK(_stdio_openlist_add_lock)
 
 #define __STDIO_THREADUNLOCK_OPENLIST_ADD		\
-        __UCLIBC_IO_MUTEX_UNLOCK(_stdio_openlist_add_lock)
+        __UCLIBC_MUTEX_UNLOCK(_stdio_openlist_add_lock)
 
 #ifdef __STDIO_BUFFERS
 
 #define __STDIO_THREADLOCK_OPENLIST_DEL			\
-        __UCLIBC_IO_MUTEX_LOCK(_stdio_openlist_del_lock)
+        __UCLIBC_MUTEX_LOCK(_stdio_openlist_del_lock)
 
 #define __STDIO_THREADUNLOCK_OPENLIST_DEL		\
-        __UCLIBC_IO_MUTEX_UNLOCK(_stdio_openlist_del_lock)
+        __UCLIBC_MUTEX_UNLOCK(_stdio_openlist_del_lock)
 
 
 #ifdef __UCLIBC_HAS_THREADS__

Modified: branches/uClibc-nptl/libc/stdio/fflush.c
===================================================================
--- branches/uClibc-nptl/libc/stdio/fflush.c	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/stdio/fflush.c	2008-07-09 23:52:41 UTC (rev 22726)
@@ -19,11 +19,11 @@
  * when all (lbf) writing streams are flushed. */
 
 #define __MY_STDIO_THREADLOCK(__stream)					\
-        __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK((__stream)->__lock,		\
+        __UCLIBC_MUTEX_CONDITIONAL_LOCK((__stream)->__lock,		\
 	(_stdio_user_locking != 2))
 
 #define __MY_STDIO_THREADUNLOCK(__stream)				\
-        __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK((__stream)->__lock,		\
+        __UCLIBC_MUTEX_CONDITIONAL_UNLOCK((__stream)->__lock,		\
 	(_stdio_user_locking != 2))
 
 #if defined(__UCLIBC_HAS_THREADS__) && defined(__STDIO_BUFFERS)

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_mutex.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_mutex.h	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_mutex.h	2008-07-09 23:52:41 UTC (rev 22726)
@@ -12,7 +12,8 @@
 
 #ifdef __UCLIBC_HAS_THREADS__
 
-#include <bits/pthreadtypes.h>
+#include <pthread.h>
+#include <bits/uClibc_pthread.h>
 
 #define __UCLIBC_MUTEX_TYPE				pthread_mutex_t
 
@@ -61,55 +62,8 @@
 #define __UCLIBC_MUTEX_UNLOCK(M)									\
         __UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1)
 
-#ifdef __USE_STDIO_FUTEXES__
-
-#include <bits/stdio-lock.h>
-
-#define __UCLIBC_IO_MUTEX(M)			_IO_lock_t M
-#define __UCLIBC_IO_MUTEX_LOCK(M) 		_IO_lock_lock(M)
-#define __UCLIBC_IO_MUTEX_UNLOCK(M) 	_IO_lock_unlock(M)
-#define __UCLIBC_IO_MUTEX_TRYLOCK(M) 	_IO_lock_trylock(M)
-#define __UCLIBC_IO_MUTEX_INIT(M,I) 	_IO_lock_t M = I
-#define __UCLIBC_IO_MUTEX_EXTERN(M)		extern _IO_lock_t M
-
-#define __UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,C)		\
-	if (C) {										\
-		_IO_lock_lock(M);							\
-	}
-
-#define __UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,C)	\
-	if (C) {										\
-		_IO_lock_unlock(M);							\
-	}
-
-#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V)			\
-		__UCLIBC_IO_MUTEX_CONDITIONAL_LOCK(M,((A=(V))) == 0)
-
-#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A)			\
-		__UCLIBC_IO_MUTEX_CONDITIONAL_UNLOCK(M,((A) ==0))
-
-#define __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE(M)		\
-		__UCLIBC_IO_MUTEX_LOCK(M)
-#define __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE(M) 	\
-		__UCLIBC_IO_MUTEX_UNLOCK(M)
-#define __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE(M)	\
-		__UCLIBC_IO_MUTEX_TRYLOCK(M)
-
 #else
-#define __UCLIBC_IO_MUTEX(M)				__UCLIBC_MUTEX(M)
-#define __UCLIBC_IO_MUTEX_LOCK(M) 			__UCLIBC_MUTEX_CONDITIONAL_LOCK(M, 1)
-#define __UCLIBC_IO_MUTEX_UNLOCK(M) 		__UCLIBC_MUTEX_CONDITIONAL_UNLOCK(M, 1)
-#define __UCLIBC_IO_MUTEX_TRYLOCK(M) 		__UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE
-#define __UCLIBC_IO_MUTEX_INIT(M,I) 		__UCLIBC_MUTEX_INIT(M,I)
-#define __UCLIBC_IO_MUTEX_EXTERN(M)			__UCLIBC_MUTEX_EXTERN(M)
 
-#define __UCLIBC_IO_MUTEX_AUTO_LOCK(M,A,V)	__UCLIBC_MUTEX_AUTO_LOCK(M,A,V)
-#define __UCLIBC_IO_MUTEX_AUTO_UNLOCK(M,A)		__UCLIBC_MUTEX_AUTO_UNLOCK(M,A)
-
-#endif
-
-#else
-
 #define __UCLIBC_MUTEX(M)				void *__UCLIBC_MUTEX_DUMMY_ ## M
 #define __UCLIBC_MUTEX_INIT(M,I)			extern void *__UCLIBC_MUTEX_DUMMY_ ## M
 #define __UCLIBC_MUTEX_STATIC(M,I)			extern void *__UCLIBC_MUTEX_DUMMY_ ## M
@@ -129,12 +83,6 @@
 #define __UCLIBC_MUTEX_LOCK(M)				((void)0)
 #define __UCLIBC_MUTEX_UNLOCK(M)			((void)0)
 
-#define __UCLIBC_IO_MUTEX_LOCK(M) 				((void)0)
-#define __UCLIBC_IO_MUTEX_UNLOCK(M)				((void)0)
-#define __UCLIBC_IO_MUTEX_TRYLOCK(M)				((void)0)
-#define __UCLIBC_IO_MUTEX_INIT(M,I)			extern void *__UCLIBC_MUTEX_DUMMY_ ## M
-#define __UCLIBC_IO_MUTEX_EXTERN(M)			extern void *__UCLIBC_MUTEX_DUMMY_ ## M
 #endif
 
-
 #endif /* _UCLIBC_MUTEX_H */

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/bits/uClibc_stdio.h	2008-07-09 23:52:41 UTC (rev 22726)
@@ -117,6 +117,9 @@
 
 /**********************************************************************/
 #include <bits/uClibc_mutex.h>
+#ifdef __USE_STDIO_FUTEXES__
+#include <bits/stdio-lock.h>
+#endif
 
 /* user_locking
  * 0 : do auto locking/unlocking
@@ -132,42 +135,76 @@
 
 #define __STDIO_AUTO_THREADLOCK_VAR						\
         __UCLIBC_MUTEX_AUTO_LOCK_VAR(__infunc_user_locking)
+#ifdef __USE_STDIO_FUTEXES__
 
+#define __STDIO_SET_USER_LOCKING(__stream)	((__stream)->__user_locking = 1)
+
+#define __STDIO_AUTO_THREADLOCK(__stream)                               \
+  if ((__infunc_user_locking = (__stream)->__user_locking) == 0) {	\
+    _IO_lock_lock((__stream)->_lock);                                   \
+  }
+
+#define __STDIO_AUTO_THREADUNLOCK(__stream)				\
+  if (__infunc_user_locking == 0) {					\
+    _IO_lock_unlock((__stream)->_lock);                                 \
+  }
+
+#define __STDIO_ALWAYS_THREADLOCK(__stream)     \
+  _IO_lock_lock((__stream)->_lock)
+
+#define __STDIO_ALWAYS_THREADTRYLOCK(__stream)  \
+  _IO_lock_trylock((__stream)->_lock)
+
+#define __STDIO_ALWAYS_THREADUNLOCK(__stream)   \
+  _IO_lock_unlock((__stream)->_lock)
+
+#define __STDIO_ALWAYS_THREADLOCK_CANCEL_UNSAFE(__stream)       \
+  _IO_lock_lock_cancel_unsafe((__stream)->__lock)
+
+#define __STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(__stream)    \
+  _IO_lock_trylock_cancel_unsafe((__stream)->__lock)
+
+#define __STDIO_ALWAYS_THREADUNLOCK_CANCEL_UNSAFE(__stream)     \
+  _IO_lock_unlock_cancel_unsafe((__stream)->__lock)
+
+#else /* __USE_STDIO_FUTEXES__ */
+
+
 #define __STDIO_AUTO_THREADLOCK(__stream)					\
-        __UCLIBC_IO_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking,	\
+        __UCLIBC_MUTEX_AUTO_LOCK((__stream)->__lock, __infunc_user_locking,	\
 	(__stream)->__user_locking)
 
 #define __STDIO_AUTO_THREADUNLOCK(__stream)					\
-        __UCLIBC_IO_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking)
+        __UCLIBC_MUTEX_AUTO_UNLOCK((__stream)->__lock, __infunc_user_locking)
 
 #define __STDIO_ALWAYS_THREADLOCK(__stream)					\
-        __UCLIBC_IO_MUTEX_LOCK((__stream)->__lock)
+        __UCLIBC_MUTEX_LOCK((__stream)->__lock)
 
 #define __STDIO_ALWAYS_THREADUNLOCK(__stream)					\
-        __UCLIBC_IO_MUTEX_UNLOCK((__stream)->__lock)
+        __UCLIBC_MUTEX_UNLOCK((__stream)->__lock)
 
 #define __STDIO_ALWAYS_THREADLOCK_CANCEL_UNSAFE(__stream)			\
-        __UCLIBC_IO_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock)
+        __UCLIBC_MUTEX_LOCK_CANCEL_UNSAFE((__stream)->__lock)
 
 #define __STDIO_ALWAYS_THREADTRYLOCK_CANCEL_UNSAFE(__stream)			\
-        __UCLIBC_IO_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock)
+        __UCLIBC_MUTEX_TRYLOCK_CANCEL_UNSAFE((__stream)->__lock)
 
 #define __STDIO_ALWAYS_THREADUNLOCK_CANCEL_UNSAFE(__stream)			\
-        __UCLIBC_IO_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock)
+        __UCLIBC_MUTEX_UNLOCK_CANCEL_UNSAFE((__stream)->__lock)
 
+#endif
+
 #ifdef __UCLIBC_HAS_THREADS__
 #define __STDIO_SET_USER_LOCKING(__stream)	((__stream)->__user_locking = 1)
 #else
 #define __STDIO_SET_USER_LOCKING(__stream)		((void)0)
 #endif
 
-#ifdef __UCLIBC_HAS_THREADS__
 #ifdef __USE_STDIO_FUTEXES__
 #define STDIO_INIT_MUTEX(M) _IO_lock_init(M)
 #else
 #define STDIO_INIT_MUTEX(M) __stdio_init_mutex(& M)
 #endif
-#endif
 
 /**********************************************************************/
 
@@ -283,8 +320,12 @@
 #endif
 #ifdef __UCLIBC_HAS_THREADS__
 	int __user_locking;
-	__UCLIBC_IO_MUTEX(__lock);
+#ifdef __USE_STDIO_FUTEXES__
+	_IO_lock_t _lock;
+#else
+	__UCLIBC_MUTEX(__lock);
 #endif
+#endif
 /* Everything after this is unimplemented... and may be trashed. */
 #if __STDIO_BUILTIN_BUF_SIZE > 0
 	unsigned char __builtinbuf[__STDIO_BUILTIN_BUF_SIZE];
@@ -359,9 +400,17 @@
 extern struct __STDIO_FILE_STRUCT *_stdio_openlist;
 
 #ifdef __UCLIBC_HAS_THREADS__
-__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_add_lock);
+#ifdef __USE_STDIO_FUTEXES__
+extern _IO_lock_t _stdio_openlist_add_lock;
+#else
+__UCLIBC_MUTEX_EXTERN(_stdio_openlist_add_lock);
+#endif
 #ifdef __STDIO_BUFFERS
-__UCLIBC_IO_MUTEX_EXTERN(_stdio_openlist_del_lock);
+#ifdef __USE_STDIO_FUTEXES__
+extern _IO_lock_t _stdio_openlist_del_lock;
+#else
+__UCLIBC_MUTEX_EXTERN(_stdio_openlist_del_lock);
+#endif
 extern volatile int _stdio_openlist_use_count; /* _stdio_openlist_del_lock */
 extern int _stdio_openlist_del_count; /* _stdio_openlist_del_lock */
 #endif

Modified: branches/uClibc-nptl/libc/sysdeps/linux/common/pause.c
===================================================================
--- branches/uClibc-nptl/libc/sysdeps/linux/common/pause.c	2008-07-09 23:36:41 UTC (rev 22725)
+++ branches/uClibc-nptl/libc/sysdeps/linux/common/pause.c	2008-07-09 23:52:41 UTC (rev 22726)
@@ -10,23 +10,19 @@
 #define __UCLIBC_HIDE_DEPRECATED__
 #include <sys/syscall.h>
 #include <unistd.h>
-#include <sysdep-cancel.h>
 
-/* Suspend the process until a signal arrives.
-   This always returns -1 and sets errno to EINTR.  */
-int
-__libc_pause (void)
-{
-  sigset_t set;
+extern __typeof(pause) __libc_pause;
+#ifdef __NR_pause
+#define __NR___libc_pause __NR_pause
+_syscall0(int, __libc_pause);
+#else
+#include <signal.h>
+libc_hidden_proto(__sigpause)
+libc_hidden_proto(sigblock)
 
-  __sigemptyset (&set);
-  sigprocmask (SIG_BLOCK, NULL, &set);
-
-  /* pause is a cancellation point, but so is sigsuspend.
-     So no need for anything special here.  */
-
-  return sigsuspend (&set);
+int __libc_pause(void)
+{
+	return (__sigpause(sigblock(0), 0));
 }
-weak_alias (__libc_pause, pause)
-
-LIBC_CANCEL_HANDLED ();		/* sigsuspend handles our cancellation.  */
+#endif
+weak_alias(__libc_pause,pause)




More information about the uClibc-cvs mailing list