Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2018-07

msync

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Victor Matuzenko

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?
2. Is there any reason to not provide msync in BaseUnix?
3. Can I send a patch adding Fpmsync to BaseUnix?

Thanks.

Victor Matuzenko (Виктор Матузенко)

Reply by email

Michael Van Canneyt
to Victor Matuzenko
Victor Matuzenko wrote 12 lines
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.

Reply by email