I realize it's unlikely anyone will see this, but to amplify this point a little, I thought I'd poke through the Posgres source (which I'm not otherwise familiar with). By my count, mmap is only called in 4 places, in three files.
The implementation behind this file is one of them:
That is the actual file API that you'd use inside of Postgres. While the API there isn't going to win any beauty pageants, it's significantly more sane than raw POSIX.
For comparison, this is the interface to mmaped files within my company's internal database:
There's a grand total of 1 call to mmap in all of our source. Most of the time for writing code using mapped files here, all you'd see is the interface above.
The implementation behind this file is one of them:
https://doxygen.postgresql.org/fd_8h.html
That is the actual file API that you'd use inside of Postgres. While the API there isn't going to win any beauty pageants, it's significantly more sane than raw POSIX.
For comparison, this is the interface to mmaped files within my company's internal database:
https://gist.github.com/scotchi/83609f5eb9b98ac3b4b4476ed621...
There's a grand total of 1 call to mmap in all of our source. Most of the time for writing code using mapped files here, all you'd see is the interface above.