aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdio/clearerr.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdio/clearerr.c')
-rw-r--r--newlib/libc/stdio/clearerr.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/newlib/libc/stdio/clearerr.c b/newlib/libc/stdio/clearerr.c
index ed4603b..9bf0837 100644
--- a/newlib/libc/stdio/clearerr.c
+++ b/newlib/libc/stdio/clearerr.c
@@ -17,20 +17,31 @@
/*
FUNCTION
-<<clearerr>>---clear file or stream error indicator
+<<clearerr>>, <<clearerr_unlocked>>---clear file or stream error indicator
INDEX
clearerr
+INDEX
+ clearerr_unlocked
ANSI_SYNOPSIS
#include <stdio.h>
void clearerr(FILE *<[fp]>);
+ #define _BSD_SOURCE
+ #include <stdio.h>
+ void clearerr_unlocked(FILE *<[fp]>);
+
TRAD_SYNOPSIS
#include <stdio.h>
void clearerr(<[fp]>)
FILE *<[fp]>;
+ #define _BSD_SOURCE
+ #include <stdio.h>
+ void clearerr_unlocked(<[fp]>)
+ FILE *<[fp]>;
+
DESCRIPTION
The <<stdio>> functions maintain an error indicator with each file
pointer <[fp]>, to record whether any read or write errors have
@@ -42,6 +53,14 @@ Use <<clearerr>> to reset both of these indicators.
See <<ferror>> and <<feof>> to query the two indicators.
+<<clearerr_unlocked>> is a non-thread-safe version of <<clearerr>>.
+<<clearerr_unlocked>> may only safely be used within a scope
+protected by flockfile() (or ftrylockfile()) and funlockfile(). This
+function may safely be used in a multi-threaded program if and only
+if they are called while the invoking thread owns the (FILE *)
+object, as is the case after a successful call to the flockfile() or
+ftrylockfile() functions. If threads are disabled, then
+<<clearerr_unlocked>> is equivalent to <<clearerr>>.
RETURNS
<<clearerr>> does not return a result.
@@ -49,6 +68,8 @@ RETURNS
PORTABILITY
ANSI C requires <<clearerr>>.
+<<clearerr_unlocked>> is a BSD extension also provided by GNU libc.
+
No supporting OS subroutines are required.
*/