| 1 | #ifndef STDIO_EXT_H_INCLUDED |
| 2 | #define STDIO_EXT_H_INCLUDED |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | /* http://linux.die.net/man/3/__fsetlocking */ |
| 7 | #define FSETLOCKING_INTERNAL 1 |
| 8 | #define FSETLOCKING_BYCALLER 2 |
| 9 | #define FSETLOCKING_QUERY 3 |
| 10 | static inline int __fsetlocking(FILE *stream, int type) |
| 11 | { |
| 12 | (void) stream; |
| 13 | (void) type; |
| 14 | return FSETLOCKING_INTERNAL; |
| 15 | } |
| 16 | |
| 17 | static inline int feof_unlocked(FILE *stream) |
| 18 | { |
| 19 | return feof(stream); |
| 20 | } |
| 21 | |
| 22 | static inline int ferror_unlocked(FILE *stream) |
| 23 | { |
| 24 | return ferror(stream); |
| 25 | } |
| 26 | |
| 27 | static inline int fputs_unlocked(const char *s, FILE *stream) |
| 28 | { |
| 29 | return fputs(s, stream); |
| 30 | } |
| 31 | |
| 32 | static inline int fputc_unlocked(int c, FILE *stream) |
| 33 | { |
| 34 | return fputc(c, stream); |
| 35 | } |
| 36 | |
| 37 | static inline size_t fread_unlocked(void *data, size_t size, size_t count, FILE *stream) |
| 38 | { |
| 39 | return fread(data, size, count, stream); |
| 40 | } |
| 41 | |
| 42 | static inline size_t fwrite_unlocked(const void *data, size_t size, size_t count, FILE *stream) |
| 43 | { |
| 44 | return fwrite(data, size, count, stream); |
| 45 | } |
| 46 | |
| 47 | #endif |