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 #ifdef __UCLIBC_MJN3_ONLY__
31 #warning REMINDER: should probably have a get_head() operation
33 __STDIO_THREADLOCK_OPENLIST_ADD
;
35 __STDIO_THREADUNLOCK_OPENLIST_ADD
;
38 #ifdef __UCLIBC_MJN3_ONLY__
39 #warning REMINDER: should probably have a get_next() operation
41 FILE *n
= f
->__nextopen
;
42 __STDIO_AUTO_THREADLOCK_VAR
;
44 __STDIO_AUTO_THREADLOCK(f
);
45 /* Only call fclose on the stream if it is not already closed. */
46 if ((f
->__modeflags
& (__FLAG_READONLY
|__FLAG_WRITEONLY
))
47 != (__FLAG_READONLY
|__FLAG_WRITEONLY
)
53 __STDIO_AUTO_THREADUNLOCK(f
);
58 __STDIO_OPENLIST_DEC_USE
;
64 #warning Always fails in this configuration because no open file list.