This is the mail archive of the libc-alpha@sourceware.org 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]

Fix two NPTL tests for ARM/sjlj


Two tests verify that we can create the maximum allowed number of keys with
pthread_key_create.  Unfortunately, if libgcc_s.so.1 is loaded, it will
create one key - used to track the per-thread exception context.  All this
predates TLS of course.  This patch just limits the tests to one fewer key
for SJLJ.

If you don't like this change, I can just turn off these two tests for
arm-linux.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-11-16  Daniel Jacobowitz  <dan@codesourcery.com>

	* tst-key1.c (SYSTEM_KEYS_USED): Define.
	(do_test): Use it.
	* tst-key4.c (SYSTEM_KEYS_USED): Define.
	(max): Use it.

Index: glibc/nptl/tst-key1.c
===================================================================
--- glibc.orig/nptl/tst-key1.c	2005-11-16 10:50:54.000000000 -0500
+++ glibc/nptl/tst-key1.c	2005-11-16 10:51:16.000000000 -0500
@@ -23,15 +23,22 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef __USING_SJLJ_EXCEPTIONS__
+/* GCC's setjmp/longjmp unwinder creates one thread-specific key to
+   hold the unwind data.  */
+#define SYSTEM_KEYS_USED 1
+#else
+#define SYSTEM_KEYS_USED 0
+#endif
 
 int
 do_test (void)
 {
   int max;
 #ifdef PTHREAD_KEYS_MAX
-  max = PTHREAD_KEYS_MAX;
+  max = PTHREAD_KEYS_MAX - SYSTEM_KEYS_USED;
 #else
-  max = _POSIX_THREAD_KEYS_MAX;
+  max = _POSIX_THREAD_KEYS_MAX - SYSTEM_KEYS_USED;
 #endif
   pthread_key_t *keys = alloca (max * sizeof (pthread_key_t));
 
Index: glibc/nptl/tst-key4.c
===================================================================
--- glibc.orig/nptl/tst-key4.c	2005-11-16 10:50:54.000000000 -0500
+++ glibc/nptl/tst-key4.c	2005-11-16 10:51:16.000000000 -0500
@@ -24,10 +24,18 @@
 #include <unistd.h>
 
 
+#ifdef __USING_SJLJ_EXCEPTIONS__
+/* GCC's setjmp/longjmp unwinder creates one thread-specific key to
+   hold the unwind data.  */
+#define SYSTEM_KEYS_USED 1
+#else
+#define SYSTEM_KEYS_USED 0
+#endif
+
 #ifdef PTHREAD_KEYS_MAX
-const int max = PTHREAD_KEYS_MAX;
+const int max = PTHREAD_KEYS_MAX - SYSTEM_KEYS_USED;
 #else
-const int max = _POSIX_THREAD_KEYS_MAX;
+const int max = _POSIX_THREAD_KEYS_MAX - SYSTEM_KEYS_USED;
 #endif
 static pthread_key_t *keys;
 


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