aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-basic7.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-08 01:07:04 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-08 01:07:04 +0000
commitf6ed654cabb55cc809bde696ad8357498af39757 (patch)
tree699d12220dc547380f544f9d7cf3996e60459d93 /nptl/tst-basic7.c
parentf2a8406a4f5974230d33995105160a8bacbce500 (diff)
downloadglibc-f6ed654cabb55cc809bde696ad8357498af39757.zip
glibc-f6ed654cabb55cc809bde696ad8357498af39757.tar.gz
glibc-f6ed654cabb55cc809bde696ad8357498af39757.tar.bz2
* sysdeps/x86_64/memset.S: Add sfence after movnti.
Diffstat (limited to 'nptl/tst-basic7.c')
-rw-r--r--nptl/tst-basic7.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/nptl/tst-basic7.c b/nptl/tst-basic7.c
new file mode 100644
index 0000000..da461e4
--- /dev/null
+++ b/nptl/tst-basic7.c
@@ -0,0 +1,56 @@
+#include <errno.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_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;
+
+ 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"