WinXP -> OpenVMS tests reproduced using C++ test pro

John E. Malmberg wb8tyw at qsl.net
Wed Sep 29 14:59:30 GMT 2004


In article <CF0913E9C3D53D4E94DE47FDE25C633D05049085 at hermes.cofiroute.com>,
> Brodie, R (Richard) wrote:
>
>>J. Malmberg wrote:
>>The stat() or fstat() functions should return the correct results of
>>the real size of the file.  In the standard fields, they should have the =
>>highest byte written in the file.
>
> The CRTL manual notes:
>
> 'be aware that for st_size to report a correct value, you need to flush
> both the C RTL and RMS buffers'.
>
COLLOT Jean-Yves <jean-yves.collot at cofiroute.fr> writes:
> You are perfectly right. I must admit that I was not aware of that.
>
> I replaced my Close/open by a call to fsync(), and it works fine.

This may be an issue on some of the UNIX SAMBA platforms that may not have
been noticed as it only occurs with large files, and never occurs with a
SAMBA to SAMBA transfer.

The only way for a stat() call to return the correct size for a file open
for write is if it either forces a flush, or can look inside the buffers
for another process.

That brings up another question about the UNIX SAMBA code, since the size
query is coming in on the same session that knows it has the file open,
why is stat() used instead of fstat()?

I would expect that fstat() would know the file highwater mark for it's
current file descriptor.

-John
wb8tyw at qsl.network
Personal Opinion Only



More information about the samba-vms mailing list