OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[linuxjm/LDP_man-pages.git] / draft / man3 / stdio_ext.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\"*******************************************************************
26 .\"
27 .\" This file was generated with po4a. Translate the source file.
28 .\"
29 .\"*******************************************************************
30 .\"
31 .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI all rights reserved.
32 .\" Translated Nov 2 2002 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
33 .\"O .SH NAME
34 .\"O __fbufsize, __flbf, __fpending, __fpurge, __freadable,
35 .\"O __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \-
36 .\"O interfaces to stdio FILE structure
37 .\"O .SH SYNOPSIS
38 .\"O .SH DESCRIPTION
39 .\"O Solaris introduced routines to allow portable access to the
40 .\"O internals of the
41 .\"O .I FILE
42 .\"O structure, and glibc also implemented these.
43 .\"O The
44 .\"O .BR __fbufsize ()
45 .\"O function returns the size of the buffer currently used
46 .\"O by the given stream.
47 .\"O The
48 .\"O .BR __fpending ()
49 .\"O function returns the number of bytes in the output buffer.
50 .\"O For wide-oriented streams the unit is wide characters.
51 .\"O This function is undefined on buffers in reading mode,
52 .\"O or opened read-only.
53 .\"O The
54 .\"O .BR __flbf ()
55 .\"O function returns a nonzero value if the stream is line-buffered,
56 .\"O and zero otherwise.
57 .\"O The
58 .\"O .BR __freadable ()
59 .\"O function returns a nonzero value if the stream allows reading,
60 .\"O and zero otherwise.
61 .\"O The
62 .\"O .BR __fwritable ()
63 .\"O function returns a nonzero value if the stream allows writing,
64 .\"O and zero otherwise.
65 .\"O The
66 .\"O .BR __freading ()
67 .\"O function returns a nonzero value if the stream is read-only, or
68 .\"O if the last operation on the stream was a read operation,
69 .\"O and zero otherwise.
70 .\"O The
71 .\"O .BR __fwriting ()
72 .\"O function returns a nonzero value if the stream is write-only (or
73 .\"O append-only), or if the last operation on the stream was a write
74 .\"O operation, and zero otherwise.
75 .\"O The
76 .\"O .BR __fsetlocking ()
77 .\"O function can be used to select the desired type of locking on the stream.
78 .\"O It returns the current type.
79 .\"O The
80 .\"O .I type
81 .\"O argument can take the following three values:
82 .\"O Perform implicit locking around every operation on the given stream
83 .\"O (except for the *_unlocked ones).
84 .\"O This is the default.
85 .\"O The caller will take care of the locking (possibly using
86 .\"O .BR flockfile (3)
87 .\"O in case there is more than one thread), and the stdio routines
88 .\"O will not do locking until the state is reset to
89 .\"O .BR FSETLOCKING_INTERNAL .
90 .\"O Don't change the type of locking.
91 .\"O (Only return it.)
92 .\"O The
93 .\"O .BR _flushlbf ()
94 .\"O function flushes all line-buffered streams.
95 .\"O (Presumably so that
96 .\"O output to a terminal is forced out, say before reading keyboard input.)
97 .\"O The
98 .\"O .BR __fpurge ()
99 .\"O function discards the contents of the stream's buffer.
100 .\"O .SH "SEE ALSO"
101 .\"
102 .TH STDIO_EXT 3 2013\-06\-21 "" "Linux Programmer's Manual"
103 .SH 名前
104 __fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading,
105 __fsetlocking, __fwritable, __fwriting, _flushlbf \- 標準入出力ファイル構造体へのインタフェース
106 .SH 書式
107 \fB#include <stdio.h>\fP
108 .br
109 \fB#include <stdio_ext.h>\fP
110 .sp
111 \fBsize_t __fbufsize(FILE *\fP\fIstream\fP\fB);\fP
112 .br
113 \fBsize_t __fpending(FILE *\fP\fIstream\fP\fB);\fP
114 .br
115 \fBint __flbf(FILE *\fP\fIstream\fP\fB);\fP
116 .br
117 \fBint __freadable(FILE *\fP\fIstream\fP\fB);\fP
118 .br
119 \fBint __fwritable(FILE *\fP\fIstream\fP\fB);\fP
120 .br
121 \fBint __freading(FILE *\fP\fIstream\fP\fB);\fP
122 .br
123 \fBint __fwriting(FILE *\fP\fIstream\fP\fB);\fP
124 .br
125 \fBint __fsetlocking(FILE *\fP\fIstream\fP\fB, int \fP\fItype\fP\fB);\fP
126 .br
127 \fBvoid _flushlbf(void);\fP
128 .br
129 \fBvoid __fpurge(FILE *\fP\fIstream\fP\fB);\fP
130 .SH 説明
131 Solaris では、 \fIFILE\fP 構造体の内部へポータブルなかたちで アクセスできる手段が導入されており、これらは glibc
132 でも実装されている。
133 .LP
134 \fB__fbufsize\fP()  関数は、指定されたストリームが使用しているバッファサイズを返す。
135 .LP
136 \fB__fpending\fP()  関数は、出力バッファに入っているデータのバイト数を返す。
137 ワイドキャラクタを扱うストリームの場合、ワイドキャラクタ単位で計算される。 バッファが読み出しモードの場合や読み出し専用で開かれている場合の
138 この関数の振舞いは未定義である。
139 .LP
140 \fB__flbf\fP()  関数は、ストリームがラインバッファの場合は 0 以外を、 それ以外の場合は 0 を返す。
141 .LP
142 \fB__freadable\fP()  関数は、ストリームが読み出し可能な場合は 0 以外を、 それ以外の場合は 0 を返す。
143 .LP
144 \fB__fwritable\fP()  関数は、ストリームが書き込み可能な場合は 0 以外を、 それ以外の場合は 0 を返す。
145 .LP
146 \fB__freading\fP()  関数は、ストリームが読み出し専用の場合、またはストリームに対する直前の操作が 読み出し操作であった場合は 0
147 以外を返し、それ以外の場合は 0 を返す。
148 .LP
149 \fB__fwriting\fP()  関数は、ストリームが書き込み専用(もしくは追加専用)の場合、
150 またはストリームに対する直前の操作が書き込み操作であった場合は 0 以外を返し、 それ以外の場合は 0 を返す。
151 .LP
152 \fB__fsetlocking\fP()  関数は、ストリームのロック形式を選択するために使用できる。 返り値は、現在のロック形式である。 \fItype\fP
153 引き数は以下の 3 種類の値をとることができる :
154 .TP 
155 \fBFSETLOCKING_INTERNAL\fP
156 指定されたストリームに対して操作が行われる度に、操作の前後で 明示的に指示しなくてもストリームのロック処理を行う (但し、*_unlocked
157 関数を使用した場合は例外である)。 これがデフォルトのロック形式である。
158 .TP 
159 \fBFSETLOCKING_BYCALLER\fP
160 関数の呼び出し元でロックの面倒をみる。 (おそらく、複数のスレッドが存在する状況では \fBflockfile\fP(3)  を使うことになるだろう)
161 ロック形式が \fBFSETLOCKING_INTERNAL\fP にリセットされるまでは標準入出力関連の関数はロック処理を行わない。
162 .TP 
163 \fBFSETLOCKING_QUERY\fP
164 ロック形式の変更を行わない。(現在の形式を返すだけである)
165 .LP
166 \fB_flushlbf\fP()  関数は、すべてのラインバッファ (line\-buffered) タイプのストリームの 内容を出力(フラッシュ)する。
167 (当然ながら、端末への出力が強制的に行われることになるので、 キーボードからの入力を読みこむ前にこの関数を呼んだ方がいいだろう)
168 .LP
169 \fB__fpurge\fP()  関数は、ストリームのバッファの内容を廃棄する。
170 .SH 属性
171 .SS "マルチスレッディング (pthreads(7) 参照)"
172 関数 \fB__fbufsize\fP(), \fB__fpending\fP(), \fB__fpurge\fP(), \fB__fsetlocking\fP() は、
173 ストリームのロックを行わない。 そのため、スレッドセーフではない。
174 .LP
175 関数 \fB__flbf\fP(), \fB__freadable\fP(), \fB__freading\fP(), \fB__fwritable\fP(),
176 \fB__fwriting\fP(), \fB_flushlbf\fP() はスレッドセーフである。
177 .SH 関連項目
178 \fBflockfile\fP(3), \fBfpurge\fP(3)
179 .SH この文書について
180 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
181 である。プロジェクトの説明とバグ報告に関する情報は
182 http://www.kernel.org/doc/man\-pages/ に書かれている。