[gtk/gtk-3-24: 1/2] wayland: Use shm_open(SHM_ANON) on FreeBSD
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 1/2] wayland: Use shm_open(SHM_ANON) on FreeBSD
- Date: Tue, 19 Jun 2018 15:46:19 +0000 (UTC)
commit 055c1b2faa2a43a053d80ad3e4aef4a4f4f9ea2e
Author: myfreeweb <greg@unrelenting.technology>
Date: Tue Jun 19 14:49:18 2018 +0000
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).
gdk/wayland/gdkdisplay-wayland.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index b4ef4485da..1e00f292d8 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -1276,6 +1276,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 ());
@@ -1286,6 +1289,7 @@ open_shared_memory (void)
shm_unlink (name);
else if (errno == EEXIST)
continue;
+#endif
}
}
while (ret < 0 && errno == EINTR);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]