Commit 36ce73bb authored by Greg V's avatar Greg V Committed by Emmanuel Gil Peyrot
Browse files

Wayland: use SHM_ANON on FreeBSD

This works like memfd on Linux.
parent 1d95acdf
......@@ -156,6 +156,9 @@ static int createAnonymousFile(off_t size)
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
}
else
#elif defined(SHM_ANON)
fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
if (fd < 0)
#endif
{
path = getenv("XDG_RUNTIME_DIR");
......@@ -175,7 +178,12 @@ static int createAnonymousFile(off_t size)
return -1;
}
#if defined(SHM_ANON)
// posix_fallocate does not work on SHM descriptors
ret = ftruncate(fd, size);
#else
ret = posix_fallocate(fd, 0, size);
#endif
if (ret != 0)
{
close(fd);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment