This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] nptl: tst-mutex8.c: Handle ENOTSUP PI mutex failure


 In an unfortunate sequence of events the handling of PI mutexes was 
(contrary to the ChangeLog entry used) missed for tst-mutex8.c in commit 
df47504c78f82b9c975b2a48a6c8b6dd73a79ce1 [2006-07-28 Ulrich Drepper 
<>] and then not completely fixed up in commit 
66c13581afc5d348089bb9dcb68142ee3d26006e [Fix tst-mutexpi8].  As a result 
on a target that lacks adequate atomic operation support in the Linux 
kernel required for PI mutexes tst-mutexpi8 scores a failure from 
unsuccessful pthread_mutex_init calls.

 The cause is Linux code in kernel/futex.c:do_futex that checks for the 
value of the futex_cmpxchg_enabled internal kernel variable and returns 
ENOSYS if unsuccessful.  Then the setting of futex_cmpxchg_enabled depends 
on the combination of the hardware capability and Linux kernel 
configuration and any resulting lack of PI futex support is never a 
failure in our NPTL support code.

 Here's a change, modelled after code in other tst-mutex?.c files, that 
finally removes the tst-mutexpi8 failure on systems affected.  OK to 

2013-10-02  Maciej W. Rozycki  <>

	* tst-mutex8.c (check_type) [ENABLE_PI]: Handle ENOTSUP failure 
	from pthread_mutex_init.

Index: glibc-csl-trunk-2.18/nptl/tst-mutex8.c
--- glibc-csl-trunk-2.18.orig/nptl/tst-mutex8.c	2013-09-06 19:33:43.000000000 +0100
+++ glibc-csl-trunk-2.18/nptl/tst-mutex8.c	2013-09-26 23:39:35.318530221 +0100
@@ -93,10 +93,18 @@ tf (void *arg)
 static int
 check_type (const char *mas, pthread_mutexattr_t *ma)
-  int e __attribute__((unused));
+  int e;
-  if (pthread_mutex_init (m, ma) != 0)
+  e = pthread_mutex_init (m, ma);
+  if (e != 0)
+#ifdef ENABLE_PI
+      if (e == ENOTSUP)
+	{
+	  puts ("PI mutexes unsupported");
+	  return 0;
+	}
       printf ("1st mutex_init failed for %s\n", mas);
       return 1;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]