mirror of
https://github.com/glfw/glfw.git
synced 2024-11-12 17:51:48 +00:00
Wayland: use SHM_ANON on FreeBSD
This works like memfd on Linux.
This commit is contained in:
parent
1d95acdf56
commit
36ce73bbfd
@ -156,6 +156,9 @@ static int createAnonymousFile(off_t size)
|
|||||||
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
|
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#elif defined(SHM_ANON)
|
||||||
|
fd = shm_open(SHM_ANON, O_RDWR | O_CLOEXEC, 0600);
|
||||||
|
if (fd < 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
path = getenv("XDG_RUNTIME_DIR");
|
path = getenv("XDG_RUNTIME_DIR");
|
||||||
@ -175,7 +178,12 @@ static int createAnonymousFile(off_t size)
|
|||||||
return -1;
|
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);
|
ret = posix_fallocate(fd, 0, size);
|
||||||
|
#endif
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
Reference in New Issue
Block a user