Sophie

Sophie

distrib > Mandriva > 2007.0 > x86_64 > media > main-updates-src > by-pkgid > 8fda3ecf7b23856f7036f304b55572dc > files > 35

glibc-2.4-7mdv2007.0.src.rpm

2006-09-18  Jakub Jelinek  <jakub@redhat.com>

	* tst-kill4.c (do_test): Explicitly set tf thread's stack size.

	* tst-cancel2.c (tf): Loop as long as something was written.

--- glibc-2.4.90/nptl/tst-cancel2.c.fix-nptl-testcases	2002-11-26 17:49:53.000000000 -0500
+++ glibc-2.4.90/nptl/tst-cancel2.c	2006-10-24 10:59:07.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -33,11 +33,7 @@ tf (void *arg)
      write blocks.  */
   char buf[100000];
 
-  if (write (fd[1], buf, sizeof (buf)) == sizeof (buf))
-    {
-      puts ("write succeeded");
-      return (void *) 1l;
-    }
+  while (write (fd[1], buf, sizeof (buf)) > 0);
 
   return (void *) 42l;
 }
--- glibc-2.4.90/nptl/tst-kill4.c.fix-nptl-testcases	2003-02-21 15:27:54.000000000 -0500
+++ glibc-2.4.90/nptl/tst-kill4.c	2006-10-24 10:59:07.000000000 -0400
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -35,13 +35,30 @@ tf (void *a)
 int
 do_test (void)
 {
+  pthread_attr_t at;
+  if (pthread_attr_init (&at) != 0)
+    {
+      puts ("attr_create failed");
+      exit (1);
+    }
+
+  /* Limit thread stack size, because if it is too large, pthread_join
+     will free it immediately rather than put it into stack cache.  */
+  if (pthread_attr_setstacksize (&at, 2 * 1024 * 1024) != 0)
+    {
+      puts ("setstacksize failed");
+      exit (1);
+    }
+
   pthread_t th;
-  if (pthread_create (&th, NULL, tf, NULL) != 0)
+  if (pthread_create (&th, &at, tf, NULL) != 0)
     {
       puts ("create failed");
       exit (1);
     }
 
+  pthread_attr_destroy (&at);
+
   if (pthread_join (th, NULL) != 0)
     {
       puts ("join failed");