apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: cvs commit: apr/test testfileinfo.c
Date Tue, 11 Feb 2003 21:16:41 GMT
At 11:41 AM 2/11/2003, Branko Čibej wrote:
>Heh. The OS usually has file buffers, too, and yet stat() always tells
>you what the size of the file would be if all write()s were committed,

I really doubt that is a safe assumption across all OS's and file

>not what the size on disk actually is. If apr_file_write has an internal
>buffer, then apr_file_info_get should obviously be aware of that and
>adjust the results accordingly, without having to flush the buffers
>first -- and becoming orders of magnitude less efficient.

The only safe test I can imagine, without closing the file, is looking at
seek(0, SEEK_END).  I believe all platforms implement this correctly
in conjunction with our file buffering, and the OS should perform the
seek correctly even if the inode or directory entry is still out of sync.


View raw message