apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@xbc.nu>
Subject Re: cvs commit: apr/test testfileinfo.c
Date Tue, 11 Feb 2003 17:41:36 GMT
Joe Orton wrote:

>On Sat, Feb 08, 2003 at 02:21:28AM +0100, Branko Čibej wrote:
>  
>
>>Joe Orton wrote:
>>    
>>
>>>It does indeed, is this the kind of fix you were thinking of?
>>>
>>>      
>>>
>>I expect that change would avoid the problem, yes. (In fact, in
>>Subversion, I did an explicit fluxh befode calling apr_file_info_get,
>>for this very reason.) I was sort of hoping someone had a better idea
>>for a fix, though; forcing a flush before every stat seems to me to
>>defeat the whole purpose of buffering.
>>    
>>
>
>I'm confused by that - buffering means "some writes are deferred", so a
>direct consequence of that is that the st_size returned by a stat on the
>file may not equal the number of bytes passed to apr_file_write, right?
>If you want stat().st_size to always equal the number of bytes passed to
>apr_file_write, then it sounds like you don't want to use buffering?
>  
>
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,
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.

-- 
Brane Čibej   <brane@xbc.nu>   http://www.xbc.nu/brane/


Mime
View raw message