1 /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
3 * GNU Library General Public License (LGPL) version 2 or later.
5 * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
14 /* NOTE: GLIBC difference!!! -- fcloseall
15 * According to the info pages, glibc actually fclose()s all open files.
16 * Apparently, glibc's new version only fflush()s and unbuffers all
17 * writing streams to cope with unordered destruction of c++ static
23 #ifdef __STDIO_HAS_OPENLIST
28 __STDIO_OPENLIST_INC_USE
;
30 __STDIO_THREADLOCK_OPENLIST_ADD
;
32 __STDIO_THREADUNLOCK_OPENLIST_ADD
;
35 FILE *n
= f
->__nextopen
;
36 __STDIO_AUTO_THREADLOCK_VAR
;
38 __STDIO_AUTO_THREADLOCK(f
);
39 /* Only call fclose on the stream if it is not already closed. */
40 if ((f
->__modeflags
& (__FLAG_READONLY
|__FLAG_WRITEONLY
))
41 != (__FLAG_READONLY
|__FLAG_WRITEONLY
)
47 __STDIO_AUTO_THREADUNLOCK(f
);
52 __STDIO_OPENLIST_DEC_USE
;
58 #warning Always fails in this configuration because no open file list.