Expose all MAP_ constants in <sys/mman.h> unconditionally (bug 29375)

POSIX reserves the MAP_ prefix for <sys/mman.h>, so there is no need to
conditionalize their definitions on feature test macros.
This commit is contained in:
Andreas Schwab 2022-08-16 15:18:11 +02:00
parent 589eda82bb
commit 954b8f3895
10 changed files with 90 additions and 124 deletions

View File

@ -37,27 +37,21 @@
/* Flags contain mapping type, sharing type and options. */
/* Mapping type (must choose one and only one of these). */
#ifdef __USE_MISC
# define MAP_FILE 0x0001 /* Mapped from a file or device. */
# define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */
# define MAP_TYPE 0x000f /* Mask for type field. */
# define MAP_ANONYMOUS MAP_ANON /* Linux name. */
#endif
#define MAP_FILE 0x0001 /* Mapped from a file or device. */
#define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */
#define MAP_TYPE 0x000f /* Mask for type field. */
#define MAP_ANONYMOUS MAP_ANON /* Linux name. */
/* Sharing types (must choose one and only one of these). */
#ifdef __USE_MISC
# define MAP_COPY 0x0020 /* Virtual copy of region at mapping time. */
#endif
#define MAP_COPY 0x0020 /* Virtual copy of region at mapping time. */
#define MAP_SHARED 0x0010 /* Share changes. */
#define MAP_PRIVATE 0x0000 /* Changes private; copy pages on write. */
/* Other flags. */
#define MAP_FIXED 0x0100 /* Map address must be exactly as requested. */
#ifdef __USE_MISC
# define MAP_NOEXTEND 0x0200 /* For MAP_FILE, don't change file size. */
# define MAP_HASSEMPHORE 0x0400 /* Region may contain semaphores. */
# define MAP_INHERIT 0x0800 /* Region is retained after exec. */
#endif
#define MAP_NOEXTEND 0x0200 /* For MAP_FILE, don't change file size. */
#define MAP_HASSEMPHORE 0x0400 /* Region may contain semaphores. */
#define MAP_INHERIT 0x0800 /* Region is retained after exec. */
/* Advice to `madvise'. */
#ifdef __USE_MISC

View File

@ -26,19 +26,17 @@
#define __MAP_ANONYMOUS 0x10 /* Don't use a file. */
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x01000 /* Stack-like segment. */
# define MAP_DENYWRITE 0x02000 /* ETXTBSY */
# define MAP_EXECUTABLE 0x04000 /* Mark it as an executable. */
# define MAP_LOCKED 0x08000 /* Lock the mapping. */
# define MAP_NORESERVE 0x10000 /* Don't check for reservations. */
# define MAP_POPULATE 0x20000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x40000 /* Do not block on IO. */
# define MAP_STACK 0x80000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x100000 /* Create huge page mapping. */
# define MAP_FIXED_NOREPLACE 0x200000 /* MAP_FIXED but do not unmap
#define MAP_GROWSDOWN 0x01000 /* Stack-like segment. */
#define MAP_DENYWRITE 0x02000 /* ETXTBSY */
#define MAP_EXECUTABLE 0x04000 /* Mark it as an executable. */
#define MAP_LOCKED 0x08000 /* Lock the mapping. */
#define MAP_NORESERVE 0x10000 /* Don't check for reservations. */
#define MAP_POPULATE 0x20000 /* Populate (prefault) pagetables. */
#define MAP_NONBLOCK 0x40000 /* Do not block on IO. */
#define MAP_STACK 0x80000 /* Allocation is for a stack. */
#define MAP_HUGETLB 0x100000 /* Create huge page mapping. */
#define MAP_FIXED_NOREPLACE 0x200000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif
/* Flags for `mlockall'. */
#define MCL_CURRENT 8192

View File

