mirror of
				https://sourceware.org/git/glibc.git
				synced 2025-11-03 20:53:13 +03:00 
			
		
		
		
	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:
		@@ -37,27 +37,21 @@
 | 
				
			|||||||
/* Flags contain mapping type, sharing type and options.  */
 | 
					/* Flags contain mapping type, sharing type and options.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Mapping type (must choose one and only one of these).  */
 | 
					/* 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_FILE	 0x0001	/* Mapped from a file or device.  */
 | 
				
			||||||
#define MAP_ANON	 0x0002	/* Allocated from anonymous virtual memory.  */
 | 
					#define MAP_ANON	 0x0002	/* Allocated from anonymous virtual memory.  */
 | 
				
			||||||
#define MAP_TYPE	 0x000f	/* Mask for type field.  */
 | 
					#define MAP_TYPE	 0x000f	/* Mask for type field.  */
 | 
				
			||||||
#define MAP_ANONYMOUS	 MAP_ANON /* Linux name. */
 | 
					#define MAP_ANONYMOUS	 MAP_ANON /* Linux name. */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Sharing types (must choose one and only one of these).  */
 | 
					/* Sharing types (must choose one and only one of these).  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_COPY	 0x0020	/* Virtual copy of region at mapping time.  */
 | 
					#define MAP_COPY	 0x0020	/* Virtual copy of region at mapping time.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
#define	MAP_SHARED	 0x0010	/* Share changes.  */
 | 
					#define	MAP_SHARED	 0x0010	/* Share changes.  */
 | 
				
			||||||
#define	MAP_PRIVATE	 0x0000	/* Changes private; copy pages on write.  */
 | 
					#define	MAP_PRIVATE	 0x0000	/* Changes private; copy pages on write.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Other flags.  */
 | 
					/* Other flags.  */
 | 
				
			||||||
#define	MAP_FIXED	 0x0100	/* Map address must be exactly as requested. */
 | 
					#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_NOEXTEND	 0x0200	/* For MAP_FILE, don't change file size.  */
 | 
				
			||||||
#define MAP_HASSEMPHORE 0x0400	/* Region may contain semaphores.  */
 | 
					#define MAP_HASSEMPHORE 0x0400	/* Region may contain semaphores.  */
 | 
				
			||||||
#define MAP_INHERIT	 0x0800	/* Region is retained after exec.  */
 | 
					#define MAP_INHERIT	 0x0800	/* Region is retained after exec.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Advice to `madvise'.  */
 | 
					/* Advice to `madvise'.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					#ifdef __USE_MISC
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,6 @@
 | 
				
			|||||||
#define __MAP_ANONYMOUS	  0x10		/* Don't use a file.  */
 | 
					#define __MAP_ANONYMOUS	  0x10		/* Don't use a file.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_GROWSDOWN	  0x01000	/* Stack-like segment.  */
 | 
					#define MAP_GROWSDOWN	  0x01000	/* Stack-like segment.  */
 | 
				
			||||||
#define MAP_DENYWRITE	  0x02000	/* ETXTBSY */
 | 
					#define MAP_DENYWRITE	  0x02000	/* ETXTBSY */
 | 
				
			||||||
#define MAP_EXECUTABLE	  0x04000	/* Mark it as an executable.  */
 | 
					#define MAP_EXECUTABLE	  0x04000	/* Mark it as an executable.  */
 | 
				
			||||||
@@ -38,7 +37,6 @@
 | 
				
			|||||||
#define MAP_HUGETLB	  0x100000	/* Create huge page mapping.  */
 | 
					#define MAP_HUGETLB	  0x100000	/* Create huge page mapping.  */
 | 
				
			||||||
#define MAP_FIXED_NOREPLACE 0x200000	/* MAP_FIXED but do not unmap
 | 
					#define MAP_FIXED_NOREPLACE 0x200000	/* MAP_FIXED but do not unmap
 | 
				
			||||||
					   underlying mapping.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Flags for `mlockall'.  */
 | 
					/* Flags for `mlockall'.  */
 | 
				
			||||||
#define MCL_CURRENT	  8192
 | 
					#define MCL_CURRENT	  8192
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,15 +41,12 @@
 | 
				
			|||||||
/* Sharing types (must choose one and only one of these).  */
 | 
					/* Sharing types (must choose one and only one of these).  */
 | 
				
			||||||
#define MAP_SHARED	0x01		/* Share changes.  */
 | 
					#define MAP_SHARED	0x01		/* Share changes.  */
 | 
				
			||||||
