source: azure_iot_hub/trunk/musl-1.1.18/src/stdio/__stdio_exit.c@ 389

Last change on this file since 389 was 389, checked in by coas-nagasima, 5 years ago

ビルドが通るよう更新

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 731 bytes
Line 
1#include "stdio_impl.h"
2
3#ifndef __c2__
4static FILE *volatile dummy_file = 0;
5weak_alias(dummy_file, __stdin_used);
6weak_alias(dummy_file, __stdout_used);
7weak_alias(dummy_file, __stderr_used);
8#else
9extern FILE *volatile __stdin_used;
10extern FILE *volatile __stdout_used;
11#endif
12
13static void close_file(FILE *f)
14{
15 if (!f) return;
16 FFINALLOCK(f);
17 if (f->wpos > f->wbase) f->write(f, 0, 0);
18 if (f->rpos < f->rend) f->seek(f, f->rpos-f->rend, SEEK_CUR);
19}
20
21void __stdio_exit(void)
22{
23 FILE *f;
24 for (f=*__ofl_lock(); f; f=f->next) close_file(f);
25 close_file(__stdin_used);
26 close_file(__stdout_used);
27}
28
29#ifndef __c2__
30weak_alias(__stdio_exit, __stdio_exit_needed);
31#else
32void __stdio_exit_needed(void)
33{
34 __stdio_exit();
35}
36#endif
Note: See TracBrowser for help on using the repository browser.