summaryrefslogtreecommitdiff
path: root/gdk/wayland
diff options
context:
space:
mode:
authormyfreeweb <greg@unrelenting.technology>2018-06-19 14:49:18 +0000
committerMatthias Clasen <mclasen@redhat.com>2018-06-19 11:45:49 -0400
commita1bcbdd02af14406fb912dc16d789ba4a07dd4b8 (patch)
treeb8179464ae24e19051ce6a0aa044346563394224 /gdk/wayland
parentcbbb7604b6e0d66cb5b8b51d4ca28d56f412452d (diff)
downloadgtk+-a1bcbdd02af14406fb912dc16d789ba4a07dd4b8.tar.gz
wayland: Use shm_open(SHM_ANON) on FreeBSD
This functionality is similar to Linux's memfd. It creates anonymous shared memory without touching the filesystem, which allows it to work in Capsicum capability mode (sandbox).
Diffstat (limited to 'gdk/wayland')
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index b64f2f105b..f83dd45046 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -1210,6 +1210,9 @@ open_shared_memory (void)
if (force_shm_open)
{
+#if defined (__FreeBSD__)
+ ret = shm_open (SHM_ANON, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600);
+#else
char name[NAME_MAX - 1] = "";
sprintf (name, "/gdk-wayland-%x", g_random_int ());
@@ -1220,6 +1223,7 @@ open_shared_memory (void)
shm_unlink (name);
else if (errno == EEXIST)
continue;
+#endif
}
}
while (ret < 0 && errno == EINTR);