#define MAP_PRIVATE	0x02		/* Changes are private.  */
 | 
					#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.  */
 | 
										   extension flags.  */
 | 
				
			||||||
#define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
 | 
					#define MAP_TYPE	0x0f		/* Mask for type of mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Other flags.  */
 | 
					/* Other flags.  */
 | 
				
			||||||
#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
 | 
					#define MAP_FIXED	0x10		/* Interpret addr exactly.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_FILE	0
 | 
					#define MAP_FILE	0
 | 
				
			||||||
#ifdef __MAP_ANONYMOUS
 | 
					#ifdef __MAP_ANONYMOUS
 | 
				
			||||||
# define MAP_ANONYMOUS	__MAP_ANONYMOUS	/* Don't use a file.  */
 | 
					# define MAP_ANONYMOUS	__MAP_ANONYMOUS	/* Don't use a file.  */
 | 
				
			||||||
@@ -60,7 +57,6 @@
 | 
				
			|||||||
/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.  */
 | 
					/* When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size.  */
 | 
				
			||||||
#define MAP_HUGE_SHIFT	26
 | 
					#define MAP_HUGE_SHIFT	26
 | 
				
			||||||
#define MAP_HUGE_MASK	0x3f
 | 
					#define MAP_HUGE_MASK	0x3f
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Flags to `msync'.  */
 | 
					/* Flags to `msync'.  */
 | 
				
			||||||
#define MS_ASYNC	1		/* Sync memory asynchronously.  */
 | 
					#define MS_ASYNC	1		/* Sync memory asynchronously.  */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,6 @@
 | 
				
			|||||||
   includes asm-generic/mman.h without any changes to the values of
 | 
					   includes asm-generic/mman.h without any changes to the values of
 | 
				
			||||||
   the MAP_* flags defined in that header.  */
 | 
					   the MAP_* flags defined in that header.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
 | 
					#define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
 | 
				
			||||||
#define MAP_DENYWRITE	0x00800		/* ETXTBSY.  */
 | 
					#define MAP_DENYWRITE	0x00800		/* ETXTBSY.  */
 | 
				
			||||||
#define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
 | 
					#define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
 | 
				
			||||||
@@ -39,4 +38,3 @@
 | 
				
			|||||||
					   faults for the mapping.  */
 | 
										   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.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,12 +24,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Other flags.  */
 | 
					/* Other flags.  */
 | 
				
			||||||
#define __MAP_ANONYMOUS	0x10		/* Don't use a file */
 | 
					#define __MAP_ANONYMOUS	0x10		/* Don't use a file */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_VARIABLE	0
 | 
					#define MAP_VARIABLE	0
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 | 
					#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 | 
				
			||||||
#define MAP_EXECUTABLE	0x1000		/* Mark it as an executable */
 | 
					#define MAP_EXECUTABLE	0x1000		/* Mark it as an executable */
 | 
				
			||||||
#define MAP_LOCKED	0x2000		/* Pages are locked */
 | 
					#define MAP_LOCKED	0x2000		/* Pages are locked */
 | 
				
			||||||
@@ -41,7 +38,6 @@
 | 
				
			|||||||
#define MAP_HUGETLB	0x80000		/* Create a huge page mapping */
 | 
					#define MAP_HUGETLB	0x80000		/* Create a huge page 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.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Advice to "madvise"  */
 | 
					/* Advice to "madvise"  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					#ifdef __USE_MISC
 | 
				
			||||||
@@ -50,10 +46,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include <bits/mman-linux.h>
 | 
					#include <bits/mman-linux.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#undef MAP_TYPE
 | 
					#undef MAP_TYPE
 | 
				
			||||||
#define MAP_TYPE	0x2b		/* Mask for type of mapping */
 | 
					#define MAP_TYPE	0x2b		/* Mask for type of mapping */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#undef MAP_FIXED
 | 
					#undef MAP_FIXED
 | 
				
			||||||
#define MAP_FIXED	0x04		/* Interpret addr exactly */
 | 
					#define MAP_FIXED	0x04		/* Interpret addr exactly */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,9 +24,7 @@
 | 
				
			|||||||
   But the kernel header is not namespace clean.  */
 | 
					   But the kernel header is not namespace clean.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_GROWSUP	  0x00200	/* Register stack-like segment */
 | 
					#define MAP_GROWSUP	  0x00200	/* Register stack-like segment */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <bits/mman-map-flags-generic.h>
 | 
					#include <bits/mman-map-flags-generic.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,6 @@
 | 
				
			|||||||
   But the kernel header is not namespace clean.  */
 | 
					   But the kernel header is not namespace clean.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_NORESERVE	0x0400		/* don't check for reservations */
 | 
					#define MAP_NORESERVE	0x0400		/* don't check for reservations */
 | 
				
			||||||
