[fpc-pascal] Calling DO_SYSCALL on Mac OS X

Jonas Maebe jonas.maebe at elis.ugent.be
Wed May 20 16:25:16 CEST 2009


On 20 May 2009, at 16:15, Roland Turcan wrote:

> I just didn't find relation of fpfsync function to mac os x
> implementation.

rtl/unix/unxdeclh.inc:

Function fpfsync (fd : cint) : cint; cdecl; external clib name 'fsync';

> JM> uses
> JM>    unix;
> JM> ...
> JM>    fpfsync(handle).
>
> I have the same actually, but it doesn't work as I expect.
>
> When I write into FileStream any data I call FlushBuffer function
> which contains fpfsync(handle), but because if still buggy version of
> ported application I have some expections which crashes application
> and then nearly all changed files are broken.

Are you checking the return value of fpfsync for errors? And are you  
certain that nothing is buffered in the stream itself, or elsewhere in  
the application?

> Are you sure, that fpfsync works fine on Mac OS?

No. I don't think anyone ever added a test for that function to the  
test suite (nor for most other Unix-unit functions). Also see the man  
page of fsync for caveats (although those only apply in case of a  
power failure or an OS crash).


Jonas



More information about the fpc-pascal mailing list