This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][BZ 16074] Document that mmap() returns MAP_FAILED on error


At the moment, the glibc manual documents mmap() as returning -1 on error.

This is a problem because (1) it is cumbersome to test whether a void*
return value is equal to an integer and (2) it is not portable.

POSIX states that it returns MAP_FAILED on error as per

I suggest that the manual should be changed to indicate that mmap()
returns MAP_FAILED on error, which it does.

Could you please review the patch?


Best regards

 ChangeLog        |    5 +++++
 manual/llio.texi |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2027bd6..4912ffd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-22  Fabrice Bauzac  <>
+    * manual/llio.texi (Memory-mapped I/O): Indicate that mmap returns
+    MAP_FAILED on error.
 2013-05-11  Joseph Myers  <>

     * math/ (fma_test): Use max_value instead of local
diff --git a/manual/llio.texi b/manual/llio.texi
index b129cf4..dd0eaa3 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -1226,8 +1226,8 @@ as the included @code{malloc} automatically uses
@code{mmap} where appropriate.

 @end vtable

-@code{mmap} returns the address of the new mapping, or @math{-1} for an
+@code{mmap} returns the address of the new mapping, or
+@code{MAP_FAILED} for an error.

 Possible errors include:


Attachment: 0001-Document-that-mmap-returns-MAP_FAILED-on-error-as-pe.patch
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]