mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-20 05:34:35 -04:00
cursor: ignore posix_fallocate in shm_pool_resize if not supported by FS
Signed-off-by: Jan Beich <jbeich@FreeBSD.org>
This commit is contained in:
parent
1283d54dac
commit
3a3dd0820d
1 changed files with 8 additions and 4 deletions
|
|
@ -83,15 +83,19 @@ err_free:
|
||||||
static int
|
static int
|
||||||
shm_pool_resize(struct shm_pool *pool, int size)
|
shm_pool_resize(struct shm_pool *pool, int size)
|
||||||
{
|
{
|
||||||
if (ftruncate(pool->fd, size) < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#ifdef HAVE_POSIX_FALLOCATE
|
#ifdef HAVE_POSIX_FALLOCATE
|
||||||
|
/*
|
||||||
|
* Filesystems that do support fallocate will return EINVAL or
|
||||||
|
* EOPNOTSUPP. In this case we need to fall back to ftruncate
|
||||||
|
*/
|
||||||
errno = posix_fallocate(pool->fd, 0, size);
|
errno = posix_fallocate(pool->fd, 0, size);
|
||||||
if (errno != 0)
|
if (errno != 0 && errno != EINVAL && errno != EOPNOTSUPP)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (ftruncate(pool->fd, size) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
wl_shm_pool_resize(pool->pool, size);
|
wl_shm_pool_resize(pool->pool, size);
|
||||||
|
|
||||||
munmap(pool->data, pool->size);
|
munmap(pool->data, pool->size);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue