summary refs log tree commit diff
path: root/string/test-string.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-06-12 16:53:43 +0000
committerJakub Jelinek <jakub@redhat.com>2008-06-12 16:53:43 +0000
commit72d4ac23660326e76443cf18f0ed8c2e4792d268 (patch)
treedec24311250bb61298456c3eb0e8937c3a4b7561 /string/test-string.h
parent8ba7d5cebbd4acf40dc8d22982baa50c2e1fd194 (diff)
downloadglibc-72d4ac23660326e76443cf18f0ed8c2e4792d268.tar.gz
glibc-72d4ac23660326e76443cf18f0ed8c2e4792d268.tar.xz
glibc-72d4ac23660326e76443cf18f0ed8c2e4792d268.zip
Updated to fedora-glibc-20080612T1619 cvs/fedora-glibc-2_8_90-6
Diffstat (limited to 'string/test-string.h')
-rw-r--r--string/test-string.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/string/test-string.h b/string/test-string.h
index 381c140d9f..1aea4c9cb9 100644
--- a/string/test-string.h
+++ b/string/test-string.h
@@ -1,5 +1,5 @@
 /* Test and measure string and memory functions.
-   Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002, 2004, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Jakub Jelinek <jakub@redhat.com>, 1999.
 
@@ -118,6 +118,10 @@ size_t iterations = 100000;
     }									\
   while (0)
 
+#ifndef BUF1PAGES
+# define BUF1PAGES 1
+#endif
+
 static void
 test_init (void)
 {
@@ -126,11 +130,11 @@ test_init (void)
   if (page_size < MIN_PAGE_SIZE)
     page_size = MIN_PAGE_SIZE;
 #endif
-  buf1 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
+  buf1 = mmap (0, (BUF1PAGES + 1) * page_size, PROT_READ | PROT_WRITE,
 	       MAP_PRIVATE | MAP_ANON, -1, 0);
   if (buf1 == MAP_FAILED)
     error (EXIT_FAILURE, errno, "mmap failed");
-  if (mprotect (buf1 + page_size, page_size, PROT_NONE))
+  if (mprotect (buf1 + BUF1PAGES * page_size, page_size, PROT_NONE))
     error (EXIT_FAILURE, errno, "mprotect failed");
   buf2 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
 	       MAP_PRIVATE | MAP_ANON, -1, 0);
@@ -145,7 +149,7 @@ test_init (void)
       srandom (seed);
     }
 
-  memset (buf1, 0xa5, page_size);
+  memset (buf1, 0xa5, BUF1PAGES * page_size);
   memset (buf2, 0x5a, page_size);
 }