@ -41,26 +41,22 @@
/* Sharing types (must choose one and only one of these). */
#define MAP_SHARED 0x01 /* Share changes. */
#define MAP_PRIVATE 0x02 /* Changes are private. */
#ifdef __USE_MISC
# define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate
#define MAP_SHARED_VALIDATE 0x03 /* Share changes and validate
extension flags. */
# define MAP_TYPE 0x0f /* Mask for type of mapping. */
#endif
#define MAP_TYPE 0x0f /* Mask for type of mapping. */
/* Other flags. */
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
#ifdef __USE_MISC
# define MAP_FILE 0
# ifdef __MAP_ANONYMOUS
# define MAP_ANONYMOUS __MAP_ANONYMOUS /* Don't use a file. */
# else
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
# endif
# define MAP_ANON MAP_ANONYMOUS
/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */
# define MAP_HUGE_SHIFT 26
# define MAP_HUGE_MASK 0x3f
#define MAP_FILE 0
#ifdef __MAP_ANONYMOUS
# define MAP_ANONYMOUS __MAP_ANONYMOUS /* Don't use a file. */
#else
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
#endif
#define MAP_ANON MAP_ANONYMOUS
/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. */
#define MAP_HUGE_SHIFT 26
#define MAP_HUGE_MASK 0x3f
/* Flags to `msync'. */
#define MS_ASYNC 1 /* Sync memory asynchronously. */

View File

@ -25,18 +25,16 @@
includes asm-generic/mman.h without any changes to the values of
the MAP_* flags defined in that header. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
# define MAP_DENYWRITE 0x00800 /* ETXTBSY. */
# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
# define MAP_LOCKED 0x02000 /* Lock the mapping. */
# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
# define MAP_STACK 0x20000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
# define MAP_SYNC 0x80000 /* Perform synchronous page
#define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
#define MAP_DENYWRITE 0x00800 /* ETXTBSY. */
#define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
#define MAP_LOCKED 0x02000 /* Lock the mapping. */
#define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
#define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
#define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#define MAP_STACK 0x20000 /* Allocation is for a stack. */
#define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#define MAP_SYNC 0x80000 /* Perform synchronous page
faults for the mapping. */
# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif

View File

@ -24,24 +24,20 @@
/* Other flags. */
#define __MAP_ANONYMOUS 0x10 /* Don't use a file */
#ifdef __USE_MISC
# define MAP_VARIABLE 0
#endif
#define MAP_VARIABLE 0
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable */
# define MAP_LOCKED 0x2000 /* Pages are locked */
# define MAP_NORESERVE 0x4000 /* Don't check for reservations */
# define MAP_GROWSDOWN 0x8000 /* Stack-like segment */
# define MAP_POPULATE 0x10000 /* Populate (prefault) pagetables */
# define MAP_NONBLOCK 0x20000 /* Do not block on IO */
# define MAP_STACK 0x40000 /* Create for process/thread stacks */
# define MAP_HUGETLB 0x80000 /* Create a huge page mapping */
# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
#define MAP_EXECUTABLE 0x1000 /* Mark it as an executable */
#define MAP_LOCKED 0x2000 /* Pages are locked */
#define MAP_NORESERVE 0x4000 /* Don't check for reservations */
#define MAP_GROWSDOWN 0x8000 /* Stack-like segment */
#define MAP_POPULATE 0x10000 /* Populate (prefault) pagetables */
#define MAP_NONBLOCK 0x20000 /* Do not block on IO */
#define MAP_STACK 0x40000 /* Create for process/thread stacks */
#define MAP_HUGETLB 0x80000 /* Create a huge page mapping */
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif
/* Advice to "madvise" */
#ifdef __USE_MISC
@ -50,10 +46,8 @@
#include <bits/mman-linux.h>
#ifdef __USE_MISC
# undef MAP_TYPE
# define MAP_TYPE 0x2b /* Mask for type of mapping */
#endif
#undef MAP_TYPE
#define MAP_TYPE 0x2b /* Mask for type of mapping */
#undef MAP_FIXED
#define MAP_FIXED 0x04 /* Interpret addr exactly */

View File

@ -24,9 +24,7 @@
But the kernel header is not namespace clean. */
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSUP 0x00200 /* Register stack-like segment */
#endif
#define MAP_GROWSUP 0x00200 /* Register stack-like segment */
#include <bits/mman-map-flags-generic.h>

