Question on mmap() to rollback to previous contents
Hi,
My requirement is, when I get a signal from a process, my process should load a file using mmap() and update its data/contents and waits for further signals. After some-time I will get another signal from that process saying either proceed further or discard the previously made changes.
Initially I wanted to use MAP_PRIVATE, but if I load a region with MAP_PRIVATE the contents are never written to underlying disk.
MS_INVALIDATE never discards the contents loaded with MAP_SHARED.
So my requirement is if I get a failure message from that process after updating my mmap region contents, I should be able to rollback to previous contents.
Any help on this would be highly appreciated.
|