9103 opengroup acknowledgement should be properly formatted in man pages
[unleashed.git] / usr / src / man / man3c / __fbufsize.3c
blobe6dc9fe3859ca61bd98f467cbbc575b15b9875c1
1 '\" te
2 .\"  Copyright (c) 1998, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH __FBUFSIZE 3C "Feb 5, 1998"
7 .SH NAME
8 __fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading,
9 __fsetlocking, __fwritable, __fwriting, _flushlbf \- interfaces to stdio FILE
10 structure
11 .SH SYNOPSIS
12 .LP
13 .nf
14 #include <stdio.h>
15 #include <stdio_ext.h>
17 \fBsize_t\fR \fB__fbufsiz\fR(\fBFILE *\fR\fIstream\fR);
18 .fi
20 .LP
21 .nf
22 \fBint\fR \fB__flbf\fR(\fBFILE *\fR\fIstream\fR);
23 .fi
25 .LP
26 .nf
27 \fBsize_t\fR \fB__fpending\fR(\fBFILE *\fR\fIstream\fR);
28 .fi
30 .LP
31 .nf
32 \fBvoid\fR \fB__fpurge\fR(\fBFILE *\fR\fIstream\fR);
33 .fi
35 .LP
36 .nf
37 \fBint\fR \fB__freadable\fR(\fBFILE *\fR\fIstream\fR);
38 .fi
40 .LP
41 .nf
42 \fBint\fR \fB__freading\fR(\fBFILE *\fR\fIstream\fR);
43 .fi
45 .LP
46 .nf
47 \fBint\fR \fB__fsetlocking\fR(\fBFILE *\fR\fIstream\fR, \fBint\fR \fItype\fR);
48 .fi
50 .LP
51 .nf
52 \fBint\fR \fB__fwritable\fR(\fBFILE *\fR\fIstream\fR);
53 .fi
55 .LP
56 .nf
57 \fBint\fR \fB__fwriting\fR(\fBFILE *\fR\fIstream\fR);
58 .fi
60 .LP
61 .nf
62 \fBvoid\fR \fB_flushlbf\fR(\fBvoid\fR);
63 .fi
65 .SH DESCRIPTION
66 .sp
67 .LP
68 These functions provide portable access to the members of the \fBstdio\fR(3C)
69 \fBFILE\fR structure.
70 .sp
71 .LP
72 The \fB__fbufsize()\fR function returns in bytes the size of the buffer
73 currently in use by the given stream.
74 .sp
75 .LP
76 The \fB__flbf()\fR function returns non-zero if the stream is line-buffered.
77 .sp
78 .LP
79 The \fB__fpending\fR function returns in bytes the amount of output pending on
80 a stream.
81 .sp
82 .LP
83 The \fB__fpurge()\fR function discards any pending buffered I/O on the stream.
84 .sp
85 .LP
86 The \fB__freadable()\fR function returns non-zero if it is possible to read
87 from a stream.
88 .sp
89 .LP
90 The \fB__freading()\fR function returns non-zero if the file is open readonly,
91 or if the last operation on the stream was a read operation such as
92 \fBfread\fR(3C) or \fBfgetc\fR(3C). Otherwise it returns 0.
93 .sp
94 .LP
95 The \fB__fsetlocking()\fR function allows the type of locking performed by
96 \fBstdio\fR on a given stream to be controlled by the programmer.
97 .sp
98 .LP
99 If \fItype\fR is \fBFSETLOCKING_INTERNAL\fR, \fBstdio\fR performs implicit
100 locking around every operation on the given stream.  This is the default system
101 behavior on that stream.
104 If \fItype\fR is \fBFSETLOCKING_BYCALLER\fR, \fBstdio\fR assumes that the
105 caller is responsible for maintaining the integrity of the stream in the face
106 of access by multiple threads.  If there is only one thread accessing the
107 stream, nothing further needs to be done.  If multiple threads are accessing
108 the stream, then the caller can use the \fBflockfile()\fR, \fBfunlockfile()\fR,
109 and \fBftrylockfile()\fR functions described on the \fBflockfile\fR(3C) manual
110 page to provide the appropriate locking. In both this and the case where
111 \fItype\fR is \fBFSETLOCKING_INTERNAL\fR, \fB__fsetlocking()\fR returns the
112 previous state of the stream.
115 If \fItype\fR is \fBFSETLOCKING_QUERY\fR, \fB__fsetlocking()\fR returns the
116 current state of the stream without changing it.
119 The \fB__fwritable()\fR function returns non-zero if it is possible to write on
120 a stream.
123 The \fB__fwriting()\fR function returns non-zero if the file is open write-only
124 or append-only, or if the last operation on the stream was a write operation
125 such as \fBfwrite\fR(3C) or \fBfputc\fR(3C). Otherwise it returns 0.
128 The \fB_flushlbf()\fR function flushes all line-buffered files.  It is used
129 when reading from a line-buffered file.
130 .SH USAGE
133 Although the contents of the \fBstdio FILE\fR structure have always been
134 private to the \fBstdio\fR implementation, some applications have needed to
135 obtain information about a \fBstdio\fR stream that was not accessible through a
136 supported interface. These applications have resorted to accessing fields of
137 the \fBFILE\fR structure directly, rendering them possibly non-portable to new
138 implementations of \fBstdio\fR, or more likely, preventing enhancements to
139 \fBstdio\fR that would cause those applications to break.
142 In the 64-bit environment, the \fBFILE\fR structure is opaque.  The functions
143 described here are provided as a means of obtaining the information that up to
144 now has been retrieved directly from the \fBFILE\fR structure.  Because they
145 are based on the needs of existing applications (such as \fBmh\fR and
146 \fBemacs\fR), they may be extended as other programs are ported.  Although they
147 may still be non-portable to other operating systems, they will be compatible
148 from each Solaris release to the next.  Interfaces that are more portable are
149 under development.
150 .SH ATTRIBUTES
153 See \fBattributes\fR(5) for descriptions of the following attributes:
158 box;
159 c | c
160 l | l .
161 ATTRIBUTE TYPE  ATTRIBUTE VALUE
163 MT-Level        T{
164 \fB__fsetlocking()\fR is Unsafe; all others are MT-Safe
167 Interface Stability     Evolving
170 .SH SEE ALSO
173 \fBfgetc\fR(3C), \fBflockfile\fR(3C), \fBfputc\fR(3C), \fBfread\fR(3C),
174 \fBfwrite\fR(3C), \fBstdio\fR(3C), \fBattributes\fR(5)