mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
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).
This commit is contained in:
parent
cbbb7604b6
commit
a1bcbdd02a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user