View File

@ -24,25 +24,21 @@
But the kernel header is not namespace clean. */
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_NORESERVE 0x0400 /* don't check for reservations */
# define MAP_GROWSDOWN 0x1000 /* stack-like segment */
# define MAP_DENYWRITE 0x2000 /* ETXTBSY */
# define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
# define MAP_LOCKED 0x8000 /* pages are locked */
# define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
# define MAP_NONBLOCK 0x20000 /* do not block on IO */
# define MAP_STACK 0x40000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x80000 /* Create huge page mapping. */
# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
#define MAP_NORESERVE 0x0400 /* don't check for reservations */
#define MAP_GROWSDOWN 0x1000 /* stack-like segment */
#define MAP_DENYWRITE 0x2000 /* ETXTBSY */
#define MAP_EXECUTABLE 0x4000 /* mark it as an executable */
#define MAP_LOCKED 0x8000 /* pages are locked */
#define MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
#define MAP_NONBLOCK 0x20000 /* do not block on IO */
#define MAP_STACK 0x40000 /* Allocation is for a stack. */
#define MAP_HUGETLB 0x80000 /* Create huge page mapping. */
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif
#define __MAP_ANONYMOUS 0x0800
/* Include generic Linux declarations. */
#include <bits/mman-linux.h>
#ifdef __USE_MISC
# define MAP_RENAME MAP_ANONYMOUS
#endif
#define MAP_RENAME MAP_ANONYMOUS

View File

@ -26,21 +26,19 @@
#define PROT_SAO 0x10 /* Strong Access Ordering. */
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
# define MAP_LOCKED 0x00080 /* Lock the mapping. */
# define MAP_NORESERVE 0x00040 /* Don't check for reservations. */
# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
# define MAP_STACK 0x20000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
# define MAP_SYNC 0x80000 /* Perform synchronous page
#define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
#define MAP_DENYWRITE 0x00800 /* ETXTBSY */
#define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
#define MAP_LOCKED 0x00080 /* Lock the mapping. */
#define MAP_NORESERVE 0x00040 /* Don't check for reservations. */
#define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
#define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#define MAP_STACK 0x20000 /* Allocation is for a stack. */
#define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#define MAP_SYNC 0x80000 /* Perform synchronous page
faults for the mapping. */
# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif
/* Flags for `mlockall'. */
#define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */

View File

@ -25,22 +25,20 @@
/* These are Linux-specific. */
#ifdef __USE_MISC
# define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */
# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
# define MAP_LOCKED 0x0100 /* Lock the mapping. */
# define MAP_NORESERVE 0x0040 /* Don't check for reservations. */
# define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */
# define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */
# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
# define MAP_STACK 0x20000 /* Allocation is for a stack. */
# define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
# define MAP_SYNC 0x80000 /* Perform synchronous page
#define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */
#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
#define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
#define MAP_LOCKED 0x0100 /* Lock the mapping. */
#define MAP_NORESERVE 0x0040 /* Don't check for reservations. */
#define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */
#define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */
#define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#define MAP_STACK 0x20000 /* Allocation is for a stack. */
#define MAP_HUGETLB 0x40000 /* Create huge page mapping. */
#define MAP_SYNC 0x80000 /* Perform synchronous page
faults for the mapping. */
# define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
#define MAP_FIXED_NOREPLACE 0x100000 /* MAP_FIXED but do not unmap
underlying mapping. */
#endif
/* Flags for `mlockall'. */
#define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */
@ -52,6 +50,4 @@
#include <bits/mman-linux.h>
/* Other flags. */
#ifdef __USE_MISC
# define MAP_RENAME MAP_ANONYMOUS
#endif
#define MAP_RENAME MAP_ANONYMOUS

View File

@ -24,9 +24,7 @@
But the kernel header is not namespace clean. */
/* Other flags. */
#ifdef __USE_MISC
# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */
#endif
#define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */
#include <bits/mman-map-flags-generic.h>