[PATCH][BZ 16074] Document that mmap() returns MAP_FAILED on error
Fabrice Bauzac
libnoon@gmail.com
Tue Oct 22 13:24:00 GMT 2013
Hello,
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
http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html
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?
Thanks!
Best regards
Fabrice
---
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 <fbauzac@debian71.nce.amadeus.net>
+
+ * manual/llio.texi (Memory-mapped I/O): Indicate that mmap returns
+ MAP_FAILED on error.
+
2013-05-11 Joseph Myers <joseph@codesourcery.com>
* math/libm-test.inc (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
-error.
+@code{mmap} returns the address of the new mapping, or
+@code{MAP_FAILED} for an error.
Possible errors include:
--
1.7.10.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Document-that-mmap-returns-MAP_FAILED-on-error-as-pe.patch
Type: application/octet-stream
Size: 1216 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20131022/9ceec385/attachment.obj>
More information about the Libc-alpha
mailing list