summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2003-01-10 06:22:28 +0000
committertjr <tjr@FreeBSD.org>2003-01-10 06:22:28 +0000
commit5e6eecbdf0598d50a80766d698324e918cb3cb7c (patch)
treebf0650d6b7ed7d7626d9426bd71cf682ea8ea53f /lib
parentd8624a90a21f889b227fd945069f7b0cc9bf14b9 (diff)
downloadFreeBSD-src-5e6eecbdf0598d50a80766d698324e918cb3cb7c.zip
FreeBSD-src-5e6eecbdf0598d50a80766d698324e918cb3cb7c.tar.gz
Document clearerr_unlocked(), feof_unlocked(), ferror_unlocked()
and fileno_unlocked().
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/Makefile.inc5
-rw-r--r--lib/libc/stdio/ferror.336
2 files changed, 38 insertions, 3 deletions
diff --git a/lib/libc/stdio/Makefile.inc b/lib/libc/stdio/Makefile.inc
index 2b80ef7..6b86b4c 100644
--- a/lib/libc/stdio/Makefile.inc
+++ b/lib/libc/stdio/Makefile.inc
@@ -28,7 +28,10 @@ MAN+= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetws.3 flockfile.3 \
printf.3 putc.3 putwc.3 remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 \
ungetc.3 ungetwc.3 wprintf.3 wscanf.3
-MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
+MLINKS+=ferror.3 ferror_unlocked.3 \
+ ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \
+ ferror.3 feof.3 ferror.3 feof_unlocked.3 \
+ ferror.3 fileno.3 ferror.3 fileno_unlocked.3
MLINKS+=fflush.3 fpurge.3
MLINKS+=fgets.3 gets.3
MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
diff --git a/lib/libc/stdio/ferror.3 b/lib/libc/stdio/ferror.3
index b9968f1..cb170a4 100644
--- a/lib/libc/stdio/ferror.3
+++ b/lib/libc/stdio/ferror.3
@@ -36,14 +36,18 @@
.\" @(#)ferror.3 8.2 (Berkeley) 4/19/94
.\" $FreeBSD$
.\"
-.Dd April 19, 1994
+.Dd January 10, 2003
.Dt FERROR 3
.Os
.Sh NAME
.Nm clearerr ,
+.Nm clearerr_unlocked ,
.Nm feof ,
+.Nm feof_unlocked ,
.Nm ferror ,
-.Nm fileno
+.Nm ferror_unlocked ,
+.Nm fileno ,
+.Nm fileno_unlocked
.Nd check and reset stream status
.Sh LIBRARY
.Lb libc
@@ -51,12 +55,20 @@
.In stdio.h
.Ft void
.Fn clearerr "FILE *stream"
+.Ft void
+.Fn clearerr_unlocked "FILE *stream"
.Ft int
.Fn feof "FILE *stream"
.Ft int
+.Fn feof_unlocked "FILE *stream"
+.Ft int
.Fn ferror "FILE *stream"
.Ft int
+.Fn ferror_unlocked "FILE *stream"
+.Ft int
.Fn fileno "FILE *stream"
+.Ft int
+.Fn fileno_unlocked "FILE *stream"
.Sh DESCRIPTION
The function
.Fn clearerr
@@ -86,6 +98,25 @@ The function
examines the argument
.Fa stream
and returns its integer descriptor.
+.Pp
+The
+.Fn clearerr_unlocked ,
+.Fn feof_unlocked ,
+.Fn ferror_unlocked ,
+and
+.Fn fileno_unlocked
+functions are equivalent to
+.Fn clearerr ,
+.Fn feof ,
+.Fn ferror ,
+and
+.Fn fileno
+respectively, except that the caller is responsible for locking the stream
+with
+.Fn flockfile
+before calling them.
+These functions may be used to avoid the overhead of locking the stream
+and to prevent races when multiple threads are operating on the same stream.
.Sh ERRORS
These functions should not fail and do not set the external
variable
@@ -93,6 +124,7 @@ variable
.Sh SEE ALSO
.Xr open 2 ,
.Xr fdopen 3 ,
+.Xr flockfile 3 ,
.Xr stdio 3
.Sh STANDARDS
The functions
OpenPOWER on IntegriCloud