I am doing a mmap of a file using the crate memmap. The mapping is done like this :
let mut mmap_var = memmap::MmapOptions::new().len(8589934592)
.map_mut(file).unwrap();
Everything goes well until i reach the value contained in mmap_var[4096]
for u8 and mmap_var[511]
for u64 for example.
When I try to go further, I get a : signal: 7, SIGBUS: access to undefined memory.
I don't understand why, because when I read the length of the mmaped array, it corresponds to the value I set it to.
I would like to access the whole mapped area.
EDIT
I know know that the problem was the file size as it was a regular file.
My problem is now that the main goal is to mmap a character device file that has zero as length.
The instruction is :
memmap2::MmapOptions::new().len(65000)
.map_mut(&file);
And it results in :
Os {
code: 19,
kind: Uncategorized,
message: "No such device",}