Bug#542601: manpages-dev: mmap(2) manpage doesn't say that MAP_ANON is not available if _XOPEN_SOURCE is defined

2013-02-13 Thread Simon Paillard
On Tue, Feb 12, 2013 at 09:42:11PM +0100, Michael Kerrisk (man-pages) wrote:
 tags 542601 fixed-upstream
 thanks

FTR, it will be available in 3.48, and is:
45e97e2ac5b mmap.2: Some 'flags' values require a feature test macro to be 
defined
 

-- 
Simon Paillard


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#542601: manpages-dev: mmap(2) manpage doesn't say that MAP_ANON is not available if _XOPEN_SOURCE is defined

2013-02-12 Thread Michael Kerrisk (man-pages)
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
 .BIint  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



Bug#542601: manpages-dev: mmap(2) manpage doesn't say that MAP_ANON is not available if _XOPEN_SOURCE is defined

2009-08-20 Thread Török Edwin
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.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30.4 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages manpages-dev depends on:
ii  manpages  3.22-1 Manual pages about using a GNU/Lin

manpages-dev recommends no packages.

Versions of packages manpages-dev suggests:
ii  konqueror [man-browser]   4:4.3.0-1  KDE 4's advanced file manager, web
ii  man-db [man-browser]  2.5.5-3on-line manual pager

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org