From 3f601a31dc24d7acba7b57124e3b319b792b9581 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 25 Feb 2020 19:07:23 +0100 Subject: shm: handle EINTR in posix_fallocate() --- shm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'shm.c') diff --git a/shm.c b/shm.c index 33095e74..ab717bd0 100644 --- a/shm.c +++ b/shm.c @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -124,7 +125,9 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) size = stride * height; LOG_DBG("cookie=%lx: allocating new buffer: %zu KB", cookie, size / 1024); - int err = posix_fallocate(pool_fd, 0, size); + int err = EINTR; + while (err == EINTR) + err = posix_fallocate(pool_fd, 0, size); if (err != 0) { static bool failure_logged = false; -- cgit v1.3 From 9d834bb43d349729568cc15de371535b3f78b33b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 1 Mar 2020 12:19:28 +0100 Subject: shm: log 'size' when failing to fallocate() --- shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shm.c') diff --git a/shm.c b/shm.c index ab717bd0..56395fab 100644 --- a/shm.c +++ b/shm.c @@ -133,7 +133,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie) if (!failure_logged) { failure_logged = true; - LOG_ERRNO_P("failed to fallocate", err); + LOG_ERRNO_P("failed to fallocate %zu bytes", err, size); } if (ftruncate(pool_fd, size) == -1) { -- cgit v1.3