OSDN Git Service

6d568dbf6393aeed9464a885331dd08d765f5527
[linuxjm/LDP_man-pages.git] / draft / 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 .\" 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"
26 .\"O .SH NAME
27 .SH 名前
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 標準入出力ファイル構造体へのインタフェース
34 .\"O .SH SYNOPSIS
35 .SH 書式
36 .B #include <stdio.h>
37 .br
38 .B #include <stdio_ext.h>
39 .sp
40 .BI "size_t __fbufsize(FILE *" stream );
41 .br
42 .BI "size_t __fpending(FILE *" stream );
43 .br
44 .BI "int __flbf(FILE *" stream );
45 .br
46 .BI "int __freadable(FILE *" stream );
47 .br
48 .BI "int __fwritable(FILE *" stream );
49 .br
50 .BI "int __freading(FILE *" stream );
51 .br
52 .BI "int __fwriting(FILE *" stream );
53 .br
54 .BI "int __fsetlocking(FILE *" stream ", int " type );
55 .br
56 .B "void _flushlbf(void);"
57 .br
58 .BI "void __fpurge(FILE *" stream );
59 .\"O .SH DESCRIPTION
60 .SH 説明
61 .\"O Solaris introduced routines to allow portable access to the
62 .\"O internals of the
63 .\"O .I FILE
64 .\"O structure, and glibc also implemented these.
65 Solaris では、
66 .I FILE
67 構造体の内部へポータブルなかたちで
68 アクセスできる手段が導入されており、これらは glibc でも実装されている。
69 .LP
70 .\"O The
71 .\"O .BR __fbufsize ()
72 .\"O function returns the size of the buffer currently used
73 .\"O by the given stream.
74 .BR __fbufsize ()
75 関数は、指定されたストリームが使用しているバッファ・サイズを返す。
76 .LP
77 .\"O The
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.
83 .BR __fpending ()
84 関数は、出力バッファに入っているデータのバイト数を返す。
85 ワイドキャラクタを扱うストリームの場合、ワイドキャラクタ単位で計算される。
86 バッファが読み出しモードの場合や読み出し専用で開かれている場合の
87 この関数の振舞いは未定義である。
88 .LP
89 .\"O The
90 .\"O .BR __flbf ()
91 .\"O function returns a nonzero value if the stream is line-buffered,
92 .\"O and zero otherwise.
93 .BR __flbf ()
94 関数は、ストリームがラインバッファの場合は 0 以外を、
95 それ以外の場合は 0 を返す。
96 .LP
97 .\"O The
98 .\"O .BR __freadable ()
99 .\"O function returns a nonzero value if the stream allows reading,
100 .\"O and zero otherwise.
101 .BR __freadable ()
102 関数は、ストリームが読み出し可能な場合は 0 以外を、
103 それ以外の場合は 0 を返す。
104 .LP
105 .\"O The
106 .\"O .BR __fwritable ()
107 .\"O function returns a nonzero value if the stream allows writing,
108 .\"O and zero otherwise.
109 .BR __fwritable ()
110 関数は、ストリームが書き込み可能な場合は 0 以外を、
111 それ以外の場合は 0 を返す。
112 .LP
113 .\"O The
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.
118 .BR __freading ()
119 関数は、ストリームが読み出し専用の場合、またはストリームに対する直前の操作が
120 読み出し操作であった場合は 0 以外を返し、それ以外の場合は 0 を返す。
121 .LP
122 .\"O The
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.
127 .BR __fwriting ()
128 関数は、ストリームが書き込み専用(もしくは追加専用)の場合、
129 またはストリームに対する直前の操作が書き込み操作であった場合は 0 以外を返し、
130 それ以外の場合は 0 を返す。
131 .LP
132 .\"O The
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.
136 .\"O The
137 .\"O .I type
138 .\"O argument can take the following three values:
139 .BR __fsetlocking ()
140 関数は、ストリームのロック形式を選択するために使用できる。
141 返り値は、現在のロック形式である。
142 .I type
143 引き数は以下の 3 種類の値をとることができる :
144 .TP
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 これがデフォルトのロック形式である。
153 .TP
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 (おそらく、複数のスレッドが存在する状況では
162 .BR flockfile (3)
163 を使うことになるだろう)
164 ロック形式が
165 .B FSETLOCKING_INTERNAL
166 にリセットされるまでは標準入出力関連の関数はロック処理を行わない。
167 .TP
168 .B FSETLOCKING_QUERY
169 .\"O Don't change the type of locking.
170 .\"O (Only return it.)
171 ロック形式の変更を行わない。(現在の形式を返すだけである)
172 .LP
173 .\"O The
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.)
178 .BR _flushlbf ()
179 関数は、すべてのラインバッファ (line-buffered) タイプのストリームの
180 内容を出力(フラッシュ)する。
181 (当然ながら、端末への出力が強制的に行われることになるので、
182 キーボードからの入力を読みこむ前にこの関数を呼んだ方がいいだろう)
183 .LP
184 .\"O The
185 .\"O .BR __fpurge ()
186 .\"O function discards the contents of the stream's buffer.
187 .BR __fpurge ()
188 関数は、ストリームのバッファの内容を廃棄する。
189 .\"O .SH "SEE ALSO"
190 .SH 関連項目
191 .BR flockfile (3),
192 .BR fpurge (3)