TDOR2JDR2SO7FF5LVBJ4GYQXHK7MPLJQJPZMRO6EIRT6AYQNH6CQC
/**
* The sanakirja database exists to allow the creation of data
* structures that most naturally lives in memory-mapped files.
*
* It is structured around pages, through two traits AllocPage and
* LoadPage. The assumption is that pages have 4K bytes.
*
* There is a Storable macro that types can implement to indicate they
* can be stored on disk. Implementations should allow for comparing
* types, getting references from a page to other pages (if they
* exist).
*/
#define PAGESZ 4096
usize length = 4096;
int prot = PROT_READ; // memory protection; PROT_{EXEC,READ,WRITE,NONE}
int flags = MAP_PRIVATE; // determines visibility
off_t offset = 0;
addr = mmap(NULL, length, prot, flags, fd, offset);
addr = mmap(NULL, PAGESZ, PROT_READ, MAP_PRIVATE, fd, 0);