(void) munmap(addr, st.st_size);
+ if (munlock(addr, pgsize) == 0)
+ errx(1, "munlock %s (again): should have failed but didn't",
+ filename);
+ if (errno != ENOMEM)
+ err(1, "munlock %s (again)", filename);
+
/*
* TEST MLOCKALL'ING AN ANONYMOUS MEMORY RANGE.
*/
-/* $OpenBSD: mmap0.c,v 1.1 2011/10/07 19:43:07 ariane Exp $ */
+/* $OpenBSD: mmap0.c,v 1.2 2016/08/27 04:35:19 guenther Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
*
#include <sys/types.h>
#include <sys/mman.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
+#include <stdio.h>
#include <sysexits.h>
-#include <errno.h>
/*
-/* $OpenBSD: mmap_fixed.c,v 1.2 2016/08/25 05:12:06 deraadt Exp $ */
+/* $OpenBSD: mmap_fixed.c,v 1.3 2016/08/27 04:35:19 guenther Exp $ */
/*
* Public domain. 2006, Kurt Miller <kurt@intricatesoftware.com>
#include <sys/types.h>
#include <sys/mman.h>
#include <err.h>
+#include <stdio.h>
#define MEM_SIZE 1024*1024