libandroid-shmem
libandroid-shmem copied to clipboard
Fixes for QEMU support
Set MAP_FIXED when addr isn't NULL and don't assume that shmflg != 0 means SHM_RDONLY
termux/proot-distro#495
QEMU implies use of SHM_REMAP: https://github.com/qemu/qemu/blob/495de0fd82d8bb2d7035f82d9869cfeb48de2f9e/linux-user/mmap.c#L1420-L1423
In Linux, addr != 0 implies MAP_FIXED, while SHM_REMAP flag only requires use of addr != 0: https://github.com/torvalds/linux/blob/7ff71e6d923969d933e1ba7e0db857782d36cd19/ipc/shm.c#L1534-L1555