Reported-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FAILED ((void *) -1)
+/*
+ * Note that some platforms (e.g. Windows) do not allow read-only
+ * mappings to exceed the file's size (even within a page).
+ */
void *bt_mmap(void *addr, size_t length, int prot, int flags, int fd,
off_t offset);
goto error;
}
+ /*
+ * mmap_valid_len is guaranteed to be page-aligned except on the
+ * last mapping where it may not be possible (since the file's
+ * size itself may not be a page multiple).
+ */
ds_file->mmap_offset += ds_file->mmap_valid_len;
ds_file->request_offset = 0;
}
void *mmap_addr;
- /* Max length of chunk to mmap() when updating the current mapping. */
+ /*
+ * Max length of chunk to mmap() when updating the current mapping.
+ * This value must be page-aligned.
+ */
size_t mmap_max_len;
/* Length of the current mapping. */