[PATCH] manual: Describe glibc's limited linked stream handling

Florian Weimer fweimer@redhat.com
Wed Jan 29 10:05:34 GMT 2025


The implementation was changed in commit 3d759cb8d32614667f58688899f,
but the manual was not updated.

---
 manual/stdio.texi | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/manual/stdio.texi b/manual/stdio.texi
index 01b9f478dd..0f0838c70a 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -4805,8 +4805,20 @@ When the program terminates by calling @code{exit}.
 When a newline is written, if the stream is line buffered.
 
 @item
-Whenever an input operation on @emph{any} stream actually reads data
-from its file.
+@c See the stdout reference in _IO_new_file_underflow.
+When input occurs on a line-buffered or unbuffered stream that is the
+original @code{stdin} stream at program start, or has been created using
+@code{fopen} or @code{fdopen}, a line-buffered @code{stdout} stream is
+flushed if it is the original @code{stdout} stream or has been created
+using @code{fopen} or @code{fdopen}.  (The @code{fopen64} function
+counts as @code{fopen} in this regard.)
+
+This exact behavior is specific to @theglibc{}.  According to some
+interpretations of POSIX, such flushing is requiring for all buffered
+output streams, not just @code{stdout}.  Other C libraries may not
+implement such linked stream handling at all.  A future version of
+@theglibc{} may remove the limited linked stream handling described
+above.
 @end itemize
 
 If you want to flush the buffered output at another time, call

base-commit: 5429bae110e2f094482b3f7974b3ce9b4bfdab57



More information about the Libc-alpha mailing list