When I mmap a file it's possible to have a bus error and I attached some code to reproduce it The reproduce steps are in main.c. I choose to use mmap because I noticed doing an `read` on a large file is a bit slow. It seems like the kernel will zero out everything then write the file contents to the buffer. mmap is significantly faster but risk corrupting data and having a bus error (also doesn't seem like zero copy). Essentially what the program is is write to the contents of the file while main.c is using it which causes bad data OR it will TRUNC the file and cause a bus error + coredump. Are there ways to get a copy without being as 'slow' as `read` and doesn't have the downsides of mmap?
Attachment:
main.c
Description: Binary data
Attachment:
app2.c
Description: Binary data