From 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Thu, 8 Jun 2017 15:39:03 -0400 Subject: Prepare for radical source tree reorganization. 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). --- nptl/tst-basic7.c | 75 ------------------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 nptl/tst-basic7.c (limited to 'nptl/tst-basic7.c') 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 -#include -#include -#include -#include -#include -#include -#include -#include - -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" -- cgit v1.2.3-70-g09d2