preserve errno across free
[musl.git] / src / stdio / ext.c
blob1fd9549019330f5944a83c4ac7a70c2bce93daab
1 #define _GNU_SOURCE
2 #include "stdio_impl.h"
3 #include <stdio_ext.h>
5 void _flushlbf(void)
7 fflush(0);
10 int __fsetlocking(FILE *f, int type)
12 return 0;
15 int __fwriting(FILE *f)
17 return (f->flags & F_NORD) || f->wend;
20 int __freading(FILE *f)
22 return (f->flags & F_NOWR) || f->rend;
25 int __freadable(FILE *f)
27 return !(f->flags & F_NORD);
30 int __fwritable(FILE *f)
32 return !(f->flags & F_NOWR);
35 int __flbf(FILE *f)
37 return f->lbf >= 0;
40 size_t __fbufsize(FILE *f)
42 return f->buf_size;
45 size_t __fpending(FILE *f)
47 return f->wend ? f->wpos - f->wbase : 0;
50 int __fpurge(FILE *f)
52 f->wpos = f->wbase = f->wend = 0;
53 f->rpos = f->rend = 0;
54 return 0;
57 weak_alias(__fpurge, fpurge);