]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/ferror.3
proc.5: Note kernel version for /proc/PID/smaps VmFlags "wf" flag
[thirdparty/man-pages.git] / man3 / ferror.3
index 43443095f6c1267987500666c3839d61cc688b42..d866edcbad4ab869faa7d3aa9ddca5dd290ec4fc 100644 (file)
@@ -5,6 +5,7 @@
 .\" Chris Torek and the American National Standards Committee X3,
 .\" on Information Processing Systems.
 .\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
@@ -32,6 +33,7 @@
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
+.\" %%%LICENSE_END
 .\"
 .\"     @(#)ferror.3   6.8 (Berkeley) 6/29/91
 .\"
 .\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
 .\" Added remark on EBADF for fileno, aeb, 2001-03-22
 .\"
-.TH FERROR 3  2007-07-26 "" "Linux Programmer's Manual"
+.TH FERROR 3  2019-03-06 "" "Linux Programmer's Manual"
 .SH NAME
 clearerr, feof, ferror, fileno \- check and reset stream status
 .SH SYNOPSIS
 .B #include <stdio.h>
-.sp
+.PP
 .BI "void clearerr(FILE *" stream );
-.br
+.PP
 .BI "int feof(FILE *" stream );
-.br
+.PP
 .BI "int ferror(FILE *" stream );
-.br
+.PP
 .BI "int fileno(FILE *" stream );
-.sp
+.PP
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .in
-.sp
+.PP
 .BR fileno ():
-_POSIX_C_SOURCE || _XOPEN_SOURCE
+_POSIX_C_SOURCE
 .SH DESCRIPTION
 The function
 .BR clearerr ()
@@ -70,17 +72,16 @@ The function
 .BR feof ()
 tests the end-of-file indicator for the stream pointed to by
 .IR stream ,
-returning non-zero if it is set.
-The end-of-file indicator can only be
-cleared by the function
+returning nonzero if it is set.
+The end-of-file indicator can be cleared only by the function
 .BR clearerr ().
 .PP
 The function
 .BR ferror ()
 tests the error indicator for the stream pointed to by
 .IR stream ,
-returning non-zero if it is set.
-The error indicator can only be reset by the
+returning nonzero if it is set.
+The error indicator can be reset only by the
 .BR clearerr ()
 function.
 .PP
@@ -88,9 +89,17 @@ The function
 .BR fileno ()
 examines the argument
 .I stream
-and returns its integer descriptor.
+and returns the integer file descriptor used to implement this stream.
+The file descriptor is still owned by
+.I stream
+and will be closed when
+.BR fclose (3)
+is called.
+Duplicate the file descriptor with
+.BR dup (2)
+before passing it to code that might close it.
 .PP
-For non-locking counterparts, see
+For nonlocking counterparts, see
 .BR unlocked_stdio (3).
 .SH ERRORS
 These functions should not fail and do not set the external variable
@@ -102,14 +111,34 @@ return \-1 and set
 .I errno
 to
 .BR EBADF .)
-.SH "CONFORMING TO"
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbw19 lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR clearerr (),
+.BR feof (),
+.br
+.BR ferror (),
+.BR fileno ()
+T}     Thread safety   MT-Safe
+.TE
+.SH CONFORMING TO
 The functions
 .BR clearerr (),
 .BR feof (),
 and
 .BR ferror ()
-conform to C89 and C99.
-.SH "SEE ALSO"
+conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
+.PP
+The function
+.BR fileno ()
+conforms to POSIX.1-2001 and POSIX.1-2008.
+.SH SEE ALSO
 .BR open (2),
 .BR fdopen (3),
 .BR stdio (3),