db: Define PAGESZ, inline mmap() args
Dependencies
Change contents
- edit in db.h at line 3
/*** 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 - replacement in db.c at line 66
usize length = 4096;int prot = PROT_READ; // memory protection; PROT_{EXEC,READ,WRITE,NONE}int flags = MAP_PRIVATE; // determines visibilityoff_t offset = 0;addr = mmap(NULL, length, prot, flags, fd, offset);addr = mmap(NULL, PAGESZ, PROT_READ, MAP_PRIVATE, fd, 0); - replacement in db.c at line 71
munmap(addr, length);munmap(addr, PAGESZ); - replacement in db.c at line 79
addr = mmap(NULL, length, prot, flags, fd, i << 12);addr = mmap(NULL, PAGESZ, PROT_READ, MAP_PRIVATE, fd, i << 12); - replacement in db.c at line 83
munmap(addr, length);munmap(addr, PAGESZ);