libio: Deprecate the fcloseall function (bug 28099)
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
redhat-pt-bot/TryBot-still_applies |
warning
|
Patch no longer applies to master
|
Commit Message
---
NEWS | 4 ++++
libio/stdio.h | 3 ++-
manual/stdio.texi | 26 --------------------------
3 files changed, 6 insertions(+), 27 deletions(-)
base-commit: a46956e65d037358161e7512a9f0fd408ea1333a
@@ -21,6 +21,10 @@ Deprecated and removed features, and other changes affecting compatibility:
corresponds to the AT_PLATFORM system name, or employs the legacy AT_HWCAP
search mechanism, which was deprecated in version 2.33.
+* The fcloseall function has been deprecated and will be removed in a
+ future release. It does not behave as documented, and closing the
+ standard streams is unsafe.
+
Changes to build and runtime requirements:
[Add changes to build and runtime requirements here]
@@ -246,7 +246,8 @@ extern int fflush_unlocked (FILE *__stream);
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
-extern int fcloseall (void);
+extern int fcloseall (void) __attribute_deprecated_msg__
+ ("Closing all streams is unsafe; consider using fflush (NULL) instead");
#endif
@@ -441,32 +441,6 @@ you are using NFS.
The function @code{fclose} is declared in @file{stdio.h}.
@end deftypefun
-To close all streams currently available @theglibc{} provides
-another function.
-
-@deftypefun int fcloseall (void)
-@standards{GNU, stdio.h}
-@safety{@prelim{}@mtunsafe{@mtasurace{:streams}}@asunsafe{}@acsafe{}}
-@c Like fclose, using any previously-opened streams after fcloseall is
-@c undefined. However, the implementation of fcloseall isn't equivalent
-@c to calling fclose for all streams: it just flushes and unbuffers all
-@c streams, without any locking. It's the flushing without locking that
-@c makes it unsafe.
-This function causes all open streams of the process to be closed and
-the connections to corresponding files to be broken. All buffered data
-is written and any buffered input is discarded. The @code{fcloseall}
-function returns a value of @code{0} if all the files were closed
-successfully, and @code{EOF} if an error was detected.
-
-This function should be used only in special situations, e.g., when an
-error occurred and the program must be aborted. Normally each single
-stream should be closed separately so that problems with individual
-streams can be identified. It is also problematic since the standard
-streams (@pxref{Standard Streams}) will also be closed.
-
-The function @code{fcloseall} is declared in @file{stdio.h}.
-@end deftypefun
-
If the @code{main} function to your program returns, or if you call the
@code{exit} function (@pxref{Normal Termination}), all open streams are
automatically closed properly. If your program terminates in any other