blob: 5be9b553e421b86dbf13db682b1f16982a62f4a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
#include "_stdio.h"
libc_hidden_proto(fclose)
/* NOTE: GLIBC difference!!! -- fcloseall
* According to the info pages, glibc actually fclose()s all open files.
* Apparently, glibc's new version only fflush()s and unbuffers all
* writing streams to cope with unordered destruction of c++ static
* objects.
*/
int fcloseall (void)
{
#ifdef __STDIO_HAS_OPENLIST
int retval = 0;
__STDIO_THREADLOCK_OPENLIST;
while (_stdio_openlist) {
if (fclose(_stdio_openlist)) {
retval = EOF;
}
}
__STDIO_THREADUNLOCK_OPENLIST;
return retval;
#else
#warning Always fails in this configuration because no open file list.
return EOF;
#endif
}
|