From 7a7e4d4d95e878c62ea5b642da864018b50aae21 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 17 Jan 2014 10:55:32 +0000 Subject: Introduce _STDIO_BSD_SEMANTICS flag to switch fclose/exit file flushing semantics from POSIX to BSD. * libc/stdio/fclose.c (_fclose_r): Conditionalize file flushing on _STDIO_BSD_SEMANTICS. Call __sflush_r rather than _fflush_r. Add comment. * libc/stdio/fflush.c (__sflushw_r): New function, only available if _STDIO_BSD_SEMANTICS is defined. * libc/stdio/findfp.c (_cleanup_r): Call _fwalk_reent rather than _fwalk. Conditionalize cleanup function call on _STDIO_BSD_SEMANTICS. Add comments. Add FIXME. * libc/stdio/local.h (__sflushw_r): Declare if _STDIO_BSD_SEMANTICS is defined. --- newlib/libc/stdio/local.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'newlib/libc/stdio/local.h') diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 0bd47a46a..ad477485b 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -147,6 +147,9 @@ int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, extern FILE *_EXFUN(__sfp,(struct _reent *)); extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); +#ifdef _STDIO_BSD_SEMANTICS +extern int _EXFUN(__sflushw_r,(struct _reent *,FILE *)); +#endif extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(struct _reent *, void *, char *, _READ_WRITE_BUFSIZE_TYPE)); -- cgit v1.2.3