[gtk+] broadway: Ensure we allocate shm surface space early
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] broadway: Ensure we allocate shm surface space early
- Date: Wed, 3 Apr 2013 13:59:28 +0000 (UTC)
commit 8084e6e468bb026c427c0e6238683cab62df5e6b
Author: Alexander Larsson <alexl redhat com>
Date: Wed Apr 3 15:50:54 2013 +0200
broadway: Ensure we allocate shm surface space early
This is nicer then getting random sigbus later
gdk/broadway/gdkbroadway-server.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index adc28a0..f5df46a 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -582,6 +582,13 @@ _gdk_broadway_server_create_surface (int width,
res = ftruncate (fd, data->data_size);
g_assert (res != -1);
+ res = posix_fallocate (fd, 0, data->data_size);
+ if (res != 0)
+ {
+ shm_unlink (data->name);
+ g_error ("Not enough shared memory for window surface");
+ }
+
data->data = mmap(0, data->data_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
(void) close(fd);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]