I'm not subscribed, please CC me. glibc doesn't require _GNU_SOURCE to expose certain MAP_* constants anymore (MAP_ANONYMOUS being particularly noteworthy among them for being on track for POSIX Issue 8). See this commit: https://sourceware.org/git/?p=glibc.git;a=commit;h=954b8f38958de72c4712088735eb175118f17b51 or my glibc bug report which triggered the change at https://sourceware.org/bugzilla/show_bug.cgi?id=29375 This is because POSIX reserves MAP_ constants to the implementation, so their unconditional visibility in sys/mman.h is always allowed. This is also helpful for portable application writers. Other C libraries like musl already exhibit this behavior. Because mmap() is in a POSIX-specific header already, using it with any combination of MAP_ constants doesn't require feature test macros. Thanks for your consideration
From 47632888627cac3d0547a969c55d3848b3b350b7 Mon Sep 17 00:00:00 2001 From: John Scott <jscott@xxxxxxxxxx> Date: Wed, 19 Oct 2022 06:25:25 -0400 Subject: [PATCH] Remove any feature test macro requirements for mmap() No feature test macros are required anymore, not even to expose certain constants. See https://sourceware.org/bugzilla/show_bug.cgi?id=29375 --- man2/mmap.2 | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/man2/mmap.2 b/man2/mmap.2 index 9c343f2..8a2bddf 100644 --- a/man2/mmap.2 +++ b/man2/mmap.2 @@ -32,8 +32,6 @@ Standard C library .BI " int " fd ", off_t " offset ); .BI "int munmap(void *" addr ", size_t " length ); .fi -.PP -See NOTES for information on feature test macro requirements. .SH DESCRIPTION .BR mmap () creates a new mapping in the virtual address space of @@ -727,39 +725,6 @@ flag is specified, and .I addr is 0 (NULL), then the mapped address will be 0 (NULL). .PP -Certain -.I flags -constants are defined only if suitable feature test macros are defined -(possibly by default): -.B _DEFAULT_SOURCE -with glibc 2.19 or later; -or -.B _BSD_SOURCE -or -.B _SVID_SOURCE -in glibc 2.19 and earlier. -(Employing -.B _GNU_SOURCE -also suffices, -and requiring that macro specifically would have been more logical, -since these flags are all Linux-specific.) -The relevant flags are: -.BR MAP_32BIT , -.B MAP_ANONYMOUS -(and the synonym -.BR MAP_ANON ), -.BR MAP_DENYWRITE , -.BR MAP_EXECUTABLE , -.BR MAP_FILE , -.BR MAP_GROWSDOWN , -.BR MAP_HUGETLB , -.BR MAP_LOCKED , -.BR MAP_NONBLOCK , -.BR MAP_NORESERVE , -.BR MAP_POPULATE , -and -.BR MAP_STACK . -.PP An application can determine which pages of a mapping are currently resident in the buffer/page cache using .BR mincore (2). -- 2.35.1
Attachment:
signature.asc
Description: This is a digitally signed message part