[pgsql-jp: 35685] Re: pgpoolのfflush()におけるEAGAIN
Tatsuo Ishii
t-ishii @ sra.co.jp
2005年 7月 6日 (水) 23:14:48 JST
石井です.
> 杉村です。
>
> > > > 現状FreeBSD4.11、postgresql7.4.8でpgpoolを使用していますが、
>
> EAGAIN についてはよくわからなかったのですが、
> fflush() は 4.11 と 5.x以降 では少々実装が違うようです。
>
> fflush.c を比べてみますと、次のようになっています。
> http://www.jp.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/stdio/fflush.c
>
> 4.11 Sat Aug 28 00:00:58 1999 UTC
> 5.x〜 Sun Jul 4 20:17:00 2004 UTC
>
> コメントで次のように書いてありました。
>
> Linux では失敗しても成功を返して何もしないそうなのですが、
> それもまたどうかと思います。
>
> /*
> * There is disagreement about the correct behaviour of fflush()
> * when passed a file which is not open for reading. According to
> * the ISO C standard, the behaviour is undefined.
> * Under linux, such an fflush returns success and has no effect;
> * under Windows, such an fflush is documented as behaving instead
> * as fpurge().
> * Given that applications may be written with the expectation of
> * either of these two behaviours, the only safe (non-astonishing)
> * option is to return EBADF and ask that applications be fixed.
> */
良く分からなかったのですが,もしかして上記の「open for readig」は
「open for writing」の間違いですか?コードをちらっと見た感じでは,
read用にオープンしたfdをfflushに渡すとEBADFが返るような気がしたのです
が?
もし私の解釈が正しければ,
> * Under linux, such an fflush returns success and has no effect;
というのは最近のLinuxでは当てはまらないようです.
Linuxのfflushのマニュアルより:
EBADF Stream is not an open stream, or is not open for
writing.
--
Tatsuo Ishii
pgsql-jp メーリングリストの案内