allow a writer to reopen shmem without clearing a data
A reader can open shmem and use wrs_shm_follow
to apply offset between shmem address in a writer and reader. No problem here.
The problem is when the writer reopens shmem. For simplicity it does not use wrs_shm_follow
nor similar function during reading/writing of pointers. All values of pointers written to shmem are in the form <shmem map address>
+ <offset within shmem>
the first part changes between opening of shmem by a writer. It is stored in basemap
field of a shmem header. Unfortunately, as mentioned before, the map address changes from one opening to another so having one basemap
is not enough (there might be many openings). On the other hand keeping a list of such map addresses does not resolve a problem, since it is not known which pointer was written during which opening and what was the map address then.
The solution is to try to mmap shmem always at the same address. If it is not possible to map at the same (fixed) address the entire shmem shall be cleared or a writer shall exit.
As today only in wrs_rtud
there is a need to preserve data between restarts of a writer (some configuration than can be written to FPGA but cannot be read later, so there is a mirror of the configuration in shmem). Fortunately, wrs_rtud
does not store pointers in the shmem.