Last change
on this file was 444, checked in by coas-nagasima, 4 years ago |
muslのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
788 bytes
|
Rev | Line | |
---|
[444] | 1 | #include "stdio_impl.h"
|
---|
| 2 |
|
---|
| 3 | /* stdout.c will override this if linked */
|
---|
| 4 | static FILE *volatile dummy = 0;
|
---|
| 5 | weak_alias(dummy, __stdout_used);
|
---|
| 6 |
|
---|
| 7 | int fflush(FILE *f)
|
---|
| 8 | {
|
---|
| 9 | if (!f) {
|
---|
| 10 | int r = __stdout_used ? fflush(__stdout_used) : 0;
|
---|
| 11 |
|
---|
| 12 | for (f=*__ofl_lock(); f; f=f->next) {
|
---|
| 13 | FLOCK(f);
|
---|
| 14 | if (f->wpos > f->wbase) r |= fflush(f);
|
---|
| 15 | FUNLOCK(f);
|
---|
| 16 | }
|
---|
| 17 | __ofl_unlock();
|
---|
| 18 |
|
---|
| 19 | return r;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | FLOCK(f);
|
---|
| 23 |
|
---|
| 24 | /* If writing, flush output */
|
---|
| 25 | if (f->wpos > f->wbase) {
|
---|
| 26 | f->write(f, 0, 0);
|
---|
| 27 | if (!f->wpos) {
|
---|
| 28 | FUNLOCK(f);
|
---|
| 29 | return EOF;
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | /* If reading, sync position, per POSIX */
|
---|
| 34 | if (f->rpos < f->rend) f->seek(f, f->rpos-f->rend, SEEK_CUR);
|
---|
| 35 |
|
---|
| 36 | /* Clear read and write modes */
|
---|
| 37 | f->wpos = f->wbase = f->wend = 0;
|
---|
| 38 | f->rpos = f->rend = 0;
|
---|
| 39 |
|
---|
| 40 | FUNLOCK(f);
|
---|
| 41 | return 0;
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | weak_alias(fflush, fflush_unlocked);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.