.\" 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 2013-06-21 "" "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 );
-
+.PP
.BI "int feof(FILE *" stream );
-
+.PP
.BI "int ferror(FILE *" stream );
-
+.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\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
+_POSIX_C_SOURCE
.SH DESCRIPTION
The function
.BR clearerr ()
.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 nonlocking counterparts, see
.BR unlocked_stdio (3).
to
.BR EBADF .)
.SH ATTRIBUTES
-.SS Multithreading (see pthreads(7))
-The
+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 (),
-and
.BR fileno ()
-functions are thread-safe.
+T} Thread safety MT-Safe
+.TE
.SH CONFORMING TO
The functions
.BR clearerr (),
.BR feof (),
and
.BR ferror ()
-conform to C89 and C99.
+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),