1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
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.
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.
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
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI all rights reserved.
24 .\" Translated Nov 2 2002 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
25 .TH STDIO_EXT 3 2001-12-16 "" "Linux Programmer's Manual"
28 .\"O __fbufsize, __flbf, __fpending, __fpurge, __freadable,
29 .\"O __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
30 .\"O interfaces to stdio FILE structure
31 __fbufsize, __flbf, __fpending, __fpurge, __freadable,
32 __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
33 ɸ½àÆþ½ÐÎÏ¥Õ¥¡¥¤¥ë¹½Â¤ÂΤؤΥ¤¥ó¥¿¥Õ¥§¡¼¥¹
38 .B #include <stdio_ext.h>
40 .BI "size_t __fbufsize(FILE *" stream );
42 .BI "size_t __fpending(FILE *" stream );
44 .BI "int __flbf(FILE *" stream );
46 .BI "int __freadable(FILE *" stream );
48 .BI "int __fwritable(FILE *" stream );
50 .BI "int __freading(FILE *" stream );
52 .BI "int __fwriting(FILE *" stream );
54 .BI "int __fsetlocking(FILE *" stream ", int " type );
56 .B "void _flushlbf(void);"
58 .BI "void __fpurge(FILE *" stream );
61 .\"O Solaris introduced routines to allow portable access to the
64 .\"O structure, and glibc also implemented these.
67 ¹½Â¤ÂΤÎÆâÉô¤Ø¥Ý¡¼¥¿¥Ö¥ë¤Ê¤«¤¿¤Á¤Ç
68 ¥¢¥¯¥»¥¹¤Ç¤¤ë¼êÃʤ¬Æ³Æþ¤µ¤ì¤Æ¤ª¤ê¡¢¤³¤ì¤é¤Ï glibc ¤Ç¤â¼ÂÁõ¤µ¤ì¤Æ¤¤¤ë¡£
71 .\"O .BR __fbufsize ()
72 .\"O function returns the size of the buffer currently used
73 .\"O by the given stream.
75 ´Ø¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿¥¹¥È¥ê¡¼¥à¤¬»ÈÍѤ·¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡¡¦¥µ¥¤¥º¤òÊÖ¤¹¡£
78 .\"O .BR __fpending ()
79 .\"O function returns the number of bytes in the output buffer.
80 .\"O For wide-oriented streams the unit is wide characters.
81 .\"O This function is undefined on buffers in reading mode,
82 .\"O or opened read-only.
84 ´Ø¿ô¤Ï¡¢½ÐÎϥХåե¡¤ËÆþ¤Ã¤Æ¤¤¤ë¥Ç¡¼¥¿¤Î¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
85 ¥ï¥¤¥É¥¥ã¥é¥¯¥¿¤ò°·¤¦¥¹¥È¥ê¡¼¥à¤Î¾ì¹ç¡¢¥ï¥¤¥É¥¥ã¥é¥¯¥¿Ã±°Ì¤Ç·×»»¤µ¤ì¤ë¡£
86 ¥Ð¥Ã¥Õ¥¡¤¬Æɤ߽Ф·¥â¡¼¥É¤Î¾ì¹ç¤äÆɤ߽Ф·ÀìÍѤdz«¤«¤ì¤Æ¤¤¤ë¾ì¹ç¤Î
87 ¤³¤Î´Ø¿ô¤Î¿¶Éñ¤¤¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£
91 .\"O function returns a nonzero value if the stream is line-buffered,
92 .\"O and zero otherwise.
94 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤¬¥é¥¤¥ó¥Ð¥Ã¥Õ¥¡¤Î¾ì¹ç¤Ï 0 °Ê³°¤ò¡¢
95 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
98 .\"O .BR __freadable ()
99 .\"O function returns a nonzero value if the stream allows reading,
100 .\"O and zero otherwise.
102 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤¬Æɤ߽Ф·²Äǽ¤Ê¾ì¹ç¤Ï 0 °Ê³°¤ò¡¢
103 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
106 .\"O .BR __fwritable ()
107 .\"O function returns a nonzero value if the stream allows writing,
108 .\"O and zero otherwise.
110 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤¬½ñ¤¹þ¤ß²Äǽ¤Ê¾ì¹ç¤Ï 0 °Ê³°¤ò¡¢
111 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
114 .\"O .BR __freading ()
115 .\"O function returns a nonzero value if the stream is read-only, or
116 .\"O if the last operation on the stream was a read operation,
117 .\"O and zero otherwise.
119 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤¬Æɤ߽Ф·ÀìÍѤξì¹ç¡¢¤Þ¤¿¤Ï¥¹¥È¥ê¡¼¥à¤ËÂФ¹¤ëľÁ°¤ÎÁàºî¤¬
120 Æɤ߽Ф·Áàºî¤Ç¤¢¤Ã¤¿¾ì¹ç¤Ï 0 °Ê³°¤òÊÖ¤·¡¢¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
123 .\"O .BR __fwriting ()
124 .\"O function returns a nonzero value if the stream is write-only (or
125 .\"O append-only), or if the last operation on the stream was a write
126 .\"O operation, and zero otherwise.
128 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤¬½ñ¤¹þ¤ßÀìÍÑ(¤â¤·¤¯¤ÏÄɲÃÀìÍÑ)¤Î¾ì¹ç¡¢
129 ¤Þ¤¿¤Ï¥¹¥È¥ê¡¼¥à¤ËÂФ¹¤ëľÁ°¤ÎÁàºî¤¬½ñ¤¹þ¤ßÁàºî¤Ç¤¢¤Ã¤¿¾ì¹ç¤Ï 0 °Ê³°¤òÊÖ¤·¡¢
130 ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï 0 ¤òÊÖ¤¹¡£
133 .\"O .BR __fsetlocking ()
134 .\"O function can be used to select the desired type of locking on the stream.
135 .\"O It returns the current type.
138 .\"O argument can take the following three values:
140 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤Î¥í¥Ã¥¯·Á¼°¤òÁªÂò¤¹¤ë¤¿¤á¤Ë»ÈÍѤǤ¤ë¡£
141 ÊÖ¤êÃͤϡ¢¸½ºß¤Î¥í¥Ã¥¯·Á¼°¤Ç¤¢¤ë¡£
143 °ú¤¿ô¤Ï°Ê²¼¤Î 3 ¼ïÎà¤ÎÃͤò¤È¤ë¤³¤È¤¬¤Ç¤¤ë :
145 .B FSETLOCKING_INTERNAL
146 .\"O Perform implicit locking around every operation on the given stream
147 .\"O (except for the *_unlocked ones).
148 .\"O This is the default.
149 »ØÄꤵ¤ì¤¿¥¹¥È¥ê¡¼¥à¤ËÂФ·¤ÆÁàºî¤¬¹Ô¤ï¤ì¤ëÅ٤ˡ¢Áàºî¤ÎÁ°¸å¤Ç
150 ÌÀ¼¨Åª¤Ë»Ø¼¨¤·¤Ê¤¯¤Æ¤â¥¹¥È¥ê¡¼¥à¤Î¥í¥Ã¥¯½èÍý¤ò¹Ô¤¦
151 (⤷¡¢*_unlocked ´Ø¿ô¤ò»ÈÍѤ·¤¿¾ì¹ç¤ÏÎã³°¤Ç¤¢¤ë)¡£
152 ¤³¤ì¤¬¥Ç¥Õ¥©¥ë¥È¤Î¥í¥Ã¥¯·Á¼°¤Ç¤¢¤ë¡£
154 .B FSETLOCKING_BYCALLER
155 .\"O The caller will take care of the locking (possibly using
156 .\"O .BR flockfile (3)
157 .\"O in case there is more than one thread), and the stdio routines
158 .\"O will not do locking until the state is reset to
159 .\"O .BR FSETLOCKING_INTERNAL .
160 ´Ø¿ô¤Î¸Æ¤Ó½Ð¤·¸µ¤Ç¥í¥Ã¥¯¤ÎÌÌÅݤò¤ß¤ë¡£
161 (¤ª¤½¤é¤¯¡¢Ê£¿ô¤Î¥¹¥ì¥Ã¥É¤¬Â¸ºß¤¹¤ë¾õ¶·¤Ç¤Ï
163 ¤ò»È¤¦¤³¤È¤Ë¤Ê¤ë¤À¤í¤¦)
165 .B FSETLOCKING_INTERNAL
166 ¤Ë¥ê¥»¥Ã¥È¤µ¤ì¤ë¤Þ¤Ç¤Ïɸ½àÆþ½ÐÎÏ´ØÏ¢¤Î´Ø¿ô¤Ï¥í¥Ã¥¯½èÍý¤ò¹Ô¤ï¤Ê¤¤¡£
169 .\"O Don't change the type of locking.
170 .\"O (Only return it.)
171 ¥í¥Ã¥¯·Á¼°¤ÎÊѹ¹¤ò¹Ô¤ï¤Ê¤¤¡£(¸½ºß¤Î·Á¼°¤òÊÖ¤¹¤À¤±¤Ç¤¢¤ë)
174 .\"O .BR _flushlbf ()
175 .\"O function flushes all line-buffered streams.
176 .\"O (Presumably so that
177 .\"O output to a terminal is forced out, say before reading keyboard input.)
179 ´Ø¿ô¤Ï¡¢¤¹¤Ù¤Æ¤Î¥é¥¤¥ó¥Ð¥Ã¥Õ¥¡ (line-buffered) ¥¿¥¤¥×¤Î¥¹¥È¥ê¡¼¥à¤Î
180 ÆâÍƤò½ÐÎÏ(¥Õ¥é¥Ã¥·¥å)¤¹¤ë¡£
181 (ÅöÁ³¤Ê¤¬¤é¡¢Ã¼Ëö¤Ø¤Î½ÐÎϤ¬¶¯À©Åª¤Ë¹Ô¤ï¤ì¤ë¤³¤È¤Ë¤Ê¤ë¤Î¤Ç¡¢
182 ¥¡¼¥Ü¡¼¥É¤«¤é¤ÎÆþÎϤòÆɤߤ³¤àÁ°¤Ë¤³¤Î´Ø¿ô¤ò¸Æ¤ó¤ÀÊý¤¬¤¤¤¤¤À¤í¤¦)
186 .\"O function discards the contents of the stream's buffer.
188 ´Ø¿ô¤Ï¡¢¥¹¥È¥ê¡¼¥à¤Î¥Ð¥Ã¥Õ¥¡¤ÎÆâÍƤòÇÑ´þ¤¹¤ë¡£