#define MAP_GROWSDOWN	0x1000		/* stack-like segment */
 | 
					#define MAP_GROWSDOWN	0x1000		/* stack-like segment */
 | 
				
			||||||
#define MAP_DENYWRITE	0x2000		/* ETXTBSY */
 | 
					#define MAP_DENYWRITE	0x2000		/* ETXTBSY */
 | 
				
			||||||
@@ -36,13 +35,10 @@
 | 
				
			|||||||
#define MAP_HUGETLB	0x80000		/* Create huge page mapping.  */
 | 
					#define MAP_HUGETLB	0x80000		/* Create huge page 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.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __MAP_ANONYMOUS 0x0800
 | 
					#define __MAP_ANONYMOUS 0x0800
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Include generic Linux declarations.  */
 | 
					/* Include generic Linux declarations.  */
 | 
				
			||||||
#include <bits/mman-linux.h>
 | 
					#include <bits/mman-linux.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_RENAME	MAP_ANONYMOUS
 | 
					#define MAP_RENAME	MAP_ANONYMOUS
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,6 @@
 | 
				
			|||||||
#define PROT_SAO	0x10		/* Strong Access Ordering.  */
 | 
					#define PROT_SAO	0x10		/* Strong Access Ordering.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
 | 
					#define MAP_GROWSDOWN	0x00100		/* Stack-like segment.  */
 | 
				
			||||||
#define MAP_DENYWRITE	0x00800		/* ETXTBSY */
 | 
					#define MAP_DENYWRITE	0x00800		/* ETXTBSY */
 | 
				
			||||||
#define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
 | 
					#define MAP_EXECUTABLE	0x01000		/* Mark it as an executable.  */
 | 
				
			||||||
@@ -40,7 +39,6 @@
 | 
				
			|||||||
					   faults for the mapping.  */
 | 
										   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.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Flags for `mlockall'.  */
 | 
					/* Flags for `mlockall'.  */
 | 
				
			||||||
#define MCL_CURRENT	0x2000		/* Lock all currently mapped pages.  */
 | 
					#define MCL_CURRENT	0x2000		/* Lock all currently mapped pages.  */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are Linux-specific.  */
 | 
					/* These are Linux-specific.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_GROWSDOWN	0x0200		/* Stack-like segment.  */
 | 
					#define MAP_GROWSDOWN	0x0200		/* Stack-like segment.  */
 | 
				
			||||||
#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 | 
					#define MAP_DENYWRITE	0x0800		/* ETXTBSY */
 | 
				
			||||||
#define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 | 
					#define MAP_EXECUTABLE	0x1000		/* Mark it as an executable.  */
 | 
				
			||||||
@@ -40,7 +39,6 @@
 | 
				
			|||||||
					   faults for the mapping.  */
 | 
										   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.  */
 | 
										   underlying mapping.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Flags for `mlockall'.  */
 | 
					/* Flags for `mlockall'.  */
 | 
				
			||||||
#define MCL_CURRENT	0x2000		/* Lock all currently mapped pages.  */
 | 
					#define MCL_CURRENT	0x2000		/* Lock all currently mapped pages.  */
 | 
				
			||||||
@@ -52,6 +50,4 @@
 | 
				
			|||||||
#include <bits/mman-linux.h>
 | 
					#include <bits/mman-linux.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Other flags.  */
 | 
					/* Other flags.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_RENAME	MAP_ANONYMOUS
 | 
					#define MAP_RENAME	MAP_ANONYMOUS
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,9 +24,7 @@
 | 
				
			|||||||
   But the kernel header is not namespace clean.  */
 | 
					   But the kernel header is not namespace clean.  */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Other flags.  */
 | 
					/* Other flags.  */
 | 
				
			||||||
#ifdef __USE_MISC
 | 
					 | 
				
			||||||
#define MAP_32BIT	0x40		/* Only give out 32-bit addresses.  */
 | 
					#define MAP_32BIT	0x40		/* Only give out 32-bit addresses.  */
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <bits/mman-map-flags-generic.h>
 | 
					#include <bits/mman-map-flags-generic.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user