[fpc-devel] msync

Michael Van Canneyt michael at freepascal.org
Mon Jul 16 09:32:11 CEST 2018



On Mon, 16 Jul 2018, Victor Matuzenko wrote:

> Hi!
>
> There is Fpmmap function in BaseUnix for POSIX's mmap:
> https://www.freepascal.org/docs-html/rtl/baseunix/fpmmap.html
>
> I want to mmap a file in writable mode. After some modifications done
> I should to call POSIX's msync to garantee changes applied to the file:
> http://pubs.opengroup.org/onlinepubs/000095399/functions/msync.html
>
> But I can't find neither Fpmsync nor msync in fpc rtl.
>
> 1. How do I call msync?

You need to do a direct syscall. You can check the implementation of the 
various routines to see how this is done.

> 2. Is there any reason to not provide msync in BaseUnix?

If not all supported platforms (BSD, Mac) have it, 
it can't go in baseunix or unix. I suspect it's better placed for the Unix
unit.

> 3. Can I send a patch adding Fpmsync to BaseUnix?

If we know all platforms support it, yes. Otherwise, a patch to the linux
unit can be made (assuming you use Linux).

Michael.



More information about the fpc-devel mailing list