1 #include "stdio_impl.h"
3 /* stdout.c will override this if linked */
4 static FILE *volatile dummy
= 0;
5 weak_alias(dummy
, __stdout_used
);
10 int r
= __stdout_used
? fflush(__stdout_used
) : 0;
12 for (f
=*__ofl_lock(); f
; f
=f
->next
) {
14 if (f
->wpos
!= f
->wbase
) r
|= fflush(f
);
24 /* If writing, flush output */
25 if (f
->wpos
!= f
->wbase
) {
33 /* If reading, sync position, per POSIX */
34 if (f
->rpos
!= f
->rend
) f
->seek(f
, f
->rpos
-f
->rend
, SEEK_CUR
);
36 /* Clear read and write modes */
37 f
->wpos
= f
->wbase
= f
->wend
= 0;
38 f
->rpos
= f
->rend
= 0;
44 weak_alias(fflush
, fflush_unlocked
);