Discussion:
msync
(too old to reply)
Victor Matuzenko
2018-07-16 03:29:58 UTC
Permalink
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 (Виктор Матузенко)

_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo
Michael Van Canneyt
2018-07-16 07:32:11 UTC
Permalink
Post by Victor Matuzenko
Hi!
https://www.freepascal.org/docs-html/rtl/baseunix/fpmmap.html
I want to mmap a file in writable mode. After some modifications done
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.
Post by Victor Matuzenko
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.
Post by Victor Matuzenko
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.
_______________________________________________
fpc-devel maillist - fpc-***@lists.freepascal.org
http://

Loading...