summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2005-07-11 12:50:47 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2005-07-11 12:50:47 +0000
commit4a8f16a064596f0935527600f239fe99c77b4ff3 (patch)
treecb3c8e0929682cce74f7273662428e452473cedc
parentdcdd2b085b00bbc5cb541c636ad5e3d407b4d88f (diff)
Test that mmap fails properly.
-rw-r--r--regress/sys/kern/mmap-fail/Makefile5
-rw-r--r--regress/sys/kern/mmap-fail/mmap-fail.c20
2 files changed, 25 insertions, 0 deletions
diff --git a/regress/sys/kern/mmap-fail/Makefile b/regress/sys/kern/mmap-fail/Makefile
new file mode 100644
index 00000000000..0b76005d618
--- /dev/null
+++ b/regress/sys/kern/mmap-fail/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2005/07/11 12:50:46 art Exp $
+
+PROG= mmap-fail
+
+.include <bsd.regress.mk>
diff --git a/regress/sys/kern/mmap-fail/mmap-fail.c b/regress/sys/kern/mmap-fail/mmap-fail.c
new file mode 100644
index 00000000000..6a484a1df01
--- /dev/null
+++ b/regress/sys/kern/mmap-fail/mmap-fail.c
@@ -0,0 +1,20 @@
+/* $OpenBSD: mmap-fail.c,v 1.1 2005/07/11 12:50:46 art Exp $ */
+/*
+ * Written by Artur Grabowski <art@openbsd.org> 2005 Public Domain.
+ */
+
+#include <sys/types.h>
+#include <sys/mman.h>
+
+int
+main()
+{
+ void *foo;
+
+ foo = mmap(0, (size_t)-1, 0, 0, 0, 0);
+
+ if (foo == MAP_FAILED)
+ return (0);
+
+ return (1);
+}