OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / stdio_ext.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH STDIO_EXT 3 2001-12-16 "" "Linux Programmer's Manual"
24 .SH NAME
25 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
26 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
27 interfaces to stdio FILE structure
28 .SH SYNOPSIS
29 .B #include <stdio.h>
30 .br
31 .B #include <stdio_ext.h>
32 .sp
33 .BI "size_t __fbufsize(FILE *" stream );
34 .br
35 .BI "size_t __fpending(FILE *" stream );
36 .br
37 .BI "int __flbf(FILE *" stream );
38 .br
39 .BI "int __freadable(FILE *" stream );
40 .br
41 .BI "int __fwritable(FILE *" stream );
42 .br
43 .BI "int __freading(FILE *" stream );
44 .br
45 .BI "int __fwriting(FILE *" stream );
46 .br
47 .BI "int __fsetlocking(FILE *" stream ", int " type );
48 .br
49 .B "void _flushlbf(void);"
50 .br
51 .BI "void __fpurge(FILE *" stream );
52 .SH DESCRIPTION
53 Solaris introduced routines to allow portable access to the
54 internals of the
55 .I FILE
56 structure, and glibc also implemented these.
57 .LP
58 The
59 .BR __fbufsize ()
60 function returns the size of the buffer currently used
61 by the given stream.
62 .LP
63 The
64 .BR __fpending ()
65 function returns the number of bytes in the output buffer.
66 For wide-oriented streams the unit is wide characters.
67 This function is undefined on buffers in reading mode,
68 or opened read-only.
69 .LP
70 The
71 .BR __flbf ()
72 function returns a nonzero value if the stream is line-buffered,
73 and zero otherwise.
74 .LP
75 The
76 .BR __freadable ()
77 function returns a nonzero value if the stream allows reading,
78 and zero otherwise.
79 .LP
80 The
81 .BR __fwritable ()
82 function returns a nonzero value if the stream allows writing,
83 and zero otherwise.
84 .LP
85 The
86 .BR __freading ()
87 function returns a nonzero value if the stream is read-only, or
88 if the last operation on the stream was a read operation,
89 and zero otherwise.
90 .LP
91 The
92 .BR __fwriting ()
93 function returns a nonzero value if the stream is write-only (or
94 append-only), or if the last operation on the stream was a write
95 operation, and zero otherwise.
96 .LP
97 The
98 .BR __fsetlocking ()
99 function can be used to select the desired type of locking on the stream.
100 It returns the current type.
101 The
102 .I type
103 argument can take the following three values:
104 .TP
105 .B FSETLOCKING_INTERNAL
106 Perform implicit locking around every operation on the given stream
107 (except for the *_unlocked ones).
108 This is the default.
109 .TP
110 .B FSETLOCKING_BYCALLER
111 The caller will take care of the locking (possibly using
112 .BR flockfile (3)
113 in case there is more than one thread), and the stdio routines
114 will not do locking until the state is reset to
115 .BR FSETLOCKING_INTERNAL .
116 .TP
117 .B FSETLOCKING_QUERY
118 Don't change the type of locking.
119 (Only return it.)
120 .LP
121 The
122 .BR _flushlbf ()
123 function flushes all line-buffered streams.
124 (Presumably so that
125 output to a terminal is forced out, say before reading keyboard input.)
126 .LP
127 The
128 .BR __fpurge ()
129 function discards the contents of the stream's buffer.
130 .SH "SEE ALSO"
131 .BR flockfile (3),
132 .BR fpurge (3)