aboutsummaryrefslogtreecommitdiff
path: root/shm.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-10 17:01:01 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-10 17:06:10 +0000
commit7efe2c6c973ee40e77c07402b6bf28e4d2d11384 (patch)
tree6a8e26eee852f28ae4a2c58ce297e9f240f21105 /shm.c
parentshm: log errno error message too (diff)
shm: try to mmap with MAP_UNINITIALIZED
This flag is expected to be ignored on most systems, but can't hurt to try.
Diffstat (limited to 'shm.c')
-rw-r--r--shm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/shm.c b/shm.c
index 71f964a8..ba88b361 100644
--- a/shm.c
+++ b/shm.c
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/mman.h>
+#include <linux/mman.h>
#include <linux/memfd.h>
#include <fcntl.h>
@@ -142,7 +143,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie)
}
}
- mmapped = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, pool_fd, 0);
+ mmapped = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_UNINITIALIZED, pool_fd, 0);
if (mmapped == MAP_FAILED) {
LOG_ERRNO("failed to mmap SHM backing memory file");
goto err;