How to get memory address from shm_open?
问题 I want to share memory using a file descriptor with another process created via fork . The problem is that I get different address regions from mmap . I want that mmap returns the same address value. Only in such case I can be sure that I really share the memory. Probably it is possible to use MAP_FIXED flag to mmap , but how to get memory address from shm_open ? Is it possible to share memory via shm_open at all? Maybe shmget must be used instead? This is the minimal working example: