aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-basic7.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /nptl/tst-basic7.c
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-zack/build-layout-experiment.tar
glibc-zack/build-layout-experiment.tar.gz
glibc-zack/build-layout-experiment.tar.bz2
glibc-zack/build-layout-experiment.zip
Prepare for radical source tree reorganization.zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'nptl/tst-basic7.c')
-rw-r--r--nptl/tst-basic7.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/nptl/tst-basic7.c b/nptl/tst-basic7.c
deleted file mode 100644
index 29a2461efe..0000000000
--- a/nptl/tst-basic7.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#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)
-{
- struct rlimit rl;
- getrlimit (RLIMIT_AS, &rl);
- rl.rlim_cur = 10 * 1024 * 1024;
- setrlimit (RLIMIT_AS, &rl);
-
- char *c;
- int PAGESIZE = getpagesize ();
- while (1)
- {
- c = mmap (NULL, PAGESIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
- if (c == MAP_FAILED)
- break;
- }
-}
-
-static void *
-child (void *arg)
-{
- sleep (1);
- return arg;
-}
-
-static int
-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);
- if (err != 0)
- {
- printf ("pthread_create returns %d: %s\n", err,
- err == EAGAIN ? "OK" : "FAIL");
- return err != EAGAIN;
- }
-
- /* We did not fail to allocate memory despite the preparation. Oh well. */
- return 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"