summaryrefslogtreecommitdiff
path: root/regress/sys/uvm
diff options
context:
space:
mode:
authorKurt Miller <kurt@cvs.openbsd.org>2006-04-06 20:39:04 +0000
committerKurt Miller <kurt@cvs.openbsd.org>2006-04-06 20:39:04 +0000
commit0c30f8f5391fb1c702e23f2aeca504c5f82fb50e (patch)
treebf44c883c88369f818b71534f900194579218f6c /regress/sys/uvm
parentc6ddcea9c34ef0318b872ccc5ec07b144947a6db (diff)
add a regress that repetitively calls mmap with MMAP_FIXED on the same
region of memory to ensure process datasize is properly calculated. this time in the righ place *sigh* ok pedro@
Diffstat (limited to 'regress/sys/uvm')
-rw-r--r--regress/sys/uvm/mmap_fixed/Makefile4
-rw-r--r--regress/sys/uvm/mmap_fixed/mmap_fixed.c33
2 files changed, 37 insertions, 0 deletions
diff --git a/regress/sys/uvm/mmap_fixed/Makefile b/regress/sys/uvm/mmap_fixed/Makefile
new file mode 100644
index 00000000000..405f33cb805
--- /dev/null
+++ b/regress/sys/uvm/mmap_fixed/Makefile
@@ -0,0 +1,4 @@
+# $OpenBSD: Makefile,v 1.1.1.1 2006/04/06 20:39:03 kurt Exp $
+PROG=mmap_fixed
+
+.include <bsd.regress.mk>
diff --git a/regress/sys/uvm/mmap_fixed/mmap_fixed.c b/regress/sys/uvm/mmap_fixed/mmap_fixed.c
new file mode 100644
index 00000000000..4b3669ba5da
--- /dev/null
+++ b/regress/sys/uvm/mmap_fixed/mmap_fixed.c
@@ -0,0 +1,33 @@
+/* $OpenBSD: mmap_fixed.c,v 1.1.1.1 2006/04/06 20:39:03 kurt Exp $ */
+
+/*
+ * Public domain. 2006, Kurt Miller <kurt@intricatesoftware.com>
+ */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <err.h>
+
+#define MEM_SIZE 1024*1024
+
+/*
+ * Repetitively call mmap with MMAP_FIXED on the same region of memory
+ * to ensure process datasize is properly calculated.
+ */
+
+int
+main(void)
+{
+ void *mem_area;
+ int i;
+
+ mem_area = mmap(0, MEM_SIZE, PROT_NONE, MAP_ANON, -1, 0);
+
+ for (i = 0; i < 20000; i++) {
+ if (mmap(mem_area, MEM_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
+ err(1, NULL);
+ }
+
+ return (0);
+}