]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/lib/libc/stdio/ferror.3
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / lib / libc / stdio / ferror.3
1 .\" Copyright (c) 1990, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" This code is derived from software contributed to Berkeley by
5 .\" Chris Torek and the American National Standards Committee X3,
6 .\" on Information Processing Systems.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\"    must display the following acknowledgement:
18 .\"     This product includes software developed by the University of
19 .\"     California, Berkeley and its contributors.
20 .\" 4. Neither the name of the University nor the names of its contributors
21 .\"    may be used to endorse or promote products derived from this software
22 .\"    without specific prior written permission.
23 .\"
24 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" SUCH DAMAGE.
35 .\"
36 .\"     @(#)ferror.3    8.2 (Berkeley) 4/19/94
37 .\" $FreeBSD$
38 .\"
39 .Dd January 10, 2003
40 .Dt FERROR 3
41 .Os
42 .Sh NAME
43 .Nm clearerr ,
44 .Nm clearerr_unlocked ,
45 .Nm feof ,
46 .Nm feof_unlocked ,
47 .Nm ferror ,
48 .Nm ferror_unlocked ,
49 .Nm fileno ,
50 .Nm fileno_unlocked
51 .Nd check and reset stream status
52 .Sh LIBRARY
53 .Lb libc
54 .Sh SYNOPSIS
55 .In stdio.h
56 .Ft void
57 .Fn clearerr "FILE *stream"
58 .Ft void
59 .Fn clearerr_unlocked "FILE *stream"
60 .Ft int
61 .Fn feof "FILE *stream"
62 .Ft int
63 .Fn feof_unlocked "FILE *stream"
64 .Ft int
65 .Fn ferror "FILE *stream"
66 .Ft int
67 .Fn ferror_unlocked "FILE *stream"
68 .Ft int
69 .Fn fileno "FILE *stream"
70 .Ft int
71 .Fn fileno_unlocked "FILE *stream"
72 .Sh DESCRIPTION
73 The function
74 .Fn clearerr
75 clears the end-of-file and error indicators for the stream pointed
76 to by
77 .Fa stream .
78 .Pp
79 The function
80 .Fn feof
81 tests the end-of-file indicator for the stream pointed to by
82 .Fa stream ,
83 returning non-zero if it is set.
84 The end-of-file indicator can only be cleared by the function
85 .Fn clearerr .
86 .Pp
87 The function
88 .Fn ferror
89 tests the error indicator for the stream pointed to by
90 .Fa stream ,
91 returning non-zero if it is set.
92 The error indicator can only be reset by the
93 .Fn clearerr
94 function.
95 .Pp
96 The function
97 .Fn fileno
98 examines the argument
99 .Fa stream
100 and returns its integer descriptor.
101 .Pp
102 The
103 .Fn clearerr_unlocked ,
104 .Fn feof_unlocked ,
105 .Fn ferror_unlocked ,
106 and
107 .Fn fileno_unlocked
108 functions are equivalent to
109 .Fn clearerr ,
110 .Fn feof ,
111 .Fn ferror ,
112 and
113 .Fn fileno
114 respectively, except that the caller is responsible for locking the stream
115 with
116 .Xr flockfile 3
117 before calling them.
118 These functions may be used to avoid the overhead of locking the stream
119 and to prevent races when multiple threads are operating on the same stream.
120 .Sh ERRORS
121 These functions should not fail and do not set the external
122 variable
123 .Va errno .
124 .Sh SEE ALSO
125 .Xr open 2 ,
126 .Xr fdopen 3 ,
127 .Xr flockfile 3 ,
128 .Xr stdio 3
129 .Sh STANDARDS
130 The functions
131 .Fn clearerr ,
132 .Fn feof ,
133 and
134 .Fn ferror
135 conform to
136 .St -isoC .