mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 09:30:11 +01:00
util: fix os_create_anonymous_file on android
Commit fixes current crashes with Vulkan applications on Android. Fixes:c0376a1234"util: add anon_file.h for all memfd/temp file usage" Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> (cherry picked from commitce8fd042a5)
This commit is contained in:
parent
26ab4e1614
commit
52dc974cd1
1 changed files with 5 additions and 4 deletions
|
|
@ -36,15 +36,16 @@
|
|||
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/mman.h>
|
||||
#elif defined(HAVE_MEMFD_CREATE)
|
||||
#elif defined(HAVE_MEMFD_CREATE) || defined(ANDROID)
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/memfd.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(HAVE_MKOSTEMP))
|
||||
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(HAVE_MKOSTEMP) || defined(ANDROID))
|
||||
static int
|
||||
set_cloexec_or_close(int fd)
|
||||
{
|
||||
|
|
@ -68,7 +69,7 @@ err:
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE))
|
||||
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(ANDROID))
|
||||
static int
|
||||
create_tmpfile_cloexec(char *tmpname)
|
||||
{
|
||||
|
|
@ -118,7 +119,7 @@ os_create_anonymous_file(off_t size, const char *debug_name)
|
|||
#ifdef __FreeBSD__
|
||||
(void*)debug_name;
|
||||
fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600);
|
||||
#elif defined(HAVE_MEMFD_CREATE)
|
||||
#elif defined(HAVE_MEMFD_CREATE) || defined(ANDROID)
|
||||
if (!debug_name)
|
||||
debug_name = "mesa-shared";
|
||||
fd = syscall(SYS_memfd_create, debug_name, MFD_CLOEXEC);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue