summaryrefslogtreecommitdiff
path: root/linuxthreads
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-05-04 19:25:38 +0000
committerUlrich Drepper <drepper@redhat.com>2004-05-04 19:25:38 +0000
commit2d7ae2107d3713981a66011ec62d094e32ec46fb (patch)
tree0446bffdf7488f7d4df9354d993c2206b896fa7d /linuxthreads
parentce118ec6f3f1dbca08e03d25492f71974e125251 (diff)
Update.
* sysdeps/unix/sysv/linux/ia64/Makefile (librt-routines): Mention rt-sysdep. * sysdeps/unix/sysv/linux/ia64/rt-sysdep.S: New file.
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog6
-rw-r--r--linuxthreads/tst-stack1.c33
2 files changed, 22 insertions, 17 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index 5840521e28..44cfa9edc2 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-04 Jakub Jelinek <jakub@redhat.com>
+
+ * tst-stack1.c: Don't include mcheck.h.
+ (do_test): Make sure user defined stacks aren't reused,
+ don't free them at the end. [BZ #110]
+
2004-05-02 Jakub Jelinek <jakub@redhat.com>
* manager.c: Include not-cancel.h.
diff --git a/linuxthreads/tst-stack1.c b/linuxthreads/tst-stack1.c
index fa9aeddd9c..057bfa3f9f 100644
--- a/linuxthreads/tst-stack1.c
+++ b/linuxthreads/tst-stack1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
@@ -17,11 +17,9 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* Test whether pthread_create/pthread_join with user defined stacks
- doesn't leak memory. */
+/* Test pthread_create/pthread_join with user defined stacks. */
#include <limits.h>
-#include <mcheck.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
@@ -37,13 +35,13 @@ tf (void *p)
return NULL;
}
+#define N 16
+
static int
do_test (void)
{
- mtrace ();
-
void *stack;
- int res = posix_memalign (&stack, getpagesize (), 4 * PTHREAD_STACK_MIN);
+ int res = posix_memalign (&stack, getpagesize (), N * 4 * PTHREAD_STACK_MIN);
if (res)
{
printf ("malloc failed %s\n", strerror (res));
@@ -54,15 +52,17 @@ do_test (void)
pthread_attr_init (&attr);
int result = 0;
- res = pthread_attr_setstack (&attr, stack, 4 * PTHREAD_STACK_MIN);
- if (res)
+ for (int i = 0; i < N; ++i)
{
- printf ("pthread_attr_setstack failed %d\n", res);
- result = 1;
- }
+ res = pthread_attr_setstack (&attr, stack + i * 4 * PTHREAD_STACK_MIN,
+ 4 * PTHREAD_STACK_MIN);
+ if (res)
+ {
+ printf ("pthread_attr_setstack failed %d\n", res);
+ result = 1;
+ continue;
+ }
- for (int i = 0; i < 16; ++i)
- {
/* Create the thread. */
pthread_t th;
res = pthread_create (&th, &attr, tf, NULL);
@@ -84,13 +84,12 @@ do_test (void)
pthread_attr_destroy (&attr);
- if (seen != 16)
+ if (seen != N)
{
- printf ("seen %d != 16\n", seen);
+ printf ("seen %d != %d\n", seen, N);
result = 1;
}
- free (stack);
return result;
}