aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-basic7.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-12-12 18:41:10 +0000
committerUlrich Drepper <drepper@redhat.com>2007-12-12 18:41:10 +0000
commit3eb0e1c6d6259c1d8db0859589a5ca67e3cac8e2 (patch)
treee657f21f0f12ecb5daa7533117977c0af249ce45 /nptl/tst-basic7.c
parent77751669d757d1b78dfa677c1c429bd94aa2e59d (diff)
downloadglibc-3eb0e1c6d6259c1d8db0859589a5ca67e3cac8e2.zip
glibc-3eb0e1c6d6259c1d8db0859589a5ca67e3cac8e2.tar.gz
glibc-3eb0e1c6d6259c1d8db0859589a5ca67e3cac8e2.tar.bz2
* tst-basic7.c: Allocate memory for the stack.
Diffstat (limited to 'nptl/tst-basic7.c')
-rw-r--r--nptl/tst-basic7.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/nptl/tst-basic7.c b/nptl/tst-basic7.c
index da461e4..ff6b36b 100644
--- a/nptl/tst-basic7.c
+++ b/nptl/tst-basic7.c
@@ -7,6 +7,21 @@
#include <sys/mman.h>
#include <sys/resource.h>
+static void use_stack (size_t needed);
+
+void (*use_stack_ptr) (size_t) = use_stack;
+
+static void
+use_stack (size_t needed)
+{
+ size_t sz = sysconf (_SC_PAGESIZE);
+ char *buf = alloca (sz);
+ memset (buf, '\0', sz);
+
+ if (needed > sz)
+ use_stack_ptr (needed - sz);
+}
+
static void
use_up_memory (void)
{
@@ -38,6 +53,9 @@ do_test (void)
int err;
pthread_t tid;
+ /* Allocate the memory needed for the stack. */
+ use_stack_ptr (PTHREAD_STACK_MIN);
+
use_up_memory ();
err = pthread_create (&tid, NULL, child, NULL);