.\" Copyright (C) 2001 Andries Brouwer . .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI all rights reserved. .\" Translated Nov 2 2002 by Akihiro MOTOKI .\"O .SH NAME .\"O __fbufsize, __flbf, __fpending, __fpurge, __freadable, .\"O __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \- .\"O interfaces to stdio FILE structure .\"O .SH SYNOPSIS .\"O .SH DESCRIPTION .\"O Solaris introduced routines to allow portable access to the .\"O internals of the .\"O .I FILE .\"O structure, and glibc also implemented these. .\"O The .\"O .BR __fbufsize () .\"O function returns the size of the buffer currently used .\"O by the given stream. .\"O The .\"O .BR __fpending () .\"O function returns the number of bytes in the output buffer. .\"O For wide-oriented streams the unit is wide characters. .\"O This function is undefined on buffers in reading mode, .\"O or opened read-only. .\"O The .\"O .BR __flbf () .\"O function returns a nonzero value if the stream is line-buffered, .\"O and zero otherwise. .\"O The .\"O .BR __freadable () .\"O function returns a nonzero value if the stream allows reading, .\"O and zero otherwise. .\"O The .\"O .BR __fwritable () .\"O function returns a nonzero value if the stream allows writing, .\"O and zero otherwise. .\"O The .\"O .BR __freading () .\"O function returns a nonzero value if the stream is read-only, or .\"O if the last operation on the stream was a read operation, .\"O and zero otherwise. .\"O The .\"O .BR __fwriting () .\"O function returns a nonzero value if the stream is write-only (or .\"O append-only), or if the last operation on the stream was a write .\"O operation, and zero otherwise. .\"O The .\"O .BR __fsetlocking () .\"O function can be used to select the desired type of locking on the stream. .\"O It returns the current type. .\"O The .\"O .I type .\"O argument can take the following three values: .\"O Perform implicit locking around every operation on the given stream .\"O (except for the *_unlocked ones). .\"O This is the default. .\"O The caller will take care of the locking (possibly using .\"O .BR flockfile (3) .\"O in case there is more than one thread), and the stdio routines .\"O will not do locking until the state is reset to .\"O .BR FSETLOCKING_INTERNAL . .\"O Don't change the type of locking. .\"O (Only return it.) .\"O The .\"O .BR _flushlbf () .\"O function flushes all line-buffered streams. .\"O (Presumably so that .\"O output to a terminal is forced out, say before reading keyboard input.) .\"O The .\"O .BR __fpurge () .\"O function discards the contents of the stream's buffer. .\"O .SH "SEE ALSO" .\" .TH STDIO_EXT 3 2013\-06\-21 "" "Linux Programmer's Manual" .SH 名前 __fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading, __fsetlocking, __fwritable, __fwriting, _flushlbf \- 標準入出力ファイル構造体へのインターフェース .SH 書式 \fB#include \fP .br \fB#include \fP .sp \fBsize_t __fbufsize(FILE *\fP\fIstream\fP\fB);\fP .br \fBsize_t __fpending(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __flbf(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __freadable(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __fwritable(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __freading(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __fwriting(FILE *\fP\fIstream\fP\fB);\fP .br \fBint __fsetlocking(FILE *\fP\fIstream\fP\fB, int \fP\fItype\fP\fB);\fP .br \fBvoid _flushlbf(void);\fP .br \fBvoid __fpurge(FILE *\fP\fIstream\fP\fB);\fP .SH 説明 Solaris では、 \fIFILE\fP 構造体の内部へポータブルなかたちで アクセスできる手段が導入されており、これらは glibc でも実装されている。 .LP \fB__fbufsize\fP() 関数は、指定されたストリームが使用しているバッファーサイズを返す。 .LP \fB__fpending\fP() 関数は、出力バッファーに入っているデータのバイト数を返す。 ワイドキャラクターを扱うストリームの場合、ワイドキャラクター単位で計算される。 バッファーが読み出しモードの場合や読み出し専用で開かれている場合の この関数の振舞いは未定義である。 .LP \fB__flbf\fP() 関数は、ストリームがラインバッファーの場合は 0 以外を、 それ以外の場合は 0 を返す。 .LP \fB__freadable\fP() 関数は、ストリームが読み出し可能な場合は 0 以外を、 それ以外の場合は 0 を返す。 .LP \fB__fwritable\fP() 関数は、ストリームが書き込み可能な場合は 0 以外を、 それ以外の場合は 0 を返す。 .LP \fB__freading\fP() 関数は、ストリームが読み出し専用の場合、またはストリームに対する直前の操作が 読み出し操作であった場合は 0 以外を返し、それ以外の場合は 0 を返す。 .LP \fB__fwriting\fP() 関数は、ストリームが書き込み専用(もしくは追加専用)の場合、 またはストリームに対する直前の操作が書き込み操作であった場合は 0 以外を返し、 それ以外の場合は 0 を返す。 .LP \fB__fsetlocking\fP() 関数は、ストリームのロック形式を選択するために使用できる。 返り値は、現在のロック形式である。 \fItype\fP 引き数は以下の 3 種類の値をとることができる : .TP \fBFSETLOCKING_INTERNAL\fP 指定されたストリームに対して操作が行われる度に、操作の前後で 明示的に指示しなくてもストリームのロック処理を行う (但し、*_unlocked 関数を使用した場合は例外である)。 これがデフォルトのロック形式である。 .TP \fBFSETLOCKING_BYCALLER\fP 関数の呼び出し元でロックの面倒をみる。 (おそらく、複数のスレッドが存在する状況では \fBflockfile\fP(3) を使うことになるだろう) ロック形式が \fBFSETLOCKING_INTERNAL\fP にリセットされるまでは標準入出力関連の関数はロック処理を行わない。 .TP \fBFSETLOCKING_QUERY\fP ロック形式の変更を行わない。(現在の形式を返すだけである) .LP \fB_flushlbf\fP() 関数は、すべてのラインバッファー (line\-buffered) タイプのストリームの 内容を出力(フラッシュ)する。 (当然ながら、端末への出力が強制的に行われることになるので、 キーボードからの入力を読みこむ前にこの関数を呼んだ方がいいだろう) .LP \fB__fpurge\fP() 関数は、ストリームのバッファーの内容を廃棄する。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fB__fbufsize\fP(), \fB__fpending\fP(), \fB__fpurge\fP(), \fB__fsetlocking\fP() は、 ストリームのロックを行わない。 そのため、スレッドセーフではない。 .LP 関数 \fB__flbf\fP(), \fB__freadable\fP(), \fB__freading\fP(), \fB__fwritable\fP(), \fB__fwriting\fP(), \fB_flushlbf\fP() はスレッドセーフである。 .SH 関連項目 \fBflockfile\fP(3), \fBfpurge\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。