mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-31 22:25:25 -04:00
os: use posix_fallocate in creating sharable buffers
If posix_fallocate is available, use it instead of ftruncate. Unlike ftruncate, when posix_fallocate succeeds, it guarantees that you cannot run out of disk space, when later writing to the mmap()'ed file. With posix_fallocate, if os_create_anonymous_file() succeeds, the program cannot get a SIGBUS later from accessing this file via mmap. If there is insufficient disk space, the function fails and errno is set to ENOSPC. This is useful on systems, that limit the available buffer space by having XDG_RUNTIME_DIR on a small tmpfs. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
5a019e38a1
commit
011b695403
2 changed files with 19 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ if test "x$GCC" = "xyes"; then
|
|||
fi
|
||||
AC_SUBST(GCC_CFLAGS)
|
||||
|
||||
AC_CHECK_FUNCS([accept4 mkostemp])
|
||||
AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate])
|
||||
|
||||
AC_CHECK_DECL(SFD_CLOEXEC,[],
|
||||
[AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland")],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue