tags 542601 fixed-upstream thanks On Thu, Aug 20, 2009 at 1:02 PM, Török Edwin <edwinto...@gmail.com> wrote: > Package: manpages-dev > Version: 3.22-1 > Severity: normal > > When _XOPEN_SOURCE is defined the glibc headers no longer define MAP_ANON or > MAP_ANONYMOUS (because _BSD_SOURCE is no longer defined by default). > > So if I want to use both pread(2) and mmap(2) in same C source file, > I have to define both _XOPEN_SOURCE and _BSD_SOURCE to get the prototype > for pread *and* MAP_ANON for mmap(2). > > The manpage of pread(2) does say that _XOPEN_SOURCE 500 is needed, but doesn't > say that this breaks mmap. mmap's manpage doesn't say that some constants > may not be available under _XOPEN_SOURCE. > > Why is _XOPEN_SOURCE 500 even needed for pread? It is a POSIX function, > and defining _XOPEN_SOURCE is not needed for other POSIX functions. > Also the POSIX manpage for pread(3p) doesn't say that _XOPEN_SOURCE is needed, > so this seems like an unnecessary complication on Linux. > If pread(2) was available w/o _XOPEN_SOURCE being defined, then the problem > with using pread and mmap would no longer exist. I think this is rather a > question for glibc though.
I applied the patch below upstream. Thanks, Michael --- a/man2/mmap.2 +++ b/man2/mmap.2 @@ -49,6 +49,8 @@ mmap, munmap \- map or unmap files or devices into memory .BI " int " fd ", off_t " offset ); .BI "int munmap(void *" addr ", size_t " length ); .fi + +See NOTES for information on feature test macro requirements. .SH DESCRIPTION .BR mmap () creates a new mapping in the virtual address space of @@ -541,6 +543,36 @@ If the flag is specified, and .I addr is 0 (NULL), then the mapped address will be 0 (NULL). + +Certain +.I flags +constants are defined only if either +.BR _BSD_SOURCE +or +.BR _SVID_SOURCE +is defined. +(Requiring +.BR _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 , +.BR 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 . + .SH BUGS On Linux there are no guarantees like those suggested above under .BR MAP_NORESERVE . -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org