broadway backend: allow building on OpenBSD

On OpenBSD shm_open(3) is part of libc and there is not librt, so add an
according check.
Check if we have posix_fallocate before using it.

https://bugzilla.gnome.org/show_bug.cgi?id=728272
This commit is contained in:
Antoine Jacoutot
2014-04-18 00:59:45 +02:00
parent 2e1d0df1ed
commit be9d1e0b3b
3 changed files with 11 additions and 2 deletions

View File

@ -540,12 +540,14 @@ map_named_shm (char *name, gsize size)
res = ftruncate (fd, size);
g_assert (res != -1);
#ifdef HAVE_POSIX_FALLOCATE
res = posix_fallocate (fd, 0, size);
if (res != 0)
{
shm_unlink (name);
g_error ("Not enough shared memory for window surface");
}
#endif
ptr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);