On Fri, Jun 27, 2014 at 02:46:01PM +0200, Mark Kettenis wrote: > Losing the descriptions of the "no-op" flags is a bit unfortunate. > Can you add those back?
Okay, restored them below. Also tested that kdump can handle this change gracefully. In this diff I've also moved MAP_FILE down to the legacy flags section. I don't expect we'll want to remove it, but strictly speaking it *is* just a legacy flag: POSIX doesn't define MAP_FILE and instead just mandates the "map from file" semantics even without any flag. ok? Index: sys/sys/mman.h =================================================================== RCS file: /home/matthew/cvs-mirror/cvs/src/sys/sys/mman.h,v retrieving revision 1.24 diff -u -p -r1.24 mman.h --- sys/sys/mman.h 13 Jun 2014 01:48:52 -0000 1.24 +++ sys/sys/mman.h 27 Jun 2014 17:26:32 -0000 @@ -50,32 +50,49 @@ */ #define MAP_SHARED 0x0001 /* share changes */ #define MAP_PRIVATE 0x0002 /* changes are private */ -#define MAP_COPY 0x0004 /* "copy" region at mmap time */ /* * Other flags */ -#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ -#define MAP_RENAME 0x0020 /* Sun: rename private pages to file */ -#define MAP_NORESERVE 0x0040 /* Sun: don't reserve needed swap area */ -#define MAP_INHERIT 0x0080 /* region is retained after exec */ -#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */ -#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */ -#define MAP_TRYFIXED 0x0400 /* attempt hint address, even within heap */ +#define MAP_FIXED 0x0010 /* map addr must be exactly as requested */ +#define __MAP_NOREPLACE 0x0800 /* fail if address not available */ +#define MAP_ANON 0x1000 /* allocated from memory, swap space */ -#define __MAP_NOREPLACE 0x0800 /* fail if address not available */ +#define MAP_FLAGMASK 0x1ff7 +#ifdef _KERNEL /* - * Error return from mmap() + * Backwards compat for OpenBSD 5.5. + * TODO: Remove after OpenBSD 5.7 release. */ -#define MAP_FAILED ((void *)-1) +#define MAP_OLDCOPY 0x0004 /* alias for MAP_PRIVATE */ +#define MAP_OLDRENAME 0x0020 +#define MAP_OLDNORESERVE 0x0040 +#define MAP_OLDINHERIT 0x0080 +#define MAP_OLDNOEXTEND 0x0100 +#define MAP_OLDHASSEMAPHORE 0x0200 +#define MAP_OLDTRYFIXED 0x0400 +#endif +#ifndef _KERNEL /* - * Mapping type + * Legacy defines for userland source compatibility. + * Can be removed once no longer needed in base and ports. */ -#define MAP_FILE 0x0000 /* map from file (default) */ -#define MAP_ANON 0x1000 /* allocated from memory, swap space */ -#define MAP_FLAGMASK 0x1ff7 +#define MAP_COPY MAP_PRIVATE /* "copy" region at mmap time */ +#define MAP_FILE 0 /* map from file (default) */ +#define MAP_HASSEMAPHORE 0 /* region may contain semaphores */ +#define MAP_INHERIT 0 /* region is retained after exec */ +#define MAP_NOEXTEND 0 /* for MAP_FILE, don't change file size */ +#define MAP_NORESERVE 0 /* Sun: don't reserve needed swap area */ +#define MAP_RENAME 0 /* Sun: rename private pages to file */ +#define MAP_TRYFIXED 0 /* attempt hint address, even within heap */ +#endif + +/* + * Error return from mmap() + */ +#define MAP_FAILED ((void *)-1) /* * POSIX memory advisory values. Index: usr.bin/kdump/mksubr =================================================================== RCS file: /home/matthew/cvs-mirror/cvs/src/usr.bin/kdump/mksubr,v retrieving revision 1.18 diff -u -p -r1.18 mksubr --- usr.bin/kdump/mksubr 21 Dec 2013 07:32:35 -0000 1.18 +++ usr.bin/kdump/mksubr 27 Jun 2014 17:08:46 -0000 @@ -241,7 +241,9 @@ cat <<_EOF_ #include <sys/fcntl.h> #include <sys/stat.h> #include <sys/unistd.h> +#define _KERNEL #include <sys/mman.h> +#undef _KERNEL #include <sys/wait.h> #include <sys/proc.h> #define _KERNEL