setbuf.3: stdio buffers are allocated by mmap() not malloc()
PATCH 1/1 setbuf.3: stdio buffers are allocated by mmap() not malloc()
Hello,
This patch applies to man-pages 3.33. setbuf.3 claims that stdio buffers are allocated by malloc(). Strangely this is not the case; they are allocated using mmap() by way of the macro ALLOC_BUF() in glibc-2.13.90/libio/libioP.h:803.
Best,
John
---
man3/setbuf.3 +1 -1
@@ -83,7 +83,7 @@ may be used to force the block out early. .BR fclose (3).) Normally all files are block buffered. When the first I/O operation occurs on a file, -.BR malloc (3) +.BR mmap (2) is called, and a buffer is obtained. If a stream refers to a terminal (as .I stdout
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
A little peer review before the maintainer gets a chance to reply...
Quoted 5 lines · John Hammond
---
man3/setbuf.3 +0
-0@@ -83,7 +83,7 @@ may be used to force the block out early. .BR fclose (3).)
Quoted 7 lines
Normally all files are block buffered.
When the first I/O operation occurs on a file,
-.BR malloc (3)
+.BR mmap (2)
is called, and a buffer is obtained.
If a stream refers to a terminal (as
.I stdout
Are you sure this applies to older glibc versions as well? When behavior of a glibc function has changed in time, usually (or I should probably rephrase this as "in the most fortunate cases..." :), but let's not be that pessimistic ) the man page specifies that; if it's the case here, it might be good to say: "mmap is used since glibc x.y, malloc was used before".
Thanks,
Stefan.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): BANLkTin6ogPpQFDAkezygqAVtcfRZnoMMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Hi Stefan,
Quoted 1 line
A little peer review before the maintainer gets a chance to reply...
Of course.
Quoted 12 lines · John Hammond
Quoted 11 lines
---
man3/setbuf.3 +1
-1@@ -83,7 +83,7 @@ may be used to force the block out early. .BR fclose (3).) Normally all files are block buffered. When the first I/O operation occurs on a file, -.BR malloc (3) +.BR mmap (2) is called, and a buffer is obtained. If a stream refers to a terminal (as
Quoted 8 lines
man3/setbuf.3 may be used to force the block out early. · line 89
Quoted 1 line
man3/setbuf.3 +0
-0.I stdoutAre you sure this applies to older glibc versions as well? When behavior of a glibc function has changed in time, usually (or I should probably rephrase this as "in the most fortunate cases..." :), but let's not be that pessimistic ) the man page specifies that; if it's the case here, it might be good to say: "mmap is used since glibc x.y, malloc was used before".
malloc() was used in 1.09, and mmap() in 2.0.1. I've also noticed this behavior other versions, including 2.3.4 and 2.13 (current). But I haven't checked all intermediate versions. See also
http://sources.redhat.com/ml/libc-alpha/2006-11/msg00061.html for some fruitless discussion of this issue.
Best,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html