diff --git a/src/wayland-shm.c b/src/wayland-shm.c index 28c550dd..c4cd390c 100644 --- a/src/wayland-shm.c +++ b/src/wayland-shm.c @@ -65,10 +65,12 @@ struct wl_shm_pool { char *data; ssize_t size; ssize_t new_size; +#ifndef MREMAP_MAYMOVE /* The following three fields are needed for mremap() emulation. */ int mmap_fd; int mmap_flags; int mmap_prot; +#endif bool sigbus_is_impossible; }; @@ -153,7 +155,9 @@ shm_pool_unref(struct wl_shm_pool *pool, bool external) return; munmap(pool->data, pool->size); +#ifndef MREMAP_MAYMOVE close(pool->mmap_fd); +#endif free(pool); } @@ -344,10 +348,14 @@ shm_create_pool(struct wl_client *client, struct wl_resource *resource, strerror(errno)); goto err_free; } +#ifndef MREMAP_MAYMOVE /* We may need to keep the fd, prot and flags to emulate mremap(). */ pool->mmap_fd = fd; pool->mmap_prot = prot; pool->mmap_flags = flags; +#else + close(fd); +#endif pool->resource = wl_resource_create(client, &wl_shm_pool_interface, 1, id); if (!pool->resource) {